格式转换
2024-12-19
1
0
格式转换的的是YUV转成RGB,需要相应的纹理和对应的着色器资源视图
video->convert_textures[0] =gs_texture_create(ovi->output_width, ovi->output_height, GS_R8, 1, NULL, GS_RENDER_TARGET);
const struct video_output_info *info =video_output_get_info(video->video);
switch (info->format)
{
case VIDEO_FORMAT_I420:
video->convert_textures[1] = gs_texture_create(ovi->output_width/2, ovi->output_height/2,GS_R8, 1, NULL, GS_RENDER_TARGET);
video->convert_textures[2] = gs_texture_create(ovi->output_width/2, ovi->output_height/2,GS_R8, 1, NULL, GS_RENDER_TARGET);
if (!video->convert_textures[2])
return false;
break;
case VIDEO_FORMAT_NV12:
video->convert_textures[1] = gs_texture_create(ovi->output_width/2, ovi->output_height/2,GS_R8G8, 1, NULL, GS_RENDER_TARGET);
break;
case VIDEO_FORMAT_I444:
video->convert_textures[1] = gs_texture_create(ovi->output_width, ovi->output_height, GS_R8, 1, NULL, GS_RENDER_TARGET);
video->convert_textures[2] = gs_texture_create(ovi->output_width, ovi->output_height, GS_R8, 1, NULL, GS_RENDER_TARGET);
if (!video->convert_textures[2])
return false;
break;
default:
break;
}