[vlc-commits] DTS in wav: use DTS helper

Jean-Baptiste Kempf git at videolan.org
Mon Nov 12 17:49:43 CET 2012


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Mon Nov 12 17:48:54 2012 +0100| [68416d1a4d91fddc6060a8c92abab224d7dc03a3] | committer: Jean-Baptiste Kempf

DTS in wav: use DTS helper

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

 modules/codec/dts_header.c |   10 ++++++----
 modules/demux/Modules.am   |    2 +-
 modules/demux/mpeg/es.c    |   32 ++------------------------------
 3 files changed, 9 insertions(+), 35 deletions(-)

diff --git a/modules/codec/dts_header.c b/modules/codec/dts_header.c
index 8296220..b08b540 100644
--- a/modules/codec/dts_header.c
+++ b/modules/codec/dts_header.c
@@ -195,11 +195,9 @@ int GetSyncInfo( const uint8_t *p_buf,
                                      pi_bit_rate, pi_frame_length );
     }
     /* DTS-HD */
-    else
+    else if( p_buf[0] == 0x64 && p_buf[1] ==  0x58 &&
+                p_buf[2] == 0x20 && p_buf[3] ==  0x25 )
     {
-        assert( p_buf[0] == 0x64 && p_buf[1] ==  0x58 &&
-                p_buf[2] == 0x20 && p_buf[3] ==  0x25 );
-
         int i_dts_hd_size;
         bs_t s;
         bs_init( &s, &p_buf[4], DTS_HEADER_SIZE - 4 );
@@ -230,6 +228,10 @@ int GetSyncInfo( const uint8_t *p_buf,
         */
         return i_dts_hd_size;
     }
+    else
+    {
+        return VLC_EGENERIC;
+    }
 
     *pb_dts_hd = false;
     return i_frame_size;
diff --git a/modules/demux/Modules.am b/modules/demux/Modules.am
index 43f644d..01a9d72 100644
--- a/modules/demux/Modules.am
+++ b/modules/demux/Modules.am
@@ -65,7 +65,7 @@ endif
 libvlc_LTLIBRARIES += $(LTLIBavformat)
 EXTRA_LTLIBRARIES += libavformat_plugin.la
 
-libes_plugin_la_SOURCES  = mpeg/es.c
+libes_plugin_la_SOURCES  = mpeg/es.c ../codec/dts_header.c ../codec/dts_header.h ../codec/a52.h
 libes_plugin_la_CFLAGS = $(AM_CFLAGS)
 libes_plugin_la_LIBADD = $(AM_LIBADD)
 
diff --git a/modules/demux/mpeg/es.c b/modules/demux/mpeg/es.c
index 87dbf17..742bd7c 100644
--- a/modules/demux/mpeg/es.c
+++ b/modules/demux/mpeg/es.c
@@ -38,6 +38,7 @@
 #include <vlc_input.h>
 
 #include "../../codec/a52.h"
+#include "../../codec/dts_header.h"
 
 /*****************************************************************************
  * Module descriptor
@@ -920,36 +921,7 @@ static int A52Init( demux_t *p_demux )
 static int DtsCheckSync( const uint8_t *p_peek, int *pi_samples )
 {
     /* TODO return frame size for robustness */
-
-    /* 14 bits, little endian version of the bitstream */
-    if( p_peek[0] == 0xff && p_peek[1] == 0x1f &&
-        p_peek[2] == 0x00 && p_peek[3] == 0xe8 &&
-        (p_peek[4] & 0xf0) == 0xf0 && p_peek[5] == 0x07 )
-    {
-        return 0;
-    }
-    /* 14 bits, big endian version of the bitstream */
-    else if( p_peek[0] == 0x1f && p_peek[1] == 0xff &&
-             p_peek[2] == 0xe8 && p_peek[3] == 0x00 &&
-             p_peek[4] == 0x07 && (p_peek[5] & 0xf0) == 0xf0)
-    {
-        return 0;
-    }
-    /* 16 bits, big endian version of the bitstream */
-    else if( p_peek[0] == 0x7f && p_peek[1] == 0xfe &&
-             p_peek[2] == 0x80 && p_peek[3] == 0x01 )
-    {
-        return 0;
-    }
-    /* 16 bits, little endian version of the bitstream */
-    else if( p_peek[0] == 0xfe && p_peek[1] == 0x7f &&
-             p_peek[2] == 0x01 && p_peek[3] == 0x80 )
-    {
-        return 0;
-    }
-
-    VLC_UNUSED(pi_samples);
-    return VLC_EGENERIC;
+    return SyncCode( p_peek );
 }
 
 static int DtsProbe( demux_t *p_demux, int64_t *pi_offset )



More information about the vlc-commits mailing list