summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--contrib/ffmpeg/A00-qsv.patch56
-rw-r--r--contrib/ffmpeg/A01-multi-object-pgs.patch671
-rw-r--r--contrib/ffmpeg/A02-disable-nero-chpl.patch65
-rw-r--r--contrib/ffmpeg/A03-mp4-track-title.patch133
-rw-r--r--contrib/ffmpeg/A03-unbreak-no-tty.patch22
-rw-r--r--contrib/ffmpeg/A04-mp4-chap-char-encoding.patch37
-rw-r--r--contrib/ffmpeg/A05-mpeg4-initialization.patch41
-rw-r--r--contrib/ffmpeg/A06-frame-threading-state.patch110
-rw-r--r--contrib/ffmpeg/A07-movenc-Add-dvd-subtitle-support.patch142
-rw-r--r--contrib/ffmpeg/A08-movenc-unbreak-sbtl.patch27
-rw-r--r--contrib/ffmpeg/A10-h264-extradata.patch14
-rw-r--r--contrib/ffmpeg/P01-solaris.patch8
-rw-r--r--contrib/ffmpeg/P02-darwin-pic.patch6
-rw-r--r--contrib/ffmpeg/module.defs2
14 files changed, 58 insertions, 1276 deletions
diff --git a/contrib/ffmpeg/A00-qsv.patch b/contrib/ffmpeg/A00-qsv.patch
index 988ea6ccd..d98132f26 100644
--- a/contrib/ffmpeg/A00-qsv.patch
+++ b/contrib/ffmpeg/A00-qsv.patch
@@ -1,8 +1,8 @@
diff --git a/configure b/configure
-index 05acff5..e71aad5 100755
+index 5085333..7283fb1 100755
--- a/configure
+++ b/configure
-@@ -132,6 +132,7 @@ Component options:
+@@ -134,6 +134,7 @@ Component options:
Hardware accelerators:
--enable-dxva2 enable DXVA2 code
@@ -10,7 +10,7 @@ index 05acff5..e71aad5 100755
--enable-vaapi enable VAAPI code
--enable-vda enable VDA code
--enable-vdpau enable VDPAU code
-@@ -1139,6 +1140,7 @@ EXTERNAL_LIBRARY_LIST="
+@@ -1198,6 +1199,7 @@ FEATURE_LIST="
HWACCEL_LIST="
dxva2
@@ -18,7 +18,7 @@ index 05acff5..e71aad5 100755
vaapi
vda
vdpau
-@@ -1800,6 +1802,7 @@ zmbv_encoder_deps="zlib"
+@@ -1939,6 +1941,7 @@ zmbv_encoder_deps="zlib"
# hardware accelerators
dxva2_deps="dxva2api_h"
@@ -26,7 +26,7 @@ index 05acff5..e71aad5 100755
vaapi_deps="va_va_h"
vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads"
vda_extralibs="-framework CoreFoundation -framework VideoDecodeAcceleration -framework QuartzCore"
-@@ -1811,6 +1814,8 @@ h263_vdpau_hwaccel_deps="vdpau"
+@@ -1950,6 +1953,8 @@ h263_vdpau_hwaccel_deps="vdpau"
h263_vdpau_hwaccel_select="h263_decoder"
h264_dxva2_hwaccel_deps="dxva2"
h264_dxva2_hwaccel_select="h264_decoder"
@@ -35,55 +35,55 @@ index 05acff5..e71aad5 100755
h264_vaapi_hwaccel_deps="vaapi"
h264_vaapi_hwaccel_select="h264_decoder"
h264_vda_hwaccel_deps="vda"
-@@ -3861,6 +3866,7 @@ check_header dxva.h
- check_header dxva2api.h
+@@ -4115,6 +4120,7 @@ check_header dxva2api.h
check_header io.h
+ check_header mach/mach_time.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 9e4dd25..1fbee4a 100644
+index 419dcb6..5208d5b 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
-@@ -4,6 +4,7 @@ FFLIBS = avutil
- HEADERS = avcodec.h \
+@@ -4,6 +4,7 @@ HEADERS = avcodec.h \
avfft.h \
+ dv_profile.h \
dxva2.h \
+ qsv.h \
vaapi.h \
vda.h \
vdpau.h \
-@@ -60,6 +61,7 @@ OBJS-$(CONFIG_MPEGAUDIODSP) += mpegaudiodsp.o \
- OBJS-$(CONFIG_MPEGVIDEO) += mpegvideo.o mpegvideo_motion.o
+@@ -75,6 +76,7 @@ OBJS-$(CONFIG_MPEGVIDEO) += mpegvideo.o mpegvideodsp.o \
OBJS-$(CONFIG_MPEGVIDEOENC) += mpegvideo_enc.o mpeg12data.o \
- motion_est.o ratecontrol.o
+ motion_est.o ratecontrol.o \
+ mpegvideoencdsp.o
+OBJS-$(CONFIG_QSV) += qsv.o
+ OBJS-$(CONFIG_PIXBLOCKDSP) += pixblockdsp.o
+ OBJS-$(CONFIG_QPELDSP) += qpeldsp.o
OBJS-$(CONFIG_RANGECODER) += rangecoder.o
- RDFT-OBJS-$(CONFIG_HARDCODED_TABLES) += sin_tables.o
- OBJS-$(CONFIG_RDFT) += rdft.o $(RDFT-OBJS-yes)
-@@ -199,6 +201,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
+@@ -216,6 +218,7 @@ OBJS-$(CONFIG_H264_DECODER) += h264.o h264_cabac.o h264_cavlc.o \
+ h264_direct.o h264_loopfilter.o \
+ h264_mb.o h264_picture.o h264_ps.o \
+ h264_refs.o h264_sei.o h264_slice.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
-@@ -692,6 +695,7 @@ SKIPHEADERS += %_tablegen.h \
+ hevcdsp.o hevc_filter.o
+@@ -712,6 +715,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_VDA) += vda.h vda_internal.h
SKIPHEADERS-$(CONFIG_VDPAU) += vdpau.h vdpau_internal.h
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
-index b6c27c0..287b912 100644
+index 0d46afe..b3a5dd0 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
-@@ -155,6 +155,7 @@ void avcodec_register_all(void)
+@@ -159,6 +159,7 @@ void avcodec_register_all(void)
REGISTER_DECODER(H263I, h263i);
REGISTER_ENCODER(H263P, h263p);
REGISTER_DECODER(H264, h264);
@@ -2304,14 +2304,14 @@ index 0000000..3cbdb3f
+
+#endif //AVCODEC_QSV_H264_H
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
-index 0d6e0a3..d2779b7 100644
+index 6af6596..70fe068 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
-@@ -190,6 +190,7 @@ enum AVPixelFormat {
+@@ -193,6 +193,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
+ AV_PIX_FMT_RGBA64BE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian
+ AV_PIX_FMT_RGBA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian
diff --git a/contrib/ffmpeg/A01-multi-object-pgs.patch b/contrib/ffmpeg/A01-multi-object-pgs.patch
deleted file mode 100644
index 1a177aee0..000000000
--- a/contrib/ffmpeg/A01-multi-object-pgs.patch
+++ /dev/null
@@ -1,671 +0,0 @@
-From 638cb29d7579ad76ea358ee30ab5e6069ee796c3 Mon Sep 17 00:00:00 2001
-From: John Stebbins <[email protected]>
-Date: Thu, 12 Jun 2014 15:24:26 -0700
-Subject: [PATCH] pgssubdec: handle more complex PGS scenarios
-
-Add ability to handle multiple palettes and objects simultaneously.
-Each simultaneous object is given its own AVSubtitleRect.
-Note that there can be up to 64 currently valid objects, but only
-2 at any one time can be "presented".
----
- libavcodec/pgssubdec.c | 424 ++++++++++++++++++++++++++++++++++---------------
- 1 file changed, 294 insertions(+), 130 deletions(-)
-
-diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c
-index 4f175a3..1cafd9f 100644
---- a/libavcodec/pgssubdec.c
-+++ b/libavcodec/pgssubdec.c
-@@ -33,38 +33,104 @@
- #include "libavutil/imgutils.h"
-
- #define RGBA(r,g,b,a) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
-+#define MAX_EPOCH_PALETTES 8 // Max 8 allowed per PGS epoch
-+#define MAX_EPOCH_OBJECTS 64 // Max 64 allowed per PGS epoch
-+#define MAX_OBJECT_REFS 2 // Max objects per display set
-
- enum SegmentType {
- PALETTE_SEGMENT = 0x14,
-- PICTURE_SEGMENT = 0x15,
-+ OBJECT_SEGMENT = 0x15,
- PRESENTATION_SEGMENT = 0x16,
- WINDOW_SEGMENT = 0x17,
- DISPLAY_SEGMENT = 0x80,
- };
-
-+typedef struct PGSSubObjectRef {
-+ int id;
-+ int window_id;
-+ uint8_t composition_flag;
-+ int x;
-+ int y;
-+ int crop_x;
-+ int crop_y;
-+ int crop_w;
-+ int crop_h;
-+} PGSSubObjectRef;
-+
- typedef struct PGSSubPresentation {
-- int x;
-- int y;
- int id_number;
-- int object_number;
-- uint8_t composition_flag;
-+ int palette_id;
-+ int object_count;
-+ PGSSubObjectRef objects[MAX_OBJECT_REFS];
- int64_t pts;
- } PGSSubPresentation;
-
--typedef struct PGSSubPicture {
-+typedef struct PGSSubObject {
-+ int id;
- int w;
- int h;
- uint8_t *rle;
- unsigned int rle_buffer_size, rle_data_len;
- unsigned int rle_remaining_len;
--} PGSSubPicture;
-+} PGSSubObject;
-+
-+typedef struct PGSSubObjects {
-+ int count;
-+ PGSSubObject object[MAX_EPOCH_OBJECTS];
-+} PGSSubObjects;
-+
-+typedef struct PGSSubPalette {
-+ int id;
-+ uint32_t clut[256];
-+} PGSSubPalette;
-+
-+typedef struct PGSSubPalettes {
-+ int count;
-+ PGSSubPalette palette[MAX_EPOCH_PALETTES];
-+} PGSSubPalettes;
-
- typedef struct PGSSubContext {
- PGSSubPresentation presentation;
-- uint32_t clut[256];
-- PGSSubPicture picture;
-+ PGSSubPalettes palettes;
-+ PGSSubObjects objects;
- } PGSSubContext;
-
-+static void flush_cache(AVCodecContext *avctx)
-+{
-+ PGSSubContext *ctx = avctx->priv_data;
-+ int i;
-+
-+ for (i = 0; i < ctx->objects.count; i++) {
-+ av_freep(&ctx->objects.object[i].rle);
-+ ctx->objects.object[i].rle_buffer_size = 0;
-+ ctx->objects.object[i].rle_remaining_len = 0;
-+ }
-+ ctx->objects.count = 0;
-+ ctx->palettes.count = 0;
-+}
-+
-+static PGSSubObject * find_object(int id, PGSSubObjects *objects)
-+{
-+ int i;
-+
-+ for (i = 0; i < objects->count; i++) {
-+ if (objects->object[i].id == id)
-+ return &objects->object[i];
-+ }
-+ return NULL;
-+}
-+
-+static PGSSubPalette * find_palette(int id, PGSSubPalettes *palettes)
-+{
-+ int i;
-+
-+ for (i = 0; i < palettes->count; i++) {
-+ if (palettes->palette[i].id == id)
-+ return &palettes->palette[i];
-+ }
-+ return NULL;
-+}
-+
- static av_cold int init_decoder(AVCodecContext *avctx)
- {
- avctx->pix_fmt = AV_PIX_FMT_PAL8;
-@@ -74,10 +140,7 @@ static av_cold int init_decoder(AVCodecContext *avctx)
-
- static av_cold int close_decoder(AVCodecContext *avctx)
- {
-- PGSSubContext *ctx = avctx->priv_data;
--
-- av_freep(&ctx->picture.rle);
-- ctx->picture.rle_buffer_size = 0;
-+ flush_cache(avctx);
-
- return 0;
- }
-@@ -92,7 +155,7 @@ static av_cold int close_decoder(AVCodecContext *avctx)
- * @param buf pointer to the RLE data to process
- * @param buf_size size of the RLE data to process
- */
--static int decode_rle(AVCodecContext *avctx, AVSubtitle *sub,
-+static int decode_rle(AVCodecContext *avctx, AVSubtitleRect *rect,
- const uint8_t *buf, unsigned int buf_size)
- {
- const uint8_t *rle_bitmap_end;
-@@ -100,15 +163,15 @@ static int decode_rle(AVCodecContext *avctx, AVSubtitle *sub,
-
- rle_bitmap_end = buf + buf_size;
-
-- sub->rects[0]->pict.data[0] = av_malloc(sub->rects[0]->w * sub->rects[0]->h);
-+ rect->pict.data[0] = av_malloc(rect->w * rect->h);
-
-- if (!sub->rects[0]->pict.data[0])
-- return -1;
-+ if (!rect->pict.data[0])
-+ return AVERROR(ENOMEM);
-
- pixel_count = 0;
- line_count = 0;
-
-- while (buf < rle_bitmap_end && line_count < sub->rects[0]->h) {
-+ while (buf < rle_bitmap_end && line_count < rect->h) {
- uint8_t flags, color;
- int run;
-
-@@ -123,27 +186,31 @@ static int decode_rle(AVCodecContext *avctx, AVSubtitle *sub,
- color = flags & 0x80 ? bytestream_get_byte(&buf) : 0;
- }
-
-- if (run > 0 && pixel_count + run <= sub->rects[0]->w * sub->rects[0]->h) {
-- memset(sub->rects[0]->pict.data[0] + pixel_count, color, run);
-+ if (run > 0 && pixel_count + run <= rect->w * rect->h) {
-+ memset(rect->pict.data[0] + pixel_count, color, run);
- pixel_count += run;
- } else if (!run) {
- /*
- * New Line. Check if correct pixels decoded, if not display warning
- * and adjust bitmap pointer to correct new line position.
- */
-- if (pixel_count % sub->rects[0]->w > 0)
-+ if (pixel_count % rect->w > 0) {
- av_log(avctx, AV_LOG_ERROR, "Decoded %d pixels, when line should be %d pixels\n",
-- pixel_count % sub->rects[0]->w, sub->rects[0]->w);
-+ pixel_count % rect->w, rect->w);
-+ if (avctx->err_recognition & AV_EF_EXPLODE) {
-+ return AVERROR_INVALIDDATA;
-+ }
-+ }
- line_count++;
- }
- }
-
-- if (pixel_count < sub->rects[0]->w * sub->rects[0]->h) {
-+ if (pixel_count < rect->w * rect->h) {
- av_log(avctx, AV_LOG_ERROR, "Insufficient RLE data for subtitle\n");
-- return -1;
-+ return AVERROR_INVALIDDATA;
- }
-
-- av_dlog(avctx, "Pixel Count = %d, Area = %d\n", pixel_count, sub->rects[0]->w * sub->rects[0]->h);
-+ av_dlog(avctx, "Pixel Count = %d, Area = %d\n", pixel_count, rect->w * rect->h);
-
- return 0;
- }
-@@ -157,40 +224,52 @@ static int decode_rle(AVCodecContext *avctx, AVSubtitle *sub,
- * @param avctx contains the current codec context
- * @param buf pointer to the packet to process
- * @param buf_size size of packet to process
-- * @todo TODO: Enable support for RLE data over multiple packets
- */
--static int parse_picture_segment(AVCodecContext *avctx,
-+static int parse_object_segment(AVCodecContext *avctx,
- const uint8_t *buf, int buf_size)
- {
- PGSSubContext *ctx = avctx->priv_data;
-+ PGSSubObject *object;
-
- uint8_t sequence_desc;
- unsigned int rle_bitmap_len, width, height;
-+ int id;
-
- if (buf_size <= 4)
-- return -1;
-+ return AVERROR_INVALIDDATA;
- buf_size -= 4;
-
-- /* skip 3 unknown bytes: Object ID (2 bytes), Version Number */
-- buf += 3;
-+ id = bytestream_get_be16(&buf);
-+ object = find_object(id, &ctx->objects);
-+ if (!object) {
-+ if (ctx->objects.count >= MAX_EPOCH_OBJECTS) {
-+ av_log(avctx, AV_LOG_ERROR, "Too many objects in epoch\n");
-+ return AVERROR_INVALIDDATA;
-+ }
-+ object = &ctx->objects.object[ctx->objects.count++];
-+ object->id = id;
-+ }
-+
-+ /* skip object version number */
-+ buf += 1;
-
- /* Read the Sequence Description to determine if start of RLE data or appended to previous RLE */
- sequence_desc = bytestream_get_byte(&buf);
-
- if (!(sequence_desc & 0x80)) {
- /* Additional RLE data */
-- if (buf_size > ctx->picture.rle_remaining_len)
-- return -1;
-+ if (buf_size > object->rle_remaining_len)
-+ return AVERROR_INVALIDDATA;
-
-- memcpy(ctx->picture.rle + ctx->picture.rle_data_len, buf, buf_size);
-- ctx->picture.rle_data_len += buf_size;
-- ctx->picture.rle_remaining_len -= buf_size;
-+ memcpy(object->rle + object->rle_data_len, buf, buf_size);
-+ object->rle_data_len += buf_size;
-+ object->rle_remaining_len -= buf_size;
-
- return 0;
- }
-
- if (buf_size <= 7)
-- return -1;
-+ return AVERROR_INVALIDDATA;
- buf_size -= 7;
-
- /* Decode rle bitmap length, stored size includes width/height data */
-@@ -203,20 +282,20 @@ static int parse_picture_segment(AVCodecContext *avctx,
- /* Make sure the bitmap is not too large */
- if (avctx->width < width || avctx->height < height) {
- av_log(avctx, AV_LOG_ERROR, "Bitmap dimensions larger than video.\n");
-- return -1;
-+ return AVERROR_INVALIDDATA;
- }
-
-- ctx->picture.w = width;
-- ctx->picture.h = height;
-+ object->w = width;
-+ object->h = height;
-
-- av_fast_malloc(&ctx->picture.rle, &ctx->picture.rle_buffer_size, rle_bitmap_len);
-+ av_fast_malloc(&object->rle, &object->rle_buffer_size, rle_bitmap_len);
-
-- if (!ctx->picture.rle)
-- return -1;
-+ if (!object->rle)
-+ return AVERROR(ENOMEM);
-
-- memcpy(ctx->picture.rle, buf, buf_size);
-- ctx->picture.rle_data_len = buf_size;
-- ctx->picture.rle_remaining_len = rle_bitmap_len - buf_size;
-+ memcpy(object->rle, buf, buf_size);
-+ object->rle_data_len = buf_size;
-+ object->rle_remaining_len = rle_bitmap_len - buf_size;
-
- return 0;
- }
-@@ -231,19 +310,32 @@ static int parse_picture_segment(AVCodecContext *avctx,
- * @param buf pointer to the packet to process
- * @param buf_size size of packet to process
- */
--static void parse_palette_segment(AVCodecContext *avctx,
-+static int parse_palette_segment(AVCodecContext *avctx,
- const uint8_t *buf, int buf_size)
- {
- PGSSubContext *ctx = avctx->priv_data;
-+ PGSSubPalette *palette;
-
- const uint8_t *buf_end = buf + buf_size;
- const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
- int color_id;
- int y, cb, cr, alpha;
- int r, g, b, r_add, g_add, b_add;
-+ int id;
-+
-+ id = bytestream_get_byte(&buf);
-+ palette = find_palette(id, &ctx->palettes);
-+ if (!palette) {
-+ if (ctx->palettes.count >= MAX_EPOCH_PALETTES) {
-+ av_log(avctx, AV_LOG_ERROR, "Too many palettes in epoch\n");
-+ return AVERROR_INVALIDDATA;
-+ }
-+ palette = &ctx->palettes.palette[ctx->palettes.count++];
-+ palette->id = id;
-+ }
-
-- /* Skip two null bytes */
-- buf += 2;
-+ /* Skip palette version */
-+ buf += 1;
-
- while (buf < buf_end) {
- color_id = bytestream_get_byte(&buf);
-@@ -258,8 +350,9 @@ static void parse_palette_segment(AVCodecContext *avctx,
- av_dlog(avctx, "Color %d := (%d,%d,%d,%d)\n", color_id, r, g, b, alpha);
-
- /* Store color in palette */
-- ctx->clut[color_id] = RGBA(r,g,b,alpha);
-+ palette->clut[color_id] = RGBA(r,g,b,alpha);
- }
-+ return 0;
- }
-
- /**
-@@ -272,7 +365,6 @@ static void parse_palette_segment(AVCodecContext *avctx,
- * @param buf pointer to the packet to process
- * @param buf_size size of packet to process
- * @todo TODO: Implement cropping
-- * @todo TODO: Implement forcing of subtitles
- */
- static int parse_presentation_segment(AVCodecContext *avctx,
- const uint8_t *buf, int buf_size,
-@@ -280,8 +372,9 @@ static int parse_presentation_segment(AVCodecContext *avctx,
- {
- PGSSubContext *ctx = avctx->priv_data;
-
-- int x, y, ret;
-+ int i, state, ret;
-
-+ // Video descriptor
- int w = bytestream_get_be16(&buf);
- int h = bytestream_get_be16(&buf);
-
-@@ -293,49 +386,75 @@ static int parse_presentation_segment(AVCodecContext *avctx,
- if (ret < 0)
- return ret;
-
-- /* Skip 1 bytes of unknown, frame rate? */
-+ /* Skip 1 bytes of unknown, frame rate */
- buf++;
-
-+ // Composition descriptor
- ctx->presentation.id_number = bytestream_get_be16(&buf);
--
- /*
-- * Skip 3 bytes of unknown:
-- * state
-- * palette_update_flag (0x80),
-- * palette_id_to_use,
-+ * state is a 2 bit field that defines pgs epoch boundaries
-+ * 00 - Normal, previously defined objects and palettes are still valid
-+ * 01 - Acquisition point, previous objects and palettes can be released
-+ * 10 - Epoch start, previous objects and palettes can be released
-+ * 11 - Epoch continue, previous objects and palettes can be released
-+ *
-+ * reserved 6 bits discarded
- */
-- buf += 3;
--
-- ctx->presentation.object_number = bytestream_get_byte(&buf);
-- ctx->presentation.composition_flag = 0;
-- if (!ctx->presentation.object_number)
-- return 0;
-+ state = bytestream_get_byte(&buf) >> 6;
-+ if (state != 0) {
-+ flush_cache(avctx);
-+ }
-
- /*
-- * Skip 3 bytes of unknown:
-- * object_id_ref (2 bytes),
-- * window_id_ref,
-+ * skip palette_update_flag (0x80),
- */
-- buf += 3;
-- ctx->presentation.composition_flag = bytestream_get_byte(&buf);
--
-- x = bytestream_get_be16(&buf);
-- y = bytestream_get_be16(&buf);
--
-- /* TODO If cropping, cropping_x, cropping_y, cropping_width, cropping_height (all 2 bytes).*/
-+ buf += 1;
-+ ctx->presentation.palette_id = bytestream_get_byte(&buf);
-+ ctx->presentation.object_count = bytestream_get_byte(&buf);
-+ if (ctx->presentation.object_count > MAX_OBJECT_REFS) {
-+ av_log(avctx, AV_LOG_ERROR,
-+ "Invalid number of presentation objects %d\n",
-+ ctx->presentation.object_count);
-+ ctx->presentation.object_count = 2;
-+ if (avctx->err_recognition & AV_EF_EXPLODE) {
-+ return AVERROR_INVALIDDATA;
-+ }
-+ }
-
-- av_dlog(avctx, "Subtitle Placement x=%d, y=%d\n", x, y);
-+ for (i = 0; i < ctx->presentation.object_count; i++)
-+ {
-+ ctx->presentation.objects[i].id = bytestream_get_be16(&buf);
-+ ctx->presentation.objects[i].window_id = bytestream_get_byte(&buf);
-+ ctx->presentation.objects[i].composition_flag = bytestream_get_byte(&buf);
-+
-+ ctx->presentation.objects[i].x = bytestream_get_be16(&buf);
-+ ctx->presentation.objects[i].y = bytestream_get_be16(&buf);
-+
-+ // If cropping
-+ if (ctx->presentation.objects[i].composition_flag & 0x80) {
-+ ctx->presentation.objects[i].crop_x = bytestream_get_be16(&buf);
-+ ctx->presentation.objects[i].crop_y = bytestream_get_be16(&buf);
-+ ctx->presentation.objects[i].crop_w = bytestream_get_be16(&buf);
-+ ctx->presentation.objects[i].crop_h = bytestream_get_be16(&buf);
-+ }
-
-- if (x > avctx->width || y > avctx->height) {
-- av_log(avctx, AV_LOG_ERROR, "Subtitle out of video bounds. x = %d, y = %d, video width = %d, video height = %d.\n",
-- x, y, avctx->width, avctx->height);
-- x = 0; y = 0;
-+ av_dlog(avctx, "Subtitle Placement x=%d, y=%d\n",
-+ ctx->presentation.objects[i].x, ctx->presentation.objects[i].y);
-+
-+ if (ctx->presentation.objects[i].x > avctx->width ||
-+ ctx->presentation.objects[i].y > avctx->height) {
-+ av_log(avctx, AV_LOG_ERROR, "Subtitle out of video bounds. x = %d, y = %d, video width = %d, video height = %d.\n",
-+ ctx->presentation.objects[i].x,
-+ ctx->presentation.objects[i].y,
-+ avctx->width, avctx->height);
-+ ctx->presentation.objects[i].x = 0;
-+ ctx->presentation.objects[i].y = 0;
-+ if (avctx->err_recognition & AV_EF_EXPLODE) {
-+ return AVERROR_INVALIDDATA;
-+ }
-+ }
- }
-
-- /* Fill in dimensions */
-- ctx->presentation.x = x;
-- ctx->presentation.y = y;
--
- return 0;
- }
-
-@@ -348,64 +467,105 @@ static int parse_presentation_segment(AVCodecContext *avctx,
- * @param data pointer to the data pertaining the subtitle to display
- * @param buf pointer to the packet to process
- * @param buf_size size of packet to process
-- * @todo TODO: Fix start time, relies on correct PTS, currently too late
-- *
-- * @todo TODO: Fix end time, normally cleared by a second display
-- * @todo segment, which is currently ignored as it clears
-- * @todo the subtitle too early.
- */
- static int display_end_segment(AVCodecContext *avctx, void *data,
- const uint8_t *buf, int buf_size)
- {
- AVSubtitle *sub = data;
- PGSSubContext *ctx = avctx->priv_data;
--
-- /*
-- * The end display time is a timeout value and is only reached
-- * if the next subtitle is later then timeout or subtitle has
-- * not been cleared by a subsequent empty display command.
-- */
-+ PGSSubPalette *palette;
-+ int i, ret;
-
- memset(sub, 0, sizeof(*sub));
- sub->pts = ctx->presentation.pts;
--
-- // Blank if last object_number was 0.
-- // Note that this may be wrong for more complex subtitles.
-- if (!ctx->presentation.object_number)
-- return 1;
- sub->start_display_time = 0;
-- sub->end_display_time = 20000;
-+ // There is no explicit end time for PGS subtitles. The end time
-+ // is defined by the start of the next sub which may contain no
-+ // objects (i.e. clears the previous sub)
-+ sub->end_display_time = UINT32_MAX;
- sub->format = 0;
-
-- sub->rects = av_mallocz(sizeof(*sub->rects));
-- sub->rects[0] = av_mallocz(sizeof(*sub->rects[0]));
-- sub->num_rects = 1;
--
-- if (ctx->presentation.composition_flag & 0x40)
-- sub->rects[0]->flags |= AV_SUBTITLE_FLAG_FORCED;
-+ // Blank if last object_count was 0.
-+ if (!ctx->presentation.object_count)
-+ return 1;
-+ sub->rects = av_mallocz(sizeof(*sub->rects) * ctx->presentation.object_count);
-+ if (!sub->rects) {
-+ return AVERROR(ENOMEM);
-+ }
-+ palette = find_palette(ctx->presentation.palette_id, &ctx->palettes);
-+ if (!palette) {
-+ // Missing palette. Should only happen with damaged streams.
-+ av_log(avctx, AV_LOG_ERROR, "Invalid palette id %d\n",
-+ ctx->presentation.palette_id);
-+ avsubtitle_free(sub);
-+ return AVERROR_INVALIDDATA;
-+ }
-+ for (i = 0; i < ctx->presentation.object_count; i++) {
-+ PGSSubObject *object;
-
-- sub->rects[0]->x = ctx->presentation.x;
-- sub->rects[0]->y = ctx->presentation.y;
-- sub->rects[0]->w = ctx->picture.w;
-- sub->rects[0]->h = ctx->picture.h;
-- sub->rects[0]->type = SUBTITLE_BITMAP;
-+ sub->rects[i] = av_mallocz(sizeof(*sub->rects[0]));
-+ if (!sub->rects[i]) {
-+ avsubtitle_free(sub);
-+ return AVERROR(ENOMEM);
-+ }
-+ sub->num_rects++;
-+ sub->rects[i]->type = SUBTITLE_BITMAP;
-+
-+ /* Process bitmap */
-+ object = find_object(ctx->presentation.objects[i].id, &ctx->objects);
-+ if (!object) {
-+ // Missing object. Should only happen with damaged streams.
-+ av_log(avctx, AV_LOG_ERROR, "Invalid object id %d\n",
-+ ctx->presentation.objects[i].id);
-+ if (avctx->err_recognition & AV_EF_EXPLODE) {
-+ avsubtitle_free(sub);
-+ return AVERROR_INVALIDDATA;
-+ }
-+ // Leaves rect empty with 0 width and height.
-+ continue;
-+ }
-+ if (ctx->presentation.objects[i].composition_flag & 0x40)
-+ sub->rects[i]->flags |= AV_SUBTITLE_FLAG_FORCED;
-+
-+ sub->rects[i]->x = ctx->presentation.objects[i].x;
-+ sub->rects[i]->y = ctx->presentation.objects[i].y;
-+ sub->rects[i]->w = object->w;
-+ sub->rects[i]->h = object->h;
-+
-+ sub->rects[i]->pict.linesize[0] = object->w;
-+
-+ if (object->rle) {
-+ if (object->rle_remaining_len) {
-+ av_log(avctx, AV_LOG_ERROR, "RLE data length %u is %u bytes shorter than expected\n",
-+ object->rle_data_len, object->rle_remaining_len);
-+ if (avctx->err_recognition & AV_EF_EXPLODE) {
-+ avsubtitle_free(sub);
-+ return AVERROR_INVALIDDATA;
-+ }
-+ }
-+ ret = decode_rle(avctx, sub->rects[i], object->rle, object->rle_data_len);
-+ if (ret < 0) {
-+ if ((avctx->err_recognition & AV_EF_EXPLODE) ||
-+ ret == AVERROR(ENOMEM)) {
-+ avsubtitle_free(sub);
-+ return ret;
-+ }
-+ sub->rects[i]->w = 0;
-+ sub->rects[i]->h = 0;
-+ continue;
-+ }
-+ }
-+ /* Allocate memory for colors */
-+ sub->rects[i]->nb_colors = 256;
-+ sub->rects[i]->pict.data[1] = av_mallocz(AVPALETTE_SIZE);
-+ if (!sub->rects[i]->pict.data[1]) {
-+ avsubtitle_free(sub);
-+ return AVERROR(ENOMEM);
-+ }
-
-- /* Process bitmap */
-- sub->rects[0]->pict.linesize[0] = ctx->picture.w;
-+ memcpy(sub->rects[i]->pict.data[1], palette->clut, sub->rects[i]->nb_colors * sizeof(uint32_t));
-
-- if (ctx->picture.rle) {
-- if (ctx->picture.rle_remaining_len)
-- av_log(avctx, AV_LOG_ERROR, "RLE data length %u is %u bytes shorter than expected\n",
-- ctx->picture.rle_data_len, ctx->picture.rle_remaining_len);
-- if(decode_rle(avctx, sub, ctx->picture.rle, ctx->picture.rle_data_len) < 0)
-- return 0;
- }
-- /* Allocate memory for colors */
-- sub->rects[0]->nb_colors = 256;
-- sub->rects[0]->pict.data[1] = av_mallocz(AVPALETTE_SIZE);
--
-- memcpy(sub->rects[0]->pict.data[1], ctx->clut, sub->rects[0]->nb_colors * sizeof(uint32_t));
--
- return 1;
- }
-
-@@ -449,17 +609,16 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size,
- if (segment_type != DISPLAY_SEGMENT && segment_length > buf_end - buf)
- break;
-
-+ ret = 0;
- switch (segment_type) {
- case PALETTE_SEGMENT:
-- parse_palette_segment(avctx, buf, segment_length);
-+ ret = parse_palette_segment(avctx, buf, segment_length);
- break;
-- case PICTURE_SEGMENT:
-- parse_picture_segment(avctx, buf, segment_length);
-+ case OBJECT_SEGMENT:
-+ ret = parse_object_segment(avctx, buf, segment_length);
- break;
- case PRESENTATION_SEGMENT:
- ret = parse_presentation_segment(avctx, buf, segment_length, avpkt->pts);
-- if (ret < 0)
-- return ret;
- break;
- case WINDOW_SEGMENT:
- /*
-@@ -472,13 +631,18 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size,
- */
- break;
- case DISPLAY_SEGMENT:
-- *data_size = display_end_segment(avctx, data, buf, segment_length);
-+ ret = display_end_segment(avctx, data, buf, segment_length);
-+ if (ret >= 0)
-+ *data_size = ret;
- break;
- default:
- av_log(avctx, AV_LOG_ERROR, "Unknown subtitle segment type 0x%x, length %d\n",
- segment_type, segment_length);
-+ ret = AVERROR_INVALIDDATA;
- break;
- }
-+ if (ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE))
-+ return ret;
-
- buf += segment_length;
- }
---
-1.9.3
-
diff --git a/contrib/ffmpeg/A02-disable-nero-chpl.patch b/contrib/ffmpeg/A02-disable-nero-chpl.patch
deleted file mode 100644
index a558ef609..000000000
--- a/contrib/ffmpeg/A02-disable-nero-chpl.patch
+++ /dev/null
@@ -1,65 +0,0 @@
-From 189f0b725a268374647d251f8732b51dd29d4b15 Mon Sep 17 00:00:00 2001
-From: John Stebbins <[email protected]>
-Date: Mon, 4 Aug 2014 08:32:56 -0700
-Subject: [PATCH] movenc: Add option to disable nero chapters
-
-And add flag to muxer documentation.
-Nero chapters break some taggers (mp3tag and iTunes).
----
- doc/muxers.texi | 5 +++++
- libavformat/movenc.c | 3 ++-
- libavformat/movenc.h | 1 +
- 3 files changed, 8 insertions(+), 1 deletion(-)
-
-diff --git a/doc/muxers.texi b/doc/muxers.texi
-index 0ca8d3f..54109c7 100644
---- a/doc/muxers.texi
-+++ b/doc/muxers.texi
-@@ -330,6 +330,11 @@ This option is implicitly set when writing ismv (Smooth Streaming) files.
- Run a second pass moving the index (moov atom) to the beginning of the file.
- This operation can take a while, and will not work in various situations such
- as fragmented output, thus it is not enabled by default.
-+@item -movflags disable_chpl
-+Disable Nero chapter markers (chpl atom). Normally, both Nero chapters
-+and a QuickTime chapter track are written to the file. With this option
-+set, only the QuickTime chapter track will be written. Nero chapters can
-+cause failures when the file is reprocessed with certain tagging programs.
- @end table
-
- Smooth Streaming content can be pushed in real time to a publishing
-diff --git a/libavformat/movenc.c b/libavformat/movenc.c
-index f16e851..73a78d8 100644
---- a/libavformat/movenc.c
-+++ b/libavformat/movenc.c
-@@ -57,6 +57,7 @@ static const AVOption options[] = {
- { "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 index (moov atom) 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" },
- { "omit_tfhd_offset", "Omit the base data offset in tfhd atoms", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_OMIT_TFHD_OFFSET}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
-+ { "disable_chpl", "Disable Nero chapter atom", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_DISABLE_CHPL}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
- 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},
-@@ -2076,7 +2077,7 @@ static int mov_write_udta_tag(AVIOContext *pb, MOVMuxContext *mov,
- mov_write_meta_tag(pb_buf, mov, s);
- }
-
-- if (s->nb_chapters)
-+ if (s->nb_chapters && !(mov->flags & FF_MOV_FLAG_DISABLE_CHPL))
- mov_write_chpl_tag(pb_buf, s);
-
- if ((size = avio_close_dyn_buf(pb_buf, &buf)) > 0) {
-diff --git a/libavformat/movenc.h b/libavformat/movenc.h
-index 35be781..0d3eb34 100644
---- a/libavformat/movenc.h
-+++ b/libavformat/movenc.h
-@@ -175,6 +175,7 @@ typedef struct MOVMuxContext {
- #define FF_MOV_FLAG_ISML 64
- #define FF_MOV_FLAG_FASTSTART 128
- #define FF_MOV_FLAG_OMIT_TFHD_OFFSET 256
-+#define FF_MOV_FLAG_DISABLE_CHPL 512
-
- int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt);
-
---
-1.9.3
-
diff --git a/contrib/ffmpeg/A03-mp4-track-title.patch b/contrib/ffmpeg/A03-mp4-track-title.patch
deleted file mode 100644
index 25ad12cb6..000000000
--- a/contrib/ffmpeg/A03-mp4-track-title.patch
+++ /dev/null
@@ -1,133 +0,0 @@
-diff --git a/libavformat/movenc.c b/libavformat/movenc.c
-index 0c688f6..f89b630 100644
---- a/libavformat/movenc.c
-+++ b/libavformat/movenc.c
-@@ -76,6 +76,17 @@ static const AVClass flavor ## _muxer_class = {\
- .version = LIBAVUTIL_VERSION_INT,\
- };
-
-+static int utf8len(const uint8_t *b)
-+{
-+ int len = 0;
-+ int val;
-+ while (*b) {
-+ GET_UTF8(val, *b++, return -1;)
-+ len++;
-+ }
-+ return len;
-+}
-+
- //FIXME support 64 bit variant with wide placeholders
- static int64_t update_size(AVIOContext *pb, int64_t pos)
- {
-@@ -1325,6 +1336,15 @@ static int mov_write_hdlr_tag(AVIOContext *pb, MOVTrack *track)
- "Unknown hldr_type for %s / 0x%04X, writing dummy values\n",
- tag_buf, track->enc->codec_tag);
- }
-+ if (track->st) {
-+ // hdlr.name is used by some players to identify the content title
-+ // of the track. So if an alternate handler description is
-+ // specified, use it.
-+ AVDictionaryEntry *t;
-+ t = av_dict_get(track->st->metadata, "handler", NULL, 0);
-+ if (t && utf8len(t->value))
-+ descr = t->value;
-+ }
- }
-
- avio_wb32(pb, 0); /* size */
-@@ -1623,6 +1643,47 @@ static int mov_write_udta_sdp(AVIOContext *pb, MOVTrack *track)
- return len + 24;
- }
-
-+static int mov_write_track_metadata(AVIOContext *pb, AVStream *st,
-+ const char *tag, const char *str)
-+{
-+ int64_t pos = avio_tell(pb);
-+ AVDictionaryEntry *t = av_dict_get(st->metadata, str, NULL, 0);
-+ if (!t || !utf8len(t->value))
-+ return 0;
-+
-+ avio_wb32(pb, 0); /* size */
-+ ffio_wfourcc(pb, tag); /* type */
-+ avio_write(pb, t->value, strlen(t->value)); /* UTF8 string value */
-+ return update_size(pb, pos);
-+}
-+
-+static int mov_write_track_udta_tag(AVIOContext *pb, MOVMuxContext *mov,
-+ AVStream *st)
-+{
-+ AVIOContext *pb_buf;
-+ int ret, size;
-+ uint8_t *buf;
-+
-+ if (st == NULL)
-+ return 0;
-+
-+ ret = avio_open_dyn_buf(&pb_buf);
-+ if (ret < 0)
-+ return ret;
-+
-+ if (mov->mode & MODE_MP4)
-+ mov_write_track_metadata(pb_buf, st, "name", "title");
-+
-+ if ((size = avio_close_dyn_buf(pb_buf, &buf)) > 0) {
-+ avio_wb32(pb, size + 8);
-+ ffio_wfourcc(pb, "udta");
-+ avio_write(pb, buf, size);
-+ }
-+ av_free(buf);
-+
-+ return 0;
-+}
-+
- static int mov_write_trak_tag(AVIOContext *pb, MOVMuxContext *mov,
- MOVTrack *track, AVStream *st)
- {
-@@ -1647,6 +1708,7 @@ static int mov_write_trak_tag(AVIOContext *pb, MOVMuxContext *mov,
- if (0.0 != sample_aspect_ratio && 1.0 != sample_aspect_ratio)
- mov_write_tapt_tag(pb, track);
- }
-+ mov_write_track_udta_tag(pb, mov, st);
- return update_size(pb, pos);
- }
-
-@@ -1904,17 +1966,6 @@ static int mov_write_meta_tag(AVIOContext *pb, MOVMuxContext *mov,
- return size;
- }
-
--static int utf8len(const uint8_t *b)
--{
-- int len = 0;
-- int val;
-- while (*b) {
-- GET_UTF8(val, *b++, return -1;)
-- len++;
-- }
-- return len;
--}
--
- static int ascii_to_wc(AVIOContext *pb, const uint8_t *b)
- {
- int val;
-@@ -3266,6 +3317,7 @@ static int mov_write_header(AVFormatContext *s)
- MOVTrack *track= &mov->tracks[i];
- AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL,0);
-
-+ track->st = st;
- track->enc = st->codec;
- track->language = ff_mov_iso639_to_lang(lang?lang->value:"und", mov->mode!=MODE_MOV);
- if (track->language < 0)
-diff --git a/libavformat/movenc.h b/libavformat/movenc.h
-index 226a28f..687299e 100644
---- a/libavformat/movenc.h
-+++ b/libavformat/movenc.h
-@@ -133,6 +133,8 @@ typedef struct MOVTrack {
- int packet_entry;
- int slices;
- } vc1_info;
-+
-+ AVStream *st;
- } MOVTrack;
-
- typedef struct MOVMuxContext {
diff --git a/contrib/ffmpeg/A03-unbreak-no-tty.patch b/contrib/ffmpeg/A03-unbreak-no-tty.patch
new file mode 100644
index 000000000..1e819bf9e
--- /dev/null
+++ b/contrib/ffmpeg/A03-unbreak-no-tty.patch
@@ -0,0 +1,22 @@
+commit d995f0a1550c9148140eab34c7d770e90925c004
+Author: Luca Barbato <[email protected]>
+Date: Sat Sep 13 00:26:21 2014 +0200
+
+ log: Unbreak no-tty support on 256color terminals
+
+diff --git a/libavutil/log.c b/libavutil/log.c
+index 5a8f293..d38e40b 100644
+--- a/libavutil/log.c
++++ b/libavutil/log.c
+@@ -75,7 +75,8 @@ static void check_color_terminal(void)
+ char *term = getenv("TERM");
+ use_color = !getenv("NO_COLOR") && !getenv("AV_LOG_FORCE_NOCOLOR") &&
+ (getenv("TERM") && isatty(2) || getenv("AV_LOG_FORCE_COLOR"));
+- use_color += term && strstr(term, "256color");
++ if (use_color)
++ use_color += term && strstr(term, "256color");
+ #else
+ use_color = getenv("AV_LOG_FORCE_COLOR") && !getenv("NO_COLOR") &&
+ !getenv("AV_LOG_FORCE_NOCOLOR");
+
+
diff --git a/contrib/ffmpeg/A04-mp4-chap-char-encoding.patch b/contrib/ffmpeg/A04-mp4-chap-char-encoding.patch
deleted file mode 100644
index 1cb8482d7..000000000
--- a/contrib/ffmpeg/A04-mp4-chap-char-encoding.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From bfdfd6c70e717c0ef8a89327931e8905f95eba7c Mon Sep 17 00:00:00 2001
-From: John Stebbins <[email protected]>
-Date: Thu, 31 Jul 2014 11:51:40 -0700
-Subject: [PATCH 3/3] movenc: fix QT chapter track character encoding
-
-An encoding ("encd") box is required to tell QT that the string is UTF8
----
- libavformat/movenc.c | 7 ++++++-
- 1 file changed, 6 insertions(+), 1 deletion(-)
-
-diff --git a/libavformat/movenc.c b/libavformat/movenc.c
-index c9b0f6e..4d487e9 100644
---- a/libavformat/movenc.c
-+++ b/libavformat/movenc.c
-@@ -3196,13 +3196,18 @@ static int mov_create_chapter_track(AVFormatContext *s, int tracknum)
- pkt.duration = end - pkt.dts;
-
- if ((t = av_dict_get(c->metadata, "title", NULL, 0))) {
-+ const char encd[12] = {
-+ 0x00, 0x00, 0x00, 0x0C,
-+ 'e', 'n', 'c', 'd',
-+ 0x00, 0x00, 0x01, 0x00 };
- len = strlen(t->value);
-- pkt.size = len + 2;
-+ pkt.size = len + 2 + 12;
- pkt.data = av_malloc(pkt.size);
- if (!pkt.data)
- return AVERROR(ENOMEM);
- AV_WB16(pkt.data, len);
- memcpy(pkt.data + 2, t->value, len);
-+ memcpy(pkt.data + len + 2, encd, sizeof(encd));
- ff_mov_write_packet(s, &pkt);
- av_freep(&pkt.data);
- }
---
-1.9.3
-
diff --git a/contrib/ffmpeg/A05-mpeg4-initialization.patch b/contrib/ffmpeg/A05-mpeg4-initialization.patch
deleted file mode 100644
index 3045c8d28..000000000
--- a/contrib/ffmpeg/A05-mpeg4-initialization.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
-index f6c79af..70522ee 100644
---- a/libavcodec/h263dec.c
-+++ b/libavcodec/h263dec.c
-@@ -414,17 +414,7 @@ int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
-
- if (!s->context_initialized)
- // we need the idct permutaton for reading a custom matrix
-- if ((ret = ff_MPV_common_init(s)) < 0)
-- return ret;
--
-- /* We need to set current_picture_ptr before reading the header,
-- * otherwise we cannot store anyting in there */
-- if (s->current_picture_ptr == NULL || s->current_picture_ptr->f.data[0]) {
-- int i = ff_find_unused_picture(s, 0);
-- if (i < 0)
-- return i;
-- s->current_picture_ptr = &s->picture[i];
-- }
-+ ff_dsputil_init(&s->dsp, avctx);
-
- /* let's go :-) */
- if (CONFIG_WMV2_DECODER && s->msmpeg4_version == 5) {
-@@ -459,6 +449,17 @@ int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
- return ret;
- }
-
-+ if (!s->context_initialized)
-+ if ((ret = ff_MPV_common_init(s)) < 0)
-+ return ret;
-+
-+ if (s->current_picture_ptr == NULL || s->current_picture_ptr->f.data[0]) {
-+ int i = ff_find_unused_picture(s, 0);
-+ if (i < 0)
-+ return i;
-+ s->current_picture_ptr = &s->picture[i];
-+ }
-+
- avctx->has_b_frames = !s->low_delay;
-
- #define SET_QPEL_FUNC(postfix1, postfix2) \
diff --git a/contrib/ffmpeg/A06-frame-threading-state.patch b/contrib/ffmpeg/A06-frame-threading-state.patch
deleted file mode 100644
index fef87b808..000000000
--- a/contrib/ffmpeg/A06-frame-threading-state.patch
+++ /dev/null
@@ -1,110 +0,0 @@
-Received: from oboro.libav.org (77.109.144.72) by cas.jetheaddev.com
- (192.168.13.27) with Microsoft SMTP Server id 14.3.195.1; Fri, 22 Aug 2014
- 04:13:09 -0700
-Received: from oboro.libav.org (localhost [127.0.0.1]) by oboro.libav.org
- (Postfix) with ESMTP id 54F155DBA3; Fri, 22 Aug 2014 13:13:06 +0200 (CEST)
-X-Original-To: [email protected]
-Delivered-To: [email protected]
-Received: from localhost (localhost [127.0.0.1]) by oboro.libav.org (Postfix)
- with ESMTP id A5E705DBA3 for <[email protected]>; Fri, 22 Aug 2014
- 13:13:04 +0200 (CEST)
-Received: from oboro.libav.org ([127.0.0.1]) by localhost (oboro.libav.org
- [127.0.0.1]) (amavisd-new, port 10024) with LMTP id q_DABqtOoALY for
- <[email protected]>; Fri, 22 Aug 2014 13:13:04 +0200 (CEST)
-Received: from aruru.libav.org (aruru.libav.org [77.109.144.70]) by
- oboro.libav.org (Postfix) with ESMTP id 8C8AA5DB88 for
- <[email protected]>; Fri, 22 Aug 2014 13:13:04 +0200 (CEST)
-Received: by aruru.libav.org (Postfix, from userid 106) id 8436F5DD71; Fri, 22
- Aug 2014 13:13:04 +0200 (CEST)
-From: "Janne Grunau " <[email protected]>
-Message-ID: <[email protected]>
-Date: Fri, 22 Aug 2014 13:13:04 +0200
-Subject: [libav-commits] rv34: use ff_mpeg_update_thread_context only when
- decoder is fully initialized
-X-BeenThere: [email protected]
-X-Mailman-Version: 2.1.15
-Precedence: list
-Reply-To: <[email protected]>
-List-Id: libav commit notifications <libav-commits.libav.org>
-List-Unsubscribe: <https://lists.libav.org/mailman/options/libav-commits>,
- <mailto:[email protected]?subject=unsubscribe>
-List-Archive: <http://lists.libav.org/pipermail/libav-commits/>
-List-Post: <mailto:[email protected]>
-List-Help: <mailto:[email protected]?subject=help>
-List-Subscribe: <https://lists.libav.org/mailman/listinfo/libav-commits>,
- <mailto:[email protected]?subject=subscribe>
-Content-Type: text/plain; charset="us-ascii"
-Content-Transfer-Encoding: 7bit
-Errors-To: [email protected]
-Sender: libav-commits <[email protected]>
-Return-Path: [email protected]
-X-MS-Exchange-Organization-AuthSource: cas.jetheaddev.com
-X-MS-Exchange-Organization-AuthAs: Anonymous
-X-MS-Exchange-Organization-PRD: libav.org
-X-MS-Exchange-Organization-SenderIdResult: None
-Received-SPF: None (cas.jetheaddev.com: [email protected] does
- not designate permitted sender hosts)
-X-MS-Exchange-Organization-SCL: 0
-X-MS-Exchange-Organization-PCL: 2
-X-MS-Exchange-Organization-Antispam-Report: DV:3.3.14004.476;SID:SenderIDStatus None;OrigIP:77.109.144.72
-MIME-Version: 1.0
-
-Module: libav
-Branch: master
-Commit: dc4b2e7d33903a6b9380e8a84b22b3a20facbb08
-
-Author: Janne Grunau <[email protected]>
-Committer: Janne Grunau <[email protected]>
-Date: Thu Aug 21 13:26:33 2014 +0200
-
-rv34: use ff_mpeg_update_thread_context only when decoder is fully initialized
-
-MpegEncContext based decoders are only fully initialized after the first
-ff_thread_get_buffer() call. The RV30/40 decoders may fail before a frame
-buffer was requested. ff_mpeg_update_thread_context() fails on half
-initialized MpegEncContexts. Since this can only happen before a the
-first frame was decoded there is no need to call
-ff_mpeg_update_thread_context().
-
-Based on patches by John Stebbins and tested by John Stebbins.
-
-
----
-
- libavcodec/rv34.c | 10 ++++++----
- 1 file changed, 6 insertions(+), 4 deletions(-)
-
-diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
-index 4ed2a33..26ab7e4 100644
---- a/libavcodec/rv34.c
-+++ b/libavcodec/rv34.c
-@@ -1555,16 +1555,18 @@ int ff_rv34_decode_update_thread_context(AVCodecContext *dst, const AVCodecConte
- return err;
- }
-
-- if ((err = ff_mpeg_update_thread_context(dst, src)))
-- return err;
--
- r->cur_pts = r1->cur_pts;
- r->last_pts = r1->last_pts;
- r->next_pts = r1->next_pts;
-
- memset(&r->si, 0, sizeof(r->si));
-
-- return 0;
-+ // Do no call ff_mpeg_update_thread_context on a partially initialized
-+ // decoder context.
-+ if (!s1->linesize)
-+ return 0;
-+
-+ return ff_mpeg_update_thread_context(dst, src);
- }
-
- static int get_slice_offset(AVCodecContext *avctx, const uint8_t *buf, int n)
-
-_______________________________________________
-libav-commits mailing list
-https://lists.libav.org/mailman/listinfo/libav-commits
diff --git a/contrib/ffmpeg/A07-movenc-Add-dvd-subtitle-support.patch b/contrib/ffmpeg/A07-movenc-Add-dvd-subtitle-support.patch
deleted file mode 100644
index 9f604ecb9..000000000
--- a/contrib/ffmpeg/A07-movenc-Add-dvd-subtitle-support.patch
+++ /dev/null
@@ -1,142 +0,0 @@
-From 6adf3bc42e36242d487636786e995149bbb849fe Mon Sep 17 00:00:00 2001
-From: John Stebbins <[email protected]>
-Date: Tue, 18 Mar 2014 08:50:25 -0600
-Subject: [PATCH] movenc: Add dvd subtitle support
-
-Signed-off-by: Luca Barbato <[email protected]>
----
- libavformat/movenc.c | 83 ++++++++++++++++++++++++++++++++++++++++++++++++----
- 1 file changed, 78 insertions(+), 5 deletions(-)
-
-diff --git a/libavformat/movenc.c b/libavformat/movenc.c
-index 0c688f6..a6a55d5 100644
---- a/libavformat/movenc.c
-+++ b/libavformat/movenc.c
-@@ -309,7 +309,9 @@ static int mov_write_esds_tag(AVIOContext *pb, MOVTrack *track) // Basic
-
- // the following fields is made of 6 bits to identify the streamtype (4 for video, 5 for audio)
- // plus 1 bit to indicate upstream and 1 bit set to 1 (reserved)
-- if (track->enc->codec_type == AVMEDIA_TYPE_AUDIO)
-+ if (track->enc->codec_id == AV_CODEC_ID_DVD_SUBTITLE)
-+ avio_w8(pb, (0x38 << 2) | 1); // flags (= NeroSubpicStream)
-+ else if (track->enc->codec_type == AVMEDIA_TYPE_AUDIO)
- avio_w8(pb, 0x15); // flags (= Audiostream)
- else
- avio_w8(pb, 0x11); // flags (= Visualstream)
-@@ -760,6 +762,7 @@ static int mp4_get_codec_tag(AVFormatContext *s, MOVTrack *track)
- else if (track->enc->codec_id == AV_CODEC_ID_VC1) tag = MKTAG('v','c','-','1');
- else if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO) tag = MKTAG('m','p','4','v');
- else if (track->enc->codec_type == AVMEDIA_TYPE_AUDIO) tag = MKTAG('m','p','4','a');
-+ else if (track->enc->codec_id == AV_CODEC_ID_DVD_SUBTITLE) tag = MKTAG('m','p','4','s');
-
- return tag;
- }
-@@ -976,7 +979,9 @@ static int mov_write_subtitle_tag(AVIOContext *pb, MOVTrack *track)
- avio_wb16(pb, 0); /* Reserved */
- avio_wb16(pb, 1); /* Data-reference index */
-
-- if (track->enc->extradata_size)
-+ if (track->enc->codec_id == AV_CODEC_ID_DVD_SUBTITLE)
-+ mov_write_esds_tag(pb, track);
-+ else if (track->enc->extradata_size)
- avio_write(pb, track->enc->extradata, track->enc->extradata_size);
-
- return update_size(pb, pos);
-@@ -1308,6 +1313,7 @@ static int mov_write_hdlr_tag(AVIOContext *pb, MOVTrack *track)
- descr = "SoundHandler";
- } else if (track->enc->codec_type == AVMEDIA_TYPE_SUBTITLE) {
- if (track->tag == MKTAG('t','x','3','g')) hdlr_type = "sbtl";
-+ if (track->tag == MKTAG('m','p','4','s')) hdlr_type = "subp";
- else hdlr_type = "text";
- descr = "SubtitleHandler";
- } else if (track->enc->codec_tag == MKTAG('r','t','p',' ')) {
-@@ -3178,6 +3184,69 @@ static void mov_free(AVFormatContext *s)
- av_freep(&mov->tracks);
- }
-
-+static uint32_t rgb_to_yuv(uint32_t rgb)
-+{
-+ uint8_t r, g, b;
-+ int y, cb, cr;
-+
-+ r = (rgb >> 16) & 0xFF;
-+ g = (rgb >> 8) & 0xFF;
-+ b = (rgb ) & 0xFF;
-+
-+ y = av_clip_uint8( 16. + 0.257 * r + 0.504 * g + 0.098 * b);
-+ cb = av_clip_uint8(128. - 0.148 * r - 0.291 * g + 0.439 * b);
-+ cr = av_clip_uint8(128. + 0.439 * r - 0.368 * g - 0.071 * b);
-+
-+ return (y << 16) | (cr << 8) | cb;
-+}
-+
-+static int mov_create_dvd_sub_decoder_specific_info(MOVTrack *track,
-+ AVStream *st)
-+{
-+ int i, width = 720, height = 480;
-+ int have_palette = 0, have_size = 0;
-+ uint32_t palette[16];
-+ char *cur = st->codec->extradata;
-+
-+ while (cur && *cur) {
-+ if (strncmp("palette:", cur, 8) == 0) {
-+ int i, count;
-+ count = sscanf(cur + 8,
-+ "%06x, %06x, %06x, %06x, %06x, %06x, %06x, %06x, "
-+ "%06x, %06x, %06x, %06x, %06x, %06x, %06x, %06x",
-+ &palette[ 0], &palette[ 1], &palette[ 2], &palette[ 3],
-+ &palette[ 4], &palette[ 5], &palette[ 6], &palette[ 7],
-+ &palette[ 8], &palette[ 9], &palette[10], &palette[11],
-+ &palette[12], &palette[13], &palette[14], &palette[15]);
-+
-+ for (i = 0; i < count; i++) {
-+ palette[i] = rgb_to_yuv(palette[i]);
-+ }
-+ have_palette = 1;
-+ } else if (!strncmp("size:", cur, 5)) {
-+ sscanf(cur + 5, "%dx%d", &width, &height);
-+ have_size = 1;
-+ }
-+ if (have_palette && have_size)
-+ break;
-+ cur += strcspn(cur, "\n\r");
-+ cur += strspn(cur, "\n\r");
-+ }
-+ if (have_palette) {
-+ track->vos_data = av_malloc(16*4);
-+ if (!track->vos_data)
-+ return AVERROR(ENOMEM);
-+ for (i = 0; i < 16; i++) {
-+ AV_WB32(track->vos_data + i * 4, palette[i]);
-+ }
-+ track->vos_len = 16 * 4;
-+ }
-+ st->codec->width = width;
-+ st->codec->height = track->height = height;
-+
-+ return 0;
-+}
-+
- static int mov_write_header(AVFormatContext *s)
- {
- AVIOContext *pb = s->pb;
-@@ -3334,9 +3403,13 @@ static int mov_write_header(AVFormatContext *s)
-
- /* copy extradata if it exists */
- if (st->codec->extradata_size) {
-- track->vos_len = st->codec->extradata_size;
-- track->vos_data = av_malloc(track->vos_len);
-- memcpy(track->vos_data, st->codec->extradata, track->vos_len);
-+ if (st->codec->codec_id == AV_CODEC_ID_DVD_SUBTITLE)
-+ mov_create_dvd_sub_decoder_specific_info(track, st);
-+ else {
-+ track->vos_len = st->codec->extradata_size;
-+ track->vos_data = av_malloc(track->vos_len);
-+ memcpy(track->vos_data, st->codec->extradata, track->vos_len);
-+ }
- }
- }
-
---
-1.9.3
-
diff --git a/contrib/ffmpeg/A08-movenc-unbreak-sbtl.patch b/contrib/ffmpeg/A08-movenc-unbreak-sbtl.patch
deleted file mode 100644
index 8ac7ea997..000000000
--- a/contrib/ffmpeg/A08-movenc-unbreak-sbtl.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-commit f94371b1db89bf65173a763a49175ce549466602
-Author: Michael Niedermayer <[email protected]>
-Date: Sat Mar 29 15:56:03 2014 +0100
-
- mov: Unbreak sbtl writing
-
-diff --git a/libavformat/movenc.c b/libavformat/movenc.c
-index a6a55d5..889f15c 100644
---- a/libavformat/movenc.c
-+++ b/libavformat/movenc.c
-@@ -1312,9 +1312,13 @@ static int mov_write_hdlr_tag(AVIOContext *pb, MOVTrack *track)
- hdlr_type = "soun";
- descr = "SoundHandler";
- } else if (track->enc->codec_type == AVMEDIA_TYPE_SUBTITLE) {
-- if (track->tag == MKTAG('t','x','3','g')) hdlr_type = "sbtl";
-- if (track->tag == MKTAG('m','p','4','s')) hdlr_type = "subp";
-- else hdlr_type = "text";
-+ if (track->tag == MKTAG('t','x','3','g')) {
-+ hdlr_type = "sbtl";
-+ } else if (track->tag == MKTAG('m','p','4','s')) {
-+ hdlr_type = "subp";
-+ } else {
-+ hdlr_type = "text";
-+ }
- descr = "SubtitleHandler";
- } else if (track->enc->codec_tag == MKTAG('r','t','p',' ')) {
- hdlr_type = "hint";
diff --git a/contrib/ffmpeg/A10-h264-extradata.patch b/contrib/ffmpeg/A10-h264-extradata.patch
deleted file mode 100644
index 9ad5c7337..000000000
--- a/contrib/ffmpeg/A10-h264-extradata.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c
-index 145dce3..b9c47ab 100644
---- a/libavcodec/h264_parser.c
-+++ b/libavcodec/h264_parser.c
-@@ -474,7 +474,8 @@ static int h264_split(AVCodecContext *avctx,
- * }
- */
- if ((state & 0xFFFFFF00) == 0x100 && (state & 0xFFFFFF1F) != 0x107 &&
-- (state & 0xFFFFFF1F) != 0x108 && (state & 0xFFFFFF1F) != 0x109) {
-+ (state & 0xFFFFFF1F) != 0x108 && (state & 0xFFFFFF1F) != 0x109 &&
-+ (state & 0xFFFFFF1F) != 0x10d) {
- if (has_sps) {
- while (i > 4 && buf[i - 5] == 0)
- i--;
diff --git a/contrib/ffmpeg/P01-solaris.patch b/contrib/ffmpeg/P01-solaris.patch
index 501a1f1d9..f51ac4171 100644
--- a/contrib/ffmpeg/P01-solaris.patch
+++ b/contrib/ffmpeg/P01-solaris.patch
@@ -1,13 +1,13 @@
diff --git a/configure b/configure
-index c6789d5..2ff3621 100755
+index 5085333..3d85303 100755
--- a/configure
+++ b/configure
-@@ -3602,7 +3602,7 @@ EOF
+@@ -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_inline_asm inline_asm_labels '"1:\n"'
-
+ check_gas() {
+ log "check_gas using '$as' as AS"
diff --git a/contrib/ffmpeg/P02-darwin-pic.patch b/contrib/ffmpeg/P02-darwin-pic.patch
index 79fd3313a..0b855a442 100644
--- a/contrib/ffmpeg/P02-darwin-pic.patch
+++ b/contrib/ffmpeg/P02-darwin-pic.patch
@@ -1,8 +1,8 @@
diff --git a/configure b/configure
-index c6789d5..d041718 100755
+index 5085333..41420e7 100755
--- a/configure
+++ b/configure
-@@ -3276,6 +3276,7 @@ case $target_os in
+@@ -3475,6 +3475,7 @@ case $target_os in
SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
objformat="macho"
enabled x86_64 && objformat="macho64"
@@ -10,7 +10,7 @@ index c6789d5..d041718 100755
enabled_any pic shared ||
{ check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
;;
-@@ -3515,7 +3516,7 @@ esc(){
+@@ -3720,7 +3721,7 @@ esc(){
echo "config:$arch:$subarch:$cpu:$target_os:$(esc $cc_ident):$(esc $LIBAV_CONFIGURATION)" >config.fate
diff --git a/contrib/ffmpeg/module.defs b/contrib/ffmpeg/module.defs
index 9956083f4..2bcd41d98 100644
--- a/contrib/ffmpeg/module.defs
+++ b/contrib/ffmpeg/module.defs
@@ -6,7 +6,7 @@ endif
$(eval $(call import.MODULE.defs,FFMPEG,ffmpeg,$(__deps__)))
$(eval $(call import.CONTRIB.defs,FFMPEG))
-FFMPEG.FETCH.url = http://download.handbrake.fr/handbrake/contrib/libav-v10.1.tar.bz2
+FFMPEG.FETCH.url = http://download.handbrake.fr/handbrake/contrib/libav-v11.2-0-g4039f11.tar.gz
FFMPEG.CONFIGURE.deps =
FFMPEG.CONFIGURE.env =