]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/vdpau_vc1.c
cllc: Convert to the new bitstream reader
[ffmpeg] / libavcodec / vdpau_vc1.c
index 392c511ac89987af6e07d4d1f50cf2173b230190..4f87c52ecc99d4a5f2d33702480fe17065941a66 100644 (file)
@@ -44,12 +44,12 @@ static int vdpau_vc1_start_frame(AVCodecContext *avctx,
 
     switch (s->pict_type) {
     case AV_PICTURE_TYPE_B:
-        ref = ff_vdpau_get_surface_id(&s->next_picture.f);
+        ref = ff_vdpau_get_surface_id(s->next_picture.f);
         assert(ref != VDP_INVALID_HANDLE);
         info->backward_reference = ref;
         /* fall-through */
     case AV_PICTURE_TYPE_P:
-        ref = ff_vdpau_get_surface_id(&s->last_picture.f);
+        ref = ff_vdpau_get_surface_id(s->last_picture.f);
         assert(ref != VDP_INVALID_HANDLE);
         info->forward_reference  = ref;
     }
@@ -109,6 +109,27 @@ static int vdpau_vc1_decode_slice(AVCodecContext *avctx,
     return 0;
 }
 
+static int vdpau_vc1_init(AVCodecContext *avctx)
+{
+    VdpDecoderProfile profile;
+
+    switch (avctx->profile) {
+    case FF_PROFILE_VC1_SIMPLE:
+        profile = VDP_DECODER_PROFILE_VC1_SIMPLE;
+        break;
+    case FF_PROFILE_VC1_MAIN:
+        profile = VDP_DECODER_PROFILE_VC1_MAIN;
+        break;
+    case FF_PROFILE_VC1_ADVANCED:
+        profile = VDP_DECODER_PROFILE_VC1_ADVANCED;
+        break;
+    default:
+        return AVERROR(ENOTSUP);
+    }
+
+    return ff_vdpau_common_init(avctx, profile, avctx->level);
+}
+
 #if CONFIG_WMV3_VDPAU_HWACCEL
 AVHWAccel ff_wmv3_vdpau_hwaccel = {
     .name           = "wm3_vdpau",
@@ -118,7 +139,10 @@ AVHWAccel ff_wmv3_vdpau_hwaccel = {
     .start_frame    = vdpau_vc1_start_frame,
     .end_frame      = ff_vdpau_mpeg_end_frame,
     .decode_slice   = vdpau_vc1_decode_slice,
-    .priv_data_size = sizeof(struct vdpau_picture_context),
+    .frame_priv_data_size = sizeof(struct vdpau_picture_context),
+    .init           = vdpau_vc1_init,
+    .uninit         = ff_vdpau_common_uninit,
+    .priv_data_size = sizeof(VDPAUContext),
 };
 #endif
 
@@ -130,5 +154,8 @@ AVHWAccel ff_vc1_vdpau_hwaccel = {
     .start_frame    = vdpau_vc1_start_frame,
     .end_frame      = ff_vdpau_mpeg_end_frame,
     .decode_slice   = vdpau_vc1_decode_slice,
-    .priv_data_size = sizeof(struct vdpau_picture_context),
+    .frame_priv_data_size = sizeof(struct vdpau_picture_context),
+    .init           = vdpau_vc1_init,
+    .uninit         = ff_vdpau_common_uninit,
+    .priv_data_size = sizeof(VDPAUContext),
 };