[FFmpeg-devel] [RFC 1/4] hwaccel: add infrastructure to hold accelerator config options.
Gwenole Beauchesne
gb.devel at gmail.com
Wed Aug 19 18:01:34 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 f93a196..413e49b 100644
--- a/libavcodec/internal.h
+++ b/libavcodec/internal.h
@@ -157,6 +157,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 4da16ee..d6be93d 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);
@@ -2923,6 +2924,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