[vlc-devel] [PATCH 18/24] [mux/ts] Add dirac muxing support

davidf+nntp at woaf.net davidf+nntp at woaf.net
Thu Oct 30 12:29:47 CET 2008


From: David Flynn <davidf at rd.bbc.co.uk>

 - Basic signalling of stream type, including registration descriptor
 - Doesn't include setting extended stream_id
 - Allow Dirac PES packets to be unbounded in length

Signed-off-by: David Flynn <davidf at rd.bbc.co.uk>
---
 modules/mux/mpeg/pes.c |    7 +++++--
 modules/mux/mpeg/ts.c  |   24 +++++++++++++++++++++++-
 2 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/modules/mux/mpeg/pes.c b/modules/mux/mpeg/pes.c
index c4b6ca5..3b034f1 100644
--- a/modules/mux/mpeg/pes.c
+++ b/modules/mux/mpeg/pes.c
@@ -112,8 +112,11 @@ static inline int PESHeader( uint8_t *p_hdr, mtime_t i_pts, mtime_t i_dts,
                     if ( !i_header_size ) i_header_size = 0x0;
                 }
 
-                bits_write( &bits, 16, i_es_size + i_extra + 3
-                             + i_header_size ); // size
+                if (p_fmt->i_codec == VLC_FOURCC('d','r','a','c'))
+                    bits_write( &bits, 16, 0 ); // size unbounded
+                else
+                    bits_write( &bits, 16, i_es_size + i_extra + 3
+                                 + i_header_size ); // size
                 bits_write( &bits, 2, 0x02 ); // mpeg2 id
                 bits_write( &bits, 2, 0x00 ); // pes scrambling control
                 bits_write( &bits, 1, 0x00 ); // pes priority
diff --git a/modules/mux/mpeg/ts.c b/modules/mux/mpeg/ts.c
index 80fd15b..6c35c73 100644
--- a/modules/mux/mpeg/ts.c
+++ b/modules/mux/mpeg/ts.c
@@ -1032,6 +1032,10 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
                     p_stream->i_bih_width  = p_input->p_fmt->video.i_width;
                     p_stream->i_bih_height = p_input->p_fmt->video.i_height;
                     break;
+                case VLC_FOURCC( 'd', 'r', 'a', 'c' ):
+                    p_stream->i_stream_type = 0xd1;
+                    p_stream->i_stream_id = 0xfd;
+                    break;
                 default:
                     free( p_stream );
                     return VLC_EGENERIC;
@@ -1538,6 +1542,7 @@ static int Mux( sout_mux_t *p_mux )
                     else
                     {
                         int i_header_size = 0;
+                        int i_max_pes_size = 0;
                         int b_data_alignment = 0;
                         if( p_input->p_fmt->i_cat == SPU_ES )
                         {
@@ -1617,9 +1622,19 @@ static int Mux( sout_mux_t *p_mux )
                             p_data->i_pts = p_data->i_dts;
                         }
 
+                        if( p_input->p_fmt->i_codec ==
+                                   VLC_FOURCC('d','r','a','c') )
+                        {
+                            b_data_alignment = 1;
+                            /* dirac pes packets should be unbounded in
+                             * length, specify a suitibly large max size */
+                            i_max_pes_size = 0x7fffffff;
+                        }
+
                          EStoPES ( p_mux->p_sout, &p_data, p_data,
                                        p_input->p_fmt, p_stream->i_stream_id,
-                                       1, b_data_alignment, i_header_size, 0 );
+                                       1, b_data_alignment, i_header_size,
+                                       i_max_pes_size );
 
                         BufferChainAppend( &p_stream->chain_pes, p_data );
 
@@ -2668,6 +2683,13 @@ static void GetPMT( sout_mux_t *p_mux, sout_buffer_chain_t *c )
             /* "registration" descriptor : "AC-3" */
             dvbpsi_PMTESAddDescriptor( p_es, 0x05, 4, format );
         }
+        else if( p_stream->i_codec == VLC_FOURCC('d','r','a','c') )
+        {
+            /* Dirac registration descriptor */
+
+            uint8_t data[4] = { 'd', 'r', 'a', 'c' };
+            dvbpsi_PMTESAddDescriptor( p_es, 0x05, 4, data );
+        }
         else if( p_stream->i_codec == VLC_FOURCC('d','t','s',' ') )
         {
             /* DTS registration descriptor (ETSI TS 101 154 Annex F) */
-- 
1.5.6.5




More information about the vlc-devel mailing list