From 198751b6e25fd7018778b3e18a4e77e6fffc4868 Mon Sep 17 00:00:00 2001 From: "Andrew J.Swan" Date: Thu, 13 Jun 2024 00:02:16 +0300 Subject: [PATCH] MP1-5220: Change the VideorRenderer without leaving MediaPortal --- .../MediaPortal.Base/language/strings_en.xml | 9 +- .../MediaPortal.Base/language/strings_fr.xml | 8 +- .../MyVideos/GUISettingsMyVideos.cs | 139 ++++++++++++++++-- 3 files changed, 142 insertions(+), 14 deletions(-) diff --git a/mediaportal/MediaPortal.Base/language/strings_en.xml b/mediaportal/MediaPortal.Base/language/strings_en.xml index 55181857c98..3f2e5931a07 100644 --- a/mediaportal/MediaPortal.Base/language/strings_en.xml +++ b/mediaportal/MediaPortal.Base/language/strings_en.xml @@ -2208,9 +2208,6 @@ Video Stream Pixel Shaders Select Pixel Shader - Create new profile - Edit current profile - Remove current profile Use pixel ratio correction Correction mode Display mode @@ -2442,6 +2439,12 @@ OSD Settings Show OSD Auto Hide OSD + Renderer + VMR9 + EVR + MadVR + A video file is playing + Do you want to stop video playback? Press Info/F9 for quick settings... Movies PlayDisc diff --git a/mediaportal/MediaPortal.Base/language/strings_fr.xml b/mediaportal/MediaPortal.Base/language/strings_fr.xml index 74bfac1e67f..492c8f3f1ba 100644 --- a/mediaportal/MediaPortal.Base/language/strings_fr.xml +++ b/mediaportal/MediaPortal.Base/language/strings_fr.xml @@ -2431,10 +2431,16 @@ Réduire en icône lorsque MP n'est plus au premier plan Arrêter la lecture lors d'une modification du rendu audio Réduction du taux de rafraichissement lorsque MP n'est plus au premier plan + Mettre à jour les fichiers uniquement après {0} Réglages OSD Voir OSD Cache OSD Auto - Mettre à jour les fichiers uniquement après {0} + Renderer + VMR9 + EVR + MadVR + Un fichier video est en cours de lecture + Voulez-vous arrêter la lecture video ? Appuyez sur Info/F9 pour les réglages rapides... Films Lecteur de Disque diff --git a/mediaportal/WindowPlugins/GUISettings/MyVideos/GUISettingsMyVideos.cs b/mediaportal/WindowPlugins/GUISettings/MyVideos/GUISettingsMyVideos.cs index 1aa73bd8b41..257e5b055fb 100644 --- a/mediaportal/WindowPlugins/GUISettings/MyVideos/GUISettingsMyVideos.cs +++ b/mediaportal/WindowPlugins/GUISettings/MyVideos/GUISettingsMyVideos.cs @@ -29,8 +29,11 @@ using MediaPortal.GUI.Settings; using MediaPortal.Profile; using MediaPortal.Util; -using Action = MediaPortal.GUI.Library.Action; - +using Action = MediaPortal.GUI.Library.Action; +// start fmu +using MediaPortal.Player; +// end fmu + namespace WindowPlugins.GUISettings.TV { /// @@ -41,9 +44,12 @@ public class GUISettingsMovies : GUIInternalWindow [SkinControl(24)] protected GUIButtonControl btnVideo = null; [SkinControl(25)] protected GUIButtonControl btnAudio = null; [SkinControl(31)] protected GUICheckButton btnEnableSubtitles = null; - [SkinControl(34)] protected GUIButtonControl btnPlayall = null; + [SkinControl(34)] protected GUIButtonControl btnPlayall = null; [SkinControl(35)] protected GUIButtonControl btnExtensions = null; - [SkinControl(40)] protected GUIButtonControl btnFolders = null; + // start fmu + [SkinControl(36)] protected GUIButtonControl btnRenderer = null; + // end fmu + [SkinControl(40)] protected GUIButtonControl btnFolders = null; [SkinControl(41)] protected GUIButtonControl btnDatabase= null; [SkinControl(42)] protected GUIButtonControl btnPlaylist= null; [SkinControl(43)] protected GUIButtonControl btnOtherSettings = null; @@ -77,9 +83,13 @@ public class GUISettingsMovies : GUIInternalWindow private bool _ForceSourceSplitter; private bool _mpCheckBoxTS; private bool _audioDefaultCheckBox; - private bool _streamLAVSelectionCheckBox; - - + private bool _streamLAVSelectionCheckBox; + // start fmu + private bool _isEVR; + private bool _isMadVR; + private int _renderer; + // end fmu + private class CultureComparer : IComparer { #region IComparer Members @@ -154,7 +164,26 @@ private void LoadSettings() btnUseSstreamLAVSelection.IsEnabled = false; btnUseAudioDefaultCheckBox.Selected = false; btnUseSstreamLAVSelection.Selected = false; - } + } + // start fmu + _isEVR = xmlreader.GetValueAsBool("general", "useEVRenderer", false); + _isMadVR = xmlreader.GetValueAsBool("general", "useMadVideoRenderer", false); + if (_isEVR) + { + _renderer = 1; + } + else + { + if (_isMadVR) + { + _renderer = 2; + } + else + { + _renderer = 0; + } + } + // end fmu } } @@ -191,7 +220,24 @@ private void SaveSettings() } xmlwriter.SetValueAsBool("subtitles", "enabled", btnEnableSubtitles.Selected); - xmlwriter.SetValue("movies", "playallinfolder", _playAll); + xmlwriter.SetValue("movies", "playallinfolder", _playAll); + // start fmu + switch (_renderer) + { + case 0: + xmlwriter.SetValueAsBool("general", "useEVRenderer", false); + xmlwriter.SetValueAsBool("general", "useMadVideoRenderer", false); + break; + case 1: + xmlwriter.SetValueAsBool("general", "useEVRenderer", true); + xmlwriter.SetValueAsBool("general", "useMadVideoRenderer", false); + break; + case 2: + xmlwriter.SetValueAsBool("general", "useEVRenderer", false); + xmlwriter.SetValueAsBool("general", "useMadVideoRenderer", true); + break; + } + // end fmu } } @@ -241,7 +287,39 @@ protected override void OnClicked(int controlId, GUIControl control, Action.Acti if (control == btnPlayall) { OnPlayAllVideos(); - } + } + // start fmu + if (control == btnRenderer) + { + if (g_Player.Playing && g_Player.HasVideo) + { + GUIDialogYesNo dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_YES_NO); + if (null == dlgYesNo) + { + return; + } + dlgYesNo.SetHeading(100102); // Play-Stop dialog + dlgYesNo.SetLine(1, 300240); // A video file is playing + dlgYesNo.SetLine(2, 300241); // Do you want to stop video playback? + dlgYesNo.SetLine(3, ""); + dlgYesNo.DoModal(GetID); + + if (!dlgYesNo.IsConfirmed) + { + return; + } + else + { + g_Player.Stop(); + OnRenderer(); + } + } + else + { + OnRenderer(); + } + } + // end fmu if (control == btnExtensions) { OnExtensions(); @@ -1057,7 +1135,48 @@ private void OnPlayAllVideos() _playAll = dlg.SelectedLabel; } + + // start fmu + private void OnRenderer() + { + GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); + if (dlg == null) + { + return; + } + dlg.Reset(); + dlg.SetHeading(300236); // Renderer + + dlg.AddLocalizedString(300237); // VMR9 + dlg.AddLocalizedString(300238); // EVR + dlg.AddLocalizedString(300239); // MadVR + + dlg.SelectedLabel = _renderer; + + dlg.DoModal(GetID); + + if (dlg.SelectedId == -1) + { + return; + } + _renderer = dlg.SelectedLabel; + + switch (_renderer) + { + case 0: + GUIGraphicsContext.VideoRenderer = GUIGraphicsContext.VideoRendererType.VMR9; + break; + case 1: + GUIGraphicsContext.VideoRenderer = GUIGraphicsContext.VideoRendererType.EVR; + break; + case 2: + GUIGraphicsContext.VideoRenderer = GUIGraphicsContext.VideoRendererType.madVR; + break; + } + } + // end fmu + private void OnExtensions() { GUISettingsExtensions dlg = (GUISettingsExtensions)GUIWindowManager.GetWindow((int)Window.WINDOW_SETTINGS_EXTENSIONS);