]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/vdpau_mpeg12.c
avutil: add alias names for gray 8/16 colour spaces
[ffmpeg] / libavcodec / vdpau_mpeg12.c
index d2d4ac3c25b94c1e6bc7bcc3e55b82efbfc1570f..2b53e66edea24d1fd30a33646eda460eb2ab1cba 100644 (file)
@@ -31,8 +31,9 @@ static int vdpau_mpeg_start_frame(AVCodecContext *avctx,
                                   const uint8_t *buffer, uint32_t size)
 {
     MpegEncContext * const s = avctx->priv_data;
-    AVVDPAUContext *hwctx    = avctx->hwaccel_context;
-    VdpPictureInfoMPEG1Or2 *info = &hwctx->info.mpeg;
+    Picture *pic             = s->current_picture_ptr;
+    struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private;
+    VdpPictureInfoMPEG1Or2 *info = &pic_ctx->info.mpeg;
     VdpVideoSurface ref;
     int i;
 
@@ -42,13 +43,13 @@ static int vdpau_mpeg_start_frame(AVCodecContext *avctx,
 
     switch (s->pict_type) {
     case AV_PICTURE_TYPE_B:
-        ref = ff_vdpau_get_surface_id(&s->next_picture);
+        ref = ff_vdpau_get_surface_id(s->next_picture.f);
         assert(ref != VDP_INVALID_HANDLE);
-        hwctx->info.mpeg.backward_reference = ref;
+        info->backward_reference = ref;
         /* fall through to forward prediction */
     case AV_PICTURE_TYPE_P:
-        ref = ff_vdpau_get_surface_id(&s->last_picture);
-        hwctx->info.mpeg.forward_reference  = ref;
+        ref = ff_vdpau_get_surface_id(s->last_picture.f);
+        info->forward_reference  = ref;
     }
 
     info->slice_count                = 0;
@@ -74,20 +75,22 @@ static int vdpau_mpeg_start_frame(AVCodecContext *avctx,
         info->non_intra_quantizer_matrix[i] = s->inter_matrix[i];
     }
 
-    return ff_vdpau_common_start_frame(avctx, buffer, size);
+    return ff_vdpau_common_start_frame(pic_ctx, buffer, size);
 }
 
 static int vdpau_mpeg_decode_slice(AVCodecContext *avctx,
                                    const uint8_t *buffer, uint32_t size)
 {
-    AVVDPAUContext *hwctx = avctx->hwaccel_context;
+    MpegEncContext * const s = avctx->priv_data;
+    Picture *pic             = s->current_picture_ptr;
+    struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private;
     int val;
 
-    val = ff_vdpau_add_buffer(avctx, buffer, size);
+    val = ff_vdpau_add_buffer(pic_ctx, buffer, size);
     if (val < 0)
         return val;
 
-    hwctx->info.mpeg.slice_count++;
+    pic_ctx->info.mpeg.slice_count++;
     return 0;
 }
 
@@ -98,8 +101,9 @@ AVHWAccel ff_mpeg1_vdpau_hwaccel = {
     .id             = AV_CODEC_ID_MPEG1VIDEO,
     .pix_fmt        = AV_PIX_FMT_VDPAU,
     .start_frame    = vdpau_mpeg_start_frame,
-    .end_frame      = ff_vdpau_common_end_frame,
+    .end_frame      = ff_vdpau_mpeg_end_frame,
     .decode_slice   = vdpau_mpeg_decode_slice,
+    .frame_priv_data_size = sizeof(struct vdpau_picture_context),
 };
 #endif
 
@@ -110,7 +114,8 @@ AVHWAccel ff_mpeg2_vdpau_hwaccel = {
     .id             = AV_CODEC_ID_MPEG2VIDEO,
     .pix_fmt        = AV_PIX_FMT_VDPAU,
     .start_frame    = vdpau_mpeg_start_frame,
-    .end_frame      = ff_vdpau_common_end_frame,
+    .end_frame      = ff_vdpau_mpeg_end_frame,
     .decode_slice   = vdpau_mpeg_decode_slice,
+    .frame_priv_data_size = sizeof(struct vdpau_picture_context),
 };
 #endif