avcodec/vdpau: warn if the user application has not setup avctx->hwaccel_context...
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 6 Oct 2014 12:10:37 +0000 (14:10 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 6 Oct 2014 12:10:37 +0000 (14:10 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/vdpau.c

index 3162814..f2b4acd 100644 (file)
@@ -83,6 +83,12 @@ int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile,
     uint32_t width  = (avctx->coded_width + 1) & ~1;
     uint32_t height = (avctx->coded_height + 3) & ~3;
 
+    if (!hwctx) {
+        vdctx->device  = VDP_INVALID_HANDLE;
+        av_log(avctx, AV_LOG_WARNING, "hwaccel_context has not been setup by the user application, cannot initialize\n");
+        return 0;
+    }
+
     if (hwctx->context.decoder != VDP_INVALID_HANDLE) {
         vdctx->decoder = hwctx->context.decoder;
         vdctx->render  = hwctx->context.render;