]> git.sesse.net Git - casparcg/blobdiff - protocol/amcp/AMCPCommandsImpl.cpp
[channel_producer] #590 Added NO_AUTO_DEINTERLACE parameter to channel route AMCP...
[casparcg] / protocol / amcp / AMCPCommandsImpl.cpp
index 45382b452119b6360bee81a18ec1707e99020ae6..69826476d6e7c443c2ede347314a0bd5c3c0589f 100644 (file)
@@ -306,7 +306,8 @@ core::frame_producer_dependencies get_producer_dependencies(const std::shared_pt
                        channel->frame_factory(),
                        get_channels(ctx),
                        channel->video_format_desc(),
-                       ctx.producer_registry);
+                       ctx.producer_registry,
+                       ctx.cg_registry);
 }
 
 // Basic Commands
@@ -958,7 +959,7 @@ void cg_add_describer(core::help_sink& sink, const core::help_repository& repo)
                ->text(L"Prepares a template for displaying. It won't show until you call ")->see(L"CG PLAY")
                ->text(L" (unless you supply the play-on-load flag, 1 for true). Data is either inline XML or a reference to a saved dataset.");
        sink.para()->text(L"Examples:");
-       sink.example(L"CG 1 ADD 10 svtnews/info 1");
+       sink.example(L">> CG 1 ADD 10 svtnews/info 1");
 }
 
 std::wstring cg_add_command(command_context& ctx)
@@ -1029,7 +1030,7 @@ void cg_play_describer(core::help_sink& sink, const core::help_repository& repo)
        sink.syntax(L"CG [video_channel:int]{-[layer:int]|-9999} PLAY [cg_layer:int]");
        sink.para()->text(L"Plays and displays the template in the specified layer.");
        sink.para()->text(L"Examples:");
-       sink.example(L"CG 1 PLAY 0");
+       sink.example(L">> CG 1 PLAY 0");
 }
 
 std::wstring cg_play_command(command_context& ctx)
@@ -1058,7 +1059,7 @@ void cg_stop_describer(core::help_sink& sink, const core::help_repository& repo)
                ->text(L"Stops and removes the template from the specified layer. This is different from ")->code(L"REMOVE")
                ->text(L" in that the template gets a chance to animate out when it is stopped.");
        sink.para()->text(L"Examples:");
-       sink.example(L"CG 1 STOP 0");
+       sink.example(L">> CG 1 STOP 0");
 }
 
 std::wstring cg_stop_command(command_context& ctx)
@@ -1077,7 +1078,7 @@ void cg_next_describer(core::help_sink& sink, const core::help_repository& repo)
                ->text(LR"(Triggers a "continue" in the template on the specified layer. )")
                ->text(L"This is used to control animations that has multiple discreet steps.");
        sink.para()->text(L"Examples:");
-       sink.example(L"CG 1 NEXT 0");
+       sink.example(L">> CG 1 NEXT 0");
 }
 
 std::wstring cg_next_command(command_context& ctx)
@@ -1094,7 +1095,7 @@ void cg_remove_describer(core::help_sink& sink, const core::help_repository& rep
        sink.syntax(L"CG [video_channel:int]{-[layer:int]|-9999} REMOVE [cg_layer:int]");
        sink.para()->text(L"Removes the template from the specified layer.");
        sink.para()->text(L"Examples:");
-       sink.example(L"CG 1 REMOVE 0");
+       sink.example(L">> CG 1 REMOVE 0");
 }
 
 std::wstring cg_remove_command(command_context& ctx)
@@ -1111,7 +1112,7 @@ void cg_clear_describer(core::help_sink& sink, const core::help_repository& repo
        sink.syntax(L"CG [video_channel:int]{-[layer:int]|-9999} CLEAR");
        sink.para()->text(L"Removes all templates on a video layer. The entire cg producer will be removed.");
        sink.para()->text(L"Examples:");
-       sink.example(L"CG 1 CLEAR");
+       sink.example(L">> CG 1 CLEAR");
 }
 
 std::wstring cg_clear_command(command_context& ctx)
@@ -1293,28 +1294,28 @@ std::wstring ANIMATION_SYNTAX = L" {[duration:int] {[tween:string]|linear}|0 lin
 void mixer_chroma_describer(core::help_sink& sink, const core::help_repository& repo)
 {
        sink.short_description(L"Enable chroma keying on a layer.");
-       sink.syntax(L"MIXER [video_channel:int]{-[layer:int]|-0} CHROMA {[enable:0,1] {[target_hue:float] [hue_width:float] [min_saturation:float] [min_brightness:float] [softness:float] [spill:float] [spill_darken:float] [show_mask:0,1]}}" + ANIMATION_SYNTAX);
+       sink.syntax(L"MIXER [video_channel:int]{-[layer:int]|-0} CHROMA {[enable:0,1] {[target_hue:float] [hue_width:float] [min_saturation:float] [min_brightness:float] [softness:float] [spill_suppress:float] [spill_suppress_saturation:float] [show_mask:0,1]}}" + ANIMATION_SYNTAX);
        sink.para()
                ->text(L"Enables or disables chroma keying on the specified video layer. Giving no parameters returns the current chroma settings.");
        sink.para()->text(L"The chroma keying is done in the HSB/HSV color space.");
        sink.para()->text(L"Parameters:");
        sink.definitions()
-               ->item(L"enable", L"0 to disable chroma keying on layer. The rest of the parameters should not be given when disabling.")
-               ->item(L"target_hue", L"The hue in degrees between 0-360 where the center of the hue window will open up.")
-               ->item(L"hue_width", L"The width of the hue window within 0.0-1.0 where 1.0 means 100% of 360 degrees around target_hue.")
-               ->item(L"min_saturation", L"The minimum saturation within 0.0-1.0 required for a color to be within the chroma window.")
-               ->item(L"min_brightness", L"The minimum brightness within 0.0-1.0 required for a color to be within the chroma window.")
-               ->item(L"softness", L"The softness of the chroma keying window.")
-               ->item(L"spill", L"Controls the amount of spill. A value of 1.0 does not suppress any spill. A lower value gradually turns the spill into grayscale and more transparent.")
-               ->item(L"spill_darken", L"Controls the shade of gray that the spill suppression is done towards. Lower values goes towards white and higher values goes towards black.")
-               ->item(L"show_mask", L"If enabled, only shows the mask. Useful while editing the chroma key settings.")
+               ->item(L"enable",                                               L"0 to disable chroma keying on layer. The rest of the parameters should not be given when disabling.")
+               ->item(L"target_hue",                                   L"The hue in degrees between 0-360 where the center of the hue window will open up.")
+               ->item(L"hue_width",                                            L"The width of the hue window within 0.0-1.0 where 1.0 means 100% of 360 degrees around target_hue.")
+               ->item(L"min_saturation",                               L"The minimum saturation within 0.0-1.0 required for a color to be within the chroma window.")
+               ->item(L"min_brightness",                               L"The minimum brightness within 0.0-1.0 required for a color to be within the chroma window.")
+               ->item(L"softness",                                             L"The softness of the chroma keying window.")
+               ->item(L"spill_suppress",                               L"How much to suppress spill by within 0.0-180.0. It works by taking all hue values within +- this value from target_hue and clamps it to either target_hue - this value or target_hue + this value depending on which side it is closest to.")
+               ->item(L"spill_suppress_saturation",            L"Controls how much saturation should be kept on colors affected by spill_suppress within 0.0-1.0. Full saturation may not always be desirable to be kept on suppressed colors.")
+               ->item(L"show_mask",                                            L"If enabled, only shows the mask. Useful while editing the chroma key settings.")
                ;
-       sink.example(L">> MIXER 1-1 CHROMA 1 120 0.1 0 0 0.1 1 2 0", L"for enabling chroma keying centered around a hue of 120 degrees (green) and with a 10% hue width");
+       sink.example(L">> MIXER 1-1 CHROMA 1 120 0.1 0 0 0.1 0.1 0.7 0", L"for enabling chroma keying centered around a hue of 120 degrees (green) and with a 10% hue width");
        sink.example(L">> MIXER 1-1 CHROMA 0", L"for disabling chroma keying");
        sink.example(
                L">> MIXER 1-1 CHROMA 0\n"
                L"<< 202 MIXER OK\n"
-               L"<< 1 120 0.1 0 0 0.1 1 2 0", L"for getting the current chroma key mode");
+               L"<< 1 120 0.1 0 0 0.1 0 1 0", L"for getting the current chroma key mode");
        sink.para()->text(L"Deprecated legacy syntax:");
        sink.syntax(L"MIXER [video_channel:int]{-[layer:int]|-0} CHROMA {[color:none,green,blue] {[threshold:float] [softness:float] [spill:float]}}" + ANIMATION_SYNTAX);
        sink.para()->text(L"Deprecated legacy examples:");
@@ -1334,8 +1335,8 @@ std::wstring mixer_chroma_command(command_context& ctx)
                        + boost::lexical_cast<std::wstring>(chroma.min_saturation) + L" "
                        + boost::lexical_cast<std::wstring>(chroma.min_brightness) + L" "
                        + boost::lexical_cast<std::wstring>(chroma.softness) + L" "
-                       + boost::lexical_cast<std::wstring>(chroma.spill) + L" "
-                       + boost::lexical_cast<std::wstring>(chroma.spill_darken) + L" "
+                       + boost::lexical_cast<std::wstring>(chroma.spill_suppress) + L" "
+                       + boost::lexical_cast<std::wstring>(chroma.spill_suppress_saturation) + L" "
                        + std::wstring(chroma.show_mask ? L"1" : L"0") + L"\r\n";
        }
 
@@ -1359,13 +1360,13 @@ std::wstring mixer_chroma_command(command_context& ctx)
                }
                else
                {
-                       chroma.enable = true;
-                       chroma.hue_width = 0.5 - boost::lexical_cast<double>(ctx.parameters.at(1)) * 0.5;
-                       chroma.min_brightness = boost::lexical_cast<double>(ctx.parameters.at(1));
-                       chroma.min_saturation = boost::lexical_cast<double>(ctx.parameters.at(1));
-                       chroma.softness = boost::lexical_cast<double>(ctx.parameters.at(2)) - boost::lexical_cast<double>(ctx.parameters.at(1));
-                       chroma.spill = boost::lexical_cast<double>(ctx.parameters.at(3));
-                       chroma.spill_darken = 2;
+                       chroma.enable                                           = true;
+                       chroma.hue_width                                        = 0.5 - boost::lexical_cast<double>(ctx.parameters.at(1)) * 0.5;
+                       chroma.min_brightness                           = boost::lexical_cast<double>(ctx.parameters.at(1));
+                       chroma.min_saturation                           = boost::lexical_cast<double>(ctx.parameters.at(1));
+                       chroma.softness                                         = boost::lexical_cast<double>(ctx.parameters.at(2)) - boost::lexical_cast<double>(ctx.parameters.at(1));
+                       chroma.spill_suppress                           = 180.0 - boost::lexical_cast<double>(ctx.parameters.at(3)) * 180.0;
+                       chroma.spill_suppress_saturation        = 1;
 
                        if (*legacy_mode == chroma::legacy_type::green)
                                chroma.target_hue = 120;
@@ -1382,14 +1383,14 @@ std::wstring mixer_chroma_command(command_context& ctx)
 
                if (chroma.enable)
                {
-                       chroma.target_hue               = boost::lexical_cast<double>(ctx.parameters.at(1));
-                       chroma.hue_width                = boost::lexical_cast<double>(ctx.parameters.at(2));
-                       chroma.min_saturation   = boost::lexical_cast<double>(ctx.parameters.at(3));
-                       chroma.min_brightness   = boost::lexical_cast<double>(ctx.parameters.at(4));
-                       chroma.softness                 = boost::lexical_cast<double>(ctx.parameters.at(5));
-                       chroma.spill                    = boost::lexical_cast<double>(ctx.parameters.at(6));
-                       chroma.spill_darken             = boost::lexical_cast<double>(ctx.parameters.at(7));
-                       chroma.show_mask                = boost::lexical_cast<double>(ctx.parameters.at(8));
+                       chroma.target_hue                                       = boost::lexical_cast<double>(ctx.parameters.at(1));
+                       chroma.hue_width                                        = boost::lexical_cast<double>(ctx.parameters.at(2));
+                       chroma.min_saturation                           = boost::lexical_cast<double>(ctx.parameters.at(3));
+                       chroma.min_brightness                           = boost::lexical_cast<double>(ctx.parameters.at(4));
+                       chroma.softness                                         = boost::lexical_cast<double>(ctx.parameters.at(5));
+                       chroma.spill_suppress                           = boost::lexical_cast<double>(ctx.parameters.at(6));
+                       chroma.spill_suppress_saturation        = boost::lexical_cast<double>(ctx.parameters.at(7));
+                       chroma.show_mask                                        = boost::lexical_cast<double>(ctx.parameters.at(8));
                }
        }
 
@@ -2144,7 +2145,7 @@ std::wstring channel_grid_command(command_context& ctx)
                if (channel.channel != self.channel)
                {
                        core::diagnostics::call_context::for_thread().layer = index;
-                       auto producer = ctx.producer_registry->create_producer(get_producer_dependencies(self.channel, ctx), L"route://" + boost::lexical_cast<std::wstring>(channel.channel->index()));
+                       auto producer = ctx.producer_registry->create_producer(get_producer_dependencies(self.channel, ctx), L"route://" + boost::lexical_cast<std::wstring>(channel.channel->index()) + L" NO_AUTO_DEINTERLACE");
                        self.channel->stage().load(index, producer, false);
                        self.channel->stage().play(index);
                        index++;
@@ -2946,9 +2947,9 @@ void lock_describer(core::help_sink& sink, const core::help_repository& repo)
        sink.syntax(L"LOCK [video_channel:int] [action:ACQUIRE,RELEASE,CLEAR] {[lock-phrase:string]}");
        sink.para()->text(L"Allows for exclusive access to a channel.");
        sink.para()->text(L"Examples:");
-       sink.example(L"LOCK 1 ACQUIRE secret");
-       sink.example(L"LOCK 1 RELEASE");
-       sink.example(L"LOCK 1 CLEAR");
+       sink.example(L">> LOCK 1 ACQUIRE secret");
+       sink.example(L">> LOCK 1 RELEASE");
+       sink.example(L">> LOCK 1 CLEAR");
 }
 
 std::wstring lock_command(command_context& ctx)
@@ -3002,7 +3003,6 @@ void req_describer(core::help_sink& sink, const core::help_repository& repo)
                ->text(L"This special command modifies the AMCP protocol a little bit to prepend ")
                ->code(L"RES request_id")->text(L" to the response, in order to see what asynchronous response matches what request.");
        sink.para()->text(L"Examples:");
-       sink.example(L"REQ unique PLAY 1-0 AMB\n");
        sink.example(
                L">> REQ unique PLAY 1-0 AMB\n"
                L"<< RES unique 202 PLAY OK");