Mercurial > libavformat.hg
comparison mpegts.c @ 5116:c4e22fecdcaa libavformat
Stop parsing in read_header only after finding pmt, and
do not close pat filter so further pmt can be parsed.
Fix issue #1294.
| author | bcoudurier |
|---|---|
| date | Wed, 29 Jul 2009 02:17:08 +0000 |
| parents | 11e86c7bdc25 |
| children | 84b8032a5227 |
comparison
equal
deleted
inserted
replaced
| 5115:640c875b3bfe | 5116:c4e22fecdcaa |
|---|---|
| 638 p += len; | 638 p += len; |
| 639 } | 639 } |
| 640 p += program_info_length; | 640 p += program_info_length; |
| 641 if (p >= p_end) | 641 if (p >= p_end) |
| 642 return; | 642 return; |
| 643 | |
| 644 // stop parsing after pmt, we found header | |
| 645 if (!ts->stream->nb_streams) | |
| 646 ts->stop_parse = 1; | |
| 647 | |
| 643 for(;;) { | 648 for(;;) { |
| 644 st = 0; | 649 st = 0; |
| 645 stream_type = get8(&p, p_end); | 650 stream_type = get8(&p, p_end); |
| 646 if (stream_type < 0) | 651 if (stream_type < 0) |
| 647 break; | 652 break; |
| 723 p = desc_end; | 728 p = desc_end; |
| 724 } | 729 } |
| 725 p = desc_list_end; | 730 p = desc_list_end; |
| 726 } | 731 } |
| 727 /* all parameters are there */ | 732 /* all parameters are there */ |
| 728 ts->stop_parse++; | |
| 729 mpegts_close_filter(ts, filter); | 733 mpegts_close_filter(ts, filter); |
| 730 } | 734 } |
| 731 | 735 |
| 732 static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len) | 736 static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len) |
| 733 { | 737 { |
| 760 | 764 |
| 761 if (sid == 0x0000) { | 765 if (sid == 0x0000) { |
| 762 /* NIT info */ | 766 /* NIT info */ |
| 763 } else { | 767 } else { |
| 764 av_new_program(ts->stream, sid); | 768 av_new_program(ts->stream, sid); |
| 765 ts->stop_parse--; | |
| 766 mpegts_open_section_filter(ts, pmt_pid, pmt_cb, ts, 1); | 769 mpegts_open_section_filter(ts, pmt_pid, pmt_cb, ts, 1); |
| 767 add_pat_entry(ts, sid); | 770 add_pat_entry(ts, sid); |
| 768 add_pid_to_pmt(ts, sid, 0); //add pat pid to program | 771 add_pid_to_pmt(ts, sid, 0); //add pat pid to program |
| 769 add_pid_to_pmt(ts, sid, pmt_pid); | 772 add_pid_to_pmt(ts, sid, pmt_pid); |
| 770 } | 773 } |
| 771 } | 774 } |
| 772 /* not found */ | |
| 773 ts->stop_parse++; | |
| 774 | |
| 775 mpegts_close_filter(ts, filter); | |
| 776 } | 775 } |
| 777 | 776 |
| 778 static void sdt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len) | 777 static void sdt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len) |
| 779 { | 778 { |
| 780 MpegTSContext *ts = filter->u.section_filter.opaque; | 779 MpegTSContext *ts = filter->u.section_filter.opaque; |
