]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/vdpau.c
mpegvideo_enc: Check AVCodecContext allocation
[ffmpeg] / libavcodec / vdpau.c
index ea67314f93babfb9d42582792b7d6754e56e509f..8606624a850d46071a2b79a1386bb562485af39f 100644 (file)
@@ -142,6 +142,10 @@ int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile,
     if (av_vdpau_get_surface_parameters(avctx, &type, &width, &height))
         return AVERROR(ENOSYS);
 
+    if (!(hwctx->flags & AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH) &&
+        type != VDP_CHROMA_TYPE_420)
+        return AVERROR(ENOSYS);
+
     status = vdctx->get_proc_address(vdctx->device,
                                      VDP_FUNC_ID_VIDEO_SURFACE_QUERY_CAPABILITIES,
                                      &func);
@@ -371,7 +375,7 @@ int av_vdpau_bind_context(AVCodecContext *avctx, VdpDevice device,
 {
     VDPAUHWContext *hwctx;
 
-    if (flags & ~AV_HWACCEL_FLAG_IGNORE_LEVEL)
+    if (flags & ~(AV_HWACCEL_FLAG_IGNORE_LEVEL|AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH))
         return AVERROR(EINVAL);
 
     if (av_reallocp(&avctx->hwaccel_context, sizeof(*hwctx)))