diff options
author | Bradley Sepos <[email protected]> | 2018-05-29 04:29:21 -0400 |
---|---|---|
committer | Bradley Sepos <[email protected]> | 2018-05-29 04:29:35 -0400 |
commit | dbe412e9ce9843da83360eee8b203a04c5d545d7 (patch) | |
tree | e4086b16d2bcf7bd7d57ca7ff6a39ee7923f217d /contrib | |
parent | 74dbfebb28d9e65d2f43161bb2b3db8f94005a39 (diff) |
contrib: Remove unused Libav patches from FFmpeg.
Closes #974 and closes #1078.
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/ffmpeg/old/A04-dv-eof.patch | 37 | ||||
-rw-r--r-- | contrib/ffmpeg/old/A05-hevc10b-decode.patch | 50 | ||||
-rw-r--r-- | contrib/ffmpeg/old/A05-p10-output-support.patch | 149 | ||||
-rw-r--r-- | contrib/ffmpeg/old/A06-edit-list-offset.patch | 106 | ||||
-rw-r--r-- | contrib/ffmpeg/old/A09-mkv-block-ts-offset.patch | 12 | ||||
-rw-r--r-- | contrib/ffmpeg/old/A10-mp4-aac-roll.patch | 76 | ||||
-rw-r--r-- | contrib/ffmpeg/old/A11-elst-audio-pad.patch | 106 | ||||
-rw-r--r-- | contrib/ffmpeg/old/A12-mov-initial_padding.patch | 42 | ||||
-rw-r--r-- | contrib/ffmpeg/old/A13-mkv-fix-seek-crash.patch | 57 | ||||
-rw-r--r-- | contrib/ffmpeg/old/A14-aacenc-high-bitrate-crash.patch | 105 | ||||
-rw-r--r-- | contrib/ffmpeg/old/A17-mkv-rawvideo.patch | 25 | ||||
-rw-r--r-- | contrib/ffmpeg/old/A18-avi-broken-index.patch | 42 | ||||
-rw-r--r-- | contrib/ffmpeg/old/A19-h264-refs.patch | 35 | ||||
-rw-r--r-- | contrib/ffmpeg/old/A20-avc3-hvc1-override.patch | 49 | ||||
-rw-r--r-- | contrib/ffmpeg/old/A21-mp4-sdtp.patch | 126 | ||||
-rw-r--r-- | contrib/ffmpeg/old/P01-solaris.patch | 13 | ||||
-rw-r--r-- | contrib/ffmpeg/old/P02-darwin-pic.patch | 21 |
17 files changed, 0 insertions, 1051 deletions
diff --git a/contrib/ffmpeg/old/A04-dv-eof.patch b/contrib/ffmpeg/old/A04-dv-eof.patch deleted file mode 100644 index 7afecff35..000000000 --- a/contrib/ffmpeg/old/A04-dv-eof.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 1f5593ff0a2d9fee94fe39aa52fb8a81d7383ebb Mon Sep 17 00:00:00 2001 -From: John Stebbins <[email protected]> -Date: Wed, 11 Jan 2017 12:17:06 -0700 -Subject: [PATCH] dv: Don't return EIO upon EOF - ---- - libavformat/dv.c | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) - -diff --git a/libavformat/dv.c b/libavformat/dv.c -index d4e5180..7e52e42 100644 ---- a/libavformat/dv.c -+++ b/libavformat/dv.c -@@ -478,7 +478,7 @@ static int dv_read_header(AVFormatContext *s) - - static int dv_read_packet(AVFormatContext *s, AVPacket *pkt) - { -- int size; -+ int size, result; - RawDVContext *c = s->priv_data; - - size = avpriv_dv_get_packet(c->dv_demux, pkt); -@@ -487,7 +487,10 @@ static int dv_read_packet(AVFormatContext *s, AVPacket *pkt) - if (!c->dv_demux->sys) - return AVERROR(EIO); - size = c->dv_demux->sys->frame_size; -- if (avio_read(s->pb, c->buf, size) <= 0) -+ result = avio_read(s->pb, c->buf, size); -+ if (result == AVERROR_EOF) -+ return result; -+ if (result <= 0) - return AVERROR(EIO); - - size = avpriv_dv_produce_packet(c->dv_demux, pkt, c->buf, size); --- -2.9.3 - diff --git a/contrib/ffmpeg/old/A05-hevc10b-decode.patch b/contrib/ffmpeg/old/A05-hevc10b-decode.patch deleted file mode 100644 index 63b582641..000000000 --- a/contrib/ffmpeg/old/A05-hevc10b-decode.patch +++ /dev/null @@ -1,50 +0,0 @@ -diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c -index e19eba5..e9ad86c 100644 ---- a/libavcodec/qsvdec.c -+++ b/libavcodec/qsvdec.c -@@ -416,6 +416,7 @@ int ff_qsv_process_data(AVCodecContext *avctx, QSVContext *q, - uint8_t *dummy_data; - int dummy_size; - int ret; -+ const AVPixFmtDescriptor *desc; - - if (!q->avctx_internal) { - q->avctx_internal = avcodec_alloc_context3(NULL); -@@ -452,8 +453,8 @@ int ff_qsv_process_data(AVCodecContext *avctx, QSVContext *q, - - /* TODO: flush delayed frames on reinit */ - if (q->parser->format != q->orig_pix_fmt || -- q->parser->coded_width != avctx->coded_width || -- q->parser->coded_height != avctx->coded_height) { -+ FFALIGN(q->parser->coded_width, 16) != FFALIGN(avctx->coded_width, 16) || -+ FFALIGN(q->parser->coded_height, 16) != FFALIGN(avctx->coded_height, 16)) { - enum AVPixelFormat pix_fmts[3] = { AV_PIX_FMT_QSV, - AV_PIX_FMT_NONE, - AV_PIX_FMT_NONE }; -@@ -472,8 +473,8 @@ int ff_qsv_process_data(AVCodecContext *avctx, QSVContext *q, - avctx->pix_fmt = pix_fmts[1] = qsv_format; - avctx->width = q->parser->width; - avctx->height = q->parser->height; -- avctx->coded_width = q->parser->coded_width; -- avctx->coded_height = q->parser->coded_height; -+ avctx->coded_width = FFALIGN(q->parser->coded_width, 16); -+ avctx->coded_height = FFALIGN(q->parser->coded_height, 16); - avctx->level = q->avctx_internal->level; - avctx->profile = q->avctx_internal->profile; - -@@ -483,6 +484,15 @@ int ff_qsv_process_data(AVCodecContext *avctx, QSVContext *q, - - avctx->pix_fmt = ret; - -+ desc = av_pix_fmt_desc_get(avctx->pix_fmt); -+ if (!desc) -+ goto reinit_fail; -+ -+ if (desc->comp[0].depth > 8) { -+ avctx->coded_width = FFALIGN(q->parser->coded_width, 32); -+ avctx->coded_height = FFALIGN(q->parser->coded_height, 32); -+ } -+ - ret = qsv_decode_init(avctx, q); - if (ret < 0) - goto reinit_fail; diff --git a/contrib/ffmpeg/old/A05-p10-output-support.patch b/contrib/ffmpeg/old/A05-p10-output-support.patch deleted file mode 100644 index d6f95508a..000000000 --- a/contrib/ffmpeg/old/A05-p10-output-support.patch +++ /dev/null @@ -1,149 +0,0 @@ -diff -Naur ../libav-12.org/libswscale/output.c ./libswscale/output.c ---- ../libav-12.org/libswscale/output.c 2016-10-16 23:10:02.000000000 +0200 -+++ ./libswscale/output.c 2017-02-07 23:37:28.150180400 +0100 -@@ -295,6 +295,98 @@ - } - } - -+ -+#define output_pixel(pos, val) \ -+ if (big_endian) { \ -+ AV_WB16(pos, av_clip_uintp2(val >> shift, 10) << 6); \ -+ } else { \ -+ AV_WL16(pos, av_clip_uintp2(val >> shift, 10) << 6); \ -+ } -+ -+static void yuv2p010l1_c(const int16_t *src, -+ uint16_t *dest, int dstW, -+ int big_endian) -+{ -+ int i; -+ int shift = 5; -+ -+ for (i = 0; i < dstW; i++) { -+ int val = src[i] + (1 << (shift - 1)); -+ output_pixel(&dest[i], val); -+ } -+} -+ -+static void yuv2p010lX_c(const int16_t *filter, int filterSize, -+ const int16_t **src, uint16_t *dest, int dstW, -+ int big_endian) -+{ -+ int i, j; -+ int shift = 17; -+ -+ for (i = 0; i < dstW; i++) { -+ int val = 1 << (shift - 1); -+ -+ for (j = 0; j < filterSize; j++) -+ val += src[j][i] * filter[j]; -+ -+ output_pixel(&dest[i], val); -+ } -+} -+ -+static void yuv2p010cX_c(SwsContext *c, const int16_t *chrFilter, int chrFilterSize, -+ const int16_t **chrUSrc, const int16_t **chrVSrc, -+ uint8_t *dest8, int chrDstW) -+{ -+ uint16_t *dest = (uint16_t*)dest8; -+ int shift = 17; -+ int big_endian = c->dstFormat == AV_PIX_FMT_P010BE; -+ int i, j; -+ -+ for (i = 0; i < chrDstW; i++) { -+ int u = 1 << (shift - 1); -+ int v = 1 << (shift - 1); -+ -+ for (j = 0; j < chrFilterSize; j++) { -+ u += chrUSrc[j][i] * chrFilter[j]; -+ v += chrVSrc[j][i] * chrFilter[j]; -+ } -+ -+ output_pixel(&dest[2*i] , u); -+ output_pixel(&dest[2*i+1], v); -+ } -+} -+ -+static void yuv2p010l1_LE_c(const int16_t *src, -+ uint8_t *dest, int dstW, -+ const uint8_t *dither, int offset) -+{ -+ yuv2p010l1_c(src, (uint16_t*)dest, dstW, 0); -+} -+ -+static void yuv2p010l1_BE_c(const int16_t *src, -+ uint8_t *dest, int dstW, -+ const uint8_t *dither, int offset) -+{ -+ yuv2p010l1_c(src, (uint16_t*)dest, dstW, 1); -+} -+ -+static void yuv2p010lX_LE_c(const int16_t *filter, int filterSize, -+ const int16_t **src, uint8_t *dest, int dstW, -+ const uint8_t *dither, int offset) -+{ -+ yuv2p010lX_c(filter, filterSize, src, (uint16_t*)dest, dstW, 0); -+} -+ -+static void yuv2p010lX_BE_c(const int16_t *filter, int filterSize, -+ const int16_t **src, uint8_t *dest, int dstW, -+ const uint8_t *dither, int offset) -+{ -+ yuv2p010lX_c(filter, filterSize, src, (uint16_t*)dest, dstW, 1); -+} -+ -+#undef output_pixel -+ -+ - #define accumulate_bit(acc, val) \ - acc <<= 1; \ - acc |= (val) >= (128 + 110) -@@ -1361,7 +1453,11 @@ - enum AVPixelFormat dstFormat = c->dstFormat; - const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(dstFormat); - -- if (is16BPS(dstFormat)) { -+ if (dstFormat == AV_PIX_FMT_P010LE || dstFormat == AV_PIX_FMT_P010BE) { -+ *yuv2plane1 = isBE(dstFormat) ? yuv2p010l1_BE_c : yuv2p010l1_LE_c; -+ *yuv2planeX = isBE(dstFormat) ? yuv2p010lX_BE_c : yuv2p010lX_LE_c; -+ *yuv2nv12cX = yuv2p010cX_c; -+ } else if (is16BPS(dstFormat)) { - *yuv2planeX = isBE(dstFormat) ? yuv2planeX_16BE_c : yuv2planeX_16LE_c; - *yuv2plane1 = isBE(dstFormat) ? yuv2plane1_16BE_c : yuv2plane1_16LE_c; - } else if (is9_OR_10BPS(dstFormat)) { -diff -Naur ../libav-12.org/libswscale/utils.c ./libswscale/utils.c ---- ../libav-12.org/libswscale/utils.c 2016-10-16 23:10:02.000000000 +0200 -+++ ./libswscale/utils.c 2017-02-07 23:20:09.617945500 +0100 -@@ -185,8 +185,8 @@ - [AV_PIX_FMT_GBRAP16BE] = { 1, 0 }, - [AV_PIX_FMT_XYZ12BE] = { 0, 0, 1 }, - [AV_PIX_FMT_XYZ12LE] = { 0, 0, 1 }, -- [AV_PIX_FMT_P010LE] = { 1, 0 }, -- [AV_PIX_FMT_P010BE] = { 1, 0 }, -+ [AV_PIX_FMT_P010LE] = { 1, 1 }, -+ [AV_PIX_FMT_P010BE] = { 1, 1 }, - }; - - int sws_isSupportedInput(enum AVPixelFormat pix_fmt) -diff -Naur ../libav-12.org/libswscale/x86/swscale.c ./libswscale/x86/swscale.c ---- ../libav-12.org/libswscale/x86/swscale.c 2016-10-16 23:10:02.000000000 +0200 -+++ ./libswscale/x86/swscale.c 2017-02-07 23:15:14.000000000 +0100 -@@ -338,14 +338,14 @@ - #define ASSIGN_VSCALEX_FUNC(vscalefn, opt, do_16_case, condition_8bit) \ - switch(c->dstBpc){ \ - case 16: do_16_case; break; \ -- case 10: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2planeX_10_ ## opt; break; \ -+ case 10: if (!isBE(c->dstFormat) && c->dstFormat != AV_PIX_FMT_P010LE) vscalefn = ff_yuv2planeX_10_ ## opt; break; \ - case 9: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2planeX_9_ ## opt; break; \ - default: if (condition_8bit) vscalefn = ff_yuv2planeX_8_ ## opt; break; \ - } - #define ASSIGN_VSCALE_FUNC(vscalefn, opt1, opt2, opt2chk) \ - switch(c->dstBpc){ \ - case 16: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2plane1_16_ ## opt1; break; \ -- case 10: if (!isBE(c->dstFormat) && opt2chk) vscalefn = ff_yuv2plane1_10_ ## opt2; break; \ -+ case 10: if (!isBE(c->dstFormat) && c->dstFormat != AV_PIX_FMT_P010LE && opt2chk) vscalefn = ff_yuv2plane1_10_ ## opt2; break; \ - case 9: if (!isBE(c->dstFormat) && opt2chk) vscalefn = ff_yuv2plane1_9_ ## opt2; break; \ - default: vscalefn = ff_yuv2plane1_8_ ## opt1; break; \ - } diff --git a/contrib/ffmpeg/old/A06-edit-list-offset.patch b/contrib/ffmpeg/old/A06-edit-list-offset.patch deleted file mode 100644 index c6921622e..000000000 --- a/contrib/ffmpeg/old/A06-edit-list-offset.patch +++ /dev/null @@ -1,106 +0,0 @@ -From eeb38d760d0748b14c4faed1bfd04efad9ed0806 Mon Sep 17 00:00:00 2001 -From: John Stebbins <[email protected]> -Date: Sun, 19 Feb 2017 14:45:44 -0700 -Subject: [PATCH] mov: fix edit list issue that can cause A/V desync - -Only the first entry in the edit list was factored into the time_offset -of the first sample in a track. But when there is a delay (empty edit -entry) the mediatime from the second entry must also be factored into -the time_offset. ---- - libavformat/isom.h | 2 ++ - libavformat/mov.c | 30 ++++++++++++++++++++++-------- - 2 files changed, 24 insertions(+), 8 deletions(-) - -diff --git a/libavformat/isom.h b/libavformat/isom.h -index 8cc5ab7..7c345e9 100644 ---- a/libavformat/isom.h -+++ b/libavformat/isom.h -@@ -125,6 +125,8 @@ typedef struct MOVStreamContext { - int *keyframes; - int time_scale; - int64_t time_offset; ///< time offset of the first edit list entry -+ int64_t time_offset_delay; -+ int64_t time_offset_skip; - int current_sample; - unsigned int bytes_per_frame; - unsigned int samples_per_frame; -diff --git a/libavformat/mov.c b/libavformat/mov.c -index 5c9f85c..1657647 100644 ---- a/libavformat/mov.c -+++ b/libavformat/mov.c -@@ -2323,10 +2323,10 @@ static void mov_build_index(MOVContext *mov, AVStream *st) - uint64_t stream_size = 0; - - /* adjust first dts according to edit list */ -- if (sc->time_offset && mov->time_scale > 0) { -- if (sc->time_offset < 0) -- sc->time_offset = av_rescale(sc->time_offset, sc->time_scale, mov->time_scale); -- current_dts = -sc->time_offset; -+ if (mov->time_scale > 0) { -+ sc->time_offset = av_rescale(sc->time_offset_delay, sc->time_scale, -+ mov->time_scale) - sc->time_offset_skip; -+ current_dts = sc->time_offset; - } - - /* only use old uncompressed audio chunk demuxing when stts specifies it */ -@@ -2999,6 +2999,10 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom) - sc = st->priv_data; - if (sc->pseudo_stream_id+1 != frag->stsd_id) - return 0; -+ if (c->time_scale > 0) { -+ sc->time_offset = av_rescale(sc->time_offset_delay, sc->time_scale, -+ c->time_scale) - sc->time_offset_skip; -+ } - avio_r8(pb); /* version */ - flags = avio_rb24(pb); - entries = avio_rb32(pb); -@@ -3029,7 +3033,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom) - } - if (flags & MOV_TRUN_DATA_OFFSET) data_offset = avio_rb32(pb); - if (flags & MOV_TRUN_FIRST_SAMPLE_FLAGS) first_sample_flags = avio_rb32(pb); -- dts = sc->track_end - sc->time_offset; -+ dts = sc->track_end + sc->time_offset; - offset = frag->base_data_offset + data_offset; - distance = 0; - av_log(c->fc, AV_LOG_TRACE, "first sample flags 0x%x\n", first_sample_flags); -@@ -3069,7 +3073,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom) - return AVERROR_EOF; - - frag->implicit_offset = offset; -- st->duration = sc->track_end = dts + sc->time_offset; -+ st->duration = sc->track_end = dts - sc->time_offset; - return 0; - } - -@@ -3152,6 +3156,7 @@ static int mov_read_elst(MOVContext *c, AVIOContext *pb, MOVAtom atom) - { - MOVStreamContext *sc; - int i, edit_count, version; -+ int time_offset_done = 0; - - if (c->fc->nb_streams < 1) - return 0; -@@ -3175,8 +3180,17 @@ static int mov_read_elst(MOVContext *c, AVIOContext *pb, MOVAtom atom) - time = (int32_t)avio_rb32(pb); /* media time */ - } - avio_rb32(pb); /* Media rate */ -- if (i == 0 && time >= -1) { -- sc->time_offset = time != -1 ? time : -duration; -+ if (!time_offset_done) { -+ if (time == -1) { -+ /* delay is in movie timescale */ -+ sc->time_offset_delay += duration; -+ } else if (time >= 0) { -+ /* samples to skip is in track timescale */ -+ sc->time_offset_skip = time; -+ time_offset_done = 1; -+ } -+ /* timescales may not be known yet, so we can not compute -+ * a single combined time_offset yet */ - } - } - --- -2.9.3 - diff --git a/contrib/ffmpeg/old/A09-mkv-block-ts-offset.patch b/contrib/ffmpeg/old/A09-mkv-block-ts-offset.patch deleted file mode 100644 index fdf883439..000000000 --- a/contrib/ffmpeg/old/A09-mkv-block-ts-offset.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c -index e951a0f..2fe6e0e 100644 ---- a/libavformat/matroskaenc.c -+++ b/libavformat/matroskaenc.c -@@ -1461,6 +1461,7 @@ static void mkv_write_block(AVFormatContext *s, AVIOContext *pb, - uint8_t *data = NULL; - int offset = 0, size = pkt->size; - int64_t ts = mkv->tracks[pkt->stream_index].write_dts ? pkt->dts : pkt->pts; -+ ts += mkv->tracks[pkt->stream_index].ts_offset; - - av_log(s, AV_LOG_DEBUG, "Writing block at offset %" PRIu64 ", size %d, " - "pts %" PRId64 ", dts %" PRId64 ", duration %" PRId64 ", flags %d\n", diff --git a/contrib/ffmpeg/old/A10-mp4-aac-roll.patch b/contrib/ffmpeg/old/A10-mp4-aac-roll.patch deleted file mode 100644 index 66fb59e00..000000000 --- a/contrib/ffmpeg/old/A10-mp4-aac-roll.patch +++ /dev/null @@ -1,76 +0,0 @@ -diff --git a/libavformat/movenc.c b/libavformat/movenc.c -index 840190d..92d923e 100644 ---- a/libavformat/movenc.c -+++ b/libavformat/movenc.c -@@ -136,6 +136,54 @@ static int mov_write_stco_tag(AVIOContext *pb, MOVTrack *track) - return update_size(pb, pos); - } - -+static int mov_write_sgpd_tag(AVIOContext *pb, int16_t roll) -+{ -+ int64_t pos = avio_tell(pb); -+ avio_wb32(pb, 0); /* size */ -+ -+ ffio_wfourcc(pb, "sgpd"); -+ avio_w8(pb, 1); /* version */ -+ avio_w8(pb, 0); /* flags (1) */ -+ avio_wb16(pb, 0); /* flags (2) */ -+ ffio_wfourcc(pb, "roll"); /* grouping type */ -+ avio_wb32(pb, 2); /* table entry length */ -+ avio_wb32(pb, 1); /* table entry count */ -+ -+ /* table data, roll distance -+ * i.e. number of audio frames to pre-roll after a seek */ -+ avio_wb16(pb, roll); -+ -+ return update_size(pb, pos); -+} -+ -+static int mov_write_sbgp_tag(AVIOContext *pb, MOVTrack *track) -+{ -+ int count = 0; -+ int i; -+ int64_t pos; -+ -+ for (i = 0; i < track->entry; i++) -+ { -+ count += track->cluster[i].entries; -+ } -+ -+ pos = avio_tell(pb); -+ avio_wb32(pb, 0); /* size */ -+ -+ ffio_wfourcc(pb, "sbgp"); /* atom name */ -+ avio_wb32(pb, 0); /* version & flags */ -+ ffio_wfourcc(pb, "roll"); /* grouping type */ -+ avio_wb32(pb, 1); /* table entry count */ -+ -+ /* table data */ -+ avio_wb32(pb, count); -+ /* sgpd table index, index values are 1 based -+ * we write 'roll' sample group at index 1 */ -+ avio_wb32(pb, 1); -+ -+ return update_size(pb, pos); -+} -+ - /* Sample size atom */ - static int mov_write_stsz_tag(AVIOContext *pb, MOVTrack *track) - { -@@ -1277,6 +1325,16 @@ static int mov_write_stbl_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *tra - mov_write_stsc_tag(pb, track); - mov_write_stsz_tag(pb, track); - mov_write_stco_tag(pb, track); -+ -+ /* Add sgpd and sbgp tags for AAC tracks -+ * Apple documentation says they use this as a flag to indicate -+ * that AAC encoder delay is explicitely set in the edit list */ -+ if (track->par->codec_id == AV_CODEC_ID_AAC) -+ { -+ mov_write_sgpd_tag(pb, -1); -+ mov_write_sbgp_tag(pb, track); -+ } -+ - return update_size(pb, pos); - } - diff --git a/contrib/ffmpeg/old/A11-elst-audio-pad.patch b/contrib/ffmpeg/old/A11-elst-audio-pad.patch deleted file mode 100644 index bc044b19c..000000000 --- a/contrib/ffmpeg/old/A11-elst-audio-pad.patch +++ /dev/null @@ -1,106 +0,0 @@ -From c6f8a1affd650c917576b4019a9003717cb4ff22 Mon Sep 17 00:00:00 2001 -From: John Stebbins <[email protected]> -Date: Sun, 19 Feb 2017 14:02:24 -0700 -Subject: [PATCH] movenc: factor initial_padding into edit lists - -initial_padding was getting added to the edit list indirectly due to -initial negative dts. But in cases where the audio is delayed, -all or part of initial_padding would be unaccounted for. This patch -makes initial_padding explicit. ---- - libavformat/movenc.c | 58 +++++++++++++++++++++++++++++++++++++--------------- - 1 file changed, 42 insertions(+), 16 deletions(-) - -diff --git a/libavformat/movenc.c b/libavformat/movenc.c -index 689291d..b9e4f6e 100644 ---- a/libavformat/movenc.c -+++ b/libavformat/movenc.c -@@ -1698,9 +1698,31 @@ static int mov_write_edts_tag(AVIOContext *pb, MOVMuxContext *mov, - track->timescale, AV_ROUND_UP); - int version = duration < INT32_MAX ? 0 : 1; - int entry_size, entry_count, size; -- int64_t delay, start_ct = track->start_cts; -- delay = av_rescale_rnd(track->start_dts + start_ct, MOV_TIMESCALE, -- track->timescale, AV_ROUND_DOWN); -+ int64_t delay; -+ int64_t mediatime; -+ int64_t skip = 0; -+ -+ delay = track->start_dts + track->start_cts; -+ -+ if (track->par->codec_type == AVMEDIA_TYPE_AUDIO && -+ track->par->initial_padding > 0) { -+ /* Adjust delay so that initial_padding gets recorded in the -+ * MediaTime of an edit list entry even in the case that -+ * delay is positive. I.e. we don't want initial_padding to be -+ * absorbed and hidden in the delay. MediaTime must contain -+ * initial_padding in order to know where the actual media -+ * timeline begins. A player should drop samples until MediaTime -+ * is reached */ -+ delay += av_rescale_rnd(track->par->initial_padding, track->timescale, -+ track->par->sample_rate, AV_ROUND_UP); -+ skip = av_rescale_rnd(track->par->initial_padding, -+ track->timescale, -+ track->par->sample_rate, AV_ROUND_DOWN); -+ } -+ /* rescale delay, this was not done earlier to minimize rounding errors */ -+ delay = av_rescale_rnd(delay, MOV_TIMESCALE, -+ track->timescale, AV_ROUND_NEAR_INF); -+ - version |= delay < INT32_MAX ? 0 : 1; - - entry_size = (version == 1) ? 20 : 12; -@@ -1731,33 +1753,37 @@ static int mov_write_edts_tag(AVIOContext *pb, MOVMuxContext *mov, - } - avio_wb32(pb, 0x00010000); - } else { -- /* Avoid accidentally ending up with start_ct = -1 which has got a -- * special meaning. Normally start_ct should end up positive or zero -- * here, but use FFMIN in case dts is a a small positive integer -- * rounded to 0 when represented in MOV_TIMESCALE units. */ -- start_ct = -FFMIN(track->start_dts, 0); -- /* Note, this delay is calculated from the pts of the first sample, -- * ensuring that we don't reduce the duration for cases with -- * dts<0 pts=0. */ -- duration += delay; -+ /* Avoid accidentally ending up with mediatime = -1 which has got a -+ * special meaning. skip and -track->start_dts are guaranteed to be -+ * positive here, so it is not possible mediatime to be -1 */ -+ skip = FFMAX(skip, -track->start_dts - track->start_cts); - } -+ mediatime = skip + track->start_cts; -+ -+ /* skip is the duration of the media segment that will be dropped -+ * during playback when an edit entry is applied. The edit entry -+ * duration must be reduced by this amount. */ -+ duration -= av_rescale_rnd(skip, MOV_TIMESCALE, -+ track->timescale, AV_ROUND_UP); - - /* For fragmented files, we don't know the full length yet. Setting - * duration to 0 allows us to only specify the offset, including - * the rest of the content (from all future fragments) without specifying - * an explicit duration. */ -- if (mov->flags & FF_MOV_FLAG_FRAGMENT) -+ if (mov->flags & FF_MOV_FLAG_FRAGMENT || duration < 0) - duration = 0; - -- /* duration */ -+ /* add edit entry that defines the presentation time of the first -+ * sample to render during playback and the duration of the segment */ - if (version == 1) { - avio_wb64(pb, duration); -- avio_wb64(pb, start_ct); -+ avio_wb64(pb, mediatime); - } else { - avio_wb32(pb, duration); -- avio_wb32(pb, start_ct); -+ avio_wb32(pb, mediatime); - } - avio_wb32(pb, 0x00010000); -+ - return size; - } - --- -2.9.3 - diff --git a/contrib/ffmpeg/old/A12-mov-initial_padding.patch b/contrib/ffmpeg/old/A12-mov-initial_padding.patch deleted file mode 100644 index 61ca81907..000000000 --- a/contrib/ffmpeg/old/A12-mov-initial_padding.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 70deb2f2c99677e91b8a404882d9bb0db1791efa Mon Sep 17 00:00:00 2001 -From: John Stebbins <[email protected]> -Date: Tue, 21 Feb 2017 10:46:02 -0700 -Subject: [PATCH] mov: extract audio initial_padding from edit list - ---- - libavformat/mov.c | 13 ++++++++++++- - 1 file changed, 12 insertions(+), 1 deletion(-) - -diff --git a/libavformat/mov.c b/libavformat/mov.c -index 1657647..a080216 100644 ---- a/libavformat/mov.c -+++ b/libavformat/mov.c -@@ -3806,13 +3806,24 @@ static int mov_read_header(AVFormatContext *s) - MOVStreamContext *sc = st->priv_data; - - switch (st->codecpar->codec_type) { -- case AVMEDIA_TYPE_AUDIO: -+ case AVMEDIA_TYPE_AUDIO: { -+ int64_t skip_samples; - err = ff_replaygain_export(st, s->metadata); - if (err < 0) { - mov_read_close(s); - return err; - } -+ skip_samples = av_rescale(sc->time_offset_skip, -+ st->codecpar->sample_rate, -+ sc->time_scale); -+ /* If the number of skipped samples specified in the edit list -+ * is in a range that looks like an initial_padding, set -+ * initial_padding to tell decoders to drop the samples */ -+ if (skip_samples > 0 && skip_samples <= 3840) { -+ st->codecpar->initial_padding = skip_samples; -+ } - break; -+ } - case AVMEDIA_TYPE_VIDEO: - if (sc->display_matrix) { - err = av_stream_add_side_data(st, AV_PKT_DATA_DISPLAYMATRIX, --- -2.9.3 - diff --git a/contrib/ffmpeg/old/A13-mkv-fix-seek-crash.patch b/contrib/ffmpeg/old/A13-mkv-fix-seek-crash.patch deleted file mode 100644 index 3563855b1..000000000 --- a/contrib/ffmpeg/old/A13-mkv-fix-seek-crash.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 4b73e7f3606fe0a33c258c802998b4e24ae24fb0 Mon Sep 17 00:00:00 2001 -From: John Stebbins <[email protected]> -Date: Tue, 21 Feb 2017 15:14:51 -0700 -Subject: [PATCH] matroskadec: remove broken subtitle seek code - -It looks up an index on one stream, and then uses that index on a -different stream. If nb_index_entries is different on the streams, -kaboom! ---- - libavformat/matroskadec.c | 16 ++-------------- - 1 file changed, 2 insertions(+), 14 deletions(-) - -diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c -index 4e121b6..d88088a 100644 ---- a/libavformat/matroskadec.c -+++ b/libavformat/matroskadec.c -@@ -2693,7 +2693,7 @@ static int matroska_read_seek(AVFormatContext *s, int stream_index, - MatroskaDemuxContext *matroska = s->priv_data; - MatroskaTrack *tracks = NULL; - AVStream *st = s->streams[stream_index]; -- int i, index, index_sub, index_min; -+ int i, index; - - /* Parse the CUES now since we need the index data to seek. */ - if (matroska->cues_parsing_deferred) { -@@ -2720,27 +2720,15 @@ static int matroska_read_seek(AVFormatContext *s, int stream_index, - if (index < 0) - return 0; - -- index_min = index; - tracks = matroska->tracks.elem; - 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( -- tracks[i].stream, st->index_entries[index].timestamp, -- AVSEEK_FLAG_BACKWARD); -- if (index_sub >= 0 && -- st->index_entries[index_sub].pos < st->index_entries[index_min].pos && -- st->index_entries[index].timestamp - -- st->index_entries[index_sub].timestamp < 30000000000 / matroska->time_scale) -- index_min = index_sub; -- } - } - -- avio_seek(s->pb, st->index_entries[index_min].pos, SEEK_SET); -+ avio_seek(s->pb, st->index_entries[index].pos, SEEK_SET); - matroska->current_id = 0; - matroska->skip_to_keyframe = !(flags & AVSEEK_FLAG_ANY); - matroska->skip_to_timecode = st->index_entries[index].timestamp; --- -2.9.3 - diff --git a/contrib/ffmpeg/old/A14-aacenc-high-bitrate-crash.patch b/contrib/ffmpeg/old/A14-aacenc-high-bitrate-crash.patch deleted file mode 100644 index 1eb260dae..000000000 --- a/contrib/ffmpeg/old/A14-aacenc-high-bitrate-crash.patch +++ /dev/null @@ -1,105 +0,0 @@ -From 923c5a378ed4a11817a16a7c1ed3011d7ff72ec8 Mon Sep 17 00:00:00 2001 -From: John Stebbins <[email protected]> -Date: Sun, 26 Feb 2017 09:58:14 -0700 -Subject: [PATCH] put_bits: bounds check buffer - -This prevents invalid writes outside put_bits' buffer. - -It also has the side effect of allowing measurement of the required -size of a buffer without the need to pre-allocate an over-sized buffer. - -This fixes a crash in aacenc.c where it could write past the end of the -allocated packet, which is allocated to be the max size allowed by the -aac spec. aacenc.c uses the above feature to check the size -of encoded data and try again when the size is too large. ---- - libavcodec/aacenc.c | 2 +- - libavcodec/put_bits.h | 25 ++++++++++++++++++++----- - 2 files changed, 21 insertions(+), 6 deletions(-) - -diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c -index 9b0e99b..a83b2a8 100644 ---- a/libavcodec/aacenc.c -+++ b/libavcodec/aacenc.c -@@ -638,7 +638,7 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, - start_ch += chans; - } - -- frame_bits = put_bits_count(&s->pb); -+ frame_bits = put_bits_attempted(&s->pb); - if (frame_bits <= 6144 * s->channels - 3) { - s->psy.bitres.bits = frame_bits / s->channels; - break; -diff --git a/libavcodec/put_bits.h b/libavcodec/put_bits.h -index 17666fa..677fecd 100644 ---- a/libavcodec/put_bits.h -+++ b/libavcodec/put_bits.h -@@ -30,6 +30,7 @@ - #include <stddef.h> - #include <assert.h> - -+#include "libavutil/common.h" - #include "libavutil/intreadwrite.h" - - typedef struct PutBitContext { -@@ -62,11 +63,19 @@ static inline void init_put_bits(PutBitContext *s, uint8_t *buffer, - } - - /** -+ * @return the total number of bits attempted to be written to the bitstream. -+ */ -+static inline int put_bits_attempted(PutBitContext *s) -+{ -+ return (s->buf_ptr - s->buf) * 8 + 32 - s->bit_left; -+} -+ -+/** - * @return the total number of bits written to the bitstream. - */ - static inline int put_bits_count(PutBitContext *s) - { -- return (s->buf_ptr - s->buf) * 8 + 32 - s->bit_left; -+ return FFMIN(s->size_in_bits, put_bits_attempted(s)); - } - - /** -@@ -89,10 +98,14 @@ static inline void flush_put_bits(PutBitContext *s) - while (s->bit_left < 32) { - /* XXX: should test end of buffer */ - #ifdef BITSTREAM_WRITER_LE -- *s->buf_ptr++ = s->bit_buf; -+ if (s->buf_ptr < s->buf_end) -+ *s->buf_ptr = s->bit_buf; -+ s->buf_ptr++; - s->bit_buf >>= 8; - #else -- *s->buf_ptr++ = s->bit_buf >> 24; -+ if (s->buf_ptr < s->buf_end) -+ *s->buf_ptr = s->bit_buf >> 24; -+ s->buf_ptr++; - s->bit_buf <<= 8; - #endif - s->bit_left += 8; -@@ -145,7 +158,8 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value) - #ifdef BITSTREAM_WRITER_LE - bit_buf |= value << (32 - bit_left); - if (n >= bit_left) { -- AV_WL32(s->buf_ptr, bit_buf); -+ if (s->buf_ptr < s->buf_end) -+ AV_WL32(s->buf_ptr, bit_buf); - s->buf_ptr += 4; - bit_buf = (bit_left == 32) ? 0 : value >> bit_left; - bit_left += 32; -@@ -158,7 +172,8 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value) - } else { - bit_buf <<= bit_left; - bit_buf |= value >> (n - bit_left); -- AV_WB32(s->buf_ptr, bit_buf); -+ if (s->buf_ptr < s->buf_end) -+ AV_WB32(s->buf_ptr, bit_buf); - s->buf_ptr += 4; - bit_left += 32 - n; - bit_buf = value; --- -2.9.3 - diff --git a/contrib/ffmpeg/old/A17-mkv-rawvideo.patch b/contrib/ffmpeg/old/A17-mkv-rawvideo.patch deleted file mode 100644 index 77430fe09..000000000 --- a/contrib/ffmpeg/old/A17-mkv-rawvideo.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 2469f85d5b6d981f891e697dec82e87f169347ba Mon Sep 17 00:00:00 2001 -From: John Stebbins <[email protected]> -Date: Wed, 1 Mar 2017 07:57:44 -0700 -Subject: [PATCH] matroskadec: fix endianness fourcc and codec_tag - -This fixes decode of rawvideo in matroska. ---- - libavformat/matroskadec.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c -index 4e121b6..75cfa85 100644 ---- a/libavformat/matroskadec.c -+++ b/libavformat/matroskadec.c -@@ -1612,6 +1612,7 @@ static int matroska_parse_tracks(AVFormatContext *s) - track->video.display_width = track->video.pixel_width; - if (!track->video.display_height) - track->video.display_height = track->video.pixel_height; -+ track->video.fourcc = av_bswap32(track->video.fourcc); - } else if (track->type == MATROSKA_TRACK_TYPE_AUDIO) { - if (!track->audio.out_samplerate) - track->audio.out_samplerate = track->audio.samplerate; --- -2.9.3 - diff --git a/contrib/ffmpeg/old/A18-avi-broken-index.patch b/contrib/ffmpeg/old/A18-avi-broken-index.patch deleted file mode 100644 index 281a0b6cc..000000000 --- a/contrib/ffmpeg/old/A18-avi-broken-index.patch +++ /dev/null @@ -1,42 +0,0 @@ -From c03b7f91b1ae407cb777ff4d18a8513c0030bf57 Mon Sep 17 00:00:00 2001 -From: John Stebbins <[email protected]> -Date: Mon, 27 Feb 2017 11:53:11 -0700 -Subject: [PATCH] avidec: handle broken AVI index better - -A broken index that causes non-interleaved access and has a packet size -of 0 causes an infinite loop reading 0 bytes. Switch to assuming file -is interleaved if a broken index is detected. ---- - libavformat/avidec.c | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) - -diff --git a/libavformat/avidec.c b/libavformat/avidec.c -index 870066e..a44ad87 100644 ---- a/libavformat/avidec.c -+++ b/libavformat/avidec.c -@@ -1146,7 +1146,6 @@ static int ni_prepare_read(AVFormatContext *s) - if (i >= 0) { - int64_t pos = best_st->index_entries[i].pos; - pos += best_ast->packet_size - best_ast->remaining; -- avio_seek(s->pb, pos + 8, SEEK_SET); - - assert(best_ast->remaining <= best_ast->packet_size); - -@@ -1154,6 +1153,14 @@ static int ni_prepare_read(AVFormatContext *s) - if (!best_ast->remaining) - best_ast->packet_size = - best_ast->remaining = best_st->index_entries[i].size; -+ if (!best_ast->remaining) { -+ /* broken index, assume the rest is non-interleaved */ -+ av_log(s, AV_LOG_ERROR, "Broken AVI index.\n"); -+ avi->stream_index = -1; -+ avi->non_interleaved = 0; -+ } else { -+ avio_seek(s->pb, pos + 8, SEEK_SET); -+ } - } - - return 0; --- -2.9.3 - diff --git a/contrib/ffmpeg/old/A19-h264-refs.patch b/contrib/ffmpeg/old/A19-h264-refs.patch deleted file mode 100644 index ad38b5825..000000000 --- a/contrib/ffmpeg/old/A19-h264-refs.patch +++ /dev/null @@ -1,35 +0,0 @@ -From dde41279a91fce7abf2687c34bb8529b66298466 Mon Sep 17 00:00:00 2001 -From: Michael Niedermayer <[email protected]> -Date: Sun, 1 May 2011 02:32:41 +0200 -Subject: [PATCH] h264_refs: Fix decode error when too many refs - -This improves upon a commit that was meant to fix intra only decoding. -The prior code caused decode errors in non-intra only. - -H264: Fix intra only decoding. -This possibly fixes issue2679 -Signed-off-by: Michael Niedermayer <[email protected]> - -(cherry picked from commit c059d7aa57391f2216808dbf2afdcb9e0a835ab5) ---- - libavcodec/h264_refs.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c -index b4dc49c..1b9ecc9 100644 ---- a/libavcodec/h264_refs.c -+++ b/libavcodec/h264_refs.c -@@ -697,8 +697,8 @@ int ff_h264_execute_ref_pic_marking(H264Context *h) - } - } - -- if (h->long_ref_count + h->short_ref_count - -- (h->short_ref[0] == h->cur_pic_ptr) > h->ps.sps->ref_frame_count) { -+ if (h->long_ref_count + h->short_ref_count > -+ FFMAX(h->ps.sps->ref_frame_count, 1)) { - - /* We have too many reference frames, probably due to corrupted - * stream. Need to discard one frame. Prevents overrun of the --- -2.9.3 - diff --git a/contrib/ffmpeg/old/A20-avc3-hvc1-override.patch b/contrib/ffmpeg/old/A20-avc3-hvc1-override.patch deleted file mode 100644 index 70d67b4a3..000000000 --- a/contrib/ffmpeg/old/A20-avc3-hvc1-override.patch +++ /dev/null @@ -1,49 +0,0 @@ -diff -ur libav-12.2.orig/libavformat/isom.c libav-12.2/libavformat/isom.c ---- libav-12.2.orig/libavformat/isom.c 2017-09-30 11:13:39.000000000 -0700 -+++ libav-12.2/libavformat/isom.c 2017-11-01 14:17:30.762856002 -0700 -@@ -152,6 +152,7 @@ - { AV_CODEC_ID_HEVC, MKTAG('h', 'v', 'c', '1') }, /* HEVC/H.265 which indicates parameter sets shall not be in ES */ - - { AV_CODEC_ID_H264, MKTAG('a', 'v', 'c', '1') }, /* AVC-1/H.264 */ -+ { AV_CODEC_ID_H264, MKTAG('a', 'v', 'c', '3') }, /* AVC-1/H.264 */ - { AV_CODEC_ID_H264, MKTAG('a', 'i', '5', 'p') }, /* AVC-Intra 50M 720p24/30/60 */ - { AV_CODEC_ID_H264, MKTAG('a', 'i', '5', 'q') }, /* AVC-Intra 50M 720p25/50 */ - { AV_CODEC_ID_H264, MKTAG('a', 'i', '5', '2') }, /* AVC-Intra 50M 1080p25/50 */ -diff -ur libav-12.2.orig/libavformat/movenc.c libav-12.2/libavformat/movenc.c ---- libav-12.2.orig/libavformat/movenc.c 2017-09-30 11:13:39.000000000 -0700 -+++ libav-12.2/libavformat/movenc.c 2017-11-01 14:20:52.783487291 -0700 -@@ -724,7 +724,10 @@ - - avio_wb32(pb, 0); - ffio_wfourcc(pb, "hvcC"); -- ff_isom_write_hvcc(pb, track->vos_data, track->vos_len, 0); -+ if (track->tag == MKTAG('h','v','c','1')) -+ ff_isom_write_hvcc(pb, track->vos_data, track->vos_len, 1); -+ else -+ ff_isom_write_hvcc(pb, track->vos_data, track->vos_len, 0); - return update_size(pb, pos); - } - -@@ -783,7 +786,11 @@ - if (!ff_codec_get_tag(ff_mp4_obj_type, track->par->codec_id)) - return 0; - -- if (track->par->codec_id == AV_CODEC_ID_H264) tag = MKTAG('a','v','c','1'); -+ if (track->par->codec_id == AV_CODEC_ID_H264 && -+ tag == MKTAG('a','v','c','3')) ; -+ else if (track->par->codec_id == AV_CODEC_ID_H264) tag = MKTAG('a','v','c','1'); -+ else if (track->par->codec_id == AV_CODEC_ID_HEVC && -+ tag == MKTAG('h','v','c','1')) ; - else if (track->par->codec_id == AV_CODEC_ID_HEVC) tag = MKTAG('h','e','v','1'); - else if (track->par->codec_id == AV_CODEC_ID_AC3) tag = MKTAG('a','c','-','3'); - else if (track->par->codec_id == AV_CODEC_ID_DIRAC) tag = MKTAG('d','r','a','c'); -@@ -4476,7 +4483,7 @@ - .write_packet = mov_write_packet, - .write_trailer = mov_write_trailer, - .flags = AVFMT_GLOBALHEADER | AVFMT_ALLOW_FLUSH | AVFMT_TS_NEGATIVE, -- .codec_tag = (const AVCodecTag* const []){ ff_mp4_obj_type, 0 }, -+ .codec_tag = (const AVCodecTag* const []){ ff_codec_movvideo_tags, ff_codec_movaudio_tags, ff_codec_movsubtitle_tags, 0 }, - .priv_class = &mp4_muxer_class, - }; - #endif -Only in libav-12.2/libavformat: movenc.c.orig diff --git a/contrib/ffmpeg/old/A21-mp4-sdtp.patch b/contrib/ffmpeg/old/A21-mp4-sdtp.patch deleted file mode 100644 index 5d2221c47..000000000 --- a/contrib/ffmpeg/old/A21-mp4-sdtp.patch +++ /dev/null @@ -1,126 +0,0 @@ -From c2204c579c8411771b53a4bc66324c7c5d07698a Mon Sep 17 00:00:00 2001 -From: John Stebbins <[email protected]> -Date: Thu, 16 Nov 2017 14:40:12 -0800 -Subject: [PATCH] movenc: add sdtp (sample dependency) box to mp4 - -The AppleTV 4K requires this box in order to play 2160p60 video. ---- - libavcodec/avcodec.h | 9 +++++++-- - libavformat/movenc.c | 34 +++++++++++++++++++++++++++++++++- - libavformat/movenc.h | 6 ++++++ - 3 files changed, 46 insertions(+), 3 deletions(-) - -diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h -index 5624835023..48e9d23679 100644 ---- a/libavcodec/avcodec.h -+++ b/libavcodec/avcodec.h -@@ -1161,8 +1161,13 @@ typedef struct AVPacket { - int64_t convergence_duration; - #endif - } AVPacket; --#define AV_PKT_FLAG_KEY 0x0001 ///< The packet contains a keyframe --#define AV_PKT_FLAG_CORRUPT 0x0002 ///< The packet content is corrupted -+#define AV_PKT_FLAG_KEY 0x0001 ///< The packet contains a keyframe -+#define AV_PKT_FLAG_CORRUPT 0x0002 ///< The packet content is corrupted -+/** -+ * Flag is used to indicate packets that contain frames that can -+ * be discarded by the decoder. I.e. Non-reference frames. -+ */ -+#define AV_PKT_FLAG_DISPOSABLE 0x0004 - - enum AVSideDataParamChangeFlags { - AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT = 0x0001, -diff --git a/libavformat/movenc.c b/libavformat/movenc.c -index a546fdfead..d263f444f4 100644 ---- a/libavformat/movenc.c -+++ b/libavformat/movenc.c -@@ -227,6 +227,30 @@ static int mov_write_stss_tag(AVIOContext *pb, MOVTrack *track, uint32_t flag) - return update_size(pb, pos); - } - -+/* Sample dependency atom */ -+static int mov_write_sdtp_tag(AVIOContext *pb, MOVTrack *track) -+{ -+ int i; -+ uint8_t leading, dependent, reference, redundancy; -+ int64_t pos = avio_tell(pb); -+ avio_wb32(pb, 0); // size -+ ffio_wfourcc(pb, "sdtp"); -+ avio_wb32(pb, 0); // version & flags -+ for (i = 0; i < track->entry; i++) { -+ dependent = MOV_SAMPLE_DEPENDENCY_YES; -+ leading = reference = redundancy = MOV_SAMPLE_DEPENDENCY_UNKNOWN; -+ if (track->cluster[i].flags & MOV_DISPOSABLE_SAMPLE) { -+ reference = MOV_SAMPLE_DEPENDENCY_NO; -+ } -+ if (track->cluster[i].flags & MOV_SYNC_SAMPLE) { -+ dependent = MOV_SAMPLE_DEPENDENCY_NO; -+ } -+ avio_w8(pb, (leading << 6) | (dependent << 4) | -+ (reference << 2) | redundancy); -+ } -+ return update_size(pb, pos); -+} -+ - static int mov_write_amr_tag(AVIOContext *pb, MOVTrack *track) - { - avio_wb32(pb, 0x11); /* size */ -@@ -1211,8 +1235,12 @@ static int mov_write_stbl_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *tra - mov_write_stts_tag(pb, track); - if ((track->par->codec_type == AVMEDIA_TYPE_VIDEO || - track->par->codec_tag == MKTAG('r','t','p',' ')) && -- track->has_keyframes && track->has_keyframes < track->entry) -+ track->has_keyframes && track->has_keyframes < track->entry) { - mov_write_stss_tag(pb, track, MOV_SYNC_SAMPLE); -+ } -+ if (track->par->codec_type == AVMEDIA_TYPE_VIDEO && track->has_disposable) { -+ mov_write_sdtp_tag(pb, track); -+ } - if (track->mode == MODE_MOV && track->flags & MOV_TRACK_STPS) - mov_write_stss_tag(pb, track, MOV_PARTIAL_SYNC_SAMPLE); - if (track->par->codec_type == AVMEDIA_TYPE_VIDEO && -@@ -3647,6 +3675,10 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) - if (trk->cluster[trk->entry].flags & MOV_SYNC_SAMPLE) - trk->has_keyframes++; - } -+ if (pkt->flags & AV_PKT_FLAG_DISPOSABLE) { -+ trk->cluster[trk->entry].flags |= MOV_DISPOSABLE_SAMPLE; -+ trk->has_disposable++; -+ } - trk->entry++; - trk->sample_count += samples_in_chunk; - mov->mdat_size += size; -diff --git a/libavformat/movenc.h b/libavformat/movenc.h -index 008f4671c6..f4eb4e8078 100644 ---- a/libavformat/movenc.h -+++ b/libavformat/movenc.h -@@ -51,6 +51,7 @@ typedef struct MOVIentry { - int cts; - #define MOV_SYNC_SAMPLE 0x0001 - #define MOV_PARTIAL_SYNC_SAMPLE 0x0002 -+#define MOV_DISPOSABLE_SAMPLE 0x0004 - uint32_t flags; - } MOVIentry; - -@@ -85,6 +86,7 @@ typedef struct MOVTrack { - long sample_count; - long sample_size; - int has_keyframes; -+ int has_disposable; - #define MOV_TRACK_CTTS 0x0001 - #define MOV_TRACK_STPS 0x0002 - #define MOV_TRACK_ENABLED 0x0004 -@@ -180,6 +182,10 @@ typedef struct MOVMuxContext { - int missing_duration_warned; - } MOVMuxContext; - -+#define MOV_SAMPLE_DEPENDENCY_UNKNOWN 0x0 -+#define MOV_SAMPLE_DEPENDENCY_YES 0x1 -+#define MOV_SAMPLE_DEPENDENCY_NO 0x2 -+ - #define FF_MOV_FLAG_RTP_HINT (1 << 0) - #define FF_MOV_FLAG_FRAGMENT (1 << 1) - #define FF_MOV_FLAG_EMPTY_MOOV (1 << 2) --- -2.13.6 - diff --git a/contrib/ffmpeg/old/P01-solaris.patch b/contrib/ffmpeg/old/P01-solaris.patch deleted file mode 100644 index f51ac4171..000000000 --- a/contrib/ffmpeg/old/P01-solaris.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/configure b/configure -index 5085333..3d85303 100755 ---- a/configure -+++ b/configure -@@ -3808,7 +3808,7 @@ EOF - check_cc <<EOF || die "endian test failed" - unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E'; - EOF --od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian -+/usr/bin/tr -cd "BIGE" < $TMPO | grep -q 'B *I *G *E' && enable bigendian - - check_gas() { - log "check_gas using '$as' as AS" diff --git a/contrib/ffmpeg/old/P02-darwin-pic.patch b/contrib/ffmpeg/old/P02-darwin-pic.patch deleted file mode 100644 index 0b855a442..000000000 --- a/contrib/ffmpeg/old/P02-darwin-pic.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff --git a/configure b/configure -index 5085333..41420e7 100755 ---- a/configure -+++ b/configure -@@ -3475,6 +3475,7 @@ case $target_os in - SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)' - objformat="macho" - enabled x86_64 && objformat="macho64" -+ enabled x86_64 && enable pic - enabled_any pic shared || - { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; } - ;; -@@ -3720,7 +3721,7 @@ esc(){ - - echo "config:$arch:$subarch:$cpu:$target_os:$(esc $cc_ident):$(esc $LIBAV_CONFIGURATION)" >config.fate - --check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable_weak pic -+#check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable_weak pic - - set_default $PATHS_LIST - set_default nm |