MPEG TS: Support PES private data tracks without specific desc tag

This commit is contained in:
Moritz Bunkus 2011-10-09 00:43:35 +02:00
parent 8772c58ee6
commit dd8af67083
2 changed files with 20 additions and 2 deletions

View File

@ -4,7 +4,7 @@
v7/quilt 3.0 format.
* mkvmerge: enhancement: Implemented support for yet another way
of storing EAC3 in MPEG transport streams.
of storing EAC3 and DTS in MPEG transport streams.
2011-10-05 Moritz Bunkus <moritz@bunkus.org>

View File

@ -717,7 +717,8 @@ mpeg_ts_reader_c::parse_pmt(unsigned char *pmt) {
break;
}
pmt_descriptor = (mpeg_ts_pmt_descriptor_t *)((unsigned char *)pmt_pid_info + sizeof(mpeg_ts_pmt_pid_info_t));
pmt_descriptor = (mpeg_ts_pmt_descriptor_t *)((unsigned char *)pmt_pid_info + sizeof(mpeg_ts_pmt_pid_info_t));
bool type_known = false;
while (pmt_descriptor < (mpeg_ts_pmt_descriptor_t *)((unsigned char *)pmt_pid_info + sizeof(mpeg_ts_pmt_pid_info_t) + es_info_length)) {
mxdebug_if(m_debug_pat_pmt, boost::format("mpeg_ts:parse_pmt: PMT descriptor tag 0x%|1$02x| length %2%\n") % static_cast<unsigned int>(pmt_descriptor->tag) % static_cast<unsigned int>(pmt_descriptor->length));
@ -726,6 +727,7 @@ mpeg_ts_reader_c::parse_pmt(unsigned char *pmt) {
case 0x56: // Teletext descriptor
if (pmt_pid_info->stream_type == ISO_13818_PES_PRIVATE) { // PES containig private data
track->type = ES_UNKNOWN;
type_known = true;
mxdebug_if(m_debug_pat_pmt, "mpeg_ts:parse_pmt: Teletext found but not handled !!\n");
}
break;
@ -733,6 +735,7 @@ mpeg_ts_reader_c::parse_pmt(unsigned char *pmt) {
if (pmt_pid_info->stream_type == ISO_13818_PES_PRIVATE) { // PES containig private data
track->type = ES_SUBT_TYPE;
track->fourcc = FOURCC('V', 'S', 'U', 'B');
type_known = true;
}
break;
case 0x6A: // AC3 descriptor
@ -740,6 +743,14 @@ mpeg_ts_reader_c::parse_pmt(unsigned char *pmt) {
if (pmt_pid_info->stream_type == ISO_13818_PES_PRIVATE) { // PES containig private data
track->type = ES_AUDIO_TYPE;
track->fourcc = FOURCC('A', 'C', '3', ' ');
type_known = true;
}
break;
case 0x7b: // DTS descriptor
if (pmt_pid_info->stream_type == ISO_13818_PES_PRIVATE) { // PES containig private data
track->type = ES_AUDIO_TYPE;
track->fourcc = FOURCC('D', 'T', 'S', ' ');
type_known = true;
}
break;
case 0x0a: // ISO 639 language descriptor
@ -754,6 +765,13 @@ mpeg_ts_reader_c::parse_pmt(unsigned char *pmt) {
pmt_descriptor = (mpeg_ts_pmt_descriptor_t *)((unsigned char *)pmt_descriptor + sizeof(mpeg_ts_pmt_descriptor_t) + pmt_descriptor->length);
}
// Default to AC3 if it's a PES private stream type that's missing
// a known/more concrete descriptor tag.
if ((pmt_pid_info->stream_type == ISO_13818_PES_PRIVATE) && !type_known) {
track->type = ES_AUDIO_TYPE;
track->fourcc = FOURCC('A', 'C', '3', ' ');
}
pmt_pid_info = (mpeg_ts_pmt_pid_info_t *)((unsigned char *)pmt_pid_info + sizeof(mpeg_ts_pmt_pid_info_t) + es_info_length);
if (track->type != ES_UNKNOWN) {
PMT_found = true;