Example #1
0
static void convert_frame(
		struct video_frame *output, const struct video_data *input,
		const struct video_output_info *info)
{
	if (info->format == VIDEO_FORMAT_I420) {
		compress_uyvx_to_i420(
				input->data[0], input->linesize[0],
				0, info->height,
				output->data, output->linesize);

	} else if (info->format == VIDEO_FORMAT_NV12) {
		compress_uyvx_to_nv12(
				input->data[0], input->linesize[0],
				0, info->height,
				output->data, output->linesize);

	} else if (info->format == VIDEO_FORMAT_I444) {
		convert_uyvx_to_i444(
				input->data[0], input->linesize[0],
				0, info->height,
				output->data, output->linesize);

	} else {
		blog(LOG_ERROR, "convert_frame: unsupported texture format");
	}
}
Example #2
0
static bool convert_frame(struct obs_core_video *video,
		struct video_data *frame,
		const struct video_output_info *info, int cur_texture)
{
	struct source_frame *new_frame = &video->convert_frames[cur_texture];

	if (info->format == VIDEO_FORMAT_I420) {
		compress_uyvx_to_i420(
				frame->data[0], frame->linesize[0],
				0, info->height,
				new_frame->data, new_frame->linesize);

	} else if (info->format == VIDEO_FORMAT_NV12) {
		compress_uyvx_to_nv12(
				frame->data[0], frame->linesize[0],
				0, info->height,
				new_frame->data, new_frame->linesize);

	} else {
		blog(LOG_ERROR, "convert_frame: unsupported texture format");
		return false;
	}

	for (size_t i = 0; i < MAX_AV_PLANES; i++) {
		frame->data[i]     = new_frame->data[i];
		frame->linesize[i] = new_frame->linesize[i];
	}

	return true;
}