avcodec/decode: Make post_process_opaque a RefStruct reference

Avoids the post_process_opaque_free callback; the only user of
this is already a RefStruct reference and presumably other users
would want to use a pool for this, too, so they would use
RefStruct-objects, too.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt
2026-04-16 19:27:03 +00:00
committed by James Almer
co-authored by James Almer
parent 0ee1947d9b
commit 2d062dd0c6
4 changed files with 3 additions and 12 deletions
+1 -3
View File
@@ -1676,8 +1676,7 @@ static void decode_data_free(AVRefStructOpaque unused, void *obj)
{
FrameDecodeData *fdd = obj;
if (fdd->post_process_opaque_free)
fdd->post_process_opaque_free(fdd->post_process_opaque);
av_refstruct_unref(&fdd->post_process_opaque);
if (fdd->hwaccel_priv_free)
fdd->hwaccel_priv_free(fdd->hwaccel_priv);
@@ -1748,7 +1747,6 @@ int ff_attach_decode_data(AVCodecContext *avctx, AVFrame *frame)
validate_avframe_allocation(avctx, frame_ctx->frame);
fdd->post_process_opaque = frame_ctx;
fdd->post_process_opaque_free = ff_lcevc_unref;
fdd->post_process = ff_lcevc_process;
}
dc->lcevc.frame = 0;
+1 -2
View File
@@ -42,8 +42,7 @@ typedef struct FrameDecodeData {
* stored in the post_process_opaque object.
*/
int (*post_process)(void *logctx, AVFrame *frame);
void *post_process_opaque;
void (*post_process_opaque_free)(void *opaque);
void *post_process_opaque; ///< RefStruct reference
/**
* Per-frame private data for hwaccels.
-6
View File
@@ -464,9 +464,3 @@ fail:
av_refstruct_unref(&lcevc);
return ret;
}
void ff_lcevc_unref(void *opaque)
{
FFLCEVCFrame *lcevc = opaque;
av_refstruct_unref(&lcevc);
}
+1 -1
View File
@@ -50,5 +50,5 @@ int ff_lcevc_alloc(FFLCEVCContext **plcevc, void *logctx);
int ff_lcevc_process(void *logctx, struct AVFrame *frame);
int ff_lcevc_parse_frame(FFLCEVCContext *lcevc, const struct AVFrame *frame,
enum AVPixelFormat *format, int *width, int *height, void *logctx);
void ff_lcevc_unref(void *opaque);
#endif /* AVCODEC_LCEVCDEC_H */