summaryrefslogtreecommitdiff
path: root/codec.c
diff options
context:
space:
mode:
authorJohns <johns98@gmx.net>2013-01-23 21:54:56 +0100
committerJohns <johns98@gmx.net>2013-01-23 21:54:56 +0100
commit04286fb2ad742f33ce6abd055a108483d2a2d16c (patch)
tree8cc25e1741474e5697a1308802585d606164ef8b /codec.c
parentcd82ee8e4a01e29cc9aa616ba9a68c5c59e11d89 (diff)
downloadvdr-plugin-softhddevice-04286fb2ad742f33ce6abd055a108483d2a2d16c.tar.gz
vdr-plugin-softhddevice-04286fb2ad742f33ce6abd055a108483d2a2d16c.tar.bz2
Add video compatibility with >=ffmpeg 1.1.
Diffstat (limited to 'codec.c')
-rw-r--r--codec.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/codec.c b/codec.c
index dfaed74..c557144 100644
--- a/codec.c
+++ b/codec.c
@@ -115,17 +115,22 @@ struct _video_decoder_
/**
** Callback to negotiate the PixelFormat.
**
-** @param fmt is the list of formats which are supported by the codec,
-** it is terminated by -1 as 0 is a valid format, the
-** formats are ordered by quality.
+** @param video_ctx codec context
+** @param fmt is the list of formats which are supported by
+** the codec, it is terminated by -1 as 0 is a
+** valid format, the formats are ordered by
+** quality.
*/
static enum PixelFormat Codec_get_format(AVCodecContext * video_ctx,
const enum PixelFormat *fmt)
{
VideoDecoder *decoder;
+ if (!video_ctx->width || !video_ctx->height) {
+ Error("codec/video: ffmpeg/libav buggy\n");
+ }
+
decoder = video_ctx->opaque;
- //Debug(3, "codec: %s: %18p\n", __FUNCTION__, decoder);
decoder->GetFormatDone = 1;
return Video_get_format(decoder->HwDecoder, video_ctx, fmt);
}
@@ -143,11 +148,15 @@ static int Codec_get_buffer(AVCodecContext * video_ctx, AVFrame * frame)
VideoDecoder *decoder;
decoder = video_ctx->opaque;
+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(54,86,100)
+ // ffmpeg has this already fixed
+ // libav 0.8.5 53.35.0 still needs this
+#endif
if (!decoder->GetFormatDone) { // get_format missing
enum PixelFormat fmts[2];
- fprintf(stderr, "codec: buggy ffmpeg/libav\n");
- Warning(_("codec: buggy ffmpeg/libav\n"));
+ fprintf(stderr, "codec: buggy libav, use ffmpeg\n");
+ Warning(_("codec: buggy libav, use ffmpeg\n"));
fmts[0] = video_ctx->pix_fmt;
fmts[1] = PIX_FMT_NONE;
Codec_get_format(video_ctx, fmts);
@@ -160,16 +169,13 @@ static int Codec_get_buffer(AVCodecContext * video_ctx, AVFrame * frame)
unsigned surface;
struct vdpau_render_state *vrs;
- surface = VideoGetSurface(decoder->HwDecoder);
+ surface = VideoGetSurface(decoder->HwDecoder, video_ctx);
vrs = av_mallocz(sizeof(struct vdpau_render_state));
vrs->surface = surface;
//Debug(3, "codec: use surface %#010x\n", surface);
frame->type = FF_BUFFER_TYPE_USER;
-#if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(53,46,0)
- frame->age = 256 * 256 * 256 * 64;
-#endif
// render
frame->data[0] = (void *)vrs;
frame->data[1] = NULL;
@@ -189,14 +195,11 @@ static int Codec_get_buffer(AVCodecContext * video_ctx, AVFrame * frame)
if (video_ctx->hwaccel_context) {
unsigned surface;
- surface = VideoGetSurface(decoder->HwDecoder);
+ surface = VideoGetSurface(decoder->HwDecoder, video_ctx);
//Debug(3, "codec: use surface %#010x\n", surface);
frame->type = FF_BUFFER_TYPE_USER;
-#if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(53,46,0)
- frame->age = 256 * 256 * 256 * 64;
-#endif
// vaapi needs both fields set
frame->data[0] = (void *)(size_t) surface;
frame->data[3] = (void *)(size_t) surface;