decode: add a per-frame private data for hwaccel use
authorAnton Khirnov <anton@khirnov.net>
Fri, 13 Oct 2017 16:59:19 +0000 (18:59 +0200)
committerTimo Rothenpieler <timo@rothenpieler.org>
Fri, 10 Nov 2017 18:48:09 +0000 (19:48 +0100)
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
libavcodec/decode.h

index 8b03f61..44b874d 100644 (file)
@@ -1581,6 +1581,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);
 }
 
index 51947b9..03fc783 100644 (file)
@@ -44,6 +44,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;
 
 /**