Originally committed as revision 12180 to svn://svn.ffmpeg.org/ffmpeg/trunk
| ... | ... |
@@ -31,6 +31,7 @@ |
| 31 | 31 |
/* maximum size in which we look for synchronisation if |
| 32 | 32 |
synchronisation is lost */ |
| 33 | 33 |
#define MAX_RESYNC_SIZE 4096 |
| 34 |
+#define REGISTRATION_DESCRIPTOR 5 |
|
| 34 | 35 |
|
| 35 | 36 |
typedef struct PESContext PESContext; |
| 36 | 37 |
|
| ... | ... |
@@ -478,6 +479,7 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len |
| 478 | 478 |
int desc_list_len, desc_len, desc_tag; |
| 479 | 479 |
int comp_page = 0, anc_page = 0; /* initialize to kill warnings */ |
| 480 | 480 |
char language[4] = {0}; /* initialize to kill warnings */
|
| 481 |
+ int has_hdmv_descr = 0; |
|
| 481 | 482 |
|
| 482 | 483 |
#ifdef DEBUG_SI |
| 483 | 484 |
av_log(ts->stream, AV_LOG_DEBUG, "PMT: len %i\n", section_len); |
| ... | ... |
@@ -505,6 +507,27 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len |
| 505 | 505 |
program_info_length = get16(&p, p_end) & 0xfff; |
| 506 | 506 |
if (program_info_length < 0) |
| 507 | 507 |
return; |
| 508 |
+ while(program_info_length >= 2) {
|
|
| 509 |
+ uint8_t tag, len; |
|
| 510 |
+ tag = get8(&p, p_end); |
|
| 511 |
+ len = get8(&p, p_end); |
|
| 512 |
+ if(len > program_info_length - 2) |
|
| 513 |
+ //something else is broken, exit the program_descriptors_loop |
|
| 514 |
+ break; |
|
| 515 |
+ program_info_length -= len + 2; |
|
| 516 |
+ if(tag == REGISTRATION_DESCRIPTOR && len >= 4) {
|
|
| 517 |
+ uint8_t bytes[4]; |
|
| 518 |
+ bytes[0] = get8(&p, p_end); |
|
| 519 |
+ bytes[1] = get8(&p, p_end); |
|
| 520 |
+ bytes[2] = get8(&p, p_end); |
|
| 521 |
+ bytes[3] = get8(&p, p_end); |
|
| 522 |
+ len -= 4; |
|
| 523 |
+ if(bytes[0] == 'H' && bytes[1] == 'D' && |
|
| 524 |
+ bytes[2] == 'M' && bytes[3] == 'V') |
|
| 525 |
+ has_hdmv_descr = 1; |
|
| 526 |
+ } |
|
| 527 |
+ p += len; |
|
| 528 |
+ } |
|
| 508 | 529 |
p += program_info_length; |
| 509 | 530 |
if (p >= p_end) |
| 510 | 531 |
return; |
| ... | ... |
@@ -588,7 +611,10 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len |
| 588 | 588 |
case STREAM_TYPE_AUDIO_AAC: |
| 589 | 589 |
case STREAM_TYPE_AUDIO_AC3: |
| 590 | 590 |
case STREAM_TYPE_AUDIO_DTS: |
| 591 |
+ case STREAM_TYPE_AUDIO_HDMV_DTS: |
|
| 591 | 592 |
case STREAM_TYPE_SUBTITLE_DVB: |
| 593 |
+ if(stream_type == STREAM_TYPE_AUDIO_HDMV_DTS && !has_hdmv_descr) |
|
| 594 |
+ break; |
|
| 592 | 595 |
if(ts->pids[pid] && ts->pids[pid]->type == MPEGTS_PES){
|
| 593 | 596 |
pes= ts->pids[pid]->u.pes_filter.opaque; |
| 594 | 597 |
st= pes->st; |
| ... | ... |
@@ -923,6 +949,7 @@ static AVStream* new_pes_av_stream(PESContext *pes, uint32_t code) |
| 923 | 923 |
codec_id = CODEC_ID_AC3; |
| 924 | 924 |
break; |
| 925 | 925 |
case STREAM_TYPE_AUDIO_DTS: |
| 926 |
+ case STREAM_TYPE_AUDIO_HDMV_DTS: |
|
| 926 | 927 |
codec_type = CODEC_TYPE_AUDIO; |
| 927 | 928 |
codec_id = CODEC_ID_DTS; |
| 928 | 929 |
break; |