[FFmpeg-devel] [PATCH 4/5] hwaccel: add infrastructure to hold accelerator config options.

Gwenole Beauchesne gb.devel at gmail.com
Tue Aug 18 17:26:59 CEST 2015


The options are live from AVHWaccel.init() to AVHWAccel.uninit(). As such,
they are specific to an active hwaccel and have a meaning to that hwaccel
only during initialization. Options can be initialized by the user during
AVCodecContext.get_format() with hwaccel-specific (public) helper functions.

This is an internal infrastructure change/addition only.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne at intel.com>
---
 libavcodec/internal.h | 14 ++++++++++++++
 libavcodec/utils.c    |  2 ++
 2 files changed, 16 insertions(+)

diff --git a/libavcodec/internal.h b/libavcodec/internal.h
index 0daf669..866ed12 100644
--- a/libavcodec/internal.h
+++ b/libavcodec/internal.h
@@ -163,6 +163,20 @@ typedef struct AVCodecInternal {
      * hwaccel-specific private data
      */
     void *hwaccel_priv_data;
+
+    /**
+     * Hardware acceleration config options.
+     *
+     * Those options are live from AVHWAccel.init() to AVHWAccel.uninit().
+     * As such, they are specific to an active hwaccel and have a meaning
+     * to that specific hwaccel only during initialization. Initialization
+     * occurs during AVCodecContext.get_format() through hwaccel-specific
+     * helper functions.
+     *
+     * Options are written by the user and read by the hwaccel. Exposing
+     * hwaccel options to the user is not permitted.
+     */
+    AVDictionary *hwaccel_config;
 } AVCodecInternal;
 
 struct AVCodecDefault {
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 22dcc82..338b6bf 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1231,6 +1231,7 @@ int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt)
         if (avctx->hwaccel && avctx->hwaccel->uninit)
             avctx->hwaccel->uninit(avctx);
         av_freep(&avctx->internal->hwaccel_priv_data);
+        av_dict_free(&avctx->internal->hwaccel_config);
         avctx->hwaccel = NULL;
 
         ret = avctx->get_format(avctx, choices);
@@ -2921,6 +2922,7 @@ av_cold int avcodec_close(AVCodecContext *avctx)
         if (avctx->hwaccel && avctx->hwaccel->uninit)
             avctx->hwaccel->uninit(avctx);
         av_freep(&avctx->internal->hwaccel_priv_data);
+        av_dict_free(&avctx->internal->hwaccel_config);
 
         av_freep(&avctx->internal);
     }
-- 
1.9.1



More information about the ffmpeg-devel mailing list