static int UpdateBufferFunctions( filter_chain_t * );
static picture_t *VideoBufferNew( filter_t * );
+static void VideoBufferDelete( filter_t *, picture_t * );
/**
* Filter chain initialisation
p_filter->p_cfg = p_cfg;
p_filter->b_allow_fmt_out_change = p_chain->b_allow_fmt_out_change;
- p_filter->p_module = module_Need( p_filter, p_chain->psz_capability,
+ p_filter->p_module = module_need( p_filter, p_chain->psz_capability,
psz_name, psz_name ? true : false );
if( !p_filter->p_module )
error:
if( psz_name )
- msg_Err( p_chain->p_this, "Failed to create video filter '%s'",
- psz_name );
+ msg_Err( p_chain->p_this, "Failed to create %s '%s'",
+ p_chain->psz_capability, psz_name );
else
- msg_Err( p_chain->p_this, "Failed to create video filter" );
- if( p_filter->p_module ) module_Unneed( p_filter,
+ msg_Err( p_chain->p_this, "Failed to create %s",
+ p_chain->psz_capability );
+ if( p_filter->p_module ) module_unneed( p_filter,
p_filter->p_module );
es_format_Clean( &p_filter->fmt_in );
es_format_Clean( &p_filter->fmt_out );
{
config_chain_t *p_cfg = NULL;
char *psz_name = NULL;
+ char* psz_new_string;
if( !psz_string || !*psz_string ) return 0;
- psz_string = config_ChainCreate( &psz_name, &p_cfg, psz_string );
+ psz_new_string = config_ChainCreate( &psz_name, &p_cfg, psz_string );
filter_t *p_filter = filter_chain_AppendFilterInternal( p_chain, psz_name,
p_cfg, NULL, NULL );
"to filter chain", psz_name );
free( psz_name );
free( p_cfg );
+ free( psz_new_string );
return -1;
}
free( psz_name );
- int ret = filter_chain_AppendFromStringInternal( p_chain, psz_string );
+ int ret = filter_chain_AppendFromStringInternal( p_chain, psz_new_string );
+ free( psz_new_string );
if( ret < 0 )
{
filter_chain_DeleteFilterInternal( p_chain, p_filter );
p_chain->pf_buffer_allocation_clear( p_filter );
vlc_object_detach( p_filter );
if( p_filter->p_module )
- module_Unneed( p_filter, p_filter->p_module );
+ module_unneed( p_filter, p_filter->p_module );
vlc_object_release( p_filter );
/* FIXME: check fmt_in/fmt_out consitency */
const es_format_t *filter_chain_GetFmtOut( filter_chain_t *p_chain )
{
- return &p_chain->fmt_out;
+
+ if( p_chain->b_allow_fmt_out_change )
+ return &p_chain->fmt_out;
+
+ /* Unless filter_chain_Reset has been called we are doomed */
+ if( p_chain->filters.i_count <= 0 )
+ return &p_chain->fmt_out;
+
+ /* */
+ filter_t *p_last = (filter_t*)p_chain->filters.pp_elems[p_chain->filters.i_count-1];
+
+ return &p_last->fmt_out;
}
/**
filter_t *p_filter = pp_filter[i];
picture_t *p_newpic = p_filter->pf_video_filter( p_filter, p_pic );
- /* FIXME Ugly hack to make it work in picture core.
- * FIXME Remove this code when the picture release API has been
- * FIXME cleaned up (a git revert of the commit should work) */
- if( p_chain->p_this->i_object_type == VLC_OBJECT_VOUT )
- {
- vout_thread_t *p_vout = (vout_thread_t*)p_chain->p_this;
- vlc_mutex_lock( &p_vout->picture_lock );
- if( p_pic->i_refcount )
- {
- p_pic->i_status = DISPLAYED_PICTURE;
- }
- else
- {
- p_pic->i_status = DESTROYED_PICTURE;
- p_vout->i_heap_size--;
- }
- vlc_mutex_unlock( &p_vout->picture_lock );
-
- if( p_newpic )
- p_newpic->i_status = READY_PICTURE;
- }
if( !p_newpic )
return NULL;
if( p_chain->pf_buffer_allocation_clear )
p_chain->pf_buffer_allocation_clear( p_filter );
p_filter->pf_vout_buffer_new = VideoBufferNew;
- p_filter->pf_vout_buffer_del = NULL;
+ p_filter->pf_vout_buffer_del = VideoBufferDelete;
}
}
if( p_chain->filters.i_count >= 1 )
if( p_filter->pf_vout_buffer_new == VideoBufferNew )
{
p_filter->pf_vout_buffer_new = NULL;
+ p_filter->pf_vout_buffer_del = NULL;
if( p_chain->pf_buffer_allocation_init( p_filter,
p_chain->p_buffer_allocation_data ) != VLC_SUCCESS )
return VLC_EGENERIC;
msg_Err( p_filter, "Failed to allocate picture\n" );
return p_picture;
}
+static void VideoBufferDelete( filter_t *p_filter, picture_t *p_picture )
+{
+ picture_Release( p_picture );
+}