Commit bea45607 authored by Martin Finkel's avatar Martin Finkel

Add MediaPlayer WIP

parent f4f08f49
......@@ -4,6 +4,7 @@ using System.IO;
using System.Linq;
using NUnit.Framework;
using VideoLAN.LibVLC;
using VideoLAN.LibVLC.Manual;
namespace Bindings.Tests
{
......
......@@ -5,6 +5,7 @@ using System.Linq;
using System.Threading.Tasks;
using NUnit.Framework;
using VideoLAN.LibVLC;
using VideoLAN.LibVLC.Manual;
namespace Bindings.Tests
{
......@@ -83,9 +84,7 @@ namespace Bindings.Tests
[Test]
public void EqualityTests()
{
var instance1 = new Instance();
var instance2 = new Instance();
Assert.True(instance1 != instance2);
Assert.AreNotSame(new Instance(), new Instance());
}
[Test]
......
using System;
using NUnit.Framework;
using VideoLAN.LibVLC.Manual;
using MediaPlayer = VideoLAN.LibVLC.Manual.MediaPlayer;
namespace Bindings.Tests
{
[TestFixture]
public class MediaPlayerTests
{
[Test]
public void CreateAndDestroy()
{
var mp = new MediaPlayer(new Instance());
mp.Dispose();
Assert.AreEqual(IntPtr.Zero, mp.NativeReference);
}
[Test]
public void T()
{
var mp = new MediaPlayer(new Instance());
}
}
}
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
......@@ -8,9 +7,9 @@ using System.Security;
using System.Text;
using System.Threading.Tasks;
namespace VideoLAN.LibVLC
namespace VideoLAN.LibVLC.Manual
{
public class Instance
public class Instance : Internal
{
protected bool Equals(Instance other)
{
......@@ -43,7 +42,7 @@ namespace VideoLAN.LibVLC
}
[StructLayout(LayoutKind.Explicit, Size = 0)]
internal struct Internal
internal struct Native
{
[SuppressUnmanagedCodeSecurity]
[DllImport("libvlc", CallingConvention = CallingConvention.Cdecl,
......@@ -176,7 +175,6 @@ namespace VideoLAN.LibVLC
IntPtr args);
}
public IntPtr NativeReference { get; protected set; }
public Version VLCVersion { get; private set; }
internal static readonly System.Collections.Concurrent.ConcurrentDictionary<IntPtr, Instance> NativeToManagedMap
......@@ -227,14 +225,12 @@ namespace VideoLAN.LibVLC
/// <para>We recommend that you do not use them, other than when debugging.</para>
/// </remarks>
public Instance(int argc = 0, string[] args = null)
{
unsafe
: base(() =>
{
if (args == null || !args.Any())
NativeReference = Internal.LibVLCNew(argc, null);
else
unsafe
{
if (args == null || !args.Any())
return Native.LibVLCNew(argc, null);
fixed (byte* arg0 = Encoding.ASCII.GetBytes(args[0]),
arg1 = Encoding.ASCII.GetBytes(args[1]),
arg2 = Encoding.ASCII.GetBytes(args[2]))
......@@ -242,39 +238,34 @@ namespace VideoLAN.LibVLC
sbyte*[] arr = { (sbyte*)arg0, (sbyte*)arg1, (sbyte*)arg2 };
fixed (sbyte** argv = arr)
{
NativeReference = Internal.LibVLCNew(argc, argv);
return Native.LibVLCNew(argc, argv);
}
}
}
}
}, Native.LibVLCRelease)
{
__ownsNativeInstance = true;
NativeToManagedMap[NativeReference] = this;
var version = Marshal.PtrToStringAnsi(Internal.LibVLCVersion());
var version = Marshal.PtrToStringAnsi(Native.LibVLCVersion());
if (string.IsNullOrEmpty(version)) return;
version = version.Split('-', ' ')[0];
VLCVersion = new Version(version);
}
/// <para>Decrement the reference count of a libvlc instance, and destroy it</para>
/// <para>if it reaches zero.</para>
public void Dispose()
{
Dispose(disposing: true);
}
public virtual void Dispose(bool disposing)
{
if (NativeReference == IntPtr.Zero)
return;
//public virtual void Dispose(bool disposing)
//{
// if (NativeReference == IntPtr.Zero)
// return;
Internal.LibVLCRelease(NativeReference);
// Native.LibVLCRelease(NativeReference);
NativeToManagedMap.TryRemove(NativeReference, out var dummy);
NativeReference = IntPtr.Zero;
}
// NativeToManagedMap.TryRemove(NativeReference, out var dummy);
// NativeReference = IntPtr.Zero;
//}
public static bool operator ==(Instance obj1, Instance obj2)
{
......@@ -293,7 +284,7 @@ namespace VideoLAN.LibVLC
*/
public bool AddInterface(string name)
{
return Internal.LibVLCAddInterface(NativeReference, name ?? string.Empty) == 0;
return Native.LibVLCAddInterface(NativeReference, name ?? string.Empty) == 0;
}
/// <summary>
......@@ -317,7 +308,7 @@ namespace VideoLAN.LibVLC
public void SetExitHandler(ExitCallback cb, IntPtr opaque)
{
var cbFunctionPointer = cb == null ? IntPtr.Zero : Marshal.GetFunctionPointerForDelegate(cb);
Internal.LibVLCSetExitHandler(NativeReference, cbFunctionPointer, opaque);
Native.LibVLCSetExitHandler(NativeReference, cbFunctionPointer, opaque);
}
/// <summary>
......@@ -329,7 +320,7 @@ namespace VideoLAN.LibVLC
/// <remarks>LibVLC 1.1.1 or later</remarks>
public void SetUserAgent(string name, string http)
{
Internal.LibVLCSetUserAgent(NativeReference, name, http);
Native.LibVLCSetUserAgent(NativeReference, name, http);
}
/// <summary>
......@@ -342,7 +333,7 @@ namespace VideoLAN.LibVLC
/// <remarks>LibVLC 2.1.0 or later.</remarks>
public void SetAppId(string id, string version, string icon)
{
Internal.LibVLCSetAppId(NativeReference, id, version, icon);
Native.LibVLCSetAppId(NativeReference, id, version, icon);
}
/// <summary>Unsets the logging callback.</summary>
......@@ -356,7 +347,7 @@ namespace VideoLAN.LibVLC
/// </remarks>
public void UnsetLog()
{
Internal.LibVLCLogUnset(NativeReference);
Native.LibVLCLogUnset(NativeReference);
}
public void SetLog(LogCallback cb)
......@@ -365,7 +356,7 @@ namespace VideoLAN.LibVLC
_logCallback = cb;
Internal.LibVLCLogSet(NativeReference, cb, IntPtr.Zero);
Native.LibVLCLogSet(NativeReference, cb, IntPtr.Zero);
}
/// <summary>
......@@ -411,7 +402,7 @@ namespace VideoLAN.LibVLC
if(!fileStream.CanWrite) throw new ArgumentException("cannot write", nameof(fileStream));
//https://stackoverflow.com/questions/34519564/dealing-with-file-handles-using-mono-and-p-invoke
Internal.LibVLCLogSetFile(NativeReference, fileStream.SafeFileHandle.DangerousGetHandle());
Native.LibVLCLogSetFile(NativeReference, fileStream.SafeFileHandle.DangerousGetHandle());
}
/// <summary>Returns a list of audio filters that are available.</summary>
......@@ -427,10 +418,10 @@ namespace VideoLAN.LibVLC
{
get
{
return Retrieve(() => Internal.LibVLCAudioFilterListGet(NativeReference),
return Retrieve(() => Native.LibVLCAudioFilterListGet(NativeReference),
Marshal.PtrToStructure<ModuleDescription.Internal>,
intern => ModuleDescription.__CreateInstance(intern),
module => module.Next, Internal.LibVLCModuleDescriptionListRelease);
module => module.Next, Native.LibVLCModuleDescriptionListRelease);
}
}
......@@ -447,10 +438,10 @@ namespace VideoLAN.LibVLC
{
get
{
return Retrieve(() => Internal.LibVLCVideoFilterListGet(NativeReference),
return Retrieve(() => Native.LibVLCVideoFilterListGet(NativeReference),
Marshal.PtrToStructure<ModuleDescription.Internal>,
intern => ModuleDescription.__CreateInstance(intern),
module => module.Next, Internal.LibVLCModuleDescriptionListRelease);
module => module.Next, Native.LibVLCModuleDescriptionListRelease);
}
}
......@@ -465,10 +456,10 @@ namespace VideoLAN.LibVLC
{
get
{
return Retrieve(() => Internal.LibVLCAudioOutputListGet(NativeReference),
return Retrieve(() => Native.LibVLCAudioOutputListGet(NativeReference),
Marshal.PtrToStructure<AudioOutputDescription.Internal>,
intern => AudioOutputDescription.__CreateInstance(intern),
module => module.Next, Internal.LibVLCAudioOutputListRelease);
module => module.Next, Native.LibVLCAudioOutputListRelease);
}
}
......@@ -495,10 +486,10 @@ namespace VideoLAN.LibVLC
public IEnumerable<AudioOutputDevice> AudioOutputDevices(string audioOutputName)
{
return Retrieve(() => Internal.LibVLCAudioOutputDeviceListGet(NativeReference, audioOutputName),
return Retrieve(() => Native.LibVLCAudioOutputDeviceListGet(NativeReference, audioOutputName),
Marshal.PtrToStructure<AudioOutputDevice.Internal>,
s => AudioOutputDevice.__CreateInstance(s),
device => device.Next, Internal.LibVLCAudioOutputDeviceListRelease);
device => device.Next, Native.LibVLCAudioOutputDeviceListRelease);
}
/// <summary>Get media discoverer services by category</summary>
......@@ -508,7 +499,7 @@ namespace VideoLAN.LibVLC
public IEnumerable<MediaDiscovererDescription> MediaDiscoverers(MediaDiscovererCategory category)
{
var arrayResultPtr = IntPtr.Zero;
var count = Internal.LibVLCMediaDiscovererListGet(NativeReference, category, ref arrayResultPtr);
var count = Native.LibVLCMediaDiscovererListGet(NativeReference, category, ref arrayResultPtr);
if (count == 0) return Enumerable.Empty<MediaDiscovererDescription>();
......@@ -522,7 +513,7 @@ namespace VideoLAN.LibVLC
mediaDiscovererDescription[i] = mdd;
}
Internal.LibVLCMediaDiscovererListRelease(arrayResultPtr, count);
Native.LibVLCMediaDiscovererListRelease(arrayResultPtr, count);
return mediaDiscovererDescription;
}
......@@ -564,13 +555,13 @@ namespace VideoLAN.LibVLC
if (_log == null) return;
// Original source for va_list handling: https://stackoverflow.com/a/37629480/2663813
var byteLength = Internal._vscprintf(format, args) + 1;
var byteLength = Native._vscprintf(format, args) + 1;
var utf8Buffer = Marshal.AllocHGlobal(byteLength);
string formattedDecodedMessage;
try
{
Internal.vsprintf(utf8Buffer, format, args);
Native.vsprintf(utf8Buffer, format, args);
formattedDecodedMessage = (string)Utf8StringMarshaler.GetInstance().MarshalNativeToManaged(utf8Buffer);
}
......@@ -602,7 +593,7 @@ namespace VideoLAN.LibVLC
/// <param name="line">The source code file line number storage.</param>
void GetLogContext(IntPtr logContext, out string module, out string file, out uint? line)
{
Internal.LibVLCLogGetContext(logContext, out var modulePtr, out var filePtr, out var linePtr);
Native.LibVLCLogGetContext(logContext, out var modulePtr, out var filePtr, out var linePtr);
line = linePtr == UIntPtr.Zero ? null : (uint?)linePtr.ToUInt32();
module = Utf8StringMarshaler.GetInstance().MarshalNativeToManaged(modulePtr) as string;
......
......@@ -229,10 +229,7 @@ namespace VideoLAN.LibVLC
{
public partial struct __Internal
{
[SuppressUnmanagedCodeSecurity]
[DllImport("libvlc", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint = "libvlc_media_player_get_fps")]
internal static extern float LibvlcMediaPlayerGetFps(global::System.IntPtr p_mi);
[SuppressUnmanagedCodeSecurity]
[DllImport("libvlc", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
......@@ -259,27 +256,6 @@ namespace VideoLAN.LibVLC
EntryPoint = "libvlc_video_get_width")]
internal static extern int LibvlcVideoGetWidth(global::System.IntPtr p_mi);
[SuppressUnmanagedCodeSecurity]
[DllImport("libvlc", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint = "libvlc_video_get_title_description")]
internal static extern global::System.IntPtr LibvlcVideoGetTitleDescription(global::System.IntPtr p_mi);
[SuppressUnmanagedCodeSecurity]
[DllImport("libvlc", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint = "libvlc_video_get_chapter_description")]
internal static extern global::System.IntPtr LibvlcVideoGetChapterDescription(global::System.IntPtr p_mi,
int i_title);
[SuppressUnmanagedCodeSecurity]
[DllImport("libvlc", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint = "libvlc_video_set_subtitle_file")]
internal static extern int LibvlcVideoSetSubtitleFile(global::System.IntPtr p_mi,
[MarshalAs(UnmanagedType.LPStr)] string psz_subtitle);
[SuppressUnmanagedCodeSecurity]
[DllImport("libvlc", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint = "libvlc_toggle_teletext")]
internal static extern void LibvlcToggleTeletext(global::System.IntPtr p_mi);
[SuppressUnmanagedCodeSecurity]
[DllImport("libvlc", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
......@@ -412,27 +388,27 @@ namespace VideoLAN.LibVLC
/// <para>if the file format did not convey the frame rate explicitly.</para>
/// <para>Consider using libvlc_media_tracks_get() instead.</para>
/// </remarks>
public static float LibvlcMediaPlayerGetFps(global::VideoLAN.LibVLC.MediaPlayer p_mi)
{
var __arg0 = ReferenceEquals(p_mi, null) ? global::System.IntPtr.Zero : p_mi.__Instance;
var __ret = __Internal.LibvlcMediaPlayerGetFps(__arg0);
return __ret;
}
//public static float LibvlcMediaPlayerGetFps(global::VideoLAN.LibVLC.MediaPlayer p_mi)
//{
// var __arg0 = ReferenceEquals(p_mi, null) ? global::System.IntPtr.Zero : p_mi.NativeReference;
// var __ret = __Internal.LibvlcMediaPlayerGetFps(__arg0);
// return __ret;
//}
/// <remarks>Use libvlc_media_player_set_nsobject() instead</remarks>
public static void LibvlcMediaPlayerSetAgl(global::VideoLAN.LibVLC.MediaPlayer p_mi, uint drawable)
{
var __arg0 = ReferenceEquals(p_mi, null) ? global::System.IntPtr.Zero : p_mi.__Instance;
__Internal.LibvlcMediaPlayerSetAgl(__arg0, drawable);
}
//public static void LibvlcMediaPlayerSetAgl(global::VideoLAN.LibVLC.MediaPlayer p_mi, uint drawable)
//{
// var __arg0 = ReferenceEquals(p_mi, null) ? global::System.IntPtr.Zero : p_mi.__Instance;
// __Internal.LibvlcMediaPlayerSetAgl(__arg0, drawable);
//}
/// <remarks>Use libvlc_media_player_get_nsobject() instead</remarks>
public static uint LibvlcMediaPlayerGetAgl(global::VideoLAN.LibVLC.MediaPlayer p_mi)
{
var __arg0 = ReferenceEquals(p_mi, null) ? global::System.IntPtr.Zero : p_mi.__Instance;
var __ret = __Internal.LibvlcMediaPlayerGetAgl(__arg0);
return __ret;
}
///// <remarks>Use libvlc_media_player_get_nsobject() instead</remarks>
//public static uint LibvlcMediaPlayerGetAgl(global::VideoLAN.LibVLC.MediaPlayer p_mi)
//{
// var __arg0 = ReferenceEquals(p_mi, null) ? global::System.IntPtr.Zero : p_mi.__Instance;
// var __ret = __Internal.LibvlcMediaPlayerGetAgl(__arg0);
// return __ret;
//}
/// <remarks>Use libvlc_track_description_list_release() instead</remarks>
public static void LibvlcTrackDescriptionRelease(global::VideoLAN.LibVLC.TrackDescription p_track_description)
......@@ -447,23 +423,23 @@ namespace VideoLAN.LibVLC
/// <param name="p_mi">the media player</param>
/// <returns>the video pixel height or 0 if not applicable</returns>
/// <remarks>Use libvlc_video_get_size() instead.</remarks>
public static int LibvlcVideoGetHeight(global::VideoLAN.LibVLC.MediaPlayer p_mi)
{
var __arg0 = ReferenceEquals(p_mi, null) ? global::System.IntPtr.Zero : p_mi.__Instance;
var __ret = __Internal.LibvlcVideoGetHeight(__arg0);
return __ret;
}
//public static int LibvlcVideoGetHeight(global::VideoLAN.LibVLC.MediaPlayer p_mi)
//{
// var __arg0 = ReferenceEquals(p_mi, null) ? global::System.IntPtr.Zero : p_mi.__Instance;
// var __ret = __Internal.LibvlcVideoGetHeight(__arg0);
// return __ret;
//}
/// <summary>Get current video width.</summary>
/// <param name="p_mi">the media player</param>
/// <returns>the video pixel width or 0 if not applicable</returns>
/// <remarks>Use libvlc_video_get_size() instead.</remarks>
public static int LibvlcVideoGetWidth(global::VideoLAN.LibVLC.MediaPlayer p_mi)
{
var __arg0 = ReferenceEquals(p_mi, null) ? global::System.IntPtr.Zero : p_mi.__Instance;
var __ret = __Internal.LibvlcVideoGetWidth(__arg0);
return __ret;
}
//public static int LibvlcVideoGetWidth(global::VideoLAN.LibVLC.MediaPlayer p_mi)
//{
// var __arg0 = ReferenceEquals(p_mi, null) ? global::System.IntPtr.Zero : p_mi.__Instance;
// var __ret = __Internal.LibvlcVideoGetWidth(__arg0);
// return __ret;
//}
/// <summary>Get the description of available titles.</summary>
/// <param name="p_mi">the media player</param>
......@@ -471,19 +447,19 @@ namespace VideoLAN.LibVLC
/// <para>list containing description of available titles.</para>
/// <para>It must be freed with libvlc_track_description_list_release()</para>
/// </returns>
public static global::VideoLAN.LibVLC.TrackDescription LibvlcVideoGetTitleDescription(
global::VideoLAN.LibVLC.MediaPlayer p_mi)
{
var __arg0 = ReferenceEquals(p_mi, null) ? global::System.IntPtr.Zero : p_mi.__Instance;
var __ret = __Internal.LibvlcVideoGetTitleDescription(__arg0);
global::VideoLAN.LibVLC.TrackDescription __result0;
if (__ret == IntPtr.Zero) __result0 = null;
else if (global::VideoLAN.LibVLC.TrackDescription.NativeToManagedMap.ContainsKey(__ret))
__result0 = (global::VideoLAN.LibVLC.TrackDescription) global::VideoLAN.LibVLC.TrackDescription
.NativeToManagedMap[__ret];
else __result0 = global::VideoLAN.LibVLC.TrackDescription.__CreateInstance(__ret);
return __result0;
}
//public static global::VideoLAN.LibVLC.TrackDescription LibvlcVideoGetTitleDescription(
// global::VideoLAN.LibVLC.MediaPlayer p_mi)
//{
// var __arg0 = ReferenceEquals(p_mi, null) ? global::System.IntPtr.Zero : p_mi.NativeReference;
// var __ret = __Internal.LibvlcVideoGetTitleDescription(__arg0);
// global::VideoLAN.LibVLC.TrackDescription __result0;
// if (__ret == IntPtr.Zero) __result0 = null;
// else if (global::VideoLAN.LibVLC.TrackDescription.NativeToManagedMap.ContainsKey(__ret))
// __result0 = (global::VideoLAN.LibVLC.TrackDescription) global::VideoLAN.LibVLC.TrackDescription
// .NativeToManagedMap[__ret];
// else __result0 = global::VideoLAN.LibVLC.TrackDescription.__CreateInstance(__ret);
// return __result0;
//}
/// <summary>Get the description of available chapters for specific title.</summary>
/// <param name="p_mi">the media player</param>
......@@ -492,45 +468,45 @@ namespace VideoLAN.LibVLC
/// <para>list containing description of available chapter for title i_title.</para>
/// <para>It must be freed with libvlc_track_description_list_release()</para>
/// </returns>
public static global::VideoLAN.LibVLC.TrackDescription LibvlcVideoGetChapterDescription(
global::VideoLAN.LibVLC.MediaPlayer p_mi, int i_title)
{
var __arg0 = ReferenceEquals(p_mi, null) ? global::System.IntPtr.Zero : p_mi.__Instance;
var __ret = __Internal.LibvlcVideoGetChapterDescription(__arg0, i_title);
global::VideoLAN.LibVLC.TrackDescription __result0;
if (__ret == IntPtr.Zero) __result0 = null;
else if (global::VideoLAN.LibVLC.TrackDescription.NativeToManagedMap.ContainsKey(__ret))
__result0 = (global::VideoLAN.LibVLC.TrackDescription) global::VideoLAN.LibVLC.TrackDescription
.NativeToManagedMap[__ret];
else __result0 = global::VideoLAN.LibVLC.TrackDescription.__CreateInstance(__ret);
return __result0;
}
//public static global::VideoLAN.LibVLC.TrackDescription LibvlcVideoGetChapterDescription(
// global::VideoLAN.LibVLC.MediaPlayer p_mi, int i_title)
//{
// var __arg0 = ReferenceEquals(p_mi, null) ? global::System.IntPtr.Zero : p_mi.NativeReference;
// var __ret = __Internal.LibvlcVideoGetChapterDescription(__arg0, i_title);
// global::VideoLAN.LibVLC.TrackDescription __result0;
// if (__ret == IntPtr.Zero) __result0 = null;
// else if (global::VideoLAN.LibVLC.TrackDescription.NativeToManagedMap.ContainsKey(__ret))
// __result0 = (global::VideoLAN.LibVLC.TrackDescription) global::VideoLAN.LibVLC.TrackDescription
// .NativeToManagedMap[__ret];
// else __result0 = global::VideoLAN.LibVLC.TrackDescription.__CreateInstance(__ret);
// return __result0;
//}
/// <summary>Set new video subtitle file.</summary>
/// <param name="p_mi">the media player</param>
/// <param name="psz_subtitle">new video subtitle file</param>
/// <returns>the success status (boolean)</returns>
/// <remarks>Use libvlc_media_player_add_slave() instead.</remarks>
public static int LibvlcVideoSetSubtitleFile(global::VideoLAN.LibVLC.MediaPlayer p_mi, string psz_subtitle)
{
var __arg0 = ReferenceEquals(p_mi, null) ? global::System.IntPtr.Zero : p_mi.__Instance;
var __ret = __Internal.LibvlcVideoSetSubtitleFile(__arg0, psz_subtitle);
return __ret;
}
///// <summary>Set new video subtitle file.</summary>
///// <param name="p_mi">the media player</param>
///// <param name="psz_subtitle">new video subtitle file</param>
///// <returns>the success status (boolean)</returns>
///// <remarks>Use libvlc_media_player_add_slave() instead.</remarks>
//public static int LibvlcVideoSetSubtitleFile(global::VideoLAN.LibVLC.MediaPlayer p_mi, string psz_subtitle)
//{
// var __arg0 = ReferenceEquals(p_mi, null) ? global::System.IntPtr.Zero : p_mi.NativeReference;
// var __ret = __Internal.LibvlcVideoSetSubtitleFile(__arg0, psz_subtitle);
// return __ret;
//}
/// <summary>Toggle teletext transparent status on video output.</summary>
/// <param name="p_mi">the media player</param>
/// <remarks>use libvlc_video_set_teletext() instead.</remarks>
public static void LibvlcToggleTeletext(global::VideoLAN.LibVLC.MediaPlayer p_mi)
{
var __arg0 = ReferenceEquals(p_mi, null) ? global::System.IntPtr.Zero : p_mi.__Instance;
__Internal.LibvlcToggleTeletext(__arg0);
}
//public static void LibvlcToggleTeletext(global::VideoLAN.LibVLC.MediaPlayer p_mi)
//{
// var __arg0 = ReferenceEquals(p_mi, null) ? global::System.IntPtr.Zero : p_mi.NativeReference;
// __Internal.LibvlcToggleTeletext(__arg0);
//}
/// <summary>Backward compatibility stub. Do not use in new code.</summary>
/// <returns>always 0.</returns>
/// <remarks>Use libvlc_audio_output_device_list_get() instead.</remarks>
public static int LibvlcAudioOutputDeviceCount(global::VideoLAN.LibVLC.Instance p_instance, string psz_audio_output)
public static int LibvlcAudioOutputDeviceCount(global::VideoLAN.LibVLC.Manual.Instance p_instance, string psz_audio_output)
{
var __arg0 = ReferenceEquals(p_instance, null) ? global::System.IntPtr.Zero : p_instance.NativeReference;
var __ret = __Internal.LibvlcAudioOutputDeviceCount(__arg0, psz_audio_output);
......@@ -540,7 +516,7 @@ namespace VideoLAN.LibVLC
/// <summary>Backward compatibility stub. Do not use in new code.</summary>
/// <returns>always NULL.</returns>
/// <remarks>Use libvlc_audio_output_device_list_get() instead.</remarks>
public static sbyte* LibvlcAudioOutputDeviceLongname(global::VideoLAN.LibVLC.Instance p_instance, string psz_output,
public static sbyte* LibvlcAudioOutputDeviceLongname(global::VideoLAN.LibVLC.Manual.Instance p_instance, string psz_output,
int i_device)
{
var __arg0 = ReferenceEquals(p_instance, null) ? global::System.IntPtr.Zero : p_instance.NativeReference;
......@@ -551,7 +527,7 @@ namespace VideoLAN.LibVLC
/// <summary>Backward compatibility stub. Do not use in new code.</summary>
/// <returns>always NULL.</returns>
/// <remarks>Use libvlc_audio_output_device_list_get() instead.</remarks>
public static sbyte* LibvlcAudioOutputDeviceId(global::VideoLAN.LibVLC.Instance p_instance, string psz_audio_output,
public static sbyte* LibvlcAudioOutputDeviceId(global::VideoLAN.LibVLC.Manual.Instance p_instance, string psz_audio_output,
int i_device)
{
var __arg0 = ReferenceEquals(p_instance, null) ? global::System.IntPtr.Zero : p_instance.NativeReference;
......@@ -561,19 +537,19 @@ namespace VideoLAN.LibVLC
/// <summary>Stub for backward compatibility.</summary>
/// <returns>always -1.</returns>
public static int LibvlcAudioOutputGetDeviceType(global::VideoLAN.LibVLC.MediaPlayer p_mi)
{
var __arg0 = ReferenceEquals(p_mi, null) ? global::System.IntPtr.Zero : p_mi.__Instance;
var __ret = __Internal.LibvlcAudioOutputGetDeviceType(__arg0);
return __ret;
}
//public static int LibvlcAudioOutputGetDeviceType(global::VideoLAN.LibVLC.MediaPlayer p_mi)
//{
// var __arg0 = ReferenceEquals(p_mi, null) ? global::System.IntPtr.Zero : p_mi.__Instance;
// var __ret = __Internal.LibvlcAudioOutputGetDeviceType(__arg0);
// return __ret;
//}
/// <summary>Stub for backward compatibility.</summary>
public static void LibvlcAudioOutputSetDeviceType(global::VideoLAN.LibVLC.MediaPlayer p_mp, int device_type)
{
var __arg0 = ReferenceEquals(p_mp, null) ? global::System.IntPtr.Zero : p_mp.__Instance;
__Internal.LibvlcAudioOutputSetDeviceType(__arg0, device_type);
}
///// <summary>Stub for backward compatibility.</summary>
//public static void LibvlcAudioOutputSetDeviceType(global::VideoLAN.LibVLC.MediaPlayer p_mp, int device_type)
//{
// var __arg0 = ReferenceEquals(p_mp, null) ? global::System.IntPtr.Zero : p_mp.__Instance;
// __Internal.LibvlcAudioOutputSetDeviceType(__arg0, device_type);
//}
......@@ -609,7 +585,7 @@ namespace VideoLAN.LibVLC
/// <remarks>Use libvlc_media_discoverer_new() and libvlc_media_discoverer_start().</remarks>
public static global::VideoLAN.LibVLC.MediaDiscoverer LibvlcMediaDiscovererNewFromName(
global::VideoLAN.LibVLC.Instance p_inst, string psz_name)
global::VideoLAN.LibVLC.Manual.Instance p_inst, string psz_name)
{
var __arg0 = ReferenceEquals(p_inst, null) ? global::System.IntPtr.Zero : p_inst.NativeReference;
var __ret = __Internal.LibvlcMediaDiscovererNewFromName(__arg0, psz_name);
......@@ -646,7 +622,7 @@ namespace VideoLAN.LibVLC
//public static global::VideoLAN.LibVLC.EventManager LibvlcMediaDiscovererEventManager(
// global::VideoLAN.LibVLC.MediaDiscoverer p_mdis)
//{
// var __arg0 = ReferenceEquals(p_mdis, null) ? global::System.IntPtr.Zero : p_mdis.__Instance;
// var __arg0 = ReferenceEquals(p_mdis, null) ? global::System.IntPtr.Zero : p_mdis.NativeReference;
// var __ret = __Internal.LibvlcMediaDiscovererEventManager(__arg0);
// global::VideoLAN.LibVLC.EventManager __result0;
// if (__ret == IntPtr.Zero) __result0 = null;
......@@ -666,7 +642,7 @@ namespace VideoLAN.LibVLC
/// <para>This function wastes one thread doing basically nothing.</para>
/// <para>libvlc_set_exit_handler() should be used instead.</para>
/// </remarks>
public static void LibvlcWait(global::VideoLAN.LibVLC.Instance p_instance)
public static void LibvlcWait(global::VideoLAN.LibVLC.Manual.Instance p_instance)
{
var __arg0 = ReferenceEquals(p_instance, null) ? global::System.IntPtr.Zero : p_instance.NativeReference;
__Internal.LibvlcWait(__arg0);
......@@ -678,7 +654,7 @@ namespace VideoLAN.LibVLC
/// </summary>
/// <param name="p_instance">ignored</param>
/// <returns>always -1</returns>
public static uint LibvlcGetLogVerbosity(global::VideoLAN.LibVLC.Instance p_instance)
public static uint LibvlcGetLogVerbosity(global::VideoLAN.LibVLC.Manual.Instance p_instance)
{
var __arg0 = ReferenceEquals(p_instance, null) ? global::System.IntPtr.Zero : p_instance.NativeReference;
var __ret = __Internal.LibvlcGetLogVerbosity(__arg0);
......@@ -691,7 +667,7 @@ namespace VideoLAN.LibVLC
/// </summary>
/// <param name="p_instance">ignored</param>
/// <param name="level">ignored</param>
public static void LibvlcSetLogVerbosity(global::VideoLAN.LibVLC.Instance p_instance, uint level)
public static void LibvlcSetLogVerbosity(global::VideoLAN.LibVLC.Manual.Instance p_instance, uint level)
{
var __arg0 = ReferenceEquals(p_instance, null) ? global::System.IntPtr.Zero : p_instance.NativeReference;
__Internal.LibvlcSetLogVerbosity(__arg0, level);
......@@ -703,7 +679,7 @@ namespace VideoLAN.LibVLC
/// </summary>
/// <param name="p_instance">libvlc instance</param>
/// <returns>an unique pointer or NULL on error</returns>
public static global::VideoLAN.LibVLC.Log LibvlcLogOpen(global::VideoLAN.LibVLC.Instance p_instance)
public static global::VideoLAN.LibVLC.Log LibvlcLogOpen(global::VideoLAN.LibVLC.Manual.Instance p_instance)
{
var __arg0 = ReferenceEquals(p_instance, null) ? global::System.IntPtr.Zero : p_instance.NativeReference;
var __ret = __Internal.LibvlcLogOpen(__arg0);
......@@ -820,7 +796,7 @@ namespace VideoLAN.LibVLC
/// <para>Additionnal playlist item options can be specified for addition to the</para>
/// <para>item before it is played.</para>
/// </remarks>
public static void LibvlcPlaylistPlay(global::VideoLAN.LibVLC.Instance p_instance, int i_id, int i_options,
public static void LibvlcPlaylistPlay(global::VideoLAN.LibVLC.Manual.Instance p_instance, int i_id, int i_options,
sbyte** ppsz_options)
{
var __arg0 = ReferenceEquals(p_instance, null) ? global::System.IntPtr.Zero : p_instance.NativeReference;
......
......@@ -330,7 +330,7 @@ namespace VideoLAN.LibVLC
/// <para>The initial reference count is 1 after libvlc_new() returns.</para>
/// </summary>
/// <param name="p_instance">the instance to reference</param>
public static void LibvlcRetain(global::VideoLAN.LibVLC.Instance p_instance)
public static void LibvlcRetain(global::VideoLAN.LibVLC.Manual.Instance p_instance)
{
var __arg0 = ReferenceEquals(p_instance, null) ? global::System.IntPtr.Zero : p_instance.NativeReference;
__Internal.LibvlcRetain(__arg0);
......@@ -385,7 +385,7 @@ namespace VideoLAN.LibVLC
/// <returns>0 on success, ENOMEM on error</returns>
//public static int LibvlcEventAttach(global::VideoLAN.LibVLC.EventManager p_event_manager, int i_event_type, global::VideoLAN.LibVLC.LibvlcCallbackT f_callback, global::System.IntPtr user_data)
//{
// var __arg0 = ReferenceEquals(p_event_manager, null) ? global::System.IntPtr.Zero : p_event_manager.__Instance;
// var __arg0 = ReferenceEquals(p_event_manager, null) ? global::System.IntPtr.Zero : p_event_manager.NativeReference;
// var __arg2 = f_callback == null ? global::System.IntPtr.Zero : Marshal.GetFunctionPointerForDelegate(f_callback);
// var __ret = __Internal.LibvlcEventAttach(__arg0, i_event_type, __arg2, user_data);
// return __ret;
......@@ -398,7 +398,7 @@ namespace VideoLAN.LibVLC
/// <param name="p_user_data">user provided data to carry with the event</param>
//public static void LibvlcEventDetach(global::VideoLAN.LibVLC.EventManager p_event_manager, int i_event_type, global::VideoLAN.LibVLC.LibvlcCallbackT f_callback, global::System.IntPtr p_user_data)
//{
// var __arg0 = ReferenceEquals(p_event_manager, null) ? global::System.IntPtr.Zero : p_event_manager.__Instance;
// var __arg0 = ReferenceEquals(p_event_manager, null) ? global::System.IntPtr.Zero : p_event_manager.NativeReference;
// var __arg2 = f_callback == null ? global::System.IntPtr.Zero : Marshal.GetFunctionPointerForDelegate(f_callback);
// __Internal.LibvlcEventDetach(__arg0, i_event_type, __arg2, p_user_data);
//}
......
......@@ -209,7 +209,7 @@ namespace VideoLAN.LibVLC
/// <param name="p_cbs">a pointer to callbacks, or NULL to unregister callbacks.</param>
/// <param name="p_data">opaque pointer for the callback</param>
/// <remarks>LibVLC 3.0.0 and later.</remarks>
public static void LibvlcDialogSetCallbacks(global::VideoLAN.LibVLC.Instance p_instance, global::VideoLAN.LibVLC.DialogCallback p_cbs, global::System.IntPtr p_data)
public static void LibvlcDialogSetCallbacks(global::VideoLAN.LibVLC.Manual.Instance p_instance, global::VideoLAN.LibVLC.DialogCallback p_cbs, global::System.IntPtr p_data)
{
var __arg0 = ReferenceEquals(p_instance, null) ? global::System.IntPtr.Zero : p_instance.NativeReference;
var __arg1 = ReferenceEquals(p_cbs, null) ? global::System.IntPtr.Zero : p_cbs.__Instance;
......
......@@ -95,7 +95,7 @@ namespace VideoLAN.LibVLC
// {
// }
// public global::System.IntPtr __Instance { get; protected set; }
// public global::System.IntPtr NativeReference { get; protected set; }
// protected int __PointerAdjustment;
// internal static readonly global::System.Collections.Concurrent.ConcurrentDictionary<IntPtr, global::VideoLAN.LibVLC.Media> NativeToManagedMap = new global::System.Collections.Concurrent.ConcurrentDictionary<IntPtr, global::VideoLAN.LibVLC.Media>();
......@@ -124,14 +124,14 @@ namespace VideoLAN.LibVLC
// : this(__CopyValue(native), skipVTables)
// {
// __ownsNativeInstance = true;
// NativeToManagedMap[__Instance] = this;
// NativeToManagedMap[NativeReference] = this;
// }
// protected Media(void* native, bool skipVTables = false)
// {
// if (native == null)
// return;
// __Instance = new global::System.IntPtr(native);
// NativeReference = new global::System.IntPtr(native);