This field is private and complicates moving AVFrame from lavc. It is
only used from dxva with mpegvideo-based decoders currently.
---
libavcodec/avcodec.h | 8 ++++----
libavcodec/dxva2_h264.c | 8 ++++----
libavcodec/dxva2_mpeg2.c | 8 ++++----
libavcodec/dxva2_vc1.c | 8 ++++----
libavcodec/mpegvideo.c | 10 +++++-----
libavcodec/mpegvideo.h | 4 ++++
libavcodec/version.h | 3 +++
7 files changed, 28 insertions(+), 21 deletions(-)
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 298d6b0..149364b 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1275,12 +1275,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
diff --git a/libavcodec/dxva2_h264.c b/libavcodec/dxva2_h264.c
index 2fd0767..ca44983 100644
--- a/libavcodec/dxva2_h264.c
+++ b/libavcodec/dxva2_h264.c
@@ -281,7 +281,7 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext
*avctx,
const unsigned mb_count = s->mb_width * s->mb_height;
struct dxva_context *ctx = avctx->hwaccel_context;
const Picture *current_picture = h->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;
DXVA_Slice_H264_Short *slice = NULL;
uint8_t *dxva_data, *current, *end;
unsigned dxva_size;
@@ -376,7 +376,7 @@ static int start_frame(AVCodecContext *avctx,
{
const H264Context *h = avctx->priv_data;
struct dxva_context *ctx = avctx->hwaccel_context;
- struct dxva2_picture_context *ctx_pic =
h->s.current_picture_ptr->f.hwaccel_picture_private;
+ struct dxva2_picture_context *ctx_pic =
h->s.current_picture_ptr->hwaccel_picture_private;
if (!ctx->decoder || !ctx->cfg || ctx->surface_count <= 0)
return -1;
@@ -400,7 +400,7 @@ static int decode_slice(AVCodecContext *avctx,
const H264Context *h = avctx->priv_data;
struct dxva_context *ctx = avctx->hwaccel_context;
const Picture *current_picture = h->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;
unsigned position;
if (ctx_pic->slice_count >= MAX_SLICES)
@@ -429,7 +429,7 @@ static int end_frame(AVCodecContext *avctx)
H264Context *h = avctx->priv_data;
MpegEncContext *s = &h->s;
struct dxva2_picture_context *ctx_pic =
- h->s.current_picture_ptr->f.hwaccel_picture_private;
+ h->s.current_picture_ptr->hwaccel_picture_private;
if (ctx_pic->slice_count <= 0 || ctx_pic->bitstream_size <= 0)
return -1;
diff --git a/libavcodec/dxva2_mpeg2.c b/libavcodec/dxva2_mpeg2.c
index fa6ae7b..0005ffd 100644
--- a/libavcodec/dxva2_mpeg2.c
+++ b/libavcodec/dxva2_mpeg2.c
@@ -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 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 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 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;
if (ctx_pic->slice_count <= 0 || ctx_pic->bitstream_size <= 0)
return -1;
diff --git a/libavcodec/dxva2_vc1.c b/libavcodec/dxva2_vc1.c
index 5aed2f3..ca22422 100644
--- a/libavcodec/dxva2_vc1.c
+++ b/libavcodec/dxva2_vc1.c
@@ -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 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;
@@ -232,7 +232,7 @@ static int 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;
@@ -253,7 +253,7 @@ static int decode_slice(AVCodecContext *avctx,
static int 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;
if (ctx_pic->bitstream_size <= 0)
return -1;
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 322ad09..71afec8 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -232,7 +232,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);
}
/**
@@ -243,10 +243,10 @@ static int alloc_frame_buffer(MpegEncContext *s, Picture
*pic)
int r;
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;
}
@@ -263,7 +263,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;
}
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 34b6c67..6962807 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -140,6 +140,10 @@ typedef struct Picture{
int b_frame_score; /* */
struct MpegEncContext *owner2; ///< pointer to the MpegEncContext 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;
/**
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 6117a22..8f5662d 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -94,5 +94,8 @@
#ifndef FF_API_DESTRUCT_PACKET
#define FF_API_DESTRUCT_PACKET (LIBAVCODEC_VERSION_MAJOR < 56)
#endif
+#ifndef FF_API_AVFRAME_LAVC
+#define FF_API_AVFRAME_LAVC (LIBAVCODEC_VERSION_MAJOR < 56)
+#endif
#endif /* AVCODEC_VERSION_H */
--
1.7.10.4
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel