[vlc-commits] mux: ts: stream_type belongs to ts

Francois Cartegnie git at videolan.org
Tue Dec 13 14:52:54 CET 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Dec 13 11:07:59 2016 +0100| [e0b8480ec356e0fc932a584498acf46258ffdc3e] | committer: Francois Cartegnie

mux: ts: stream_type belongs to ts

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

 modules/demux/mpeg/ts_hotfixes.c |  2 +-
 modules/mux/mpeg/streams.h       |  4 ++--
 modules/mux/mpeg/tables.c        | 25 +++++++++++++------------
 modules/mux/mpeg/ts.c            | 36 ++++++++++++++++++------------------
 4 files changed, 34 insertions(+), 33 deletions(-)

diff --git a/modules/demux/mpeg/ts_hotfixes.c b/modules/demux/mpeg/ts_hotfixes.c
index 3cdec5f..036dd9f 100644
--- a/modules/demux/mpeg/ts_hotfixes.c
+++ b/modules/demux/mpeg/ts_hotfixes.c
@@ -333,7 +333,7 @@ void MissingPATPMTFixup( demux_t *p_demux )
                 continue;
 
             esstreams[j].pes.i_codec = p_pid->probed.i_fourcc;
-            esstreams[j].pes.i_stream_type = p_pid->probed.i_type;
+            esstreams[j].ts.i_stream_type = p_pid->probed.i_type;
             esstreams[j].ts.i_pid = p_pid->i_pid;
             mapped[j].pes = &esstreams[j].pes;
             mapped[j].ts = &esstreams[j].ts;
diff --git a/modules/mux/mpeg/streams.h b/modules/mux/mpeg/streams.h
index 1dcd150..5958ef7 100644
--- a/modules/mux/mpeg/streams.h
+++ b/modules/mux/mpeg/streams.h
@@ -24,6 +24,7 @@ typedef struct
 {
     uint16_t        i_pid;
 
+    uint8_t         i_stream_type;
     uint8_t         i_continuity_counter;
     bool            b_discontinuity;
 
@@ -33,8 +34,7 @@ typedef struct
 {
     vlc_fourcc_t    i_codec;
 
-    int             i_stream_type;
-    int             i_stream_id;
+    int             i_stream_id; /* keep as int for drac */
 
     int             i_width, i_height;
 
diff --git a/modules/mux/mpeg/tables.c b/modules/mux/mpeg/tables.c
index e4d7db1..8514ca5 100644
--- a/modules/mux/mpeg/tables.c
+++ b/modules/mux/mpeg/tables.c
@@ -174,23 +174,23 @@ static void GetPMTmpeg4( vlc_object_t *p_object, dvbpsi_pmt_t *p_dvbpmt,
         bits_write( &bits, 8,   0x04 ); /* DecoderConfigDescrTag */
         bits_fix_Decoder = bits;
         bits_write( &bits, 24,  GetDescriptorLength24b( 0 ) );
-        if( p_stream->pes->i_stream_type == 0x10 )
+        if( p_stream->ts->i_stream_type == 0x10 )
         {
             bits_write( &bits, 8, 0x20 );   /* Visual 14496-2 */
             bits_write( &bits, 6, 0x04 );   /* VisualStream */
         }
-        else if( p_stream->pes->i_stream_type == 0x1b )
+        else if( p_stream->ts->i_stream_type == 0x1b )
         {
             bits_write( &bits, 8, 0x21 );   /* Visual 14496-2 */
             bits_write( &bits, 6, 0x04 );   /* VisualStream */
         }
-        else if( p_stream->pes->i_stream_type == 0x11 ||
-                 p_stream->pes->i_stream_type == 0x0f )
+        else if( p_stream->ts->i_stream_type == 0x11 ||
+                 p_stream->ts->i_stream_type == 0x0f )
         {
             bits_write( &bits, 8, 0x40 );   /* Audio 14496-3 */
             bits_write( &bits, 6, 0x05 );   /* AudioStream */
         }
-        else if( p_stream->pes->i_stream_type == 0x12 &&
+        else if( p_stream->ts->i_stream_type == 0x12 &&
                  p_stream->pes->i_codec == VLC_CODEC_SUBT )
         {
             bits_write( &bits, 8, 0x0B );   /* Text Stream */
@@ -251,11 +251,12 @@ static void GetPMTmpeg4( vlc_object_t *p_object, dvbpsi_pmt_t *p_dvbpmt,
     dvbpsi_pmt_descriptor_add(&p_dvbpmt[0], 0x1d, bits.i_data, bits.p_data);
 }
 
-static void UpdateServiceType( uint8_t *pi_service_cat, uint8_t *pi_service_type, const pes_stream_t *p_pes )
+static void UpdateServiceType( uint8_t *pi_service_cat, uint8_t *pi_service_type,
+                               const ts_stream_t *p_ts, const pes_stream_t *p_pes )
 {
     uint8_t i_type = 0x00;
 
-    switch( p_pes->i_stream_type )
+    switch( p_ts->i_stream_type )
     {
         case 0x01: /* MPEG1 */
         case 0x02: /* MPEG2 */
@@ -297,7 +298,7 @@ static void UpdateServiceType( uint8_t *pi_service_cat, uint8_t *pi_service_type
     if( *pi_service_cat != VIDEO_ES ) /* Don't overwrite video */
     {
         /* Not video, try audio */
-        switch( p_pes->i_stream_type )
+        switch( p_ts->i_stream_type )
         {
             case 0x03: /* MPEG1 audio */
             case 0x04: /* MPEG2 audio */
@@ -404,7 +405,7 @@ void BuildPMT( dvbpsi_t *p_dvbpsi, vlc_object_t *p_object,
         const pes_mapped_stream_t *p_stream = &p_mapped_streams[i];
 
         dvbpsi_pmt_es_t *p_es = dvbpsi_pmt_es_add( &dvbpmt[p_stream->i_mapped_prog],
-                    p_stream->pes->i_stream_type, p_stream->ts->i_pid );
+                    p_stream->ts->i_stream_type, p_stream->ts->i_pid );
 
         if( p_stream->pes->i_stream_id == 0xfa || p_stream->pes->i_stream_id == 0xfb )
         {
@@ -415,7 +416,7 @@ void BuildPMT( dvbpsi_t *p_dvbpsi, vlc_object_t *p_object,
             es_id[1] = (p_stream->pes->i_es_id)&0xff;
             dvbpsi_pmt_es_descriptor_add( p_es, 0x1f, 2, es_id );
         }
-        else if( p_stream->pes->i_stream_type == 0xa0 )
+        else if( p_stream->ts->i_stream_type == 0xa0 )
         {
             uint8_t data[512];
             size_t i_extra = __MIN( p_stream->pes->i_extra, 502 );
@@ -436,7 +437,7 @@ void BuildPMT( dvbpsi_t *p_dvbpsi, vlc_object_t *p_object,
             /* 0xa0 is private */
             dvbpsi_pmt_es_descriptor_add( p_es, 0xa0, i_extra + 10, data );
         }
-        else if( p_stream->pes->i_stream_type == 0x81 )
+        else if( p_stream->ts->i_stream_type == 0x81 )
         {
             uint8_t format[4] = { 'A', 'C', '-', '3'};
 
@@ -527,7 +528,7 @@ void BuildPMT( dvbpsi_t *p_dvbpsi, vlc_object_t *p_object,
         {
             UpdateServiceType( &pi_service_cats[p_stream->i_mapped_prog],
                                &pi_service_types[p_stream->i_mapped_prog],
-                               p_stream->pes );
+                               p_stream->ts, p_stream->pes );
         }
     }
 
diff --git a/modules/mux/mpeg/ts.c b/modules/mux/mpeg/ts.c
index f403372..59c13ce 100644
--- a/modules/mux/mpeg/ts.c
+++ b/modules/mux/mpeg/ts.c
@@ -922,7 +922,7 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
         p_stream->pes.i_height = p_input->fmt.video.i_height;
     }
 
-    p_stream->pes.i_stream_type = 0x00;
+    p_stream->ts.i_stream_type = 0x00;
     switch( p_input->p_fmt->i_codec )
     {
     /* VIDEO */
@@ -931,20 +931,20 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
     case VLC_CODEC_MP2V:
     case VLC_CODEC_MP1V:
         /* TODO: do we need to check MPEG-I/II ? */
-        p_stream->pes.i_stream_type = 0x02;
+        p_stream->ts.i_stream_type = 0x02;
         p_stream->pes.i_stream_id = 0xe0;
         break;
     case VLC_CODEC_MP4V:
-        p_stream->pes.i_stream_type = 0x10;
+        p_stream->ts.i_stream_type = 0x10;
         p_stream->pes.i_stream_id = 0xe0;
         p_stream->pes.i_es_id = p_stream->ts.i_pid;
         break;
     case VLC_CODEC_HEVC:
-        p_stream->pes.i_stream_type = 0x24;
+        p_stream->ts.i_stream_type = 0x24;
         p_stream->pes.i_stream_id = 0xe0;
         break;
     case VLC_CODEC_H264:
-        p_stream->pes.i_stream_type = 0x1b;
+        p_stream->ts.i_stream_type = 0x1b;
         p_stream->pes.i_stream_id = 0xe0;
         break;
     /* XXX dirty dirty but somebody want crapy MS-codec XXX */
@@ -957,29 +957,29 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
     case VLC_CODEC_DIV2:
     case VLC_CODEC_DIV1:
     case VLC_CODEC_MJPG:
-        p_stream->pes.i_stream_type = 0xa0; /* private */
+        p_stream->ts.i_stream_type = 0xa0; /* private */
         p_stream->pes.i_stream_id = 0xa0;   /* beurk */
         break;
     case VLC_CODEC_DIRAC:
         /* stream_id makes use of stream_id_extension */
         p_stream->pes.i_stream_id = (PES_EXTENDED_STREAM_ID << 8) | 0x60;
-        p_stream->pes.i_stream_type = 0xd1;
+        p_stream->ts.i_stream_type = 0xd1;
         break;
 
     /* AUDIO */
 
     case VLC_CODEC_MPGA:
     case VLC_CODEC_MP3:
-        p_stream->pes.i_stream_type =
+        p_stream->ts.i_stream_type =
             p_input->p_fmt->audio.i_rate >= 32000 ? 0x03 : 0x04;
         p_stream->pes.i_stream_id = 0xc0;
         break;
     case VLC_CODEC_A52:
-        p_stream->pes.i_stream_type = 0x81;
+        p_stream->ts.i_stream_type = 0x81;
         p_stream->pes.i_stream_id = 0xbd;
         break;
     case VLC_CODEC_DVD_LPCM:
-        p_stream->pes.i_stream_type = 0x83;
+        p_stream->ts.i_stream_type = 0x83;
         p_stream->pes.i_stream_id = 0xbd;
         break;
     case VLC_CODEC_OPUS:
@@ -990,14 +990,14 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
         }
     case VLC_CODEC_EAC3:
     case VLC_CODEC_DTS:
-        p_stream->pes.i_stream_type = 0x06;
+        p_stream->ts.i_stream_type = 0x06;
         p_stream->pes.i_stream_id = 0xbd;
         break;
     case VLC_CODEC_MP4A:
         /* XXX: make that configurable in some way when LOAS
          * is implemented for AAC in TS */
-        //p_stream->pes.i_stream_type = 0x11; /* LOAS/LATM */
-        p_stream->pes.i_stream_type = 0x0f; /* ADTS */
+        //p_stream->ts.i_stream_type = 0x11; /* LOAS/LATM */
+        p_stream->ts.i_stream_type = 0x0f; /* ADTS */
         p_stream->pes.i_stream_id = 0xc0;
         p_stream->pes.i_es_id = p_stream->ts.i_pid;
         break;
@@ -1005,26 +1005,26 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
     /* TEXT */
 
     case VLC_CODEC_SPU:
-        p_stream->pes.i_stream_type = 0x82;
+        p_stream->ts.i_stream_type = 0x82;
         p_stream->pes.i_stream_id = 0xbd;
         break;
     case VLC_CODEC_SUBT:
-        p_stream->pes.i_stream_type = 0x12;
+        p_stream->ts.i_stream_type = 0x12;
         p_stream->pes.i_stream_id = 0xfa;
         p_stream->pes.i_es_id = p_stream->ts.i_pid;
         break;
     case VLC_CODEC_DVBS:
-        p_stream->pes.i_stream_type = 0x06;
+        p_stream->ts.i_stream_type = 0x06;
         p_stream->pes.i_es_id = p_input->p_fmt->subs.dvb.i_id;
         p_stream->pes.i_stream_id = 0xbd;
         break;
     case VLC_CODEC_TELETEXT:
-        p_stream->pes.i_stream_type = 0x06;
+        p_stream->ts.i_stream_type = 0x06;
         p_stream->pes.i_stream_id = 0xbd; /* FIXME */
         break;
     }
 
-    if (p_stream->pes.i_stream_type == 0x00)
+    if (p_stream->ts.i_stream_type == 0x00)
     {
         msg_Warn( p_mux, "rejecting stream with unsupported codec %4.4s",
                   (char*)&p_stream->pes.i_codec );



More information about the vlc-commits mailing list