diff options
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/ffmpeg/A00-qsv.patch | 168 | ||||
-rw-r--r-- | contrib/ffmpeg/A01-h264-recovery-point.patch | 63 | ||||
-rw-r--r-- | contrib/ffmpeg/A01-vc1-segfault.patch | 53 | ||||
-rw-r--r-- | contrib/ffmpeg/A02-dca-resync.patch | 73 | ||||
-rw-r--r-- | contrib/ffmpeg/A02-vc1-interlaced.patch | 27 | ||||
-rw-r--r-- | contrib/ffmpeg/A03-truehd-downmix.patch | 33 | ||||
-rw-r--r-- | contrib/ffmpeg/A04-aacenc.patch | 82 | ||||
-rw-r--r-- | contrib/ffmpeg/A05-mkv-chapters.patch | 57 | ||||
-rw-r--r-- | contrib/ffmpeg/A06-mkv-default-subtitle.patch | 30 | ||||
-rw-r--r-- | contrib/ffmpeg/A07-mp4-chapters.patch | 60 | ||||
-rw-r--r-- | contrib/ffmpeg/A08-mp4-faststart.patch | 301 | ||||
-rw-r--r-- | contrib/ffmpeg/A09-mp4-64bit.patch | 46 | ||||
-rw-r--r-- | contrib/ffmpeg/A10-mp4-track-enable.patch | 142 | ||||
-rw-r--r-- | contrib/ffmpeg/A11-mp4-chapter-properties.patch | 47 | ||||
-rw-r--r-- | contrib/ffmpeg/P01-solaris.patch | 6 | ||||
-rw-r--r-- | contrib/ffmpeg/P02-darwin-pic.patch | 12 | ||||
-rw-r--r-- | contrib/ffmpeg/module.defs | 2 |
17 files changed, 179 insertions, 1023 deletions
diff --git a/contrib/ffmpeg/A00-qsv.patch b/contrib/ffmpeg/A00-qsv.patch index 67203beac..c4e7361b3 100644 --- a/contrib/ffmpeg/A00-qsv.patch +++ b/contrib/ffmpeg/A00-qsv.patch @@ -1,84 +1,96 @@ diff --git a/configure b/configure -index 6ab04ae..0c5ad1d 100755 +index 910c47d..328702e 100755 --- a/configure +++ b/configure -@@ -133,6 +133,7 @@ Component options: +@@ -132,6 +132,7 @@ Component options: + + Hardware accelerators: + --enable-dxva2 enable DXVA2 code ++ --enable-qsv enable QSV code --enable-vaapi enable VAAPI code --enable-vda enable VDA code --enable-vdpau enable VDPAU code -+ --enable-qsv enable QSV code +@@ -1126,6 +1127,7 @@ EXTERNAL_LIBRARY_LIST=" - Individual component options: - --disable-everything disable all components listed below -@@ -1076,6 +1077,7 @@ CONFIG_LIST=" + HWACCEL_LIST=" + dxva2 ++ qsv vaapi vda vdpau -+ qsv - version3 - xmm_clobber_test - x11grab -@@ -1629,6 +1631,7 @@ vc1_vdpau_decoder_select="vdpau vc1_decoder" - wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel" - wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel" - wmv3_vdpau_decoder_select="vc1_vdpau_decoder" -+h264_qsv_decoder_select="qsv h264_decoder" - - # parsers - h264_parser_select="error_resilience golomb h264dsp h264pred mpegvideo" -@@ -3584,6 +3587,12 @@ if ! disabled vdpau && enabled vdpau_vdpau_h; then - check_cpp_condition vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" || - { echolog "Please upgrade to libvdpau >= 0.2 if you would like vdpau support." && disable vdpau; } - fi -+if enabled qsv; then -+ disable qsv -+ check_header msdk/mfxvideo.h && enable qsv -+else -+ disable qsv -+fi - - enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel" +@@ -1776,6 +1778,7 @@ zmbv_encoder_deps="zlib" -@@ -3795,6 +3804,7 @@ echo "SDL support ${sdl-no}" - echo "libdxva2 enabled ${dxva2-no}" - echo "libva enabled ${vaapi-no}" - echo "libvdpau enabled ${vdpau-no}" -+echo "libqsv enabled ${qsv-no}" - echo "AVISynth enabled ${avisynth-no}" - echo "frei0r enabled ${frei0r-no}" - echo "gnutls enabled ${gnutls-no}" + # hardware accelerators + dxva2_deps="dxva2api_h" ++qsv_deps="msdk_mfxvideo_h" + vaapi_deps="va_va_h" + vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads" + vda_extralibs="-framework CoreFoundation -framework VideoDecodeAcceleration -framework QuartzCore" +@@ -1787,6 +1790,8 @@ h263_vdpau_hwaccel_deps="vdpau" + h263_vdpau_hwaccel_select="h263_decoder" + h264_dxva2_hwaccel_deps="dxva2" + h264_dxva2_hwaccel_select="h264_decoder" ++h264_qsv_decoder_deps="qsv" ++h264_qsv_decoder_select="h264_decoder" + h264_vaapi_hwaccel_deps="vaapi" + h264_vaapi_hwaccel_select="h264_decoder" + h264_vda_hwaccel_deps="vda" +@@ -3820,6 +3825,7 @@ check_header dxva.h + check_header dxva2api.h + check_header io.h + check_header malloc.h ++check_header msdk/mfxvideo.h + check_header poll.h + check_header sys/mman.h + check_header sys/param.h diff --git a/libavcodec/Makefile b/libavcodec/Makefile -index a32ff96..52ad9ad 100644 +index 6dfb9a0..4e2d840 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile -@@ -10,6 +10,7 @@ HEADERS = avcodec.h \ +@@ -4,6 +4,7 @@ FFLIBS = avutil + HEADERS = avcodec.h \ + avfft.h \ + dxva2.h \ ++ qsv.h \ + vaapi.h \ + vda.h \ vdpau.h \ - version.h \ - xvmc.h \ -+ qsv.h \ - - OBJS = allcodecs.o \ - audioconvert.o \ -@@ -196,6 +197,7 @@ OBJS-$(CONFIG_H264_DECODER) += h264.o \ +@@ -59,6 +60,7 @@ OBJS-$(CONFIG_MPEGAUDIODSP) += mpegaudiodsp.o \ + OBJS-$(CONFIG_MPEGVIDEO) += mpegvideo.o mpegvideo_motion.o + OBJS-$(CONFIG_MPEGVIDEOENC) += mpegvideo_enc.o mpeg12data.o \ + motion_est.o ratecontrol.o ++OBJS-$(CONFIG_QSV) += qsv.o + OBJS-$(CONFIG_RANGECODER) += rangecoder.o + RDFT-OBJS-$(CONFIG_HARDCODED_TABLES) += sin_tables.o + OBJS-$(CONFIG_RDFT) += rdft.o $(RDFT-OBJS-yes) +@@ -195,6 +197,7 @@ OBJS-$(CONFIG_H264_DECODER) += h264.o \ h264_loopfilter.o h264_direct.o \ cabac.o h264_sei.o h264_ps.o \ h264_refs.o h264_cavlc.o h264_cabac.o -+OBJS-$(CONFIG_H264_QSV_DECODER) += qsv_h264.o qsv.o - OBJS-$(CONFIG_H264_DXVA2_HWACCEL) += dxva2_h264.o - OBJS-$(CONFIG_H264_VAAPI_HWACCEL) += vaapi_h264.o - OBJS-$(CONFIG_H264_VDA_HWACCEL) += vda_h264.o ++OBJS-$(CONFIG_H264_QSV_DECODER) += qsv_h264.o + OBJS-$(CONFIG_HEVC_DECODER) += hevc.o hevc_mvs.o hevc_ps.o hevc_sei.o \ + hevc_cabac.o hevc_refs.o hevcpred.o \ + hevcdsp.o hevc_filter.o cabac.o +@@ -688,6 +691,7 @@ SKIPHEADERS += %_tablegen.h \ + SKIPHEADERS-$(CONFIG_DXVA2) += dxva2.h dxva2_internal.h + SKIPHEADERS-$(CONFIG_LIBSCHROEDINGER) += libschroedinger.h + SKIPHEADERS-$(CONFIG_MPEG_XVMC_DECODER) += xvmc.h ++SKIPHEADERS-$(CONFIG_QSV) += qsv.h + SKIPHEADERS-$(CONFIG_VAAPI) += vaapi_internal.h + SKIPHEADERS-$(CONFIG_VDA) += vda.h + SKIPHEADERS-$(CONFIG_VDPAU) += vdpau.h vdpau_internal.h diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c -index 5786719..94608b0 100644 +index 044f585..99d4d23 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c -@@ -143,6 +143,7 @@ void avcodec_register_all(void) +@@ -154,6 +154,7 @@ void avcodec_register_all(void) REGISTER_DECODER(H263I, h263i); REGISTER_ENCODER(H263P, h263p); REGISTER_DECODER(H264, h264); -+ REGISTER_DECODER(H264_QSV, h264_qsv); - REGISTER_DECODER(H264_VDPAU, h264_vdpau); ++ REGISTER_DECODER(H264_QSV, h264_qsv); + REGISTER_DECODER(HEVC, hevc); + REGISTER_DECODER(HNM4_VIDEO, hnm4_video); REGISTER_ENCDEC (HUFFYUV, huffyuv); - REGISTER_DECODER(IDCIN, idcin); diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c new file mode 100644 index 0000000..2c46111 @@ -1234,10 +1246,10 @@ index 0000000..52378cf +#endif //AVCODEC_QSV_H diff --git a/libavcodec/qsv_h264.c b/libavcodec/qsv_h264.c new file mode 100644 -index 0000000..a353c22 +index 0000000..53a9f16 --- /dev/null +++ b/libavcodec/qsv_h264.c -@@ -0,0 +1,984 @@ +@@ -0,0 +1,982 @@ +/* ********************************************************************* *\ + +Copyright (C) 2013 Intel Corporation. All rights reserved. @@ -1325,12 +1337,12 @@ index 0000000..a353c22 + +int ff_qsv_dec_init_clean(AVCodecContext *avctx) +{ -+ mfxStatus sts = MFX_ERR_NONE; -+ av_qsv_context *qsv = avctx->priv_data; -+ av_qsv_space *qsv_decode = qsv->dec_space; -+ av_qsv_context_clean(qsv); -+ av_freep(&avctx->priv_data); ++ av_qsv_context *qsv = avctx->priv_data; ++ av_qsv_context_clean(qsv); ++ av_freep(&avctx->priv_data); ++ return 0; +} ++ +int ff_qsv_dec_init(AVCodecContext * avctx) +{ + int ret = 0; @@ -1569,17 +1581,15 @@ index 0000000..a353c22 + return AVERROR(ENOMEM); + + if (!(*qsv_config_context)) { -+ av_log(avctx, AV_LOG_INFO, -+ "Using default config for QSV decode\n"); ++ av_log(avctx, AV_LOG_INFO, "Using default config for QSV decode\n"); + avctx->hwaccel_context = &av_qsv_default_config; -+ } else { -+ if ((*qsv_config_context)->io_pattern != -+ MFX_IOPATTERN_OUT_OPAQUE_MEMORY -+ && (*qsv_config_context)->io_pattern != -+ MFX_IOPATTERN_OUT_SYSTEM_MEMORY) { -+ av_log_missing_feature( avctx,"Only MFX_IOPATTERN_OUT_OPAQUE_MEMORY and MFX_IOPATTERN_OUT_SYSTEM_MEMORY are currently supported\n",0); -+ return AVERROR_PATCHWELCOME; -+ } ++ } else if ((*qsv_config_context)->io_pattern != MFX_IOPATTERN_OUT_OPAQUE_MEMORY && ++ (*qsv_config_context)->io_pattern != MFX_IOPATTERN_OUT_SYSTEM_MEMORY) { ++ avpriv_report_missing_feature(avctx, ++ "Only MFX_IOPATTERN_OUT_OPAQUE_MEMORY" ++ " and MFX_IOPATTERN_OUT_SYSTEM_MEMORY" ++ " are currently supported\n"); ++ return AVERROR_PATCHWELCOME; + } + + qsv->qsv_config = avctx->hwaccel_context; @@ -2294,14 +2304,14 @@ index 0000000..3cbdb3f + +#endif //AVCODEC_QSV_H264_H diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h -index 1072f00..de232d4 100644 +index 0d6e0a3..d2779b7 100644 --- a/libavutil/pixfmt.h +++ b/libavutil/pixfmt.h -@@ -178,6 +178,7 @@ enum AVPixelFormat { - AV_PIX_FMT_YUVA422P16LE, ///< planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian) - AV_PIX_FMT_YUVA444P16BE, ///< planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian) - AV_PIX_FMT_YUVA444P16LE, ///< planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian) -+ AV_PIX_FMT_QSV_H264, ///< H.264 HW decoding with QSV, data[2] contains qsv_atom information for MFX_IOPATTERN_OUT_OPAQUE_MEMORY, MFX_IOPATTERN_OUT_VIDEO_MEMORY +@@ -190,6 +190,7 @@ enum AVPixelFormat { + AV_PIX_FMT_NV16, ///< interleaved chroma YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) + AV_PIX_FMT_NV20LE, ///< interleaved chroma YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + AV_PIX_FMT_NV20BE, ///< interleaved chroma YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian ++ AV_PIX_FMT_QSV_H264, ///< H.264 HW decoding with QSV, data[2] contains qsv_atom information for MFX_IOPATTERN_OUT_OPAQUE_MEMORY, MFX_IOPATTERN_OUT_VIDEO_MEMORY AV_PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions #if FF_API_PIX_FMT diff --git a/contrib/ffmpeg/A01-h264-recovery-point.patch b/contrib/ffmpeg/A01-h264-recovery-point.patch deleted file mode 100644 index 353f18e9f..000000000 --- a/contrib/ffmpeg/A01-h264-recovery-point.patch +++ /dev/null @@ -1,63 +0,0 @@ -diff --git a/libavcodec/h264.c b/libavcodec/h264.c -index 8625b0f..e862701 100644 ---- a/libavcodec/h264.c -+++ b/libavcodec/h264.c -@@ -2164,6 +2164,7 @@ static void flush_dpb(AVCodecContext *avctx) - - flush_change(h); - ff_mpeg_flush(avctx); -+ h->recovery_frame= -1; - } - - static int init_poc(H264Context *h) -@@ -4001,9 +4002,18 @@ again: - if ((err = decode_slice_header(hx, h))) - break; - -+ if (h->sei_recovery_frame_cnt >= 0 && h->recovery_frame < 0) { -+ h->recovery_frame = (h->frame_num + h->sei_recovery_frame_cnt) % -+ (1 << h->sps.log2_max_frame_num); -+ } -+ - s->current_picture_ptr->f.key_frame |= -- (hx->nal_unit_type == NAL_IDR_SLICE) || -- (h->sei_recovery_frame_cnt >= 0); -+ (hx->nal_unit_type == NAL_IDR_SLICE); -+ -+ if (h->recovery_frame == h->frame_num) { -+ s->current_picture_ptr->f.key_frame |= 1; -+ h->recovery_frame = -1; -+ } - - if (h->current_slice == 1) { - if (!(s->flags2 & CODEC_FLAG2_CHUNKS)) -diff --git a/libavcodec/h264.h b/libavcodec/h264.h -index 898ebf7..42aaa6f 100644 ---- a/libavcodec/h264.h -+++ b/libavcodec/h264.h -@@ -568,6 +568,13 @@ typedef struct H264Context { - * frames. - */ - int sei_recovery_frame_cnt; -+ /** -+ * recovery_frame is the frame_num at which the next frame should -+ * be fully constructed. -+ * -+ * Set to -1 when not expecting a recovery point. -+ */ -+ int recovery_frame; - - int luma_weight_flag[2]; ///< 7.4.3.2 luma_weight_lX_flag - int chroma_weight_flag[2]; ///< 7.4.3.2 chroma_weight_lX_flag -diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c -index 2e5fb65..ea33a18 100644 ---- a/libavcodec/h264_sei.c -+++ b/libavcodec/h264_sei.c -@@ -38,6 +38,7 @@ static const uint8_t sei_num_clock_ts_table[9]={ - }; - - void ff_h264_reset_sei(H264Context *h) { -+ h->recovery_frame = -1; - h->sei_recovery_frame_cnt = -1; - h->sei_dpb_output_delay = 0; - h->sei_cpb_removal_delay = -1; diff --git a/contrib/ffmpeg/A01-vc1-segfault.patch b/contrib/ffmpeg/A01-vc1-segfault.patch new file mode 100644 index 000000000..24470b9ac --- /dev/null +++ b/contrib/ffmpeg/A01-vc1-segfault.patch @@ -0,0 +1,53 @@ +From 475d00d67752a426529c977c13fffc883a191fa0 Mon Sep 17 00:00:00 2001 +From: Michael Niedermayer <[email protected]> +Date: Thu, 25 Apr 2013 21:31:18 +0200 +Subject: [PATCH] vc1dsp: add avg_no_rnd_vc1_chroma_mc4_c() + +Signed-off-by: Michael Niedermayer <[email protected]> +Signed-off-by: Tim Walker <[email protected]> +--- + libavcodec/vc1dsp.c | 21 +++++++++++++++++++++ + 1 file changed, 21 insertions(+) + +diff --git a/libavcodec/vc1dsp.c b/libavcodec/vc1dsp.c +index 7ef580d..2f510c4 100644 +--- a/libavcodec/vc1dsp.c ++++ b/libavcodec/vc1dsp.c +@@ -728,6 +728,26 @@ static void avg_no_rnd_vc1_chroma_mc8_c(uint8_t *dst/*align 8*/, uint8_t *src/*a + } + } + ++static void avg_no_rnd_vc1_chroma_mc4_c(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y){ ++ const int A=(8-x)*(8-y); ++ const int B=( x)*(8-y); ++ const int C=(8-x)*( y); ++ const int D=( x)*( y); ++ int i; ++ ++ assert(x<8 && y<8 && x>=0 && y>=0); ++ ++ for(i=0; i<h; i++) ++ { ++ dst[0] = avg2(dst[0], ((A*src[0] + B*src[1] + C*src[stride+0] + D*src[stride+1] + 32 - 4) >> 6)); ++ dst[1] = avg2(dst[1], ((A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2] + 32 - 4) >> 6)); ++ dst[2] = avg2(dst[2], ((A*src[2] + B*src[3] + C*src[stride+2] + D*src[stride+3] + 32 - 4) >> 6)); ++ dst[3] = avg2(dst[3], ((A*src[3] + B*src[4] + C*src[stride+3] + D*src[stride+4] + 32 - 4) >> 6)); ++ dst+= stride; ++ src+= stride; ++ } ++} ++ + #if CONFIG_WMV3IMAGE_DECODER || CONFIG_VC1IMAGE_DECODER + + static void sprite_h_c(uint8_t *dst, const uint8_t *src, int offset, int advance, int count) +@@ -845,6 +865,7 @@ av_cold void ff_vc1dsp_init(VC1DSPContext* dsp) { + dsp->put_no_rnd_vc1_chroma_pixels_tab[0]= put_no_rnd_vc1_chroma_mc8_c; + dsp->avg_no_rnd_vc1_chroma_pixels_tab[0]= avg_no_rnd_vc1_chroma_mc8_c; + dsp->put_no_rnd_vc1_chroma_pixels_tab[1] = put_no_rnd_vc1_chroma_mc4_c; ++ dsp->avg_no_rnd_vc1_chroma_pixels_tab[1] = avg_no_rnd_vc1_chroma_mc4_c; + + #if CONFIG_WMV3IMAGE_DECODER || CONFIG_VC1IMAGE_DECODER + dsp->sprite_h = sprite_h_c; +-- +1.8.5.1 + diff --git a/contrib/ffmpeg/A02-dca-resync.patch b/contrib/ffmpeg/A02-dca-resync.patch deleted file mode 100644 index bbd9ad7ed..000000000 --- a/contrib/ffmpeg/A02-dca-resync.patch +++ /dev/null @@ -1,73 +0,0 @@ -From 9922584ba3b5b02d913e629ea74d72e994870873 Mon Sep 17 00:00:00 2001 -From: John Stebbins <[email protected]> -Date: Thu, 17 Jan 2013 19:57:26 +0100 -Subject: [PATCH] dca_parser: Handle changes in dca frame size - -A change in framesize caused a perpetual loss of synchronization. -So read (and use) the frame size from the frame header instead of -setting it only once. ---- - libavcodec/dca_parser.c | 15 +++++++++------ - 1 file changed, 9 insertions(+), 6 deletions(-) - -diff --git a/libavcodec/dca_parser.c b/libavcodec/dca_parser.c -index ab235cf..12180f3 100644 ---- a/libavcodec/dca_parser.c -+++ b/libavcodec/dca_parser.c -@@ -62,10 +62,12 @@ static int dca_find_frame_end(DCAParseContext * pc1, const uint8_t * buf, - if (IS_MARKER(state, i, buf, buf_size)) { - if (pc1->lastmarker && state == pc1->lastmarker) { - start_found = 1; -+ i++; - break; - } else if (!pc1->lastmarker) { - start_found = 1; - pc1->lastmarker = state; -+ i++; - break; - } - } -@@ -80,9 +82,6 @@ static int dca_find_frame_end(DCAParseContext * pc1, const uint8_t * buf, - if (state == pc1->lastmarker && IS_MARKER(state, i, buf, buf_size)) { - if(pc1->framesize > pc1->size) - continue; -- if(!pc1->framesize){ -- pc1->framesize = pc1->hd_pos ? pc1->hd_pos : pc1->size; -- } - pc->frame_start_found = 0; - pc->state = -1; - pc1->size = 0; -@@ -139,7 +138,7 @@ int ff_dca_convert_bitstream(const uint8_t *src, int src_size, uint8_t *dst, - } - - static int dca_parse_params(const uint8_t *buf, int buf_size, int *duration, -- int *sample_rate) -+ int *sample_rate, int *framesize) - { - GetBitContext gb; - uint8_t hdr[12 + FF_INPUT_BUFFER_PADDING_SIZE] = { 0 }; -@@ -159,7 +158,11 @@ static int dca_parse_params(const uint8_t *buf, int buf_size, int *duration, - return AVERROR_INVALIDDATA; - *duration = 256 * (sample_blocks / 8); - -- skip_bits(&gb, 20); -+ *framesize = get_bits(&gb, 14) + 1; -+ if (*framesize < 95) -+ return AVERROR_INVALIDDATA; -+ -+ skip_bits(&gb, 6); - sr_code = get_bits(&gb, 4); - *sample_rate = avpriv_dca_sample_rates[sr_code]; - if (*sample_rate == 0) -@@ -190,7 +193,7 @@ static int dca_parse(AVCodecParserContext * s, - } - - /* read the duration and sample rate from the frame header */ -- if (!dca_parse_params(buf, buf_size, &duration, &sample_rate)) { -+ if (!dca_parse_params(buf, buf_size, &duration, &sample_rate, &pc1->framesize)) { - s->duration = duration; - avctx->sample_rate = sample_rate; - } else --- -1.7.10.4 - diff --git a/contrib/ffmpeg/A02-vc1-interlaced.patch b/contrib/ffmpeg/A02-vc1-interlaced.patch new file mode 100644 index 000000000..3db287d92 --- /dev/null +++ b/contrib/ffmpeg/A02-vc1-interlaced.patch @@ -0,0 +1,27 @@ +From 52151e23889cea0d41f44b9b35d9216786992ff1 Mon Sep 17 00:00:00 2001 +From: Tim Walker <[email protected]> +Date: Sat, 11 Jan 2014 23:08:23 +0100 +Subject: [PATCH] vc1: enable the interlaced B-frame codepath. + +This should have been done in 1fb013a57c6d98d3f425506eb25f32b2cf7ddc6f, but was missed because FFmpeg had moved that code elsewhere. + +Signed-off-by: Tim Walker <[email protected]> +--- + libavcodec/vc1.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c +index 319230a..acefce6 100644 +--- a/libavcodec/vc1.c ++++ b/libavcodec/vc1.c +@@ -1188,7 +1188,6 @@ int ff_vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb) + if (v->bfraction == 0) { + return -1; + } +- return -1; // This codepath is still incomplete thus it is disabled + } + if (v->extended_mv) + v->mvrange = get_unary(gb, 0, 3); +-- +1.8.5.1 + diff --git a/contrib/ffmpeg/A03-truehd-downmix.patch b/contrib/ffmpeg/A03-truehd-downmix.patch deleted file mode 100644 index 9a9c18e13..000000000 --- a/contrib/ffmpeg/A03-truehd-downmix.patch +++ /dev/null @@ -1,33 +0,0 @@ -diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c -index 0eaf2e3..ef1812d 100644 ---- a/libavcodec/mlpdec.c -+++ b/libavcodec/mlpdec.c -@@ -445,14 +445,24 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp, - return AVERROR_INVALIDDATA; - } - -- if (m->avctx->request_channels > 0 -- && s->max_channel + 1 >= m->avctx->request_channels -- && substr < m->max_decoded_substream) { -+#if FF_API_REQUEST_CHANNELS -+ if (m->avctx->request_channels > 0 && -+ m->avctx->request_channels <= s->max_channel + 1 && -+ m->max_decoded_substream > substr) { - av_log(m->avctx, AV_LOG_DEBUG, -- "Extracting %d channel downmix from substream %d. " -+ "Extracting %d-channel downmix from substream %d. " - "Further substreams will be skipped.\n", - s->max_channel + 1, substr); - m->max_decoded_substream = substr; -+ } else -+#endif -+ if (m->avctx->request_channel_layout == s->ch_layout && -+ m->max_decoded_substream > substr) { -+ av_log(m->avctx, AV_LOG_DEBUG, -+ "Extracting %d-channel downmix (0x%"PRIx64") from substream %d. " -+ "Further substreams will be skipped.\n", -+ s->max_channel + 1, s->ch_layout, substr); -+ m->max_decoded_substream = substr; - } - - s->noise_shift = get_bits(gbp, 4); diff --git a/contrib/ffmpeg/A04-aacenc.patch b/contrib/ffmpeg/A04-aacenc.patch deleted file mode 100644 index b58441a17..000000000 --- a/contrib/ffmpeg/A04-aacenc.patch +++ /dev/null @@ -1,82 +0,0 @@ -commit 8bbdd20a293eab2cfac9f332613ead02a4e3c0c2 -Author: Claudio Freire <[email protected]> -Date: Sun May 12 09:38:40 2013 +0200 - - aacenc: Fix erasure of surround channels - - This was due to a miscomputation of s->cur_channel, which led to - psy-based encoders using the psy coefficients for the wrong channel. - - Signed-off-by: Martin Storsjö <[email protected]> - -diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c -index 60eca59..b2ad47b 100644 ---- a/libavcodec/aacenc.c -+++ b/libavcodec/aacenc.c -@@ -597,7 +597,7 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, - coeffs[ch] = cpe->ch[ch].coeffs; - s->psy.model->analyze(&s->psy, start_ch, coeffs, wi); - for (ch = 0; ch < chans; ch++) { -- s->cur_channel = start_ch * 2 + ch; -+ s->cur_channel = start_ch + ch; - s->coder->search_for_quantizers(avctx, s, &cpe->ch[ch], s->lambda); - } - cpe->common_window = 0; -@@ -613,7 +613,7 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, - } - } - } -- s->cur_channel = start_ch * 2; -+ s->cur_channel = start_ch; - if (s->options.stereo_mode && cpe->common_window) { - if (s->options.stereo_mode > 0) { - IndividualChannelStream *ics = &cpe->ch[0].ics; - -commit f4d0a63b5b5c682c18df3bba730f97a9067408ba -Author: Claudio Freire <[email protected]> -Date: Sat May 4 18:36:37 2013 -0300 - - aacenc: Fix target bitrate for twoloop quantiser search - - This fixes a case where multichannel bitrate isn't accurately - targetted by psy model alone, never achieving the target bitrate. - - Signed-off-by: Martin Storsjö <[email protected]> - -diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c -index d65d8d9..35b98a9 100644 ---- a/libavcodec/aaccoder.c -+++ b/libavcodec/aaccoder.c -@@ -710,7 +710,7 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx, - const float lambda) - { - int start = 0, i, w, w2, g; -- int destbits = avctx->bit_rate * 1024.0 / avctx->sample_rate / avctx->channels; -+ int destbits = avctx->bit_rate * 1024.0 / avctx->sample_rate / avctx->channels * (lambda / 120.f); - float dists[128] = { 0 }, uplims[128]; - float maxvals[128]; - int fflag, minscaler; - -commit 7c71ada4cad3c6aab5fa24155c379465c41cfd76 -Author: Claudio Freire <[email protected]> -Date: Sat May 4 18:35:49 2013 -0300 - - aacenc: Fix a rounding bug in aacpsy channel bitrate computation - - Signed-off-by: Martin Storsjö <[email protected]> - -diff --git a/libavcodec/aacpsy.c b/libavcodec/aacpsy.c -index 6f1ac05..66cf6d5 100644 ---- a/libavcodec/aacpsy.c -+++ b/libavcodec/aacpsy.c -@@ -312,7 +312,7 @@ static av_cold int psy_3gpp_init(FFPsyContext *ctx) { - AacPsyCoeffs *coeffs = pctx->psy_coef[j]; - const uint8_t *band_sizes = ctx->bands[j]; - float line_to_frequency = ctx->avctx->sample_rate / (j ? 256.f : 2048.0f); -- float avg_chan_bits = chan_bitrate / ctx->avctx->sample_rate * (j ? 128.0f : 1024.0f); -+ float avg_chan_bits = chan_bitrate * (j ? 128.0f : 1024.0f) / ctx->avctx->sample_rate; - /* reference encoder uses 2.4% here instead of 60% like the spec says */ - float bark_pe = 0.024f * PSY_3GPP_BITS_TO_PE(avg_chan_bits) / num_bark; - float en_spread_low = j ? PSY_3GPP_EN_SPREAD_LOW_S : PSY_3GPP_EN_SPREAD_LOW_L; - - diff --git a/contrib/ffmpeg/A05-mkv-chapters.patch b/contrib/ffmpeg/A05-mkv-chapters.patch deleted file mode 100644 index f4082be1d..000000000 --- a/contrib/ffmpeg/A05-mkv-chapters.patch +++ /dev/null @@ -1,57 +0,0 @@ -From c4d83dfad34d69a86bf04ded97ae3fda087bfa25 Mon Sep 17 00:00:00 2001 -From: John Stebbins <[email protected]> -Date: Fri, 10 May 2013 08:45:55 -0700 -Subject: [PATCH 1/9] matroskaenc: Allow chapters to be written in trailer - -This allows creation of frame accurate chapter marks from sources like -DVD and BD where the precise chapter location is not known until the -chapter mark has been reached during reading. ---- - libavformat/matroskaenc.c | 10 +++++++++- - 1 file changed, 9 insertions(+), 1 deletion(-) - -diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c -index b37d10c..99de151 100644 ---- a/libavformat/matroskaenc.c -+++ b/libavformat/matroskaenc.c -@@ -94,6 +94,7 @@ typedef struct MatroskaMuxContext { - AVPacket cur_audio_pkt; - - int have_attachments; -+ int wrote_chapters; - } MatroskaMuxContext; - - -@@ -688,7 +689,7 @@ static int mkv_write_chapters(AVFormatContext *s) - AVRational scale = {1, 1E9}; - int i, ret; - -- if (!s->nb_chapters) -+ if (!s->nb_chapters || mkv->wrote_chapters) - return 0; - - ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_CHAPTERS, avio_tell(pb)); -@@ -721,6 +722,8 @@ static int mkv_write_chapters(AVFormatContext *s) - } - end_ebml_master(pb, editionentry); - end_ebml_master(pb, chapters); -+ -+ mkv->wrote_chapters = 1; - return 0; - } - -@@ -1259,6 +1262,11 @@ static int mkv_write_trailer(AVFormatContext *s) - end_ebml_master(pb, mkv->cluster); - } - -+ if (mkv->mode != MODE_WEBM) { -+ ret = mkv_write_chapters(s); -+ if (ret < 0) return ret; -+ } -+ - if (pb->seekable) { - if (mkv->cues->num_entries) { - cuespos = mkv_write_cues(pb, mkv->cues, s->nb_streams); --- -1.8.1.4 - diff --git a/contrib/ffmpeg/A06-mkv-default-subtitle.patch b/contrib/ffmpeg/A06-mkv-default-subtitle.patch deleted file mode 100644 index 9074a3443..000000000 --- a/contrib/ffmpeg/A06-mkv-default-subtitle.patch +++ /dev/null @@ -1,30 +0,0 @@ -From f1febbdddc573c7684e1761abfe568ebfcfcdcd1 Mon Sep 17 00:00:00 2001 -From: John Stebbins <[email protected]> -Date: Fri, 10 May 2013 08:49:58 -0700 -Subject: [PATCH 3/9] matroskaenc: Fix writing TRACKDEFAULTFLAG - -The element was only being written when the value == 1. But the default -value of this element is 1, so this has no useful effect. This element -needs to be written when the value == 0. ---- - libavformat/matroskaenc.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c -index 4858af5..358ba66 100644 ---- a/libavformat/matroskaenc.c -+++ b/libavformat/matroskaenc.c -@@ -568,7 +568,9 @@ static int mkv_write_tracks(AVFormatContext *s) - tag = av_dict_get(st->metadata, "language", NULL, 0); - put_ebml_string(pb, MATROSKA_ID_TRACKLANGUAGE, tag ? tag->value:"und"); - -- if (st->disposition) -+ // The default value for TRACKFLAGDEFAULT is 1, so add element -+ // if we need to clear it. -+ if (!(st->disposition & AV_DISPOSITION_DEFAULT)) - put_ebml_uint(pb, MATROSKA_ID_TRACKFLAGDEFAULT, !!(st->disposition & AV_DISPOSITION_DEFAULT)); - - // look for a codec ID string specific to mkv to use, --- -1.8.1.4 - diff --git a/contrib/ffmpeg/A07-mp4-chapters.patch b/contrib/ffmpeg/A07-mp4-chapters.patch deleted file mode 100644 index 0fec0eaf9..000000000 --- a/contrib/ffmpeg/A07-mp4-chapters.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 36bdd52964ef68532eea50a81431c0c4c9f329e5 Mon Sep 17 00:00:00 2001 -From: John Stebbins <[email protected]> -Date: Fri, 10 May 2013 08:51:46 -0700 -Subject: [PATCH 4/9] movenc: Allow chapters to be written in trailer - -This allows creation of frame accurate chapter marks from sources -like DVD and BD where the precise chapter location is not known until -the chapter mark has been reached during reading. ---- - libavformat/movenc.c | 19 ++++++++++++++++--- - 1 file changed, 16 insertions(+), 3 deletions(-) - -diff --git a/libavformat/movenc.c b/libavformat/movenc.c -index 496158c..f41f8d7 100644 ---- a/libavformat/movenc.c -+++ b/libavformat/movenc.c -@@ -3038,7 +3038,7 @@ static int mov_write_header(AVFormatContext *s) - } - - mov->nb_streams = s->nb_streams; -- if (mov->mode & (MODE_MOV|MODE_IPOD) && s->nb_chapters) -+ if (mov->mode & (MODE_MP4|MODE_MOV|MODE_IPOD) && s->nb_chapters) - mov->chapter_track = mov->nb_streams++; - - if (mov->flags & FF_MOV_FLAG_RTP_HINT) { -@@ -3053,7 +3053,9 @@ static int mov_write_header(AVFormatContext *s) - } - } - -- mov->tracks = av_mallocz(mov->nb_streams*sizeof(*mov->tracks)); -+ // Reserve an extra stream for chapters for the case where chapters -+ // are written in the trailer -+ mov->tracks = av_mallocz((mov->nb_streams+1)*sizeof(*mov->tracks)); - if (!mov->tracks) - return AVERROR(ENOMEM); - -@@ -3189,8 +3191,19 @@ static int mov_write_trailer(AVFormatContext *s) - AVIOContext *pb = s->pb; - int res = 0; - int i; -+ int64_t moov_pos; -+ -+ // If there were no chapters when the header was written, but there -+ // are chapters now, write them in the trailer. This only works -+ // when we are not doing fragments. -+ if (!mov->chapter_track && !(mov->flags & FF_MOV_FLAG_FRAGMENT)) { -+ if (mov->mode & (MODE_MP4|MODE_MOV|MODE_IPOD) && s->nb_chapters) { -+ mov->chapter_track = mov->nb_streams++; -+ mov_create_chapter_track(s, mov->chapter_track); -+ } -+ } - -- int64_t moov_pos = avio_tell(pb); -+ moov_pos = avio_tell(pb); - - if (!(mov->flags & FF_MOV_FLAG_FRAGMENT)) { - /* Write size of mdat tag */ --- -1.8.1.4 - diff --git a/contrib/ffmpeg/A08-mp4-faststart.patch b/contrib/ffmpeg/A08-mp4-faststart.patch deleted file mode 100644 index c4d8d706b..000000000 --- a/contrib/ffmpeg/A08-mp4-faststart.patch +++ /dev/null @@ -1,301 +0,0 @@ -From 650a3dbf0cb6e38011bd6ea3ccec7148c7e9adb9 Mon Sep 17 00:00:00 2001 -From: John Stebbins <[email protected]> -Date: Fri, 10 May 2013 09:01:45 -0700 -Subject: [PATCH 5/9] movenc: allow placing moov atom at beginning of file - -Adds option to reserve space for moov. ---- - libavformat/movenc.c | 22 ++++++++++++++++++++-- - libavformat/movenc.h | 3 +++ - 2 files changed, 23 insertions(+), 2 deletions(-) - -diff --git a/libavformat/movenc.c b/libavformat/movenc.c -index f41f8d7..684f8d6 100644 ---- a/libavformat/movenc.c -+++ b/libavformat/movenc.c -@@ -51,6 +51,7 @@ static const AVOption options[] = { - { "separate_moof", "Write separate moof/mdat atoms for each track", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_SEPARATE_MOOF}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" }, - { "frag_custom", "Flush fragments on caller requests", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_FRAG_CUSTOM}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" }, - { "isml", "Create a live smooth streaming feed (for pushing to a publishing point)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_ISML}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" }, -+ { "moov_size", "maximum moov size so it can be placed at the begin", offsetof(MOVMuxContext, reserved_moov_size), AV_OPT_TYPE_INT, {.dbl = 0}, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, 0 }, - FF_RTP_FLAG_OPTS(MOVMuxContext, rtp_flags), - { "skip_iods", "Skip writing iods atom.", offsetof(MOVMuxContext, iods_skip), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM}, - { "iods_audio_profile", "iods audio profile atom.", offsetof(MOVMuxContext, iods_audio_profile), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 255, AV_OPT_FLAG_ENCODING_PARAM}, -@@ -3146,8 +3147,13 @@ static int mov_write_header(AVFormatContext *s) - FF_MOV_FLAG_FRAGMENT; - } - -- if (!(mov->flags & FF_MOV_FLAG_FRAGMENT)) -+ if (!(mov->flags & FF_MOV_FLAG_FRAGMENT)) { -+ if(mov->reserved_moov_size) { -+ mov->reserved_moov_pos= avio_tell(pb); -+ avio_skip(pb, mov->reserved_moov_size); -+ } - mov_write_mdat_tag(pb, mov); -+ } - - if (t = av_dict_get(s->metadata, "creation_time", NULL, 0)) - mov->time = ff_iso8601_to_unix_time(t->value); -@@ -3219,9 +3225,21 @@ static int mov_write_trailer(AVFormatContext *s) - ffio_wfourcc(pb, "mdat"); - avio_wb64(pb, mov->mdat_size + 16); - } -- avio_seek(pb, moov_pos, SEEK_SET); -+ avio_seek(pb, mov->reserved_moov_size ? mov->reserved_moov_pos : moov_pos, SEEK_SET); - - mov_write_moov_tag(pb, mov, s); -+ if (mov->reserved_moov_size) { -+ int64_t size= mov->reserved_moov_size - (avio_tell(pb) - mov->reserved_moov_pos); -+ if(size < 8){ -+ av_log(s, AV_LOG_ERROR, "reserved_moov_size is too small, needed %"PRId64" additional\n", 8-size); -+ return -1; -+ } -+ avio_wb32(pb, size); -+ ffio_wfourcc(pb, "free"); -+ for(i=0; i<size; i++) -+ avio_w8(pb, 0); -+ avio_seek(pb, moov_pos, SEEK_SET); -+ } - } else { - mov_flush_fragment(s); - mov_write_mfra_tag(pb, mov); -diff --git a/libavformat/movenc.h b/libavformat/movenc.h -index e20ef14..f91fc5f 100644 ---- a/libavformat/movenc.h -+++ b/libavformat/movenc.h -@@ -153,6 +153,9 @@ typedef struct MOVMuxContext { - int max_fragment_size; - int ism_lookahead; - AVIOContext *mdat_buf; -+ -+ int reserved_moov_size; -+ int64_t reserved_moov_pos; - } MOVMuxContext; - - #define FF_MOV_FLAG_RTP_HINT 1 --- -1.8.1.4 - -From 256ce14e2492ccdcb987afd6fb66ef590e58f02e Mon Sep 17 00:00:00 2001 -From: John Stebbins <[email protected]> -Date: Fri, 10 May 2013 09:11:32 -0700 -Subject: [PATCH 6/9] movenc: add faststart option for web streaming - -Faststart moves moov atom to beginning of file and rewrites the reset of -the file after muxing is complete. ---- - libavformat/movenc.c | 140 +++++++++++++++++++++++++++++++++++++++++++++++++-- - libavformat/movenc.h | 3 +- - 2 files changed, 137 insertions(+), 6 deletions(-) - -diff --git a/libavformat/movenc.c b/libavformat/movenc.c -index 684f8d6..7348cf8 100644 ---- a/libavformat/movenc.c -+++ b/libavformat/movenc.c -@@ -51,6 +51,7 @@ static const AVOption options[] = { - { "separate_moof", "Write separate moof/mdat atoms for each track", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_SEPARATE_MOOF}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" }, - { "frag_custom", "Flush fragments on caller requests", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_FRAG_CUSTOM}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" }, - { "isml", "Create a live smooth streaming feed (for pushing to a publishing point)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_ISML}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" }, -+ { "faststart", "Run a second pass to put the moov at the beginning of the file", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_FASTSTART}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" }, - { "moov_size", "maximum moov size so it can be placed at the begin", offsetof(MOVMuxContext, reserved_moov_size), AV_OPT_TYPE_INT, {.dbl = 0}, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, 0 }, - FF_RTP_FLAG_OPTS(MOVMuxContext, rtp_flags), - { "skip_iods", "Skip writing iods atom.", offsetof(MOVMuxContext, iods_skip), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM}, -@@ -3007,6 +3008,14 @@ static int mov_write_header(AVFormatContext *s) - FF_MOV_FLAG_FRAG_CUSTOM)) - mov->flags |= FF_MOV_FLAG_FRAGMENT; - -+ /* faststart: moov at the beginning of the file, if supported */ -+ if (mov->flags & FF_MOV_FLAG_FASTSTART) { -+ if (mov->flags & FF_MOV_FLAG_FRAGMENT) -+ mov->flags &= ~FF_MOV_FLAG_FASTSTART; -+ else -+ mov->reserved_moov_size = -1; -+ } -+ - /* Non-seekable output is ok if using fragmentation. If ism_lookahead - * is enabled, we don't support non-seekable output at all. */ - if (!s->pb->seekable && -@@ -3150,7 +3159,8 @@ static int mov_write_header(AVFormatContext *s) - if (!(mov->flags & FF_MOV_FLAG_FRAGMENT)) { - if(mov->reserved_moov_size) { - mov->reserved_moov_pos= avio_tell(pb); -- avio_skip(pb, mov->reserved_moov_size); -+ if(mov->reserved_moov_size > 0) -+ avio_skip(pb, mov->reserved_moov_size); - } - mov_write_mdat_tag(pb, mov); - } -@@ -3191,6 +3201,115 @@ static int mov_write_header(AVFormatContext *s) - return -1; - } - -+static int get_moov_size(AVFormatContext *s) -+{ -+ int ret; -+ uint8_t *buf; -+ AVIOContext *moov_buf; -+ MOVMuxContext *mov = s->priv_data; -+ -+ if ((ret = avio_open_dyn_buf(&moov_buf)) < 0) -+ return ret; -+ mov_write_moov_tag(moov_buf, mov, s); -+ ret = avio_close_dyn_buf(moov_buf, &buf); -+ av_free(buf); -+ return ret; -+} -+ -+/** -+ * This function gets the moov size if moved to the top of the file: the chunk -+ * offset table can switch between stco (32-bit entries) to co64 (64-bit -+ * entries) when the moov is moved to the top, so the size of the moov would -+ * change. It also updates the chunk offset tables. -+ */ -+static int compute_moov_size(AVFormatContext *s) -+{ -+ int i, moov_size, moov_size2; -+ MOVMuxContext *mov = s->priv_data; -+ -+ moov_size = get_moov_size(s); -+ if (moov_size < 0) -+ return moov_size; -+ -+ for (i = 0; i < mov->nb_streams; i++) -+ mov->tracks[i].data_offset += moov_size; -+ -+ moov_size2 = get_moov_size(s); -+ if (moov_size2 < 0) -+ return moov_size2; -+ -+ /* if the size changed, we just switched from stco to co64 and needs to -+ * update the offsets */ -+ if (moov_size2 != moov_size) -+ for (i = 0; i < mov->nb_streams; i++) -+ mov->tracks[i].data_offset += moov_size2 - moov_size; -+ -+ return moov_size2; -+} -+ -+static int shift_data(AVFormatContext *s) -+{ -+ int ret = 0, moov_size; -+ MOVMuxContext *mov = s->priv_data; -+ int64_t pos, pos_end = avio_tell(s->pb); -+ uint8_t *buf, *read_buf[2]; -+ int read_buf_id = 0; -+ int read_size[2]; -+ AVIOContext *read_pb; -+ -+ moov_size = compute_moov_size(s); -+ if (moov_size < 0) -+ return moov_size; -+ -+ buf = av_malloc(moov_size * 2); -+ if (!buf) -+ return AVERROR(ENOMEM); -+ read_buf[0] = buf; -+ read_buf[1] = buf + moov_size; -+ -+ /* Shift the data: the AVIO context of the output can only be used for -+ * writing, so we re-open the same output, but for reading. It also avoids -+ * a read/seek/write/seek back and forth. */ -+ avio_flush(s->pb); -+ ret = avio_open(&read_pb, s->filename, AVIO_FLAG_READ); -+ if (ret < 0) { -+ av_log(s, AV_LOG_ERROR, "Unable to re-open %s output file for " -+ "the second pass (faststart)\n", s->filename); -+ goto end; -+ } -+ -+ /* mark the end of the shift to up to the last data we wrote, and get ready -+ * for writing */ -+ pos_end = avio_tell(s->pb); -+ avio_seek(s->pb, mov->reserved_moov_pos + moov_size, SEEK_SET); -+ -+ /* start reading at where the new moov will be placed */ -+ avio_seek(read_pb, mov->reserved_moov_pos, SEEK_SET); -+ pos = avio_tell(read_pb); -+ -+#define READ_BLOCK do { \ -+ read_size[read_buf_id] = avio_read(read_pb, read_buf[read_buf_id], moov_size); \ -+ read_buf_id ^= 1; \ -+} while (0) -+ -+ /* shift data by chunk of at most moov_size */ -+ READ_BLOCK; -+ do { -+ int n; -+ READ_BLOCK; -+ n = read_size[read_buf_id]; -+ if (n <= 0) -+ break; -+ avio_write(s->pb, read_buf[read_buf_id], n); -+ pos += n; -+ } while (pos < pos_end); -+ avio_close(read_pb); -+ -+end: -+ av_free(buf); -+ return ret; -+} -+ - static int mov_write_trailer(AVFormatContext *s) - { - MOVMuxContext *mov = s->priv_data; -@@ -3225,11 +3344,20 @@ static int mov_write_trailer(AVFormatContext *s) - ffio_wfourcc(pb, "mdat"); - avio_wb64(pb, mov->mdat_size + 16); - } -- avio_seek(pb, mov->reserved_moov_size ? mov->reserved_moov_pos : moov_pos, SEEK_SET); - -- mov_write_moov_tag(pb, mov, s); -- if (mov->reserved_moov_size) { -- int64_t size= mov->reserved_moov_size - (avio_tell(pb) - mov->reserved_moov_pos); -+ avio_seek(pb, mov->reserved_moov_size > 0 ? mov->reserved_moov_pos : moov_pos, SEEK_SET); -+ -+ if (mov->reserved_moov_size == -1) { -+ av_log(s, AV_LOG_INFO, "Starting second pass: moving header on top of the file\n"); -+ res = shift_data(s); -+ if (res == 0) { -+ avio_seek(s->pb, mov->reserved_moov_pos, SEEK_SET); -+ mov_write_moov_tag(pb, mov, s); -+ } -+ } else if (mov->reserved_moov_size > 0) { -+ int64_t size; -+ mov_write_moov_tag(pb, mov, s); -+ size = mov->reserved_moov_size - (avio_tell(pb) - mov->reserved_moov_pos); - if(size < 8){ - av_log(s, AV_LOG_ERROR, "reserved_moov_size is too small, needed %"PRId64" additional\n", 8-size); - return -1; -@@ -3239,6 +3367,8 @@ static int mov_write_trailer(AVFormatContext *s) - for(i=0; i<size; i++) - avio_w8(pb, 0); - avio_seek(pb, moov_pos, SEEK_SET); -+ } else { -+ mov_write_moov_tag(pb, mov, s); - } - } else { - mov_flush_fragment(s); -diff --git a/libavformat/movenc.h b/libavformat/movenc.h -index f91fc5f..3ea0dd5 100644 ---- a/libavformat/movenc.h -+++ b/libavformat/movenc.h -@@ -154,7 +154,7 @@ typedef struct MOVMuxContext { - int ism_lookahead; - AVIOContext *mdat_buf; - -- int reserved_moov_size; -+ int reserved_moov_size; ///< 0 for disabled, -1 for automatic, size otherwise - int64_t reserved_moov_pos; - } MOVMuxContext; - -@@ -165,6 +165,7 @@ typedef struct MOVMuxContext { - #define FF_MOV_FLAG_SEPARATE_MOOF 16 - #define FF_MOV_FLAG_FRAG_CUSTOM 32 - #define FF_MOV_FLAG_ISML 64 -+#define FF_MOV_FLAG_FASTSTART 128 - - int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt); - --- -1.8.1.4 - diff --git a/contrib/ffmpeg/A09-mp4-64bit.patch b/contrib/ffmpeg/A09-mp4-64bit.patch deleted file mode 100644 index 04fec6032..000000000 --- a/contrib/ffmpeg/A09-mp4-64bit.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 68f89a1ec9ccef22268158640c1f62f0370f48ba Mon Sep 17 00:00:00 2001 -From: John Stebbins <[email protected]> -Date: Fri, 10 May 2013 09:12:54 -0700 -Subject: [PATCH 7/9] movenc: fix detection of 64bit offset requirement - -The old method doesn't work when moov is relocated to beginning of file ---- - libavformat/movenc.c | 16 +++++++++++++--- - 1 file changed, 13 insertions(+), 3 deletions(-) - -diff --git a/libavformat/movenc.c b/libavformat/movenc.c -index 7348cf8..2f6c003 100644 ---- a/libavformat/movenc.c -+++ b/libavformat/movenc.c -@@ -83,15 +83,25 @@ static int64_t update_size(AVIOContext *pb, int64_t pos) - return curpos - pos; - } - -+static int is_co64_required(const MOVTrack *track) -+{ -+ int i; -+ -+ for (i = 0; i < track->entry; i++) { -+ if (track->cluster[i].pos + track->data_offset > UINT32_MAX) -+ return 1; -+ } -+ return 0; -+} -+ - /* Chunk offset atom */ - static int mov_write_stco_tag(AVIOContext *pb, MOVTrack *track) - { - int i; -- int mode64 = 0; // use 32 bit size variant if possible -+ int mode64 = is_co64_required(track); // use 32 bit size variant if possible - int64_t pos = avio_tell(pb); - avio_wb32(pb, 0); /* size */ -- if (pos > UINT32_MAX) { -- mode64 = 1; -+ if (mode64) { - ffio_wfourcc(pb, "co64"); - } else - ffio_wfourcc(pb, "stco"); --- -1.8.1.4 - diff --git a/contrib/ffmpeg/A10-mp4-track-enable.patch b/contrib/ffmpeg/A10-mp4-track-enable.patch deleted file mode 100644 index 282326157..000000000 --- a/contrib/ffmpeg/A10-mp4-track-enable.patch +++ /dev/null @@ -1,142 +0,0 @@ -From 25a0ee27bb5d2bb46781ea4a2a3c88581ad75fde Mon Sep 17 00:00:00 2001 -From: John Stebbins <[email protected]> -Date: Fri, 10 May 2013 09:16:08 -0700 -Subject: [PATCH 8/9] movenc: Make tkhd "enabled" flag QuickTime compatible - -QuickTime will play multiple audio tracks concurrently if this flag is -set for multiple audio tracks. And if no subtitle track has this flag -set QuickTime will show no subtitles in the subtitle menu. ---- - libavformat/mov.c | 4 +++- - libavformat/movenc.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++- - libavformat/movenc.h | 1 + - 3 files changed, 63 insertions(+), 2 deletions(-) - -diff --git a/libavformat/mov.c b/libavformat/mov.c -index 7fe0548..cb0e395 100644 ---- a/libavformat/mov.c -+++ b/libavformat/mov.c -@@ -2129,6 +2129,7 @@ static int mov_read_tkhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) - AVStream *st; - MOVStreamContext *sc; - int version; -+ int flags; - - if (c->fc->nb_streams < 1) - return 0; -@@ -2136,13 +2137,14 @@ static int mov_read_tkhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) - sc = st->priv_data; - - version = avio_r8(pb); -- avio_rb24(pb); /* flags */ -+ flags = avio_rb24(pb); /* flags */ - /* - MOV_TRACK_ENABLED 0x0001 - MOV_TRACK_IN_MOVIE 0x0002 - MOV_TRACK_IN_PREVIEW 0x0004 - MOV_TRACK_IN_POSTER 0x0008 - */ -+ st->disposition |= (flags & 0x1) ? AV_DISPOSITION_DEFAULT : 0; - - if (version == 1) { - avio_rb64(pb); -diff --git a/libavformat/movenc.c b/libavformat/movenc.c -index 2f6c003..bc77a6f 100644 ---- a/libavformat/movenc.c -+++ b/libavformat/movenc.c -@@ -1387,7 +1387,13 @@ static int mov_write_tkhd_tag(AVIOContext *pb, MOVTrack *track, AVStream *st) - (version == 1) ? avio_wb32(pb, 104) : avio_wb32(pb, 92); /* size */ - ffio_wfourcc(pb, "tkhd"); - avio_w8(pb, version); -- avio_wb24(pb, 0xf); /* flags (track enabled) */ -+ avio_wb24(pb, (track->flags & MOV_TRACK_ENABLED) ? 0x3 : 0x2); /* flags */ -+ /* -+ MOV_TRACK_ENABLED 0x0001 -+ MOV_TRACK_IN_MOVIE 0x0002 -+ MOV_TRACK_IN_PREVIEW 0x0004 -+ MOV_TRACK_IN_POSTER 0x0008 -+ */ - if (version == 1) { - avio_wb64(pb, track->time); - avio_wb64(pb, track->time); -@@ -3003,6 +3009,56 @@ static void mov_create_chapter_track(AVFormatContext *s, int tracknum) - } - } - -+// st->disposition controls the "enabled" flag in the tkhd tag. -+// QuickTime will not play a track if it is not enabled. So make sure -+// that one track of each type (audio, video, subtitle) is enabled. -+// -+// Subtitles are special. For audio and video, setting "enabled" also -+// makes the track "default" (i.e. it is rendered when played). For -+// subtitles, an "enabled" subtitle is not rendered by default, but -+// if no subtitle is enabled, the subtitle menu in QuickTime will be -+// empty! -+static void enable_tracks(AVFormatContext *s) -+{ -+ MOVMuxContext *mov = s->priv_data; -+ int i; -+ uint8_t enabled[AVMEDIA_TYPE_NB]; -+ int first[AVMEDIA_TYPE_NB]; -+ -+ for (i = 0; i < AVMEDIA_TYPE_NB; i++) { -+ enabled[i] = 0; -+ first[i] = -1; -+ } -+ -+ for (i = 0; i < s->nb_streams; i++) { -+ AVStream *st = s->streams[i]; -+ -+ if (st->codec->codec_type <= AVMEDIA_TYPE_UNKNOWN || -+ st->codec->codec_type >= AVMEDIA_TYPE_NB) -+ continue; -+ -+ if (first[st->codec->codec_type] < 0) -+ first[st->codec->codec_type] = i; -+ if (st->disposition & AV_DISPOSITION_DEFAULT) { -+ mov->tracks[i].flags |= MOV_TRACK_ENABLED; -+ enabled[st->codec->codec_type] = 1; -+ } -+ } -+ -+ for (i = 0; i < AVMEDIA_TYPE_NB; i++) { -+ switch (i) { -+ case AVMEDIA_TYPE_VIDEO: -+ case AVMEDIA_TYPE_AUDIO: -+ case AVMEDIA_TYPE_SUBTITLE: -+ if (!enabled[i] && first[i] >= 0) -+ mov->tracks[first[i]].flags |= MOV_TRACK_ENABLED; -+ break; -+ default: -+ break; -+ } -+ } -+} -+ - static int mov_write_header(AVFormatContext *s) - { - AVIOContext *pb = s->pb; -@@ -3156,6 +3212,8 @@ static int mov_write_header(AVFormatContext *s) - } - } - -+ enable_tracks(s); -+ - if (mov->mode == MODE_ISM) { - /* If no fragmentation options have been set, set a default. */ - if (!(mov->flags & (FF_MOV_FLAG_FRAG_KEYFRAME | -diff --git a/libavformat/movenc.h b/libavformat/movenc.h -index 3ea0dd5..9bb8a78 100644 ---- a/libavformat/movenc.h -+++ b/libavformat/movenc.h -@@ -84,6 +84,7 @@ typedef struct MOVIndex { - int has_keyframes; - #define MOV_TRACK_CTTS 0x0001 - #define MOV_TRACK_STPS 0x0002 -+#define MOV_TRACK_ENABLED 0x0004 - uint32_t flags; - int language; - int track_id; --- -1.8.1.4 - diff --git a/contrib/ffmpeg/A11-mp4-chapter-properties.patch b/contrib/ffmpeg/A11-mp4-chapter-properties.patch deleted file mode 100644 index 9f64af2cb..000000000 --- a/contrib/ffmpeg/A11-mp4-chapter-properties.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 9393762b54c17abd736f8d5dd96cd22c334989da Mon Sep 17 00:00:00 2001 -From: John Stebbins <[email protected]> -Date: Fri, 10 May 2013 09:19:16 -0700 -Subject: [PATCH 9/9] movenc: Make chapter track QuickTime compatible - -QuickTime requires that the stsd.text box be completely filled in. ---- - libavformat/movenc.c | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) - -diff --git a/libavformat/movenc.c b/libavformat/movenc.c -index bc77a6f..96adfd7 100644 ---- a/libavformat/movenc.c -+++ b/libavformat/movenc.c -@@ -2982,12 +2982,17 @@ static void mov_create_chapter_track(AVFormatContext *s, int tracknum) - MOVTrack *track = &mov->tracks[tracknum]; - AVPacket pkt = { .stream_index = tracknum, .flags = AV_PKT_FLAG_KEY }; - int i, len; -+ // These properties are required to make QT recognize the chapter track -+ uint8_t chapter_properties[43] = {0, 0, 0, 0, 0, 0, 0, 1,}; - - track->mode = mov->mode; - track->tag = MKTAG('t','e','x','t'); - track->timescale = MOV_TIMESCALE; - track->enc = avcodec_alloc_context3(NULL); - track->enc->codec_type = AVMEDIA_TYPE_SUBTITLE; -+ track->enc->extradata = av_malloc(43); -+ track->enc->extradata_size = 43; -+ memcpy(track->enc->extradata, chapter_properties, 43); - - for (i = 0; i < s->nb_chapters; i++) { - AVChapter *c = s->chapters[i]; -@@ -3443,8 +3448,10 @@ static int mov_write_trailer(AVFormatContext *s) - mov_write_mfra_tag(pb, mov); - } - -- if (mov->chapter_track) -+ if (mov->chapter_track) { -+ av_free(mov->tracks[mov->chapter_track].enc->extradata); - av_freep(&mov->tracks[mov->chapter_track].enc); -+ } - - for (i=0; i<mov->nb_streams; i++) { - if (mov->tracks[i].tag == MKTAG('r','t','p',' ')) --- -1.8.1.4 - diff --git a/contrib/ffmpeg/P01-solaris.patch b/contrib/ffmpeg/P01-solaris.patch index 399aabc3a..fc0aeb287 100644 --- a/contrib/ffmpeg/P01-solaris.patch +++ b/contrib/ffmpeg/P01-solaris.patch @@ -1,13 +1,13 @@ diff --git a/configure b/configure -index 6ab04ae..1c8ab46 100755 +index e9fc08c..86ebc37 100755 --- a/configure +++ b/configure -@@ -3171,7 +3171,7 @@ EOF +@@ -3589,7 +3589,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 - if enabled alpha; then + check_inline_asm inline_asm_labels '"1:\n"' diff --git a/contrib/ffmpeg/P02-darwin-pic.patch b/contrib/ffmpeg/P02-darwin-pic.patch index f512416a1..fc43504bc 100644 --- a/contrib/ffmpeg/P02-darwin-pic.patch +++ b/contrib/ffmpeg/P02-darwin-pic.patch @@ -1,21 +1,21 @@ diff --git a/configure b/configure -index 6ab04ae..fa9f980 100755 +index e9fc08c..72bff03 100755 --- a/configure +++ b/configure -@@ -2893,6 +2893,7 @@ case $target_os in - AVSERVERLDFLAGS=-Wl,-bind_at_load +@@ -3263,6 +3263,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; } ;; -@@ -3095,7 +3096,7 @@ esc(){ +@@ -3502,7 +3503,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 pic -+#check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable pic +-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 diff --git a/contrib/ffmpeg/module.defs b/contrib/ffmpeg/module.defs index 34469582d..6f39c8e1c 100644 --- a/contrib/ffmpeg/module.defs +++ b/contrib/ffmpeg/module.defs @@ -5,7 +5,7 @@ $(eval $(call import.MODULE.defs,FFMPEG,ffmpeg,YASM BZIP2 ZLIB FDKAAC)) endif $(eval $(call import.CONTRIB.defs,FFMPEG)) -FFMPEG.FETCH.url = http://download.handbrake.fr/handbrake/contrib/libav-v9.6.tar.bz2 +FFMPEG.FETCH.url = http://download.handbrake.fr/handbrake/contrib/libav-v10_alpha1-90-g63debaa.tar.bz2 FFMPEG.CONFIGURE.deps = FFMPEG.CONFIGURE.env = |