mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-04-11 03:32:39 +00:00
avformat/mpegts: Factorize version checking code out
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 4e8d01f20c
)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
52242a387b
commit
3d296c0ec1
@ -568,6 +568,16 @@ typedef struct SectionHeader {
|
|||||||
uint8_t last_sec_num;
|
uint8_t last_sec_num;
|
||||||
} SectionHeader;
|
} SectionHeader;
|
||||||
|
|
||||||
|
static int skip_identical(const SectionHeader *h, MpegTSSectionFilter *tssf)
|
||||||
|
{
|
||||||
|
if (h->version == tssf->last_ver)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
tssf->last_ver = h->version;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static inline int get8(const uint8_t **pp, const uint8_t *p_end)
|
static inline int get8(const uint8_t **pp, const uint8_t *p_end)
|
||||||
{
|
{
|
||||||
const uint8_t *p;
|
const uint8_t *p;
|
||||||
@ -1455,9 +1465,8 @@ static void m4sl_cb(MpegTSFilter *filter, const uint8_t *section,
|
|||||||
return;
|
return;
|
||||||
if (h.tid != M4OD_TID)
|
if (h.tid != M4OD_TID)
|
||||||
return;
|
return;
|
||||||
if (h.version == tssf->last_ver)
|
if (skip_identical(&h, tssf))
|
||||||
return;
|
return;
|
||||||
tssf->last_ver = h.version;
|
|
||||||
|
|
||||||
mp4_read_od(s, p, (unsigned) (p_end - p), mp4_descr, &mp4_descr_count,
|
mp4_read_od(s, p, (unsigned) (p_end - p), mp4_descr, &mp4_descr_count,
|
||||||
MAX_MP4_DESCR_COUNT);
|
MAX_MP4_DESCR_COUNT);
|
||||||
@ -1749,9 +1758,8 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
|
|||||||
p = section;
|
p = section;
|
||||||
if (parse_section_header(h, &p, p_end) < 0)
|
if (parse_section_header(h, &p, p_end) < 0)
|
||||||
return;
|
return;
|
||||||
if (h->version == tssf->last_ver)
|
if (skip_identical(h, tssf))
|
||||||
return;
|
return;
|
||||||
tssf->last_ver = h->version;
|
|
||||||
|
|
||||||
av_dlog(ts->stream, "sid=0x%x sec_num=%d/%d\n",
|
av_dlog(ts->stream, "sid=0x%x sec_num=%d/%d\n",
|
||||||
h->id, h->sec_num, h->last_sec_num);
|
h->id, h->sec_num, h->last_sec_num);
|
||||||
@ -1917,9 +1925,8 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
|
|||||||
if (ts->skip_changes)
|
if (ts->skip_changes)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (h->version == tssf->last_ver)
|
if (skip_identical(h, tssf))
|
||||||
return;
|
return;
|
||||||
tssf->last_ver = h->version;
|
|
||||||
ts->stream->ts_id = h->id;
|
ts->stream->ts_id = h->id;
|
||||||
|
|
||||||
clear_programs(ts);
|
clear_programs(ts);
|
||||||
@ -1990,9 +1997,8 @@ static void sdt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
|
|||||||
return;
|
return;
|
||||||
if (ts->skip_changes)
|
if (ts->skip_changes)
|
||||||
return;
|
return;
|
||||||
if (h->version == tssf->last_ver)
|
if (skip_identical(h, tssf))
|
||||||
return;
|
return;
|
||||||
tssf->last_ver = h->version;
|
|
||||||
|
|
||||||
onid = get16(&p, p_end);
|
onid = get16(&p, p_end);
|
||||||
if (onid < 0)
|
if (onid < 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user