Commit 426bc0dc authored by Martin Finkel's avatar Martin Finkel

Fix libvlc event interop struct layout

#43
parent 2e8b978c
......@@ -62,27 +62,27 @@ namespace LibVLCSharp.Shared
[MonoPInvokeCallback(typeof(EventCallback))]
static void OnItemDeleted(IntPtr args)
{
var rendererItem = RetrieveEvent(args).RendererItem;
_itemDeleted?.Invoke(null, new RendererDiscovererItemDeletedEventArgs(new RendererItem(rendererItem)));
var rendererItem = RetrieveEvent(args).Union.RendererDiscovererItemDeleted;
_itemDeleted?.Invoke(null, new RendererDiscovererItemDeletedEventArgs(new RendererItem(rendererItem.item)));
}
[MonoPInvokeCallback(typeof(EventCallback))]
static void OnItemAdded(IntPtr args)
{
var rendererItem = RetrieveEvent(args).RendererItem;
_itemAdded?.Invoke(null, new RendererDiscovererItemAddedEventArgs(new RendererItem(rendererItem)));
var rendererItem = RetrieveEvent(args).Union.RendererDiscovererItemAdded;
_itemAdded?.Invoke(null, new RendererDiscovererItemAddedEventArgs(new RendererItem(rendererItem.item)));
}
#else
void OnItemDeleted(IntPtr args)
{
var rendererItem = RetrieveEvent(args).RendererItem;
_itemDeleted?.Invoke(this, new RendererDiscovererItemDeletedEventArgs(new RendererItem(rendererItem)));
var rendererItem = RetrieveEvent(args).Union.RendererDiscovererItemDeleted;
_itemDeleted?.Invoke(this, new RendererDiscovererItemDeletedEventArgs(new RendererItem(rendererItem.item)));
}
void OnItemAdded(IntPtr args)
{
var rendererItem = RetrieveEvent(args).RendererItem;
_itemAdded?.Invoke(this, new RendererDiscovererItemAddedEventArgs(new RendererItem(rendererItem)));
var rendererItem = RetrieveEvent(args).Union.RendererDiscovererItemAdded;
_itemAdded?.Invoke(this, new RendererDiscovererItemAddedEventArgs(new RendererItem(rendererItem.item)));
}
#endif
}
......
......@@ -156,12 +156,12 @@ namespace LibVLCSharp.Shared
/// <para>libvlc_renderer_discoverer_event_manager()</para>
/// </remarks>
/// <summary>A LibVLC event</summary>
[StructLayout(LayoutKind.Sequential)]
public struct LibVLCEvent
{
public EventType Type;
public IntPtr Sender;
public IntPtr RendererItem;
public EventUnion Union;
......@@ -203,18 +203,6 @@ namespace LibVLCSharp.Shared
public MediaPlayerScrambledChanged MediaPlayerScrambledChanged;
[FieldOffset(0)]
public MediaPlayerVoutChanged MediaPlayerVoutChanged;
[FieldOffset(0)]
public MediaPlayerSnapshotTaken MediaPlayerSnapshotTaken;
[FieldOffset(0)]
public MediaPlayerLengthChanged MediaPlayerLengthChanged;
[FieldOffset(0)]
public MediaPlayerMediaChanged MediaPlayerMediaChanged;
[FieldOffset(0)]
public EsChanged EsChanged;
[FieldOffset(0)]
public VolumeChanged MediaPlayerVolumeChanged;
[FieldOffset(0)]
public AudioDeviceChanged AudioDeviceChanged;
// medialist
[FieldOffset(0)]
......@@ -228,9 +216,27 @@ namespace LibVLCSharp.Shared
[FieldOffset(0)]
public MediaListPlayerNextItemSet MediaListPlayerNextItemSet;
// vlm
// mediaplayer
[FieldOffset(0)]
public MediaPlayerSnapshotTaken MediaPlayerSnapshotTaken;
[FieldOffset(0)]
public MediaPlayerLengthChanged MediaPlayerLengthChanged;
[FieldOffset(0)]
public VlmMediaEvent VlmMediaEvent;
[FieldOffset(0)]
public MediaPlayerMediaChanged MediaPlayerMediaChanged;
[FieldOffset(0)]
public EsChanged EsChanged;
[FieldOffset(0)]
public VolumeChanged MediaPlayerVolumeChanged;
[FieldOffset(0)]
public AudioDeviceChanged AudioDeviceChanged;
// renderer discoverer
[FieldOffset(0)]
public RendererDiscovererItemAdded RendererDiscovererItemAdded;
[FieldOffset(0)]
public RendererDiscovererItemDeleted RendererDiscovererItemDeleted;
}
#region Media
......@@ -417,6 +423,18 @@ namespace LibVLCSharp.Shared
public IntPtr MediaName;
public IntPtr InstanceName;
}
[StructLayout(LayoutKind.Sequential)]
public struct RendererDiscovererItemAdded
{
public IntPtr item;
}
[StructLayout(LayoutKind.Sequential)]
public struct RendererDiscovererItemDeleted
{
public IntPtr item;
}
}
#region Media events
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment