[FFmpeg-devel,5/5] decode: add a per-frame private data for hwaccel use

Submitted by wm4 on Oct. 13, 2017, 4:59 p.m.

Details

Message ID 20171013165919.7642-6-nfxjfg@googlemail.com
State New
Headers show

Commit Message

wm4 Oct. 13, 2017, 4:59 p.m.
From: Anton Khirnov <anton@khirnov.net>

This will be useful in the CUVID hwaccel. It should also eventually
replace current decoder-specific mechanisms used by various other
hwaccels.

Merges Libav commit 704311b2946d74a80f65906961cd9baaa18683a3.
---
 libavcodec/decode.c | 3 +++
 libavcodec/decode.h | 6 ++++++
 2 files changed, 9 insertions(+)

Patch hide | download patch | download mbox

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 9878950c82..5e8660e091 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -1649,6 +1649,9 @@  static void decode_data_free(void *opaque, uint8_t *data)
     if (fdd->post_process_opaque_free)
         fdd->post_process_opaque_free(fdd->post_process_opaque);
 
+    if (fdd->hwaccel_priv_free)
+        fdd->hwaccel_priv_free(fdd->hwaccel_priv);
+
     av_freep(&fdd);
 }
 
diff --git a/libavcodec/decode.h b/libavcodec/decode.h
index dcfc830296..5d532c615d 100644
--- a/libavcodec/decode.h
+++ b/libavcodec/decode.h
@@ -49,6 +49,12 @@  typedef struct FrameDecodeData {
     int (*post_process)(void *logctx, AVFrame *frame);
     void *post_process_opaque;
     void (*post_process_opaque_free)(void *opaque);
+
+    /**
+     * Per-frame private data for hwaccels.
+     */
+    void *hwaccel_priv;
+    void (*hwaccel_priv_free)(void *priv);
 } FrameDecodeData;
 
 /**