* commit 'e7c5e17d4fbd7c83fb331bf327e25ebd8e6a8623': vda: Make output CVPixelBuffer format configurable Conflicts: doc/APIchanges libavcodec/version.h
Unified · Split
| @@ -15,6 +15,9 @@ libavutil: 2014-08-09 · 14 unmodified lines | ||
| 15 | 15 | |
| 16 | 16 | API changes, most recent first: |
| 17 | 17 | |
| 18 | +2015-05-13 - xxxxxxx - lavc 56.39.100 / 56.23.0 | |
| 19 | + Add av_vda_default_init2. | |
| 20 | + | |
| 18 | 21 | 2015-05-11 - XXXXXXX - lavf 56.33.100 - avformat.h |
| 19 | 22 | Add AVOpenCallback AVFormatContext.open_cb |
| 20 | 23 | |
| @@ -28,15 +28,22 @@ AVVDAContext *av_vda_alloc_context(void) · 27 unmodified lines | ||
| 28 | 28 | { |
| 29 | 29 | AVVDAContext *ret = av_mallocz(sizeof(*ret)); |
| 30 | 30 | |
| 31 | − if (ret) | |
| 31 | + if (ret) { | |
| 32 | 32 | ret->output_callback = ff_vda_output_callback; |
| 33 | + ret->cv_pix_fmt_type = kCVPixelFormatType_422YpCbCr8; | |
| 34 | + } | |
| 33 | 35 | |
| 34 | 36 | return ret; |
| 35 | 37 | } |
| 36 | 38 | |
| 37 | 39 | int av_vda_default_init(AVCodecContext *avctx) |
| 38 | 40 | { |
| 39 | − avctx->hwaccel_context = av_vda_alloc_context(); | |
| 41 | + return av_vda_default_init2(avctx, NULL); | |
| 42 | +} | |
| 43 | + | |
| 44 | +int av_vda_default_init2(AVCodecContext *avctx, AVVDAContext *vdactx) | |
| 45 | +{ | |
| 46 | + avctx->hwaccel_context = vdactx ?: av_vda_alloc_context(); | |
| 40 | 47 | if (!avctx->hwaccel_context) |
| 41 | 48 | return AVERROR(ENOMEM); |
| 42 | 49 | return ff_vda_default_init(avctx); |
| @@ -171,6 +171,12 @@ typedef struct AVVDAContext { · 170 unmodified lines | ||
| 171 | 171 | * Set by av_vda_alloc_context(). |
| 172 | 172 | */ |
| 173 | 173 | VDADecoderOutputCallback output_callback; |
| 174 | + | |
| 175 | + /** | |
| 176 | + * CVPixelBuffer Format Type that VDA will use for decoded frames; set by | |
| 177 | + * the caller. | |
| 178 | + */ | |
| 179 | + OSType cv_pix_fmt_type; | |
| 174 | 180 | } AVVDAContext; |
| 175 | 181 | |
| 176 | 182 | /** |
| @@ -198,6 +204,17 @@ AVVDAContext *av_vda_alloc_context(void); · 21 unmodified lines | ||
| 198 | 204 | */ |
| 199 | 205 | int av_vda_default_init(AVCodecContext *avctx); |
| 200 | 206 | |
| 207 | +/** | |
| 208 | + * This is a convenience function that creates and sets up the VDA context using | |
| 209 | + * an internal implementation. | |
| 210 | + * | |
| 211 | + * @param avctx the corresponding codec context | |
| 212 | + * @param vdactx the VDA context to use | |
| 213 | + * | |
| 214 | + * @return >= 0 on success, a negative AVERROR code on failure | |
| 215 | + */ | |
| 216 | +int av_vda_default_init2(AVCodecContext *avctx, AVVDAContext *vdactx); | |
| 217 | + | |
| 201 | 218 | /** |
| 202 | 219 | * This function must be called to free the VDA context initialized with |
| 203 | 220 | * av_vda_default_init(). |
| @@ -430,7 +430,7 @@ int ff_vda_default_init(AVCodecContext *avctx) · 429 unmodified lines | ||
| 430 | 430 | CFMutableDictionaryRef buffer_attributes; |
| 431 | 431 | CFMutableDictionaryRef io_surface_properties; |
| 432 | 432 | CFNumberRef cv_pix_fmt; |
| 433 | − int32_t fmt = 'avc1', pix_fmt = kCVPixelFormatType_422YpCbCr8; | |
| 433 | + int32_t fmt = 'avc1', pix_fmt = vda_ctx->cv_pix_fmt_type; | |
| 434 | 434 | |
| 435 | 435 | // kCVPixelFormatType_420YpCbCr8Planar; |
| 436 | 436 | |
| @@ -29,7 +29,7 @@ · 28 unmodified lines | ||
| 29 | 29 | #include "libavutil/version.h" |
| 30 | 30 | |
| 31 | 31 | #define LIBAVCODEC_VERSION_MAJOR 56 |
| 32 | −#define LIBAVCODEC_VERSION_MINOR 38 | |
| 32 | +#define LIBAVCODEC_VERSION_MINOR 39 | |
| 33 | 33 | #define LIBAVCODEC_VERSION_MICRO 100 |
| 34 | 34 | |
| 35 | 35 | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ |