[vlc-commits] dec: remove return status from decode_Queue*

Thomas Guillem git at videolan.org
Wed May 16 10:43:29 CEST 2018


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed May 16 10:25:11 2018 +0200| [86df4f3d1b56776d2c77e4c9da4c829f44fafca6] | committer: Thomas Guillem

dec: remove return status from decode_Queue*

This status was never used. Decoder modules don't need to know if vouts/aouts
will drop the frame they just queued.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=86df4f3d1b56776d2c77e4c9da4c829f44fafca6
---

 include/vlc_codec.h | 35 +++++++++++++----------------------
 src/input/decoder.c | 34 +++++++++++++---------------------
 2 files changed, 26 insertions(+), 43 deletions(-)

diff --git a/include/vlc_codec.h b/include/vlc_codec.h
index 41aa99cb0b..67ac0057e1 100644
--- a/include/vlc_codec.h
+++ b/include/vlc_codec.h
@@ -174,13 +174,13 @@ struct decoder_t
     int             (*pf_get_display_rate)( decoder_t * );
 
     /* XXX use decoder_QueueVideo or decoder_QueueVideoWithCc */
-    int             (*pf_queue_video)( decoder_t *, picture_t * );
+    void            (*pf_queue_video)( decoder_t *, picture_t * );
     /* XXX use decoder_QueueAudio */
-    int             (*pf_queue_audio)( decoder_t *, block_t * );
+    void            (*pf_queue_audio)( decoder_t *, block_t * );
     /* XXX use decoder_QueueCC */
-    int             (*pf_queue_cc)( decoder_t *, block_t *, const decoder_cc_desc_t * );
+    void            (*pf_queue_cc)( decoder_t *, block_t *, const decoder_cc_desc_t * );
     /* XXX use decoder_QueueSub */
-    int             (*pf_queue_sub)( decoder_t *, subpicture_t *);
+    void            (*pf_queue_sub)( decoder_t *, subpicture_t *);
     void             *p_queue_ctx;
 
     /* Private structure for the owner of the decoder */
@@ -306,14 +306,12 @@ VLC_API void decoder_AbortPictures( decoder_t *dec, bool b_abort );
  * The caller doesn't own the picture anymore after this call (even in case of
  * error).
  * FIXME: input_DecoderFrameNext won't work if a module use this function.
- *
- * \return 0 if the picture is queued, -1 on error
  */
-static inline int decoder_QueueVideo( decoder_t *dec, picture_t *p_pic )
+static inline void decoder_QueueVideo( decoder_t *dec, picture_t *p_pic )
 {
     assert( p_pic->p_next == NULL );
     assert( dec->pf_queue_video != NULL );
-    return dec->pf_queue_video( dec, p_pic );
+    dec->pf_queue_video( dec, p_pic );
 }
 
 /**
@@ -322,17 +320,14 @@ static inline int decoder_QueueVideo( decoder_t *dec, picture_t *p_pic )
  * \param dec the decoder object
  * \param p_cc the closed-caption to queue
  * \param p_desc decoder_cc_desc_t description structure
- * \return 0 if queued, -1 on error
  */
-static inline int decoder_QueueCc( decoder_t *dec, block_t *p_cc,
+static inline void decoder_QueueCc( decoder_t *dec, block_t *p_cc,
                                    const decoder_cc_desc_t *p_desc )
 {
     if( dec->pf_queue_cc == NULL )
-    {
         block_Release( p_cc );
-        return -1;
-    }
-    return dec->pf_queue_cc( dec, p_cc, p_desc );
+    else
+        dec->pf_queue_cc( dec, p_cc, p_desc );
 }
 
 /**
@@ -341,14 +336,12 @@ static inline int decoder_QueueCc( decoder_t *dec, block_t *p_cc,
  * \note
  * The caller doesn't own the audio block anymore after this call (even in case
  * of error).
- *
- * \return 0 if the block is queued, -1 on error
  */
-static inline int decoder_QueueAudio( decoder_t *dec, block_t *p_aout_buf )
+static inline void decoder_QueueAudio( decoder_t *dec, block_t *p_aout_buf )
 {
     assert( p_aout_buf->p_next == NULL );
     assert( dec->pf_queue_audio != NULL );
-    return dec->pf_queue_audio( dec, p_aout_buf );
+    dec->pf_queue_audio( dec, p_aout_buf );
 }
 
 /**
@@ -357,14 +350,12 @@ static inline int decoder_QueueAudio( decoder_t *dec, block_t *p_aout_buf )
  * \note
  * The caller doesn't own the subtitle anymore after this call (even in case of
  * error).
- *
- * \return 0 if the subtitle is queued, -1 on error
  */
-static inline int decoder_QueueSub( decoder_t *dec, subpicture_t *p_spu )
+static inline void decoder_QueueSub( decoder_t *dec, subpicture_t *p_spu )
 {
     assert( p_spu->p_next == NULL );
     assert( dec->pf_queue_sub != NULL );
-    return dec->pf_queue_sub( dec, p_spu );
+    dec->pf_queue_sub( dec, p_spu );
 }
 
 /**
diff --git a/src/input/decoder.c b/src/input/decoder.c
index c4225ac94a..32a98b5132 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -970,7 +970,7 @@ static void PacketizerGetCc( decoder_t *p_dec, decoder_t *p_dec_cc )
     DecoderPlayCc( p_dec, p_cc, &desc );
 }
 
-static int DecoderQueueCc( decoder_t *p_videodec, block_t *p_cc,
+static void DecoderQueueCc( decoder_t *p_videodec, block_t *p_cc,
                            const decoder_cc_desc_t *p_desc )
 {
     decoder_owner_sys_t *p_owner = p_videodec->p_owner;
@@ -983,10 +983,9 @@ static int DecoderQueueCc( decoder_t *p_videodec, block_t *p_cc,
         else
             block_Release( p_cc );
     }
-    return 0;
 }
 
-static int DecoderPlayVideo( decoder_t *p_dec, picture_t *p_picture,
+static void DecoderPlayVideo( decoder_t *p_dec, picture_t *p_picture,
                              unsigned *restrict pi_lost_sum )
 {
     decoder_owner_sys_t *p_owner = p_dec->p_owner;
@@ -998,7 +997,7 @@ static int DecoderPlayVideo( decoder_t *p_dec, picture_t *p_picture,
     {
         vlc_mutex_unlock( &p_owner->lock );
         picture_Release( p_picture );
-        return -1;
+        return;
     }
 
     prerolled = p_owner->i_preroll_end > (mtime_t)INT64_MIN;
@@ -1077,11 +1076,10 @@ static int DecoderPlayVideo( decoder_t *p_dec, picture_t *p_picture,
         goto discard;
     }
 
-    return 0;
+    return;
 discard:
     *pi_lost_sum += 1;
     picture_Release( p_picture );
-    return 0;
 }
 
 static void DecoderUpdateStatVideo( decoder_owner_sys_t *p_owner,
@@ -1115,19 +1113,18 @@ static void DecoderUpdateStatVideo( decoder_owner_sys_t *p_owner,
     }
 }
 
-static int DecoderQueueVideo( decoder_t *p_dec, picture_t *p_pic )
+static void DecoderQueueVideo( decoder_t *p_dec, picture_t *p_pic )
 {
     assert( p_pic );
     unsigned i_lost = 0;
     decoder_owner_sys_t *p_owner = p_dec->p_owner;
 
-    int ret = DecoderPlayVideo( p_dec, p_pic, &i_lost );
+    DecoderPlayVideo( p_dec, p_pic, &i_lost );
 
     p_owner->pf_update_stat( p_owner, 1, i_lost );
-    return ret;
 }
 
-static int DecoderPlayAudio( decoder_t *p_dec, block_t *p_audio,
+static void DecoderPlayAudio( decoder_t *p_dec, block_t *p_audio,
                              unsigned *restrict pi_lost_sum )
 {
     decoder_owner_sys_t *p_owner = p_dec->p_owner;
@@ -1140,7 +1137,7 @@ static int DecoderPlayAudio( decoder_t *p_dec, block_t *p_audio,
     {
         vlc_mutex_unlock( &p_owner->lock );
         block_Release( p_audio );
-        return -1;
+        return;
     }
 
     prerolled = p_owner->i_preroll_end > (mtime_t)INT64_MIN;
@@ -1161,7 +1158,7 @@ static int DecoderPlayAudio( decoder_t *p_dec, block_t *p_audio,
         msg_Warn( p_dec, "non-dated audio buffer received" );
         *pi_lost_sum += 1;
         block_Release( p_audio );
-        return 0;
+        return;
     }
 
     /* */
@@ -1207,7 +1204,7 @@ static int DecoderPlayAudio( decoder_t *p_dec, block_t *p_audio,
         *pi_lost_sum += 1;
         block_Release( p_audio );
     }
-    return 0;
+    return;
 }
 
 static void DecoderUpdateStatAudio( decoder_owner_sys_t *p_owner,
@@ -1241,16 +1238,14 @@ static void DecoderUpdateStatAudio( decoder_owner_sys_t *p_owner,
     }
 }
 
-static int DecoderQueueAudio( decoder_t *p_dec, block_t *p_aout_buf )
+static void DecoderQueueAudio( decoder_t *p_dec, block_t *p_aout_buf )
 {
     unsigned lost = 0;
     decoder_owner_sys_t *p_owner = p_dec->p_owner;
 
-    int ret = DecoderPlayAudio( p_dec, p_aout_buf, &lost );
+    DecoderPlayAudio( p_dec, p_aout_buf, &lost );
 
     p_owner->pf_update_stat( p_owner, 1, lost );
-
-    return ret;
 }
 
 static void DecoderPlaySpu( decoder_t *p_dec, subpicture_t *p_subpic )
@@ -1296,12 +1291,11 @@ static void DecoderUpdateStatSpu( decoder_owner_sys_t *p_owner,
     (void) p_owner; (void) decoded; (void) lost;
 }
 
-static int DecoderQueueSpu( decoder_t *p_dec, subpicture_t *p_spu )
+static void DecoderQueueSpu( decoder_t *p_dec, subpicture_t *p_spu )
 {
     assert( p_spu );
     decoder_owner_sys_t *p_owner = p_dec->p_owner;
 
-    int i_ret = -1;
     vout_thread_t *p_vout = input_resource_HoldVout( p_owner->p_resource );
     if( p_vout && p_owner->p_spu_vout == p_vout )
     {
@@ -1318,7 +1312,6 @@ static int DecoderQueueSpu( decoder_t *p_dec, subpicture_t *p_spu )
         {
             vlc_mutex_unlock( &p_owner->lock );
             DecoderPlaySpu( p_dec, p_spu );
-            i_ret = 0;
         }
     }
     else
@@ -1327,7 +1320,6 @@ static int DecoderQueueSpu( decoder_t *p_dec, subpicture_t *p_spu )
     }
     if( p_vout )
         vlc_object_release( p_vout );
-    return i_ret;
 }
 
 static void DecoderProcess( decoder_t *p_dec, block_t *p_block );



More information about the vlc-commits mailing list