From e018cdea0566e22edf72de4b82a6634c791a90bc Mon Sep 17 00:00:00 2001 From: Bradley Sepos Date: Tue, 6 Jun 2017 15:43:09 -0400 Subject: contrib: Update to Libav 12.1. Closes #742 and closes #767. --- contrib/ffmpeg/A02-mov-colr.patch | 57 ---------- ...A03-matroskadec-fix-SRT-subtitle-duration.patch | 31 ------ contrib/ffmpeg/A05-h264-recovery.patch | 20 ---- contrib/ffmpeg/A07-wmv-crash.patch | 31 ------ contrib/ffmpeg/A08-wmv-scan-fail.patch | 117 --------------------- contrib/ffmpeg/A15-asf-2G.patch | 27 ----- contrib/ffmpeg/A16-decoder-hang-eagain.patch | 71 ------------- contrib/ffmpeg/module.defs | 6 +- 8 files changed, 3 insertions(+), 357 deletions(-) delete mode 100644 contrib/ffmpeg/A02-mov-colr.patch delete mode 100644 contrib/ffmpeg/A03-matroskadec-fix-SRT-subtitle-duration.patch delete mode 100644 contrib/ffmpeg/A05-h264-recovery.patch delete mode 100644 contrib/ffmpeg/A07-wmv-crash.patch delete mode 100644 contrib/ffmpeg/A08-wmv-scan-fail.patch delete mode 100644 contrib/ffmpeg/A15-asf-2G.patch delete mode 100644 contrib/ffmpeg/A16-decoder-hang-eagain.patch diff --git a/contrib/ffmpeg/A02-mov-colr.patch b/contrib/ffmpeg/A02-mov-colr.patch deleted file mode 100644 index b65b465e6..000000000 --- a/contrib/ffmpeg/A02-mov-colr.patch +++ /dev/null @@ -1,57 +0,0 @@ -diff --git a/libavformat/mov.c b/libavformat/mov.c -index 36e75d5..fee9f36 100644 ---- a/libavformat/mov.c -+++ b/libavformat/mov.c -@@ -36,6 +36,7 @@ - #include "libavutil/avstring.h" - #include "libavutil/dict.h" - #include "libavutil/opt.h" -+#include "libavutil/pixdesc.h" - #include "libavcodec/ac3tab.h" - #include "avformat.h" - #include "internal.h" -@@ -1083,16 +1084,14 @@ static int mov_read_colr(MOVContext *c, AVIOContext *pb, MOVAtom atom) - st->codecpar->color_range = AVCOL_RANGE_JPEG; - else - st->codecpar->color_range = AVCOL_RANGE_MPEG; -- /* 14496-12 references JPEG XR specs (rather than the more complete -- * 23001-8) so some adjusting is required */ -- if (color_primaries >= AVCOL_PRI_FILM) -+ -+ if (!av_color_primaries_name(color_primaries)) - color_primaries = AVCOL_PRI_UNSPECIFIED; -- if ((color_trc >= AVCOL_TRC_LINEAR && -- color_trc <= AVCOL_TRC_LOG_SQRT) || -- color_trc >= AVCOL_TRC_BT2020_10) -+ if (!av_color_transfer_name(color_trc)) - color_trc = AVCOL_TRC_UNSPECIFIED; -- if (color_matrix >= AVCOL_SPC_BT2020_NCL) -+ if (!av_color_space_name(color_matrix)) - color_matrix = AVCOL_SPC_UNSPECIFIED; -+ - st->codecpar->color_primaries = color_primaries; - st->codecpar->color_trc = color_trc; - st->codecpar->color_space = color_matrix; -@@ -1102,17 +1101,22 @@ static int mov_read_colr(MOVContext *c, AVIOContext *pb, MOVAtom atom) - case 1: st->codecpar->color_primaries = AVCOL_PRI_BT709; break; - case 5: st->codecpar->color_primaries = AVCOL_PRI_SMPTE170M; break; - case 6: st->codecpar->color_primaries = AVCOL_PRI_SMPTE240M; break; -+ case 9: st->codecpar->color_primaries = AVCOL_PRI_BT2020; break; -+ case 10: st->codecpar->color_primaries = AVCOL_PRI_SMPTE431; break; -+ case 11: st->codecpar->color_primaries = AVCOL_PRI_SMPTE432; break; - } - /* color transfer, Table 4-5 */ - switch (color_trc) { - case 1: st->codecpar->color_trc = AVCOL_TRC_BT709; break; - case 7: st->codecpar->color_trc = AVCOL_TRC_SMPTE240M; break; -+ case 17: st->codecpar->color_trc = AVCOL_TRC_SMPTE428; break; - } - /* color matrix, Table 4-6 */ - switch (color_matrix) { - case 1: st->codecpar->color_space = AVCOL_SPC_BT709; break; - case 6: st->codecpar->color_space = AVCOL_SPC_BT470BG; break; - case 7: st->codecpar->color_space = AVCOL_SPC_SMPTE240M; break; -+ case 9: st->codecpar->color_space = AVCOL_SPC_BT2020_NCL; break; - } - } - av_log(c->fc, AV_LOG_TRACE, "\n"); diff --git a/contrib/ffmpeg/A03-matroskadec-fix-SRT-subtitle-duration.patch b/contrib/ffmpeg/A03-matroskadec-fix-SRT-subtitle-duration.patch deleted file mode 100644 index e3c83ca25..000000000 --- a/contrib/ffmpeg/A03-matroskadec-fix-SRT-subtitle-duration.patch +++ /dev/null @@ -1,31 +0,0 @@ -From e5ed82a1719ebabda8d2ae7b02ab59dc1c819b4b Mon Sep 17 00:00:00 2001 -From: John Stebbins -Date: Thu, 22 Dec 2016 09:23:30 -0800 -Subject: [PATCH] matroskadec: fix SRT subtitle duration - -The codec id for SRT was changed and conditionals were not updated. ---- - libavformat/matroskadec.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c -index 8016730..a3954b0 100644 ---- a/libavformat/matroskadec.c -+++ b/libavformat/matroskadec.c -@@ -2439,11 +2439,11 @@ static int matroska_parse_frame(MatroskaDemuxContext *matroska, - else - pkt->pts = timecode; - pkt->pos = pos; -- if (track->type != MATROSKA_TRACK_TYPE_SUBTITLE || st->codecpar->codec_id == AV_CODEC_ID_TEXT) -+ if (track->type != MATROSKA_TRACK_TYPE_SUBTITLE || st->codecpar->codec_id == AV_CODEC_ID_SRT) - pkt->duration = duration; - #if FF_API_CONVERGENCE_DURATION - FF_DISABLE_DEPRECATION_WARNINGS -- if (st->codecpar->codec_id == AV_CODEC_ID_TEXT) -+ if (st->codecpar->codec_id == AV_CODEC_ID_SRT) - pkt->convergence_duration = duration; - FF_ENABLE_DEPRECATION_WARNINGS - #endif --- -2.7.4 - diff --git a/contrib/ffmpeg/A05-h264-recovery.patch b/contrib/ffmpeg/A05-h264-recovery.patch deleted file mode 100644 index d27b35bdd..000000000 --- a/contrib/ffmpeg/A05-h264-recovery.patch +++ /dev/null @@ -1,20 +0,0 @@ -diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c -index 5137039..6d7aa7b 100644 ---- a/libavcodec/h264dec.c -+++ b/libavcodec/h264dec.c -@@ -452,7 +452,6 @@ void ff_h264_flush_change(H264Context *h) - if (h->cur_pic_ptr) - h->cur_pic_ptr->reference = 0; - h->first_field = 0; -- ff_h264_sei_uninit(&h->sei); - h->recovery_frame = -1; - h->frame_recovered = 0; - } -@@ -466,6 +465,7 @@ static void flush_dpb(AVCodecContext *avctx) - memset(h->delayed_pic, 0, sizeof(h->delayed_pic)); - - ff_h264_flush_change(h); -+ ff_h264_sei_uninit(&h->sei); - - for (i = 0; i < H264_MAX_PICTURE_COUNT; i++) - ff_h264_unref_picture(h, &h->DPB[i]); diff --git a/contrib/ffmpeg/A07-wmv-crash.patch b/contrib/ffmpeg/A07-wmv-crash.patch deleted file mode 100644 index ca124a14c..000000000 --- a/contrib/ffmpeg/A07-wmv-crash.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 8e67039c6312ba520945f2c01b7b14df056d5ed1 Mon Sep 17 00:00:00 2001 -From: John Stebbins -Date: Thu, 12 Jan 2017 13:36:26 -0700 -Subject: [PATCH] asfdec: Use the ASF stream count when iterating - -The AVFormat stream count can be larger due external factors, such as -an id3 tag appended. - -Avoid an out of bound read. - -Signed-off-by: Luca Barbato ---- - libavformat/asfdec.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c -index 1c50ad6..d602af8 100644 ---- a/libavformat/asfdec.c -+++ b/libavformat/asfdec.c -@@ -1485,7 +1485,7 @@ static int asf_read_packet(AVFormatContext *s, AVPacket *pkt) - asf->return_subpayload = 0; - return 0; - } -- for (i = 0; i < s->nb_streams; i++) { -+ for (i = 0; i < asf->nb_streams; i++) { - ASFPacket *asf_pkt = &asf->asf_st[i]->pkt; - if (asf_pkt && !asf_pkt->size_left && asf_pkt->data_size) { - if (asf->asf_st[i]->span > 1 && --- -2.9.3 - diff --git a/contrib/ffmpeg/A08-wmv-scan-fail.patch b/contrib/ffmpeg/A08-wmv-scan-fail.patch deleted file mode 100644 index 14b03e83c..000000000 --- a/contrib/ffmpeg/A08-wmv-scan-fail.patch +++ /dev/null @@ -1,117 +0,0 @@ -From 0539d84d985e811e5989ef27c13f7e2dda0f9b89 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Alexandra=20H=C3=A1jkov=C3=A1?= - -Date: Wed, 8 Feb 2017 12:51:37 +0100 -Subject: [PATCH] asfdec: Account for different Format Data sizes - -Some muxers may use the BMP_HEADER Format Data size instead -of the ASF-specific one. - -Bug-Id: 1020 -CC: libav-stable@libav.org - -Signed-off-by: Diego Biurrun ---- - libavformat/asfdec.c | 12 +++++++----- - libavformat/avidec.c | 2 +- - libavformat/riff.h | 3 ++- - libavformat/riffdec.c | 6 ++++-- - libavformat/wtv.c | 2 +- - 5 files changed, 15 insertions(+), 10 deletions(-) - -diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c -index d602af8..34730b2 100644 ---- a/libavformat/asfdec.c -+++ b/libavformat/asfdec.c -@@ -691,20 +691,22 @@ static int asf_read_properties(AVFormatContext *s, const GUIDParseTable *g) - - static int parse_video_info(AVIOContext *pb, AVStream *st) - { -- uint16_t size; -+ uint16_t size_asf; // ASF-specific Format Data size -+ uint32_t size_bmp; // BMP_HEADER-specific Format Data size - unsigned int tag; - - st->codecpar->width = avio_rl32(pb); - st->codecpar->height = avio_rl32(pb); - avio_skip(pb, 1); // skip reserved flags -- size = avio_rl16(pb); // size of the Format Data -- tag = ff_get_bmp_header(pb, st); -+ size_asf = avio_rl16(pb); -+ tag = ff_get_bmp_header(pb, st, &size_bmp); - st->codecpar->codec_tag = tag; - st->codecpar->codec_id = ff_codec_get_id(ff_codec_bmp_tags, tag); -+ size_bmp = FFMAX(size_asf, size_bmp); - -- if (size > BMP_HEADER_SIZE) { -+ if (size_bmp > BMP_HEADER_SIZE) { - int ret; -- st->codecpar->extradata_size = size - BMP_HEADER_SIZE; -+ st->codecpar->extradata_size = size_bmp - BMP_HEADER_SIZE; - if (!(st->codecpar->extradata = av_malloc(st->codecpar->extradata_size + - AV_INPUT_BUFFER_PADDING_SIZE))) { - st->codecpar->extradata_size = 0; -diff --git a/libavformat/avidec.c b/libavformat/avidec.c -index 701cccb..870066e 100644 ---- a/libavformat/avidec.c -+++ b/libavformat/avidec.c -@@ -613,7 +613,7 @@ static int avi_read_header(AVFormatContext *s) - avio_skip(pb, size); - break; - } -- tag1 = ff_get_bmp_header(pb, st); -+ tag1 = ff_get_bmp_header(pb, st, NULL); - - if (tag1 == MKTAG('D', 'X', 'S', 'B') || - tag1 == MKTAG('D', 'X', 'S', 'A')) { -diff --git a/libavformat/riff.h b/libavformat/riff.h -index a45c7f3..e5f4645 100644 ---- a/libavformat/riff.h -+++ b/libavformat/riff.h -@@ -41,9 +41,10 @@ void ff_end_tag(AVIOContext *pb, int64_t start); - /** - * Read BITMAPINFOHEADER structure and set AVStream codec width, height and - * bits_per_encoded_sample fields. Does not read extradata. -+ * Writes the size of the BMP file to *size. - * @return codec tag - */ --int ff_get_bmp_header(AVIOContext *pb, AVStream *st); -+int ff_get_bmp_header(AVIOContext *pb, AVStream *st, uint32_t *size); - - void ff_put_bmp_header(AVIOContext *pb, AVCodecParameters *par, const AVCodecTag *tags, int for_asf); - int ff_put_wav_header(AVFormatContext *s, AVIOContext *pb, AVCodecParameters *par); -diff --git a/libavformat/riffdec.c b/libavformat/riffdec.c -index 8124835..db83b32 100644 ---- a/libavformat/riffdec.c -+++ b/libavformat/riffdec.c -@@ -180,10 +180,12 @@ enum AVCodecID ff_wav_codec_get_id(unsigned int tag, int bps) - return id; - } - --int ff_get_bmp_header(AVIOContext *pb, AVStream *st) -+int ff_get_bmp_header(AVIOContext *pb, AVStream *st, uint32_t *size) - { - int tag1; -- avio_rl32(pb); /* size */ -+ uint32_t size_ = avio_rl32(pb); -+ if (size) -+ *size = size_; - st->codecpar->width = avio_rl32(pb); - st->codecpar->height = (int32_t)avio_rl32(pb); - avio_rl16(pb); /* planes */ -diff --git a/libavformat/wtv.c b/libavformat/wtv.c -index 794dd4b..d750cef 100644 ---- a/libavformat/wtv.c -+++ b/libavformat/wtv.c -@@ -586,7 +586,7 @@ static int parse_videoinfoheader2(AVFormatContext *s, AVStream *st) - AVIOContext *pb = wtv->pb; - - avio_skip(pb, 72); // picture aspect ratio is unreliable -- ff_get_bmp_header(pb, st); -+ ff_get_bmp_header(pb, st, NULL); - - return 72 + 40; - } --- -2.9.3 - diff --git a/contrib/ffmpeg/A15-asf-2G.patch b/contrib/ffmpeg/A15-asf-2G.patch deleted file mode 100644 index 4b5f350be..000000000 --- a/contrib/ffmpeg/A15-asf-2G.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 93de850f0fe3dc0084aba1933b57f0a0c0344d15 Mon Sep 17 00:00:00 2001 -From: John Stebbins -Date: Thu, 23 Feb 2017 16:47:58 -0700 -Subject: [PATCH] asfdec: fix reading files larger than 2GB - -avio_skip returns file position and overflows int ---- - libavformat/asfdec.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c -index 34730b2..10d3396 100644 ---- a/libavformat/asfdec.c -+++ b/libavformat/asfdec.c -@@ -976,7 +976,8 @@ static int asf_read_simple_index(AVFormatContext *s, const GUIDParseTable *g) - uint64_t interval; // index entry time interval in 100 ns units, usually it's 1s - uint32_t pkt_num, nb_entries; - int32_t prev_pkt_num = -1; -- int i, ret; -+ int i; -+ int64_t ret; - uint64_t size = avio_rl64(pb); - - // simple index objects should be ordered by stream number, this loop tries to find --- -2.9.3 - diff --git a/contrib/ffmpeg/A16-decoder-hang-eagain.patch b/contrib/ffmpeg/A16-decoder-hang-eagain.patch deleted file mode 100644 index 5b59cae93..000000000 --- a/contrib/ffmpeg/A16-decoder-hang-eagain.patch +++ /dev/null @@ -1,71 +0,0 @@ -diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c -index 6a06062..0e629ce 100644 ---- a/libavcodec/aacdec.c -+++ b/libavcodec/aacdec.c -@@ -3229,7 +3229,7 @@ static int read_audio_mux_element(struct LATMContext *latmctx, - } else if (!latmctx->aac_ctx.avctx->extradata) { - av_log(latmctx->aac_ctx.avctx, AV_LOG_DEBUG, - "no decoder config found\n"); -- return AVERROR(EAGAIN); -+ return 1; - } - if (latmctx->audio_mux_version_A == 0) { - int mux_slot_length_bytes = read_payload_length_info(latmctx, gb); -@@ -3266,8 +3266,8 @@ static int latm_decode_frame(AVCodecContext *avctx, void *out, - if (muxlength > avpkt->size) - return AVERROR_INVALIDDATA; - -- if ((err = read_audio_mux_element(latmctx, &gb)) < 0) -- return err; -+ if ((err = read_audio_mux_element(latmctx, &gb))) -+ return (err < 0) ? err : avpkt->size; - - if (!latmctx->initialized) { - if (!avctx->extradata) { -diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c -index 1ff27a1..3c1528c 100644 ---- a/libavcodec/nvenc.c -+++ b/libavcodec/nvenc.c -@@ -113,12 +113,14 @@ static const struct { - { NV_ENC_ERR_OUT_OF_MEMORY, AVERROR(ENOMEM), "out of memory" }, - { NV_ENC_ERR_ENCODER_NOT_INITIALIZED, AVERROR(EINVAL), "encoder not initialized" }, - { NV_ENC_ERR_UNSUPPORTED_PARAM, AVERROR(ENOSYS), "unsupported param" }, -- { NV_ENC_ERR_LOCK_BUSY, AVERROR(EAGAIN), "lock busy" }, -+ { NV_ENC_ERR_LOCK_BUSY, AVERROR(EBUSY), "lock busy" }, - { NV_ENC_ERR_NOT_ENOUGH_BUFFER, AVERROR(ENOBUFS), "not enough buffer" }, - { NV_ENC_ERR_INVALID_VERSION, AVERROR(EINVAL), "invalid version" }, - { NV_ENC_ERR_MAP_FAILED, AVERROR(EIO), "map failed" }, -- { NV_ENC_ERR_NEED_MORE_INPUT, AVERROR(EAGAIN), "need more input" }, -- { NV_ENC_ERR_ENCODER_BUSY, AVERROR(EAGAIN), "encoder busy" }, -+ /* this is error should always be treated specially, so this "mapping" -+ * is for completeness only */ -+ { NV_ENC_ERR_NEED_MORE_INPUT, AVERROR_UNKNOWN, "need more input" }, -+ { NV_ENC_ERR_ENCODER_BUSY, AVERROR(EBUSY), "encoder busy" }, - { NV_ENC_ERR_EVENT_NOT_REGISTERD, AVERROR(EBADF), "event not registered" }, - { NV_ENC_ERR_GENERIC, AVERROR_UNKNOWN, "generic error" }, - { NV_ENC_ERR_INCOMPATIBLE_CLIENT_KEY, AVERROR(EINVAL), "incompatible client key" }, -diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c -index 9119586..45a353a 100644 ---- a/libavcodec/qsv.c -+++ b/libavcodec/qsv.c -@@ -69,15 +69,17 @@ static const struct { - { MFX_ERR_LOCK_MEMORY, AVERROR(EIO), "failed to lock the memory block" }, - { MFX_ERR_NOT_INITIALIZED, AVERROR_BUG, "not initialized" }, - { MFX_ERR_NOT_FOUND, AVERROR(ENOSYS), "specified object was not found" }, -- { MFX_ERR_MORE_DATA, AVERROR(EAGAIN), "expect more data at input" }, -- { MFX_ERR_MORE_SURFACE, AVERROR(EAGAIN), "expect more surface at output" }, -+ /* the following 3 errors should always be handled explicitly, so those "mappings" -+ * are for completeness only */ -+ { MFX_ERR_MORE_DATA, AVERROR_UNKNOWN, "expect more data at input" }, -+ { MFX_ERR_MORE_SURFACE, AVERROR_UNKNOWN, "expect more surface at output" }, -+ { MFX_ERR_MORE_BITSTREAM, AVERROR_UNKNOWN, "expect more bitstream at output" }, - { MFX_ERR_ABORTED, AVERROR_UNKNOWN, "operation aborted" }, - { MFX_ERR_DEVICE_LOST, AVERROR(EIO), "device lost" }, - { MFX_ERR_INCOMPATIBLE_VIDEO_PARAM, AVERROR(EINVAL), "incompatible video parameters" }, - { MFX_ERR_INVALID_VIDEO_PARAM, AVERROR(EINVAL), "invalid video parameters" }, - { MFX_ERR_UNDEFINED_BEHAVIOR, AVERROR_BUG, "undefined behavior" }, - { MFX_ERR_DEVICE_FAILED, AVERROR(EIO), "device failed" }, -- { MFX_ERR_MORE_BITSTREAM, AVERROR(EAGAIN), "expect more bitstream at output" }, - { MFX_ERR_INCOMPATIBLE_AUDIO_PARAM, AVERROR(EINVAL), "incompatible audio parameters" }, - { MFX_ERR_INVALID_AUDIO_PARAM, AVERROR(EINVAL), "invalid audio parameters" }, - diff --git a/contrib/ffmpeg/module.defs b/contrib/ffmpeg/module.defs index 4e87090b4..e3c72335f 100644 --- a/contrib/ffmpeg/module.defs +++ b/contrib/ffmpeg/module.defs @@ -9,9 +9,9 @@ endif $(eval $(call import.MODULE.defs,FFMPEG,ffmpeg,$(__deps__))) $(eval $(call import.CONTRIB.defs,FFMPEG)) -FFMPEG.FETCH.url = https://download.handbrake.fr/handbrake/contrib/libav-12.tar.gz -FFMPEG.FETCH.url += https://libav.org/releases/libav-12.tar.gz -FFMPEG.FETCH.sha256 = ca5cb22ba660f0bdc47817fdb9d99059a71f9eb0776c68cf8bef769a5ccc7534 +FFMPEG.FETCH.url = https://download.handbrake.fr/handbrake/contrib/libav-12.1.tar.gz +FFMPEG.FETCH.url += https://libav.org/releases/libav-12.1.tar.gz +FFMPEG.FETCH.sha256 = f08d48bfd26097402d61f831e77effd53d0838fdeccb02ea85ec3c5d2a4527e1 FFMPEG.CONFIGURE.deps = FFMPEG.CONFIGURE.host = -- cgit v1.2.3