summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohns <johns98@gmx.net>2013-02-25 16:33:40 +0100
committerJohns <johns98@gmx.net>2013-02-25 16:33:40 +0100
commit21e4f4ee04bfb6ba25ee5be33030192124899446 (patch)
tree41496fd89383b0a4c40bbfc3f55d61f1c312f9e1
parent746746d5b72000bb42dee61617bdc149e4457948 (diff)
downloadvdr-plugin-softhddevice-21e4f4ee04bfb6ba25ee5be33030192124899446.tar.gz
vdr-plugin-softhddevice-21e4f4ee04bfb6ba25ee5be33030192124899446.tar.bz2
Workaround for ffmpeg 1.1.x get_format bug.
-rw-r--r--video.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/video.c b/video.c
index 2cbfa0e..0049850 100644
--- a/video.c
+++ b/video.c
@@ -152,6 +152,15 @@ typedef enum
#include <libavcodec/vaapi.h>
#include <libavutil/pixdesc.h>
+#if LIBAVCODEC_VERSION_INT == AV_VERSION_INT(54,86,100)
+ ///
+ /// ffmpeg version 1.1.1 calls get_format with zero width and height
+ /// for H264 codecs.
+ /// since version 1.1.3 get_format is called twice.
+ ///
+#define FFMPEG_BUG1_WORKAROUND ///< get_format bug workaround
+#endif
+
#include "misc.h"
#include "video.h"
#include "audio.h"
@@ -2429,6 +2438,7 @@ static void VaapiSetup(VaapiDecoder * decoder,
static VASurfaceID VaapiGetSurface(VaapiDecoder * decoder,
const AVCodecContext * video_ctx)
{
+#ifdef FFMPEG_BUG1_WORKAROUND
// get_format not called with valid informations.
if (video_ctx->width != decoder->InputWidth
|| video_ctx->height != decoder->InputHeight) {
@@ -2459,6 +2469,7 @@ static VASurfaceID VaapiGetSurface(VaapiDecoder * decoder,
}
// FIXME: too late to switch to software rending on failures
}
+#endif
return VaapiGetSurface0(decoder);
}
@@ -2659,7 +2670,7 @@ static enum PixelFormat Vaapi_get_format(VaapiDecoder * decoder,
decoder->InputWidth = 0;
decoder->InputHeight = 0;
-#if 0
+#ifndef FFMPEG_BUG1_WORKAROUND
if (video_ctx->width && video_ctx->height) {
VAStatus status;
@@ -6743,6 +6754,7 @@ static void VdpauSetupOutput(VdpauDecoder * decoder)
static unsigned VdpauGetSurface(VdpauDecoder * decoder,
const AVCodecContext * video_ctx)
{
+#ifdef FFMPEG_BUG1_WORKAROUND
// get_format not called with valid informations.
if (video_ctx->width != decoder->InputWidth
|| video_ctx->height != decoder->InputHeight) {
@@ -6766,6 +6778,7 @@ static unsigned VdpauGetSurface(VdpauDecoder * decoder,
VdpauSetupOutput(decoder);
}
+#endif
return VdpauGetSurface0(decoder);
}
@@ -6925,7 +6938,7 @@ static enum PixelFormat Vdpau_get_format(VdpauDecoder * decoder,
decoder->InputWidth = 0;
decoder->InputHeight = 0;
-#if 0
+#ifndef FFMPEG_BUG1_WORKAROUND
if (video_ctx->width && video_ctx->height) {
VdpStatus status;