diff options
author | Hendrik Leppkes <h.leppkes@gmail.com> | 2016-06-26 15:23:24 +0200 |
---|---|---|
committer | Hendrik Leppkes <h.leppkes@gmail.com> | 2016-06-26 15:23:24 +0200 |
commit | 481f320aa3886174363c052c93a8000c37d27285 (patch) | |
tree | 2490a81062295ec755fe07ab39de9a970350499c /libavutil/hwcontext.h | |
parent | 2c1d0f871f6a3ee851f7094cc9946652ba1788ab (diff) | |
parent | 1c9e8616c535ef496e7ee8a5cbc5e9e972a6977d (diff) | |
download | ffmpeg-481f320aa3886174363c052c93a8000c37d27285.tar.gz |
Merge commit '1c9e8616c535ef496e7ee8a5cbc5e9e972a6977d'
* commit '1c9e8616c535ef496e7ee8a5cbc5e9e972a6977d':
hwcontext: add a function for opening devices
Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
Diffstat (limited to 'libavutil/hwcontext.h')
-rw-r--r-- | libavutil/hwcontext.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/libavutil/hwcontext.h b/libavutil/hwcontext.h index dc8169903b..4e9da0224d 100644 --- a/libavutil/hwcontext.h +++ b/libavutil/hwcontext.h @@ -242,6 +242,34 @@ AVBufferRef *av_hwdevice_ctx_alloc(enum AVHWDeviceType type); int av_hwdevice_ctx_init(AVBufferRef *ref); /** + * Open a device of the specified type and create an AVHWDeviceContext for it. + * + * This is a convenience function intended to cover the simple cases. Callers + * who need to fine-tune device creation/management should open the device + * manually and then wrap it in an AVHWDeviceContext using + * av_hwdevice_ctx_alloc()/av_hwdevice_ctx_init(). + * + * The returned context is already initialized and ready for use, the caller + * should not call av_hwdevice_ctx_init() on it. The user_opaque/free fields of + * the created AVHWDeviceContext are set by this function and should not be + * touched by the caller. + * + * @param device_ctx On success, a reference to the newly-created device context + * will be written here. The reference is owned by the caller + * and must be released with av_buffer_unref() when no longer + * needed. On failure, NULL will be written to this pointer. + * @param type The type of the device to create. + * @param device A type-specific string identifying the device to open. + * @param opts A dictionary of additional (type-specific) options to use in + * opening the device. The dictionary remains owned by the caller. + * @param flags currently unused + * + * @return 0 on success, a negative AVERROR code on failure. + */ +int av_hwdevice_ctx_create(AVBufferRef **device_ctx, enum AVHWDeviceType type, + const char *device, AVDictionary *opts, int flags); + +/** * Allocate an AVHWFramesContext tied to a given device context. * * @param device_ctx a reference to a AVHWDeviceContext. This function will make |