new option minimum-aspect-ratio-audio

This commit is contained in:
stax76
2022-06-19 18:06:08 +02:00
parent f6ad169f9d
commit a148c88435
5 changed files with 26 additions and 11 deletions

View File

@@ -2,10 +2,11 @@
# 6.0.0.1 Beta (not yet released) # 6.0.0.1 Beta (not yet released)
- New tutorial: [Extending mpv and mpv.net via Lua scripting](https://github.com/stax76/mpv.net/wiki/Extending-mpv-and-mpv.net-via-Lua-scripting) - New tutorial: [Extending mpv and mpv.net via Lua scripting](https://github.com/stax76/mpv.net/wiki/Extending-mpv-and-mpv.net-via-Lua-scripting)
- New options `autofit-image` and `autofit-audio`, like autofit but used for image and audio files. Default 80. - New options `autofit-image` and `autofit-audio`, like autofit but used for image and audio files.
- New [auto-mode](https://github.com/stax76/mpv-scripts) script to use mpv and mpv.net as image viewer and audio player. - New [auto-mode](https://github.com/stax76/mpv-scripts) script to use mpv and mpv.net as image viewer and audio player.
- New support of the mpv option `snap-window`. - New support of the mpv option `snap-window`.
- New feature to show chapters in the command palette, see binding and menu definition below. - New feature to show chapters in the command palette, see binding and menu definition below.
- New option minimum-aspect-ratio-audio, same as minimum-aspect-ratio but used for audio files.
- Fix long commands causing key bindings not visible in the command palette. - Fix long commands causing key bindings not visible in the command palette.
- Fix script compatibility with mordenx and mpv-osc-tethys. - Fix script compatibility with mordenx and mpv-osc-tethys.
- Fix borderless window not resizable with mouse. - Fix borderless window not resizable with mouse.

View File

@@ -388,7 +388,7 @@ mpv.net specific options can be found in the conf editor searching for 'mpv.net'
The options are saved in the mpvnet.conf file. The options are saved in the mpvnet.conf file.
#### --autofit-audio \<integer\> #### --autofit-audio \<integer\>
Initial window height in percent for audio files. Default: 80 Initial window height in percent for audio files. Default: 70
#### --autofit-image \<integer\> #### --autofit-image \<integer\>
Initial window height in percent for image files. Default: 80 Initial window height in percent for image files. Default: 80
@@ -439,9 +439,12 @@ Window size is always remembered.
#### --minimum-aspect-ratio=\<float\> #### --minimum-aspect-ratio=\<float\>
Minimum aspect ratio, if the AR is smaller than the defined value then Minimum aspect ratio of the window. Useful to force
the window AR is set to 16/9. This avoids a square window for Music a wider window and therefore a larger OSC.
with cover art. Default: 0
#### --minimum-aspect-ratio-audio=\<float\>
Same as minimum-aspect-ratio but used for audio files.
#### --remember-window-position=\<yes|no\> #### --remember-window-position=\<yes|no\>

View File

@@ -36,9 +36,10 @@ namespace mpvnet
public static int StartThreshold { get; set; } = 1500; public static int StartThreshold { get; set; } = 1500;
public static int RecentCount { get; set; } = 15; public static int RecentCount { get; set; } = 15;
public static float AutofitAudio { get; set; } = 0.8f; public static float AutofitAudio { get; set; } = 0.7f;
public static float AutofitImage { get; set; } = 0.8f; public static float AutofitImage { get; set; } = 0.8f;
public static float MinimumAspectRatio { get; set; } public static float MinimumAspectRatio { get; set; }
public static float MinimumAspectRatioAudio { get; set; }
public static float QuickBookmark { get; set; } public static float QuickBookmark { get; set; }
public static Extension Extension { get; set; } public static Extension Extension { get; set; }
@@ -252,6 +253,7 @@ namespace mpvnet
case "light-theme": LightTheme = value.Trim('\'', '"'); return true; case "light-theme": LightTheme = value.Trim('\'', '"'); return true;
case "media-info": MediaInfo = value == "yes"; return true; case "media-info": MediaInfo = value == "yes"; return true;
case "minimum-aspect-ratio": MinimumAspectRatio = value.ToFloat(); return true; case "minimum-aspect-ratio": MinimumAspectRatio = value.ToFloat(); return true;
case "minimum-aspect-ratio-audio": MinimumAspectRatioAudio = value.ToFloat(); return true;
case "process-instance": ProcessInstance = value; return true; case "process-instance": ProcessInstance = value; return true;
case "queue": Queue = value == "yes"; return true; case "queue": Queue = value == "yes"; return true;
case "recent-count": RecentCount = value.ToInt(); return true; case "recent-count": RecentCount = value.ToInt(); return true;

View File

@@ -420,7 +420,7 @@ help = <int> Initial window height in percent for image files. Default: 80
name = autofit-audio name = autofit-audio
file = mpvnet file = mpvnet
filter = Screen filter = Screen
help = <int> Initial window height in percent for audio files. Default: 80 help = <int> Initial window height in percent for audio files. Default: 70
[setting] [setting]
name = autofit-smaller name = autofit-smaller
@@ -463,7 +463,13 @@ option = no
name = minimum-aspect-ratio name = minimum-aspect-ratio
file = mpvnet file = mpvnet
filter = Screen filter = Screen
help = <float> Minimum aspect ratio, if the AR is smaller than the defined value then the window AR is set to 16/9. This avoids a square window for Music with cover art. Default: 0 (mpv.net specific option) help = <float> Minimum aspect ratio of the window. Useful to force a wider window and therefore a larger OSC. (mpv.net specific option)
[setting]
name = minimum-aspect-ratio-audio
file = mpvnet
filter = Screen
help = Same as minimum-aspect-ratio but used for audio files.
[setting] [setting]
name = remember-window-position name = remember-window-position

View File

@@ -437,11 +437,14 @@ namespace mpvnet
if (Core.IsAudio) autoFitHeight = Convert.ToInt32(workingArea.Height * App.AutofitAudio); if (Core.IsAudio) autoFitHeight = Convert.ToInt32(workingArea.Height * App.AutofitAudio);
if (Core.IsImage) autoFitHeight = Convert.ToInt32(workingArea.Height * App.AutofitImage); if (Core.IsImage) autoFitHeight = Convert.ToInt32(workingArea.Height * App.AutofitImage);
if (Core.VideoSize.Height == 0 || Core.VideoSize.Width == 0 || if (Core.VideoSize.Height == 0 || Core.VideoSize.Width == 0)
Core.VideoSize.Width / (float)Core.VideoSize.Height < App.MinimumAspectRatio)
Core.VideoSize = new Size((int)(autoFitHeight * (16 / 9f)), autoFitHeight); Core.VideoSize = new Size((int)(autoFitHeight * (16 / 9f)), autoFitHeight);
float minAspectRatio = Core.IsAudio ? App.MinimumAspectRatioAudio : App.MinimumAspectRatio;
if (minAspectRatio != 0 && Core.VideoSize.Width / (float)Core.VideoSize.Height < minAspectRatio)
Core.VideoSize = new Size((int)(autoFitHeight * minAspectRatio), autoFitHeight);
Size videoSize = Core.VideoSize; Size videoSize = Core.VideoSize;
int height = videoSize.Height; int height = videoSize.Height;