diff --git a/src/ControlManager.cpp b/src/ControlManager.cpp index 5ffb176..cd410f2 100644 --- a/src/ControlManager.cpp +++ b/src/ControlManager.cpp @@ -824,6 +824,12 @@ bool Control::receiveSourceAttribute(Source *target, const std::string &attribut arguments >> t >> osc::EndMessage; target->call( new Seek( t ), true ); } + /// e.g. '/vimix/current/speed f 0.25' + else if ( attribute.compare(OSC_SOURCE_SPEED) == 0) { + float t = 0.f; + arguments >> t >> osc::EndMessage; + target->call( new PlaySpeed( t ), true ); + } /// e.g. '/vimix/name/sync' else if ( attribute.compare(OSC_SYNC) == 0) { // this will require to send feedback status about source diff --git a/src/ControlManager.h b/src/ControlManager.h index bb9ca97..f3c0efa 100644 --- a/src/ControlManager.h +++ b/src/ControlManager.h @@ -50,6 +50,7 @@ #define OSC_SOURCE_SIZE "/size" #define OSC_SOURCE_ANGLE "/angle" #define OSC_SOURCE_SEEK "/seek" +#define OSC_SOURCE_SPEED "/speed" #define OSC_SOURCE_BRIGHTNESS "/brightness" #define OSC_SOURCE_CONTRAST "/contrast" #define OSC_SOURCE_SATURATION "/saturation" diff --git a/src/MediaPlayer.cpp b/src/MediaPlayer.cpp index 6c64d76..0335b57 100644 --- a/src/MediaPlayer.cpp +++ b/src/MediaPlayer.cpp @@ -139,7 +139,8 @@ MediaInfo MediaPlayer::UriDiscoverer(const std::string &uri) video_stream_info.log = "Invalid URI"; break; case GST_DISCOVERER_ERROR: - video_stream_info.log = std::string( "Error; " ) + err->message; + video_stream_info.log = std::string( "Warning: " ) + err->message; + result = GST_DISCOVERER_OK; // try to read the file anyways, discoverer can report errors but still read the file break; case GST_DISCOVERER_TIMEOUT: video_stream_info.log = "Timeout loading"; @@ -355,7 +356,7 @@ void MediaPlayer::execute_open() return; } - // setup uridecodebin + // setup software decode if (force_software_decoding_) { g_object_set (G_OBJECT (gst_bin_get_by_name (GST_BIN (pipeline_), "decoder")), "force-sw-decoders", true, NULL); } @@ -584,8 +585,11 @@ bool MediaPlayer::isImage() const std::string MediaPlayer::decoderName() { if (pipeline_) { + if (force_software_decoding_) { + decoder_name_ = "software"; + } // decoder_name_ not initialized - if (decoder_name_.empty()) { + else if (decoder_name_.empty()) { // try to know if it is a hardware decoder decoder_name_ = GstToolkit::used_gpu_decoding_plugins(pipeline_); // nope, then it is a sofware decoder diff --git a/src/UserInterfaceManager.cpp b/src/UserInterfaceManager.cpp index c191fce..ce33e73 100644 --- a/src/UserInterfaceManager.cpp +++ b/src/UserInterfaceManager.cpp @@ -3146,20 +3146,19 @@ void SourceController::Render() mediaplayer_active_->setRewindOnDisabled(true); ImGui::EndMenu(); } - if (Settings::application.render.gpu_decoding) + // always allow for hardware decoding to be disabled + ImGui::Separator(); + if (ImGui::BeginMenu(ICON_FA_MICROCHIP " Hardware decoding")) { - ImGui::Separator(); - if (ImGui::BeginMenu(ICON_FA_MICROCHIP " Hardware decoding")) - { - bool hwdec = !mediaplayer_active_->softwareDecodingForced(); - if (ImGui::MenuItem("Auto", "", &hwdec )) - mediaplayer_active_->setSoftwareDecodingForced(false); - hwdec = mediaplayer_active_->softwareDecodingForced(); - if (ImGui::MenuItem("Disabled", "", &hwdec )) - mediaplayer_active_->setSoftwareDecodingForced(true); - ImGui::EndMenu(); - } + bool hwdec = !mediaplayer_active_->softwareDecodingForced(); + if (ImGui::MenuItem("Auto", "", &hwdec )) + mediaplayer_active_->setSoftwareDecodingForced(false); + hwdec = mediaplayer_active_->softwareDecodingForced(); + if (ImGui::MenuItem("Disabled", "", &hwdec )) + mediaplayer_active_->setSoftwareDecodingForced(true); + ImGui::EndMenu(); } + ImGui::EndMenu(); } @@ -4390,7 +4389,7 @@ void SourceController::RenderMediaPlayer(MediaSource *ms) ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x - buttons_height_ ); // speed slider float speed = static_cast(mediaplayer_active_->playSpeed()); - if (ImGui::DragFloat( "##Speed", &speed, 0.01f, -10.f, 10.f, UNICODE_MULTIPLY " %.1f", 2.f)) + if (ImGui::DragFloat( "##Speed", &speed, 0.01f, -10.f, 10.f, UNICODE_MULTIPLY " %.2f", 2.f)) mediaplayer_active_->setPlaySpeed( static_cast(speed) ); // store action on mouse release if (ImGui::IsItemDeactivatedAfterEdit()){ @@ -5832,7 +5831,7 @@ void InputMappingInterface::SliderParametersCallback(SourceCallback *callback, c float val = edited->value(); ImGui::SetNextItemWidth(right_align); ImGui::SameLine(0, IMGUI_SAME_LINE / 2); - if (ImGui::SliderFloat("##CALLBACK_PLAYSPEED", &val, 0.1f, 20.f, "x %.1f")) + if (ImGui::SliderFloat("##CALLBACK_PLAYSPEED", &val, -10.f, 10.f, UNICODE_MULTIPLY " %.2f")) edited->setValue(val); ImGui::SameLine(0, IMGUI_SAME_LINE / 2); diff --git a/src/snippets.cpp b/src/snippets.cpp index ad726b1..a4d8374 100644 --- a/src/snippets.cpp +++ b/src/snippets.cpp @@ -256,7 +256,7 @@ void drawMediaPlayer() ImGui::SameLine(0, spacing); ImGui::SetNextItemWidth(270); // ImGui::SetNextItemWidth(width - 90.0); - if (ImGui::SliderFloat( "Speed", &speed, -10.f, 10.f, "x %.1f", 2.f)) + if (ImGui::SliderFloat( "Speed", &speed, -10.f, 10.f, "x %.2f", 2.f)) testmedia.setPlaySpeed( static_cast(speed) ); ImGui::SameLine(0, spacing); if (ImGuiToolkit::ButtonIcon(19, 15)) {