mirror of https://git.ffmpeg.org/ffmpeg.git
avcodec/libdav1d: Stop mangling AVPacket.opaque
Unnecessary since 67e7f0b05e
as there are no longer two opaque fields.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
f04a2ba302
commit
c89f6ae689
|
@ -305,10 +305,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;
|
||||
|
||||
|
@ -318,7 +314,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);
|
||||
}
|
||||
|
||||
|
@ -341,8 +336,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) {
|
||||
|
@ -352,21 +345,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;
|
||||
|
@ -405,7 +386,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
|
||||
|
@ -460,16 +440,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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue