Skip to content

Commit

Permalink
Print encoder name to info log during creation
Browse files Browse the repository at this point in the history
  • Loading branch information
ns6089 committed Aug 5, 2024
1 parent adf068e commit 23af3a9
Showing 1 changed file with 19 additions and 22 deletions.
41 changes: 19 additions & 22 deletions src/video.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1725,28 +1725,6 @@ namespace video {

std::unique_ptr<encode_session_t>
make_encode_session(platf::display_t *disp, const encoder_t &encoder, const config_t &config, int width, int height, std::unique_ptr<platf::encode_device_t> encode_device) {
if (encode_device) {
switch (encode_device->colorspace.colorspace) {
case colorspace_e::bt2020:
BOOST_LOG(info) << "HDR color coding [Rec. 2020 + SMPTE 2084 PQ]"sv;
break;

case colorspace_e::rec601:
BOOST_LOG(info) << "SDR color coding [Rec. 601]"sv;
break;

case colorspace_e::rec709:
BOOST_LOG(info) << "SDR color coding [Rec. 709]"sv;
break;

case colorspace_e::bt2020sdr:
BOOST_LOG(info) << "SDR color coding [Rec. 2020]"sv;
break;
}
BOOST_LOG(info) << "Color depth: " << encode_device->colorspace.bit_depth << "-bit";
BOOST_LOG(info) << "Color range: ["sv << (encode_device->colorspace.full_range ? "JPEG"sv : "MPEG"sv) << ']';
}

if (dynamic_cast<platf::avcodec_encode_device_t *>(encode_device.get())) {
auto avcodec_encode_device = boost::dynamic_pointer_cast<platf::avcodec_encode_device_t>(std::move(encode_device));
return make_avcodec_encode_session(disp, encoder, config, width, height, std::move(avcodec_encode_device));
Expand Down Expand Up @@ -1880,6 +1858,25 @@ namespace video {
auto colorspace = colorspace_from_client_config(config, disp.is_hdr());
auto pix_fmt = (colorspace.bit_depth == 10) ? encoder.platform_formats->pix_fmt_10bit : encoder.platform_formats->pix_fmt_8bit;

{
auto encoder_name = config.videoFormat == 0 ? encoder.h264.name :
config.videoFormat == 1 ? encoder.hevc.name :
config.videoFormat == 2 ? encoder.av1.name :
"unknown";

BOOST_LOG(info) << "Creating encoder " << logging::bracket(encoder_name);

auto color_coding = colorspace.colorspace == colorspace_e::bt2020 ? "HDR (Rec. 2020 + SMPTE 2084 PQ)" :
colorspace.colorspace == colorspace_e::rec601 ? "SDR (Rec. 601)" :
colorspace.colorspace == colorspace_e::rec709 ? "SDR (Rec. 709)" :
colorspace.colorspace == colorspace_e::bt2020sdr ? "SDR (Rec. 2020)" :

Check warning on line 1872 in src/video.cpp

View check run for this annotation

Codecov / codecov/patch

src/video.cpp#L1872

Added line #L1872 was not covered by tests
"unknown";

BOOST_LOG(info) << "Color coding: " << color_coding;
BOOST_LOG(info) << "Color depth: " << colorspace.bit_depth << "-bit";
BOOST_LOG(info) << "Color range: " << (colorspace.full_range ? "JPEG" : "MPEG");
}

if (dynamic_cast<const encoder_platform_formats_avcodec *>(encoder.platform_formats.get())) {
result = disp.make_avcodec_encode_device(pix_fmt);
}
Expand Down

0 comments on commit 23af3a9

Please sign in to comment.