summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPetri Hintukainen <phintuka@users.sourceforge.net>2012-06-05 11:52:38 +0300
committerPetri Hintukainen <phintuka@users.sourceforge.net>2012-06-05 11:52:38 +0300
commit589cd12c0ba1294f9d36358a07f0d782de09415e (patch)
treeb53111762a7207f02b21cb86e530b0e90038a93f /src
parent3b076d574b3e2ae13eebef53756014acf8b485df (diff)
downloadxine-lib-589cd12c0ba1294f9d36358a07f0d782de09415e.tar.gz
xine-lib-589cd12c0ba1294f9d36358a07f0d782de09415e.tar.bz2
Added check for AVCodecContext.color_range and AVCodecContext.colorspace
Diffstat (limited to 'src')
-rw-r--r--src/combined/ffmpeg/ff_video_decoder.c12
-rw-r--r--src/combined/ffmpeg/ffmpeg_compat.h5
2 files changed, 15 insertions, 2 deletions
diff --git a/src/combined/ffmpeg/ff_video_decoder.c b/src/combined/ffmpeg/ff_video_decoder.c
index f7817556f..ecd59ab80 100644
--- a/src/combined/ffmpeg/ff_video_decoder.c
+++ b/src/combined/ffmpeg/ff_video_decoder.c
@@ -145,12 +145,20 @@ struct ff_video_decoder_s {
static void ff_check_colorspace (ff_video_decoder_t *this) {
int i, cm;
+#ifdef AVCODEC_HAS_COLORSPACE
cm = this->context->colorspace << 1;
+#else
+ cm = 0;
+#endif
+
/* ffmpeg bug: color_range not set by svq3 decoder */
i = this->context->pix_fmt;
- if (cm && ((i == PIX_FMT_YUVJ420P) || (i == PIX_FMT_YUVJ444P) ||
- (this->context->color_range == AVCOL_RANGE_JPEG)))
+ if (cm && ((i == PIX_FMT_YUVJ420P) || (i == PIX_FMT_YUVJ444P)))
cm |= 1;
+#ifdef AVCODEC_HAS_COLORSPACE
+ if (this->context->color_range == AVCOL_RANGE_JPEG)
+ cm |= 1;
+#endif
/* report changes of colorspyce and/or color range */
if (cm != this->color_matrix) {
diff --git a/src/combined/ffmpeg/ffmpeg_compat.h b/src/combined/ffmpeg/ffmpeg_compat.h
index f0a49d7f2..f025dfec6 100644
--- a/src/combined/ffmpeg/ffmpeg_compat.h
+++ b/src/combined/ffmpeg/ffmpeg_compat.h
@@ -48,6 +48,11 @@
# undef AVCODEC_HAS_REORDERED_OPAQUE
#endif
+/* colorspace and color_range were added before 52.29.0 */
+#if LIBAVCODEC_VERSION_MAJOR > 52 || (LIBAVCODEC_VERSION_MAJOR == 52 && LIBAVCODEC_VERSION_MINOR >= 29)
+# define AVCODEC_HAS_COLORSPACE
+#endif
+
/**/
#if LIBAVCODEC_VERSION_MAJOR > 53 || (LIBAVCODEC_VERSION_MAJOR == 53 && LIBAVCODEC_VERSION_MINOR >= 8)
# define avcodec_init() do {} while(0)