Refactor to use pixel format helpers in VAAPI
This commit is contained in:
parent
3b11bc86b0
commit
9a3553db04
3 changed files with 34 additions and 22 deletions
|
|
@ -195,25 +195,7 @@ namespace va {
|
|||
return -1;
|
||||
}
|
||||
|
||||
// Decide the bit depth format of the backing texture based the target frame format
|
||||
GLint gl_format;
|
||||
switch (hw_frames_ctx->sw_format) {
|
||||
case AV_PIX_FMT_YUV420P:
|
||||
case AV_PIX_FMT_NV12:
|
||||
gl_format = GL_RGBA8;
|
||||
break;
|
||||
|
||||
case AV_PIX_FMT_YUV420P10:
|
||||
case AV_PIX_FMT_P010:
|
||||
gl_format = GL_RGB10_A2;
|
||||
break;
|
||||
|
||||
default:
|
||||
BOOST_LOG(error) << "Unsupported pixel format for VA frame: "sv << hw_frames_ctx->sw_format;
|
||||
return -1;
|
||||
}
|
||||
|
||||
auto sws_opt = egl::sws_t::make(width, height, frame->width, frame->height, gl_format);
|
||||
auto sws_opt = egl::sws_t::make(width, height, frame->width, frame->height, hw_frames_ctx->sw_format);
|
||||
if (!sws_opt) {
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue