aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/DllAvCodec.h4
-rw-r--r--lib/DllAvFilter.h2
-rw-r--r--lib/DllAvFormat.h8
-rw-r--r--lib/DllAvUtil.h4
-rw-r--r--lib/DllPostProc.h2
-rw-r--r--lib/DllSwResample.h4
-rw-r--r--lib/DllSwScale.h4
-rw-r--r--lib/Makefile.in14
-rw-r--r--lib/cximage-6.0/raw/libdcr.c24
-rw-r--r--lib/ffmpeg/libavcodec/dxva2.h1
-rw-r--r--lib/ffmpeg/libavcodec/dxva2_mpeg2.c25
-rw-r--r--lib/ffmpeg/patches/0018-dxva-mpeg2-Allocate-slices-array-dynamically-fixes-v.patch75
-rw-r--r--lib/ffmpeg/patches/0019-dxva-mpeg2-speed-up-slice-allocation.patch75
-rw-r--r--lib/ffmpeg/patches/0062-backport-dxva2-bump-max-number-of-slices.patch28
-rw-r--r--lib/libdvd/build-xbmc-win32.sh2
-rwxr-xr-xlib/libdvd/dvdread-config60
16 files changed, 140 insertions, 192 deletions
diff --git a/lib/DllAvCodec.h b/lib/DllAvCodec.h
index 5cef736405..af13a15d52 100644
--- a/lib/DllAvCodec.h
+++ b/lib/DllAvCodec.h
@@ -94,7 +94,7 @@ public:
virtual AVDictionary* av_frame_get_metadata(const AVFrame* frame)=0;
};
-#if (defined USE_EXTERNAL_FFMPEG) || (defined TARGET_DARWIN)
+#if (defined USE_EXTERNAL_FFMPEG) || (defined TARGET_DARWIN) || (defined USE_STATIC_FFMPEG)
// Use direct layer
class DllAvCodec : public DllDynamic, DllAvCodecInterface
@@ -166,7 +166,7 @@ public:
// DLL faking.
virtual bool ResolveExports() { return true; }
virtual bool Load() {
-#if !defined(TARGET_DARWIN)
+#if !defined(TARGET_DARWIN) && !defined(USE_STATIC_FFMPEG)
CLog::Log(LOGDEBUG, "DllAvCodec: Using libavcodec system library");
#endif
return true;
diff --git a/lib/DllAvFilter.h b/lib/DllAvFilter.h
index 2200bfafa6..05e5c6f734 100644
--- a/lib/DllAvFilter.h
+++ b/lib/DllAvFilter.h
@@ -104,7 +104,7 @@ public:
#endif
};
-#if (defined USE_EXTERNAL_FFMPEG) || (defined TARGET_DARWIN)
+#if (defined USE_EXTERNAL_FFMPEG) || (defined TARGET_DARWIN) || (defined USE_STATIC_FFMPEG)
// Use direct mapping
class DllAvFilter : public DllDynamic, DllAvFilterInterface
{
diff --git a/lib/DllAvFormat.h b/lib/DllAvFormat.h
index 0016c0b73e..fc7e16658e 100644
--- a/lib/DllAvFormat.h
+++ b/lib/DllAvFormat.h
@@ -41,7 +41,7 @@ extern "C" {
void xbmc_read_frame_flush(AVFormatContext *s);
#else
#include "libavformat/avformat.h"
- #if defined(TARGET_DARWIN)
+ #if defined(TARGET_DARWIN) || defined(USE_STATIC_FFMPEG)
void ff_read_frame_flush(AVFormatContext *s); // internal replacement
#define xbmc_read_frame_flush ff_read_frame_flush
#endif
@@ -73,7 +73,7 @@ public:
virtual int av_read_play(AVFormatContext *s)=0;
virtual int av_read_pause(AVFormatContext *s)=0;
virtual int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)=0;
-#if (!defined USE_EXTERNAL_FFMPEG) && (!defined TARGET_DARWIN)
+#if (!defined USE_EXTERNAL_FFMPEG) && (!defined TARGET_DARWIN) && (!defined USE_STATIC_FFMPEG)
virtual int avformat_find_stream_info_dont_call(AVFormatContext *ic, AVDictionary **options)=0;
#endif
virtual int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options)=0;
@@ -108,7 +108,7 @@ public:
#endif
};
-#if (defined USE_EXTERNAL_FFMPEG) || (defined TARGET_DARWIN)
+#if (defined USE_EXTERNAL_FFMPEG) || (defined TARGET_DARWIN) || (defined USE_STATIC_FFMPEG)
// Use direct mapping
class DllAvFormat : public DllDynamic, DllAvFormatInterface
@@ -170,7 +170,7 @@ public:
// DLL faking.
virtual bool ResolveExports() { return true; }
virtual bool Load() {
-#if !defined(TARGET_DARWIN)
+#if !defined(TARGET_DARWIN) && !defined(USE_STATIC_FFMPEG)
CLog::Log(LOGDEBUG, "DllAvFormat: Using libavformat system library");
#endif
CSingleLock lock(DllAvCodec::m_critSection);
diff --git a/lib/DllAvUtil.h b/lib/DllAvUtil.h
index ce5889b5ff..0fcdf10679 100644
--- a/lib/DllAvUtil.h
+++ b/lib/DllAvUtil.h
@@ -116,7 +116,7 @@ public:
#endif
};
-#if defined (USE_EXTERNAL_FFMPEG) || (defined TARGET_DARWIN)
+#if defined (USE_EXTERNAL_FFMPEG) || (defined TARGET_DARWIN) || (defined USE_STATIC_FFMPEG)
// Use direct layer
class DllAvUtilBase : public DllDynamic, DllAvUtilInterface
{
@@ -174,7 +174,7 @@ public:
// DLL faking.
virtual bool ResolveExports() { return true; }
virtual bool Load() {
-#if !defined(TARGET_DARWIN)
+#if !defined(TARGET_DARWIN) && !defined(USE_STATIC_FFMPEG)
CLog::Log(LOGDEBUG, "DllAvUtilBase: Using libavutil system library");
#endif
return true;
diff --git a/lib/DllPostProc.h b/lib/DllPostProc.h
index 02656510a4..e9542eb0b3 100644
--- a/lib/DllPostProc.h
+++ b/lib/DllPostProc.h
@@ -78,7 +78,7 @@ public:
virtual void pp_free_context(pp_context *ppContext)=0;
};
-#if (defined USE_EXTERNAL_FFMPEG) || (defined TARGET_DARWIN)
+#if (defined USE_EXTERNAL_FFMPEG) || (defined TARGET_DARWIN) || (defined USE_STATIC_FFMPEG)
// We call directly.
class DllPostProc : public DllDynamic, DllPostProcInterface
diff --git a/lib/DllSwResample.h b/lib/DllSwResample.h
index 854d25073c..cd1452b0f4 100644
--- a/lib/DllSwResample.h
+++ b/lib/DllSwResample.h
@@ -60,7 +60,7 @@ public:
virtual int swr_set_compensation(struct SwrContext *s, int sample_delta, int compensation_distance) = 0;
};
-#if (defined USE_EXTERNAL_FFMPEG) || (defined TARGET_DARWIN)
+#if (defined USE_EXTERNAL_FFMPEG) || (defined TARGET_DARWIN) || (defined USE_STATIC_FFMPEG)
// Use direct mapping
class DllSwResample : public DllDynamic, DllSwResampleInterface
@@ -71,7 +71,7 @@ public:
// DLL faking.
virtual bool ResolveExports() { return true; }
virtual bool Load() {
-#if !defined(TARGET_DARWIN)
+#if !defined(TARGET_DARWIN) && !defined(USE_STATIC_FFMPEG)
CLog::Log(LOGDEBUG, "DllAvFormat: Using libswresample system library");
#endif
return true;
diff --git a/lib/DllSwScale.h b/lib/DllSwScale.h
index 36bb616809..97e3b400ed 100644
--- a/lib/DllSwScale.h
+++ b/lib/DllSwScale.h
@@ -87,7 +87,7 @@ public:
virtual void sws_freeContext(struct SwsContext *context)=0;
};
-#if (defined USE_EXTERNAL_FFMPEG) || (defined TARGET_DARWIN)
+#if (defined USE_EXTERNAL_FFMPEG) || (defined TARGET_DARWIN) || (defined USE_STATIC_FFMPEG)
// We call into this library directly.
class DllSwScale : public DllDynamic, public DllSwScaleInterface
@@ -111,7 +111,7 @@ public:
// DLL faking.
virtual bool ResolveExports() { return true; }
virtual bool Load() {
-#if !defined(TARGET_DARWIN)
+#if !defined(TARGET_DARWIN) && !defined(USE_STATIC_FFMPEG)
CLog::Log(LOGDEBUG, "DllSwScale: Using libswscale system library");
#endif
return true;
diff --git a/lib/Makefile.in b/lib/Makefile.in
index 906219c573..ca18a4ae31 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -27,6 +27,7 @@ endif
LIBS=
ifneq (@USE_EXTERNAL_FFMPEG@,1)
+ifneq (@USE_STATIC_FFMPEG@,1)
LIBS+=$(AVUTIL_SO) \
$(AVCODEC_SO) \
$(AVFORMAT_SO) \
@@ -35,10 +36,12 @@ ifneq (@USE_EXTERNAL_FFMPEG@,1)
$(SWSCALE_SO) \
$(SWRESAMPLE_SO)
endif
+endif
.PHONY: $(DIRS) codecs
ifneq ($(findstring osx,$(ARCH)), osx)
+ifneq (@USE_STATIC_FFMPEG@,1)
codecs: $(addprefix $(SYSDIR)/, $(LIBS));
@@ -71,6 +74,17 @@ ffmpeg/libswscale/libswscale.so : ffmpeg;
ffmpeg/libpostproc/libpostproc.so : ffmpeg;
ffmpeg/libswresample/libswresample.so : ffmpeg;
endif
+endif
+
+ifeq (@USE_STATIC_FFMPEG@,1)
+ffmpeg/libavutil/libavutil.a : ffmpeg;
+ffmpeg/libavcodec/libavcodec.a : ffmpeg;
+ffmpeg/libavformat/libavformat.a : ffmpeg;
+ffmpeg/libavfilter/libavfilter.a : ffmpeg;
+ffmpeg/libswscale/libswscale.a : ffmpeg;
+ffmpeg/libpostproc/libpostproc.a : ffmpeg;
+ffmpeg/libswresample/libswresample.a : ffmpeg;
+endif
ffmpeg:
$(MAKE) -C $@
diff --git a/lib/cximage-6.0/raw/libdcr.c b/lib/cximage-6.0/raw/libdcr.c
index ced60c3665..e441afb742 100644
--- a/lib/cximage-6.0/raw/libdcr.c
+++ b/lib/cximage-6.0/raw/libdcr.c
@@ -837,6 +837,9 @@ int DCR_CLASS dcr_ljpeg_diff (DCRAW* p, struct dcr_decode *dindex)
{
int len, diff;
+ if (!dindex)
+ longjmp (p->failure, 2);
+
while (dindex->branch[0])
dindex = dindex->branch[dcr_getbits(p, 1)];
len = dindex->leaf;
@@ -894,6 +897,10 @@ void DCR_CLASS dcr_lossless_jpeg_load_raw(DCRAW* p)
ushort *rp;
if (!dcr_ljpeg_start (p,&jh, 0)) return;
+
+ if (jh.wide<1 || jh.high<1 || jh.clrs<1 || jh.bits<1)
+ longjmp (p->failure, 2);
+
jwide = jh.wide * jh.clrs;
for (jrow=0; jrow < jh.high; jrow++) {
@@ -922,6 +929,8 @@ void DCR_CLASS dcr_lossless_jpeg_load_raw(DCRAW* p)
}
if (++col >= p->raw_width)
col = (row++,0);
+ if (row >= p->raw_height)
+ longjmp (p->failure, 3);
}
}
free (jh.row);
@@ -4973,6 +4982,7 @@ int DCR_CLASS dcr_parse_tiff_ifd (DCRAW* p, int base)
p->data_offset = dcr_get4(p)+base;
ifd++; break;
}
+ if(len > 1000) len=1000; /* 1000 SubIFDs is enough */
while (len--) {
i = dcr_ftell(p->obj_);
dcr_fseek(p->obj_, dcr_get4(p)+base, SEEK_SET);
@@ -5161,7 +5171,7 @@ guess_cfa_pc:
case 50714: /* BlackLevel */
case 50715: /* BlackLevelDeltaH */
case 50716: /* BlackLevelDeltaV */
- for (dblack=i=0; i < (int)len; i++)
+ for (dblack=i=0; i < (int)len && i < 65536; i++)
dblack += dcr_getreal(p, type);
p->black += (unsigned int)(dblack/len + 0.5);
break;
@@ -5275,9 +5285,11 @@ void DCR_CLASS dcr_parse_tiff (DCRAW* p, int base)
if (p->thumb_offset) {
dcr_fseek(p->obj_, p->thumb_offset, SEEK_SET);
if (dcr_ljpeg_start (p,&jh, 1)) {
- p->thumb_misc = jh.bits;
- p->thumb_width = jh.wide;
- p->thumb_height = jh.high;
+ if ((unsigned)jh.bits<17 && (unsigned)jh.wide < 0x10000 && (unsigned)jh.high < 0x10000) {
+ p->thumb_misc = jh.bits;
+ p->thumb_width = jh.wide;
+ p->thumb_height = jh.high;
+ }
}
}
for (i=0; i < (int)p->tiff_nifds; i++) {
@@ -5285,6 +5297,8 @@ void DCR_CLASS dcr_parse_tiff (DCRAW* p, int base)
max_samp = p->tiff_ifd[i].samples;
if (max_samp > 3) max_samp = 3;
if ((p->tiff_ifd[i].comp != 6 || p->tiff_ifd[i].samples != 3) &&
+ (unsigned)(p->tiff_ifd[i].width | p->tiff_ifd[i].height) < 0x10000 &&
+ (unsigned)p->tiff_ifd[i].bps < 33 && (unsigned)p->tiff_ifd[i].samples < 13 &&
p->tiff_ifd[i].width*p->tiff_ifd[i].height > p->raw_width*p->raw_height) {
p->raw_width = p->tiff_ifd[i].width;
p->raw_height = p->tiff_ifd[i].height;
@@ -5348,6 +5362,8 @@ void DCR_CLASS dcr_parse_tiff (DCRAW* p, int base)
if (p->tiff_bps == 8 && p->tiff_samples == 4) p->is_raw = 0;
for (i=0; i < (int)p->tiff_nifds; i++)
if (i != raw && p->tiff_ifd[i].samples == max_samp &&
+ p->tiff_ifd[i].bps>0 && p->tiff_ifd[i].bps < 33 &&
+ (unsigned)(p->tiff_ifd[i].width | p->tiff_ifd[i].height) < 0x10000 &&
p->tiff_ifd[i].width * p->tiff_ifd[i].height / SQR(p->tiff_ifd[i].bps+1) >
(int)(p->thumb_width * p->thumb_height / SQR(p->thumb_misc+1))) {
p->thumb_width = p->tiff_ifd[i].width;
diff --git a/lib/ffmpeg/libavcodec/dxva2.h b/lib/ffmpeg/libavcodec/dxva2.h
index 881b48dac5..ac39e06917 100644
--- a/lib/ffmpeg/libavcodec/dxva2.h
+++ b/lib/ffmpeg/libavcodec/dxva2.h
@@ -86,7 +86,6 @@ struct dxva_context {
* Private to the FFmpeg AVHWAccel implementation
*/
unsigned report_id;
- unsigned last_slice_count;
};
/**
diff --git a/lib/ffmpeg/libavcodec/dxva2_mpeg2.c b/lib/ffmpeg/libavcodec/dxva2_mpeg2.c
index e967770208..5db7316876 100644
--- a/lib/ffmpeg/libavcodec/dxva2_mpeg2.c
+++ b/lib/ffmpeg/libavcodec/dxva2_mpeg2.c
@@ -22,13 +22,12 @@
#include "dxva2_internal.h"
+#define MAX_SLICES 1024
struct dxva2_picture_context {
DXVA_PictureParameters pp;
DXVA_QmatrixData qm;
unsigned slice_count;
- DXVA_SliceInfo *slice;
- unsigned int slice_alloc;
-
+ DXVA_SliceInfo slice[MAX_SLICES];
const uint8_t *bitstream;
unsigned bitstream_size;
};
@@ -220,20 +219,9 @@ static int dxva2_mpeg2_start_frame(AVCodecContext *avctx,
fill_quantization_matrices(avctx, ctx, s, &ctx_pic->qm);
ctx_pic->slice_count = 0;
- ctx_pic->slice = NULL;
- ctx_pic->slice_alloc = 0;
ctx_pic->bitstream_size = 0;
ctx_pic->bitstream = NULL;
- if (ctx->last_slice_count > 0)
- {
- ctx_pic->slice = av_fast_realloc(NULL,
- &ctx_pic->slice_alloc,
- ctx->last_slice_count * sizeof(DXVA_SliceInfo));
- if (!ctx_pic->slice)
- return -1;
- }
-
return 0;
}
@@ -244,14 +232,9 @@ static int dxva2_mpeg2_decode_slice(AVCodecContext *avctx,
struct dxva2_picture_context *ctx_pic =
s->current_picture_ptr->f.hwaccel_picture_private;
unsigned position;
- DXVA_SliceInfo* slice;
- slice = av_fast_realloc(ctx_pic->slice,
- &ctx_pic->slice_alloc,
- (ctx_pic->slice_count + 1) * sizeof(DXVA_SliceInfo));
- if (!slice)
+ if (ctx_pic->slice_count >= MAX_SLICES)
return -1;
- ctx_pic->slice = slice;
if (!ctx_pic->bitstream)
ctx_pic->bitstream = buffer;
@@ -268,7 +251,6 @@ static int dxva2_mpeg2_end_frame(AVCodecContext *avctx)
struct MpegEncContext *s = avctx->priv_data;
struct dxva2_picture_context *ctx_pic =
s->current_picture_ptr->f.hwaccel_picture_private;
- struct dxva_context *ctx = avctx->hwaccel_context;
int ret;
if (ctx_pic->slice_count <= 0 || ctx_pic->bitstream_size <= 0)
@@ -280,7 +262,6 @@ static int dxva2_mpeg2_end_frame(AVCodecContext *avctx)
if (!ret)
ff_mpeg_draw_horiz_band(s, 0, avctx->height);
- ctx->last_slice_count = ctx_pic->slice_count;
return ret;
}
diff --git a/lib/ffmpeg/patches/0018-dxva-mpeg2-Allocate-slices-array-dynamically-fixes-v.patch b/lib/ffmpeg/patches/0018-dxva-mpeg2-Allocate-slices-array-dynamically-fixes-v.patch
deleted file mode 100644
index 87e31c5b70..0000000000
--- a/lib/ffmpeg/patches/0018-dxva-mpeg2-Allocate-slices-array-dynamically-fixes-v.patch
+++ /dev/null
@@ -1,75 +0,0 @@
-From 40f4c15370f7027dc5422edcb10e8a3b7e58e83d Mon Sep 17 00:00:00 2001
-From: CrystalP <CrystalP@xbmc.org>
-Date: Wed, 5 Oct 2011 12:38:30 -0400
-Subject: [PATCH 18/24] dxva-mpeg2 Allocate slices array dynamically - fixes
- videos with > 175 slices. They used to result in
- images with a black bottom.
-
-sample on team ftp samples/PR471/too_many_slices.ts
-
-Inspired by the vaapi code to reallocate the slices array for each new slice.
-Could be more efficient if the array could be preserved for all frames and
-freed only at the end of the video, but there doesn't seem to be anywhere
-appropriate to free the memory at the end.
-
-Alternative is to allocate the proper size straight away for a new frame,
-instead of realloc'ing for each slice.
----
- libavcodec/dxva2_mpeg2.c | 14 +++++++++++---
- 1 file changed, 11 insertions(+), 3 deletions(-)
-
-diff --git a/libavcodec/dxva2_mpeg2.c b/libavcodec/dxva2_mpeg2.c
-index 951305d..8ba83b6 100644
---- a/libavcodec/dxva2_mpeg2.c
-+++ b/libavcodec/dxva2_mpeg2.c
-@@ -22,12 +22,12 @@
-
- #include "dxva2_internal.h"
-
--#define MAX_SLICES (SLICE_MAX_START_CODE - SLICE_MIN_START_CODE + 1)
- struct dxva2_picture_context {
- DXVA_PictureParameters pp;
- DXVA_QmatrixData qm;
- unsigned slice_count;
-- DXVA_SliceInfo slice[MAX_SLICES];
-+ DXVA_SliceInfo *slice;
-+ unsigned int slice_alloc;
-
- const uint8_t *bitstream;
- unsigned bitstream_size;
-@@ -220,6 +220,8 @@ static int start_frame(AVCodecContext *avctx,
- fill_quantization_matrices(avctx, ctx, s, &ctx_pic->qm);
-
- ctx_pic->slice_count = 0;
-+ ctx_pic->slice = NULL;
-+ ctx_pic->slice_alloc = 0;
- ctx_pic->bitstream_size = 0;
- ctx_pic->bitstream = NULL;
- return 0;
-@@ -232,9 +234,14 @@ static int decode_slice(AVCodecContext *avctx,
- struct dxva2_picture_context *ctx_pic =
- s->current_picture_ptr->f.hwaccel_picture_private;
- unsigned position;
-+ DXVA_SliceInfo* slice;
-
-- if (ctx_pic->slice_count >= MAX_SLICES)
-+ slice = av_fast_realloc(ctx_pic->slice,
-+ &ctx_pic->slice_alloc,
-+ (ctx_pic->slice_count + 1) * sizeof(DXVA_SliceInfo));
-+ if (!slice)
- return -1;
-+ ctx_pic->slice = slice;
-
- if (!ctx_pic->bitstream)
- ctx_pic->bitstream = buffer;
-@@ -258,6 +265,7 @@ static int end_frame(AVCodecContext *avctx)
- &ctx_pic->pp, sizeof(ctx_pic->pp),
- &ctx_pic->qm, sizeof(ctx_pic->qm),
- commit_bitstream_and_slice_buffer);
-+ av_freep(ctx_pic->slice);
- }
-
- AVHWAccel ff_mpeg2_dxva2_hwaccel = {
---
-1.7.9.4
-
diff --git a/lib/ffmpeg/patches/0019-dxva-mpeg2-speed-up-slice-allocation.patch b/lib/ffmpeg/patches/0019-dxva-mpeg2-speed-up-slice-allocation.patch
deleted file mode 100644
index 4336c3180f..0000000000
--- a/lib/ffmpeg/patches/0019-dxva-mpeg2-speed-up-slice-allocation.patch
+++ /dev/null
@@ -1,75 +0,0 @@
-From 681f74b224e16a4df7f8c4e31a9be56975d57e10 Mon Sep 17 00:00:00 2001
-From: CrystalP <CrystalP@xbmc.org>
-Date: Mon, 10 Oct 2011 19:42:50 -0400
-Subject: [PATCH 19/24] dxva-mpeg2 speed up slice allocation
-
-The number of slices is not very likely to change from frame to frame, so
-at the beginning of a new frame, allocate memory for the amount of slices of
-the previous frame. Saves a lot of reallocation, for some TV capture samples
-there are over 200 slices.
-
-There wasn't anywhere really appropriate to store last_slice_count (needs to
-live from first frame to last frame), so this is likely to cause discussion to
-merge upstream.
-Adding members to dxva_context breaks ABI, which we don't care too much about
-since on Windows we don't support external ffmpeg.
-dxva mpeg2 code also has access to MpegEncContext, but adding there would
-likely break ABI as well.
----
- libavcodec/dxva2.h | 1 +
- libavcodec/dxva2_mpeg2.c | 12 ++++++++++++
- 2 files changed, 13 insertions(+)
-
-diff --git a/libavcodec/dxva2.h b/libavcodec/dxva2.h
-index fc99560..16a6994 100644
---- a/libavcodec/dxva2.h
-+++ b/libavcodec/dxva2.h
-@@ -66,6 +66,7 @@ struct dxva_context {
- * Private to the FFmpeg AVHWAccel implementation
- */
- unsigned report_id;
-+ unsigned last_slice_count;
- };
-
- #endif /* AVCODEC_DXVA_H */
-diff --git a/libavcodec/dxva2_mpeg2.c b/libavcodec/dxva2_mpeg2.c
-index 8ba83b6..90507f9 100644
---- a/libavcodec/dxva2_mpeg2.c
-+++ b/libavcodec/dxva2_mpeg2.c
-@@ -222,6 +222,16 @@
- ctx_pic->slice_count = 0;
- ctx_pic->bitstream_size = 0;
- ctx_pic->bitstream = NULL;
-+
-+ if (ctx->last_slice_count > 0)
-+ {
-+ ctx_pic->slice = av_fast_realloc(NULL,
-+ &ctx_pic->slice_alloc,
-+ ctx->last_slice_count * sizeof(DXVA_SliceInfo));
-+ if (!ctx_pic->slice)
-+ return -1;
-+ }
-+
- return 0;
- }
-
-@@ -251,6 +261,7 @@
- struct MpegEncContext *s = avctx->priv_data;
- struct dxva2_picture_context *ctx_pic =
- s->current_picture_ptr->f.hwaccel_picture_private;
-+ struct dxva_context *ctx = avctx->hwaccel_context;
- int ret;
-
- if (ctx_pic->slice_count <= 0 || ctx_pic->bitstream_size <= 0)
-@@ -261,6 +272,8 @@
- commit_bitstream_and_slice_buffer);
- if (!ret)
- ff_mpeg_draw_horiz_band(s, 0, avctx->height);
-+
-+ ctx->last_slice_count = ctx_pic->slice_count;
- return ret;
- }
-
---
-1.7.9.4
-
diff --git a/lib/ffmpeg/patches/0062-backport-dxva2-bump-max-number-of-slices.patch b/lib/ffmpeg/patches/0062-backport-dxva2-bump-max-number-of-slices.patch
new file mode 100644
index 0000000000..9d0e5cbc40
--- /dev/null
+++ b/lib/ffmpeg/patches/0062-backport-dxva2-bump-max-number-of-slices.patch
@@ -0,0 +1,28 @@
+From bceeccc648baf94a02b7b2c53e44bf77a47773ef Mon Sep 17 00:00:00 2001
+From: Rainer Hochecker <fernetmenta@online.de>
+Date: Mon, 27 Jan 2014 08:16:13 +0100
+Subject: [PATCH] dxva2: bump maximum number of slieces for mpeg2
+
+Suggested by heleppkes on https://trac.ffmpeg.org/ticket/3133
+
+Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
+---
+ libavcodec/dxva2_mpeg2.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libavcodec/dxva2_mpeg2.c b/libavcodec/dxva2_mpeg2.c
+index 1827dd5..e2f6b70 100644
+--- a/libavcodec/dxva2_mpeg2.c
++++ b/libavcodec/dxva2_mpeg2.c
+@@ -22,7 +22,7 @@
+
+ #include "dxva2_internal.h"
+
+-#define MAX_SLICES (SLICE_MAX_START_CODE - SLICE_MIN_START_CODE + 1)
++#define MAX_SLICES 1024
+ struct dxva2_picture_context {
+ DXVA_PictureParameters pp;
+ DXVA_QmatrixData qm;
+--
+1.8.5.1
+
diff --git a/lib/libdvd/build-xbmc-win32.sh b/lib/libdvd/build-xbmc-win32.sh
index ed00ad0904..3babd83398 100644
--- a/lib/libdvd/build-xbmc-win32.sh
+++ b/lib/libdvd/build-xbmc-win32.sh
@@ -64,7 +64,7 @@ echo "***** Building libdvdnav *****"
--disable-shared \
--enable-static \
--extra-cflags="-D_XBMC -DNDEBUG -I`pwd`/../includes" \
- --with-dvdread-config="`pwd`/../libdvdread/obj/dvdread-config" \
+ --with-dvdread-config="`pwd`/../dvdread-config" \
--disable-debug
mkdir -p ../includes/dvdnav
cp ../libdvdnav/src/dvdnav/*.h ../includes/dvdnav
diff --git a/lib/libdvd/dvdread-config b/lib/libdvd/dvdread-config
new file mode 100755
index 0000000000..b28b1cac77
--- /dev/null
+++ b/lib/libdvd/dvdread-config
@@ -0,0 +1,60 @@
+#!/bin/sh
+
+# this configfile is based on the original libdvdread config
+# 'dvdread-config' but stripped down to not output the include
+# and libdirs to not break crosscompiling with including
+# system includes and libraries
+
+prefix=/usr
+dvdreadlib="-ldvdread"
+
+usage()
+{
+ cat <<EOF
+Usage: dvdread-config [OPTIONS] [LIBRARIES]
+Options:
+ [--prefix[=DIR]]
+ [--libs]
+ [--cflags]
+EOF
+ exit $1
+}
+
+if test $# -eq 0; then
+ usage 1 1>&2
+fi
+
+while test $# -gt 0; do
+ case "$1" in
+ -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) optarg= ;;
+ esac
+
+ case $1 in
+ --prefix)
+ echo_prefix=yes
+ ;;
+ --cflags)
+ echo_cflags=yes
+ ;;
+ --libs)
+ echo_libs=yes
+ ;;
+ *)
+ usage 1 1>&2
+ ;;
+ esac
+ shift
+done
+
+if test "$echo_prefix" = "yes"; then
+ echo $prefix
+fi
+
+if test "$echo_cflags" = "yes"; then
+ echo $extracflags
+fi
+
+if test "$echo_libs" = "yes"; then
+ echo $dvdreadlib
+fi