[vlc-commits] codec: cc: flag blocks when packetized and ordered

Francois Cartegnie git at videolan.org
Thu Aug 13 14:19:39 CEST 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sat Aug  8 01:13:21 2015 +0200| [fb51deba714c80b05978fa24ce1cd41138ca52bc] | committer: Francois Cartegnie

codec: cc: flag blocks when packetized and ordered

avoids reordering and display delay

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

 modules/codec/cc.c      |    6 ++++++
 modules/codec/cc.h      |    2 ++
 modules/demux/mp4/mp4.c |    2 ++
 3 files changed, 10 insertions(+)

diff --git a/modules/codec/cc.c b/modules/codec/cc.c
index dfbfb65..c9ba743 100644
--- a/modules/codec/cc.c
+++ b/modules/codec/cc.c
@@ -311,6 +311,12 @@ static block_t *Pop( decoder_t *p_dec )
      * XXX it won't work with H264 which use non out of order B picture or MMCO
      */
 
+    if( p_sys->i_block && (p_sys->pp_block[0]->i_flags & BLOCK_FLAG_PRIVATE_MASK) )
+    {
+        p_sys->i_block--;
+        return p_sys->pp_block[0];
+    }
+
     /* Wait for a P and output all *previous* picture by pts order (for
      * hierarchical B frames) */
     if( p_sys->i_block <= 1 ||
diff --git a/modules/codec/cc.h b/modules/codec/cc.h
index e824780..d13bfd2 100644
--- a/modules/codec/cc.h
+++ b/modules/codec/cc.h
@@ -26,6 +26,8 @@
 
 #include <vlc_bits.h>
 
+#define BLOCK_FLAG_ORDERED_CAPTIONS (0x01 << BLOCK_FLAG_PRIVATE_SHIFT)
+
 /* CC have a maximum rate of 9600 bit/s (per field?) */
 #define CC_MAX_DATA_SIZE (2 * 3*600)
 enum
diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index cd046d0..da2c157 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -38,6 +38,7 @@
 #include <vlc_aout.h>
 #include <assert.h>
 #include <limits.h>
+#include "../codec/cc.h"
 
 /*****************************************************************************
  * Module descriptor
@@ -482,6 +483,7 @@ static block_t * MP4_EIA608_Convert( block_t * p_block )
 
     block_Release( p_block );
     p_newblock->i_buffer = i_copied;
+    p_newblock->i_flags = BLOCK_FLAG_ORDERED_CAPTIONS;
     return p_newblock;
 }
 



More information about the vlc-commits mailing list