Commit 398cabc6 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

filter: separate owner structure from the filter itself

parent 2a981bac
/***************************************************************************** /*****************************************************************************
* vlc_filter.h: filter related structures and functions * vlc_filter.h: filter related structures and functions
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2008 VLC authors and VideoLAN * Copyright (C) 1999-2014 VLC authors and VideoLAN
* $Id$
* *
* Authors: Gildas Bazin <gbazin@videolan.org> * Authors: Gildas Bazin <gbazin@videolan.org>
* Antoine Cellerier <dionoea at videolan dot org> * Antoine Cellerier <dionoea at videolan dot org>
* Rémi Denis-Courmont
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by * under the terms of the GNU Lesser General Public License as published by
...@@ -37,6 +37,26 @@ ...@@ -37,6 +37,26 @@
typedef struct filter_owner_sys_t filter_owner_sys_t; typedef struct filter_owner_sys_t filter_owner_sys_t;
typedef struct filter_owner_t
{
void *sys;
union
{
struct
{
picture_t * (*buffer_new)( filter_t * );
void (*buffer_del)( filter_t *, picture_t * );
} video;
struct
{
subpicture_t * (*buffer_new)( filter_t * );
void (*buffer_del)( filter_t *, subpicture_t * );
} sub;
};
} filter_owner_t;
/** Structure describing a filter /** Structure describing a filter
* @warning BIG FAT WARNING : the code relies on the first 4 members of * @warning BIG FAT WARNING : the code relies on the first 4 members of
* filter_t and decoder_t to be the same, so if you have anything to add, * filter_t and decoder_t to be the same, so if you have anything to add,
...@@ -66,8 +86,6 @@ struct filter_t ...@@ -66,8 +86,6 @@ struct filter_t
{ {
picture_t * (*pf_filter) ( filter_t *, picture_t * ); picture_t * (*pf_filter) ( filter_t *, picture_t * );
void (*pf_flush)( filter_t * ); void (*pf_flush)( filter_t * );
picture_t * (*pf_buffer_new) ( filter_t * );
void (*pf_buffer_del) ( filter_t *, picture_t * );
/* Filter mouse state. /* Filter mouse state.
* *
* If non-NULL, you must convert from output to input formats: * If non-NULL, you must convert from output to input formats:
...@@ -83,8 +101,6 @@ struct filter_t ...@@ -83,8 +101,6 @@ struct filter_t
#define pf_video_filter u.video.pf_filter #define pf_video_filter u.video.pf_filter
#define pf_video_flush u.video.pf_flush #define pf_video_flush u.video.pf_flush
#define pf_video_mouse u.video.pf_mouse #define pf_video_mouse u.video.pf_mouse
#define pf_video_buffer_new u.video.pf_buffer_new
#define pf_video_buffer_del u.video.pf_buffer_del
struct struct
{ {
...@@ -102,16 +118,12 @@ struct filter_t ...@@ -102,16 +118,12 @@ struct filter_t
struct struct
{ {
subpicture_t * (*pf_source) ( filter_t *, mtime_t ); subpicture_t * (*pf_source) ( filter_t *, mtime_t );
subpicture_t * (*pf_buffer_new)( filter_t * );
void (*pf_buffer_del)( filter_t *, subpicture_t * );
int (*pf_mouse) ( filter_t *, int (*pf_mouse) ( filter_t *,
const vlc_mouse_t *p_old, const vlc_mouse_t *p_old,
const vlc_mouse_t *p_new, const vlc_mouse_t *p_new,
const video_format_t * ); const video_format_t * );
} sub; } sub;
#define pf_sub_source u.sub.pf_source #define pf_sub_source u.sub.pf_source
#define pf_sub_buffer_new u.sub.pf_buffer_new
#define pf_sub_buffer_del u.sub.pf_buffer_del
#define pf_sub_mouse u.sub.pf_mouse #define pf_sub_mouse u.sub.pf_mouse
struct struct
...@@ -139,7 +151,7 @@ struct filter_t ...@@ -139,7 +151,7 @@ struct filter_t
int (*pf_get_attachments)( filter_t *, input_attachment_t ***, int * ); int (*pf_get_attachments)( filter_t *, input_attachment_t ***, int * );
/* Private structure for the owner of the decoder */ /* Private structure for the owner of the decoder */
filter_owner_sys_t *p_owner; filter_owner_t owner;
}; };
/** /**
...@@ -153,10 +165,10 @@ struct filter_t ...@@ -153,10 +165,10 @@ struct filter_t
*/ */
static inline picture_t *filter_NewPicture( filter_t *p_filter ) static inline picture_t *filter_NewPicture( filter_t *p_filter )
{ {
picture_t *p_picture = p_filter->pf_video_buffer_new( p_filter ); picture_t *pic = p_filter->owner.video.buffer_new( p_filter );
if( !p_picture ) if( pic == NULL )
msg_Warn( p_filter, "can't get output picture" ); msg_Warn( p_filter, "can't get output picture" );
return p_picture; return pic;
} }
/** /**
...@@ -166,9 +178,9 @@ static inline picture_t *filter_NewPicture( filter_t *p_filter ) ...@@ -166,9 +178,9 @@ static inline picture_t *filter_NewPicture( filter_t *p_filter )
* \param p_filter filter_t object * \param p_filter filter_t object
* \param p_picture picture to be deleted * \param p_picture picture to be deleted
*/ */
static inline void filter_DeletePicture( filter_t *p_filter, picture_t *p_picture ) static inline void filter_DeletePicture( filter_t *p_filter, picture_t *pic )
{ {
p_filter->pf_video_buffer_del( p_filter, p_picture ); p_filter->owner.video.buffer_del( p_filter, pic );
} }
/** /**
...@@ -191,10 +203,10 @@ static inline void filter_FlushPictures( filter_t *p_filter ) ...@@ -191,10 +203,10 @@ static inline void filter_FlushPictures( filter_t *p_filter )
*/ */
static inline subpicture_t *filter_NewSubpicture( filter_t *p_filter ) static inline subpicture_t *filter_NewSubpicture( filter_t *p_filter )
{ {
subpicture_t *p_subpicture = p_filter->pf_sub_buffer_new( p_filter ); subpicture_t *subpic = p_filter->owner.sub.buffer_new( p_filter );
if( !p_subpicture ) if( subpic == NULL )
msg_Warn( p_filter, "can't get output subpicture" ); msg_Warn( p_filter, "can't get output subpicture" );
return p_subpicture; return subpic;
} }
/** /**
...@@ -204,9 +216,10 @@ static inline subpicture_t *filter_NewSubpicture( filter_t *p_filter ) ...@@ -204,9 +216,10 @@ static inline subpicture_t *filter_NewSubpicture( filter_t *p_filter )
* \param p_filter filter_t object * \param p_filter filter_t object
* \param p_subpicture to be released * \param p_subpicture to be released
*/ */
static inline void filter_DeleteSubpicture( filter_t *p_filter, subpicture_t *p_subpicture ) static inline void filter_DeleteSubpicture( filter_t *p_filter,
subpicture_t *subpic )
{ {
p_filter->pf_sub_buffer_del( p_filter, p_subpicture ); p_filter->owner.sub.buffer_del( p_filter, subpic );
} }
/** /**
......
...@@ -276,9 +276,9 @@ static void Close( vlc_object_t * p_this ) ...@@ -276,9 +276,9 @@ static void Close( vlc_object_t * p_this )
static int video_filter_buffer_allocation_init( filter_t *p_filter, void *p_data ) static int video_filter_buffer_allocation_init( filter_t *p_filter, void *p_data )
{ {
p_filter->pf_video_buffer_new = video_new_buffer_filter; p_filter->owner.sys = p_data;
p_filter->pf_video_buffer_del = video_del_buffer_filter; p_filter->owner.video.buffer_new = video_new_buffer_filter;
p_filter->p_owner = p_data; p_filter->owner.video.buffer_del = video_del_buffer_filter;
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -614,7 +614,7 @@ inline static picture_t *video_new_buffer_decoder( decoder_t *p_dec ) ...@@ -614,7 +614,7 @@ inline static picture_t *video_new_buffer_decoder( decoder_t *p_dec )
inline static picture_t *video_new_buffer_filter( filter_t *p_filter ) inline static picture_t *video_new_buffer_filter( filter_t *p_filter )
{ {
return video_new_buffer( VLC_OBJECT( p_filter ), return video_new_buffer( VLC_OBJECT( p_filter ),
(decoder_owner_sys_t *)p_filter->p_owner, (decoder_owner_sys_t *)p_filter->owner.sys,
&p_filter->fmt_out ); &p_filter->fmt_out );
} }
......
...@@ -87,8 +87,8 @@ static int transcode_video_filter_allocation_init( filter_t *p_filter, ...@@ -87,8 +87,8 @@ static int transcode_video_filter_allocation_init( filter_t *p_filter,
void *p_data ) void *p_data )
{ {
VLC_UNUSED(p_data); VLC_UNUSED(p_data);
p_filter->pf_video_buffer_new = transcode_video_filter_buffer_new; p_filter->owner.video.buffer_new = transcode_video_filter_buffer_new;
p_filter->pf_video_buffer_del = transcode_video_filter_buffer_del; p_filter->owner.video.buffer_del = transcode_video_filter_buffer_del;
return VLC_SUCCESS; return VLC_SUCCESS;
} }
......
...@@ -266,21 +266,23 @@ exit: ...@@ -266,21 +266,23 @@ exit:
*****************************************************************************/ *****************************************************************************/
static picture_t *BufferNew( filter_t *p_filter ) static picture_t *BufferNew( filter_t *p_filter )
{ {
filter_t *p_parent = (filter_t*)p_filter->p_owner; filter_t *p_parent = p_filter->owner.sys;
return filter_NewPicture( p_parent ); return filter_NewPicture( p_parent );
} }
static void BufferDel( filter_t *p_filter, picture_t *p_pic ) static void BufferDel( filter_t *p_filter, picture_t *p_pic )
{ {
filter_t *p_parent = (filter_t*)p_filter->p_owner; filter_t *p_parent = p_filter->owner.sys;
filter_DeletePicture( p_parent, p_pic ); filter_DeletePicture( p_parent, p_pic );
} }
static int BufferAllocationInit ( filter_t *p_filter, void *p_data ) static int BufferAllocationInit ( filter_t *p_filter, void *p_data )
{ {
p_filter->pf_video_buffer_new = BufferNew; p_filter->owner.sys = p_data;
p_filter->pf_video_buffer_del = BufferDel; p_filter->owner.video.buffer_new = BufferNew;
p_filter->p_owner = p_data; p_filter->owner.video.buffer_del = BufferDel;
return VLC_SUCCESS; return VLC_SUCCESS;
} }
......
...@@ -370,18 +370,18 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) ...@@ -370,18 +370,18 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
*****************************************************************************/ *****************************************************************************/
static picture_t *video_new( filter_t *p_filter ) static picture_t *video_new( filter_t *p_filter )
{ {
return filter_NewPicture( (filter_t*)p_filter->p_owner ); return filter_NewPicture( p_filter->owner.sys );
} }
static void video_del( filter_t *p_filter, picture_t *p_pic ) static void video_del( filter_t *p_filter, picture_t *p_pic )
{ {
return filter_DeletePicture( (filter_t*)p_filter->p_owner, p_pic ); return filter_DeletePicture( p_filter->owner.sys, p_pic );
} }
static int alloc_init( filter_t *p_filter, void *p_data ) static int alloc_init( filter_t *p_filter, void *p_data )
{ {
p_filter->p_owner = p_data; p_filter->owner.sys = p_data;
p_filter->pf_video_buffer_new = video_new; p_filter->owner.video.buffer_new = video_new;
p_filter->pf_video_buffer_del = video_del; p_filter->owner.video.buffer_del = video_del;
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -51,7 +51,7 @@ static filter_t *CreateFilter (vlc_object_t *obj, const char *type, ...@@ -51,7 +51,7 @@ static filter_t *CreateFilter (vlc_object_t *obj, const char *type,
if (unlikely(filter == NULL)) if (unlikely(filter == NULL))
return NULL; return NULL;
filter->p_owner = owner; filter->owner.sys = owner;
filter->fmt_in.audio = *infmt; filter->fmt_in.audio = *infmt;
filter->fmt_in.i_codec = infmt->i_format; filter->fmt_in.i_codec = infmt->i_format;
filter->fmt_out.audio = *outfmt; filter->fmt_out.audio = *outfmt;
...@@ -317,7 +317,7 @@ vout_thread_t *aout_filter_RequestVout (filter_t *filter, vout_thread_t *vout, ...@@ -317,7 +317,7 @@ vout_thread_t *aout_filter_RequestVout (filter_t *filter, vout_thread_t *vout,
* If you want to use visualization filters from another place, you will * If you want to use visualization filters from another place, you will
* need to add a new pf_aout_request_vout callback or store a pointer * need to add a new pf_aout_request_vout callback or store a pointer
* to aout_request_vout_t inside filter_t (i.e. a level of indirection). */ * to aout_request_vout_t inside filter_t (i.e. a level of indirection). */
const aout_request_vout_t *req = (void *)filter->p_owner; const aout_request_vout_t *req = filter->owner.sys;
char *visual = var_InheritString (filter->p_parent, "audio-visual"); char *visual = var_InheritString (filter->p_parent, "audio-visual");
/* NOTE: Disable recycling to always close the filter vout because OpenGL /* NOTE: Disable recycling to always close the filter vout because OpenGL
* visualizations do not use this function to ask for a context. */ * visualizations do not use this function to ask for a context. */
......
...@@ -605,15 +605,15 @@ static int InternalVideoInit( filter_t *p_filter, void *p_data ) ...@@ -605,15 +605,15 @@ static int InternalVideoInit( filter_t *p_filter, void *p_data )
{ {
VLC_UNUSED(p_data); VLC_UNUSED(p_data);
p_filter->pf_video_buffer_new = VideoBufferNew; p_filter->owner.video.buffer_new = VideoBufferNew;
p_filter->pf_video_buffer_del = VideoBufferDelete; p_filter->owner.video.buffer_del = VideoBufferDelete;
return VLC_SUCCESS; return VLC_SUCCESS;
} }
static bool IsInternalVideoAllocator( chained_filter_t *p_filter ) static bool IsInternalVideoAllocator( chained_filter_t *p_filter )
{ {
return p_filter->filter.pf_video_buffer_new == VideoBufferNew; return p_filter->filter.owner.video.buffer_new == VideoBufferNew;
} }
/* */ /* */
......
...@@ -784,9 +784,9 @@ static filter_t *CreateFilter( vlc_object_t *p_this, es_format_t *p_fmt_in, ...@@ -784,9 +784,9 @@ static filter_t *CreateFilter( vlc_object_t *p_this, es_format_t *p_fmt_in,
filter_t *p_filter; filter_t *p_filter;
p_filter = vlc_custom_create( p_this, sizeof(filter_t), "filter" ); p_filter = vlc_custom_create( p_this, sizeof(filter_t), "filter" );
p_filter->pf_video_buffer_new = p_filter->owner.video.buffer_new =
(picture_t *(*)(filter_t *))video_new_buffer; (picture_t *(*)(filter_t *))video_new_buffer;
p_filter->pf_video_buffer_del = p_filter->owner.video.buffer_del =
(void (*)(filter_t *, picture_t *))video_del_buffer; (void (*)(filter_t *, picture_t *))video_del_buffer;
p_filter->fmt_in = *p_fmt_in; p_filter->fmt_in = *p_fmt_in;
......
...@@ -53,7 +53,7 @@ static void SplitterClose(vout_display_t *vd); ...@@ -53,7 +53,7 @@ static void SplitterClose(vout_display_t *vd);
*****************************************************************************/ *****************************************************************************/
static picture_t *VideoBufferNew(filter_t *filter) static picture_t *VideoBufferNew(filter_t *filter)
{ {
vout_display_t *vd = (vout_display_t*)filter->p_owner; vout_display_t *vd = filter->owner.sys;
const video_format_t *fmt = &filter->fmt_out.video; const video_format_t *fmt = &filter->fmt_out.video;
assert(vd->fmt.i_chroma == fmt->i_chroma && assert(vd->fmt.i_chroma == fmt->i_chroma &&
...@@ -73,10 +73,9 @@ static void VideoBufferDelete(filter_t *filter, picture_t *picture) ...@@ -73,10 +73,9 @@ static void VideoBufferDelete(filter_t *filter, picture_t *picture)
static int FilterAllocationInit(filter_t *filter, void *vd) static int FilterAllocationInit(filter_t *filter, void *vd)
{ {
filter->pf_video_buffer_new = VideoBufferNew; filter->owner.sys = vd;
filter->pf_video_buffer_del = VideoBufferDelete; filter->owner.video.buffer_new = VideoBufferNew;
filter->p_owner = vd; filter->owner.video.buffer_del = VideoBufferDelete;
return VLC_SUCCESS; return VLC_SUCCESS;
} }
......
...@@ -669,7 +669,7 @@ void vout_DeleteDisplayWindow(vout_thread_t *vout, vout_display_t *vd, ...@@ -669,7 +669,7 @@ void vout_DeleteDisplayWindow(vout_thread_t *vout, vout_display_t *vd,
/* */ /* */
static picture_t *VoutVideoFilterInteractiveNewPicture(filter_t *filter) static picture_t *VoutVideoFilterInteractiveNewPicture(filter_t *filter)
{ {
vout_thread_t *vout = (vout_thread_t*)filter->p_owner; vout_thread_t *vout = filter->owner.sys;
picture_t *picture = picture_pool_Get(vout->p->private_pool); picture_t *picture = picture_pool_Get(vout->p->private_pool);
if (picture) { if (picture) {
...@@ -678,9 +678,10 @@ static picture_t *VoutVideoFilterInteractiveNewPicture(filter_t *filter) ...@@ -678,9 +678,10 @@ static picture_t *VoutVideoFilterInteractiveNewPicture(filter_t *filter)
} }
return picture; return picture;
} }
static picture_t *VoutVideoFilterStaticNewPicture(filter_t *filter) static picture_t *VoutVideoFilterStaticNewPicture(filter_t *filter)
{ {
vout_thread_t *vout = (vout_thread_t*)filter->p_owner; vout_thread_t *vout = filter->owner.sys;
vlc_assert_locked(&vout->p->filter.lock); vlc_assert_locked(&vout->p->filter.lock);
if (filter_chain_GetLength(vout->p->filter.chain_interactive) == 0) if (filter_chain_GetLength(vout->p->filter.chain_interactive) == 0)
...@@ -688,25 +689,29 @@ static picture_t *VoutVideoFilterStaticNewPicture(filter_t *filter) ...@@ -688,25 +689,29 @@ static picture_t *VoutVideoFilterStaticNewPicture(filter_t *filter)
return picture_NewFromFormat(&filter->fmt_out.video); return picture_NewFromFormat(&filter->fmt_out.video);
} }
static void VoutVideoFilterDelPicture(filter_t *filter, picture_t *picture) static void VoutVideoFilterDelPicture(filter_t *filter, picture_t *picture)
{ {
VLC_UNUSED(filter); VLC_UNUSED(filter);
picture_Release(picture); picture_Release(picture);
} }
static int VoutVideoFilterStaticAllocationSetup(filter_t *filter, void *data) static int VoutVideoFilterStaticAllocationSetup(filter_t *filter, void *data)
{ {
filter->pf_video_buffer_new = VoutVideoFilterStaticNewPicture; filter->owner.sys = data; /* vout */
filter->pf_video_buffer_del = VoutVideoFilterDelPicture; filter->owner.video.buffer_new = VoutVideoFilterStaticNewPicture;
filter->p_owner = data; /* vout */ filter->owner.video.buffer_del = VoutVideoFilterDelPicture;
return VLC_SUCCESS; return VLC_SUCCESS;
} }
static int VoutVideoFilterInteractiveAllocationSetup(filter_t *filter, void *data) static int VoutVideoFilterInteractiveAllocationSetup(filter_t *filter, void *data)
{ {
filter->pf_video_buffer_new = VoutVideoFilterInteractiveNewPicture; filter->owner.sys = data; /* vout */
filter->pf_video_buffer_del = VoutVideoFilterDelPicture; filter->owner.video.buffer_new = VoutVideoFilterInteractiveNewPicture;
filter->p_owner = data; /* vout */ filter->owner.video.buffer_del = VoutVideoFilterDelPicture;
return VLC_SUCCESS; return VLC_SUCCESS;
} }
static void ThreadFilterFlush(vout_thread_t *vout, bool is_locked) static void ThreadFilterFlush(vout_thread_t *vout, bool is_locked)
{ {
if (vout->p->displayed.current) if (vout->p->displayed.current)
......
...@@ -165,9 +165,7 @@ static void FilterRelease(filter_t *filter) ...@@ -165,9 +165,7 @@ static void FilterRelease(filter_t *filter)
{ {
if (filter->p_module) if (filter->p_module)
module_unneed(filter, filter->p_module); module_unneed(filter, filter->p_module);
if (filter->p_owner) free(filter->owner.sys);
free(filter->p_owner);
vlc_object_release(filter); vlc_object_release(filter);
} }
...@@ -188,7 +186,8 @@ static int spu_get_attachments(filter_t *filter, ...@@ -188,7 +186,8 @@ static int spu_get_attachments(filter_t *filter,
input_attachment_t ***attachment_ptr, input_attachment_t ***attachment_ptr,
int *attachment_count) int *attachment_count)
{ {
spu_t *spu = filter->p_owner->spu; filter_owner_sys_t *sys = filter->owner.sys;
spu_t *spu = sys->spu;
int ret = VLC_EGENERIC; int ret = VLC_EGENERIC;
if (spu->p->input) if (spu->p->input)
...@@ -204,8 +203,9 @@ static filter_t *SpuRenderCreateAndLoadText(spu_t *spu) ...@@ -204,8 +203,9 @@ static filter_t *SpuRenderCreateAndLoadText(spu_t *spu)
if (!text) if (!text)
return NULL; return NULL;
text->p_owner = xmalloc(sizeof(*text->p_owner)); filter_owner_sys_t *sys = xmalloc(sizeof(*sys));
text->p_owner->spu = spu; sys->spu = spu;
text->owner.sys = sys;
es_format_Init(&text->fmt_in, VIDEO_ES, 0); es_format_Init(&text->fmt_in, VIDEO_ES, 0);
...@@ -249,8 +249,8 @@ static filter_t *SpuRenderCreateAndLoadScale(vlc_object_t *object, ...@@ -249,8 +249,8 @@ static filter_t *SpuRenderCreateAndLoadScale(vlc_object_t *object,
scale->fmt_out.video.i_height = scale->fmt_out.video.i_height =
scale->fmt_out.video.i_visible_height = require_resize ? 16 : 32; scale->fmt_out.video.i_visible_height = require_resize ? 16 : 32;
scale->pf_video_buffer_new = spu_new_video_buffer; scale->owner.video.buffer_new = spu_new_video_buffer;
scale->pf_video_buffer_del = spu_del_video_buffer; scale->owner.video.buffer_del = spu_del_video_buffer;
scale->p_module = module_need(scale, "video filter2", NULL, false); scale->p_module = module_need(scale, "video filter2", NULL, false);
...@@ -1163,13 +1163,14 @@ static int CropCallback(vlc_object_t *object, char const *var, ...@@ -1163,13 +1163,14 @@ static int CropCallback(vlc_object_t *object, char const *var,
static subpicture_t *sub_new_buffer(filter_t *filter) static subpicture_t *sub_new_buffer(filter_t *filter)
{ {
filter_owner_sys_t *sys = filter->p_owner; filter_owner_sys_t *sys = filter->owner.sys;
subpicture_t *subpicture = subpicture_New(NULL); subpicture_t *subpicture = subpicture_New(NULL);
if (subpicture) if (subpicture)
subpicture->i_channel = sys->channel; subpicture->i_channel = sys->channel;
return subpicture; return subpicture;
} }
static void sub_del_buffer(filter_t *filter, subpicture_t *subpic) static void sub_del_buffer(filter_t *filter, subpicture_t *subpic)
{ {
VLC_UNUSED(filter); VLC_UNUSED(filter);
...@@ -1184,10 +1185,10 @@ static int SubSourceAllocationInit(filter_t *filter, void *data) ...@@ -1184,10 +1185,10 @@ static int SubSourceAllocationInit(filter_t *filter, void *data)
if (!sys) if (!sys)
return VLC_EGENERIC; return VLC_EGENERIC;
filter->pf_sub_buffer_new = sub_new_buffer; filter->owner.sub.buffer_new = sub_new_buffer;
filter->pf_sub_buffer_del = sub_del_buffer; filter->owner.sub.buffer_del = sub_del_buffer;
filter->p_owner = sys; filter->owner.sys = sys;
sys->channel = spu_RegisterChannel(spu); sys->channel = spu_RegisterChannel(spu);
sys->spu = spu; sys->spu = spu;
...@@ -1196,10 +1197,10 @@ static int SubSourceAllocationInit(filter_t *filter, void *data) ...@@ -1196,10 +1197,10 @@ static int SubSourceAllocationInit(filter_t *filter, void *data)
static void SubSourceAllocationClean(filter_t *filter) static void SubSourceAllocationClean(filter_t *filter)
{ {
filter_owner_sys_t *sys = filter->p_owner; filter_owner_sys_t *sys = filter->owner.sys;
spu_ClearChannel(sys->spu, sys->channel); spu_ClearChannel(sys->spu, sys->channel);
free(filter->p_owner); free(sys);
} }
/***************************************************************************** /*****************************************************************************
......
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