]> git.sesse.net Git - vlc/commitdiff
decoder: remove decoder_UnlinkPicture() and decoder_DeletePicture()
authorRémi Denis-Courmont <remi@remlab.net>
Sat, 1 Nov 2014 12:25:50 +0000 (14:25 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Sat, 1 Nov 2014 12:30:07 +0000 (14:30 +0200)
Use picture_Release() directly.

13 files changed:
include/vlc_codec.h
modules/codec/avcodec/video.c
modules/codec/crystalhd.c
modules/codec/libmpeg2.c
modules/codec/omxil/android_mediacodec.c
modules/codec/omxil/omxil.c
modules/codec/schroedinger.c
modules/hw/mmal/codec.c
modules/stream_out/mosaic_bridge.c
modules/stream_out/transcode/video.c
src/input/decoder.c
src/libvlccore.sym
src/misc/image.c

index 48f8acdae8aac6de3e541d8e95132ce6710666b5..cd9bbe82312495e124a66598ccfaf1974d50de52 100644 (file)
@@ -95,12 +95,9 @@ struct decoder_t
      */
 
     /* Video output callbacks
-     * XXX use decoder_NewPicture/decoder_DeletePicture
-     * and decoder_UnlinkPicture */
+     * XXX use decoder_NewPicture */
     int             (*pf_vout_format_update)( 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
@@ -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
- * 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.
  */
 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
  * format (fmt_out.audio). If there is currently no audio output or if the
index ef1c067f9304493b922229189271a41244133112..b57fc3d2348e7e9e8f87a174f7cd9bc2c94917f2 100644 (file)
@@ -793,7 +793,7 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
         }
         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)
 {
     lavc_pic_ref_t *ref = opaque;
 
-    decoder_UnlinkPicture(ref->decoder, ref->picture);
+    picture_Release(ref->picture);
     free(ref);
     (void) data;
 }
@@ -1080,14 +1080,14 @@ static picture_t *lavc_dr_GetFrame(struct AVCodecContext *ctx,
             goto error;
         }
     }
-    decoder_UnlinkPicture(dec, pic);
+    picture_Release(pic);
     (void) flags;
     return pic;
 error:
     for (unsigned i = 0; frame->buf[i] != NULL; i++)
         av_buffer_unref(&frame->buf[i]);
 no_dr:
-    decoder_DeletePicture(dec, pic);
+    picture_Release(pic);
     return NULL;
 }
 
@@ -1231,7 +1231,7 @@ static picture_t *ffmpeg_dr_GetFrameBuf(struct AVCodecContext *p_context)
 
 no_dr:
     if (p_pic)
-        decoder_DeletePicture( p_dec, p_pic );
+        picture_Release( p_pic );
 
     return NULL;
 }
@@ -1302,7 +1302,7 @@ static void ffmpeg_ReleaseFrameBuf( struct AVCodecContext *p_context,
     if( p_sys->p_va )
         vlc_va_Release( p_sys->p_va, p_ff_pic->opaque, p_ff_pic->data[0] );
     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 )
         /* We can end up here without the AVFrame being allocated by
          * avcodec_default_get_buffer() if VA is used and the frame is
index 3c838c4959840d678dc5369d4d9ad5d4c6abd7b8..b8e39afa8625860e79879f75661097d0eff5b52c 100644 (file)
@@ -581,7 +581,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
             break;
     }
     if( p_pic )
-        decoder_DeletePicture( p_dec, p_pic );
+        picture_Release( p_pic );
     return NULL;
 }
 
index 48bafe40a6bb6a29d8f726c6cd5177f15a9b2490..c8e1c493fb5b919e25e1155e0216a4c5e5213aad 100644 (file)
@@ -799,9 +799,9 @@ static void DpbClean( decoder_t *p_dec )
         if( !p->p_picture )
             continue;
         if( p->b_linked )
-            decoder_UnlinkPicture( p_dec, p->p_picture );
+            picture_Release( p->p_picture );
         if( !p->b_displayed )
-            decoder_DeletePicture( p_dec, p->p_picture );
+            picture_Release( p->p_picture );
 
         p->p_picture = NULL;
     }
@@ -868,11 +868,11 @@ static void DpbUnlinkPicture( decoder_t *p_dec, picture_t *p_picture )
 
     assert( p && p->b_linked );
 
-    decoder_UnlinkPicture( p_dec, p->p_picture );
+    picture_Release( p->p_picture );
     p->b_linked = false;
 
     if( !p->b_displayed )
-        decoder_DeletePicture( p_dec, p->p_picture );
+        picture_Release( p->p_picture );
     p->p_picture = NULL;
 }
 /**
index 6d204d7a8d68a68f0317ada816a96f57c2f0c11b..1eeee694f0fb8f6a5d308f8bc4802239a1faee85 100644 (file)
@@ -1024,7 +1024,7 @@ static picture_t *DecodeVideo(decoder_t *p_dec, block_t **pp_block)
     }
     if (p_sys->error_state) {
         if (p_pic)
-            decoder_DeletePicture(p_dec, p_pic);
+            picture_Release(p_pic);
         jni_detach_thread();
         return NULL;
     }
index 01605219ac450e3e9f86d15d9073e02ad03ae401..042c2fc1f211e2b00600c66141d14fa07970204e 100644 (file)
@@ -553,7 +553,7 @@ static OMX_ERRORTYPE FreeBuffers(decoder_t *p_dec, OmxPort *p_port)
         if( p_buffer )
         {
             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,
                                         p_port->i_port_index, p_buffer );
index 8178553be2e2fa4853949ba0dc03a5af155df7d0..f48aa2ba48c27a5ed1f5f76a753e63869da2f4cd 100644 (file)
@@ -36,7 +36,7 @@
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
-#include <vlc_codec.h>                              /* decoder_DeletePicture */
+#include <vlc_codec.h>
 
 #include <schroedinger/schro.h>
 
@@ -646,7 +646,7 @@ static void SchroFrameFree( SchroFrame *frame, void *priv)
     if( !p_free )
         return;
 
-    decoder_DeletePicture( p_free->p_dec, p_free->p_pic );
+    picture_Release( p_free->p_pic );
     free(p_free);
     (void)frame;
 }
index 1a08fd3cf4059457b30decbd5e5e58169bc60454..9401289701a8a725f2d4e7203c23327418bee9af 100644 (file)
@@ -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)",
                 status, mmal_status_to_string(status));
         mmal_buffer_header_release(buffer);
-        decoder_DeletePicture(dec, picture);
+        picture_Release(picture);
         ret = -1;
         goto out;
     }
@@ -608,7 +608,7 @@ static void output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer)
             fill_output_port(dec);
         } else {
             picture = (picture_t *)buffer->user_data;
-            decoder_DeletePicture(dec, picture);
+            picture_Release(picture);
             buffer->user_data = NULL;
             buffer->alloc_size = 0;
             buffer->data = NULL;
index 627d2e5b2785e6f6ebc2c8b77fd197a155444dc9..005929a7150acfc5df5d1f86f5917ce10ea4253f 100644 (file)
@@ -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               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 picture_t *video_new_buffer_decoder( decoder_t * );
 inline static picture_t *video_new_buffer_filter( filter_t * );
 static int video_update_format( vlc_object_t *, decoder_owner_sys_t *,
                                 es_format_t * );
 
-static void video_unlink_picture_decoder( decoder_t *, picture_t * );
-
 static int HeightCallback( vlc_object_t *, char const *,
                            vlc_value_t, vlc_value_t, void * );
 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 )
     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_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) );
     if( !p_sys->p_decoder->p_owner )
     {
@@ -655,20 +649,6 @@ static int video_update_format( vlc_object_t *p_this,
     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
  **********************************************************************/
index 083ede36bd5cad995fef092ebd5301fdfbb9d6c3..b0f7716bb61a051ba6c5de0976c45e61fc381ca1 100644 (file)
@@ -43,18 +43,6 @@ struct decoder_owner_sys_t
     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 )
 {
     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 )
     id->p_decoder->pf_get_cc = 0;
     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_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) );
     if( !id->p_decoder->p_owner )
         return VLC_EGENERIC;
index 710b7d3c23bf4459503497f6409866faad76b646..7c0c7850e9d0db455a7b22ebc9911ed8c768fbb9 100644 (file)
@@ -68,8 +68,6 @@ static void       DecoderUnsupportedCodec( decoder_t *, vlc_fourcc_t );
 /* Buffers allocation callbacks for the decoders */
 static int vout_update_format( 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 subpicture_t *spu_new_buffer( decoder_t *, const subpicture_updater_t * );
 static void spu_del_buffer( decoder_t *, subpicture_t * );
@@ -168,14 +166,6 @@ picture_t *decoder_NewPicture( decoder_t *p_decoder )
         msg_Warn( p_decoder, "can't get output 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 )
 {
@@ -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_vout_format_update = vout_update_format;
     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_del  = spu_del_buffer;
     /* */
@@ -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,
                                      const subpicture_updater_t *p_updater )
 {
index 102b3ade1ecbfe54ee876166fd1f80f031f7775d..95952631914517d8a8c6231cf03647ea4f91e349 100644 (file)
@@ -72,7 +72,6 @@ date_Increment
 date_Init
 date_Move
 date_Set
-decoder_DeletePicture
 decoder_DeleteSubpicture
 decoder_GetDisplayDate
 decoder_GetDisplayRate
@@ -89,7 +88,6 @@ decoder_SynchroNewPicture
 decoder_SynchroRelease
 decoder_SynchroReset
 decoder_SynchroTrash
-decoder_UnlinkPicture
 decode_URI
 decode_URI_duplicate
 demux_GetParentInput
index 968022cbba34fbcb7251e915238e570f3ab26bed..906470a3ea90bc505e274e8206ac11f92efac620 100644 (file)
@@ -596,18 +596,6 @@ static picture_t *video_new_buffer( decoder_t *p_dec )
     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 )
 {
     decoder_t *p_dec;
@@ -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_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 */
     p_dec->p_module = module_need( p_dec, "decoder", "$codec", false );