vic: Implement RGBX frame format
This commit is contained in:
parent
f84328934f
commit
899fdb9c44
@ -68,13 +68,24 @@ void Vic::Execute() {
|
|||||||
const auto pixel_format = static_cast<VideoPixelFormat>(config.pixel_format.Value());
|
const auto pixel_format = static_cast<VideoPixelFormat>(config.pixel_format.Value());
|
||||||
switch (pixel_format) {
|
switch (pixel_format) {
|
||||||
case VideoPixelFormat::BGRA8:
|
case VideoPixelFormat::BGRA8:
|
||||||
|
case VideoPixelFormat::RGBX8:
|
||||||
case VideoPixelFormat::RGBA8: {
|
case VideoPixelFormat::RGBA8: {
|
||||||
LOG_TRACE(Service_NVDRV, "Writing RGB Frame");
|
LOG_TRACE(Service_NVDRV, "Writing RGB Frame");
|
||||||
|
|
||||||
if (scaler_ctx == nullptr || frame->width != scaler_width ||
|
if (scaler_ctx == nullptr || frame->width != scaler_width ||
|
||||||
frame->height != scaler_height) {
|
frame->height != scaler_height) {
|
||||||
const AVPixelFormat target_format =
|
const AVPixelFormat target_format = [pixel_format]() {
|
||||||
(pixel_format == VideoPixelFormat::RGBA8) ? AV_PIX_FMT_RGBA : AV_PIX_FMT_BGRA;
|
switch (pixel_format) {
|
||||||
|
case VideoPixelFormat::BGRA8:
|
||||||
|
return AV_PIX_FMT_BGRA;
|
||||||
|
case VideoPixelFormat::RGBX8:
|
||||||
|
return AV_PIX_FMT_RGB0;
|
||||||
|
case VideoPixelFormat::RGBA8:
|
||||||
|
return AV_PIX_FMT_RGBA;
|
||||||
|
default:
|
||||||
|
return AV_PIX_FMT_RGBA;
|
||||||
|
}
|
||||||
|
}();
|
||||||
|
|
||||||
sws_freeContext(scaler_ctx);
|
sws_freeContext(scaler_ctx);
|
||||||
scaler_ctx = nullptr;
|
scaler_ctx = nullptr;
|
||||||
@ -190,7 +201,7 @@ void Vic::Execute() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
UNIMPLEMENTED_MSG("Unknown video pixel format {}", config.pixel_format.Value());
|
UNIMPLEMENTED_MSG("Unknown video pixel format {:X}", config.pixel_format.Value());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,7 @@ private:
|
|||||||
enum class VideoPixelFormat : u64_le {
|
enum class VideoPixelFormat : u64_le {
|
||||||
RGBA8 = 0x1f,
|
RGBA8 = 0x1f,
|
||||||
BGRA8 = 0x20,
|
BGRA8 = 0x20,
|
||||||
|
RGBX8 = 0x23,
|
||||||
Yuv420 = 0x44,
|
Yuv420 = 0x44,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user