* 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 | API changes, most recent first: | 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 | 2015-05-11 - XXXXXXX - lavf 56.33.100 - avformat.h | 21 | 2015-05-11 - XXXXXXX - lavf 56.33.100 - avformat.h |
| 19 | Add AVOpenCallback AVFormatContext.open_cb | 22 | Add AVOpenCallback AVFormatContext.open_cb |
| 20 | 23 | ||
| @@ -28,15 +28,22 @@ AVVDAContext *av_vda_alloc_context(void) · 27 unmodified lines | |||
| 28 | { | 28 | { |
| 29 | AVVDAContext *ret = av_mallocz(sizeof(*ret)); | 29 | AVVDAContext *ret = av_mallocz(sizeof(*ret)); |
| 30 | 30 | ||
| 31 | if (ret) | 31 | if (ret) { |
| 32 | ret->output_callback = ff_vda_output_callback; | 32 | ret->output_callback = ff_vda_output_callback; |
| 33 | ret->cv_pix_fmt_type = kCVPixelFormatType_422YpCbCr8; | ||
| 34 | } | ||
| 33 | 35 | ||
| 34 | return ret; | 36 | return ret; |
| 35 | } | 37 | } |
| 36 | 38 | ||
| 37 | int av_vda_default_init(AVCodecContext *avctx) | 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 | if (!avctx->hwaccel_context) | 47 | if (!avctx->hwaccel_context) |
| 41 | return AVERROR(ENOMEM); | 48 | return AVERROR(ENOMEM); |
| 42 | return ff_vda_default_init(avctx); | 49 | return ff_vda_default_init(avctx); |
| @@ -171,6 +171,12 @@ typedef struct AVVDAContext { · 170 unmodified lines | |||
| 171 | * Set by av_vda_alloc_context(). | 171 | * Set by av_vda_alloc_context(). |
| 172 | */ | 172 | */ |
| 173 | VDADecoderOutputCallback output_callback; | 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 | } AVVDAContext; | 180 | } AVVDAContext; |
| 175 | 181 | ||
| 176 | /** | 182 | /** |
| @@ -198,6 +204,17 @@ AVVDAContext *av_vda_alloc_context(void); · 21 unmodified lines | |||
| 198 | */ | 204 | */ |
| 199 | int av_vda_default_init(AVCodecContext *avctx); | 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 | * This function must be called to free the VDA context initialized with | 219 | * This function must be called to free the VDA context initialized with |
| 203 | * av_vda_default_init(). | 220 | * av_vda_default_init(). |
| @@ -430,7 +430,7 @@ int ff_vda_default_init(AVCodecContext *avctx) · 429 unmodified lines | |||
| 430 | CFMutableDictionaryRef buffer_attributes; | 430 | CFMutableDictionaryRef buffer_attributes; |
| 431 | CFMutableDictionaryRef io_surface_properties; | 431 | CFMutableDictionaryRef io_surface_properties; |
| 432 | CFNumberRef cv_pix_fmt; | 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 | // kCVPixelFormatType_420YpCbCr8Planar; | 435 | // kCVPixelFormatType_420YpCbCr8Planar; |
| 436 | 436 | ||
| @@ -29,7 +29,7 @@ · 28 unmodified lines | |||
| 29 | #include "libavutil/version.h" | 29 | #include "libavutil/version.h" |
| 30 | 30 | ||
| 31 | #define LIBAVCODEC_VERSION_MAJOR 56 | 31 | #define LIBAVCODEC_VERSION_MAJOR 56 |
| 32 | #define LIBAVCODEC_VERSION_MINOR 38 | 32 | #define LIBAVCODEC_VERSION_MINOR 39 |
| 33 | #define LIBAVCODEC_VERSION_MICRO 100 | 33 | #define LIBAVCODEC_VERSION_MICRO 100 |
| 34 | 34 | ||
| 35 | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ | 35 | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ |