[FFmpeg-devel] Proper parsing of DTS-HD MA streams

Vitor Sessak vitor1001
Sun Jan 23 17:17:56 CET 2011


On 11/26/2008 06:30 PM, Robert McNamara wrote:
> On Wed, Nov 26, 2008 at 1:08 AM, madshi<dear at madshi.net>  wrote:
>
>> Kostya schrieb:
>>> Thank you for the sample. I'll try to find some time to improve parser.
>>
>> See here how to properly parse and skip DTS-HD blocks:
>>
>> http://forum.doom9.org/showthread.php?p=1183481#post1183481
>>
>> https://ffdshow-tryout.svn.sourceforge.net/svnroot/ffdshow-tryout/branches/libavformat/src/TaudioParser.cpp
>>
>> Search for "blownUpHeader".
>>
>>
>> Regards, madshi.
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel at mplayerhq.hu
>> https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel
>>
>
>
> Thank you Kostya and Madshi both for looking into this.  I'm thrilled to see
> that a lot of the heavy lifting is already done and hope that this will be a
> snap.
>
> In what may be an unpopular move, I've updated the previous patches to
> mpegts.c/h to properly parse the tracks.  I know there was some resistance
> to this before, but perhaps since we're starting fresh, cool heads can
> prevail and we can figure out a way that it makes sense to get this
> committed.  I've changed the patch somewhat to create a case for TrueHD to
> point at the MLP codec (I think it was mistakenly included in AC3 before)
> and I've added stream definition for LPCM so that it at least is parse
> correctly in m2ts.  I tested pointing Bluray LPCM at CODEC_ID_PCM_S16LE, but
> that seems not to work properly just yet so I left it out.  I have tested
> these parser updates and found them to work with LPCM (0x80, even though it
> is technically misidentified as mp1), DTS-HD (0x85), and DTS-HD MA (0x86).
>   I don't have any disks that include E-AC-3 (0x84) or MLP/TrueHD (0x83) so I
> wasn't able to test those.
>
> I should note that the parser hangs entirely on these samples without the
> patches.  With this patch applied, ffmpeg -i infile works as expected and
> picks up all the tracks in all of my disks (about 30).

Git-friendly patch attached so patchwork will catch it up.

-Vitor

>From robert.mcnamaraatgmail.com  Sun Jan 23 17:16:21 2011
From: robert.mcnamaraatgmail.com (Robert McNamara)
Date: Sun, 23 Jan 2011 17:16:21 +0100
Subject: [PATCH] Properly parse and skip DTS-HD blocks
Message-ID: <mailman.464.1295799488.1307.ffmpeg-devel at mplayerhq.hu>

---
 libavformat/mpegts.c |   12 ++++++++++++
 libavformat/mpegts.h |    5 +++++
 2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 48aca43..037d16f 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -616,6 +616,11 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
 
         /* now create ffmpeg stream */
         switch(stream_type) {
+        case STREAM_TYPE_AUDIO_HDMV_LPCM:
+        case STREAM_TYPE_AUDIO_HDMV_DTS_HD: 
+        case STREAM_TYPE_AUDIO_HDMV_DTS_HD_MASTER: 
+        case STREAM_TYPE_AUDIO_HDMV_TRUEHD: 
+        case STREAM_TYPE_AUDIO_HDMV_EAC3:
         case STREAM_TYPE_AUDIO_MPEG1:
         case STREAM_TYPE_AUDIO_MPEG2:
         case STREAM_TYPE_VIDEO_MPEG1:
@@ -968,12 +973,19 @@ static AVStream* new_pes_av_stream(PESContext *pes, uint32_t code)
         codec_type = CODEC_TYPE_AUDIO;
         codec_id = CODEC_ID_AAC;
         break;
+    case STREAM_TYPE_AUDIO_HDMV_TRUEHD: 
+        codec_type = CODEC_TYPE_AUDIO; 
+        codec_id = CODEC_ID_MLP; 
+        break; 
     case STREAM_TYPE_AUDIO_AC3:
+    case STREAM_TYPE_AUDIO_HDMV_EAC3:
         codec_type = CODEC_TYPE_AUDIO;
         codec_id = CODEC_ID_AC3;
         break;
     case STREAM_TYPE_AUDIO_DTS:
     case STREAM_TYPE_AUDIO_HDMV_DTS:
+    case STREAM_TYPE_AUDIO_HDMV_DTS_HD: 
+    case STREAM_TYPE_AUDIO_HDMV_DTS_HD_MASTER:
         codec_type = CODEC_TYPE_AUDIO;
         codec_id = CODEC_ID_DTS;
         break;
diff --git a/libavformat/mpegts.h b/libavformat/mpegts.h
index 896836d..6b09455 100644
--- a/libavformat/mpegts.h
+++ b/libavformat/mpegts.h
@@ -54,9 +54,14 @@
 #define STREAM_TYPE_VIDEO_VC1       0xea
 #define STREAM_TYPE_VIDEO_DIRAC     0xd1
 
+#define STREAM_TYPE_AUDIO_HDMV_LPCM 0x80
 #define STREAM_TYPE_AUDIO_AC3       0x81
 #define STREAM_TYPE_AUDIO_DTS       0x8a
 #define STREAM_TYPE_AUDIO_HDMV_DTS  0x82
+#define STREAM_TYPE_AUDIO_HDMV_TRUEHD   0x83 
+#define STREAM_TYPE_AUDIO_HDMV_EAC3      0x84 
+#define STREAM_TYPE_AUDIO_HDMV_DTS_HD        0x85 
+#define STREAM_TYPE_AUDIO_HDMV_DTS_HD_MASTER 0x86
 
 #define STREAM_TYPE_SUBTITLE_DVB    0x100
 
-- 
1.7.1


--------------050207020403090505070106--



More information about the ffmpeg-devel mailing list