ffmpeg: update to ffmpeg-2.5.4

Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
Stephan Raue 2015-02-15 13:08:34 +01:00
parent 3ee63df0b8
commit 2fb0892a26
2 changed files with 67 additions and 361 deletions

View File

@ -17,7 +17,7 @@
################################################################################ ################################################################################
PKG_NAME="ffmpeg" PKG_NAME="ffmpeg"
PKG_VERSION="2.4.6" PKG_VERSION="2.5.4"
PKG_REV="1" PKG_REV="1"
PKG_ARCH="any" PKG_ARCH="any"
PKG_LICENSE="LGPL" PKG_LICENSE="LGPL"

View File

@ -1,7 +1,7 @@
From 052cc5502868ccba359d73c05ce44a396cd3d060 Mon Sep 17 00:00:00 2001 From cc70eab317cc54a46ebf14dee17a6670d470d716 Mon Sep 17 00:00:00 2001
From: Joakim Plate <elupus@ecce.se> From: Joakim Plate <elupus@ecce.se>
Date: Sun, 11 Sep 2011 19:04:51 +0200 Date: Sun, 11 Sep 2011 19:04:51 +0200
Subject: [PATCH 01/17] Support raw dvdsub palette as stored on normal dvd's Subject: [PATCH 01/13] Support raw dvdsub palette as stored on normal dvd's
This is how the palette is stored on dvd's. Currently This is how the palette is stored on dvd's. Currently
only xbmc passes the palette information to libavcodec only xbmc passes the palette information to libavcodec
@ -11,10 +11,10 @@ this way.
1 file changed, 24 insertions(+) 1 file changed, 24 insertions(+)
diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c
index 54dd2c4..cc8f49c 100644 index 222c71b..040a713 100644
--- a/libavcodec/dvdsubdec.c --- a/libavcodec/dvdsubdec.c
+++ b/libavcodec/dvdsubdec.c +++ b/libavcodec/dvdsubdec.c
@@ -61,6 +61,24 @@ static void yuv_a_to_rgba(const uint8_t *ycbcr, const uint8_t *alpha, uint32_t * @@ -64,6 +64,24 @@ static void yuv_a_to_rgba(const uint8_t *ycbcr, const uint8_t *alpha, uint32_t *
} }
} }
@ -39,8 +39,8 @@ index 54dd2c4..cc8f49c 100644
static int decode_run_2bit(GetBitContext *gb, int *color) static int decode_run_2bit(GetBitContext *gb, int *color)
{ {
unsigned int v, t; unsigned int v, t;
@@ -632,6 +650,12 @@ static av_cold int dvdsub_init(AVCodecContext *avctx) @@ -700,6 +718,12 @@ static av_cold int dvdsub_init(AVCodecContext *avctx)
parse_ifo_palette(ctx, ctx->ifo_str);
if (ctx->palette_str) if (ctx->palette_str)
parse_palette(ctx, ctx->palette_str); parse_palette(ctx, ctx->palette_str);
+ +
@ -53,76 +53,10 @@ index 54dd2c4..cc8f49c 100644
int i; int i;
av_log(avctx, AV_LOG_DEBUG, "palette:"); av_log(avctx, AV_LOG_DEBUG, "palette:");
From 5ffad9061ccad48feb9eea723717ff7a368f8f96 Mon Sep 17 00:00:00 2001 From d51b190099d13d293d94b876ea8dad422f2e4e39 Mon Sep 17 00:00:00 2001
From: Joakim Plate <elupus@ecce.se>
Date: Sat, 22 Oct 2011 18:33:45 +0200
Subject: [PATCH 02/17] Check return value of avio_seek and avoid modifying
state if it fails
The code still modifies state if the timestamp is not found. Not
sure exactly how to avoid that.
---
libavformat/matroskadec.c | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index beb1aef..4430658 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -2926,8 +2926,8 @@ static int matroska_read_seek(AVFormatContext *s, int stream_index,
timestamp = FFMAX(timestamp, st->index_entries[0].timestamp);
if ((index = av_index_search_timestamp(st, timestamp, flags)) < 0) {
- avio_seek(s->pb, st->index_entries[st->nb_index_entries - 1].pos,
- SEEK_SET);
+ if (avio_seek(s->pb, st->index_entries[st->nb_index_entries-1].pos, SEEK_SET) < 0)
+ return -1;
matroska->current_id = 0;
while ((index = av_index_search_timestamp(st, timestamp, flags)) < 0) {
matroska_clear_queue(matroska);
@@ -2936,16 +2936,11 @@ static int matroska_read_seek(AVFormatContext *s, int stream_index,
}
}
- matroska_clear_queue(matroska);
if (index < 0 || (matroska->cues_parsing_deferred < 0 && index == st->nb_index_entries - 1))
goto err;
index_min = index;
for (i = 0; i < matroska->tracks.nb_elem; i++) {
- tracks[i].audio.pkt_cnt = 0;
- tracks[i].audio.sub_packet_cnt = 0;
- tracks[i].audio.buf_timecode = AV_NOPTS_VALUE;
- tracks[i].end_timecode = 0;
if (tracks[i].type == MATROSKA_TRACK_TYPE_SUBTITLE &&
tracks[i].stream->discard != AVDISCARD_ALL) {
index_sub = av_index_search_timestamp(
@@ -2959,8 +2954,18 @@ static int matroska_read_seek(AVFormatContext *s, int stream_index,
}
}
- avio_seek(s->pb, st->index_entries[index_min].pos, SEEK_SET);
- matroska->current_id = 0;
+ if (avio_seek(s->pb, st->index_entries[index_min].pos, SEEK_SET) < 0)
+ return -1;
+
+ matroska_clear_queue(matroska);
+ for (i=0; i < matroska->tracks.nb_elem; i++) {
+ tracks[i].audio.pkt_cnt = 0;
+ tracks[i].audio.sub_packet_cnt = 0;
+ tracks[i].audio.buf_timecode = AV_NOPTS_VALUE;
+ tracks[i].end_timecode = 0;
+ }
+ matroska->current_id = 0;
+
if (flags & AVSEEK_FLAG_ANY) {
st->skip_to_keyframe = 0;
matroska->skip_to_timecode = timestamp;
From bc823fb80744c68ebf0d5bde0d86baa7c2404e90 Mon Sep 17 00:00:00 2001
From: Joakim Plate <elupus@ecce.se> From: Joakim Plate <elupus@ecce.se>
Date: Mon, 12 Sep 2011 21:37:17 +0200 Date: Mon, 12 Sep 2011 21:37:17 +0200
Subject: [PATCH 03/17] asf hacks Subject: [PATCH 02/13] asf hacks
--- ---
libavformat/asfdec.c | 11 +++++++++++ libavformat/asfdec.c | 11 +++++++++++
@ -154,10 +88,10 @@ index 7f7bb4d..8911987 100644
if (s->pb) { if (s->pb) {
int ret = avio_seek_time(s->pb, stream_index, pts, flags); int ret = avio_seek_time(s->pb, stream_index, pts, flags);
From cac3601e6949c132766572b4122275361a2233b5 Mon Sep 17 00:00:00 2001 From d0dcf7d95bffe4509fb71a8129cc880e9e0552f9 Mon Sep 17 00:00:00 2001
From: Cory Fields <theuni-nospam-@xbmc.org> From: Cory Fields <theuni-nospam-@xbmc.org>
Date: Mon, 28 Jun 2010 01:55:31 -0400 Date: Mon, 28 Jun 2010 01:55:31 -0400
Subject: [PATCH 04/17] if av_read_packet returns AVERROR_IO, we are done. Subject: [PATCH 03/13] if av_read_packet returns AVERROR_IO, we are done.
ffmpeg's codecs might or might not handle returning any completed demuxed ffmpeg's codecs might or might not handle returning any completed demuxed
packets correctly packets correctly
@ -166,10 +100,10 @@ Subject: [PATCH 04/17] if av_read_packet returns AVERROR_IO, we are done.
1 file changed, 2 insertions(+) 1 file changed, 2 insertions(+)
diff --git a/libavformat/utils.c b/libavformat/utils.c diff --git a/libavformat/utils.c b/libavformat/utils.c
index b1f7909..5b15baa 100644 index 78653d1..b233a2b 100644
--- a/libavformat/utils.c --- a/libavformat/utils.c
+++ b/libavformat/utils.c +++ b/libavformat/utils.c
@@ -1276,6 +1276,8 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt) @@ -1307,6 +1307,8 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt)
if (ret < 0) { if (ret < 0) {
if (ret == AVERROR(EAGAIN)) if (ret == AVERROR(EAGAIN))
return ret; return ret;
@ -179,10 +113,10 @@ index b1f7909..5b15baa 100644
for (i = 0; i < s->nb_streams; i++) { for (i = 0; i < s->nb_streams; i++) {
st = s->streams[i]; st = s->streams[i];
From 9da8b7477201133b2c8f1f6b159f2c95864da37a Mon Sep 17 00:00:00 2001 From 37154452e754303f638cff93214c122d640c5d69 Mon Sep 17 00:00:00 2001
From: Cory Fields <theuni-nospam-@xbmc.org> From: Cory Fields <theuni-nospam-@xbmc.org>
Date: Mon, 28 Jun 2010 02:10:50 -0400 Date: Mon, 28 Jun 2010 02:10:50 -0400
Subject: [PATCH 05/17] added: Ticket #7187, TV Teletext support for DVB EBU Subject: [PATCH 04/13] added: Ticket #7187, TV Teletext support for DVB EBU
Teletext streams Teletext streams
--- ---
@ -191,10 +125,10 @@ Subject: [PATCH 05/17] added: Ticket #7187, TV Teletext support for DVB EBU
2 files changed, 6 insertions(+) 2 files changed, 6 insertions(+)
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index fb1c9ca..45bfba3 100644 index dabae1b..dd6ef3f 100644
--- a/libavcodec/avcodec.h --- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h
@@ -523,6 +523,10 @@ enum AVCodecID { @@ -520,6 +520,10 @@ enum AVCodecID {
AV_CODEC_ID_PJS = MKBETAG('P','h','J','S'), AV_CODEC_ID_PJS = MKBETAG('P','h','J','S'),
AV_CODEC_ID_ASS = MKBETAG('A','S','S',' '), ///< ASS as defined in Matroska AV_CODEC_ID_ASS = MKBETAG('A','S','S',' '), ///< ASS as defined in Matroska
@ -206,10 +140,10 @@ index fb1c9ca..45bfba3 100644
AV_CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs. AV_CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs.
AV_CODEC_ID_TTF = 0x18000, AV_CODEC_ID_TTF = 0x18000,
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 8808269..4d73e6d 100644 index 97da0a3..5dd28f1 100644
--- a/libavformat/mpegts.c --- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c +++ b/libavformat/mpegts.c
@@ -717,6 +717,8 @@ static const StreamType DESC_types[] = { @@ -729,6 +729,8 @@ static const StreamType DESC_types[] = {
{ 0x7b, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_DTS }, { 0x7b, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_DTS },
{ 0x56, AVMEDIA_TYPE_SUBTITLE, AV_CODEC_ID_DVB_TELETEXT }, { 0x56, AVMEDIA_TYPE_SUBTITLE, AV_CODEC_ID_DVB_TELETEXT },
{ 0x59, AVMEDIA_TYPE_SUBTITLE, AV_CODEC_ID_DVB_SUBTITLE }, /* subtitling descriptor */ { 0x59, AVMEDIA_TYPE_SUBTITLE, AV_CODEC_ID_DVB_SUBTITLE }, /* subtitling descriptor */
@ -219,20 +153,20 @@ index 8808269..4d73e6d 100644
}; };
From e92eeb9dbaca4cc2a422bbf9e0bfe509cff04c8d Mon Sep 17 00:00:00 2001 From 7993eb16b229ab65a32a4a3ce5d1f18ab64349f2 Mon Sep 17 00:00:00 2001
From: Joakim Plate <elupus@ecce.se> From: Joakim Plate <elupus@ecce.se>
Date: Sun, 18 Sep 2011 19:16:34 +0200 Date: Sun, 18 Sep 2011 19:16:34 +0200
Subject: [PATCH 06/17] Don't accept mpegts PMT that isn't current Subject: [PATCH 05/13] Don't accept mpegts PMT that isn't current
--- ---
libavformat/mpegts.c | 4 ++++ libavformat/mpegts.c | 4 ++++
1 file changed, 4 insertions(+) 1 file changed, 4 insertions(+)
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 4d73e6d..4160c80 100644 index 5dd28f1..9f85aed 100644
--- a/libavformat/mpegts.c --- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c +++ b/libavformat/mpegts.c
@@ -561,6 +561,7 @@ typedef struct SectionHeader { @@ -572,6 +572,7 @@ typedef struct SectionHeader {
uint8_t tid; uint8_t tid;
uint16_t id; uint16_t id;
uint8_t version; uint8_t version;
@ -240,7 +174,7 @@ index 4d73e6d..4160c80 100644
uint8_t sec_num; uint8_t sec_num;
uint8_t last_sec_num; uint8_t last_sec_num;
} SectionHeader; } SectionHeader;
@@ -632,6 +633,7 @@ static int parse_section_header(SectionHeader *h, @@ -643,6 +644,7 @@ static int parse_section_header(SectionHeader *h,
val = get8(pp, p_end); val = get8(pp, p_end);
if (val < 0) if (val < 0)
return val; return val;
@ -248,7 +182,7 @@ index 4d73e6d..4160c80 100644
h->version = (val >> 1) & 0x1f; h->version = (val >> 1) & 0x1f;
val = get8(pp, p_end); val = get8(pp, p_end);
if (val < 0) if (val < 0)
@@ -1904,6 +1906,8 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len @@ -1968,6 +1970,8 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
return; return;
if (ts->skip_changes) if (ts->skip_changes)
return; return;
@ -258,20 +192,20 @@ index 4d73e6d..4160c80 100644
ts->stream->ts_id = h->id; ts->stream->ts_id = h->id;
From 1cabda9aedc3a7534438f4fb7e0989bbfb03818e Mon Sep 17 00:00:00 2001 From 3c994a2ad7873395455b834ce85458202c90266b Mon Sep 17 00:00:00 2001
From: Joakim Plate <elupus@ecce.se> From: Joakim Plate <elupus@ecce.se>
Date: Sun, 18 Sep 2011 19:17:23 +0200 Date: Sun, 18 Sep 2011 19:17:23 +0200
Subject: [PATCH 07/17] Don't reparse PMT unless it's version has changed Subject: [PATCH 06/13] Don't reparse PMT unless it's version has changed
--- ---
libavformat/mpegts.c | 6 ++++++ libavformat/mpegts.c | 6 ++++++
1 file changed, 6 insertions(+) 1 file changed, 6 insertions(+)
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 4160c80..c946449 100644 index 9f85aed..25007a6 100644
--- a/libavformat/mpegts.c --- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c +++ b/libavformat/mpegts.c
@@ -87,6 +87,7 @@ struct MpegTSFilter { @@ -88,6 +88,7 @@ struct MpegTSFilter {
int es_id; int es_id;
int last_cc; /* last cc code (-1 if first packet) */ int last_cc; /* last cc code (-1 if first packet) */
int64_t last_pcr; int64_t last_pcr;
@ -279,7 +213,7 @@ index 4160c80..c946449 100644
enum MpegTSFilterType type; enum MpegTSFilterType type;
union { union {
MpegTSPESFilter pes_filter; MpegTSPESFilter pes_filter;
@@ -439,6 +440,7 @@ static MpegTSFilter *mpegts_open_filter(MpegTSContext *ts, unsigned int pid, @@ -450,6 +451,7 @@ static MpegTSFilter *mpegts_open_filter(MpegTSContext *ts, unsigned int pid,
filter->es_id = -1; filter->es_id = -1;
filter->last_cc = -1; filter->last_cc = -1;
filter->last_pcr= -1; filter->last_pcr= -1;
@ -287,7 +221,7 @@ index 4160c80..c946449 100644
return filter; return filter;
} }
@@ -1908,6 +1910,10 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len @@ -1972,6 +1974,10 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
return; return;
if (!h->current) if (!h->current)
return; return;
@ -299,10 +233,10 @@ index 4160c80..c946449 100644
ts->stream->ts_id = h->id; ts->stream->ts_id = h->id;
From beb037fb05df1610ab2850a8fbc858d1044b9216 Mon Sep 17 00:00:00 2001 From b772f2fa2076904e3cf2c9e9a80c080cec25c523 Mon Sep 17 00:00:00 2001
From: Cory Fields <theuni-nospam-@xbmc.org> From: Cory Fields <theuni-nospam-@xbmc.org>
Date: Fri, 9 Jul 2010 16:43:31 -0400 Date: Fri, 9 Jul 2010 16:43:31 -0400
Subject: [PATCH 08/17] Read PID timestamps as well as PCR timestamps to find Subject: [PATCH 07/13] Read PID timestamps as well as PCR timestamps to find
location in mpegts stream location in mpegts stream
--- ---
@ -310,10 +244,10 @@ Subject: [PATCH 08/17] Read PID timestamps as well as PCR timestamps to find
1 file changed, 46 insertions(+), 2 deletions(-) 1 file changed, 46 insertions(+), 2 deletions(-)
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index c946449..772df83 100644 index 25007a6..d5a8a45 100644
--- a/libavformat/mpegts.c --- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c +++ b/libavformat/mpegts.c
@@ -2388,6 +2388,44 @@ static void seek_back(AVFormatContext *s, AVIOContext *pb, int64_t pos) { @@ -2459,6 +2459,44 @@ static void seek_back(AVFormatContext *s, AVIOContext *pb, int64_t pos) {
av_log(s, pb->seekable ? AV_LOG_ERROR : AV_LOG_INFO, "Unable to seek back to the start\n"); av_log(s, pb->seekable ? AV_LOG_ERROR : AV_LOG_INFO, "Unable to seek back to the start\n");
} }
@ -358,7 +292,7 @@ index c946449..772df83 100644
static int mpegts_read_header(AVFormatContext *s) static int mpegts_read_header(AVFormatContext *s)
{ {
MpegTSContext *ts = s->priv_data; MpegTSContext *ts = s->priv_data;
@@ -2587,6 +2625,7 @@ static av_unused int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index, @@ -2658,6 +2696,7 @@ static av_unused int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index,
uint8_t buf[TS_PACKET_SIZE]; uint8_t buf[TS_PACKET_SIZE];
int pcr_l, pcr_pid = int pcr_l, pcr_pid =
((PESContext *)s->streams[stream_index]->priv_data)->pcr_pid; ((PESContext *)s->streams[stream_index]->priv_data)->pcr_pid;
@ -366,7 +300,7 @@ index c946449..772df83 100644
int pos47 = ts->pos47_full % ts->raw_packet_size; int pos47 = ts->pos47_full % ts->raw_packet_size;
pos = pos =
((*ppos + ts->raw_packet_size - 1 - pos47) / ts->raw_packet_size) * ((*ppos + ts->raw_packet_size - 1 - pos47) / ts->raw_packet_size) *
@@ -2608,6 +2647,11 @@ static av_unused int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index, @@ -2679,6 +2718,11 @@ static av_unused int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index,
*ppos = pos; *ppos = pos;
return timestamp; return timestamp;
} }
@ -378,7 +312,7 @@ index c946449..772df83 100644
pos += ts->raw_packet_size; pos += ts->raw_packet_size;
} }
@@ -2707,7 +2751,7 @@ AVInputFormat ff_mpegts_demuxer = { @@ -2778,7 +2822,7 @@ AVInputFormat ff_mpegts_demuxer = {
.read_header = mpegts_read_header, .read_header = mpegts_read_header,
.read_packet = mpegts_read_packet, .read_packet = mpegts_read_packet,
.read_close = mpegts_read_close, .read_close = mpegts_read_close,
@ -387,7 +321,7 @@ index c946449..772df83 100644
.flags = AVFMT_SHOW_IDS | AVFMT_TS_DISCONT, .flags = AVFMT_SHOW_IDS | AVFMT_TS_DISCONT,
.priv_class = &mpegts_class, .priv_class = &mpegts_class,
}; };
@@ -2719,7 +2763,7 @@ AVInputFormat ff_mpegtsraw_demuxer = { @@ -2790,7 +2834,7 @@ AVInputFormat ff_mpegtsraw_demuxer = {
.read_header = mpegts_read_header, .read_header = mpegts_read_header,
.read_packet = mpegts_raw_read_packet, .read_packet = mpegts_raw_read_packet,
.read_close = mpegts_read_close, .read_close = mpegts_read_close,
@ -397,20 +331,20 @@ index c946449..772df83 100644
.priv_class = &mpegtsraw_class, .priv_class = &mpegtsraw_class,
}; };
From fc5042d5fe0a3140508bdf03e3057ef67c1b0804 Mon Sep 17 00:00:00 2001 From ce94d83559b1f4e1affd6349abcd1bf794e2cd17 Mon Sep 17 00:00:00 2001
From: Joakim Plate <elupus@ecce.se> From: Joakim Plate <elupus@ecce.se>
Date: Sat, 22 Oct 2011 19:01:38 +0200 Date: Sat, 22 Oct 2011 19:01:38 +0200
Subject: [PATCH 09/17] Get stream durations using read_timestamp Subject: [PATCH 08/13] Get stream durations using read_timestamp
--- ---
libavformat/utils.c | 39 +++++++++++++++++++++++++++++++++++++++ libavformat/utils.c | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+) 1 file changed, 39 insertions(+)
diff --git a/libavformat/utils.c b/libavformat/utils.c diff --git a/libavformat/utils.c b/libavformat/utils.c
index 5b15baa..03d46f5 100644 index b233a2b..ccd8149 100644
--- a/libavformat/utils.c --- a/libavformat/utils.c
+++ b/libavformat/utils.c +++ b/libavformat/utils.c
@@ -2317,6 +2317,41 @@ static void estimate_timings_from_bit_rate(AVFormatContext *ic) @@ -2359,6 +2359,41 @@ static void estimate_timings_from_bit_rate(AVFormatContext *ic)
#define DURATION_MAX_READ_SIZE 250000LL #define DURATION_MAX_READ_SIZE 250000LL
#define DURATION_MAX_RETRY 4 #define DURATION_MAX_RETRY 4
@ -452,7 +386,7 @@ index 5b15baa..03d46f5 100644
/* only usable for MPEG-PS streams */ /* only usable for MPEG-PS streams */
static void estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset) static void estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset)
{ {
@@ -2467,6 +2502,10 @@ static void estimate_timings(AVFormatContext *ic, int64_t old_offset) @@ -2509,6 +2544,10 @@ static void estimate_timings(AVFormatContext *ic, int64_t old_offset)
* the components */ * the components */
fill_all_stream_timings(ic); fill_all_stream_timings(ic);
ic->duration_estimation_method = AVFMT_DURATION_FROM_STREAM; ic->duration_estimation_method = AVFMT_DURATION_FROM_STREAM;
@ -464,10 +398,10 @@ index 5b15baa..03d46f5 100644
/* less precise: use bitrate info */ /* less precise: use bitrate info */
estimate_timings_from_bit_rate(ic); estimate_timings_from_bit_rate(ic);
From f41ad0604415bc18c61761a948f46c52aaa62eb5 Mon Sep 17 00:00:00 2001 From d159d252efab3568335faf615d8083b7e88e5b51 Mon Sep 17 00:00:00 2001
From: Joakim Plate <elupus@ecce.se> From: Joakim Plate <elupus@ecce.se>
Date: Wed, 8 Dec 2010 14:03:43 +0000 Date: Wed, 8 Dec 2010 14:03:43 +0000
Subject: [PATCH 10/17] changed: allow 4 second skew between streams in mov Subject: [PATCH 09/13] changed: allow 4 second skew between streams in mov
before attempting to seek before attempting to seek
--- ---
@ -475,10 +409,10 @@ Subject: [PATCH 10/17] changed: allow 4 second skew between streams in mov
1 file changed, 2 insertions(+), 2 deletions(-) 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavformat/mov.c b/libavformat/mov.c diff --git a/libavformat/mov.c b/libavformat/mov.c
index 12fa707..6042517 100644 index 7455e3b..4f6e207 100644
--- a/libavformat/mov.c --- a/libavformat/mov.c
+++ b/libavformat/mov.c +++ b/libavformat/mov.c
@@ -3725,8 +3725,8 @@ static AVIndexEntry *mov_find_next_sample(AVFormatContext *s, AVStream **st) @@ -4049,8 +4049,8 @@ static AVIndexEntry *mov_find_next_sample(AVFormatContext *s, AVStream **st)
if (!sample || (!s->pb->seekable && current_sample->pos < sample->pos) || if (!sample || (!s->pb->seekable && current_sample->pos < sample->pos) ||
(s->pb->seekable && (s->pb->seekable &&
((msc->pb != s->pb && dts < best_dts) || (msc->pb == s->pb && ((msc->pb != s->pb && dts < best_dts) || (msc->pb == s->pb &&
@ -490,10 +424,10 @@ index 12fa707..6042517 100644
best_dts = dts; best_dts = dts;
*st = avst; *st = avst;
From 8948e1b229d79193a5f248094431b2c357c9d029 Mon Sep 17 00:00:00 2001 From bce4a8f7d52722aacf9d5d6256f70cb7c42e5480 Mon Sep 17 00:00:00 2001
From: Joakim Plate <elupus@ecce.se> From: Joakim Plate <elupus@ecce.se>
Date: Fri, 26 Nov 2010 20:56:48 +0000 Date: Fri, 26 Nov 2010 20:56:48 +0000
Subject: [PATCH 11/17] fixed: memleak in mpegts demuxer on some malformed (??) Subject: [PATCH 10/13] fixed: memleak in mpegts demuxer on some malformed (??)
mpegts files with too large pes packets mpegts files with too large pes packets
at-visions sample file brokenStream.mpg at-visions sample file brokenStream.mpg
@ -502,10 +436,10 @@ at-visions sample file brokenStream.mpg
1 file changed, 6 insertions(+) 1 file changed, 6 insertions(+)
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 772df83..40dfab1 100644 index d5a8a45..e070f1f 100644
--- a/libavformat/mpegts.c --- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c +++ b/libavformat/mpegts.c
@@ -820,6 +820,10 @@ static void reset_pes_packet_state(PESContext *pes) @@ -832,6 +832,10 @@ static void reset_pes_packet_state(PESContext *pes)
static void new_pes_packet(PESContext *pes, AVPacket *pkt) static void new_pes_packet(PESContext *pes, AVPacket *pkt)
{ {
@ -516,7 +450,7 @@ index 772df83..40dfab1 100644
av_init_packet(pkt); av_init_packet(pkt);
pkt->buf = pes->buffer; pkt->buf = pes->buffer;
@@ -2578,6 +2582,8 @@ static int mpegts_read_packet(AVFormatContext *s, AVPacket *pkt) @@ -2649,6 +2653,8 @@ static int mpegts_read_packet(AVFormatContext *s, AVPacket *pkt)
pkt->size = -1; pkt->size = -1;
ts->pkt = pkt; ts->pkt = pkt;
@ -526,20 +460,20 @@ index 772df83..40dfab1 100644
if (ret < 0) { if (ret < 0) {
av_free_packet(ts->pkt); av_free_packet(ts->pkt);
From ff0c571031aa53f46dbceaa8478d2cc4be4b4a81 Mon Sep 17 00:00:00 2001 From 81ffa6832117d97c61aff62b27c1cd71b778daa0 Mon Sep 17 00:00:00 2001
From: Joakim Plate <elupus@ecce.se> From: Joakim Plate <elupus@ecce.se>
Date: Mon, 28 Jun 2010 21:26:54 +0000 Date: Mon, 28 Jun 2010 21:26:54 +0000
Subject: [PATCH 12/17] Speed up mpegts av_find_stream_info Subject: [PATCH 11/13] Speed up mpegts av_find_stream_info
--- ---
libavformat/mpegts.c | 2 +- libavformat/mpegts.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-) 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 40dfab1..031f4e1 100644 index e070f1f..dd9e129 100644
--- a/libavformat/mpegts.c --- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c +++ b/libavformat/mpegts.c
@@ -982,7 +982,7 @@ static int mpegts_push_data(MpegTSFilter *filter, @@ -994,7 +994,7 @@ static int mpegts_push_data(MpegTSFilter *filter,
goto skip; goto skip;
/* stream not present in PMT */ /* stream not present in PMT */
@ -549,10 +483,10 @@ index 40dfab1..031f4e1 100644
goto skip; goto skip;
From 07961e665a524faacfc1f0b074c5e4fdcf61909f Mon Sep 17 00:00:00 2001 From 7cc40ff6285cb0e571ef2fccaffdbeda11600ccb Mon Sep 17 00:00:00 2001
From: marc <mhocking@ubuntu-desktop.(none)> From: marc <mhocking@ubuntu-desktop.(none)>
Date: Mon, 18 Feb 2013 17:18:18 +0000 Date: Mon, 18 Feb 2013 17:18:18 +0000
Subject: [PATCH 13/17] dxva-h264 Fix dxva playback of streams that don't start Subject: [PATCH 12/13] dxva-h264 Fix dxva playback of streams that don't start
with an I-Frame. with an I-Frame.
--- ---
@ -582,7 +516,7 @@ index 6deccc3..85b25fd 100644
&ctx_pic->pp, sizeof(ctx_pic->pp), &ctx_pic->pp, sizeof(ctx_pic->pp),
&ctx_pic->qm, sizeof(ctx_pic->qm), &ctx_pic->qm, sizeof(ctx_pic->qm),
diff --git a/libavcodec/h264.c b/libavcodec/h264.c diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index ba5bb40..02f2179 100644 index 438c43f..a576e90 100644
--- a/libavcodec/h264.c --- a/libavcodec/h264.c
+++ b/libavcodec/h264.c +++ b/libavcodec/h264.c
@@ -1096,6 +1096,7 @@ void ff_h264_flush_change(H264Context *h) @@ -1096,6 +1096,7 @@ void ff_h264_flush_change(H264Context *h)
@ -607,7 +541,7 @@ index cb7e6f9..f819465 100644
int sei_buffering_period_present; ///< Buffering period SEI flag int sei_buffering_period_present; ///< Buffering period SEI flag
int initial_cpb_removal_delay[32]; ///< Initial timestamps for CPBs int initial_cpb_removal_delay[32]; ///< Initial timestamps for CPBs
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index c46cc24..c764226 100644 index f03ab4e..ee22bc0 100644
--- a/libavcodec/h264_slice.c --- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c
@@ -1189,6 +1189,7 @@ static int h264_slice_header_init(H264Context *h, int reinit) @@ -1189,6 +1189,7 @@ static int h264_slice_header_init(H264Context *h, int reinit)
@ -619,10 +553,10 @@ index c46cc24..c764226 100644
init_scan_tables(h); init_scan_tables(h);
ret = ff_h264_alloc_tables(h); ret = ff_h264_alloc_tables(h);
From 5bf9e53b2622024382147b527226bf23c76589c3 Mon Sep 17 00:00:00 2001 From f723a5163e9a24080de5abdbd317ee8df61a79f7 Mon Sep 17 00:00:00 2001
From: elupus <elupus@xbmc.org> From: elupus <elupus@xbmc.org>
Date: Tue, 1 Nov 2011 20:18:35 +0100 Date: Tue, 1 Nov 2011 20:18:35 +0100
Subject: [PATCH 14/17] add public version of ff_read_frame_flush Subject: [PATCH 13/13] add public version of ff_read_frame_flush
We need this since we sometimes seek on the We need this since we sometimes seek on the
input stream behind ffmpeg's back. After this input stream behind ffmpeg's back. After this
@ -633,10 +567,10 @@ all data need to be flushed completely.
2 files changed, 10 insertions(+) 2 files changed, 10 insertions(+)
diff --git a/libavformat/avformat.h b/libavformat/avformat.h diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index ebf04f6..0eae4f0 100644 index 2e54ed1..3a9f292 100644
--- a/libavformat/avformat.h --- a/libavformat/avformat.h
+++ b/libavformat/avformat.h +++ b/libavformat/avformat.h
@@ -2112,6 +2112,11 @@ int av_read_packet(AVFormatContext *s, AVPacket *pkt); @@ -2121,6 +2121,11 @@ int av_find_best_stream(AVFormatContext *ic,
int av_read_frame(AVFormatContext *s, AVPacket *pkt); int av_read_frame(AVFormatContext *s, AVPacket *pkt);
/** /**
@ -649,10 +583,10 @@ index ebf04f6..0eae4f0 100644
* 'timestamp' in 'stream_index'. * 'timestamp' in 'stream_index'.
* *
diff --git a/libavformat/utils.c b/libavformat/utils.c diff --git a/libavformat/utils.c b/libavformat/utils.c
index 03d46f5..efd86a4 100644 index ccd8149..d241608 100644
--- a/libavformat/utils.c --- a/libavformat/utils.c
+++ b/libavformat/utils.c +++ b/libavformat/utils.c
@@ -1585,6 +1585,11 @@ void ff_read_frame_flush(AVFormatContext *s) @@ -1627,6 +1627,11 @@ void ff_read_frame_flush(AVFormatContext *s)
} }
} }
@ -664,231 +598,3 @@ index 03d46f5..efd86a4 100644
void ff_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp) void ff_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp)
{ {
int i; int i;
From 1ed026136a69f3cfdbc6ee73ea51278246c6f85a Mon Sep 17 00:00:00 2001
From: Memphiz <memphis@machzwo.de>
Date: Mon, 12 May 2014 18:27:01 +0200
Subject: [PATCH 15/17] fix --disable-ffplay should disable any needs to check
or add compile/link flags otherwise SDL gets spewed all over pkg-config files
and generally causes a mess
---
configure | 32 +++++++++++++++++---------------
1 file changed, 17 insertions(+), 15 deletions(-)
diff --git a/configure b/configure
index 2f36354..07376d5 100755
--- a/configure
+++ b/configure
@@ -4912,22 +4912,24 @@ if enabled libdc1394; then
die "ERROR: No version of libdc1394 found "
fi
-SDL_CONFIG="${cross_prefix}sdl-config"
-if check_pkg_config sdl SDL_events.h SDL_PollEvent; then
- check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
- check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x010300" $sdl_cflags &&
- enable sdl
-else
- if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
- sdl_cflags=$("${SDL_CONFIG}" --cflags)
- sdl_libs=$("${SDL_CONFIG}" --libs)
- check_func_headers SDL_version.h SDL_Linked_Version $sdl_cflags $sdl_libs &&
- check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
- check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x010300" $sdl_cflags &&
- enable sdl
- fi
+if enabled ffplay; then
+ SDL_CONFIG="${cross_prefix}sdl-config"
+ if check_pkg_config sdl SDL_events.h SDL_PollEvent; then
+ check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
+ check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x010300" $sdl_cflags &&
+ enable sdl
+ else
+ if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
+ sdl_cflags=$("${SDL_CONFIG}" --cflags)
+ sdl_libs=$("${SDL_CONFIG}" --libs)
+ check_func_headers SDL_version.h SDL_Linked_Version $sdl_cflags $sdl_libs &&
+ check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
+ check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x010300" $sdl_cflags &&
+ enable sdl
+ fi
+ fi
+ enabled sdl && add_cflags $sdl_cflags && add_extralibs $sdl_libs
fi
-enabled sdl && add_cflags $sdl_cflags && add_extralibs $sdl_libs
makeinfo --version > /dev/null 2>&1 && enable makeinfo || disable makeinfo
enabled makeinfo && (makeinfo --version | \
From 12eef928df9890d08e4522326890720897c2d39e Mon Sep 17 00:00:00 2001
From: Hendrik Leppkes <h.leppkes@gmail.com>
Date: Sun, 21 Sep 2014 02:29:27 +0200
Subject: [PATCH 16/17] mlpdec: support major sync headers with optional
extension blocks
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
---
libavcodec/mlp_parser.c | 29 ++++++++++++++++++++++++-----
libavcodec/mlp_parser.h | 1 +
libavcodec/mlpdec.c | 7 ++++++-
3 files changed, 31 insertions(+), 6 deletions(-)
diff --git a/libavcodec/mlp_parser.c b/libavcodec/mlp_parser.c
index 4bb82ee..deaa844 100644
--- a/libavcodec/mlp_parser.c
+++ b/libavcodec/mlp_parser.c
@@ -119,6 +119,23 @@ uint64_t ff_truehd_layout(int chanmap)
return layout;
}
+static int ff_mlp_get_major_sync_size(const uint8_t * buf, int bufsize)
+{
+ int has_extension, extensions = 0;
+ int size = 28;
+ if (bufsize < 28)
+ return -1;
+
+ if (AV_RB32(buf) == 0xf8726fba) {
+ has_extension = buf[25] & 1;
+ if (has_extension) {
+ extensions = buf[26] >> 4;
+ size += 2 + extensions * 2;
+ }
+ }
+ return size;
+}
+
/** Read a major sync info header - contains high level information about
* the stream - sample rate, channel arrangement etc. Most of this
* information is not actually necessary for decoding, only for playback.
@@ -127,18 +144,19 @@ uint64_t ff_truehd_layout(int chanmap)
int ff_mlp_read_major_sync(void *log, MLPHeaderInfo *mh, GetBitContext *gb)
{
- int ratebits, channel_arrangement;
+ int ratebits, channel_arrangement, header_size;
uint16_t checksum;
av_assert1(get_bits_count(gb) == 0);
- if (gb->size_in_bits < 28 << 3) {
+ header_size = ff_mlp_get_major_sync_size(gb->buffer, gb->size_in_bits >> 3);
+ if (header_size < 0 || gb->size_in_bits < header_size << 3) {
av_log(log, AV_LOG_ERROR, "packet too short, unable to read major sync\n");
return -1;
}
- checksum = ff_mlp_checksum16(gb->buffer, 26);
- if (checksum != AV_RL16(gb->buffer+26)) {
+ checksum = ff_mlp_checksum16(gb->buffer, header_size - 2);
+ if (checksum != AV_RL16(gb->buffer+header_size-2)) {
av_log(log, AV_LOG_ERROR, "major sync info header checksum error\n");
return AVERROR_INVALIDDATA;
}
@@ -147,6 +165,7 @@ int ff_mlp_read_major_sync(void *log, MLPHeaderInfo *mh, GetBitContext *gb)
return AVERROR_INVALIDDATA;
mh->stream_type = get_bits(gb, 8);
+ mh->header_size = header_size;
if (mh->stream_type == 0xbb) {
mh->group1_bits = mlp_quants[get_bits(gb, 4)];
@@ -199,7 +218,7 @@ int ff_mlp_read_major_sync(void *log, MLPHeaderInfo *mh, GetBitContext *gb)
mh->num_substreams = get_bits(gb, 4);
- skip_bits_long(gb, 4 + 11 * 8);
+ skip_bits_long(gb, 4 + (header_size - 17) * 8);
return 0;
}
diff --git a/libavcodec/mlp_parser.h b/libavcodec/mlp_parser.h
index 5d1d2e7..0c0109e 100644
--- a/libavcodec/mlp_parser.h
+++ b/libavcodec/mlp_parser.h
@@ -32,6 +32,7 @@
typedef struct MLPHeaderInfo
{
int stream_type; ///< 0xBB for MLP, 0xBA for TrueHD
+ int header_size; ///< Size of the major sync header, in bytes
int group1_bits; ///< The bit depth of the first substream
int group2_bits; ///< Bit depth of the second substream (MLP only)
diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
index ed6a7fb..fddeb14 100644
--- a/libavcodec/mlpdec.c
+++ b/libavcodec/mlpdec.c
@@ -132,6 +132,9 @@ typedef struct MLPDecodeContext {
/// Current access unit being read has a major sync.
int is_major_sync_unit;
+ /// Size of the major sync unit, in bytes
+ int major_sync_header_size;
+
/// Set if a valid major sync block has been read. Otherwise no decoding is possible.
uint8_t params_valid;
@@ -349,6 +352,8 @@ static int read_major_sync(MLPDecodeContext *m, GetBitContext *gb)
return AVERROR_PATCHWELCOME;
}
+ m->major_sync_header_size = mh.header_size;
+
m->access_unit_size = mh.access_unit_size;
m->access_unit_size_pow2 = mh.access_unit_size_pow2;
@@ -1142,7 +1147,7 @@ static int read_access_unit(AVCodecContext *avctx, void* data,
if (read_major_sync(m, &gb) < 0)
goto error;
m->is_major_sync_unit = 1;
- header_size += 28;
+ header_size += m->major_sync_header_size;
}
if (!m->params_valid) {
From 4313d9d59fbe0f78ebb9718946bcdf75f8e36a31 Mon Sep 17 00:00:00 2001
From: Hendrik Leppkes <h.leppkes@gmail.com>
Date: Sun, 21 Sep 2014 02:29:28 +0200
Subject: [PATCH 17/17] mlpdec: support TrueHD streams with an Atmos substream
The fourth substream is being discarded, since its not raw audio data,
but an encoded Atmos stream which needs a specialized decoder.
Fixes decoding of the true hd stream from Transformers\ -\ Age\ of\ Extinction\ 2014\ 1080P-003.mkv
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
---
libavcodec/mlp.h | 2 +-
libavcodec/mlpdec.c | 4 +++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/libavcodec/mlp.h b/libavcodec/mlp.h
index bb9ca26..05d8dba 100644
--- a/libavcodec/mlp.h
+++ b/libavcodec/mlp.h
@@ -45,7 +45,7 @@
/** Maximum number of substreams that can be decoded.
* MLP's limit is 2. TrueHD supports at least up to 3.
*/
-#define MAX_SUBSTREAMS 3
+#define MAX_SUBSTREAMS 4
/** which multiple of 48000 the maximum sample rate is */
#define MAX_RATEFACTOR 4
diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
index fddeb14..e443f81 100644
--- a/libavcodec/mlpdec.c
+++ b/libavcodec/mlpdec.c
@@ -358,7 +358,9 @@ static int read_major_sync(MLPDecodeContext *m, GetBitContext *gb)
m->access_unit_size_pow2 = mh.access_unit_size_pow2;
m->num_substreams = mh.num_substreams;
- m->max_decoded_substream = m->num_substreams - 1;
+
+ /* limit to decoding 3 substreams, as the 4th is used by Dolby Atmos for non-audio data */
+ m->max_decoded_substream = FFMIN(m->num_substreams - 1, 2);
m->avctx->sample_rate = mh.group1_samplerate;
m->avctx->frame_size = mh.access_unit_size;