Signed-off-by: Kevin Pouget <kpouget@xxxxxxxxxx> --- src/gst-plugin.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/gst-plugin.cpp b/src/gst-plugin.cpp index 5469647..657b62d 100644 --- a/src/gst-plugin.cpp +++ b/src/gst-plugin.cpp @@ -102,7 +102,8 @@ class GstreamerPlugin final: public Plugin public: FrameCapture *CreateCapture() override; unsigned Rank() override; - void ParseOptions(const ConfigureOption *options, SpiceVideoCodecType codec); + void ParseOptions(const ConfigureOption *options, SpiceVideoCodecType codec, + const std::string codec_name); SpiceVideoCodecType VideoCodecType() const override { return settings.codec; } @@ -431,7 +432,8 @@ unsigned GstreamerPlugin::Rank() return SoftwareMin; } -void GstreamerPlugin::ParseOptions(const ConfigureOption *options, SpiceVideoCodecType codec) +void GstreamerPlugin::ParseOptions(const ConfigureOption *options, + SpiceVideoCodecType codec, const std::string codec_name) { settings.codec = codec; @@ -439,15 +441,17 @@ void GstreamerPlugin::ParseOptions(const ConfigureOption *options, SpiceVideoCo const std::string name = options->name; const std::string value = options->value; - if (name == "framerate") { + if (name == "framerate" || name == "gst." + codec_name + ".framerate") { try { settings.fps = std::stoi(value); + } catch (const std::exception &e) { - throw std::runtime_error("Invalid value '" + value + "' for option 'framerate'."); + throw std::runtime_error("Invalid value '" + value + "' " + "for option '" + name + "'."); } - } else if (name == "gst.encoder") { + } else if (name == "gst.encoder" || name == "gst." + codec_name + ".encoder") { settings.encoder = value; - } else if (name == "gst.prop") { + } else if (name == "gst.prop" || name == "gst." + codec_name + ".prop") { size_t pos = value.find('='); if (pos == 0 || pos >= value.size() - 1) { gst_syslog(LOG_WARNING, "Property input is invalid ('%s' Ignored)", value.c_str()); @@ -488,7 +492,7 @@ SPICE_STREAMING_AGENT_PLUGIN(agent) } auto plugin = std::make_shared<GstreamerPlugin>(); - plugin->ParseOptions(agent->Options(), codec_type); + plugin->ParseOptions(agent->Options(), codec_type, value); agent->Register(plugin); } } -- 2.21.0 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel