Skip to content

Commit

Permalink
Add config parameter for channel color-space
Browse files Browse the repository at this point in the history
  • Loading branch information
niklaspandersson committed Apr 29, 2024
1 parent ebcc6ab commit aac7d44
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/shell/casparcg.config
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
<channel>
<video-mode>PAL [PAL|NTSC|576p2500|720p2398|720p2400|720p2500|720p5000|720p2997|720p5994|720p3000|720p6000|1080p2398|1080p2400|1080i5000|1080i5994|1080i6000|1080p2500|1080p2997|1080p3000|1080p5000|1080p5994|1080p6000|1556p2398|1556p2400|1556p2500|dci1080p2398|dci1080p2400|dci1080p2500|2160p2398|2160p2400|2160p2500|2160p2997|2160p3000|2160p5000|2160p5994|2160p6000|dci2160p2398|dci2160p2400|dci2160p2500] </video-mode>
<color-depth>8 [8|16]</color-depth>
<color-space>bt709 [bt709|bt2020]</color-space>
<consumers>
<decklink>
<device>[1..]</device>
Expand Down
7 changes: 6 additions & 1 deletion src/shell/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,14 +261,19 @@ struct server::impl
if (color_depth != 8 && color_depth != 16)
CASPAR_THROW_EXCEPTION(user_error()
<< msg_info(L"Invalid color-depth: " + std::to_wstring(color_depth)));

auto color_space_str = boost::to_lower_copy(xml_channel.second.get(L"color-space", L"bt709"));
if (color_space_str != L"bt709" && color_space_str != L"bt2020")
CASPAR_THROW_EXCEPTION(user_error()
<< msg_info(L"Invalid color-space, must be bt709 or bt2020"));

if (format_desc.format == video_format::invalid)
CASPAR_THROW_EXCEPTION(user_error() << msg_info(L"Invalid video-mode: " + format_desc_str));

auto weak_client = std::weak_ptr<osc::client>(osc_client_);
auto channel_id = static_cast<int>(channels_->size() + 1);
auto depth = color_depth == 16 ? common::bit_depth::bit16 : common::bit_depth::bit8;
auto color_space = depth == common::bit_depth::bit16 ? core::color_space::bt2020 : core::color_space::bt709;
auto color_space = color_space_str == L"bt2020" ? core::color_space::bt2020 : core::color_space::bt709;
auto channel =
spl::make_shared<video_channel>(channel_id,
format_desc,
Expand Down

0 comments on commit aac7d44

Please sign in to comment.