summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2010-04-25 21:15:43 +0000
committerjstebbins <[email protected]>2010-04-25 21:15:43 +0000
commitc22e82ad0081856466a92a6e47a72b3ea9b5628c (patch)
tree4118bfdb4913105820b98e7317021704c8f39faa
parente6ba7dc071b0b1f070b7f92e3b30eab1ee00a0b5 (diff)
bump ffmpeg to rev 22950
offset ffmpeg seeks by value of initial timestamp since it can be non-zero catch pix fmt that is unsupported by swscale, log it, skip the track use new ffmpeg avg_frame_rate for more accurate framerate estimate git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3267 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--contrib/ffmpeg/A00-latm.patch147
-rw-r--r--contrib/ffmpeg/A01-mpegleak.patch30
-rw-r--r--contrib/ffmpeg/A02-audioconvert.patch11
-rw-r--r--contrib/ffmpeg/A03-png-sequences.patch4
-rw-r--r--contrib/ffmpeg/A04-mov-seek.patch13
-rw-r--r--contrib/ffmpeg/P01-solaris.patch8
-rw-r--r--contrib/ffmpeg/P02-darwin-pic.patch27
-rw-r--r--contrib/ffmpeg/module.defs5
-rw-r--r--libhb/decavcodec.c10
-rw-r--r--libhb/stream.c21
-rw-r--r--make/include/contrib.defs2
11 files changed, 168 insertions, 110 deletions
diff --git a/contrib/ffmpeg/A00-latm.patch b/contrib/ffmpeg/A00-latm.patch
index 28196b74d..192d703cc 100644
--- a/contrib/ffmpeg/A00-latm.patch
+++ b/contrib/ffmpeg/A00-latm.patch
@@ -1,8 +1,8 @@
-Index: ffmpeg-r20817/libavcodec/allcodecs.c
+Index: ffmpeg-r22950/libavcodec/allcodecs.c
===================================================================
---- ffmpeg-r20817/libavcodec/allcodecs.c (revision 20817)
-+++ ffmpeg-r20817/libavcodec/allcodecs.c (working copy)
-@@ -314,6 +314,7 @@
+--- ffmpeg-r22950/libavcodec/allcodecs.c (revision 22950)
++++ ffmpeg-r22950/libavcodec/allcodecs.c (working copy)
+@@ -334,6 +334,7 @@
REGISTER_ENCDEC (LIBDIRAC, libdirac);
REGISTER_ENCODER (LIBFAAC, libfaac);
REGISTER_DECODER (LIBFAAD, libfaad);
@@ -10,7 +10,7 @@ Index: ffmpeg-r20817/libavcodec/allcodecs.c
REGISTER_ENCDEC (LIBGSM, libgsm);
REGISTER_ENCDEC (LIBGSM_MS, libgsm_ms);
REGISTER_ENCODER (LIBMP3LAME, libmp3lame);
-@@ -329,6 +330,7 @@
+@@ -349,6 +350,7 @@
/* parsers */
REGISTER_PARSER (AAC, aac);
@@ -18,11 +18,11 @@ Index: ffmpeg-r20817/libavcodec/allcodecs.c
REGISTER_PARSER (AC3, ac3);
REGISTER_PARSER (CAVSVIDEO, cavsvideo);
REGISTER_PARSER (DCA, dca);
-Index: ffmpeg-r20817/libavcodec/avcodec.h
+Index: ffmpeg-r22950/libavcodec/avcodec.h
===================================================================
---- ffmpeg-r20817/libavcodec/avcodec.h (revision 20817)
-+++ ffmpeg-r20817/libavcodec/avcodec.h (working copy)
-@@ -276,6 +276,7 @@
+--- ffmpeg-r22950/libavcodec/avcodec.h (revision 22950)
++++ ffmpeg-r22950/libavcodec/avcodec.h (working copy)
+@@ -286,6 +286,7 @@
CODEC_ID_MP2= 0x15000,
CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3
CODEC_ID_AAC,
@@ -30,11 +30,11 @@ Index: ffmpeg-r20817/libavcodec/avcodec.h
CODEC_ID_AC3,
CODEC_ID_DTS,
CODEC_ID_VORBIS,
-Index: ffmpeg-r20817/libavcodec/Makefile
+Index: ffmpeg-r22950/libavcodec/Makefile
===================================================================
---- ffmpeg-r20817/libavcodec/Makefile (revision 20817)
-+++ ffmpeg-r20817/libavcodec/Makefile (working copy)
-@@ -474,7 +474,7 @@
+--- ffmpeg-r22950/libavcodec/Makefile (revision 22950)
++++ ffmpeg-r22950/libavcodec/Makefile (working copy)
+@@ -505,7 +505,7 @@
OBJS-$(CONFIG_LIBDIRAC_DECODER) += libdiracdec.o
OBJS-$(CONFIG_LIBDIRAC_ENCODER) += libdiracenc.o libdirac_libschro.o
OBJS-$(CONFIG_LIBFAAC_ENCODER) += libfaac.o
@@ -43,7 +43,7 @@ Index: ffmpeg-r20817/libavcodec/Makefile
OBJS-$(CONFIG_LIBGSM_DECODER) += libgsm.o
OBJS-$(CONFIG_LIBGSM_ENCODER) += libgsm.o
OBJS-$(CONFIG_LIBGSM_MS_DECODER) += libgsm.o
-@@ -498,7 +498,7 @@
+@@ -529,7 +529,7 @@
# parsers
OBJS-$(CONFIG_AAC_PARSER) += aac_parser.o aac_ac3_parser.o \
@@ -52,11 +52,11 @@ Index: ffmpeg-r20817/libavcodec/Makefile
OBJS-$(CONFIG_AC3_PARSER) += ac3_parser.o ac3tab.o \
aac_ac3_parser.o
OBJS-$(CONFIG_CAVSVIDEO_PARSER) += cavs_parser.o
-Index: ffmpeg-r20817/libavcodec/latmaac.c
+Index: ffmpeg-r22950/libavcodec/latmaac.c
===================================================================
---- ffmpeg-r20817/libavcodec/latmaac.c (revision 0)
-+++ ffmpeg-r20817/libavcodec/latmaac.c (revision 0)
-@@ -0,0 +1,625 @@
+--- ffmpeg-r22950/libavcodec/latmaac.c (revision 0)
++++ ffmpeg-r22950/libavcodec/latmaac.c (revision 0)
+@@ -0,0 +1,642 @@
+/*
+ * copyright (c) 2008 Paul Kendall <[email protected]>
+ *
@@ -167,14 +167,17 @@ Index: ffmpeg-r20817/libavcodec/latmaac.c
+
+static void readGASpecificConfig(struct AACConfig *cfg, GetBitContext *b, PutBitContext *o)
+{
-+ int framelen_flag = get_bits(b, 1);
-+ put_bits(o, 1, framelen_flag);
-+ int dependsOnCoder = get_bits(b, 1);
-+ put_bits(o, 1, dependsOnCoder);
++ int framelen_flag;
++ int dependsOnCoder;
+ int ext_flag;
+ int delay;
+ int layerNr;
+
++ framelen_flag = get_bits(b, 1);
++ put_bits(o, 1, framelen_flag);
++ dependsOnCoder = get_bits(b, 1);
++ put_bits(o, 1, dependsOnCoder);
++
+ if (dependsOnCoder) {
+ delay = get_bits(b, 14);
+ put_bits(o, 14, delay);
@@ -213,13 +216,16 @@ Index: ffmpeg-r20817/libavcodec/latmaac.c
+
+static int readAudioSpecificConfig(struct AACConfig *cfg, GetBitContext *b)
+{
++ int ret;
++ int sbr_present;
+ PutBitContext o;
++
+ init_put_bits(&o, cfg->extra, sizeof(cfg->extra));
+
+ // returns the number of bits read
-+ int ret = 0;
-+ int sbr_present = -1;
+
++ ret = 0;
++ sbr_present = -1;
+ // object
+ cfg->audioObjectType = get_bits(b, 5);
+ put_bits(&o, 5, cfg->audioObjectType);
@@ -287,6 +293,8 @@ Index: ffmpeg-r20817/libavcodec/latmaac.c
+ }
+
+ if (parser->audio_mux_version_A == 0) {
++ int frame_length_type;
++
+ if (parser->audio_mux_version == 1) {
+ parser->taraFullness = latm_get_value(b);
+ }
@@ -314,7 +322,7 @@ Index: ffmpeg-r20817/libavcodec/latmaac.c
+ }
+
+ // these are not needed... perhaps
-+ int frame_length_type = get_bits(b, 3);
++ frame_length_type = get_bits(b, 3);
+ parser->frameLengthType = frame_length_type;
+ if (frame_length_type == 0) {
+ get_bits(b, 8);
@@ -323,10 +331,12 @@ Index: ffmpeg-r20817/libavcodec/latmaac.c
+ } else if (frame_length_type == 3 ||
+ frame_length_type == 4 ||
+ frame_length_type == 5) {
-+ int celp_table_index = get_bits(b, 6);
++ int celp_table_index;
++ celp_table_index = get_bits(b, 6);
+ } else if (frame_length_type == 6 ||
+ frame_length_type == 7) {
-+ int hvxc_table_index = get_bits(b, 1);
++ int hvxc_table_index;
++ hvxc_table_index = get_bits(b, 1);
+ }
+
+ // other data
@@ -337,8 +347,8 @@ Index: ffmpeg-r20817/libavcodec/latmaac.c
+ parser->other_data_bits = latm_get_value(b);
+ } else {
+ // other data not present
-+ parser->other_data_bits = 0;
+ int esc, tmp;
++ parser->other_data_bits = 0;
+ do {
+ parser->other_data_bits <<= 8;
+ esc = get_bits(b, 1);
@@ -401,9 +411,10 @@ Index: ffmpeg-r20817/libavcodec/latmaac.c
+
+static int readAudioSyncStream(struct AACParser *parser, GetBitContext *b, int size, uint8_t *payload, int *payloadsize)
+{
++ int muxlength;
+ // ISO/IEC 14496-3 Table 1.28 - Syntax of AudioMuxElement()
+ if (get_bits(b, 11) != 0x2b7) return -1; // not LATM
-+ int muxlength = get_bits(b, 13);
++ muxlength = get_bits(b, 13);
+
+ if (3+muxlength > size) return 0; // not enough data
+
@@ -528,7 +539,11 @@ Index: ffmpeg-r20817/libavcodec/latmaac.c
+
+ // are we going to initialize from decoder specific info ?
+ if (decoder->parser->config.extrasize > 0) {
-+ char ret = NeAACDecInit2(decoder->aac_decoder, (unsigned char*)decoder->parser->config.extra, decoder->parser->config.extrasize, &decoder->in_samplerate, &decoder->in_channels);
++ char ret;
++ unsigned long samplerate;
++
++ ret = NeAACDecInit2(decoder->aac_decoder, (unsigned char*)decoder->parser->config.extra, decoder->parser->config.extrasize, &samplerate, &decoder->in_channels);
++ decoder->in_samplerate = samplerate;
+ if (ret < 0) {
+ aac_filter_close(decoder); // gone wrong ?
+ return -1;
@@ -541,7 +556,7 @@ Index: ffmpeg-r20817/libavcodec/latmaac.c
+ return 0;
+}
+
-+AACDecoder *aac_filter_create()
++static AACDecoder *aac_filter_create()
+{
+ AACDecoder *decoder = (AACDecoder *)av_malloc(sizeof(AACDecoder));
+ decoder->parser = latm_create_parser();
@@ -550,14 +565,14 @@ Index: ffmpeg-r20817/libavcodec/latmaac.c
+ return (void *)decoder;
+}
+
-+void aac_filter_destroy(AACDecoder *decoder)
++static void aac_filter_destroy(AACDecoder *decoder)
+{
+ aac_filter_close(decoder);
+ latm_destroy_parser(decoder->parser);
+ av_free(decoder);
+}
+
-+int aac_filter_receive(AACDecoder *decoder, void *out, int *out_size, uint8_t *data, int size)
++static int aac_filter_receive(AACDecoder *decoder, void *out, int *out_size, uint8_t *data, int size)
+{
+ uint8_t tempbuf[32*1024];
+ int ret;
@@ -574,6 +589,9 @@ Index: ffmpeg-r20817/libavcodec/latmaac.c
+ latm_write_data(decoder->parser, data, size);
+
+ do {
++ NeAACDecFrameInfo info;
++ void *buf;
++
+ ret = latm_parse_packet(decoder->parser, tempbuf, sizeof(tempbuf));
+ if (ret < 0) {
+ latm_flush(decoder->parser);
@@ -600,8 +618,7 @@ Index: ffmpeg-r20817/libavcodec/latmaac.c
+ //-------------------------------------------------------------------------
+ // Decode samples
+ //-------------------------------------------------------------------------
-+ NeAACDecFrameInfo info;
-+ void *buf = NeAACDecDecode(decoder->aac_decoder, &info, data, size);
++ buf = NeAACDecDecode(decoder->aac_decoder, &info, data, size);
+
+ if (buf) {
+ decoder->in_samplerate = info.samplerate;
@@ -631,7 +648,7 @@ Index: ffmpeg-r20817/libavcodec/latmaac.c
+ return consumed;
+}
+
-+void aac_filter_getinfo(AACDecoder *decoder, int *sample_rate, int *channels)
++static void aac_filter_getinfo(AACDecoder *decoder, int *sample_rate, int *channels)
+{
+ if(!decoder->open) return;
+ *sample_rate = decoder->in_samplerate;
@@ -682,10 +699,10 @@ Index: ffmpeg-r20817/libavcodec/latmaac.c
+ .decode = faac_decode_frame,
+ .long_name = "AAC over LATM",
+};
-Index: ffmpeg-r20817/libavcodec/latm_parser.c
+Index: ffmpeg-r22950/libavcodec/latm_parser.c
===================================================================
---- ffmpeg-r20817/libavcodec/latm_parser.c (revision 0)
-+++ ffmpeg-r20817/libavcodec/latm_parser.c (revision 0)
+--- ffmpeg-r22950/libavcodec/latm_parser.c (revision 0)
++++ ffmpeg-r22950/libavcodec/latm_parser.c (revision 0)
@@ -0,0 +1,128 @@
+/*
+ * LATM parser
@@ -815,20 +832,20 @@ Index: ffmpeg-r20817/libavcodec/latm_parser.c
+ ff_parse_close,
+ latm_split,
+};
-Index: ffmpeg-r20817/libavformat/mpegts.c
+Index: ffmpeg-r22950/libavformat/mpegts.c
===================================================================
---- ffmpeg-r20817/libavformat/mpegts.c (revision 20817)
-+++ ffmpeg-r20817/libavformat/mpegts.c (working copy)
-@@ -499,7 +499,7 @@
- { 0x04, CODEC_TYPE_AUDIO, CODEC_ID_MP3 },
- { 0x0f, CODEC_TYPE_AUDIO, CODEC_ID_AAC },
- { 0x10, CODEC_TYPE_VIDEO, CODEC_ID_MPEG4 },
-- { 0x11, CODEC_TYPE_AUDIO, CODEC_ID_AAC }, /* LATM syntax */
-+ { 0x11, CODEC_TYPE_AUDIO, CODEC_ID_AAC_LATM }, /* LATM syntax */
- { 0x1b, CODEC_TYPE_VIDEO, CODEC_ID_H264 },
- { 0xd1, CODEC_TYPE_VIDEO, CODEC_ID_DIRAC },
- { 0xea, CODEC_TYPE_VIDEO, CODEC_ID_VC1 },
-@@ -683,7 +683,7 @@
+--- ffmpeg-r22950/libavformat/mpegts.c (revision 22950)
++++ ffmpeg-r22950/libavformat/mpegts.c (working copy)
+@@ -497,7 +497,7 @@
+ { 0x04, AVMEDIA_TYPE_AUDIO, CODEC_ID_MP3 },
+ { 0x0f, AVMEDIA_TYPE_AUDIO, CODEC_ID_AAC },
+ { 0x10, AVMEDIA_TYPE_VIDEO, CODEC_ID_MPEG4 },
+- //{ 0x11, AVMEDIA_TYPE_AUDIO, CODEC_ID_AAC }, /* LATM syntax */
++ { 0x11, AVMEDIA_TYPE_AUDIO, CODEC_ID_AAC_LATM }, /* LATM syntax */
+ { 0x1b, AVMEDIA_TYPE_VIDEO, CODEC_ID_H264 },
+ { 0xd1, AVMEDIA_TYPE_VIDEO, CODEC_ID_DIRAC },
+ { 0xea, AVMEDIA_TYPE_VIDEO, CODEC_ID_VC1 },
+@@ -684,7 +684,7 @@
if ((!pes->st && pes->stream->nb_streams == MAX_STREAMS) ||
(pes->st && pes->st->discard == AVDISCARD_ALL) ||
@@ -837,10 +854,10 @@ Index: ffmpeg-r20817/libavformat/mpegts.c
goto skip;
/* stream not present in PMT */
-Index: ffmpeg-r20817/libavformat/mpegts.h
+Index: ffmpeg-r22950/libavformat/mpegts.h
===================================================================
---- ffmpeg-r20817/libavformat/mpegts.h (revision 20817)
-+++ ffmpeg-r20817/libavformat/mpegts.h (working copy)
+--- ffmpeg-r22950/libavformat/mpegts.h (revision 22950)
++++ ffmpeg-r22950/libavformat/mpegts.h (working copy)
@@ -49,6 +49,7 @@
#define STREAM_TYPE_PRIVATE_DATA 0x06
#define STREAM_TYPE_AUDIO_AAC 0x0f
@@ -849,11 +866,11 @@ Index: ffmpeg-r20817/libavformat/mpegts.h
#define STREAM_TYPE_VIDEO_H264 0x1b
#define STREAM_TYPE_VIDEO_VC1 0xea
#define STREAM_TYPE_VIDEO_DIRAC 0xd1
-Index: ffmpeg-r20817/libavformat/mpeg.c
+Index: ffmpeg-r22950/libavformat/mpeg.c
===================================================================
---- ffmpeg-r20817/libavformat/mpeg.c (revision 20817)
-+++ ffmpeg-r20817/libavformat/mpeg.c (working copy)
-@@ -282,7 +282,7 @@
+--- ffmpeg-r22950/libavformat/mpeg.c (revision 22950)
++++ ffmpeg-r22950/libavformat/mpeg.c (working copy)
+@@ -287,7 +287,7 @@
/* find matching stream */
if (!((startcode >= 0x1c0 && startcode <= 0x1df) ||
(startcode >= 0x1e0 && startcode <= 0x1ef) ||
@@ -862,20 +879,20 @@ Index: ffmpeg-r20817/libavformat/mpeg.c
goto redo;
if (ppos) {
*ppos = url_ftell(s->pb) - 4;
-@@ -449,6 +449,9 @@
+@@ -454,6 +454,9 @@
} else if(es_type == STREAM_TYPE_AUDIO_AAC){
codec_id = CODEC_ID_AAC;
- type = CODEC_TYPE_AUDIO;
+ type = AVMEDIA_TYPE_AUDIO;
+ } else if(es_type == STREAM_TYPE_AUDIO_AAC_LATM){
+ codec_id = CODEC_ID_AAC_LATM;
+ type = CODEC_TYPE_AUDIO;
} else if(es_type == STREAM_TYPE_VIDEO_MPEG4){
codec_id = CODEC_ID_MPEG4;
- type = CODEC_TYPE_VIDEO;
-Index: ffmpeg-r20817/libavformat/mpeg.h
+ type = AVMEDIA_TYPE_VIDEO;
+Index: ffmpeg-r22950/libavformat/mpeg.h
===================================================================
---- ffmpeg-r20817/libavformat/mpeg.h (revision 20817)
-+++ ffmpeg-r20817/libavformat/mpeg.h (working copy)
+--- ffmpeg-r22950/libavformat/mpeg.h (revision 22950)
++++ ffmpeg-r22950/libavformat/mpeg.h (working copy)
@@ -53,6 +53,7 @@
#define STREAM_TYPE_PRIVATE_DATA 0x06
#define STREAM_TYPE_AUDIO_AAC 0x0f
diff --git a/contrib/ffmpeg/A01-mpegleak.patch b/contrib/ffmpeg/A01-mpegleak.patch
index 7b3b9be24..49e99456d 100644
--- a/contrib/ffmpeg/A01-mpegleak.patch
+++ b/contrib/ffmpeg/A01-mpegleak.patch
@@ -1,8 +1,8 @@
Index: libavcodec/mpegvideo.c
===================================================================
---- ffmpeg.orig/libavcodec/mpegvideo.c (revision 20594)
+--- ffmpeg.orig/libavcodec/mpegvideo.c (revision 22823)
+++ ffmpeg/libavcodec/mpegvideo.c (working copy)
-@@ -834,19 +834,18 @@
+@@ -867,19 +867,18 @@
}
av_log(s->avctx, AV_LOG_FATAL, "Internal error, picture buffer overflow\n");
@@ -36,18 +36,9 @@ Index: libavcodec/mpegvideo.c
static void update_noise_reduction(MpegEncContext *s){
Index: libavcodec/h264.c
===================================================================
---- ffmpeg.orig/libavcodec/h264.c (revision 20594)
+--- ffmpeg.orig/libavcodec/h264.c (revision 22823)
+++ ffmpeg/libavcodec/h264.c (working copy)
-@@ -3411,7 +3411,7 @@
- * stream. Need to discard one frame. Prevents overrun of the
- * short_ref and long_ref buffers.
- */
-- av_log(h->s.avctx, AV_LOG_ERROR,
-+ av_log(h->s.avctx, AV_LOG_DEBUG,
- "number of reference frames exceeds max (probably "
- "corrupt input), discarding one\n");
-
-@@ -7786,7 +7786,7 @@
+@@ -2772,7 +2772,7 @@
if(!(s->flags2 & CODEC_FLAG2_CHUNKS) && !s->current_picture_ptr){
if (avctx->skip_frame >= AVDISCARD_NONREF || s->hurry_up) return 0;
@@ -56,3 +47,16 @@ Index: libavcodec/h264.c
return -1;
}
+Index: libavcodec/h264_refs.c
+===================================================================
+--- ffmpeg.orig/libavcodec/h264_refs.c (revision 22823)
++++ ffmpeg/libavcodec/h264_refs.c (working copy)
+@@ -608,7 +608,7 @@
+ * stream. Need to discard one frame. Prevents overrun of the
+ * short_ref and long_ref buffers.
+ */
+- av_log(h->s.avctx, AV_LOG_ERROR,
++ av_log(h->s.avctx, AV_LOG_DEBUG,
+ "number of reference frames exceeds max (probably "
+ "corrupt input), discarding one\n");
+
diff --git a/contrib/ffmpeg/A02-audioconvert.patch b/contrib/ffmpeg/A02-audioconvert.patch
index bec0cac7c..8bbb657d9 100644
--- a/contrib/ffmpeg/A02-audioconvert.patch
+++ b/contrib/ffmpeg/A02-audioconvert.patch
@@ -1,12 +1,13 @@
-diff -Naur ffmpeg.orig/libavcodec/Makefile ffmpeg/libavcodec/Makefile
---- ffmpeg.orig/libavcodec/Makefile 2008-12-01 01:40:36.000000000 -0500
-+++ ffmpeg/libavcodec/Makefile 2009-02-23 07:03:23.000000000 -0500
+Index: libavcodec/Makefile
+===================================================================
+--- ffmpeg.orig/libavcodec/Makefile (revision 22823)
++++ ffmpeg/libavcodec/Makefile (working copy)
@@ -3,7 +3,7 @@
NAME = avcodec
FFLIBS = avutil
--HEADERS = avcodec.h opt.h vdpau.h xvmc.h
-+HEADERS = avcodec.h opt.h vdpau.h xvmc.h audioconvert.h
+-HEADERS = avcodec.h avfft.h dxva2.h opt.h vaapi.h vdpau.h xvmc.h
++HEADERS = avcodec.h avfft.h dxva2.h opt.h vaapi.h vdpau.h xvmc.h audioconvert.h
OBJS = allcodecs.o \
audioconvert.o \
diff --git a/contrib/ffmpeg/A03-png-sequences.patch b/contrib/ffmpeg/A03-png-sequences.patch
index 5259160fb..6f244170b 100644
--- a/contrib/ffmpeg/A03-png-sequences.patch
+++ b/contrib/ffmpeg/A03-png-sequences.patch
@@ -1,6 +1,6 @@
Index: libavcodec/pngdec.c
===================================================================
---- ffmpeg.orig/libavcodec/pngdec.c (revision 20594)
+--- ffmpeg.orig/libavcodec/pngdec.c (revision 22823)
+++ ffmpeg/libavcodec/pngdec.c (working copy)
@@ -597,6 +597,18 @@
}
@@ -20,7 +20,7 @@ Index: libavcodec/pngdec.c
+#if 0
/* handle p-frames only if a predecessor frame is available */
if(s->last_picture->data[0] != NULL) {
- if(!(avpkt->flags & PKT_FLAG_KEY)) {
+ if(!(avpkt->flags & AV_PKT_FLAG_KEY)) {
@@ -613,6 +625,7 @@
}
}
diff --git a/contrib/ffmpeg/A04-mov-seek.patch b/contrib/ffmpeg/A04-mov-seek.patch
new file mode 100644
index 000000000..ecfff65ce
--- /dev/null
+++ b/contrib/ffmpeg/A04-mov-seek.patch
@@ -0,0 +1,13 @@
+Index: libavformat/mov.c
+===================================================================
+--- ffmpeg.orig/libavformat/mov.c (revision 22950)
++++ ffmpeg/libavformat/mov.c (working copy)
+@@ -2466,6 +2466,8 @@
+
+ sample = av_index_search_timestamp(st, timestamp, flags);
+ dprintf(s, "stream %d, timestamp %"PRId64", sample %d\n", st->index, timestamp, sample);
++ if (sample < 0 && st->nb_index_entries && timestamp < st->index_entries[0].timestamp)
++ sample = 0;
+ if (sample < 0) /* not sure what to do */
+ return -1;
+ sc->current_sample = sample;
diff --git a/contrib/ffmpeg/P01-solaris.patch b/contrib/ffmpeg/P01-solaris.patch
index 6924e562e..4eadaa6c8 100644
--- a/contrib/ffmpeg/P01-solaris.patch
+++ b/contrib/ffmpeg/P01-solaris.patch
@@ -1,6 +1,6 @@
Index: configure
===================================================================
---- ffmpeg.orig/configure (revision 20594)
+--- ffmpeg.orig/configure (revision 22823)
+++ ffmpeg/configure (working copy)
@@ -54,6 +54,9 @@
exit 1
@@ -12,12 +12,12 @@ Index: configure
show_help(){
cat <<EOF
Usage: configure [options]
-@@ -2171,7 +2174,7 @@
+@@ -2387,7 +2390,7 @@
check_cc <<EOF || die "endian test failed"
unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
EOF
--od -A n -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
+-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 arm; then
+ if enabled alpha; then
diff --git a/contrib/ffmpeg/P02-darwin-pic.patch b/contrib/ffmpeg/P02-darwin-pic.patch
index 3368da8be..c151b2950 100644
--- a/contrib/ffmpeg/P02-darwin-pic.patch
+++ b/contrib/ffmpeg/P02-darwin-pic.patch
@@ -1,16 +1,8 @@
-diff -Naur ffmpeg-r20602.orig/configure ffmpeg-r20602/configure
---- ffmpeg-r20602.orig/configure 2009-11-24 15:17:19.000000000 -0800
-+++ ffmpeg-r20602/configure 2009-11-27 12:02:03.659012744 -0800
-@@ -1913,7 +1913,7 @@
-
- enable $arch $subarch
- enabled spic && 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 pic
-
- # OS specific
- case $target_os in
-@@ -1982,6 +1982,7 @@
+Index: configure
+===================================================================
+--- ffmpeg.orig/configure (revision 22823)
++++ ffmpeg/configure (working copy)
+@@ -2191,6 +2191,7 @@
FFSERVERLDFLAGS=-Wl,-bind_at_load
objformat="macho"
enabled x86_64 && objformat="macho64"
@@ -18,3 +10,12 @@ diff -Naur ffmpeg-r20602.orig/configure ffmpeg-r20602/configure
enabled_any pic shared ||
{ check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
;;
+@@ -2291,7 +2292,7 @@
+ ;;
+ esac
+
+-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
+
+ set_default $PATHS_LIST
+
diff --git a/contrib/ffmpeg/module.defs b/contrib/ffmpeg/module.defs
index 60979b45e..7b9616857 100644
--- a/contrib/ffmpeg/module.defs
+++ b/contrib/ffmpeg/module.defs
@@ -1,7 +1,7 @@
$(eval $(call import.MODULE.defs,FFMPEG,ffmpeg,BZIP2 FAAD2 ZLIB))
$(eval $(call import.CONTRIB.defs,FFMPEG))
-FFMPEG.FETCH.url = http://download.m0k.org/handbrake/contrib/ffmpeg-r20817.tar.bz2
+FFMPEG.FETCH.url = http://download.m0k.org/handbrake/contrib/ffmpeg-r22950.tar.bz2
FFMPEG.CONFIGURE.deps =
FFMPEG.CONFIGURE.env =
@@ -32,12 +32,13 @@ ifeq (0-cygwin,$(BUILD.cross)-$(BUILD.system))
FFMPEG.GCC.args.extra = -fno-common
else ifeq (darwin,$(BUILD.system))
## section for darwin-archs
- FFMPEG.CONFIGURE.extra += --enable-pthreads --enable-cross-compile --arch=$(BUILD.machine)
+ FFMPEG.CONFIGURE.extra += --enable-pthreads --enable-cross-compile --arch=$(BUILD.machine) --target-os=darwin
else ifeq (1-mingw,$(BUILD.cross)-$(BUILD.system))
FFMPEG.CONFIGURE.extra += \
--enable-w32threads \
--enable-memalign-hack \
--target-os=mingw32 \
+ --arch=i386 \
--enable-cross-compile --cross-prefix=$(BUILD.cross.prefix)
FFMPEG.GCC.args.extra += -fno-common
else
diff --git a/libhb/decavcodec.c b/libhb/decavcodec.c
index a506154db..0a9f63fec 100644
--- a/libhb/decavcodec.c
+++ b/libhb/decavcodec.c
@@ -1027,8 +1027,14 @@ static void init_ffmpeg_context( hb_work_object_t *w )
// Because the time bases are so screwed up, we only take values
// in the range 8fps - 64fps.
AVRational tb;
- if ( st->time_base.num * 64 > st->time_base.den &&
- st->time_base.den > st->time_base.num * 8 )
+ if ( st->avg_frame_rate.den * 64 > st->avg_frame_rate.num &&
+ st->avg_frame_rate.num > st->avg_frame_rate.den * 8 )
+ {
+ tb.num = st->avg_frame_rate.den;
+ tb.den = st->avg_frame_rate.num;
+ }
+ else if ( st->time_base.num * 64 > st->time_base.den &&
+ st->time_base.den > st->time_base.num * 8 )
{
tb = st->time_base;
}
diff --git a/libhb/stream.c b/libhb/stream.c
index d2d2a4a47..caed365cd 100644
--- a/libhb/stream.c
+++ b/libhb/stream.c
@@ -1259,6 +1259,14 @@ int hb_stream_read( hb_stream_t * src_stream, hb_buffer_t * b )
return hb_ts_stream_decode( src_stream, b );
}
+int64_t ffmpeg_initial_timestamp( hb_stream_t * stream )
+{
+ AVStream *s = stream->ffmpeg_ic->streams[stream->ffmpeg_video_id];
+ if ( s->nb_index_entries < 1 )
+ return 0;
+
+ return s->index_entries[0].timestamp;
+}
int hb_stream_seek_chapter( hb_stream_t * stream, int chapter_num )
{
@@ -1284,7 +1292,7 @@ int hb_stream_seek_chapter( hb_stream_t * stream, int chapter_num )
stream->chapter = chapter_num - 1;
stream->chapter_end = sum_dur;
- int64_t pos = ( ( ( sum_dur - chapter->duration ) * AV_TIME_BASE ) / 90000 );
+ int64_t pos = ( ( ( sum_dur - chapter->duration ) * AV_TIME_BASE ) / 90000 ) + ffmpeg_initial_timestamp( stream );
hb_deep_log( 2, "Seeking to chapter %d: starts %"PRId64", ends %"PRId64", AV pos %"PRId64,
chapter_num, sum_dur - chapter->duration, sum_dur, pos);
@@ -1302,7 +1310,7 @@ int hb_stream_seek_chapter( hb_stream_t * stream, int chapter_num )
// that causes the problem. since hb_stream_seek_chapter
// is called before we start reading, make sure
// we do a seek here.
- av_seek_frame( stream->ffmpeg_ic, -1, 0LL, AVSEEK_FLAG_BACKWARD );
+ av_seek_frame( stream->ffmpeg_ic, -1, ffmpeg_initial_timestamp( stream ), AVSEEK_FLAG_BACKWARD );
}
return 1;
}
@@ -2857,6 +2865,13 @@ static hb_title_t *ffmpeg_title_scan( hb_stream_t *stream )
avcodec_find_decoder( ic->streams[i]->codec->codec_id ) &&
title->video_codec == 0 )
{
+ AVCodecContext *context = ic->streams[i]->codec;
+ if ( context->pix_fmt != PIX_FMT_YUV420P &&
+ !sws_isSupportedInput( context->pix_fmt ) )
+ {
+ hb_log( "ffmpeg_title_scan: Unsupported color space" );
+ continue;
+ }
title->video_id = i;
stream->ffmpeg_video_id = i;
@@ -3116,7 +3131,7 @@ static int ffmpeg_seek_ts( hb_stream_t *stream, int64_t ts )
AVFormatContext *ic = stream->ffmpeg_ic;
int64_t pos;
- pos = ts * AV_TIME_BASE / 90000;
+ pos = ts * AV_TIME_BASE / 90000 + ffmpeg_initial_timestamp( stream );
stream->need_keyframe = 1;
// Seek to the nearest timestamp before that requested where
// there is an I-frame
diff --git a/make/include/contrib.defs b/make/include/contrib.defs
index fcff27356..9edd9389c 100644
--- a/make/include/contrib.defs
+++ b/make/include/contrib.defs
@@ -124,7 +124,7 @@ define import.CONTRIB.defs
$(1).INSTALL.ntargets =
$(1).INSTALL.args = !make @dir !extra !ntargets
- $(1).INSTALL.args.dir = -C $$(1) install
+ $(1).INSTALL.args.dir = -j 1 -C $$(1) install
$(1).INSTALL.mkdirs = $$(CONTRIB.build/)lib/ $$(CONTRIB.build/)include/
$(1).INSTALL.target = $$($(1).build/).stamp.install