Commit 3159c34c authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

decoder: remove decoder_UnlinkPicture() and decoder_DeletePicture()

Use picture_Release() directly.
parent 58c8d782
...@@ -95,12 +95,9 @@ struct decoder_t ...@@ -95,12 +95,9 @@ struct decoder_t
*/ */
/* Video output callbacks /* Video output callbacks
* XXX use decoder_NewPicture/decoder_DeletePicture * XXX use decoder_NewPicture */
* and decoder_UnlinkPicture */
int (*pf_vout_format_update)( decoder_t * ); int (*pf_vout_format_update)( decoder_t * );
picture_t *(*pf_vout_buffer_new)( decoder_t * ); picture_t *(*pf_vout_buffer_new)( decoder_t * );
void (*pf_vout_buffer_del)( decoder_t *, picture_t * );
void (*pf_picture_unlink) ( decoder_t *, picture_t * );
/** /**
* Number of extra (ie in addition to the DPB) picture buffers * Number of extra (ie in addition to the DPB) picture buffers
...@@ -194,22 +191,11 @@ static inline int decoder_UpdateVideoFormat( decoder_t *dec ) ...@@ -194,22 +191,11 @@ static inline int decoder_UpdateVideoFormat( decoder_t *dec )
/** /**
* This function will return a new picture usable by a decoder as an output * This function will return a new picture usable by a decoder as an output
* buffer. You have to release it using decoder_DeletePicture or by returning * buffer. You have to release it using picture_Release() or by returning
* it to the caller as a pf_decode_video return value. * it to the caller as a pf_decode_video return value.
*/ */
VLC_API picture_t * decoder_NewPicture( decoder_t * ) VLC_USED; VLC_API picture_t * decoder_NewPicture( decoder_t * ) VLC_USED;
/**
* This function will release a picture create by decoder_NewPicture.
*/
VLC_API void decoder_DeletePicture( decoder_t *, picture_t *p_picture );
/**
* This function will decrease the picture reference count.
* (picture_Release is not usable.)
*/
VLC_API void decoder_UnlinkPicture( decoder_t *, picture_t * );
/** /**
* This function notifies the audio output pipeline of a new audio output * This function notifies the audio output pipeline of a new audio output
* format (fmt_out.audio). If there is currently no audio output or if the * format (fmt_out.audio). If there is currently no audio output or if the
......
...@@ -793,7 +793,7 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block ) ...@@ -793,7 +793,7 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
} }
else else
{ {
decoder_DeletePicture( p_dec, p_pic ); picture_Release( p_pic );
} }
} }
...@@ -998,7 +998,7 @@ static void lavc_dr_ReleaseFrame(void *opaque, uint8_t *data) ...@@ -998,7 +998,7 @@ static void lavc_dr_ReleaseFrame(void *opaque, uint8_t *data)
{ {
lavc_pic_ref_t *ref = opaque; lavc_pic_ref_t *ref = opaque;
decoder_UnlinkPicture(ref->decoder, ref->picture); picture_Release(ref->picture);
free(ref); free(ref);
(void) data; (void) data;
} }
...@@ -1080,14 +1080,14 @@ static picture_t *lavc_dr_GetFrame(struct AVCodecContext *ctx, ...@@ -1080,14 +1080,14 @@ static picture_t *lavc_dr_GetFrame(struct AVCodecContext *ctx,
goto error; goto error;
} }
} }
decoder_UnlinkPicture(dec, pic); picture_Release(pic);
(void) flags; (void) flags;
return pic; return pic;
error: error:
for (unsigned i = 0; frame->buf[i] != NULL; i++) for (unsigned i = 0; frame->buf[i] != NULL; i++)
av_buffer_unref(&frame->buf[i]); av_buffer_unref(&frame->buf[i]);
no_dr: no_dr:
decoder_DeletePicture(dec, pic); picture_Release(pic);
return NULL; return NULL;
} }
...@@ -1231,7 +1231,7 @@ static picture_t *ffmpeg_dr_GetFrameBuf(struct AVCodecContext *p_context) ...@@ -1231,7 +1231,7 @@ static picture_t *ffmpeg_dr_GetFrameBuf(struct AVCodecContext *p_context)
no_dr: no_dr:
if (p_pic) if (p_pic)
decoder_DeletePicture( p_dec, p_pic ); picture_Release( p_pic );
return NULL; return NULL;
} }
...@@ -1302,7 +1302,7 @@ static void ffmpeg_ReleaseFrameBuf( struct AVCodecContext *p_context, ...@@ -1302,7 +1302,7 @@ static void ffmpeg_ReleaseFrameBuf( struct AVCodecContext *p_context,
if( p_sys->p_va ) if( p_sys->p_va )
vlc_va_Release( p_sys->p_va, p_ff_pic->opaque, p_ff_pic->data[0] ); vlc_va_Release( p_sys->p_va, p_ff_pic->opaque, p_ff_pic->data[0] );
else if( p_ff_pic->opaque ) else if( p_ff_pic->opaque )
decoder_UnlinkPicture( p_dec, (picture_t*)p_ff_pic->opaque); picture_Release( (picture_t*)p_ff_pic->opaque);
else if( p_ff_pic->type == FF_BUFFER_TYPE_INTERNAL ) else if( p_ff_pic->type == FF_BUFFER_TYPE_INTERNAL )
/* We can end up here without the AVFrame being allocated by /* We can end up here without the AVFrame being allocated by
* avcodec_default_get_buffer() if VA is used and the frame is * avcodec_default_get_buffer() if VA is used and the frame is
......
...@@ -581,7 +581,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -581,7 +581,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
break; break;
} }
if( p_pic ) if( p_pic )
decoder_DeletePicture( p_dec, p_pic ); picture_Release( p_pic );
return NULL; return NULL;
} }
......
...@@ -799,9 +799,9 @@ static void DpbClean( decoder_t *p_dec ) ...@@ -799,9 +799,9 @@ static void DpbClean( decoder_t *p_dec )
if( !p->p_picture ) if( !p->p_picture )
continue; continue;
if( p->b_linked ) if( p->b_linked )
decoder_UnlinkPicture( p_dec, p->p_picture ); picture_Release( p->p_picture );
if( !p->b_displayed ) if( !p->b_displayed )
decoder_DeletePicture( p_dec, p->p_picture ); picture_Release( p->p_picture );
p->p_picture = NULL; p->p_picture = NULL;
} }
...@@ -868,11 +868,11 @@ static void DpbUnlinkPicture( decoder_t *p_dec, picture_t *p_picture ) ...@@ -868,11 +868,11 @@ static void DpbUnlinkPicture( decoder_t *p_dec, picture_t *p_picture )
assert( p && p->b_linked ); assert( p && p->b_linked );
decoder_UnlinkPicture( p_dec, p->p_picture ); picture_Release( p->p_picture );
p->b_linked = false; p->b_linked = false;
if( !p->b_displayed ) if( !p->b_displayed )
decoder_DeletePicture( p_dec, p->p_picture ); picture_Release( p->p_picture );
p->p_picture = NULL; p->p_picture = NULL;
} }
/** /**
......
...@@ -1024,7 +1024,7 @@ static picture_t *DecodeVideo(decoder_t *p_dec, block_t **pp_block) ...@@ -1024,7 +1024,7 @@ static picture_t *DecodeVideo(decoder_t *p_dec, block_t **pp_block)
} }
if (p_sys->error_state) { if (p_sys->error_state) {
if (p_pic) if (p_pic)
decoder_DeletePicture(p_dec, p_pic); picture_Release(p_pic);
jni_detach_thread(); jni_detach_thread();
return NULL; return NULL;
} }
......
...@@ -553,7 +553,7 @@ static OMX_ERRORTYPE FreeBuffers(decoder_t *p_dec, OmxPort *p_port) ...@@ -553,7 +553,7 @@ static OMX_ERRORTYPE FreeBuffers(decoder_t *p_dec, OmxPort *p_port)
if( p_buffer ) if( p_buffer )
{ {
if (p_buffer->pAppPrivate != NULL) if (p_buffer->pAppPrivate != NULL)
decoder_DeletePicture( p_dec, p_buffer->pAppPrivate ); picture_Release( p_buffer->pAppPrivate );
omx_error = OMX_FreeBuffer( p_port->omx_handle, omx_error = OMX_FreeBuffer( p_port->omx_handle,
p_port->i_port_index, p_buffer ); p_port->i_port_index, p_buffer );
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_plugin.h> #include <vlc_plugin.h>
#include <vlc_codec.h> /* decoder_DeletePicture */ #include <vlc_codec.h>
#include <schroedinger/schro.h> #include <schroedinger/schro.h>
...@@ -646,7 +646,7 @@ static void SchroFrameFree( SchroFrame *frame, void *priv) ...@@ -646,7 +646,7 @@ static void SchroFrameFree( SchroFrame *frame, void *priv)
if( !p_free ) if( !p_free )
return; return;
decoder_DeletePicture( p_free->p_dec, p_free->p_pic ); picture_Release( p_free->p_pic );
free(p_free); free(p_free);
(void)frame; (void)frame;
} }
......
...@@ -433,7 +433,7 @@ static int send_output_buffer(decoder_t *dec) ...@@ -433,7 +433,7 @@ static int send_output_buffer(decoder_t *dec)
msg_Err(dec, "Failed to send buffer to output port (status=%"PRIx32" %s)", msg_Err(dec, "Failed to send buffer to output port (status=%"PRIx32" %s)",
status, mmal_status_to_string(status)); status, mmal_status_to_string(status));
mmal_buffer_header_release(buffer); mmal_buffer_header_release(buffer);
decoder_DeletePicture(dec, picture); picture_Release(picture);
ret = -1; ret = -1;
goto out; goto out;
} }
...@@ -608,7 +608,7 @@ static void output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer) ...@@ -608,7 +608,7 @@ static void output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer)
fill_output_port(dec); fill_output_port(dec);
} else { } else {
picture = (picture_t *)buffer->user_data; picture = (picture_t *)buffer->user_data;
decoder_DeletePicture(dec, picture); picture_Release(picture);
buffer->user_data = NULL; buffer->user_data = NULL;
buffer->alloc_size = 0; buffer->alloc_size = 0;
buffer->data = NULL; buffer->data = NULL;
......
...@@ -77,16 +77,12 @@ static sout_stream_id_sys_t *Add ( sout_stream_t *, es_format_t * ); ...@@ -77,16 +77,12 @@ static sout_stream_id_sys_t *Add ( sout_stream_t *, es_format_t * );
static int Del ( sout_stream_t *, sout_stream_id_sys_t * ); static int Del ( sout_stream_t *, sout_stream_id_sys_t * );
static int Send( sout_stream_t *, sout_stream_id_sys_t *, block_t * ); static int Send( sout_stream_t *, sout_stream_id_sys_t *, block_t * );
inline static void video_del_buffer_decoder( decoder_t *, picture_t * );
inline static int video_update_format_decoder( decoder_t *p_dec ); inline static int video_update_format_decoder( decoder_t *p_dec );
inline static picture_t *video_new_buffer_decoder( decoder_t * ); inline static picture_t *video_new_buffer_decoder( decoder_t * );
inline static picture_t *video_new_buffer_filter( filter_t * ); inline static picture_t *video_new_buffer_filter( filter_t * );
static int video_update_format( vlc_object_t *, decoder_owner_sys_t *, static int video_update_format( vlc_object_t *, decoder_owner_sys_t *,
es_format_t * ); es_format_t * );
static void video_unlink_picture_decoder( decoder_t *, picture_t * );
static int HeightCallback( vlc_object_t *, char const *, static int HeightCallback( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * ); vlc_value_t, vlc_value_t, void * );
static int WidthCallback( vlc_object_t *, char const *, static int WidthCallback( vlc_object_t *, char const *,
...@@ -297,8 +293,6 @@ static sout_stream_id_sys_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt ) ...@@ -297,8 +293,6 @@ static sout_stream_id_sys_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt )
p_sys->p_decoder->pf_decode_video = 0; p_sys->p_decoder->pf_decode_video = 0;
p_sys->p_decoder->pf_vout_format_update = video_update_format_decoder; p_sys->p_decoder->pf_vout_format_update = video_update_format_decoder;
p_sys->p_decoder->pf_vout_buffer_new = video_new_buffer_decoder; p_sys->p_decoder->pf_vout_buffer_new = video_new_buffer_decoder;
p_sys->p_decoder->pf_vout_buffer_del = video_del_buffer_decoder;
p_sys->p_decoder->pf_picture_unlink = video_unlink_picture_decoder;
p_sys->p_decoder->p_owner = malloc( sizeof(decoder_owner_sys_t) ); p_sys->p_decoder->p_owner = malloc( sizeof(decoder_owner_sys_t) );
if( !p_sys->p_decoder->p_owner ) if( !p_sys->p_decoder->p_owner )
{ {
...@@ -655,20 +649,6 @@ static int video_update_format( vlc_object_t *p_this, ...@@ -655,20 +649,6 @@ static int video_update_format( vlc_object_t *p_this,
return 0; return 0;
} }
inline static void video_del_buffer_decoder( decoder_t *p_this,
picture_t *p_pic )
{
VLC_UNUSED(p_this);
picture_Release( p_pic );
}
static void video_unlink_picture_decoder( decoder_t *p_dec, picture_t *p_pic )
{
VLC_UNUSED(p_dec);
picture_Release( p_pic );
}
/********************************************************************** /**********************************************************************
* Callback to update (some) params on the fly * Callback to update (some) params on the fly
**********************************************************************/ **********************************************************************/
......
...@@ -43,18 +43,6 @@ struct decoder_owner_sys_t ...@@ -43,18 +43,6 @@ struct decoder_owner_sys_t
sout_stream_sys_t *p_sys; sout_stream_sys_t *p_sys;
}; };
static void video_del_buffer_decoder( decoder_t *p_decoder, picture_t *p_pic )
{
VLC_UNUSED(p_decoder);
picture_Release( p_pic );
}
static void video_unlink_picture_decoder( decoder_t *p_dec, picture_t *p_pic )
{
VLC_UNUSED(p_dec);
picture_Release( p_pic );
}
static int video_update_format_decoder( decoder_t *p_dec ) static int video_update_format_decoder( decoder_t *p_dec )
{ {
p_dec->fmt_out.video.i_chroma = p_dec->fmt_out.i_codec; p_dec->fmt_out.video.i_chroma = p_dec->fmt_out.i_codec;
...@@ -160,8 +148,6 @@ int transcode_video_new( sout_stream_t *p_stream, sout_stream_id_sys_t *id ) ...@@ -160,8 +148,6 @@ int transcode_video_new( sout_stream_t *p_stream, sout_stream_id_sys_t *id )
id->p_decoder->pf_get_cc = 0; id->p_decoder->pf_get_cc = 0;
id->p_decoder->pf_vout_format_update = video_update_format_decoder; id->p_decoder->pf_vout_format_update = video_update_format_decoder;
id->p_decoder->pf_vout_buffer_new = video_new_buffer_decoder; id->p_decoder->pf_vout_buffer_new = video_new_buffer_decoder;
id->p_decoder->pf_vout_buffer_del = video_del_buffer_decoder;
id->p_decoder->pf_picture_unlink = video_unlink_picture_decoder;
id->p_decoder->p_owner = malloc( sizeof(decoder_owner_sys_t) ); id->p_decoder->p_owner = malloc( sizeof(decoder_owner_sys_t) );
if( !id->p_decoder->p_owner ) if( !id->p_decoder->p_owner )
return VLC_EGENERIC; return VLC_EGENERIC;
......
...@@ -68,8 +68,6 @@ static void DecoderUnsupportedCodec( decoder_t *, vlc_fourcc_t ); ...@@ -68,8 +68,6 @@ static void DecoderUnsupportedCodec( decoder_t *, vlc_fourcc_t );
/* Buffers allocation callbacks for the decoders */ /* Buffers allocation callbacks for the decoders */
static int vout_update_format( decoder_t * ); static int vout_update_format( decoder_t * );
static picture_t *vout_new_buffer( decoder_t * ); static picture_t *vout_new_buffer( decoder_t * );
static void vout_del_buffer( decoder_t *, picture_t * );
static void vout_unlink_picture( decoder_t *, picture_t * );
static int aout_update_format( decoder_t * ); static int aout_update_format( decoder_t * );
static subpicture_t *spu_new_buffer( decoder_t *, const subpicture_updater_t * ); static subpicture_t *spu_new_buffer( decoder_t *, const subpicture_updater_t * );
static void spu_del_buffer( decoder_t *, subpicture_t * ); static void spu_del_buffer( decoder_t *, subpicture_t * );
...@@ -168,14 +166,6 @@ picture_t *decoder_NewPicture( decoder_t *p_decoder ) ...@@ -168,14 +166,6 @@ picture_t *decoder_NewPicture( decoder_t *p_decoder )
msg_Warn( p_decoder, "can't get output picture" ); msg_Warn( p_decoder, "can't get output picture" );
return p_picture; return p_picture;
} }
void decoder_DeletePicture( decoder_t *p_decoder, picture_t *p_picture )
{
p_decoder->pf_vout_buffer_del( p_decoder, p_picture );
}
void decoder_UnlinkPicture( decoder_t *p_decoder, picture_t *p_picture )
{
p_decoder->pf_picture_unlink( p_decoder, p_picture );
}
block_t *decoder_NewAudioBuffer( decoder_t *dec, int samples ) block_t *decoder_NewAudioBuffer( decoder_t *dec, int samples )
{ {
...@@ -779,8 +769,6 @@ static decoder_t * CreateDecoder( vlc_object_t *p_parent, ...@@ -779,8 +769,6 @@ static decoder_t * CreateDecoder( vlc_object_t *p_parent,
p_dec->pf_aout_format_update = aout_update_format; p_dec->pf_aout_format_update = aout_update_format;
p_dec->pf_vout_format_update = vout_update_format; p_dec->pf_vout_format_update = vout_update_format;
p_dec->pf_vout_buffer_new = vout_new_buffer; p_dec->pf_vout_buffer_new = vout_new_buffer;
p_dec->pf_vout_buffer_del = vout_del_buffer;
p_dec->pf_picture_unlink = vout_unlink_picture;
p_dec->pf_spu_buffer_new = spu_new_buffer; p_dec->pf_spu_buffer_new = spu_new_buffer;
p_dec->pf_spu_buffer_del = spu_del_buffer; p_dec->pf_spu_buffer_del = spu_del_buffer;
/* */ /* */
...@@ -2185,16 +2173,6 @@ static picture_t *vout_new_buffer( decoder_t *p_dec ) ...@@ -2185,16 +2173,6 @@ static picture_t *vout_new_buffer( decoder_t *p_dec )
} }
} }
static void vout_del_buffer( decoder_t *p_dec, picture_t *p_pic )
{
picture_Release( p_pic );
}
static void vout_unlink_picture( decoder_t *p_dec, picture_t *p_pic )
{
picture_Release( p_pic );
}
static subpicture_t *spu_new_buffer( decoder_t *p_dec, static subpicture_t *spu_new_buffer( decoder_t *p_dec,
const subpicture_updater_t *p_updater ) const subpicture_updater_t *p_updater )
{ {
......
...@@ -72,7 +72,6 @@ date_Increment ...@@ -72,7 +72,6 @@ date_Increment
date_Init date_Init
date_Move date_Move
date_Set date_Set
decoder_DeletePicture
decoder_DeleteSubpicture decoder_DeleteSubpicture
decoder_GetDisplayDate decoder_GetDisplayDate
decoder_GetDisplayRate decoder_GetDisplayRate
...@@ -89,7 +88,6 @@ decoder_SynchroNewPicture ...@@ -89,7 +88,6 @@ decoder_SynchroNewPicture
decoder_SynchroRelease decoder_SynchroRelease
decoder_SynchroReset decoder_SynchroReset
decoder_SynchroTrash decoder_SynchroTrash
decoder_UnlinkPicture
decode_URI decode_URI
decode_URI_duplicate decode_URI_duplicate
demux_GetParentInput demux_GetParentInput
......
...@@ -596,18 +596,6 @@ static picture_t *video_new_buffer( decoder_t *p_dec ) ...@@ -596,18 +596,6 @@ static picture_t *video_new_buffer( decoder_t *p_dec )
return picture_NewFromFormat( &p_dec->fmt_out.video ); return picture_NewFromFormat( &p_dec->fmt_out.video );
} }
static void video_del_buffer( decoder_t *p_dec, picture_t *p_pic )
{
(void)p_dec;
picture_Release( p_pic );
}
static void video_unlink_picture( decoder_t *p_dec, picture_t *p_pic )
{
(void)p_dec;
picture_Release( p_pic );
}
static decoder_t *CreateDecoder( vlc_object_t *p_this, video_format_t *fmt ) static decoder_t *CreateDecoder( vlc_object_t *p_this, video_format_t *fmt )
{ {
decoder_t *p_dec; decoder_t *p_dec;
...@@ -624,8 +612,6 @@ static decoder_t *CreateDecoder( vlc_object_t *p_this, video_format_t *fmt ) ...@@ -624,8 +612,6 @@ static decoder_t *CreateDecoder( vlc_object_t *p_this, video_format_t *fmt )
p_dec->pf_vout_format_update = video_update_format; p_dec->pf_vout_format_update = video_update_format;
p_dec->pf_vout_buffer_new = video_new_buffer; p_dec->pf_vout_buffer_new = video_new_buffer;
p_dec->pf_vout_buffer_del = video_del_buffer;
p_dec->pf_picture_unlink = video_unlink_picture;
/* Find a suitable decoder module */ /* Find a suitable decoder module */
p_dec->p_module = module_need( p_dec, "decoder", "$codec", false ); p_dec->p_module = module_need( p_dec, "decoder", "$codec", false );
......
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