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 ...@@ -62,27 +62,27 @@ namespace LibVLCSharp.Shared
[MonoPInvokeCallback(typeof(EventCallback))] [MonoPInvokeCallback(typeof(EventCallback))]
static void OnItemDeleted(IntPtr args) static void OnItemDeleted(IntPtr args)
{ {
var rendererItem = RetrieveEvent(args).RendererItem; var rendererItem = RetrieveEvent(args).Union.RendererDiscovererItemDeleted;
_itemDeleted?.Invoke(null, new RendererDiscovererItemDeletedEventArgs(new RendererItem(rendererItem))); _itemDeleted?.Invoke(null, new RendererDiscovererItemDeletedEventArgs(new RendererItem(rendererItem.item)));
} }
[MonoPInvokeCallback(typeof(EventCallback))] [MonoPInvokeCallback(typeof(EventCallback))]
static void OnItemAdded(IntPtr args) static void OnItemAdded(IntPtr args)
{ {
var rendererItem = RetrieveEvent(args).RendererItem; var rendererItem = RetrieveEvent(args).Union.RendererDiscovererItemAdded;
_itemAdded?.Invoke(null, new RendererDiscovererItemAddedEventArgs(new RendererItem(rendererItem))); _itemAdded?.Invoke(null, new RendererDiscovererItemAddedEventArgs(new RendererItem(rendererItem.item)));
} }
#else #else
void OnItemDeleted(IntPtr args) void OnItemDeleted(IntPtr args)
{ {
var rendererItem = RetrieveEvent(args).RendererItem; var rendererItem = RetrieveEvent(args).Union.RendererDiscovererItemDeleted;
_itemDeleted?.Invoke(this, new RendererDiscovererItemDeletedEventArgs(new RendererItem(rendererItem))); _itemDeleted?.Invoke(this, new RendererDiscovererItemDeletedEventArgs(new RendererItem(rendererItem.item)));
} }
void OnItemAdded(IntPtr args) void OnItemAdded(IntPtr args)
{ {
var rendererItem = RetrieveEvent(args).RendererItem; var rendererItem = RetrieveEvent(args).Union.RendererDiscovererItemAdded;
_itemAdded?.Invoke(this, new RendererDiscovererItemAddedEventArgs(new RendererItem(rendererItem))); _itemAdded?.Invoke(this, new RendererDiscovererItemAddedEventArgs(new RendererItem(rendererItem.item)));
} }
#endif #endif
} }
......
...@@ -156,12 +156,12 @@ namespace LibVLCSharp.Shared ...@@ -156,12 +156,12 @@ namespace LibVLCSharp.Shared
/// <para>libvlc_renderer_discoverer_event_manager()</para> /// <para>libvlc_renderer_discoverer_event_manager()</para>
/// </remarks> /// </remarks>
/// <summary>A LibVLC event</summary> /// <summary>A LibVLC event</summary>
[StructLayout(LayoutKind.Sequential)]
public struct LibVLCEvent public struct LibVLCEvent
{ {
public EventType Type; public EventType Type;
public IntPtr Sender; public IntPtr Sender;
public IntPtr RendererItem;
public EventUnion Union; public EventUnion Union;
...@@ -203,18 +203,6 @@ namespace LibVLCSharp.Shared ...@@ -203,18 +203,6 @@ namespace LibVLCSharp.Shared
public MediaPlayerScrambledChanged MediaPlayerScrambledChanged; public MediaPlayerScrambledChanged MediaPlayerScrambledChanged;
[FieldOffset(0)] [FieldOffset(0)]
public MediaPlayerVoutChanged MediaPlayerVoutChanged; 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 // medialist
[FieldOffset(0)] [FieldOffset(0)]
...@@ -228,9 +216,27 @@ namespace LibVLCSharp.Shared ...@@ -228,9 +216,27 @@ namespace LibVLCSharp.Shared
[FieldOffset(0)] [FieldOffset(0)]
public MediaListPlayerNextItemSet MediaListPlayerNextItemSet; public MediaListPlayerNextItemSet MediaListPlayerNextItemSet;
// vlm // mediaplayer
[FieldOffset(0)]
public MediaPlayerSnapshotTaken MediaPlayerSnapshotTaken;
[FieldOffset(0)]
public MediaPlayerLengthChanged MediaPlayerLengthChanged;
[FieldOffset(0)] [FieldOffset(0)]
public VlmMediaEvent VlmMediaEvent; 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 #region Media
...@@ -417,6 +423,18 @@ namespace LibVLCSharp.Shared ...@@ -417,6 +423,18 @@ namespace LibVLCSharp.Shared
public IntPtr MediaName; public IntPtr MediaName;
public IntPtr InstanceName; public IntPtr InstanceName;
} }
[StructLayout(LayoutKind.Sequential)]
public struct RendererDiscovererItemAdded
{
public IntPtr item;
}
[StructLayout(LayoutKind.Sequential)]
public struct RendererDiscovererItemDeleted
{
public IntPtr item;
}
} }
#region Media events #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