/* Initialize the locking library. Returns 0 if the operation was successful, EINVAL if the operation table was invalid and EBUSY if we already were initialized. */ gpg_err_code_t ath_install (struct ath_ops *ath_ops, int check_only) { if (check_only) { unsigned int option = 0; /* Check if the requested thread option is compatible to the thread option we are already committed to. */ if (ath_ops) option = ath_ops->option; if (!ops_set && GET_OPTION (option)) return GPG_ERR_NOT_SUPPORTED; if (GET_OPTION (ops.option) == ATH_THREAD_OPTION_USER || GET_OPTION (option) == ATH_THREAD_OPTION_USER || GET_OPTION (ops.option) != GET_OPTION (option) || GET_VERSION (ops.option) != GET_VERSION (option)) return GPG_ERR_NOT_SUPPORTED; return 0; } if (ath_ops) { /* It is convenient to not require DESTROY. */ if (!ath_ops->mutex_init || !ath_ops->mutex_lock || !ath_ops->mutex_unlock) return GPG_ERR_INV_ARG; ops = *ath_ops; ops_set = 1; } else ops_set = 0; return 0; }
/***************************************************************************** * OpenFilter: probe the filter and return score *****************************************************************************/ static int OpenFilter( vlc_object_t *p_this ) { filter_t *p_filter = (filter_t*)p_this; filter_sys_t *p_sys; if( !p_filter->b_allow_fmt_out_change ) { msg_Err( p_filter, "Picture format change isn't allowed" ); return VLC_EGENERIC; } if( p_filter->fmt_in.video.i_chroma != p_filter->fmt_out.video.i_chroma ) { msg_Err( p_filter, "Input and output chromas don't match" ); /* In fact we don't really care about this since we're allowed * to change the output format ... FIXME? */ return VLC_EGENERIC; } const vlc_chroma_description_t *p_chroma = vlc_fourcc_GetChromaDescription( p_filter->fmt_in.video.i_chroma ); if( p_chroma == NULL || p_chroma->plane_count == 0 ) return VLC_EGENERIC; p_filter->p_sys = (filter_sys_t *)malloc( sizeof( filter_sys_t ) ); if( !p_filter->p_sys ) return VLC_ENOMEM; config_ChainParse( p_filter, CFG_PREFIX, ppsz_filter_options, p_filter->p_cfg ); p_sys = p_filter->p_sys; #define GET_OPTION( name ) \ p_sys->i_ ## name = var_CreateGetInteger( p_filter, CFG_PREFIX #name ); \ if( p_sys->i_ ## name & 1 ) \ msg_Warn( p_filter, "Using even values for `" #name "' is recommended" ); GET_OPTION( croptop ) GET_OPTION( cropbottom ) GET_OPTION( cropleft ) GET_OPTION( cropright ) GET_OPTION( paddtop ) GET_OPTION( paddbottom ) GET_OPTION( paddleft ) GET_OPTION( paddright ) p_filter->fmt_out.video.i_height = p_filter->fmt_out.video.i_visible_height = p_filter->fmt_in.video.i_visible_height - p_sys->i_croptop - p_sys->i_cropbottom + p_sys->i_paddtop + p_sys->i_paddbottom; p_filter->fmt_out.video.i_width = p_filter->fmt_out.video.i_visible_width = p_filter->fmt_in.video.i_visible_width - p_sys->i_cropleft - p_sys->i_cropright + p_sys->i_paddleft + p_sys->i_paddright; p_filter->pf_video_filter = Filter; msg_Dbg( p_filter, "Crop: Top: %d, Bottom: %d, Left: %d, Right: %d", p_sys->i_croptop, p_sys->i_cropbottom, p_sys->i_cropleft, p_sys->i_cropright ); msg_Dbg( p_filter, "Padd: Top: %d, Bottom: %d, Left: %d, Right: %d", p_sys->i_paddtop, p_sys->i_paddbottom, p_sys->i_paddleft, p_sys->i_paddright ); msg_Dbg( p_filter, "%dx%d -> %dx%d", p_filter->fmt_in.video.i_width, p_filter->fmt_in.video.i_height, p_filter->fmt_out.video.i_width, p_filter->fmt_out.video.i_height ); return VLC_SUCCESS; }
int video_get_params (struct ctfb_res_modes *pPar, char *penv) { char *p, *s, *val_s; int i = 0, t; int bpp; int mode; /* first search for the environment containing the real param string */ s = penv; if ((p = getenv (s)) != NULL) { s = p; } /* in case of the bootargs line, we have to start * after "video=ctfb:" */ i = video_search_param (s, "video=ctfb:"); if (i >= 0) { s += i; s += strlen ("video=ctfb:"); } /* search for mode as a default value */ p = s; t = 0; mode = 0; /* default */ while ((i = video_get_param_len (p, ',')) != 0) { GET_OPTION ("mode:", mode) p += i; if (*p != 0) p++; /* skip ',' */ } if (mode >= RES_MODES_COUNT) mode = 0; *pPar = res_mode_init[mode]; /* copy default values */ bpp = 24 - ((mode % 3) * 8); p = s; /* restart */ while ((i = video_get_param_len (p, ',')) != 0) { GET_OPTION ("x:", pPar->xres) GET_OPTION ("y:", pPar->yres) GET_OPTION ("le:", pPar->left_margin) GET_OPTION ("ri:", pPar->right_margin) GET_OPTION ("up:", pPar->upper_margin) GET_OPTION ("lo:", pPar->lower_margin) GET_OPTION ("hs:", pPar->hsync_len) GET_OPTION ("vs:", pPar->vsync_len) GET_OPTION ("sync:", pPar->sync) GET_OPTION ("vmode:", pPar->vmode) GET_OPTION ("pclk:", pPar->pixclock) GET_OPTION ("depth:", bpp) p += i; if (*p != 0) p++; /* skip ',' */ } return bpp; }