Commit 8f90136b authored by Steve Lhomme's avatar Steve Lhomme

filter_chain: only set the video owner for video filters

spu filters don't set an owner for the filter chain (for now)
parent f289e033
...@@ -52,7 +52,7 @@ static inline chained_filter_t *chained(filter_t *filter) ...@@ -52,7 +52,7 @@ static inline chained_filter_t *chained(filter_t *filter)
struct filter_chain_t struct filter_chain_t
{ {
vlc_object_t *obj; vlc_object_t *obj;
filter_owner_t owner; /**< Owner (downstream) callbacks */ filter_owner_t parent_video_owner; /**< Owner (downstream) callbacks */
chained_filter_t *first, *last; /**< List of filters */ chained_filter_t *first, *last; /**< List of filters */
...@@ -70,7 +70,7 @@ static void FilterDeletePictures( picture_t * ); ...@@ -70,7 +70,7 @@ static void FilterDeletePictures( picture_t * );
static filter_chain_t *filter_chain_NewInner( vlc_object_t *obj, static filter_chain_t *filter_chain_NewInner( vlc_object_t *obj,
const char *cap, const char *conv_cap, bool fmt_out_change, const char *cap, const char *conv_cap, bool fmt_out_change,
const filter_owner_t *owner, enum es_format_category_e cat ) enum es_format_category_e cat )
{ {
assert( obj != NULL ); assert( obj != NULL );
assert( cap != NULL ); assert( cap != NULL );
...@@ -80,10 +80,6 @@ static filter_chain_t *filter_chain_NewInner( vlc_object_t *obj, ...@@ -80,10 +80,6 @@ static filter_chain_t *filter_chain_NewInner( vlc_object_t *obj,
return NULL; return NULL;
chain->obj = obj; chain->obj = obj;
if( owner != NULL )
chain->owner = *owner;
else
memset(&chain->owner, 0, sizeof(chain->owner));
chain->first = NULL; chain->first = NULL;
chain->last = NULL; chain->last = NULL;
es_format_Init( &chain->fmt_in, cat, 0 ); es_format_Init( &chain->fmt_in, cat, 0 );
...@@ -100,7 +96,7 @@ static filter_chain_t *filter_chain_NewInner( vlc_object_t *obj, ...@@ -100,7 +96,7 @@ static filter_chain_t *filter_chain_NewInner( vlc_object_t *obj,
*/ */
filter_chain_t *filter_chain_NewSPU( vlc_object_t *obj, const char *cap ) filter_chain_t *filter_chain_NewSPU( vlc_object_t *obj, const char *cap )
{ {
return filter_chain_NewInner( obj, cap, NULL, false, NULL, SPU_ES ); return filter_chain_NewInner( obj, cap, NULL, false, SPU_ES );
} }
/** Chained filter picture allocator function */ /** Chained filter picture allocator function */
...@@ -118,8 +114,8 @@ static picture_t *filter_chain_VideoBufferNew( filter_t *filter ) ...@@ -118,8 +114,8 @@ static picture_t *filter_chain_VideoBufferNew( filter_t *filter )
filter_chain_t *chain = filter->owner.sys; filter_chain_t *chain = filter->owner.sys;
/* XXX ugly */ /* XXX ugly */
filter->owner.sys = chain->owner.sys; filter->owner.sys = chain->parent_video_owner.sys;
picture_t *pic = chain->owner.video->buffer_new( filter ); picture_t *pic = chain->parent_video_owner.video->buffer_new( filter );
filter->owner.sys = chain; filter->owner.sys = chain;
return pic; return pic;
} }
...@@ -134,8 +130,21 @@ static const struct filter_video_callbacks filter_chain_video_cbs = ...@@ -134,8 +130,21 @@ static const struct filter_video_callbacks filter_chain_video_cbs =
filter_chain_t *filter_chain_NewVideo( vlc_object_t *obj, bool allow_change, filter_chain_t *filter_chain_NewVideo( vlc_object_t *obj, bool allow_change,
const filter_owner_t *restrict owner ) const filter_owner_t *restrict owner )
{ {
return filter_chain_NewInner( obj, "video filter", filter_chain_t *chain =
"video converter", allow_change, owner, VIDEO_ES ); filter_chain_NewInner( obj, "video filter",
"video converter", allow_change, VIDEO_ES );
if (unlikely(chain == NULL))
return NULL;
if( owner != NULL && owner->video != NULL )
{
// keep this to get pictures for the last filter in the chain
assert( owner->video->buffer_new != NULL );
chain->parent_video_owner = *owner;
}
else
chain->parent_video_owner = (filter_owner_t){};
return chain;
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment