decode: add a per-frame private data for hwaccel use
authorAnton Khirnov <anton@khirnov.net>
Sat, 1 Jul 2017 10:09:58 +0000 (12:09 +0200)
committerAnton Khirnov <anton@khirnov.net>
Wed, 26 Jul 2017 21:24:14 +0000 (23:24 +0200)
This will be useful in the CUVID hwaccel. It should also eventually
replace current decoder-specific mechanisms used by various other
hwaccels.

libavcodec/decode.c
libavcodec/decode.h

index 9050b57..c76ee66 100644 (file)
@@ -1025,6 +1025,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 72052f1..235f355 100644 (file)
@@ -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;
 
 /**