]> git.sesse.net Git - vlc/commitdiff
For private stream_type, fallback on registration descriptor in TS demuxer.
authorLaurent Aimar <fenrir@videolan.org>
Fri, 26 Feb 2010 22:50:25 +0000 (23:50 +0100)
committerLaurent Aimar <fenrir@videolan.org>
Fri, 26 Feb 2010 22:53:21 +0000 (23:53 +0100)
It closes #3339 (the stream is correctly detected), but as the 302M content is
not PCM data (probably AC3 or Dolby E), the audio is not correctly decoded.

modules/demux/ts.c

index 88be47fdbeaec5da47d89ac5f818b3c5db9e9a93..4838ebe5aeda7fdfa739956f8ba8d6461c70db8a 100644 (file)
@@ -3781,6 +3781,38 @@ static void PMTSetupEsHDMV( demux_t *p_demux, ts_pid_t *pid,
         break;
     }
 }
+
+static void PMTSetupEsRegistration( demux_t *p_demux, ts_pid_t *pid,
+                                    const dvbpsi_pmt_es_t *p_es )
+{
+    static const struct
+    {
+        char         psz_tag[5];
+        int          i_cat;
+        vlc_fourcc_t i_codec;
+    } p_regs[] = {
+        { "AC-3", AUDIO_ES, VLC_CODEC_A52   },
+        { "DTS1", AUDIO_ES, VLC_CODEC_DTS   },
+        { "DTS2", AUDIO_ES, VLC_CODEC_DTS   },
+        { "DTS3", AUDIO_ES, VLC_CODEC_DTS   },
+        { "BSSD", AUDIO_ES, VLC_CODEC_302M  },
+        { "VC-1", VIDEO_ES, VLC_CODEC_VC1   },
+        { "drac", VIDEO_ES, VLC_CODEC_DIRAC },
+        { "", UNKNOWN_ES, 0 }
+    };
+    es_format_t *p_fmt = &pid->es->fmt;
+
+    for( int i = 0; p_regs[i].i_cat != UNKNOWN_ES; i++ )
+    {
+        if( PMTEsHasRegistration( p_demux, p_es, p_regs[i].psz_tag ) )
+        {
+            p_fmt->i_cat   = p_regs[i].i_cat;
+            p_fmt->i_codec = p_regs[i].i_codec;
+            break;
+        }
+    }
+}
+
 static void PMTParseEsIso639( demux_t *p_demux, ts_pid_t *pid,
                               const dvbpsi_pmt_es_t *p_es )
 {
@@ -4068,6 +4100,10 @@ static void PMTCallBack( demux_t *p_demux, dvbpsi_pmt_t *p_pmt )
         {
             PMTSetupEsHDMV( p_demux, pid, p_es );
         }
+        else if( p_es->i_type >= 0x80 )
+        {
+            PMTSetupEsRegistration( p_demux, pid, p_es );
+        }
 
         if( pid->es->fmt.i_cat == AUDIO_ES ||
             ( pid->es->fmt.i_cat == SPU_ES &&