这篇教程C++ var_CreateGetInteger函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中var_CreateGetInteger函数的典型用法代码示例。如果您正苦于以下问题:C++ var_CreateGetInteger函数的具体用法?C++ var_CreateGetInteger怎么用?C++ var_CreateGetInteger使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了var_CreateGetInteger函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: Create/***************************************************************************** * Create: initialize and set pf_video_filter() *****************************************************************************/static int Create( vlc_object_t *p_this ){ filter_t *p_filter = (filter_t *)p_this; filter_sys_t *p_sys; 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; config_ChainParse( p_filter, CFG_PREFIX, ppsz_vfilter_options, p_filter->p_cfg ); p_filter->p_sys = p_sys = calloc( 1, sizeof( filter_sys_t ) ); if( p_filter->p_sys == NULL ) return VLC_ENOMEM; p_sys->p_image = image_HandlerCreate( p_this ); if( !p_sys->p_image ) { msg_Err( p_this, "Couldn't get handle to image conversion routines." ); free( p_sys ); return VLC_EGENERIC; } p_sys->psz_format = var_CreateGetString( p_this, CFG_PREFIX "format" ); p_sys->i_format = image_Type2Fourcc( p_sys->psz_format ); if( !p_sys->i_format ) { msg_Err( p_filter, "Could not find FOURCC for image type '%s'", p_sys->psz_format ); image_HandlerDelete( p_sys->p_image ); free( p_sys->psz_format ); free( p_sys ); return VLC_EGENERIC; } p_sys->i_width = var_CreateGetInteger( p_this, CFG_PREFIX "width" ); p_sys->i_height = var_CreateGetInteger( p_this, CFG_PREFIX "height" ); p_sys->i_ratio = var_CreateGetInteger( p_this, CFG_PREFIX "ratio" ); if( p_sys->i_ratio <= 0) p_sys->i_ratio = 1; p_sys->b_replace = var_CreateGetBool( p_this, CFG_PREFIX "replace" ); p_sys->psz_prefix = var_CreateGetString( p_this, CFG_PREFIX "prefix" ); p_sys->psz_path = var_GetNonEmptyString( p_this, CFG_PREFIX "path" ); if( p_sys->psz_path == NULL ) p_sys->psz_path = config_GetUserDir( VLC_PICTURES_DIR ); p_filter->pf_video_filter = Filter; return VLC_SUCCESS;}
开发者ID:AsamQi,项目名称:vlc,代码行数:54,
示例2: OpenDecoder/***************************************************************************** * OpenDecoder: probe the decoder and return score ***************************************************************************** * Tries to launch a decoder and return score so that the interface is able * to chose. *****************************************************************************/static int OpenDecoder( vlc_object_t *p_this ){ decoder_t *p_dec = (decoder_t*)p_this; decoder_sys_t *p_sys; if( p_dec->fmt_in.i_codec != VLC_CODEC_USF ) return VLC_EGENERIC; /* Allocate the memory needed to store the decoder's structure */ if( ( p_dec->p_sys = p_sys = calloc(1, sizeof(decoder_sys_t)) ) == NULL ) return VLC_ENOMEM; p_dec->pf_decode_sub = DecodeBlock; p_dec->fmt_out.i_cat = SPU_ES; p_dec->fmt_out.i_codec = 0; /* init of p_sys */ TAB_INIT( p_sys->i_ssa_styles, p_sys->pp_ssa_styles ); TAB_INIT( p_sys->i_images, p_sys->pp_images ); /* USF subtitles are mandated to be UTF-8, so don't need vlc_iconv */ p_sys->i_align = var_CreateGetInteger( p_dec, "subsdec-align" ); ParseImageAttachments( p_dec ); if( var_CreateGetBool( p_dec, "subsdec-formatted" ) ) { if( p_dec->fmt_in.i_extra > 0 ) ParseUSFHeader( p_dec ); } return VLC_SUCCESS;}
开发者ID:9034725985,项目名称:vlc,代码行数:40,
示例3: Open/***************************************************************************** * Open: initialize and create stuff *****************************************************************************/static int Open( vlc_object_t *p_this ){ filter_t *p_filter = (filter_t*)p_this; unsigned i_channels; filter_sys_t *p_sys; i_channels = aout_FormatNbChannels( &p_filter->fmt_in.audio ); p_sys = p_filter->p_sys = (filter_sys_t *)malloc( sizeof( *p_sys ) ); // sunqueen modify if( !p_sys ) return VLC_ENOMEM; p_sys->i_nb = var_CreateGetInteger( p_filter->p_parent, "norm-buff-size" ); p_sys->f_max = var_CreateGetFloat( p_filter->p_parent, "norm-max-level" ); if( p_sys->f_max <= 0 ) p_sys->f_max = 0.01; /* We need to store (nb_buffers+1)*nb_channels floats */ p_sys->p_last = (float *)calloc( i_channels * (p_filter->p_sys->i_nb + 2), sizeof(float) ); // sunqueen modify if( !p_sys->p_last ) { free( p_sys ); return VLC_ENOMEM; } p_filter->fmt_in.audio.i_format = VLC_CODEC_FL32; p_filter->fmt_out.audio = p_filter->fmt_in.audio; p_filter->pf_audio_filter = DoWork; return VLC_SUCCESS;}
开发者ID:Aki-Liang,项目名称:vlc-2.1.0.oldlib-2010,代码行数:33,
示例4: Overflow/** * Log a message */static void Overflow (msg_cb_data_t *p_sys, msg_item_t *p_item, unsigned overruns){ VLC_UNUSED(overruns); int verbosity = var_CreateGetInteger( p_sys->p_intf, "verbose" ); int priority = 0; switch( p_item->i_type ) { case VLC_MSG_WARN: priority = 1; break; case VLC_MSG_DBG: priority = 2; break; } if (verbosity < priority) return; int canc = vlc_savecancel(); switch( p_sys->i_mode ) { case MODE_HTML: HtmlPrint( p_item, p_sys->p_file ); break;#ifdef HAVE_SYSLOG_H case MODE_SYSLOG: SyslogPrint( p_item ); break;#endif case MODE_TEXT: default: TextPrint( p_item, p_sys->p_file ); break; } vlc_restorecancel( canc );}
开发者ID:shanewfx,项目名称:vlc-arib,代码行数:37,
示例5: Open/** * Open() */static int Open (vlc_object_t *obj){ access_t *access = (access_t*)obj; access_t *src = access->p_source; if (src->pf_read != NULL) access->pf_read = Read; else { msg_Err (obj, "block bandwidth limit not implemented"); return VLC_EGENERIC; } if (src->pf_seek != NULL) access->pf_seek = Seek; access->pf_control = Control; access->info = src->info; access_sys_t *p_sys = access->p_sys = calloc( 1, sizeof (*p_sys) ); if( !p_sys ) return VLC_ENOMEM; p_sys->bandwidth = var_CreateGetInteger (access, "access-bandwidth"); p_sys->last_time = mdate (); msg_Dbg (obj, "bandwidth limit: %lu bytes/s", (unsigned long)p_sys->bandwidth); return VLC_SUCCESS;}
开发者ID:FLYKingdom,项目名称:vlc,代码行数:33,
示例6: Open/** * Open the module * @param p_this: the filter object * @return VLC_SUCCESS or vlc error codes */static int Open( vlc_object_t * p_this ){ filter_t *p_filter = (filter_t *)p_this; filter_sys_t *p_sys; p_sys = p_filter->p_sys = (filter_sys_t*)malloc( sizeof( *p_sys ) ); if( !p_sys ) return VLC_ENOMEM; /* Create the object for the thread */ p_sys->b_quit = false; p_sys->i_channels = aout_FormatNbChannels( &p_filter->fmt_in.audio ); vlc_mutex_init( &p_sys->lock ); p_sys->p_buffer = NULL; p_sys->i_buffer_size = 0; p_sys->i_nb_samples = 0; /* Create the OpenGL context */ vout_window_cfg_t cfg; memset(&cfg, 0, sizeof (cfg)); cfg.width = var_CreateGetInteger( p_filter, "projectm-width" ); cfg.height = var_CreateGetInteger( p_filter, "projectm-height" ); p_sys->gl = vlc_gl_surface_Create( VLC_OBJECT(p_filter), &cfg, NULL ); if( p_sys->gl == NULL ) goto error; /* Create the thread */ if( vlc_clone( &p_sys->thread, Thread, p_filter, VLC_THREAD_PRIORITY_LOW ) ) { vlc_gl_surface_Destroy( p_sys->gl ); goto error; } p_filter->fmt_in.audio.i_format = VLC_CODEC_FL32; p_filter->fmt_out.audio = p_filter->fmt_in.audio; p_filter->pf_audio_filter = DoWork; return VLC_SUCCESS;error: vlc_mutex_destroy( &p_sys->lock ); free (p_sys ); return VLC_EGENERIC;}
开发者ID:0xheart0,项目名称:vlc,代码行数:51,
示例7: Setupstatic int Setup( vlc_va_t *p_external, void **pp_hw_ctx, vlc_fourcc_t *pi_chroma, int i_width, int i_height ){ vlc_va_vda_t *p_va = vlc_va_vda_Get( p_external ); if( p_va->hw_ctx.width == i_width && p_va->hw_ctx.height == i_height && p_va->hw_ctx.decoder ) { *pp_hw_ctx = &p_va->hw_ctx; *pi_chroma = p_va->i_chroma; return VLC_SUCCESS; } if( p_va->hw_ctx.decoder ) { ff_vda_destroy_decoder( &p_va->hw_ctx ); goto ok; } memset( &p_va->hw_ctx, 0, sizeof(p_va->hw_ctx) ); p_va->hw_ctx.width = i_width; p_va->hw_ctx.height = i_height; p_va->hw_ctx.format = 'avc1'; int i_pix_fmt = var_CreateGetInteger( p_va->p_log, "avcodec-vda-pix-fmt" ); switch( i_pix_fmt ) { case 1 : p_va->hw_ctx.cv_pix_fmt_type = kCVPixelFormatType_422YpCbCr8; p_va->i_chroma = VLC_CODEC_UYVY; break; case 0 : default : p_va->hw_ctx.cv_pix_fmt_type = kCVPixelFormatType_420YpCbCr8Planar; p_va->i_chroma = VLC_CODEC_I420; CopyInitCache( &p_va->image_cache, i_width ); }ok: /* Setup the ffmpeg hardware context */ *pp_hw_ctx = &p_va->hw_ctx; *pi_chroma = p_va->i_chroma; /* create the decoder */ int status = ff_vda_create_decoder( &p_va->hw_ctx, p_va->p_extradata, p_va->i_extradata ); if( status ) { msg_Err( p_va->p_log, "Failed to create the decoder : %i", status ); return VLC_EGENERIC; } return VLC_SUCCESS;}
开发者ID:brendonjustin,项目名称:vlc,代码行数:58,
示例8: OpenCommon/** * Common open function */static int OpenCommon(vlc_object_t *p_this, bool b_sub){ filter_t *p_filter = (filter_t *)p_this; filter_sys_t *p_sys; /* */ if (!b_sub && !es_format_IsSimilar(&p_filter->fmt_in, &p_filter->fmt_out)) { msg_Err(p_filter, "Input and output format does not match"); return VLC_EGENERIC; } /* */ p_filter->p_sys = p_sys = malloc(sizeof(*p_sys)); if (!p_sys) return VLC_ENOMEM; /* */ p_sys->p_blend = NULL; if (!b_sub) { p_sys->p_blend = filter_NewBlend(VLC_OBJECT(p_filter), &p_filter->fmt_in.video); if (!p_sys->p_blend) { free(p_sys); return VLC_EGENERIC; } } /* */ config_ChainParse(p_filter, CFG_PREFIX, ppsz_filter_options, p_filter->p_cfg); /* create and initialize variables */ p_sys->i_pos = var_CreateGetInteger(p_filter, CFG_PREFIX "position"); p_sys->i_pos_x = var_CreateGetInteger(p_filter, CFG_PREFIX "x"); p_sys->i_pos_y = var_CreateGetInteger(p_filter, CFG_PREFIX "y"); BarGraph_t *p_BarGraph = &p_sys->p_BarGraph; p_BarGraph->p_pic = NULL; p_BarGraph->i_alpha = var_CreateGetInteger(p_filter, CFG_PREFIX "transparency"); p_BarGraph->i_alpha = VLC_CLIP(p_BarGraph->i_alpha, 0, 255); p_BarGraph->i_values = NULL; parse_i_values(p_BarGraph, &(char){ 0 });
开发者ID:videolan,项目名称:vlc,代码行数:45,
示例9: CreateFilter/***************************************************************************** * CreateFilter: allocates marquee video filter *****************************************************************************/static int CreateFilter( vlc_object_t *p_this ){ filter_t *p_filter = (filter_t *)p_this; filter_sys_t *p_sys; vlc_object_t *p_pl; /* Allocate structure */ p_sys = p_filter->p_sys = malloc( sizeof( filter_sys_t ) ); if( p_sys == NULL ) { msg_Err( p_filter, "out of memory" ); return VLC_ENOMEM; } /* hook to the playlist */ p_pl = vlc_object_find( p_this, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ); if( !p_pl ) { return VLC_ENOOBJ; }/* p_access->p_libvlc p_demux->p_libvlc */ p_sys->i_xoff = var_CreateGetInteger( p_pl , "marq-x" ); p_sys->i_yoff = var_CreateGetInteger( p_pl , "marq-y" ); p_sys->i_timeout = var_CreateGetInteger( p_pl , "marq-timeout" ); p_sys->psz_marquee = var_CreateGetString( p_pl, "marq-marquee" ); var_AddCallback( p_pl, "marq-x", MarqueeCallback, p_sys ); var_AddCallback( p_pl, "marq-y", MarqueeCallback, p_sys ); var_AddCallback( p_pl, "marq-marquee", MarqueeCallback, p_sys ); var_AddCallback( p_pl, "marq-timeout", MarqueeCallback, p_sys ); vlc_object_release( p_pl ); /* Misc init */ p_filter->pf_sub_filter = Filter; p_sys->last_time = ((time_t)-1); p_sys->b_need_update = VLC_TRUE; return VLC_SUCCESS;}
开发者ID:forthyen,项目名称:SDesk,代码行数:44,
示例10: Open/***************************************************************************** * Open: initialize and create stuff *****************************************************************************/static int Open( vlc_object_t *p_this ){ aout_filter_t *p_filter = (aout_filter_t*)p_this; bool b_fit = true; int i_channels; aout_filter_sys_t *p_sys; if( p_filter->fmt_in.audio.i_format != VLC_CODEC_FL32 || p_filter->fmt_out.audio.i_format != VLC_CODEC_FL32 ) { b_fit = false; p_filter->fmt_in.audio.i_format = VLC_CODEC_FL32; p_filter->fmt_out.audio.i_format = VLC_CODEC_FL32; msg_Warn( p_filter, "bad input or output format" ); } if ( !AOUT_FMTS_SIMILAR( &p_filter->fmt_in.audio, &p_filter->fmt_out.audio ) ) { b_fit = false; memcpy( &p_filter->fmt_out.audio, &p_filter->fmt_in.audio, sizeof(audio_sample_format_t) ); msg_Warn( p_filter, "input and output formats are not similar" ); } if ( ! b_fit ) { return VLC_EGENERIC; } p_filter->pf_do_work = DoWork; p_filter->b_in_place = true; i_channels = aout_FormatNbChannels( &p_filter->fmt_in.audio ); p_sys = p_filter->p_sys = malloc( sizeof( aout_filter_sys_t ) ); if( !p_sys ) return VLC_ENOMEM; p_sys->i_nb = var_CreateGetInteger( p_filter->p_parent, "norm-buff-size" ); p_sys->f_max = var_CreateGetFloat( p_filter->p_parent, "norm-max-level" ); if( p_sys->f_max <= 0 ) p_sys->f_max = 0.01; /* We need to store (nb_buffers+1)*nb_channels floats */ p_sys->p_last = calloc( i_channels * (p_filter->p_sys->i_nb + 2), sizeof(float) ); if( !p_sys->p_last ) { free( p_sys ); return VLC_ENOMEM; } return VLC_SUCCESS;}
开发者ID:shanewfx,项目名称:vlc-arib,代码行数:55,
示例11: Create/***************************************************************************** * Create: allocates omapfb video thread output method ***************************************************************************** * This function allocates and initializes a FB vout method. *****************************************************************************/static int Create( vlc_object_t *p_this ){ vout_thread_t *p_vout = (vout_thread_t *)p_this; vout_sys_t *p_sys; if( p_vout->fmt_in.i_chroma != VLC_CODEC_I420 && p_vout->fmt_in.i_chroma != VLC_CODEC_YV12 ) return VLC_EGENERIC; /* Allocate instance and initialize some members */ p_vout->p_sys = p_sys = calloc( 1, sizeof( vout_sys_t ) ); if( p_vout->p_sys == NULL ) return VLC_ENOMEM; p_vout->pf_init = Init; p_vout->pf_end = End; p_vout->pf_manage = Manage; p_vout->pf_render = NULL; p_vout->pf_display = DisplayVideo; p_vout->pf_control = Control; p_sys->b_embed = var_CreateGetInteger( p_vout, "omap-embedded" ); p_sys->b_video_enabled = true; if( OpenDisplay( p_vout ) ) { free( p_vout->p_sys ); return VLC_EGENERIC; } if( InitWindow( p_vout ) ) { free( p_vout->p_sys ); return VLC_EGENERIC; }#ifdef HAVE_OSSO p_vout->p_sys->i_backlight_on_counter = i_backlight_on_interval; p_vout->p_sys->p_octx = osso_initialize( "vlc", VERSION, 0, NULL ); if ( p_vout->p_sys->p_octx == NULL ) { msg_Err( p_vout, "Could not get osso context" ); } else { msg_Dbg( p_vout, "Initialized osso context" ); }#endif return VLC_SUCCESS;}
开发者ID:Kafay,项目名称:vlc,代码行数:53,
示例12: Open/** * Open() */static int Open (vlc_object_t *obj){ access_t *access = (access_t*)obj; access_t *src = access->p_source; if (!var_CreateGetBool (access, "dump-force")) { bool b; if ((access_Control (src, ACCESS_CAN_FASTSEEK, &b) == 0) && b) { msg_Dbg (obj, "dump filter useless"); return VLC_EGENERIC; } } if (src->pf_read != NULL) access->pf_read = Read; else access->pf_block = Block; if (src->pf_seek != NULL) access->pf_seek = Seek; access->pf_control = Control; access->info = src->info; access_sys_t *p_sys = access->p_sys = calloc( 1, sizeof (*p_sys) ); if( !p_sys ) return VLC_ENOMEM;# ifndef UNDER_CE if ((p_sys->stream = tmpfile ()) == NULL)# else char buf[75]; if(GetTempFileName("//Temp//","vlc",0,buf) || ((p_sys->stream = fopen(buf,"wb+")) ==NULL))#endif { msg_Err (access, "cannot create temporary file: %m"); free (p_sys); return VLC_EGENERIC; } p_sys->tmp_max = ((int64_t)var_CreateGetInteger (access, "dump-margin")) << 20; var_AddCallback (access->p_libvlc, "key-action", KeyHandler, access); return VLC_SUCCESS;}
开发者ID:squadette,项目名称:vlc,代码行数:49,
示例13: var_CreateGetInteger/***************************************************************************** * vout_RequestWindow: Create/Get a video window if possible. ***************************************************************************** * This function looks for the main interface and tries to request * a new video window. If it fails then the vout will still need to create the * window by itself. *****************************************************************************/void *vout_RequestWindow( vout_thread_t *p_vout, int *pi_x_hint, int *pi_y_hint, unsigned int *pi_width_hint, unsigned int *pi_height_hint ){ /* Small kludge */ if( !var_Type( p_vout, "aspect-ratio" ) ) vout_IntfInit( p_vout ); /* Get requested coordinates */ *pi_x_hint = var_GetInteger( p_vout, "video-x" ); *pi_y_hint = var_GetInteger( p_vout, "video-y" ); *pi_width_hint = p_vout->i_window_width; *pi_height_hint = p_vout->i_window_height; /* Check whether someone provided us with a window ID */ int drawable = var_CreateGetInteger( p_vout, "drawable" ); if( drawable ) return (void *)(intptr_t)drawable; vout_window_t *wnd = vlc_custom_create (VLC_OBJECT(p_vout), sizeof (*wnd), VLC_OBJECT_GENERIC, "window"); if (wnd == NULL) return NULL; wnd->vout = p_vout; wnd->width = *pi_width_hint; wnd->height = *pi_height_hint; wnd->pos_x = *pi_x_hint; wnd->pos_y = *pi_y_hint; vlc_object_attach (wnd, p_vout); wnd->module = module_Need (wnd, "vout window", 0, 0); if (wnd->module == NULL) { msg_Dbg (wnd, "no window provider available"); vlc_object_release (wnd); return NULL; } p_vout->p_window = wnd; *pi_width_hint = wnd->width; *pi_height_hint = wnd->height; *pi_x_hint = wnd->pos_x; *pi_y_hint = wnd->pos_y; return wnd->handle;}
开发者ID:mahaserver,项目名称:MHSVLC,代码行数:52,
示例14: Open/***************************************************************************** * Open: initializes demux structures *****************************************************************************/static int Open( vlc_object_t * p_this ){ demux_t *p_demux = (demux_t*)p_this; demux_sys_t *p_sys; const uint8_t *p_peek; es_format_t fmt; if( stream_Peek( p_demux->s, &p_peek, 5 ) < 5 ) return VLC_EGENERIC; if( p_peek[0] != 'B' || p_peek[1] != 'B' || p_peek[2] != 'C' || p_peek[3] != 'D') /* start of ParseInfo */ { if( !p_demux->b_force ) return VLC_EGENERIC; msg_Err( p_demux, "This doesn't look like a Dirac stream (incorrect parsecode)" ); msg_Warn( p_demux, "continuing anyway" ); } p_demux->pf_demux = Demux; p_demux->pf_control = Control; p_demux->p_sys = p_sys = (demux_sys_t *)calloc( 1, sizeof( demux_sys_t ) ); // sunqueen modify if( !p_sys ) return VLC_ENOMEM; p_sys->i_pts_offset_lowtide = INT64_MAX; p_sys->i_state = DIRAC_DEMUX_FIRST; p_sys->i_dtsoffset = var_CreateGetInteger( p_demux, DEMUX_CFG_PREFIX DEMUX_DTSOFFSET ); /* Load the packetizer */ es_format_Init( &fmt, VIDEO_ES, VLC_CODEC_DIRAC ); p_sys->p_packetizer = demux_PacketizerNew( p_demux, &fmt, "dirac" ); if( !p_sys->p_packetizer ) { free( p_sys ); return VLC_EGENERIC; } return VLC_SUCCESS;}
开发者ID:12307,项目名称:VLC-for-VS2010,代码行数:42,
示例15: vout_OpenWrapperint vout_OpenWrapper(vout_thread_t *vout, const char *splitter_name, const vout_display_state_t *state){ vout_thread_sys_t *sys = vout->p; msg_Dbg(vout, "Opening vout display wrapper"); /* */ sys->display.title = var_CreateGetNonEmptyString(vout, "video-title"); /* */ const mtime_t double_click_timeout = 300000; const mtime_t hide_timeout = var_CreateGetInteger(vout, "mouse-hide-timeout") * 1000; if (splitter_name) { sys->display.vd = vout_NewSplitter(vout, &vout->p->original, state, "$vout", splitter_name, double_click_timeout, hide_timeout); } else { sys->display.vd = vout_NewDisplay(vout, &vout->p->original, state, "$vout", double_click_timeout, hide_timeout); } if (!sys->display.vd) { free(sys->display.title); return VLC_EGENERIC; } /* */#ifdef WIN32 var_Create(vout, "direct3d-desktop", VLC_VAR_BOOL|VLC_VAR_DOINHERIT); var_AddCallback(vout, "direct3d-desktop", Forward, NULL); var_Create(vout, "video-wallpaper", VLC_VAR_BOOL|VLC_VAR_DOINHERIT); var_AddCallback(vout, "video-wallpaper", Forward, NULL);#endif /* */ sys->decoder_pool = NULL; return VLC_SUCCESS;}
开发者ID:banketree,项目名称:faplayer,代码行数:38,
示例16: Activatestatic int Activate( vlc_object_t *p_this ){ filter_t *p_filter = (filter_t *)p_this; unsigned i_canvas_width; /* width of output canvas */ unsigned i_canvas_height; /* height of output canvas */ unsigned i_canvas_aspect; /* canvas PictureAspectRatio */ es_format_t fmt; /* target format after up/down conversion */ char psz_croppadd[100]; int i_padd,i_offset; char *psz_aspect, *psz_parser; bool b_padd; unsigned i_fmt_in_aspect; 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" ); return VLC_EGENERIC; } config_ChainParse( p_filter, CFG_PREFIX, ppsz_filter_options, p_filter->p_cfg ); i_canvas_width = var_CreateGetInteger( p_filter, CFG_PREFIX "width" ); i_canvas_height = var_CreateGetInteger( p_filter, CFG_PREFIX "height" ); if( i_canvas_width == 0 || i_canvas_height == 0 ) { msg_Err( p_filter, "Width and height options must be set" ); return VLC_EGENERIC; } if( i_canvas_width & 1 || i_canvas_height & 1 ) { /* If this restriction were ever relaxed, it is very important to * get the field polatiry correct */ msg_Err( p_filter, "Width and height options must be even integers" ); return VLC_EGENERIC; } i_fmt_in_aspect = (int64_t)p_filter->fmt_in.video.i_sar_num * p_filter->fmt_in.video.i_width * VOUT_ASPECT_FACTOR / p_filter->fmt_in.video.i_sar_den / p_filter->fmt_in.video.i_height; psz_aspect = var_CreateGetNonEmptyString( p_filter, CFG_PREFIX "aspect" ); if( psz_aspect ) { psz_parser = strchr( psz_aspect, ':' ); int numerator = atoi( psz_aspect ); int denominator = psz_parser ? atoi( psz_parser+1 ) : 0; denominator = denominator == 0 ? 1 : denominator; i_canvas_aspect = numerator * VOUT_ASPECT_FACTOR / denominator; free( psz_aspect ); if( numerator <= 0 || denominator < 0 ) { msg_Err( p_filter, "Aspect ratio must be strictly positive" ); return VLC_EGENERIC; } } else { /* if there is no user supplied aspect ratio, assume the canvas * has the same sample aspect ratio as the subpicture */ /* aspect = subpic_sar * canvas_width / canvas_height * where subpic_sar = subpic_ph * subpic_par / subpic_pw */ i_canvas_aspect = (uint64_t) p_filter->fmt_in.video.i_height * i_fmt_in_aspect * i_canvas_width / (i_canvas_height * p_filter->fmt_in.video.i_width); } b_padd = var_CreateGetBool( p_filter, CFG_PREFIX "padd" ); filter_sys_t *p_sys = (filter_sys_t *)malloc( sizeof( filter_sys_t ) ); if( !p_sys ) return VLC_ENOMEM; p_filter->p_sys = p_sys; p_sys->p_chain = filter_chain_New( p_filter, "video filter2", true, alloc_init, NULL, p_filter ); if( !p_sys->p_chain ) { msg_Err( p_filter, "Could not allocate filter chain" ); free( p_sys ); return VLC_EGENERIC; } es_format_Copy( &fmt, &p_filter->fmt_in ); /* one dimension will end up with one of the following: */ fmt.video.i_width = i_canvas_width; fmt.video.i_height = i_canvas_height;//.........这里部分代码省略.........
开发者ID:12307,项目名称:VLC-for-VS2010,代码行数:101,
示例17: Open/***************************************************************************** * Open: *****************************************************************************/static int Open( vlc_object_t *p_this ){ demux_t *p_demux = (demux_t*)p_this; demux_sys_t *p_sys; char *psz_file; ifo_handle_t *p_vmg_file; if( !p_demux->psz_path || !*p_demux->psz_path ) { /* Only when selected */ if( !p_demux->psz_access || !*p_demux->psz_access ) return VLC_EGENERIC; psz_file = var_InheritString( p_this, "dvd" ); } else psz_file = strdup( p_demux->psz_path );#ifdef WIN32 if( psz_file != NULL ) { size_t flen = strlen( psz_file ); if( flen > 0 && psz_file[flen - 1] == '//' ) psz_file[flen - 1] = '/0'; } else psz_file = strdup("");#endif if( unlikely(psz_file == NULL) ) return VLC_EGENERIC; /* Open dvdread */ const char *psz_path = ToLocale( psz_file ); dvd_reader_t *p_dvdread = DVDOpen( psz_path ); LocaleFree( psz_path ); if( p_dvdread == NULL ) { msg_Err( p_demux, "DVDRead cannot open source: %s", psz_file ); dialog_Fatal( p_demux, _("Playback failure"), _("DVDRead could not open the disc /"%s/"."), psz_file ); free( psz_file ); return VLC_EGENERIC; } free( psz_file ); /* Ifo allocation & initialisation */ if( !( p_vmg_file = ifoOpen( p_dvdread, 0 ) ) ) { msg_Warn( p_demux, "cannot open VMG info" ); return VLC_EGENERIC; } msg_Dbg( p_demux, "VMG opened" ); /* Fill p_demux field */ DEMUX_INIT_COMMON(); p_sys = p_demux->p_sys; ps_track_init( p_sys->tk ); p_sys->i_sar_num = 0; p_sys->i_sar_den = 0; p_sys->i_title_cur_time = (mtime_t) 0; p_sys->i_cell_cur_time = (mtime_t) 0; p_sys->i_cell_duration = (mtime_t) 0; p_sys->p_dvdread = p_dvdread; p_sys->p_vmg_file = p_vmg_file; p_sys->p_title = NULL; p_sys->p_vts_file = NULL; p_sys->i_title = p_sys->i_chapter = -1; p_sys->i_mux_rate = 0; p_sys->i_angle = var_CreateGetInteger( p_demux, "dvdread-angle" ); if( p_sys->i_angle <= 0 ) p_sys->i_angle = 1; DemuxTitles( p_demux, &p_sys->i_angle ); if( DvdReadSetArea( p_demux, 0, 0, p_sys->i_angle ) != VLC_SUCCESS ) { Close( p_this ); msg_Err( p_demux, "DvdReadSetArea(0,0,%i) failed (can't decrypt DVD?)", p_sys->i_angle ); return VLC_EGENERIC; } /* Update default_pts to a suitable value for dvdread access */ var_Create( p_demux, "dvdread-caching", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT ); return VLC_SUCCESS;}
开发者ID:cobr123,项目名称:qtVlc,代码行数:93,
示例18: Open/***************************************************************************** * Open: open a dummy audio device *****************************************************************************/static int Open( vlc_object_t * p_this ){ aout_instance_t * p_aout = (aout_instance_t *)p_this; char * psz_name, * psz_format; const char * const * ppsz_compare = format_list; int i_channels, i = 0; psz_name = var_CreateGetString( p_this, "audiofile-file" ); if( !psz_name || !*psz_name ) { msg_Err( p_aout, "you need to specify an output file name" ); free( psz_name ); return VLC_EGENERIC; } /* Allocate structure */ p_aout->output.p_sys = malloc( sizeof( aout_sys_t ) ); if( p_aout->output.p_sys == NULL ) return VLC_ENOMEM; if( !strcmp( psz_name, "-" ) ) p_aout->output.p_sys->p_file = stdout; else p_aout->output.p_sys->p_file = utf8_fopen( psz_name, "wb" ); free( psz_name ); if ( p_aout->output.p_sys->p_file == NULL ) { free( p_aout->output.p_sys ); return VLC_EGENERIC; } p_aout->output.pf_play = Play; /* Audio format */ psz_format = var_CreateGetString( p_this, "audiofile-format" ); while ( *ppsz_compare != NULL ) { if ( !strncmp( *ppsz_compare, psz_format, strlen(*ppsz_compare) ) ) { break; } ppsz_compare++; i++; } if ( *ppsz_compare == NULL ) { msg_Err( p_aout, "cannot understand the format string (%s)", psz_format ); if( p_aout->output.p_sys->p_file != stdout ) fclose( p_aout->output.p_sys->p_file ); free( p_aout->output.p_sys ); free( psz_format ); return VLC_EGENERIC; } free( psz_format ); p_aout->output.output.i_format = format_int[i]; if ( AOUT_FMT_NON_LINEAR( &p_aout->output.output ) ) { p_aout->output.i_nb_samples = A52_FRAME_NB; p_aout->output.output.i_bytes_per_frame = AOUT_SPDIF_SIZE; p_aout->output.output.i_frame_length = A52_FRAME_NB; aout_VolumeNoneInit( p_aout ); } else { p_aout->output.i_nb_samples = FRAME_SIZE; aout_VolumeSoftInit( p_aout ); } /* Channels number */ i_channels = var_CreateGetInteger( p_this, "audiofile-channels" ); if( i_channels > 0 && i_channels <= CHANNELS_MAX ) { p_aout->output.output.i_physical_channels = pi_channels_maps[i_channels]; } /* WAV header */ p_aout->output.p_sys->b_add_wav_header = var_CreateGetBool( p_this, "audiofile-wav" ); if( p_aout->output.p_sys->b_add_wav_header ) { /* Write wave header */ WAVEHEADER *wh = &p_aout->output.p_sys->waveh; memset( wh, 0, sizeof(wh) ); switch( p_aout->output.output.i_format ) { case VLC_CODEC_FL32: wh->Format = WAVE_FORMAT_IEEE_FLOAT; wh->BitsPerSample = sizeof(float) * 8;//.........这里部分代码省略.........
开发者ID:shanewfx,项目名称:vlc-arib,代码行数:101,
示例19: vout_IntfInitvoid vout_IntfInit( vout_thread_t *p_vout ){ vlc_value_t val, text, old_val; bool b_force_par = false; char *psz_buf; int i; /* Create a few object variables we'll need later on */ var_Create( p_vout, "snapshot-path", VLC_VAR_STRING | VLC_VAR_DOINHERIT ); var_Create( p_vout, "snapshot-prefix", VLC_VAR_STRING | VLC_VAR_DOINHERIT ); var_Create( p_vout, "snapshot-format", VLC_VAR_STRING | VLC_VAR_DOINHERIT ); var_Create( p_vout, "snapshot-preview", VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); var_Create( p_vout, "snapshot-sequential", VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); var_Create( p_vout, "snapshot-num", VLC_VAR_INTEGER ); var_SetInteger( p_vout, "snapshot-num", 1 ); var_Create( p_vout, "snapshot-width", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); var_Create( p_vout, "snapshot-height", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); var_Create( p_vout, "width", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); var_Create( p_vout, "height", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); p_vout->i_alignment = var_CreateGetInteger( p_vout, "align" ); var_Create( p_vout, "video-x", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); var_Create( p_vout, "video-y", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); var_Create( p_vout, "mouse-hide-timeout", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); p_vout->b_title_show = var_CreateGetBool( p_vout, "video-title-show" ); p_vout->i_title_timeout = (mtime_t)var_CreateGetInteger( p_vout, "video-title-timeout" ); p_vout->i_title_position = var_CreateGetInteger( p_vout, "video-title-position" ); var_AddCallback( p_vout, "video-title-show", TitleShowCallback, NULL ); var_AddCallback( p_vout, "video-title-timeout", TitleTimeoutCallback, NULL ); var_AddCallback( p_vout, "video-title-position", TitlePositionCallback, NULL ); /* Zoom object var */ var_Create( p_vout, "zoom", VLC_VAR_FLOAT | VLC_VAR_ISCOMMAND | VLC_VAR_HASCHOICE | VLC_VAR_DOINHERIT ); text.psz_string = _("Zoom"); var_Change( p_vout, "zoom", VLC_VAR_SETTEXT, &text, NULL ); var_Get( p_vout, "zoom", &old_val ); for( i = 0; p_zoom_values[i].f_value; i++ ) { if( old_val.f_float == p_zoom_values[i].f_value ) var_Change( p_vout, "zoom", VLC_VAR_DELCHOICE, &old_val, NULL ); val.f_float = p_zoom_values[i].f_value; text.psz_string = _( p_zoom_values[i].psz_label ); var_Change( p_vout, "zoom", VLC_VAR_ADDCHOICE, &val, &text ); } var_Set( p_vout, "zoom", old_val ); /* Is this really needed? */ var_AddCallback( p_vout, "zoom", ZoomCallback, NULL ); /* Crop offset vars */ var_Create( p_vout, "crop-left", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND ); var_Create( p_vout, "crop-top", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND ); var_Create( p_vout, "crop-right", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND ); var_Create( p_vout, "crop-bottom", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND ); var_AddCallback( p_vout, "crop-left", CropCallback, NULL ); var_AddCallback( p_vout, "crop-top", CropCallback, NULL ); var_AddCallback( p_vout, "crop-right", CropCallback, NULL ); var_AddCallback( p_vout, "crop-bottom", CropCallback, NULL ); /* Crop object var */ var_Create( p_vout, "crop", VLC_VAR_STRING | VLC_VAR_ISCOMMAND | VLC_VAR_HASCHOICE | VLC_VAR_DOINHERIT ); text.psz_string = _("Crop"); var_Change( p_vout, "crop", VLC_VAR_SETTEXT, &text, NULL ); val.psz_string = (char*)""; var_Change( p_vout, "crop", VLC_VAR_DELCHOICE, &val, 0 ); for( i = 0; p_crop_values[i].psz_value; i++ ) { val.psz_string = (char*)p_crop_values[i].psz_value; text.psz_string = _( p_crop_values[i].psz_label ); var_Change( p_vout, "crop", VLC_VAR_ADDCHOICE, &val, &text ); } /* update triggered every time the vout's crop parameters are changed */ var_Create( p_vout, "crop-update", VLC_VAR_VOID ); /* Add custom crop ratios */ psz_buf = config_GetPsz( p_vout, "custom-crop-ratios" ); AddCustomRatios( p_vout, "crop", psz_buf ); free( psz_buf ); var_AddCallback( p_vout, "crop", CropCallback, NULL ); var_Get( p_vout, "crop", &old_val ); if( old_val.psz_string && *old_val.psz_string )//.........这里部分代码省略.........
开发者ID:mahaserver,项目名称:MHSVLC,代码行数:101,
示例20: CreateFilter/***************************************************************************** * CreateFilter: allocates RSS video filter *****************************************************************************/static int CreateFilter( vlc_object_t *p_this ){ filter_t *p_filter = (filter_t *)p_this; filter_sys_t *p_sys; char *psz_urls; int i_ttl; /* Allocate structure */ p_sys = p_filter->p_sys = (filter_sys_t *)malloc( sizeof( filter_sys_t ) ); // sunqueen modify if( p_sys == NULL ) return VLC_ENOMEM; config_ChainParse( p_filter, CFG_PREFIX, ppsz_filter_options, p_filter->p_cfg ); /* Get the urls to parse: must be non empty */ psz_urls = var_CreateGetNonEmptyString( p_filter, CFG_PREFIX "urls" ); if( !psz_urls ) { msg_Err( p_filter, "The list of urls must not be empty" ); free( p_sys ); return VLC_EGENERIC; } /* Fill the p_sys structure with the configuration */ p_sys->i_title = var_CreateGetInteger( p_filter, CFG_PREFIX "title" ); p_sys->i_cur_feed = 0; p_sys->i_cur_item = p_sys->i_title == scroll_title ? -1 : 0; p_sys->i_cur_char = 0; p_sys->i_feeds = 0; p_sys->p_feeds = NULL; p_sys->i_speed = var_CreateGetInteger( p_filter, CFG_PREFIX "speed" ); p_sys->i_length = var_CreateGetInteger( p_filter, CFG_PREFIX "length" ); p_sys->b_images = var_CreateGetBool( p_filter, CFG_PREFIX "images" ); i_ttl = __MAX( 0, var_CreateGetInteger( p_filter, CFG_PREFIX "ttl" ) ); p_sys->psz_marquee = (char *)malloc( p_sys->i_length + 1 ); // sunqueen modify if( p_sys->psz_marquee == NULL ) { free( psz_urls ); free( p_sys ); return VLC_ENOMEM; } p_sys->psz_marquee[p_sys->i_length] = '/0'; p_sys->p_style = text_style_New(); if( p_sys->p_style == NULL ) goto error; p_sys->i_xoff = var_CreateGetInteger( p_filter, CFG_PREFIX "x" ); p_sys->i_yoff = var_CreateGetInteger( p_filter, CFG_PREFIX "y" ); p_sys->i_pos = var_CreateGetInteger( p_filter, CFG_PREFIX "position" ); p_sys->p_style->i_font_alpha = 255 - var_CreateGetInteger( p_filter, CFG_PREFIX "opacity" ); p_sys->p_style->i_font_color = var_CreateGetInteger( p_filter, CFG_PREFIX "color" ); p_sys->p_style->i_font_size = var_CreateGetInteger( p_filter, CFG_PREFIX "size" ); if( p_sys->b_images && p_sys->p_style->i_font_size == -1 ) { msg_Warn( p_filter, "rss-size wasn't specified. Feed images will thus be displayed without being resized" ); } /* Parse the urls */ if( ParseUrls( p_filter, psz_urls ) ) goto error; /* Misc init */ vlc_mutex_init( &p_sys->lock ); p_filter->pf_sub_source = Filter; p_sys->last_date = (mtime_t)0; p_sys->b_fetched = false; /* Create and arm the timer */ if( vlc_timer_create( &p_sys->timer, Fetch, p_filter ) ) { vlc_mutex_destroy( &p_sys->lock ); goto error; } vlc_timer_schedule( p_sys->timer, false, 1, (mtime_t)(i_ttl)*1000000 ); free( psz_urls ); return VLC_SUCCESS;error: if( p_sys->p_style ) text_style_Delete( p_sys->p_style ); free( p_sys->psz_marquee ); free( psz_urls ); free( p_sys ); return VLC_ENOMEM;}
开发者ID:12307,项目名称:VLC-for-VS2010,代码行数:95,
示例21: InitVideoDec/***************************************************************************** * InitVideo: initialize the video decoder ***************************************************************************** * the ffmpeg codec will be opened, some memory allocated. The vout is not yet * opened (done after the first decoded frame). *****************************************************************************/int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context, AVCodec *p_codec, int i_codec_id, const char *psz_namecodec ){ decoder_sys_t *p_sys; int i_val; /* Allocate the memory needed to store the decoder's structure */ if( ( p_dec->p_sys = p_sys = calloc( 1, sizeof(decoder_sys_t) ) ) == NULL ) return VLC_ENOMEM; p_codec->type = AVMEDIA_TYPE_VIDEO; p_context->codec_type = AVMEDIA_TYPE_VIDEO; p_context->codec_id = i_codec_id; p_sys->p_context = p_context; p_sys->p_codec = p_codec; p_sys->i_codec_id = i_codec_id; p_sys->psz_namecodec = psz_namecodec; p_sys->p_ff_pic = avcodec_alloc_frame(); p_sys->b_delayed_open = true; p_sys->p_va = NULL; vlc_sem_init( &p_sys->sem_mt, 0 ); /* ***** Fill p_context with init values ***** */ p_sys->p_context->codec_tag = ffmpeg_CodecTag( p_dec->fmt_in.i_original_fourcc ? p_dec->fmt_in.i_original_fourcc : p_dec->fmt_in.i_codec ); // sunqueen modify /* ***** Get configuration of ffmpeg plugin ***** */ p_sys->p_context->workaround_bugs = var_InheritInteger( p_dec, "avcodec-workaround-bugs" ); p_sys->p_context->err_recognition = var_InheritInteger( p_dec, "avcodec-error-resilience" ); if( var_CreateGetBool( p_dec, "grayscale" ) ) p_sys->p_context->flags |= CODEC_FLAG_GRAY; /* ***** Output always the frames ***** */#if LIBAVCODEC_VERSION_CHECK(55, 23, 1, 40, 101) p_sys->p_context->flags |= CODEC_FLAG_OUTPUT_CORRUPT;#endif i_val = var_CreateGetInteger( p_dec, "avcodec-vismv" ); if( i_val ) p_sys->p_context->debug_mv = i_val; i_val = var_CreateGetInteger( p_dec, "avcodec-skiploopfilter" ); if( i_val >= 4 ) p_sys->p_context->skip_loop_filter = AVDISCARD_ALL; else if( i_val == 3 ) p_sys->p_context->skip_loop_filter = AVDISCARD_NONKEY; else if( i_val == 2 ) p_sys->p_context->skip_loop_filter = AVDISCARD_BIDIR; else if( i_val == 1 ) p_sys->p_context->skip_loop_filter = AVDISCARD_NONREF; if( var_CreateGetBool( p_dec, "avcodec-fast" ) ) p_sys->p_context->flags2 |= CODEC_FLAG2_FAST; /* ***** libavcodec frame skipping ***** */ p_sys->b_hurry_up = var_CreateGetBool( p_dec, "avcodec-hurry-up" ); i_val = var_CreateGetInteger( p_dec, "avcodec-skip-frame" ); if( i_val >= 4 ) p_sys->p_context->skip_frame = AVDISCARD_ALL; else if( i_val == 3 ) p_sys->p_context->skip_frame = AVDISCARD_NONKEY; else if( i_val == 2 ) p_sys->p_context->skip_frame = AVDISCARD_BIDIR; else if( i_val == 1 ) p_sys->p_context->skip_frame = AVDISCARD_NONREF; else if( i_val == -1 ) p_sys->p_context->skip_frame = AVDISCARD_NONE; else p_sys->p_context->skip_frame = AVDISCARD_DEFAULT; p_sys->i_skip_frame = p_sys->p_context->skip_frame; i_val = var_CreateGetInteger( p_dec, "avcodec-skip-idct" ); if( i_val >= 4 ) p_sys->p_context->skip_idct = AVDISCARD_ALL; else if( i_val == 3 ) p_sys->p_context->skip_idct = AVDISCARD_NONKEY; else if( i_val == 2 ) p_sys->p_context->skip_idct = AVDISCARD_BIDIR; else if( i_val == 1 ) p_sys->p_context->skip_idct = AVDISCARD_NONREF; else if( i_val == -1 ) p_sys->p_context->skip_idct = AVDISCARD_NONE; else p_sys->p_context->skip_idct = AVDISCARD_DEFAULT; p_sys->i_skip_idct = p_sys->p_context->skip_idct; /* ***** libavcodec direct rendering ***** */ p_sys->b_direct_rendering = false; p_sys->i_direct_rendering_used = -1; if( var_CreateGetBool( p_dec, "avcodec-dr" ) && (p_sys->p_codec->capabilities & CODEC_CAP_DR1) && /* No idea why ... but this fixes flickering on some TSCC streams */ p_sys->i_codec_id != AV_CODEC_ID_TSCC && p_sys->i_codec_id != AV_CODEC_ID_CSCD && p_sys->i_codec_id != AV_CODEC_ID_CINEPAK && !p_sys->p_context->debug_mv ) { /* Some codecs set pix_fmt only after the 1st frame has been decoded, * so we need to do another check in ffmpeg_GetFrameBuf() */ p_sys->b_direct_rendering = true; } /* libavcodec doesn't properly release old pictures when frames are skipped */ //if( p_sys->b_hurry_up ) p_sys->b_direct_rendering = false; if( p_sys->b_direct_rendering ) { msg_Dbg( p_dec, "trying to use direct rendering" ); p_sys->p_context->flags |= CODEC_FLAG_EMU_EDGE; }//.........这里部分代码省略.........
开发者ID:839687571,项目名称:vlc-2.2.1.32-2013,代码行数:101,
示例22: Start_LuaIntf//.........这里部分代码省略......... { char *psz_esc = config_StringEscape( psz_http_src ); if( psz_config ) { char *psz_tmp; asprintf( &psz_tmp, "%s,dir='%s'", psz_config, psz_esc ); free( psz_config ); psz_config = psz_tmp; } else asprintf( &psz_config, "http={dir='%s'", psz_esc ); free( psz_esc ); free( psz_http_src ); } if( psz_config ) { char *psz_tmp; asprintf( &psz_tmp, "%s,no_index=%s}", psz_config, b_http_index ? "true" : "false" ); free( psz_config ); psz_config = psz_tmp; } else asprintf( &psz_config, "http={no_index=%s}", b_http_index ? "true" : "false" ); } else if( !strcmp( name, "telnet" ) ) { char *psz_telnet_host = var_CreateGetString( p_intf, "telnet-host" ); if( !strcmp( psz_telnet_host, "*console" ) ) ; else { vlc_url_t url; vlc_UrlParse( &url, psz_telnet_host, 0 ); int i_telnet_port = var_CreateGetInteger( p_intf, "telnet-port" ); if ( url.i_port != 0 ) { if ( i_telnet_port == TELNETPORT_DEFAULT ) i_telnet_port = url.i_port; else if ( url.i_port != i_telnet_port ) msg_Warn( p_intf, "ignoring port %d (using %d)", url.i_port, i_telnet_port ); } char *psz_esc_host = config_StringEscape( url.psz_host ); free( psz_telnet_host ); vlc_UrlClean( &url ); asprintf( &psz_telnet_host, "telnet://%s:%d", psz_esc_host ? psz_esc_host : "", i_telnet_port ); free( psz_esc_host ); } char *psz_telnet_passwd = var_CreateGetString( p_intf, "telnet-password" ); char *psz_esc_passwd = config_StringEscape( psz_telnet_passwd ); asprintf( &psz_config, "telnet={host='%s',password='%s'}", psz_telnet_host, psz_esc_passwd ); free( psz_esc_passwd ); free( psz_telnet_passwd ); free( psz_telnet_host ); } else if( !strcmp( name, "cli" ) ) { char *psz_rc_host = var_CreateGetNonEmptyString( p_intf, "rc-host" ); if( !psz_rc_host ) psz_rc_host = var_CreateGetNonEmptyString( p_intf, "cli-host" ); if( psz_rc_host )
开发者ID:CSRedRat,项目名称:vlc,代码行数:67,
示例23: OpenDecoder/***************************************************************************** * OpenDecoder: probe the decoder and return score *****************************************************************************/static int OpenDecoder( vlc_object_t *p_this ){ decoder_t *p_dec = (decoder_t*)p_this; decoder_sys_t *p_sys; char *psz_tmp; if( p_dec->fmt_in.i_codec != VLC_FOURCC('f','a','k','e')) { return VLC_EGENERIC; } /* Allocate the memory needed to store the decoder's structure */ if( ( p_dec->p_sys = p_sys = malloc(sizeof(decoder_sys_t)) ) == NULL ) return VLC_ENOMEM; // get parametrs p_sys->i_width = var_CreateGetInteger( p_this, "invmem-width" ); p_sys->i_height = var_CreateGetInteger( p_this, "invmem-height" ); if( p_sys->i_width == 0 || p_sys->i_height == 0 ) { msg_Err( p_dec, "--vmem-width and --vmem-height must be > 0" ); free( p_sys ); return VLC_EGENERIC; } psz_tmp = var_CreateGetString( p_dec, "invmem-lock" ); p_sys->pf_lock = (void * (*) (void *))(intptr_t)atoll( psz_tmp ); free( psz_tmp ); psz_tmp = var_CreateGetString( p_dec, "invmem-unlock" ); p_sys->pf_unlock = (void (*) (void *))(intptr_t)atoll( psz_tmp ); free( psz_tmp ); psz_tmp = var_CreateGetString( p_dec, "invmem-data" ); p_sys->p_data = (void *)(intptr_t)atoll( psz_tmp ); free( psz_tmp ); if( !p_sys->pf_lock || !p_sys->pf_unlock ) { msg_Err( p_dec, "Invalid lock or unlock callbacks" ); free( p_sys ); return VLC_EGENERIC; } /* Set output properties */ //p_dec->fmt_out.i_codec = VLC_CODEC_RGBA; p_dec->fmt_out.i_codec = VLC_CODEC_RGB24; p_dec->fmt_out.video.i_width = p_dec->p_sys->i_width; p_dec->fmt_out.video.i_height = p_dec->p_sys->i_height; p_dec->fmt_out.video.i_aspect = VOUT_ASPECT_FACTOR * p_dec->p_sys->i_width / p_dec->p_sys->i_height; p_dec->fmt_out.video.i_rmask = 0xff0000; p_dec->fmt_out.video.i_gmask = 0x00ff00; p_dec->fmt_out.video.i_bmask = 0x0000ff; p_dec->fmt_out.i_cat = VIDEO_ES; p_sys->i_pitch = p_sys->i_width*3 + p_sys->i_width%4; p_sys->p_pic = NULL; /* Set callbacks */ p_dec->pf_decode_video = DecodeBlock; return VLC_SUCCESS;}
开发者ID:Kafay,项目名称:vlc,代码行数:67,
示例24: Open/** * Probes and initializes. */static int Open (vlc_object_t *obj){ demux_t *demux = (demux_t *)obj; int tp; /* transport protocol */ if (!strcmp (demux->psz_access, "dccp")) tp = IPPROTO_DCCP; else if (!strcmp (demux->psz_access, "rtptcp")) tp = IPPROTO_TCP; else if (!strcmp (demux->psz_access, "rtp")) tp = IPPROTO_UDP; else if (!strcmp (demux->psz_access, "udplite")) tp = IPPROTO_UDPLITE; else return VLC_EGENERIC; char *tmp = strdup (demux->psz_location); if (tmp == NULL) return VLC_ENOMEM; char *shost; char *dhost = strchr (tmp, '@'); if (dhost != NULL) { *(dhost++) = '/0'; shost = tmp; } else { dhost = tmp; shost = NULL; } /* Parses the port numbers */ int sport = 0, dport = 0; if (shost != NULL) sport = extract_port (&shost); if (dhost != NULL) dport = extract_port (&dhost); if (dport == 0) dport = 5004; /* avt-profile-1 port */ int rtcp_dport = var_CreateGetInteger (obj, "rtcp-port"); /* Try to connect */ int fd = -1, rtcp_fd = -1; switch (tp) { case IPPROTO_UDP: case IPPROTO_UDPLITE: fd = net_OpenDgram (obj, dhost, dport, shost, sport, tp); if (fd == -1) break; if (rtcp_dport > 0) /* XXX: source port is unknown */ rtcp_fd = net_OpenDgram (obj, dhost, rtcp_dport, shost, 0, tp); break; case IPPROTO_DCCP:#ifndef SOCK_DCCP /* provisional API (FIXME) */# ifdef __linux__# define SOCK_DCCP 6# endif#endif#ifdef SOCK_DCCP var_Create (obj, "dccp-service", VLC_VAR_STRING); var_SetString (obj, "dccp-service", "RTPV"); /* FIXME: RTPA? */ fd = net_Connect (obj, dhost, dport, SOCK_DCCP, tp);#else msg_Err (obj, "DCCP support not included");#endif break; case IPPROTO_TCP: fd = net_Connect (obj, dhost, dport, SOCK_STREAM, tp); break; } free (tmp); if (fd == -1) return VLC_EGENERIC; net_SetCSCov (fd, -1, 12); /* Initializes demux */ demux_sys_t *p_sys = malloc (sizeof (*p_sys)); if (p_sys == NULL) { net_Close (fd); if (rtcp_fd != -1) net_Close (rtcp_fd); return VLC_EGENERIC; } p_sys->chained_demux = NULL;//.........这里部分代码省略.........
开发者ID:Geal,项目名称:vlc,代码行数:101,
示例25: OpenScaler/***************************************************************************** * OpenScaler: probe the filter and return score *****************************************************************************/static int OpenScaler( vlc_object_t *p_this ){ filter_t *p_filter = (filter_t*)p_this; filter_sys_t *p_sys; int i_sws_mode; if( GetParameters( NULL, &p_filter->fmt_in.video, &p_filter->fmt_out.video, 0 ) ) return VLC_EGENERIC; /* */ p_filter->pf_video_filter = Filter; /* Allocate the memory needed to store the decoder's structure */ if( ( p_filter->p_sys = p_sys = malloc(sizeof(filter_sys_t)) ) == NULL ) return VLC_ENOMEM; /* Set CPU capabilities */ p_sys->i_cpu_mask = GetSwsCpuMask(); /* */ i_sws_mode = var_CreateGetInteger( p_filter, "swscale-mode" ); switch( i_sws_mode ) { case 0: p_sys->i_sws_flags = SWS_FAST_BILINEAR; break; case 1: p_sys->i_sws_flags = SWS_BILINEAR; break; case 2: p_sys->i_sws_flags = SWS_BICUBIC; break; case 3: p_sys->i_sws_flags = SWS_X; break; case 4: p_sys->i_sws_flags = SWS_POINT; break; case 5: p_sys->i_sws_flags = SWS_AREA; break; case 6: p_sys->i_sws_flags = SWS_BICUBLIN; break; case 7: p_sys->i_sws_flags = SWS_GAUSS; break; case 8: p_sys->i_sws_flags = SWS_SINC; break; case 9: p_sys->i_sws_flags = SWS_LANCZOS; break; case 10: p_sys->i_sws_flags = SWS_SPLINE; break; default: p_sys->i_sws_flags = SWS_BICUBIC; i_sws_mode = 2; break; } p_sys->p_src_filter = NULL; p_sys->p_dst_filter = NULL; /* Misc init */ p_sys->ctx = NULL; p_sys->ctxA = NULL; p_sys->p_src_a = NULL; p_sys->p_dst_a = NULL; p_sys->p_src_e = NULL; p_sys->p_dst_e = NULL; memset( &p_sys->fmt_in, 0, sizeof(p_sys->fmt_in) ); memset( &p_sys->fmt_out, 0, sizeof(p_sys->fmt_out) ); if( Init( p_filter ) ) { if( p_sys->p_src_filter ) sws_freeFilter( p_sys->p_src_filter ); free( p_sys ); return VLC_EGENERIC; } msg_Dbg( p_filter, "%ix%i chroma: %4.4s -> %ix%i chroma: %4.4s with scaling using %s", p_filter->fmt_in.video.i_width, p_filter->fmt_in.video.i_height, (char *)&p_filter->fmt_in.video.i_chroma, p_filter->fmt_out.video.i_width, p_filter->fmt_out.video.i_height, (char *)&p_filter->fmt_out.video.i_chroma, ppsz_mode_descriptions[i_sws_mode] ); return VLC_SUCCESS;}
开发者ID:Tilka,项目名称:vlc,代码行数:72,
注:本文中的var_CreateGetInteger函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ var_Destroy函数代码示例 C++ var_CreateGetBool函数代码示例 |