[vlc-commits] decoder: pass cc sub decoders reorder depth through QueueCC

Francois Cartegnie git at videolan.org
Tue May 23 18:17:54 CEST 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue May 23 18:09:40 2017 +0200| [8728715d351858d38578dacc9b2b68c21c51c2cf] | committer: Francois Cartegnie

decoder: pass cc sub decoders reorder depth through QueueCC

no comment

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

 include/vlc_codec.h            | 10 ++++++----
 modules/codec/avcodec/video.c  |  3 +--
 modules/codec/libmpeg2.c       |  2 +-
 modules/packetizer/h264.c      |  5 +++--
 modules/packetizer/hevc.c      |  5 +++--
 modules/packetizer/mpegvideo.c |  5 +++--
 modules/packetizer/vc1.c       |  5 +++--
 src/input/decoder.c            | 13 +++++++------
 8 files changed, 27 insertions(+), 21 deletions(-)

diff --git a/include/vlc_codec.h b/include/vlc_codec.h
index f152fa14cf..5c2baae517 100644
--- a/include/vlc_codec.h
+++ b/include/vlc_codec.h
@@ -130,7 +130,7 @@ struct decoder_t
      * pb_present will be used to known which cc channel are present (but
      * globaly, not necessary for the current packet. Video decoders should use
      * the decoder_QueueCc() function to pass closed captions. */
-    block_t *           ( * pf_get_cc )      ( decoder_t *, bool pb_present[4] );
+    block_t *           ( * pf_get_cc )      ( decoder_t *, bool pb_present[4], int * );
 
     /* Meta data at codec level
      *  The decoder owner set it back to NULL once it has retreived what it needs.
@@ -178,7 +178,7 @@ struct decoder_t
     /* XXX use decoder_QueueAudio */
     int             (*pf_queue_audio)( decoder_t *, block_t * );
     /* XXX use decoder_QueueCC */
-    int             (*pf_queue_cc)( decoder_t *, block_t *, bool p_cc_present[4] );
+    int             (*pf_queue_cc)( decoder_t *, block_t *, bool p_cc_present[4], int );
     /* XXX use decoder_QueueSub */
     int             (*pf_queue_sub)( decoder_t *, subpicture_t *);
     void             *p_queue_ctx;
@@ -311,17 +311,19 @@ static inline int decoder_QueueVideo( decoder_t *dec, picture_t *p_pic )
  * \param p_cc the closed-caption to queue
  * \param p_cc_present array-of-bool where each entry indicates whether the
  *                     given channel is present or not
+ * \param i_depth the closed-caption to queue reorder depth, or simply 0
+ *                     if using the old mpgv block flag tagging
  * \return 0 if queued, -1 on error
  */
 static inline int decoder_QueueCc( decoder_t *dec, block_t *p_cc,
-                                   bool p_cc_present[4] )
+                                   bool p_cc_present[4], int i_depth )
 {
     if( dec->pf_queue_cc == NULL )
     {
         block_Release( p_cc );
         return -1;
     }
-    return dec->pf_queue_cc( dec, p_cc, p_cc_present );
+    return dec->pf_queue_cc( dec, p_cc, p_cc_present, i_depth );
 }
 
 /**
diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index 51ca423b9e..52736c119b 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -1154,8 +1154,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block, bool *error
                         p_cc->i_dts = p_cc->i_pts = i_pts;
                     else
                         p_cc->i_pts = p_cc->i_dts;
-                    p_dec->fmt_out.subs.cc.i_reorder_depth = 4;
-                    decoder_QueueCc( p_dec, p_cc, p_sys->cc.pb_present );
+                    decoder_QueueCc( p_dec, p_cc, p_sys->cc.pb_present, 4 );
                 }
                 cc_Flush( &p_sys->cc );
             }
diff --git a/modules/codec/libmpeg2.c b/modules/codec/libmpeg2.c
index 8c6da24f41..52972288c6 100644
--- a/modules/codec/libmpeg2.c
+++ b/modules/codec/libmpeg2.c
@@ -719,7 +719,7 @@ static void SendCc( decoder_t *p_dec )
         p_cc->i_dts =
         p_cc->i_pts = p_sys->cc.b_reorder ? p_sys->i_cc_pts : p_sys->i_cc_dts;
         p_cc->i_flags = ( p_sys->cc.b_reorder  ? p_sys->i_cc_flags : BLOCK_FLAG_TYPE_P ) & ( BLOCK_FLAG_TYPE_I|BLOCK_FLAG_TYPE_P|BLOCK_FLAG_TYPE_B);
-        decoder_QueueCc( p_dec, p_cc, p_sys->cc.pb_present );
+        decoder_QueueCc( p_dec, p_cc, p_sys->cc.pb_present, 0 );
     }
     cc_Flush( &p_sys->cc );
     return;
diff --git a/modules/packetizer/h264.c b/modules/packetizer/h264.c
index 7da8dc90b8..989eac8f50 100644
--- a/modules/packetizer/h264.c
+++ b/modules/packetizer/h264.c
@@ -135,7 +135,7 @@ struct decoder_sys_t
 
 static block_t *Packetize( decoder_t *, block_t ** );
 static block_t *PacketizeAVC1( decoder_t *, block_t ** );
-static block_t *GetCc( decoder_t *p_dec, bool pb_present[4] );
+static block_t *GetCc( decoder_t *p_dec, bool pb_present[4], int * );
 static void PacketizeFlush( decoder_t * );
 
 static void PacketizeReset( void *p_private, bool b_broken );
@@ -490,8 +490,9 @@ static block_t *PacketizeAVC1( decoder_t *p_dec, block_t **pp_block )
 /*****************************************************************************
  * GetCc:
  *****************************************************************************/
-static block_t *GetCc( decoder_t *p_dec, bool pb_present[4] )
+static block_t *GetCc( decoder_t *p_dec, bool pb_present[4], int *pi_reorder_depth )
 {
+    *pi_reorder_depth = 0;
     return cc_storage_get_current( p_dec->p_sys->p_ccs, pb_present );
 }
 
diff --git a/modules/packetizer/hevc.c b/modules/packetizer/hevc.c
index b514bb1841..7260fc59db 100644
--- a/modules/packetizer/hevc.c
+++ b/modules/packetizer/hevc.c
@@ -69,7 +69,7 @@ static block_t *PacketizeParse(void *p_private, bool *pb_ts_used, block_t *);
 static block_t *ParseNALBlock(decoder_t *, bool *pb_ts_used, block_t *);
 static int PacketizeValidate(void *p_private, block_t *);
 static bool ParseSEICallback( const hxxx_sei_data_t *, void * );
-static block_t *GetCc( decoder_t *, bool pb_present[4] );
+static block_t *GetCc( decoder_t *, bool pb_present[4], int * );
 
 struct decoder_sys_t
 {
@@ -300,8 +300,9 @@ static void PacketizeFlush( decoder_t *p_dec )
 /*****************************************************************************
  * GetCc:
  *****************************************************************************/
-static block_t *GetCc( decoder_t *p_dec, bool pb_present[4] )
+static block_t *GetCc( decoder_t *p_dec, bool pb_present[4], int *pi_reorder_depth )
 {
+    *pi_reorder_depth = 0;
     return cc_storage_get_current( p_dec->p_sys->p_ccs, pb_present );
 }
 
diff --git a/modules/packetizer/mpegvideo.c b/modules/packetizer/mpegvideo.c
index 5f84d73017..b716115320 100644
--- a/modules/packetizer/mpegvideo.c
+++ b/modules/packetizer/mpegvideo.c
@@ -145,7 +145,7 @@ struct decoder_sys_t
 
 static block_t *Packetize( decoder_t *, block_t ** );
 static void PacketizeFlush( decoder_t * );
-static block_t *GetCc( decoder_t *p_dec, bool pb_present[4] );
+static block_t *GetCc( decoder_t *p_dec, bool pb_present[4], int * );
 
 static void PacketizeReset( void *p_private, bool b_broken );
 static block_t *PacketizeParse( void *p_private, bool *pb_ts_used, block_t * );
@@ -281,11 +281,12 @@ static void PacketizeFlush( decoder_t *p_dec )
 /*****************************************************************************
  * GetCc:
  *****************************************************************************/
-static block_t *GetCc( decoder_t *p_dec, bool pb_present[4] )
+static block_t *GetCc( decoder_t *p_dec, bool pb_present[4], int *pi_reorder_depth )
 {
     decoder_sys_t *p_sys = p_dec->p_sys;
     block_t *p_cc;
     int i;
+    *pi_reorder_depth = 0;
 
     for( i = 0; i < 4; i++ )
         pb_present[i] = p_sys->cc.pb_present[i];
diff --git a/modules/packetizer/vc1.c b/modules/packetizer/vc1.c
index de817c644e..56bb19d094 100644
--- a/modules/packetizer/vc1.c
+++ b/modules/packetizer/vc1.c
@@ -129,7 +129,7 @@ static block_t *PacketizeParse( void *p_private, bool *pb_ts_used, block_t * );
 static int PacketizeValidate( void *p_private, block_t * );
 
 static block_t *ParseIDU( decoder_t *p_dec, bool *pb_ts_used, block_t *p_frag );
-static block_t *GetCc( decoder_t *p_dec, bool pb_present[4] );
+static block_t *GetCc( decoder_t *p_dec, bool pb_present[4], int * );
 
 static const uint8_t p_vc1_startcode[3] = { 0x00, 0x00, 0x01 };
 /*****************************************************************************
@@ -762,13 +762,14 @@ static block_t *ParseIDU( decoder_t *p_dec, bool *pb_ts_used, block_t *p_frag )
 /*****************************************************************************
  * GetCc:
  *****************************************************************************/
-static block_t *GetCc( decoder_t *p_dec, bool pb_present[4] )
+static block_t *GetCc( decoder_t *p_dec, bool pb_present[4], int *pi_reorder_depth )
 {
     decoder_sys_t *p_sys = p_dec->p_sys;
     block_t *p_cc;
 
     for( int i = 0; i < 4; i++ )
         pb_present[i] = p_sys->cc.pb_present[i];
+    *pi_reorder_depth = 0;
 
     if( p_sys->cc.i_data <= 0 )
         return NULL;
diff --git a/src/input/decoder.c b/src/input/decoder.c
index 400464d085..187285790c 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -874,7 +874,7 @@ static void DecoderProcessSout( decoder_t *p_dec, block_t *p_block )
 #endif
 
 static void DecoderPlayCc( decoder_t *p_dec, block_t *p_cc,
-                           bool pb_present[4], const subs_format_t *p_fmt )
+                           bool pb_present[4], int i_reorder_depth )
 {
     decoder_owner_sys_t *p_owner = p_dec->p_owner;
     bool b_processed = false;
@@ -887,7 +887,7 @@ static void DecoderPlayCc( decoder_t *p_dec, block_t *p_cc,
         if( p_owner->cc.pp_decoder[i] )
             i_cc_decoder++;
     }
-    p_owner->cc.i_reorder_depth = p_fmt->cc.i_reorder_depth;
+    p_owner->cc.i_reorder_depth = i_reorder_depth;
 
     for( int i = 0; i < 4; i++ )
     {
@@ -918,14 +918,15 @@ static void PacketizerGetCc( decoder_t *p_dec, decoder_t *p_dec_cc )
 
     assert( p_dec_cc->pf_get_cc != NULL );
 
-    p_cc = p_dec_cc->pf_get_cc( p_dec_cc, pb_present );
+    int i_reorder_depth;
+    p_cc = p_dec_cc->pf_get_cc( p_dec_cc, pb_present, &i_reorder_depth );
     if( !p_cc )
         return;
-    DecoderPlayCc( p_dec, p_cc, pb_present, &p_dec_cc->fmt_out.subs );
+    DecoderPlayCc( p_dec, p_cc, pb_present, i_reorder_depth );
 }
 
 static int DecoderQueueCc( decoder_t *p_videodec, block_t *p_cc,
-                           bool p_cc_present[4] )
+                           bool p_cc_present[4], int i_reorder_depth )
 {
     decoder_owner_sys_t *p_owner = p_videodec->p_owner;
 
@@ -933,7 +934,7 @@ static int DecoderQueueCc( decoder_t *p_videodec, block_t *p_cc,
     {
         if( p_owner->cc.b_supported &&
            ( !p_owner->p_packetizer || !p_owner->p_packetizer->pf_get_cc ) )
-            DecoderPlayCc( p_videodec, p_cc, p_cc_present, &p_videodec->fmt_out.subs );
+            DecoderPlayCc( p_videodec, p_cc, p_cc_present, i_reorder_depth );
         else
             block_Release( p_cc );
     }



More information about the vlc-commits mailing list