Merge commit '82de8d71118f4eafd6a43e9ea9169bd411793798'

* commit '82de8d71118f4eafd6a43e9ea9169bd411793798':
  mpegts: Update the PSI/SI table only if the version change

Conflicts:
	libavformat/mpegts.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2015-04-29 04:24:06 +02:00
commit 12f7253d0e
1 changed files with 20 additions and 0 deletions

View File

@ -75,6 +75,7 @@ typedef void SetServiceCallback (void *opaque, int ret);
typedef struct MpegTSSectionFilter {
int section_index;
int section_h_size;
int last_ver;
uint8_t *section_buf;
unsigned int check_crc : 1;
unsigned int end_of_section_reached : 1;
@ -469,6 +470,8 @@ static MpegTSFilter *mpegts_open_section_filter(MpegTSContext *ts,
sec->opaque = opaque;
sec->section_buf = av_malloc(MAX_SECTION_SIZE);
sec->check_crc = check_crc;
sec->last_ver = -1;
if (!sec->section_buf) {
av_free(filter);
return NULL;
@ -1451,6 +1454,7 @@ static void m4sl_cb(MpegTSFilter *filter, const uint8_t *section,
int section_len)
{
MpegTSContext *ts = filter->u.section_filter.opaque;
MpegTSSectionFilter *tssf = &filter->u.section_filter;
SectionHeader h;
const uint8_t *p, *p_end;
AVIOContext pb;
@ -1465,6 +1469,9 @@ static void m4sl_cb(MpegTSFilter *filter, const uint8_t *section,
return;
if (h.tid != M4OD_TID)
return;
if (h.version == tssf->last_ver)
return;
tssf->last_ver = h.version;
mp4_read_od(s, p, (unsigned) (p_end - p), mp4_descr, &mp4_descr_count,
MAX_MP4_DESCR_COUNT);
@ -1787,6 +1794,7 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type
static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len)
{
MpegTSContext *ts = filter->u.section_filter.opaque;
MpegTSSectionFilter *tssf = &filter->u.section_filter;
SectionHeader h1, *h = &h1;
PESContext *pes;
AVStream *st;
@ -1806,6 +1814,9 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
p = section;
if (parse_section_header(h, &p, p_end) < 0)
return;
if (h->version == tssf->last_ver)
return;
tssf->last_ver = h->version;
av_log(ts->stream, AV_LOG_TRACE, "sid=0x%x sec_num=%d/%d version=%d\n",
h->id, h->sec_num, h->last_sec_num, h->version);
@ -1955,6 +1966,7 @@ out:
static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len)
{
MpegTSContext *ts = filter->u.section_filter.opaque;
MpegTSSectionFilter *tssf = &filter->u.section_filter;
SectionHeader h1, *h = &h1;
const uint8_t *p, *p_end;
int sid, pmt_pid;
@ -1972,6 +1984,9 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
if (ts->skip_changes)
return;
if (h->version == tssf->last_ver)
return;
tssf->last_ver = h->version;
ts->stream->ts_id = h->id;
clear_programs(ts);
@ -2027,6 +2042,7 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
static void sdt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len)
{
MpegTSContext *ts = filter->u.section_filter.opaque;
MpegTSSectionFilter *tssf = &filter->u.section_filter;
SectionHeader h1, *h = &h1;
const uint8_t *p, *p_end, *desc_list_end, *desc_end;
int onid, val, sid, desc_list_len, desc_tag, desc_len, service_type;
@ -2043,6 +2059,10 @@ static void sdt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
return;
if (ts->skip_changes)
return;
if (h->version == tssf->last_ver)
return;
tssf->last_ver = h->version;
onid = get16(&p, p_end);
if (onid < 0)
return;