Skip to content

Commit

Permalink
MP1-5220: Change the VideorRenderer without leaving MediaPortal
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewjswan committed Jun 12, 2024
1 parent 5ea5fec commit 198751b
Show file tree
Hide file tree
Showing 3 changed files with 142 additions and 14 deletions.
9 changes: 6 additions & 3 deletions mediaportal/MediaPortal.Base/language/strings_en.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2208,9 +2208,6 @@
<String id="200095">Video Stream</String>
<String id="200096">Pixel Shaders</String>
<String id="200097">Select Pixel Shader</String>
<String id="200098">Create new profile</String>
<String id="200099">Edit current profile</String>
<String id="200100">Remove current profile</String>
<String id="300000">Use pixel ratio correction</String>
<String id="300001">Correction mode</String>
<String id="300002">Display mode</String>
Expand Down Expand Up @@ -2442,6 +2439,12 @@
<String id="300233">OSD Settings</String>
<String id="300234">Show OSD</String>
<String id="300235">Auto Hide OSD</String>
<String id="300236">Renderer</String>
<String id="300237">VMR9</String>
<String id="300238">EVR</String>
<String id="300239">MadVR</String>
<String id="300240">A video file is playing</String>
<String id="300241">Do you want to stop video playback?</String>
<String id="350001">Press Info/F9 for quick settings...</String>
<String id="350002">Movies</String>
<String id="350003">PlayDisc</String>
Expand Down
8 changes: 7 additions & 1 deletion mediaportal/MediaPortal.Base/language/strings_fr.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2431,10 +2431,16 @@
<String id="300229">Réduire en icône lorsque MP n'est plus au premier plan</String>
<String id="300230">Arrêter la lecture lors d'une modification du rendu audio</String>
<String id="300231">Réduction du taux de rafraichissement lorsque MP n'est plus au premier plan</String>
<String id="300232">Mettre à jour les fichiers uniquement après {0}</String>
<String id="300233">Réglages OSD</String>
<String id="300234">Voir OSD</String>
<String id="300235">Cache OSD Auto</String>
<String id="300232">Mettre à jour les fichiers uniquement après {0}</String>
<String id="300236">Renderer</String>
<String id="300237">VMR9</String>
<String id="300238">EVR</String>
<String id="300239">MadVR</String>
<String id="300240">Un fichier video est en cours de lecture</String>
<String id="300241">Voulez-vous arrêter la lecture video ?</String>
<String id="350001">Appuyez sur Info/F9 pour les réglages rapides...</String>
<String id="350002">Films</String>
<String id="350003">Lecteur de Disque</String>
Expand Down
139 changes: 129 additions & 10 deletions mediaportal/WindowPlugins/GUISettings/MyVideos/GUISettingsMyVideos.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
/// <summary>
Expand All @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
}
}

Expand Down Expand Up @@ -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
}
}

Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 198751b

Please sign in to comment.