[FFmpeg-cvslog] Merge commit '1c9e8616c535ef496e7ee8a5cbc5e9e972a6977d'
Hendrik Leppkes
git at videolan.org
Sun Jun 26 15:23:35 CEST 2016
ffmpeg | branch: master | Hendrik Leppkes <h.leppkes at gmail.com> | Sun Jun 26 15:23:24 2016 +0200| [481f320aa3886174363c052c93a8000c37d27285] | committer: Hendrik Leppkes
Merge commit '1c9e8616c535ef496e7ee8a5cbc5e9e972a6977d'
* commit '1c9e8616c535ef496e7ee8a5cbc5e9e972a6977d':
hwcontext: add a function for opening devices
Merged-by: Hendrik Leppkes <h.leppkes at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=481f320aa3886174363c052c93a8000c37d27285
---
doc/APIchanges | 3 +++
libavutil/hwcontext.c | 36 ++++++++++++++++++++++++++++++++++++
libavutil/hwcontext.h | 28 ++++++++++++++++++++++++++++
libavutil/hwcontext_internal.h | 3 +++
libavutil/version.h | 2 +-
5 files changed, 71 insertions(+), 1 deletion(-)
diff --git a/doc/APIchanges b/doc/APIchanges
index bc030bf..e3b7875 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,9 @@ libavutil: 2015-08-28
API changes, most recent first:
+2016-06-26 - xxxxxxx / 1c9e861 - lavu 55.27.100 / 55.13.0 - hwcontext.h
+ Add av_hwdevice_ctx_create().
+
2016-06-26 - xxxxxxx / e47b8bb - lavc 57.48.101 / 57.19.1 - avcodec.h
Adjust values for JPEG 2000 profiles.
diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c
index eeeb288..1e9e913 100644
--- a/libavutil/hwcontext.c
+++ b/libavutil/hwcontext.c
@@ -452,3 +452,39 @@ void av_hwframe_constraints_free(AVHWFramesConstraints **constraints)
}
av_freep(constraints);
}
+
+int av_hwdevice_ctx_create(AVBufferRef **pdevice_ref, enum AVHWDeviceType type,
+ const char *device, AVDictionary *opts, int flags)
+{
+ AVBufferRef *device_ref = NULL;
+ AVHWDeviceContext *device_ctx;
+ int ret = 0;
+
+ device_ref = av_hwdevice_ctx_alloc(type);
+ if (!device_ref) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+ device_ctx = (AVHWDeviceContext*)device_ref->data;
+
+ if (!device_ctx->internal->hw_type->device_create) {
+ ret = AVERROR(ENOSYS);
+ goto fail;
+ }
+
+ ret = device_ctx->internal->hw_type->device_create(device_ctx, device,
+ opts, flags);
+ if (ret < 0)
+ goto fail;
+
+ ret = av_hwdevice_ctx_init(device_ref);
+ if (ret < 0)
+ goto fail;
+
+ *pdevice_ref = device_ref;
+ return 0;
+fail:
+ av_buffer_unref(&device_ref);
+ *pdevice_ref = NULL;
+ return ret;
+}
diff --git a/libavutil/hwcontext.h b/libavutil/hwcontext.h
index dc81699..4e9da02 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
diff --git a/libavutil/hwcontext_internal.h b/libavutil/hwcontext_internal.h
index e62324c..cf832fe 100644
--- a/libavutil/hwcontext_internal.h
+++ b/libavutil/hwcontext_internal.h
@@ -64,6 +64,9 @@ typedef struct HWContextType {
*/
size_t frames_priv_size;
+ int (*device_create)(AVHWDeviceContext *ctx, const char *device,
+ AVDictionary *opts, int flags);
+
int (*device_init)(AVHWDeviceContext *ctx);
void (*device_uninit)(AVHWDeviceContext *ctx);
diff --git a/libavutil/version.h b/libavutil/version.h
index a282fa8..aa10622 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -64,7 +64,7 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 55
-#define LIBAVUTIL_VERSION_MINOR 26
+#define LIBAVUTIL_VERSION_MINOR 27
#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
======================================================================
diff --cc doc/APIchanges
index bc030bf,9f46edc..e3b7875
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@@ -15,12 -13,13 +15,15 @@@ libavutil: 2015-08-2
API changes, most recent first:
-2016-xx-xx - xxxxxxx - lavu 55.13.0 - hwcontext.h
++2016-06-26 - xxxxxxx / 1c9e861 - lavu 55.27.100 / 55.13.0 - hwcontext.h
+ Add av_hwdevice_ctx_create().
+
-2016-xx-xx - xxxxxxx - lavc 57.19.1 - avcodec.h
+2016-06-26 - xxxxxxx / e47b8bb - lavc 57.48.101 / 57.19.1 - avcodec.h
Adjust values for JPEG 2000 profiles.
-2016-xx-xx - xxxxxxx - lavf 57.7.0 - avio.h
+-------- 8< --------- FFmpeg 3.1 was cut here -------- 8< ---------
+
+2016-06-23 - 5d75e46 / db7968b - lavf 57.40.100 / 57.7.0 - avio.h
Add AVIODataMarkerType, write_data_type, ignore_boundary_point and
avio_write_marker.
diff --cc libavutil/version.h
index a282fa8,48a5878..aa10622
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@@ -63,9 -53,9 +63,9 @@@
* @{
*/
-#define LIBAVUTIL_VERSION_MAJOR 55
-#define LIBAVUTIL_VERSION_MINOR 13
-#define LIBAVUTIL_VERSION_MICRO 0
+#define LIBAVUTIL_VERSION_MAJOR 55
- #define LIBAVUTIL_VERSION_MINOR 26
++#define LIBAVUTIL_VERSION_MINOR 27
+#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
LIBAVUTIL_VERSION_MINOR, \
More information about the ffmpeg-cvslog
mailing list