Commit cbaaea93 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont
Browse files

picture: add pf_destroy to picture_resource_t

parent 64f8465b
...@@ -133,6 +133,7 @@ VLC_API picture_t * picture_NewFromFormat( const video_format_t *p_fmt ) VLC_USE ...@@ -133,6 +133,7 @@ VLC_API picture_t * picture_NewFromFormat( const video_format_t *p_fmt ) VLC_USE
typedef struct typedef struct
{ {
picture_sys_t *p_sys; picture_sys_t *p_sys;
void (*pf_destroy)(picture_t *);
/* Plane resources /* Plane resources
* XXX all fields MUST be set to the right value. * XXX all fields MUST be set to the right value.
......
...@@ -226,6 +226,7 @@ picture_t *picture_NewFromResource( const video_format_t *p_fmt, const picture_r ...@@ -226,6 +226,7 @@ picture_t *picture_NewFromResource( const video_format_t *p_fmt, const picture_r
if( p_resource ) if( p_resource )
{ {
p_picture->p_sys = p_resource->p_sys; p_picture->p_sys = p_resource->p_sys;
p_picture->gc.pf_destroy = p_resource->pf_destroy;
assert( p_picture->gc.p_sys == NULL ); assert( p_picture->gc.p_sys == NULL );
for( int i = 0; i < p_picture->i_planes; i++ ) for( int i = 0; i < p_picture->i_planes; i++ )
...@@ -243,18 +244,22 @@ picture_t *picture_NewFromResource( const video_format_t *p_fmt, const picture_r ...@@ -243,18 +244,22 @@ picture_t *picture_NewFromResource( const video_format_t *p_fmt, const picture_r
return NULL; return NULL;
} }
} }
/* */ /* */
p_picture->format = fmt; p_picture->format = fmt;
vlc_atomic_set( &p_picture->gc.refcount, 1 ); vlc_atomic_set( &p_picture->gc.refcount, 1 );
p_picture->gc.pf_destroy = PictureDestroy; if( p_picture->gc.pf_destroy == NULL )
p_picture->gc.pf_destroy = PictureDestroy;
return p_picture; return p_picture;
} }
picture_t *picture_NewFromFormat( const video_format_t *p_fmt ) picture_t *picture_NewFromFormat( const video_format_t *p_fmt )
{ {
return picture_NewFromResource( p_fmt, NULL ); return picture_NewFromResource( p_fmt, NULL );
} }
picture_t *picture_New( vlc_fourcc_t i_chroma, int i_width, int i_height, int i_sar_num, int i_sar_den ) picture_t *picture_New( vlc_fourcc_t i_chroma, int i_width, int i_height, int i_sar_num, int i_sar_den )
{ {
video_format_t fmt; video_format_t fmt;
......
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