diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-02-11 01:59:14 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-02-11 01:59:14 +0100 |
commit | b61170f51d2e4178b3e3e7f2961d4d191b7896e2 (patch) | |
tree | ee986673020b96a90585c3a4bdf60bb3eb1b27fd | |
parent | 702cf8d0de9e31c0bc62b6a671dfc54411b22fd6 (diff) | |
parent | 1509c018bd5b054a2354e20021ccbac9c934d213 (diff) | |
download | ffmpeg-b61170f51d2e4178b3e3e7f2961d4d191b7896e2.tar.gz |
Merge commit '1509c018bd5b054a2354e20021ccbac9c934d213'
* commit '1509c018bd5b054a2354e20021ccbac9c934d213':
mpegts: relax restrictions on matching the packet start in read_header
Conflicts:
libavformat/mpegts.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/mpegts.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index cadce5c55a..afda648866 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -518,7 +518,8 @@ static void mpegts_close_filter(MpegTSContext *ts, MpegTSFilter *filter) ts->pids[pid] = NULL; } -static int analyze(const uint8_t *buf, int size, int packet_size, int *index) +static int analyze(const uint8_t *buf, int size, int packet_size, int *index, + int probe) { int stat[TS_MAX_PACKET_SIZE]; int stat_all = 0; @@ -528,7 +529,8 @@ static int analyze(const uint8_t *buf, int size, int packet_size, int *index) memset(stat, 0, packet_size * sizeof(*stat)); for (i = 0; i < size - 3; i++) { - if (buf[i] == 0x47 && !(buf[i + 1] & 0x80) && buf[i + 3] != 0x47) { + if (buf[i] == 0x47 && + (!probe || (!(buf[i + 1] & 0x80) && buf[i + 3] != 0x47))) { int x = i % packet_size; stat[x]++; stat_all++; @@ -551,9 +553,9 @@ static int get_packet_size(const uint8_t *buf, int size) if (size < (TS_FEC_PACKET_SIZE * 5 + 1)) return AVERROR_INVALIDDATA; - score = analyze(buf, size, TS_PACKET_SIZE, NULL); - dvhs_score = analyze(buf, size, TS_DVHS_PACKET_SIZE, NULL); - fec_score = analyze(buf, size, TS_FEC_PACKET_SIZE, NULL); + score = analyze(buf, size, TS_PACKET_SIZE, NULL, 0); + dvhs_score = analyze(buf, size, TS_DVHS_PACKET_SIZE, NULL, 0); + fec_score = analyze(buf, size, TS_FEC_PACKET_SIZE, NULL, 0); av_dlog(NULL, "score: %d, dvhs_score: %d, fec_score: %d \n", score, dvhs_score, fec_score); @@ -2394,9 +2396,9 @@ static int mpegts_probe(AVProbeData *p) for (i = 0; i<check_count; i+=CHECK_BLOCK) { int left = FFMIN(check_count - i, CHECK_BLOCK); - int score = analyze(p->buf + TS_PACKET_SIZE *i, TS_PACKET_SIZE *left, TS_PACKET_SIZE , NULL); - int dvhs_score = analyze(p->buf + TS_DVHS_PACKET_SIZE*i, TS_DVHS_PACKET_SIZE*left, TS_DVHS_PACKET_SIZE, NULL); - int fec_score = analyze(p->buf + TS_FEC_PACKET_SIZE *i, TS_FEC_PACKET_SIZE *left, TS_FEC_PACKET_SIZE , NULL); + int score = analyze(p->buf + TS_PACKET_SIZE *i, TS_PACKET_SIZE *left, TS_PACKET_SIZE , NULL, 1); + int dvhs_score = analyze(p->buf + TS_DVHS_PACKET_SIZE*i, TS_DVHS_PACKET_SIZE*left, TS_DVHS_PACKET_SIZE, NULL, 1); + int fec_score = analyze(p->buf + TS_FEC_PACKET_SIZE *i, TS_FEC_PACKET_SIZE *left, TS_FEC_PACKET_SIZE , NULL, 1); score = FFMAX3(score, dvhs_score, fec_score); sumscore += score; maxscore = FFMAX(maxscore, score); |