[FFmpeg-devel] [PATCH] support e-ac-3 in mpeg ps/ts
Måns Rullgård
mans
Tue Sep 2 03:18:21 CEST 2008
Justin Ruggles <justin.ruggles at gmail.com> writes:
> M?ns Rullg?rd wrote:
>> Justin Ruggles <justin.ruggles at gmail.com> writes:
>>
>>> Hi,
>>>
>>> Here is a patch which adds basic support for E-AC-3 decoding/encoding in
>>> MPEG PS and TS. The only case I can't seem to differentiate is EVOB,
>>> which uses the same descriptor type and start codes for AC-3 and E-AC-3.
>>> Since regular AC-3 is also valid E-AC-3, I'm setting them to E-AC-3.
>>>
>>> Index: libavformat/mpegts.c
>>> ===================================================================
>>> --- libavformat/mpegts.c (revision 15138)
>>> +++ libavformat/mpegts.c (working copy)
>>> @@ -554,9 +554,12 @@
>>> if (desc_tag < 0)
>>> break;
>>> if (stream_type == STREAM_TYPE_PRIVATE_DATA) {
>>> - if((desc_tag == 0x6A) || (desc_tag == 0x7A)) {
>>> + if (desc_tag == 0x6A) {
>>> /*assume DVB AC-3 Audio*/
>>> stream_type = STREAM_TYPE_AUDIO_AC3;
>>> + } else if (desc_tag == 0x7A) {
>>> + /* DVB E-AC-3 audio */
>>> + stream_type = STREAM_TYPE_AUDIO_EAC3;
>>> } else if(desc_tag == 0x7B) {
>>> /* DVB DTS audio */
>>> stream_type = STREAM_TYPE_AUDIO_DTS;
>>> @@ -627,6 +630,7 @@
>>> case STREAM_TYPE_AUDIO_AAC:
>>> case STREAM_TYPE_AUDIO_AC3:
>>> case STREAM_TYPE_AUDIO_DTS:
>>> + case STREAM_TYPE_AUDIO_EAC3:
>>> case STREAM_TYPE_AUDIO_HDMV_DTS:
>>> case STREAM_TYPE_SUBTITLE_DVB:
>>> if((stream_type == STREAM_TYPE_AUDIO_HDMV_DTS && !has_hdmv_descr)
>>> @@ -971,6 +975,10 @@
>>> codec_type = CODEC_TYPE_AUDIO;
>>> codec_id = CODEC_ID_AC3;
>>> break;
>>> + case STREAM_TYPE_AUDIO_EAC3:
>>> + codec_type = CODEC_TYPE_AUDIO;
>>> + codec_id = CODEC_ID_EAC3;
>>> + break;
>>> case STREAM_TYPE_AUDIO_DTS:
>>> case STREAM_TYPE_AUDIO_HDMV_DTS:
>>> codec_type = CODEC_TYPE_AUDIO;
>>> Index: libavformat/mpegts.h
>>> ===================================================================
>>> --- libavformat/mpegts.h (revision 15138)
>>> +++ libavformat/mpegts.h (working copy)
>>> @@ -55,6 +55,7 @@
>>> #define STREAM_TYPE_VIDEO_DIRAC 0xd1
>>>
>>> #define STREAM_TYPE_AUDIO_AC3 0x81
>>> +#define STREAM_TYPE_AUDIO_EAC3 0x84
>>> #define STREAM_TYPE_AUDIO_DTS 0x8a
>>> #define STREAM_TYPE_AUDIO_HDMV_DTS 0x82
>>> Index: libavformat/mpegtsenc.c
>>> ===================================================================
>>> --- libavformat/mpegtsenc.c (revision 15138)
>>> +++ libavformat/mpegtsenc.c (working copy)
>>> @@ -233,6 +233,9 @@
>>> case CODEC_ID_AC3:
>>> stream_type = STREAM_TYPE_AUDIO_AC3;
>>> break;
>>> + case CODEC_ID_EAC3:
>>> + stream_type = STREAM_TYPE_AUDIO_EAC3;
>>> + break;
>>> default:
>>> stream_type = STREAM_TYPE_PRIVATE_DATA;
>>> break;
>>
>> Where does the value 0x84 come from? ATSC uses the same stream_type
>> value (0x81) for AC-3 and E-AC-3, differentiating the two using a
>> special descriptor. DVB sets the stream_type to 6 (private data), and
>> uses different descriptors to distinguish the two types.
>
> That's my mistake... It's supposed to be 0x87 according to ATSC A/53,
> not 0x84.
Now I'm confused. A/53 does indeed specify 0x87 for stream_type.
However, A/52B can be interpreted as allowing E-AC-3 with stream_type
0x81, if the AC-3_audio_stream_descriptor has a bsid value of 16.
Which is correct?
--
M?ns Rullg?rd
mans at mansr.com
More information about the ffmpeg-devel
mailing list