[FFmpeg-devel] [PATCH] avcodec/libdav1d: Stop mangling AVPacket.opaque
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Thu Mar 7 17:40:58 EET 2024
Unnecessary since 67e7f0b05eeee37eee1357769038270fda08fe32
as there are no longer two opaque fields.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
libavcodec/libdav1d.c | 27 ---------------------------
1 file changed, 27 deletions(-)
diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c
index 79478ae893..08fe7a841d 100644
--- a/libavcodec/libdav1d.c
+++ b/libavcodec/libdav1d.c
@@ -296,10 +296,6 @@ static void libdav1d_flush(AVCodecContext *c)
dav1d_flush(dav1d->c);
}
-typedef struct OpaqueData {
- void *pkt_orig_opaque;
-} OpaqueData;
-
static void libdav1d_data_free(const uint8_t *data, void *opaque) {
AVBufferRef *buf = opaque;
@@ -309,7 +305,6 @@ static void libdav1d_data_free(const uint8_t *data, void *opaque) {
static void libdav1d_user_data_free(const uint8_t *data, void *opaque) {
AVPacket *pkt = opaque;
av_assert0(data == opaque);
- av_free(pkt->opaque);
av_packet_free(&pkt);
}
@@ -332,8 +327,6 @@ static int libdav1d_receive_frame_internal(AVCodecContext *c, Dav1dPicture *p)
}
if (pkt->size) {
- OpaqueData *od = NULL;
-
res = dav1d_data_wrap(data, pkt->data, pkt->size,
libdav1d_data_free, pkt->buf);
if (res < 0) {
@@ -343,21 +336,9 @@ static int libdav1d_receive_frame_internal(AVCodecContext *c, Dav1dPicture *p)
pkt->buf = NULL;
- if (pkt->opaque && (c->flags & AV_CODEC_FLAG_COPY_OPAQUE)) {
- od = av_mallocz(sizeof(*od));
- if (!od) {
- av_packet_free(&pkt);
- dav1d_data_unref(data);
- return AVERROR(ENOMEM);
- }
- od->pkt_orig_opaque = pkt->opaque;
- }
- pkt->opaque = od;
-
res = dav1d_data_wrap_user_data(data, (const uint8_t *)pkt,
libdav1d_user_data_free, pkt);
if (res < 0) {
- av_free(pkt->opaque);
av_packet_free(&pkt);
dav1d_data_unref(data);
return res;
@@ -396,7 +377,6 @@ static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame)
Libdav1dContext *dav1d = c->priv_data;
Dav1dPicture pic = { 0 }, *p = &pic;
AVPacket *pkt;
- OpaqueData *od = NULL;
#if FF_DAV1D_VERSION_AT_LEAST(5,1)
enum Dav1dEventFlags event_flags = 0;
#endif
@@ -451,16 +431,9 @@ static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame)
ff_set_sar(c, frame->sample_aspect_ratio);
pkt = (AVPacket *)p->m.user_data.data;
- od = pkt->opaque;
-
- // restore the original user opaque value for
- // ff_decode_frame_props_from_pkt()
- pkt->opaque = od ? od->pkt_orig_opaque : NULL;
- av_freep(&od);
// match timestamps and packet size
res = ff_decode_frame_props_from_pkt(c, frame, pkt);
- pkt->opaque = NULL;
if (res < 0)
goto fail;
--
2.40.1
More information about the ffmpeg-devel
mailing list