summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-05-13 22:34:59 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-05-13 22:42:49 +0200
commitcc48409b51c8cd8fed8038c00ea8b4a6b2341004 (patch)
tree5930e10fb3a32b0464962e222c816f16969bb2ed
parenta3adba358bbb3e8f953b15ad2820a3ff996ef91b (diff)
parente7c5e17d4fbd7c83fb331bf327e25ebd8e6a8623 (diff)
Merge commit 'e7c5e17d4fbd7c83fb331bf327e25ebd8e6a8623'
* commit 'e7c5e17d4fbd7c83fb331bf327e25ebd8e6a8623': vda: Make output CVPixelBuffer format configurable Conflicts: doc/APIchanges libavcodec/version.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--doc/APIchanges3
-rw-r--r--libavcodec/vda.c11
-rw-r--r--libavcodec/vda.h17
-rw-r--r--libavcodec/vda_h264.c2
-rw-r--r--libavcodec/version.h2
5 files changed, 31 insertions, 4 deletions
diff --git a/doc/APIchanges b/doc/APIchanges
index a173931bc7..3cca3890cb 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,9 @@ libavutil: 2014-08-09
API changes, most recent first:
+2015-05-13 - xxxxxxx - lavc 56.39.100 / 56.23.0
+ Add av_vda_default_init2.
+
2015-05-11 - XXXXXXX - lavf 56.33.100 - avformat.h
Add AVOpenCallback AVFormatContext.open_cb
diff --git a/libavcodec/vda.c b/libavcodec/vda.c
index 170580f16a..5867cae120 100644
--- a/libavcodec/vda.c
+++ b/libavcodec/vda.c
@@ -28,15 +28,22 @@ AVVDAContext *av_vda_alloc_context(void)
{
AVVDAContext *ret = av_mallocz(sizeof(*ret));
- if (ret)
+ if (ret) {
ret->output_callback = ff_vda_output_callback;
+ ret->cv_pix_fmt_type = kCVPixelFormatType_422YpCbCr8;
+ }
return ret;
}
int av_vda_default_init(AVCodecContext *avctx)
{
- avctx->hwaccel_context = av_vda_alloc_context();
+ return av_vda_default_init2(avctx, NULL);
+}
+
+int av_vda_default_init2(AVCodecContext *avctx, AVVDAContext *vdactx)
+{
+ avctx->hwaccel_context = vdactx ?: av_vda_alloc_context();
if (!avctx->hwaccel_context)
return AVERROR(ENOMEM);
return ff_vda_default_init(avctx);
diff --git a/libavcodec/vda.h b/libavcodec/vda.h
index 12330aa363..bde14e31d7 100644
--- a/libavcodec/vda.h
+++ b/libavcodec/vda.h
@@ -171,6 +171,12 @@ typedef struct AVVDAContext {
* Set by av_vda_alloc_context().
*/
VDADecoderOutputCallback output_callback;
+
+ /**
+ * CVPixelBuffer Format Type that VDA will use for decoded frames; set by
+ * the caller.
+ */
+ OSType cv_pix_fmt_type;
} AVVDAContext;
/**
@@ -199,6 +205,17 @@ AVVDAContext *av_vda_alloc_context(void);
int av_vda_default_init(AVCodecContext *avctx);
/**
+ * This is a convenience function that creates and sets up the VDA context using
+ * an internal implementation.
+ *
+ * @param avctx the corresponding codec context
+ * @param vdactx the VDA context to use
+ *
+ * @return >= 0 on success, a negative AVERROR code on failure
+ */
+int av_vda_default_init2(AVCodecContext *avctx, AVVDAContext *vdactx);
+
+/**
* This function must be called to free the VDA context initialized with
* av_vda_default_init().
*
diff --git a/libavcodec/vda_h264.c b/libavcodec/vda_h264.c
index 8ea81d8d2e..4d2274d649 100644
--- a/libavcodec/vda_h264.c
+++ b/libavcodec/vda_h264.c
@@ -430,7 +430,7 @@ int ff_vda_default_init(AVCodecContext *avctx)
CFMutableDictionaryRef buffer_attributes;
CFMutableDictionaryRef io_surface_properties;
CFNumberRef cv_pix_fmt;
- int32_t fmt = 'avc1', pix_fmt = kCVPixelFormatType_422YpCbCr8;
+ int32_t fmt = 'avc1', pix_fmt = vda_ctx->cv_pix_fmt_type;
// kCVPixelFormatType_420YpCbCr8Planar;
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 1d0525aa18..8679ac6766 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
#include "libavutil/version.h"
#define LIBAVCODEC_VERSION_MAJOR 56
-#define LIBAVCODEC_VERSION_MINOR 38
+#define LIBAVCODEC_VERSION_MINOR 39
#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \