From 0646bd60a8f672a003195e1c83ebbcb08d05aa99 Mon Sep 17 00:00:00 2001 From: jstebbins Date: Sat, 15 Oct 2011 21:32:20 +0000 Subject: bump Libav from v0.7.1 to v0.7-1241-g5f3fb59 Fixes VC-1 decode issue Adds partial support for interlaced VC-1 decode Adds ProRes decoder Fixes ac3 encoder dolby flag Fixes DCA frame size setting (delete patch A04) Fixes VC-1 repeat field processing (delete patch A05) Numerous other bug fixes and enhancements git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4291 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- contrib/ffmpeg/A01-mpegleak.patch | 14 ++-- contrib/ffmpeg/A02-audioconvert.patch | 4 +- contrib/ffmpeg/A03-png-sequences.patch | 2 +- contrib/ffmpeg/A04-channel-layout-order.patch | 86 ++++++++++++++++++++++++ contrib/ffmpeg/A04-dca-frame-size.patch | 12 ---- contrib/ffmpeg/A05-vc1-pulldown.patch | 96 --------------------------- contrib/ffmpeg/A06-h264-recovery-point.patch | 18 +++-- contrib/ffmpeg/P01-solaris.patch | 4 +- contrib/ffmpeg/P02-darwin-pic.patch | 8 +-- contrib/ffmpeg/module.defs | 7 +- 10 files changed, 120 insertions(+), 131 deletions(-) create mode 100644 contrib/ffmpeg/A04-channel-layout-order.patch delete mode 100644 contrib/ffmpeg/A04-dca-frame-size.patch delete mode 100644 contrib/ffmpeg/A05-vc1-pulldown.patch (limited to 'contrib') diff --git a/contrib/ffmpeg/A01-mpegleak.patch b/contrib/ffmpeg/A01-mpegleak.patch index 555be9228..214e9caf9 100644 --- a/contrib/ffmpeg/A01-mpegleak.patch +++ b/contrib/ffmpeg/A01-mpegleak.patch @@ -1,8 +1,8 @@ diff --git a/libavcodec/h264.c b/libavcodec/h264.c -index 2c000a3..93850d6 100644 +index 9889224..041fccf 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c -@@ -3908,7 +3908,7 @@ static int decode_frame(AVCodecContext *avctx, +@@ -3848,7 +3848,7 @@ static int decode_frame(AVCodecContext *avctx, if(!(s->flags2 & CODEC_FLAG2_CHUNKS) && !s->current_picture_ptr){ if (avctx->skip_frame >= AVDISCARD_NONREF) return 0; @@ -12,10 +12,10 @@ index 2c000a3..93850d6 100644 } diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c -index a025f7d..eda5e41 100644 +index 1f30916..dce88f3 100644 --- a/libavcodec/h264_refs.c +++ b/libavcodec/h264_refs.c -@@ -628,7 +628,7 @@ int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count){ +@@ -634,7 +634,7 @@ int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count){ * stream. Need to discard one frame. Prevents overrun of the * short_ref and long_ref buffers. */ @@ -25,10 +25,10 @@ index a025f7d..eda5e41 100644 "corrupt input), discarding one\n", h->long_ref_count, h->short_ref_count, h->sps.ref_frame_count); diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c -index 4978d28..bb9509f 100644 +index e418e95..87cb73c 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c -@@ -986,19 +986,18 @@ int ff_find_unused_picture(MpegEncContext *s, int shared){ +@@ -1004,19 +1004,18 @@ int ff_find_unused_picture(MpegEncContext *s, int shared){ } av_log(s->avctx, AV_LOG_FATAL, "Internal error, picture buffer overflow\n"); @@ -52,7 +52,7 @@ index 4978d28..bb9509f 100644 + * the oldest we have & reusing its slot. */ + int oldest=0; + for(i=0; ipicture[i].coded_picture_number < s->picture[oldest].coded_picture_number) ++ if (s->picture[i].f.coded_picture_number < s->picture[oldest].f.coded_picture_number) + oldest = i; + } + s->avctx->release_buffer(s->avctx, (AVFrame*)&s->picture[oldest]); diff --git a/contrib/ffmpeg/A02-audioconvert.patch b/contrib/ffmpeg/A02-audioconvert.patch index f8481240b..5248a9fd3 100644 --- a/contrib/ffmpeg/A02-audioconvert.patch +++ b/contrib/ffmpeg/A02-audioconvert.patch @@ -1,8 +1,8 @@ diff --git a/libavcodec/Makefile b/libavcodec/Makefile -index 0cfa08c..f9c407e 100644 +index 3c4e2f8..fe84b8c 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile -@@ -3,7 +3,7 @@ include $(SUBDIR)../config.mak +@@ -1,7 +1,7 @@ NAME = avcodec FFLIBS = avutil diff --git a/contrib/ffmpeg/A03-png-sequences.patch b/contrib/ffmpeg/A03-png-sequences.patch index 5be83fbb4..66fe1f7c3 100644 --- a/contrib/ffmpeg/A03-png-sequences.patch +++ b/contrib/ffmpeg/A03-png-sequences.patch @@ -1,5 +1,5 @@ diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c -index 7477f67..9e8e29b 100644 +index a40cebb..26239e2 100644 --- a/libavcodec/pngdec.c +++ b/libavcodec/pngdec.c @@ -599,6 +599,18 @@ static int decode_frame(AVCodecContext *avctx, diff --git a/contrib/ffmpeg/A04-channel-layout-order.patch b/contrib/ffmpeg/A04-channel-layout-order.patch new file mode 100644 index 000000000..99faa5ddc --- /dev/null +++ b/contrib/ffmpeg/A04-channel-layout-order.patch @@ -0,0 +1,86 @@ +diff --git a/libavcodec/Makefile b/libavcodec/Makefile +index 3c4e2f8..5cfd1bf 100644 +--- a/libavcodec/Makefile ++++ b/libavcodec/Makefile +@@ -142,7 +142,7 @@ OBJS-$(CONFIG_FFV1_DECODER) += ffv1.o rangecoder.o + OBJS-$(CONFIG_FFV1_ENCODER) += ffv1.o rangecoder.o + OBJS-$(CONFIG_FFVHUFF_DECODER) += huffyuv.o + OBJS-$(CONFIG_FFVHUFF_ENCODER) += huffyuv.o +-OBJS-$(CONFIG_FLAC_DECODER) += flacdec.o flacdata.o flac.o ++OBJS-$(CONFIG_FLAC_DECODER) += flacdec.o flacdata.o flac.o vorbis_data.o + OBJS-$(CONFIG_FLAC_ENCODER) += flacenc.o flacdata.o flac.o + OBJS-$(CONFIG_FLASHSV_DECODER) += flashsv.o + OBJS-$(CONFIG_FLASHSV_ENCODER) += flashsvenc.o +diff --git a/libavcodec/flac.c b/libavcodec/flac.c +index e6a427a..397155e 100644 +--- a/libavcodec/flac.c ++++ b/libavcodec/flac.c +@@ -22,6 +22,7 @@ + #include "libavutil/crc.h" + #include "flac.h" + #include "flacdata.h" ++#include "vorbis.h" + + static const int8_t sample_size_table[] = { 0, 8, 12, 0, 16, 20, 24, 0 }; + +@@ -54,9 +55,12 @@ int ff_flac_decode_frame_header(AVCodecContext *avctx, GetBitContext *gb, + fi->ch_mode = get_bits(gb, 4); + if (fi->ch_mode < FLAC_MAX_CHANNELS) { + fi->channels = fi->ch_mode + 1; ++ if (fi->ch_mode <= 5) ++ avctx->channel_layout = ff_vorbis_channel_layouts[fi->ch_mode]; + fi->ch_mode = FLAC_CHMODE_INDEPENDENT; + } else if (fi->ch_mode <= FLAC_CHMODE_MID_SIDE) { + fi->channels = 2; ++ avctx->channel_layout = AV_CH_LAYOUT_STEREO; + } else { + av_log(avctx, AV_LOG_ERROR + log_level_offset, + "invalid channel mode: %d\n", fi->ch_mode); +diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c +index c90285a..58235c8 100644 +--- a/libavcodec/mlpdec.c ++++ b/libavcodec/mlpdec.c +@@ -133,6 +133,9 @@ typedef struct MLPDecodeContext { + //! Index of the last substream to decode - further substreams are skipped. + uint8_t max_decoded_substream; + ++ //! Stream needs channel reordering to comply with FFmpeg's channel order ++ uint8_t needs_reordering; ++ + //! number of PCM samples contained in each frame + int access_unit_size; + //! next power of two above the number of samples in each frame +@@ -326,6 +329,8 @@ static int read_major_sync(MLPDecodeContext *m, GetBitContext *gb) + for (substr = 0; substr < MAX_SUBSTREAMS; substr++) + m->substream[substr].restart_seen = 0; + ++ m->needs_reordering = mh.channels_mlp >= 18 && mh.channels_mlp <= 20; ++ + return 0; + } + +@@ -436,6 +441,24 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp, + s->ch_assign[ch_assign] = ch; + } + ++ if (m->avctx->codec_id == CODEC_ID_MLP && m->needs_reordering) { ++ if (m->avctx->channel_layout == (AV_CH_LAYOUT_2_2|AV_CH_LOW_FREQUENCY) || ++ m->avctx->channel_layout == AV_CH_LAYOUT_5POINT0) { ++ int i = s->ch_assign[4]; ++ s->ch_assign[4] = s->ch_assign[3]; ++ s->ch_assign[3] = s->ch_assign[2]; ++ s->ch_assign[2] = i; ++ } else if (m->avctx->channel_layout == AV_CH_LAYOUT_5POINT1) { ++ FFSWAP(int, s->ch_assign[2], s->ch_assign[4]); ++ FFSWAP(int, s->ch_assign[3], s->ch_assign[5]); ++ } ++ } ++ if (m->avctx->codec_id == CODEC_ID_TRUEHD && ++ m->avctx->channel_layout == AV_CH_LAYOUT_7POINT1) { ++ FFSWAP(int, s->ch_assign[4], s->ch_assign[6]); ++ FFSWAP(int, s->ch_assign[5], s->ch_assign[7]); ++ } ++ + checksum = ff_mlp_restart_checksum(buf, get_bits_count(gbp) - start_count); + + if (checksum != get_bits(gbp, 8)) diff --git a/contrib/ffmpeg/A04-dca-frame-size.patch b/contrib/ffmpeg/A04-dca-frame-size.patch deleted file mode 100644 index 5af1040b2..000000000 --- a/contrib/ffmpeg/A04-dca-frame-size.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/libavcodec/dca.c b/libavcodec/dca.c -index 68731c9..cf62c48 100644 ---- a/libavcodec/dca.c -+++ b/libavcodec/dca.c -@@ -1650,6 +1650,7 @@ static int dca_decode_frame(AVCodecContext * avctx, - //set AVCodec values with parsed data - avctx->sample_rate = s->sample_rate; - avctx->bit_rate = s->bit_rate; -+ avctx->frame_size = s->sample_blocks * 32; - - s->profile = FF_PROFILE_DTS; - diff --git a/contrib/ffmpeg/A05-vc1-pulldown.patch b/contrib/ffmpeg/A05-vc1-pulldown.patch deleted file mode 100644 index ff93bd119..000000000 --- a/contrib/ffmpeg/A05-vc1-pulldown.patch +++ /dev/null @@ -1,96 +0,0 @@ -diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c -index 243bef5..d20b000 100644 ---- a/libavcodec/vc1.c -+++ b/libavcodec/vc1.c -@@ -504,6 +504,10 @@ static int decode_sequence_header_adv(VC1Context *v, GetBitContext *gb) - v->s.avctx->time_base.den = ff_vc1_fps_nr[nr - 1] * 1000; - } - } -+ if(v->broadcast) { // Pulldown may be present -+ v->s.avctx->time_base.den *= 2; -+ v->s.avctx->ticks_per_frame = 2; -+ } - } - - if(get_bits1(gb)){ -@@ -821,7 +825,7 @@ int vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb) - case 4: - v->s.pict_type = AV_PICTURE_TYPE_P; // skipped pic - v->p_frame_skipped = 1; -- return 0; -+ break; - } - if(v->tfcntrflag) - skip_bits(gb, 8); -@@ -830,13 +834,16 @@ int vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb) - v->rptfrm = get_bits(gb, 2); - } else { - v->tff = get_bits1(gb); -- v->rptfrm = get_bits1(gb); -+ v->rff = get_bits1(gb); - } - } - if(v->panscanflag) { - av_log_missing_feature(v->s.avctx, "Pan-scan", 0); - //... - } -+ if(v->p_frame_skipped) { -+ return 0; -+ } - v->rnd = get_bits1(gb); - if(v->interlace) - v->uvsamp = get_bits1(gb); -diff --git a/libavcodec/vc1_parser.c b/libavcodec/vc1_parser.c -index 27ff1bd..4151119 100644 ---- a/libavcodec/vc1_parser.c -+++ b/libavcodec/vc1_parser.c -@@ -45,6 +45,7 @@ static void vc1_extract_headers(AVCodecParserContext *s, AVCodecContext *avctx, - vpc->v.s.avctx = avctx; - vpc->v.parse_only = 1; - next = buf; -+ s->repeat_pict = 0; - - for(start = buf, end = buf + buf_size; next < end; start = next){ - int buf2_size, size; -@@ -73,6 +74,18 @@ static void vc1_extract_headers(AVCodecParserContext *s, AVCodecContext *avctx, - else - s->pict_type = vpc->v.s.pict_type; - -+ // process pulldown flags -+ s->repeat_pict = 1; -+ // Pulldown flags are only valid when 'broadcast' has been set. -+ // So ticks_per_frame will be 2 -+ if (vpc->v.rff){ -+ // repeat field -+ s->repeat_pict = 2; -+ }else if (vpc->v.rptfrm){ -+ // repeat frames -+ s->repeat_pict = vpc->v.rptfrm * 2 + 1; -+ } -+ - break; - } - } -diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c -index ae7906d..58cb8c0 100644 ---- a/libavcodec/vc1dec.c -+++ b/libavcodec/vc1dec.c -@@ -3698,6 +3698,18 @@ static int vc1_decode_frame(AVCodecContext *avctx, - av_log(v->s.avctx, AV_LOG_WARNING, "Sprite decoder: expected I-frame\n"); - } - -+ // process pulldown flags -+ s->current_picture_ptr->repeat_pict = 0; -+ // Pulldown flags are only valid when 'broadcast' has been set. -+ // So ticks_per_frame will be 2 -+ if (v->rff){ -+ // repeat field -+ s->current_picture_ptr->repeat_pict = 1; -+ }else if (v->rptfrm){ -+ // repeat frames -+ s->current_picture_ptr->repeat_pict = v->rptfrm * 2; -+ } -+ - // for skipping the frame - s->current_picture.f.pict_type = s->pict_type; - s->current_picture.f.key_frame = s->pict_type == AV_PICTURE_TYPE_I; diff --git a/contrib/ffmpeg/A06-h264-recovery-point.patch b/contrib/ffmpeg/A06-h264-recovery-point.patch index 8b1531444..61442bd44 100644 --- a/contrib/ffmpeg/A06-h264-recovery-point.patch +++ b/contrib/ffmpeg/A06-h264-recovery-point.patch @@ -1,23 +1,31 @@ diff --git a/libavcodec/h264.c b/libavcodec/h264.c -index d047448..e96a129 100644 +index 9889224..ae77285 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c -@@ -3654,9 +3654,18 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){ +@@ -2229,6 +2229,7 @@ static void flush_dpb(AVCodecContext *avctx){ + h->s.first_field= 0; + ff_h264_reset_sei(h); + ff_mpeg_flush(avctx); ++ h->recovery_frame= -1; + } + + static int init_poc(H264Context *h){ +@@ -3654,9 +3655,18 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){ if((err = decode_slice_header(hx, h))) break; -+ if (h->sei_recovery_frame_cnt >= 0) { ++ 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->key_frame |= + 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->key_frame |= 1; ++ s->current_picture_ptr->f.key_frame |= 1; + h->recovery_frame = -1; + } diff --git a/contrib/ffmpeg/P01-solaris.patch b/contrib/ffmpeg/P01-solaris.patch index d807d76de..d9bb05be2 100644 --- a/contrib/ffmpeg/P01-solaris.patch +++ b/contrib/ffmpeg/P01-solaris.patch @@ -1,5 +1,5 @@ diff --git a/configure b/configure -index 5e40e08..12d6232 100755 +index e01d9fd..69ba7ea 100755 --- a/configure +++ b/configure @@ -54,6 +54,9 @@ if test "$E1" != 0 || test "$E2" = 0; then @@ -12,7 +12,7 @@ index 5e40e08..12d6232 100755 show_help(){ cat <config.fate diff --git a/contrib/ffmpeg/module.defs b/contrib/ffmpeg/module.defs index 732b7778a..e231c5547 100644 --- a/contrib/ffmpeg/module.defs +++ b/contrib/ffmpeg/module.defs @@ -1,7 +1,7 @@ $(eval $(call import.MODULE.defs,FFMPEG,ffmpeg,BZIP2 ZLIB)) $(eval $(call import.CONTRIB.defs,FFMPEG)) -FFMPEG.FETCH.url = http://download.handbrake.fr/handbrake/contrib/ffmpeg-v0.7.1.tar.bz2 +FFMPEG.FETCH.url = http://download.handbrake.fr/handbrake/contrib/ffmpeg-v0.7-1318-g91038cd.tar.bz2 FFMPEG.CONFIGURE.deps = FFMPEG.CONFIGURE.env = @@ -12,7 +12,10 @@ FFMPEG.CONFIGURE.extra = \ --disable-bsfs \ --disable-encoders \ --disable-ffmpeg \ - --disable-ffserver \ + --disable-avconv \ + --disable-avplay \ + --disable-avprobe \ + --disable-avserver \ --disable-muxers \ --disable-network \ --disable-vaapi \ -- cgit v1.2.3