[vlc-commits] Demux: Correctly differenciate MLP and THD raw samples

Jean-Baptiste Kempf git at videolan.org
Mon Jul 22 20:34:54 CEST 2013


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Mon Jul 22 20:33:54 2013 +0200| [449bf4a7605bdc3038a39031099f09733a5101e2] | committer: Jean-Baptiste Kempf

Demux: Correctly differenciate MLP and THD raw samples

Ref #8850

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

 modules/demux/mpeg/es.c |   25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/modules/demux/mpeg/es.c b/modules/demux/mpeg/es.c
index 32bfe48..8b4b7d2 100644
--- a/modules/demux/mpeg/es.c
+++ b/modules/demux/mpeg/es.c
@@ -141,6 +141,7 @@ static int DtsProbe( demux_t *p_demux, int64_t *pi_offset );
 static int DtsInit( demux_t *p_demux );
 
 static int MlpProbe( demux_t *p_demux, int64_t *pi_offset );
+static int ThdProbe( demux_t *p_demux, int64_t *pi_offset );
 static int MlpInit( demux_t *p_demux );
 
 static bool Parse( demux_t *p_demux, block_t **pp_output );
@@ -152,6 +153,7 @@ static const codec_t p_codecs[] = {
     { VLC_CODEC_EAC3, true,  "eac3 audio", EA52Probe, A52Init },
     { VLC_CODEC_DTS, false, "dts audio",  DtsProbe,  DtsInit },
     { VLC_CODEC_MLP, false, "mlp audio",  MlpProbe,  MlpInit },
+    { VLC_CODEC_TRUEHD, false, "TrueHD audio",  ThdProbe,  MlpInit },
 
     { 0, false, NULL, NULL, NULL }
 };
@@ -969,7 +971,19 @@ static int MlpCheckSync( const uint8_t *p_peek, int *pi_samples )
     if( p_peek[4+0] != 0xf8 || p_peek[4+1] != 0x72 || p_peek[4+2] != 0x6f )
         return -1;
 
-    if( p_peek[4+3] != 0xba && p_peek[4+3] != 0xbb )
+    if( p_peek[4+3] != 0xbb )
+        return -1;
+
+    /* TODO checksum and real size for robustness */
+    VLC_UNUSED(pi_samples);
+    return 0;
+}
+static int ThdCheckSync( const uint8_t *p_peek, int *pi_samples )
+{
+    if( p_peek[4+0] != 0xf8 || p_peek[4+1] != 0x72 || p_peek[4+2] != 0x6f )
+        return -1;
+
+    if( p_peek[4+3] != 0xba )
         return -1;
 
     /* TODO checksum and real size for robustness */
@@ -978,11 +992,18 @@ static int MlpCheckSync( const uint8_t *p_peek, int *pi_samples )
 }
 static int MlpProbe( demux_t *p_demux, int64_t *pi_offset )
 {
-    const char *ppsz_name[] = { "mlp", "thd", NULL };
+    const char *ppsz_name[] = { "mlp", NULL };
     const int pi_wav[] = { WAVE_FORMAT_PCM, WAVE_FORMAT_UNKNOWN };
 
     return GenericProbe( p_demux, pi_offset, ppsz_name, MlpCheckSync, 4+28+16*4, pi_wav );
 }
+static int ThdProbe( demux_t *p_demux, int64_t *pi_offset )
+{
+    const char *ppsz_name[] = { "thd", NULL };
+    const int pi_wav[] = { WAVE_FORMAT_PCM, WAVE_FORMAT_UNKNOWN };
+
+    return GenericProbe( p_demux, pi_offset, ppsz_name, ThdCheckSync, 4+28+16*4, pi_wav );
+}
 static int MlpInit( demux_t *p_demux )
 
 {



More information about the vlc-commits mailing list