提交 2667ae3f 编写于 作者: L Luke Yelavich

mac-vth264: Fix video info set logic

In the vt_h264_video_info function, the format of the video to be encoded is
always being set to VIDEO_FORMAT_NV12, dispite the presence of code to set
the video format to VIDEO_FORMAT_I420 or VIDEO_FORMAT_I444. This commit fixes
that function to respect the video format choice of the user.

In addition, whilst testing this fix initially, I also discovered that the
4:4:4 colour format is not supported by the VideoToolbox H264 encoder.
Looking at the VideoToolbox code in ffmpeg as a reference, the ffmpeg code
errors out if a color format other than NV12 or I420 is set. Therefore, this
commit also logs a warning about I444 not being supported, and uses the NV12
default.
上级 24d2346a
...@@ -424,11 +424,12 @@ static void vt_h264_video_info(void *data, struct video_scale_info *info) ...@@ -424,11 +424,12 @@ static void vt_h264_video_info(void *data, struct video_scale_info *info)
enc->vt_pix_fmt = enc->fullrange ? enc->vt_pix_fmt = enc->fullrange ?
kCVPixelFormatType_420YpCbCr8PlanarFullRange kCVPixelFormatType_420YpCbCr8PlanarFullRange
: kCVPixelFormatType_420YpCbCr8Planar; : kCVPixelFormatType_420YpCbCr8Planar;
} else if (info->format == VIDEO_FORMAT_I444) { return;
enc->obs_pix_fmt = info->format;
enc->vt_pix_fmt = kCVPixelFormatType_444YpCbCr10;
} }
if (info->format == VIDEO_FORMAT_I444)
VT_BLOG(LOG_WARNING, "I444 color format not supported");
// Anything else, return default // Anything else, return default
enc->obs_pix_fmt = VIDEO_FORMAT_NV12; enc->obs_pix_fmt = VIDEO_FORMAT_NV12;
enc->vt_pix_fmt = enc->fullrange ? enc->vt_pix_fmt = enc->fullrange ?
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册