summaryrefslogtreecommitdiffstats
path: root/ffmpeg_vdpau.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-10-06 15:27:19 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-10-06 16:09:02 +0200
commit403133ab5eb39b5d6d1d2a94e881a40023caa109 (patch)
tree474c000a10247f0e6e175367b52525484134d698 /ffmpeg_vdpau.c
parent573d3330107b9a49d6bfbfc739727f8d1516a7a1 (diff)
downloadffmpeg-streaming-403133ab5eb39b5d6d1d2a94e881a40023caa109.zip
ffmpeg-streaming-403133ab5eb39b5d6d1d2a94e881a40023caa109.tar.gz
ffmpeg: add vdpau_old to allow continued testing of the older (but not oldest) API
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'ffmpeg_vdpau.c')
-rw-r--r--ffmpeg_vdpau.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/ffmpeg_vdpau.c b/ffmpeg_vdpau.c
index fe09306..ef35d22 100644
--- a/ffmpeg_vdpau.c
+++ b/ffmpeg_vdpau.c
@@ -57,6 +57,8 @@ typedef struct VDPAUContext {
VdpYCbCrFormat vdpau_format;
} VDPAUContext;
+int vdpau_api_ver = 2;
+
static void vdpau_uninit(AVCodecContext *s)
{
InputStream *ist = s->opaque;
@@ -291,6 +293,49 @@ fail:
return AVERROR(EINVAL);
}
+static int vdpau_old_init(AVCodecContext *s)
+{
+ InputStream *ist = s->opaque;
+ int loglevel = (ist->hwaccel_id == HWACCEL_AUTO) ? AV_LOG_VERBOSE : AV_LOG_ERROR;
+ AVVDPAUContext *vdpau_ctx;
+ VDPAUContext *ctx;
+ VdpStatus err;
+ int profile, ret;
+
+ if (!ist->hwaccel_ctx) {
+ ret = vdpau_alloc(s);
+ if (ret < 0)
+ return ret;
+ }
+ ctx = ist->hwaccel_ctx;
+ vdpau_ctx = s->hwaccel_context;
+
+ ret = av_vdpau_get_profile(s, &profile);
+ if (ret < 0) {
+ av_log(NULL, loglevel, "No known VDPAU decoder profile for this stream.\n");
+ return AVERROR(EINVAL);
+ }
+
+ if (ctx->decoder)
+ ctx->decoder_destroy(ctx->decoder);
+
+ err = ctx->decoder_create(ctx->device, profile,
+ s->coded_width, s->coded_height,
+ 16, &ctx->decoder);
+ if (err != VDP_STATUS_OK) {
+ av_log(NULL, loglevel, "Error creating the VDPAU decoder: %s\n",
+ ctx->get_error_string(err));
+ return AVERROR_UNKNOWN;
+ }
+
+ vdpau_ctx->decoder = ctx->decoder;
+
+ ist->hwaccel_get_buffer = vdpau_get_buffer;
+ ist->hwaccel_retrieve_data = vdpau_retrieve_data;
+
+ return 0;
+}
+
int vdpau_init(AVCodecContext *s)
{
InputStream *ist = s->opaque;
@@ -300,6 +345,9 @@ int vdpau_init(AVCodecContext *s)
VdpStatus err;
int profile, ret;
+ if (vdpau_api_ver == 1)
+ return vdpau_old_init(s);
+
if (!ist->hwaccel_ctx) {
ret = vdpau_alloc(s);
if (ret < 0)
OpenPOWER on IntegriCloud