]> git.sesse.net Git - ffmpeg/commitdiff
lavc: move AVFrame.hwaccel_picture_private to Picture.
authorAnton Khirnov <anton@khirnov.net>
Mon, 8 Oct 2012 05:50:14 +0000 (07:50 +0200)
committerAnton Khirnov <anton@khirnov.net>
Fri, 8 Mar 2013 06:36:01 +0000 (07:36 +0100)
This field is private and should not be present in a public struct. It
is only used in DXVA with mpegvideo-based decoders currently.

libavcodec/avcodec.h
libavcodec/dxva2_h264.c
libavcodec/dxva2_mpeg2.c
libavcodec/dxva2_vc1.c
libavcodec/mpegvideo.c
libavcodec/mpegvideo.h
libavutil/version.h

index 1eba5e51bb2cfd2d76a98265a470ac8b6e029081..d7b58196a45bef5b07795dd1a901a617af96a24a 100644 (file)
@@ -1290,12 +1290,12 @@ typedef struct AVFrame {
      */
     int64_t reordered_opaque;
 
+#if FF_API_AVFRAME_LAVC
     /**
-     * hardware accelerator private data (Libav-allocated)
-     * - encoding: unused
-     * - decoding: Set by libavcodec
+     * @deprecated this field is unused
      */
-    void *hwaccel_picture_private;
+    attribute_deprecated void *hwaccel_picture_private;
+#endif
 
     /**
      * the AVCodecContext which ff_thread_get_buffer() was last called on
index f53c07e586f2f412c30c5be53e436bdee5d64dc2..cd5084d685e2ab75a9bab61153a1db93827a80db 100644 (file)
@@ -278,7 +278,7 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx,
     const unsigned mb_count = h->mb_width * h->mb_height;
     struct dxva_context *ctx = avctx->hwaccel_context;
     const Picture *current_picture = h->cur_pic_ptr;
-    struct dxva2_picture_context *ctx_pic = current_picture->f.hwaccel_picture_private;
+    struct dxva2_picture_context *ctx_pic = current_picture->hwaccel_picture_private;
     DXVA_Slice_H264_Short *slice = NULL;
     uint8_t  *dxva_data, *current, *end;
     unsigned dxva_size;
@@ -373,7 +373,7 @@ static int dxva2_h264_start_frame(AVCodecContext *avctx,
 {
     const H264Context *h = avctx->priv_data;
     struct dxva_context *ctx = avctx->hwaccel_context;
-    struct dxva2_picture_context *ctx_pic = h->cur_pic_ptr->f.hwaccel_picture_private;
+    struct dxva2_picture_context *ctx_pic = h->cur_pic_ptr->hwaccel_picture_private;
 
     if (!ctx->decoder || !ctx->cfg || ctx->surface_count <= 0)
         return -1;
@@ -398,7 +398,7 @@ static int dxva2_h264_decode_slice(AVCodecContext *avctx,
     const H264Context *h = avctx->priv_data;
     struct dxva_context *ctx = avctx->hwaccel_context;
     const Picture *current_picture = h->cur_pic_ptr;
-    struct dxva2_picture_context *ctx_pic = current_picture->f.hwaccel_picture_private;
+    struct dxva2_picture_context *ctx_pic = current_picture->hwaccel_picture_private;
     unsigned position;
 
     if (ctx_pic->slice_count >= MAX_SLICES)
@@ -426,7 +426,7 @@ static int dxva2_h264_end_frame(AVCodecContext *avctx)
 {
     H264Context *h = avctx->priv_data;
     struct dxva2_picture_context *ctx_pic =
-        h->cur_pic_ptr->f.hwaccel_picture_private;
+        h->cur_pic_ptr->hwaccel_picture_private;
     int ret;
 
     if (ctx_pic->slice_count <= 0 || ctx_pic->bitstream_size <= 0)
index 263bce155ddf3107179c87206bf939369b9b9387..049fa48be72e84ad63e2f426ec5950c1f627a10f 100644 (file)
@@ -151,7 +151,7 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx,
     const struct MpegEncContext *s = avctx->priv_data;
     struct dxva_context *ctx = avctx->hwaccel_context;
     struct dxva2_picture_context *ctx_pic =
-        s->current_picture_ptr->f.hwaccel_picture_private;
+        s->current_picture_ptr->hwaccel_picture_private;
     const int is_field = s->picture_structure != PICT_FRAME;
     const unsigned mb_count = s->mb_width * (s->mb_height >> is_field);
     uint8_t  *dxva_data, *current, *end;
@@ -210,7 +210,7 @@ static int dxva2_mpeg2_start_frame(AVCodecContext *avctx,
     const struct MpegEncContext *s = avctx->priv_data;
     struct dxva_context *ctx = avctx->hwaccel_context;
     struct dxva2_picture_context *ctx_pic =
-        s->current_picture_ptr->f.hwaccel_picture_private;
+        s->current_picture_ptr->hwaccel_picture_private;
 
     if (!ctx->decoder || !ctx->cfg || ctx->surface_count <= 0)
         return -1;
@@ -230,7 +230,7 @@ static int dxva2_mpeg2_decode_slice(AVCodecContext *avctx,
 {
     const struct MpegEncContext *s = avctx->priv_data;
     struct dxva2_picture_context *ctx_pic =
-        s->current_picture_ptr->f.hwaccel_picture_private;
+        s->current_picture_ptr->hwaccel_picture_private;
     unsigned position;
 
     if (ctx_pic->slice_count >= MAX_SLICES)
@@ -250,7 +250,7 @@ static int dxva2_mpeg2_end_frame(AVCodecContext *avctx)
 {
     struct MpegEncContext *s = avctx->priv_data;
     struct dxva2_picture_context *ctx_pic =
-        s->current_picture_ptr->f.hwaccel_picture_private;
+        s->current_picture_ptr->hwaccel_picture_private;
     int ret;
 
     if (ctx_pic->slice_count <= 0 || ctx_pic->bitstream_size <= 0)
index 106c8dae011027316bcbdea3fbd4bcbafaafbfee..4af3ce81278d8d2617fa466d39cd830cf846b51b 100644 (file)
@@ -162,7 +162,7 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx,
     const VC1Context *v = avctx->priv_data;
     struct dxva_context *ctx = avctx->hwaccel_context;
     const MpegEncContext *s = &v->s;
-    struct dxva2_picture_context *ctx_pic = s->current_picture_ptr->f.hwaccel_picture_private;
+    struct dxva2_picture_context *ctx_pic = s->current_picture_ptr->hwaccel_picture_private;
 
     DXVA_SliceInfo *slice = &ctx_pic->si;
 
@@ -214,7 +214,7 @@ static int dxva2_vc1_start_frame(AVCodecContext *avctx,
 {
     const VC1Context *v = avctx->priv_data;
     struct dxva_context *ctx = avctx->hwaccel_context;
-    struct dxva2_picture_context *ctx_pic = v->s.current_picture_ptr->f.hwaccel_picture_private;
+    struct dxva2_picture_context *ctx_pic = v->s.current_picture_ptr->hwaccel_picture_private;
 
     if (!ctx->decoder || !ctx->cfg || ctx->surface_count <= 0)
         return -1;
@@ -233,7 +233,7 @@ static int dxva2_vc1_decode_slice(AVCodecContext *avctx,
 {
     const VC1Context *v = avctx->priv_data;
     const Picture *current_picture = v->s.current_picture_ptr;
-    struct dxva2_picture_context *ctx_pic = current_picture->f.hwaccel_picture_private;
+    struct dxva2_picture_context *ctx_pic = current_picture->hwaccel_picture_private;
 
     if (ctx_pic->bitstream_size > 0)
         return -1;
@@ -254,7 +254,7 @@ static int dxva2_vc1_decode_slice(AVCodecContext *avctx,
 static int dxva2_vc1_end_frame(AVCodecContext *avctx)
 {
     VC1Context *v = avctx->priv_data;
-    struct dxva2_picture_context *ctx_pic = v->s.current_picture_ptr->f.hwaccel_picture_private;
+    struct dxva2_picture_context *ctx_pic = v->s.current_picture_ptr->hwaccel_picture_private;
     int ret;
 
     if (ctx_pic->bitstream_size <= 0)
index 7d880e4131806e702d31311b1b85e1dfd93850db..bee32d545250a9181df0cded81d1748478407cc0 100644 (file)
@@ -252,7 +252,7 @@ static void free_frame_buffer(MpegEncContext *s, Picture *pic)
         ff_thread_release_buffer(s->avctx, &pic->f);
     else
         avcodec_default_release_buffer(s->avctx, &pic->f);
-    av_freep(&pic->f.hwaccel_picture_private);
+    av_freep(&pic->hwaccel_picture_private);
 }
 
 int ff_mpv_frame_size_alloc(MpegEncContext *s, int linesize)
@@ -288,10 +288,10 @@ static int alloc_frame_buffer(MpegEncContext *s, Picture *pic)
     int r, ret;
 
     if (s->avctx->hwaccel) {
-        assert(!pic->f.hwaccel_picture_private);
+        assert(!pic->hwaccel_picture_private);
         if (s->avctx->hwaccel->priv_data_size) {
-            pic->f.hwaccel_picture_private = av_mallocz(s->avctx->hwaccel->priv_data_size);
-            if (!pic->f.hwaccel_picture_private) {
+            pic->hwaccel_picture_private = av_mallocz(s->avctx->hwaccel->priv_data_size);
+            if (!pic->hwaccel_picture_private) {
                 av_log(s->avctx, AV_LOG_ERROR, "alloc_frame_buffer() failed (hwaccel private data allocation)\n");
                 return -1;
             }
@@ -308,7 +308,7 @@ static int alloc_frame_buffer(MpegEncContext *s, Picture *pic)
     if (r < 0 || !pic->f.type || !pic->f.data[0]) {
         av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed (%d %d %p)\n",
                r, pic->f.type, pic->f.data[0]);
-        av_freep(&pic->f.hwaccel_picture_private);
+        av_freep(&pic->hwaccel_picture_private);
         return -1;
     }
 
index 7e031db821e0264848882d0fbd1a380e3fe13d1d..532a70a43e1d879ffefd9d0167c3c1c8329209a3 100644 (file)
@@ -143,6 +143,10 @@ typedef struct Picture{
     int b_frame_score;          /* */
     void *owner2;               ///< pointer to the context that allocated this picture
     int needs_realloc;          ///< Picture needs to be reallocated (eg due to a frame size change)
+    /**
+     * hardware accelerator private data
+     */
+    void *hwaccel_picture_private;
 } Picture;
 
 /**
index 38b11a408d3ffe346e1388cbe42a8e91039a385b..d519b50c785cb59818dad774a2ec140f6b9b8231 100644 (file)
@@ -82,7 +82,9 @@
 #ifndef FF_API_LLS_PRIVATE
 #define FF_API_LLS_PRIVATE              (LIBAVUTIL_VERSION_MAJOR < 53)
 #endif
-
+#ifndef FF_API_AVFRAME_LAVC
+#define FF_API_AVFRAME_LAVC             (LIBAVUTIL_VERSION_MAJOR < 53)
+#endif
 
 /**
  * @}