summaryrefslogtreecommitdiff
path: root/libavcodec/vdpau.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-10-06 15:04:03 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-10-06 15:04:03 +0200
commita61899a0f13c0b8fca26472537cf60da04347c6d (patch)
treef0fb8d03ea22d04afcc01df1b94ad6e973b32359 /libavcodec/vdpau.c
parent067d11bf71e87d6bcc6a12eb302d6281a0d2408d (diff)
parente3e158e81f0666b8fe66be9ce1cad63a535920e0 (diff)
Merge commit 'e3e158e81f0666b8fe66be9ce1cad63a535920e0'
* commit 'e3e158e81f0666b8fe66be9ce1cad63a535920e0': vdpau: add av_vdpau_bind_context() Conflicts: doc/APIchanges libavcodec/vdpau.h libavcodec/version.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/vdpau.c')
-rw-r--r--libavcodec/vdpau.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c
index 93fbc92a6b..875c331b54 100644
--- a/libavcodec/vdpau.c
+++ b/libavcodec/vdpau.c
@@ -85,6 +85,7 @@ int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile,
vdctx->width = UINT32_MAX;
vdctx->height = UINT32_MAX;
+ hwctx->reset = 0;
if (!hwctx) {
vdctx->device = VDP_INVALID_HANDLE;
@@ -151,12 +152,13 @@ int ff_vdpau_common_uninit(AVCodecContext *avctx)
static int ff_vdpau_common_reinit(AVCodecContext *avctx)
{
+ VDPAUHWContext *hwctx = avctx->hwaccel_context;
VDPAUContext *vdctx = avctx->internal->hwaccel_priv_data;
if (vdctx->device == VDP_INVALID_HANDLE)
return 0; /* Decoder created by user */
if (avctx->coded_width == vdctx->width &&
- avctx->coded_height == vdctx->height)
+ avctx->coded_height == vdctx->height && !hwctx->reset)
return 0;
avctx->hwaccel->uninit(avctx);
@@ -639,4 +641,22 @@ AVVDPAUContext *av_vdpau_alloc_context(void)
return av_mallocz(sizeof(AVVDPAUContext));
}
+int av_vdpau_bind_context(AVCodecContext *avctx, VdpDevice device,
+ VdpGetProcAddress *get_proc, unsigned flags)
+{
+ VDPAUHWContext *hwctx;
+
+ if (av_reallocp(&avctx->hwaccel_context, sizeof(*hwctx)))
+ return AVERROR(ENOMEM);
+
+ hwctx = avctx->hwaccel_context;
+
+ memset(hwctx, 0, sizeof(*hwctx));
+ hwctx->context.decoder = VDP_INVALID_HANDLE;
+ hwctx->device = device;
+ hwctx->get_proc_address = get_proc;
+ hwctx->reset = 1;
+ return 0;
+}
+
/* @}*/