Window size flicker issue fix when changing files

This commit is contained in:
Frank Skare
2021-09-23 19:46:38 +02:00
parent 38a816a255
commit 819b026ec7
4 changed files with 16 additions and 13 deletions

View File

@@ -1,6 +1,9 @@
5.5.0.4 Beta (202?-??-??) 5.5.0.4 Beta (202?-??-??)
- Window size flicker issue fix when changing files.
5.5.0.3 Beta (2021-09-23) 5.5.0.3 Beta (2021-09-23)
- New mpv.net option auto-play which sets pause=no on file load and - New mpv.net option auto-play which sets pause=no on file load and

View File

@@ -94,7 +94,7 @@ namespace mpvnet
public string ConfPath { get => ConfigFolder + "mpv.conf"; } public string ConfPath { get => ConfigFolder + "mpv.conf"; }
public string GPUAPI { get; set; } = "auto"; public string GPUAPI { get; set; } = "auto";
public string InputConfPath { get => ConfigFolder + "input.conf"; } public string InputConfPath { get => ConfigFolder + "input.conf"; }
public string VID { get; set; } = ""; public string VID { get; set; } = "";
public string AID { get; set; } = ""; public string AID { get; set; } = "";
public string SID { get; set; } = ""; public string SID { get; set; } = "";
@@ -324,16 +324,17 @@ namespace mpvnet
{ {
Size size = new Size(GetPropertyInt(w), GetPropertyInt(h)); Size size = new Size(GetPropertyInt(w), GetPropertyInt(h));
if (size.Width == 0 || size.Height == 0)
return;
if (VideoRotate == 90 || VideoRotate == 270) if (VideoRotate == 90 || VideoRotate == 270)
size = new Size(size.Height, size.Width); size = new Size(size.Height, size.Width);
if (size.Width == 0 || size.Height == 0)
size = new Size(16, 9);
if (VideoSize != size) if (VideoSize != size)
{ {
VideoSize = size; VideoSize = size;
InvokeEvent(VideoSizeChanged, VideoSizeChangedAsync); InvokeEvent(VideoSizeChanged, VideoSizeChangedAsync);
VideoSizeAutoResetEvent.Set();
} }
} }
@@ -425,15 +426,17 @@ namespace mpvnet
if (App.StartSize == "video") if (App.StartSize == "video")
WasInitialSizeSet = false; WasInitialSizeSet = false;
UpdateVideoSize("width", "height"); string path = GetPropertyString("path");
VideoSizeAutoResetEvent.Set(); if (!VideoTypes.Contains(path.Ext()) || AudioTypes.Contains(path.Ext()))
{
UpdateVideoSize("width", "height");
VideoSizeAutoResetEvent.Set();
}
App.RunTask(new Action(() => ReadMetaData())); App.RunTask(new Action(() => ReadMetaData()));
App.RunTask(new Action(() => { App.RunTask(new Action(() => {
string path = GetPropertyString("path");
if (path.Contains("://")) if (path.Contains("://"))
path = GetPropertyString("media-title"); path = GetPropertyString("media-title");

View File

@@ -68,7 +68,7 @@ public static class ConvertStringExtension
public static class PathStringExtension public static class PathStringExtension
{ {
// return extension with lower case and without dot. // returns the extension with lower case and without preceding dot.
public static string Ext(this string instance) public static string Ext(this string instance)
{ {
if (instance == null) if (instance == null)

View File

@@ -1000,10 +1000,7 @@ namespace mpvnet
protected override void OnLoad(EventArgs e) protected override void OnLoad(EventArgs e)
{ {
base.OnLoad(e); base.OnLoad(e);
Core.VideoSizeAutoResetEvent.WaitOne(App.StartThreshold);
if (Core.GPUAPI != "vulkan")
Core.VideoSizeAutoResetEvent.WaitOne(App.StartThreshold);
LastCycleFullscreen = Environment.TickCount; LastCycleFullscreen = Environment.TickCount;
SetFormPosAndSize(); SetFormPosAndSize();
} }