[vlc-commits] es: pass no cc reorder in es fmt

Francois Cartegnie git at videolan.org
Tue Sep 19 22:36:03 CEST 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Sep 19 22:18:17 2017 +0200| [9a3111a349b9926b8a9788178e3daa14da80706e] | committer: Francois Cartegnie

es: pass no cc reorder in es fmt

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

 include/vlc_es.h                 | 3 ++-
 modules/codec/cc.c               | 3 ++-
 modules/demux/mp4/essetup.c      | 1 +
 modules/demux/subtitle.c         | 1 +
 modules/packetizer/h264.c        | 3 +--
 modules/packetizer/hevc.c        | 3 +--
 modules/packetizer/hxxx_common.c | 7 +++++--
 modules/packetizer/hxxx_common.h | 3 ++-
 modules/packetizer/mpegvideo.c   | 4 ++--
 modules/packetizer/vc1.c         | 7 ++-----
 10 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/include/vlc_es.h b/include/vlc_es.h
index f15c9dae2b..478940bdca 100644
--- a/include/vlc_es.h
+++ b/include/vlc_es.h
@@ -537,7 +537,8 @@ struct subs_format_t
     struct
     {
         uint8_t i_channel;
-        uint8_t i_reorder_depth; /* Reorder depth or transport video */
+        /* Reorder depth of transport video, -1 for no reordering */
+        int i_reorder_depth;
     } cc;
 
     text_style_t *p_style; /* Default styles to use */
diff --git a/modules/codec/cc.c b/modules/codec/cc.c
index ee35007291..e9d0b5e810 100644
--- a/modules/codec/cc.c
+++ b/modules/codec/cc.c
@@ -341,7 +341,8 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
         Push( p_dec, p_block );
     }
 
-    for( ; DoDecode( p_dec, (p_block == NULL) ); );
+    const bool b_no_reorder = (p_dec->fmt_in.subs.cc.i_reorder_depth < 0);
+    for( ; DoDecode( p_dec, (p_block == NULL) || b_no_reorder ); );
 
     return VLCDEC_SUCCESS;
 }
diff --git a/modules/demux/mp4/essetup.c b/modules/demux/mp4/essetup.c
index a085289d58..1ff001602d 100644
--- a/modules/demux/mp4/essetup.c
+++ b/modules/demux/mp4/essetup.c
@@ -1248,6 +1248,7 @@ int SetupSpuES( demux_t *p_demux, mp4_track_t *p_track, MP4_Box_t *p_sample )
         case ATOM_c608: /* EIA608 closed captions */
         //case ATOM_c708: /* EIA708 closed captions */
             p_track->fmt.i_codec = VLC_CODEC_CEA608;
+            p_track->fmt.subs.cc.i_reorder_depth = -1;
             break;
 
         case( VLC_FOURCC( 't', 'e', 'x', 't' ) ):
diff --git a/modules/demux/subtitle.c b/modules/demux/subtitle.c
index c532d3fcfe..71302807e4 100644
--- a/modules/demux/subtitle.c
+++ b/modules/demux/subtitle.c
@@ -721,6 +721,7 @@ static int Open ( vlc_object_t *p_this )
     else if( p_sys->props.i_type == SUB_TYPE_SCC )
     {
         es_format_Init( &fmt, SPU_ES, VLC_CODEC_CEA608 );
+        fmt.subs.cc.i_reorder_depth = -1;
     }
     else
         es_format_Init( &fmt, SPU_ES, VLC_CODEC_SUBT );
diff --git a/modules/packetizer/h264.c b/modules/packetizer/h264.c
index 152a14a08c..a6814229c1 100644
--- a/modules/packetizer/h264.c
+++ b/modules/packetizer/h264.c
@@ -488,8 +488,7 @@ static block_t *PacketizeAVC1( decoder_t *p_dec, block_t **pp_block )
  *****************************************************************************/
 static block_t *GetCc( decoder_t *p_dec, bool pb_present[4], int *pi_reorder_depth )
 {
-    *pi_reorder_depth = 4;
-    return cc_storage_get_current( p_dec->p_sys->p_ccs, pb_present );
+    return cc_storage_get_current( p_dec->p_sys->p_ccs, pb_present, pi_reorder_depth );
 }
 
 /****************************************************************************
diff --git a/modules/packetizer/hevc.c b/modules/packetizer/hevc.c
index ca8a86583e..9bdca109ba 100644
--- a/modules/packetizer/hevc.c
+++ b/modules/packetizer/hevc.c
@@ -306,8 +306,7 @@ static void PacketizeFlush( decoder_t *p_dec )
  *****************************************************************************/
 static block_t *GetCc( decoder_t *p_dec, bool pb_present[4], int *pi_reorder_depth )
 {
-    *pi_reorder_depth = 4;
-    return cc_storage_get_current( p_dec->p_sys->p_ccs, pb_present );
+    return cc_storage_get_current( p_dec->p_sys->p_ccs, pb_present, pi_reorder_depth );
 }
 
 /****************************************************************************
diff --git a/modules/packetizer/hxxx_common.c b/modules/packetizer/hxxx_common.c
index 70708a6bb0..745921966b 100644
--- a/modules/packetizer/hxxx_common.c
+++ b/modules/packetizer/hxxx_common.c
@@ -80,10 +80,13 @@ void cc_storage_commit( cc_storage_t *p_ccs, block_t *p_pic )
     cc_Flush( &p_ccs->next );
 }
 
-block_t * cc_storage_get_current( cc_storage_t *p_ccs, bool pb_present[4] )
+block_t * cc_storage_get_current( cc_storage_t *p_ccs, bool pb_present[4],
+                                  int *pi_reorder_depth )
 {
     block_t *p_block;
 
+    *pi_reorder_depth = p_ccs->current.b_reorder ? 4 : -1;
+
     for( int i = 0; i < 4; i++ )
         pb_present[i] = p_ccs->current.pb_present[i];
 
@@ -96,7 +99,7 @@ block_t * cc_storage_get_current( cc_storage_t *p_ccs, bool pb_present[4] )
         memcpy( p_block->p_buffer, p_ccs->current.p_data, p_ccs->current.i_data );
         p_block->i_dts =
         p_block->i_pts = p_ccs->current.b_reorder ? p_ccs->i_pts : p_ccs->i_dts;
-        p_block->i_flags = ( p_ccs->current.b_reorder  ? p_ccs->i_flags : BLOCK_FLAG_TYPE_P ) & BLOCK_FLAG_TYPE_MASK;
+        p_block->i_flags = p_ccs->i_flags & BLOCK_FLAG_TYPE_MASK;
     }
     cc_Flush( &p_ccs->current );
 
diff --git a/modules/packetizer/hxxx_common.h b/modules/packetizer/hxxx_common.h
index 89d20e7307..6e7cd0964f 100644
--- a/modules/packetizer/hxxx_common.h
+++ b/modules/packetizer/hxxx_common.h
@@ -33,7 +33,8 @@ void cc_storage_append( cc_storage_t *p_ccs, bool b_top_field_first,
                                       const uint8_t *p_buf, size_t i_buf );
 void cc_storage_commit( cc_storage_t *p_ccs, block_t *p_pic );
 
-block_t * cc_storage_get_current( cc_storage_t *p_ccs, bool pb_present[4] );
+block_t * cc_storage_get_current( cc_storage_t *p_ccs, bool pb_present[4],
+                                  int *pi_reorder_depth );
 
 /* */
 
diff --git a/modules/packetizer/mpegvideo.c b/modules/packetizer/mpegvideo.c
index a4d9657f1e..83c403b0d0 100644
--- a/modules/packetizer/mpegvideo.c
+++ b/modules/packetizer/mpegvideo.c
@@ -317,7 +317,7 @@ static block_t *GetCc( decoder_t *p_dec, bool pb_present[4], int *pi_reorder_dep
     decoder_sys_t *p_sys = p_dec->p_sys;
     block_t *p_cc;
     int i;
-    *pi_reorder_depth = 0;
+    *pi_reorder_depth = p_sys->cc.b_reorder ? 0 : -1;
 
     for( i = 0; i < 4; i++ )
         pb_present[i] = p_sys->cc.pb_present[i];
@@ -331,7 +331,7 @@ static block_t *GetCc( decoder_t *p_dec, bool pb_present[4], int *pi_reorder_dep
         memcpy( p_cc->p_buffer, p_sys->cc.p_data, p_sys->cc.i_data );
         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;
+        p_cc->i_flags = p_sys->i_cc_flags & BLOCK_FLAG_TYPE_MASK;
     }
     cc_Flush( &p_sys->cc );
     return p_cc;
diff --git a/modules/packetizer/vc1.c b/modules/packetizer/vc1.c
index 56bb19d094..b075299980 100644
--- a/modules/packetizer/vc1.c
+++ b/modules/packetizer/vc1.c
@@ -766,13 +766,10 @@ static block_t *GetCc( decoder_t *p_dec, bool pb_present[4], int *pi_reorder_dep
 {
     decoder_sys_t *p_sys = p_dec->p_sys;
     block_t *p_cc;
+    *pi_reorder_depth = p_sys->cc.b_reorder ? 4 : -1;
 
     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;
 
     p_cc = block_Alloc( p_sys->cc.i_data);
     if( p_cc )
@@ -780,7 +777,7 @@ static block_t *GetCc( decoder_t *p_dec, bool pb_present[4], int *pi_reorder_dep
         memcpy( p_cc->p_buffer, p_sys->cc.p_data, p_sys->cc.i_data );
         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_MASK;
+        p_cc->i_flags = p_sys->i_cc_flags & BLOCK_FLAG_TYPE_MASK;
     }
     cc_Flush( &p_sys->cc );
     return p_cc;



More information about the vlc-commits mailing list