CFDictionarySetValue(enc_info, kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder, kCFBooleanTrue);
#endif
- status = create_cv_pixel_buffer_info(avctx, &pixel_buffer_info);
- if (status) {
- CFRelease(enc_info);
- return status;
+ if (avctx->pix_fmt != AV_PIX_FMT_VIDEOTOOLBOX) {
+ status = create_cv_pixel_buffer_info(avctx, &pixel_buffer_info);
+ if (status) {
+ CFRelease(enc_info);
+ return status;
+ }
+ } else {
+ pixel_buffer_info = NULL;
}
status = VTCompressionSessionCreate(
}
#endif
- CFRelease(pixel_buffer_info);
+ if (pixel_buffer_info) CFRelease(pixel_buffer_info);
CFRelease(enc_info);
if (status || !vtctx->session) {
CVPixelBufferPoolRef pix_buf_pool;
VTEncContext* vtctx = avctx->priv_data;
+
+ if (avctx->pix_fmt == AV_PIX_FMT_VIDEOTOOLBOX) {
+ av_assert0(frame->format == AV_PIX_FMT_VIDEOTOOLBOX);
+
+ *cv_img = (CVPixelBufferRef)frame->data[3];
+ av_assert0(*cv_img);
+
+ CFRetain(*cv_img);
+ return 0;
+ }
+
memset(widths, 0, sizeof(widths));
memset(heights, 0, sizeof(heights));
memset(strides, 0, sizeof(strides));
}
static const enum AVPixelFormat pix_fmts[] = {
+ AV_PIX_FMT_VIDEOTOOLBOX,
AV_PIX_FMT_NV12,
AV_PIX_FMT_YUV420P,
AV_PIX_FMT_NONE