#245 Video rotation support added
This commit is contained in:
@@ -1,26 +1,27 @@
|
|||||||
|
|
||||||
5.4.8.9 Beta (2021-??-??)
|
5.4.9.0 Beta (2021-05-??)
|
||||||
=========================
|
=========================
|
||||||
|
|
||||||
- There is an issue with the `window-scale` mpv property, it does not
|
- `window-scale 1` does not work correctly in mpv,
|
||||||
work correctly in mpv either, so I've removed support for it and
|
so I've removed support for it and added my own implementation
|
||||||
added my own implementation `script-message mpv.net window-scale`.
|
that actually works: `script-message mpv.net window-scale`.
|
||||||
- The CS-Script library was replaced with my own C# scripting implementation.
|
- The CS-Script library was replaced with my own C# scripting implementation.
|
||||||
- If a player window border is near to a screen border and the window size
|
- If a player window border is near to a screen border and the window size
|
||||||
changes, the player windows sticks to that near screen border location.
|
changes, the player windows sticks to that near screen border location.
|
||||||
Furthermore the `remember-window-position` option remembers a near screen
|
Furthermore the `remember-window-position` option remembers a near screen
|
||||||
border position instead of remembering the window center position.
|
border position instead of remembering the window center position.
|
||||||
- High DPI multi monitor fix.
|
- Multi monitor fix using different DPI values.
|
||||||
- `start-size` option has new options, see config editor and manual.
|
- `start-size` option has new options, see config editor and manual.
|
||||||
- Improved `script-message mpv.net cycle-audio` OSD info.
|
- Improved `script-message mpv.net cycle-audio` OSD info.
|
||||||
- The logic for finding the config directory has changed, see manual.
|
- The logic for finding the config directory has changed, see manual.
|
||||||
- The dotnet script and extension host was redesigned, existing scripts
|
- The dotnet script and extension host was a little redesigned, this breaks
|
||||||
and extensions must be fixed. All example scripts were updated and
|
backward compatibility unfortunately, but I can help fixing existing
|
||||||
a new script delete-current-file.cs was added.
|
open source code however. Example scripts and extensions were updated.
|
||||||
- Fix console not working due to incorrect mpv.conf value generated
|
- Fix console not working due to incorrect mpv.conf value generated
|
||||||
(script-opts=console-scale=0).
|
(script-opts=console-scale=0).
|
||||||
- Registry usage is not portable and also not popular, so settings
|
- Registry usage is not portable and also not popular, so settings
|
||||||
are stored in the file settings.xml now instead of the Registry.
|
are stored in the file settings.xml now instead of the Registry.
|
||||||
|
- Video rotation support added.
|
||||||
|
|
||||||
|
|
||||||
5.4.8.8 Beta (2021-05-09)
|
5.4.8.8 Beta (2021-05-09)
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ namespace mpvnet
|
|||||||
|
|
||||||
public int Screen { get; set; } = -1;
|
public int Screen { get; set; } = -1;
|
||||||
public int Edition { get; set; }
|
public int Edition { get; set; }
|
||||||
public int PropertyChangedID;
|
public int VideoRotate { get; set; }
|
||||||
|
|
||||||
public float Autofit { get; set; } = 0.6f;
|
public float Autofit { get; set; } = 0.6f;
|
||||||
public float AutofitSmaller { get; set; } = 0.3f;
|
public float AutofitSmaller { get; set; } = 0.3f;
|
||||||
@@ -146,6 +146,11 @@ namespace mpvnet
|
|||||||
if (err < 0)
|
if (err < 0)
|
||||||
throw new Exception("mpv_initialize error\n\n" + GetError(err));
|
throw new Exception("mpv_initialize error\n\n" + GetError(err));
|
||||||
|
|
||||||
|
err = mpv_observe_property(Handle, 0, "video-rotate", mpv_format.MPV_FORMAT_INT64);
|
||||||
|
|
||||||
|
if (err < 0)
|
||||||
|
throw new Exception("mpv_observe_property video-rotate error\n\n" + GetError(err));
|
||||||
|
|
||||||
Initialized?.Invoke();
|
Initialized?.Invoke();
|
||||||
InvokeAsync(InitializedAsync);
|
InvokeAsync(InitializedAsync);
|
||||||
}
|
}
|
||||||
@@ -316,6 +321,23 @@ namespace mpvnet
|
|||||||
ps.Invoke();
|
ps.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UpdateVideoSize(string w, string h)
|
||||||
|
{
|
||||||
|
Size size = new Size(get_property_int(w), get_property_int(h));
|
||||||
|
|
||||||
|
if (VideoRotate == 90 || VideoRotate == 270)
|
||||||
|
size = new Size(size.Height, size.Width);
|
||||||
|
|
||||||
|
if (size.Width == 0 || size.Height == 0)
|
||||||
|
size = new Size(1, 1);
|
||||||
|
|
||||||
|
if (VideoSize != size)
|
||||||
|
{
|
||||||
|
VideoSize = size;
|
||||||
|
InvokeEvent(VideoSizeChanged, VideoSizeChangedAsync);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void EventLoop()
|
public void EventLoop()
|
||||||
{
|
{
|
||||||
while (true)
|
while (true)
|
||||||
@@ -326,7 +348,7 @@ namespace mpvnet
|
|||||||
if (WindowHandle == IntPtr.Zero)
|
if (WindowHandle == IntPtr.Zero)
|
||||||
WindowHandle = Native.FindWindowEx(MainForm.Hwnd, IntPtr.Zero, "mpv", null);
|
WindowHandle = Native.FindWindowEx(MainForm.Hwnd, IntPtr.Zero, "mpv", null);
|
||||||
|
|
||||||
//Debug.WriteLine(evt.event_id.ToString());
|
//System.Diagnostics.Debug.WriteLine(evt.event_id.ToString());
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -366,28 +388,19 @@ namespace mpvnet
|
|||||||
if (args.Length > 1 && args[0] == "mpv.net")
|
if (args.Length > 1 && args[0] == "mpv.net")
|
||||||
App.RunTask(() => Commands.Execute(args[1], args.Skip(2).ToArray()));
|
App.RunTask(() => Commands.Execute(args[1], args.Skip(2).ToArray()));
|
||||||
|
|
||||||
InvokeAsync<string[]>(ClientMessageAsync, args);
|
InvokeAsync(ClientMessageAsync, args);
|
||||||
ClientMessage?.Invoke(args);
|
ClientMessage?.Invoke(args);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case mpv_event_id.MPV_EVENT_VIDEO_RECONFIG:
|
case mpv_event_id.MPV_EVENT_VIDEO_RECONFIG:
|
||||||
{
|
UpdateVideoSize("dwidth", "dheight");
|
||||||
Size size = new Size(get_property_int("dwidth"), get_property_int("dheight"));
|
|
||||||
|
|
||||||
if (size.Width != 0 && size.Height != 0 && VideoSize != size)
|
|
||||||
{
|
|
||||||
VideoSize = size;
|
|
||||||
InvokeEvent(VideoSizeChanged, VideoSizeChangedAsync);
|
|
||||||
}
|
|
||||||
|
|
||||||
InvokeEvent(VideoReconfig, VideoReconfigAsync);
|
InvokeEvent(VideoReconfig, VideoReconfigAsync);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case mpv_event_id.MPV_EVENT_END_FILE:
|
case mpv_event_id.MPV_EVENT_END_FILE:
|
||||||
{
|
{
|
||||||
var data = (mpv_event_end_file)Marshal.PtrToStructure(evt.data, typeof(mpv_event_end_file));
|
var data = (mpv_event_end_file)Marshal.PtrToStructure(evt.data, typeof(mpv_event_end_file));
|
||||||
var reason = (mpv_end_file_reason)data.reason;
|
var reason = (mpv_end_file_reason)data.reason;
|
||||||
InvokeAsync<mpv_end_file_reason>(EndFileAsync, reason);
|
InvokeAsync(EndFileAsync, reason);
|
||||||
EndFile?.Invoke(reason);
|
EndFile?.Invoke(reason);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -399,16 +412,7 @@ namespace mpvnet
|
|||||||
if (App.StartSize == "video")
|
if (App.StartSize == "video")
|
||||||
Core.WasInitialSizeSet = false;
|
Core.WasInitialSizeSet = false;
|
||||||
|
|
||||||
Size size = new Size(get_property_int("width"), get_property_int("height"));
|
UpdateVideoSize("width", "height");
|
||||||
|
|
||||||
if (size.Width == 0 || size.Height == 0)
|
|
||||||
size = new Size(1, 1);
|
|
||||||
|
|
||||||
if (VideoSize != size)
|
|
||||||
{
|
|
||||||
VideoSize = size;
|
|
||||||
InvokeEvent(VideoSizeChanged, VideoSizeChangedAsync);
|
|
||||||
}
|
|
||||||
|
|
||||||
VideoSizeAutoResetEvent.Set();
|
VideoSizeAutoResetEvent.Set();
|
||||||
|
|
||||||
@@ -429,7 +433,6 @@ namespace mpvnet
|
|||||||
case mpv_event_id.MPV_EVENT_PROPERTY_CHANGE:
|
case mpv_event_id.MPV_EVENT_PROPERTY_CHANGE:
|
||||||
{
|
{
|
||||||
var data = (mpv_event_property)Marshal.PtrToStructure(evt.data, typeof(mpv_event_property));
|
var data = (mpv_event_property)Marshal.PtrToStructure(evt.data, typeof(mpv_event_property));
|
||||||
//Debug.WriteLine(data.name);
|
|
||||||
|
|
||||||
if (data.format == mpv_format.MPV_FORMAT_FLAG)
|
if (data.format == mpv_format.MPV_FORMAT_FLAG)
|
||||||
{
|
{
|
||||||
@@ -457,6 +460,12 @@ namespace mpvnet
|
|||||||
}
|
}
|
||||||
else if (data.format == mpv_format.MPV_FORMAT_INT64)
|
else if (data.format == mpv_format.MPV_FORMAT_INT64)
|
||||||
{
|
{
|
||||||
|
if (data.name == "video-rotate")
|
||||||
|
{
|
||||||
|
VideoRotate = Marshal.PtrToStructure<int>(data.data);
|
||||||
|
UpdateVideoSize("dwidth", "dheight");
|
||||||
|
}
|
||||||
|
|
||||||
lock (IntPropChangeActions)
|
lock (IntPropChangeActions)
|
||||||
foreach (var pair in IntPropChangeActions)
|
foreach (var pair in IntPropChangeActions)
|
||||||
if (pair.Key == data.name)
|
if (pair.Key == data.name)
|
||||||
|
|||||||
@@ -144,6 +144,7 @@
|
|||||||
t script-binding stats/display-stats #menu: View > Show Statistics
|
t script-binding stats/display-stats #menu: View > Show Statistics
|
||||||
T script-binding stats/display-stats-toggle #menu: View > Toggle Statistics
|
T script-binding stats/display-stats-toggle #menu: View > Toggle Statistics
|
||||||
Del script-binding osc/visibility #menu: View > Toggle OSC Visibility
|
Del script-binding osc/visibility #menu: View > Toggle OSC Visibility
|
||||||
|
Ctrl+r cycle-values video-rotate 90 180 270 0 #menu: View > Rotate Video
|
||||||
_ script-message mpv.net show-audio-devices #menu: View > Show Audio Devices
|
_ script-message mpv.net show-audio-devices #menu: View > Show Audio Devices
|
||||||
Shift+c script-message mpv.net show-commands #menu: View > Show Commands
|
Shift+c script-message mpv.net show-commands #menu: View > Show Commands
|
||||||
` script-binding console/enable #menu: View > Show Console
|
` script-binding console/enable #menu: View > Show Console
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ namespace mpvnet
|
|||||||
|
|
||||||
Core.observe_property("window-maximized", PropChangeWindowMaximized);
|
Core.observe_property("window-maximized", PropChangeWindowMaximized);
|
||||||
Core.observe_property("window-minimized", PropChangeWindowMinimized);
|
Core.observe_property("window-minimized", PropChangeWindowMinimized);
|
||||||
|
|
||||||
Core.observe_property_bool("pause", PropChangePause);
|
Core.observe_property_bool("pause", PropChangePause);
|
||||||
Core.observe_property_bool("fullscreen", PropChangeFullscreen);
|
Core.observe_property_bool("fullscreen", PropChangeFullscreen);
|
||||||
Core.observe_property_bool("ontop", PropChangeOnTop);
|
Core.observe_property_bool("ontop", PropChangeOnTop);
|
||||||
@@ -811,7 +812,7 @@ namespace mpvnet
|
|||||||
{
|
{
|
||||||
if (CursorHelp.IsPosDifferent(LastCursorPosition))
|
if (CursorHelp.IsPosDifferent(LastCursorPosition))
|
||||||
{
|
{
|
||||||
LastCursorPosition = Control.MousePosition;
|
LastCursorPosition = MousePosition;
|
||||||
LastCursorChanged = Environment.TickCount;
|
LastCursorChanged = Environment.TickCount;
|
||||||
}
|
}
|
||||||
else if (Environment.TickCount - LastCursorChanged > 1500 &&
|
else if (Environment.TickCount - LastCursorChanged > 1500 &&
|
||||||
|
|||||||
Reference in New Issue
Block a user