...
 
Commits (7)
......@@ -11,10 +11,12 @@ namespace LibVLCSharp.Tests
[TestFixture]
public class EventManagerTests
{
string RealMediaPath => Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, "sample.mp3");
[Test]
public void MetaChangedEventSubscribe()
{
var media = new Media(new Instance(), Path.GetTempFileName(), Media.FromType.FromPath);
var media = new Media(new Instance(), Path.GetTempFileName());
var eventManager = media.EventManager;
var eventHandlerCalled = false;
const Media.MetadataType description = Media.MetadataType.Description;
......@@ -26,43 +28,11 @@ namespace LibVLCSharp.Tests
media.SetMeta(Media.MetadataType.Description, "test");
Assert.True(eventHandlerCalled);
}
[Test]
public void SubItemAdded()
{
// FIXME
var instance = new Instance();
var media = new Media(instance, RealMediaPath, Media.FromType.FromPath);
var subItem = new Media(instance, Path.GetTempFileName(), Media.FromType.FromPath);
var eventManager = media.EventManager;
var eventHandlerCalled = false;
eventManager.SubItemAdded += (sender, args) =>
{
Assert.AreEqual(subItem, args.SubItem);
eventHandlerCalled = true;
};
media.SubItems.Lock();
Assert.True(media.SubItems.AddMedia(subItem));
media.SubItems.Unlock();
Assert.True(eventHandlerCalled);
}
string RealMediaPath
{
get
{
var dir = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
//var binDir = Path.Combine(dir, "..\\..\\..\\");
var files = Directory.GetFiles(dir);
return files.First(f => f.Contains("Klang"));
}
}
[Test]
public void DurationChanged()
{
var media = new Media(new Instance(), RealMediaPath, Media.FromType.FromPath);
var media = new Media(new Instance(), RealMediaPath);
var called = false;
long duration = 0;
......@@ -116,14 +86,5 @@ namespace LibVLCSharp.Tests
Assert.True(tcs.Task.Result);
Assert.True(openingCalled);
}
[Test]
public void SubItemTreeAdded()
{
var media = new Media(new Instance(), RealMediaPath, Media.FromType.FromPath);
//TODO: Implement MediaList.cs
Assert.Fail();
}
}
}
\ No newline at end of file
......@@ -2,6 +2,7 @@
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Threading;
using NUnit.Framework;
using VideoLAN.LibVLC;
using Media = VideoLAN.LibVLC.Media;
......@@ -67,7 +68,7 @@ namespace LibVLCSharp.Tests
using (var mp = new MediaPlayer(media))
{
Assert.True(mp.Play());
await Task.Delay(3000); // have to wait a bit for statistics to populate
await Task.Delay(4000); // have to wait a bit for statistics to populate
Assert.Greater(media.Statistics.DemuxBitrate, 0);
mp.Stop();
}
......@@ -76,6 +77,7 @@ namespace LibVLCSharp.Tests
}
string RealStreamMediaPath => "http://streams.videolan.org/streams/mp3/Owner-MPEG2.5.mp3";
string RealMediaPath => Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, "sample.mp3");
[Test]
public void Duplicate()
......@@ -88,9 +90,7 @@ namespace LibVLCSharp.Tests
[Test]
public void CreateMediaFromFileStream()
{
Assert.Fail();
// TODO: fix this.
var media = new Media(new Instance(), new FileStream("realFileUri", FileMode.Open, FileAccess.Read, FileShare.Read));
var media = new Media(new Instance(), new FileStream(RealMediaPath, FileMode.Open, FileAccess.Read, FileShare.Read));
media.Parse();
Assert.NotZero(media.Tracks.First().Data.Audio.Channels);
}
......@@ -104,5 +104,49 @@ namespace LibVLCSharp.Tests
Assert.True(media.SaveMeta());
Assert.AreEqual(test, media.Meta(Media.MetadataType.ShowName));
}
[Test]
public async Task AsyncParse()
{
var media = new Media(new Instance(), RealMediaPath, Media.FromType.FromPath);
var result = await media.ParseAsyncWithOptions();
Assert.True(result);
}
[Test]
public async Task AsyncParseTimeoutStop()
{
//TODO: fix
Assert.Inconclusive();
var media = new Media(new Instance(), RealMediaPath, Media.FromType.FromPath);
var called = false;
media.EventManager.ParsedChanged += (sender, args) =>
{
Assert.True(args.ParsedStatus == Media.MediaParsedStatus.Timeout);
called = true;
};
var result = await media.ParseAsyncWithOptions(timeout: 1);
Assert.False(result);
Assert.True(called);
}
[Test]
public async Task AsyncParseCancel()
{
//TODO: fix
Assert.Inconclusive();
var media = new Media(new Instance(), RealMediaPath, Media.FromType.FromPath);
var called = false;
media.EventManager.ParsedChanged += (sender, args) =>
{
Assert.True(args.ParsedStatus == Media.MediaParsedStatus.Failed);
called = true;
};
// current code cancels tasks before the parsing even starts so parseStatus is never set to failed.
var result = await media.ParseAsyncWithOptions(cancellationToken: new CancellationToken(canceled: true));
Assert.False(result);
Assert.True(called);
}
}
}
......@@ -5,16 +5,18 @@ using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Security;
using System.Threading;
using System.Threading.Tasks;
using VideoLAN.LibVLC.Events;
namespace VideoLAN.LibVLC
{
public partial class Media : IDisposable
public partial class Media : Internal
{
static readonly ConcurrentDictionary<IntPtr, StreamData> DicStreams = new ConcurrentDictionary<IntPtr, StreamData>();
static int _streamIndex;
internal struct Internal
internal struct Native
{
[SuppressUnmanagedCodeSecurity]
[DllImport("libvlc", CallingConvention = CallingConvention.Cdecl,
......@@ -198,6 +200,11 @@ namespace VideoLAN.LibVLC
[DllImport("libvlc", CallingConvention = CallingConvention.Cdecl,
EntryPoint = "libvlc_media_retain")]
internal static extern void LibVLCMediaRetain(IntPtr media);
[SuppressUnmanagedCodeSecurity]
[DllImport("libvlc", CallingConvention = CallingConvention.Cdecl,
EntryPoint = "libvlc_media_get_codec_description")]
internal static extern string LibvlcMediaGetCodecDescription(TrackType type, uint codec);
}
#region enums
......@@ -254,7 +261,8 @@ namespace VideoLAN.LibVLC
}
/// <summary>
/// <summary>Parse flags used by libvlc_media_parse_with_options()</summary>
/// <summary>Parse flags used by libvlc_media_parse_with_options()
/// </summary>
/// <remarks>libvlc_media_parse_with_options</remarks>
[Flags]
public enum MediaParseOptions
......@@ -275,6 +283,7 @@ namespace VideoLAN.LibVLC
DoInteract = 8
}
/// <summary>
/// Parse status used sent by libvlc_media_parse_with_options() or returned by
/// libvlc_media_get_parsed_status()
/// </summary>
......@@ -304,34 +313,33 @@ namespace VideoLAN.LibVLC
#endregion
public IntPtr NativeReference = IntPtr.Zero;
/// <summary>
/// Media Constructs a libvlc Media instance
/// </summary>
/// <param name="instance">A libvlc instance</param>
/// <param name="mrl">A path, location, or node name, depending on the 3rd parameter</param>
/// <param name="type">The type of the 2nd argument. \sa{FromType}</param>
public Media(Instance instance, string mrl, FromType type)
public Media(Instance instance, string mrl, FromType type = FromType.FromPath)
: base(() => SelectNativeCtor(instance, mrl, type), Native.LibVLCMediaRelease)
{
if(instance == null) throw new ArgumentNullException(nameof(instance));
if(string.IsNullOrEmpty(mrl)) throw new ArgumentNullException(nameof(mrl));
}
static IntPtr SelectNativeCtor(Instance instance, string mrl, FromType type)
{
if (instance == null) throw new ArgumentNullException(nameof(instance));
if (string.IsNullOrEmpty(mrl)) throw new ArgumentNullException(nameof(mrl));
switch (type)
{
case FromType.FromLocation:
NativeReference = Internal.LibVLCMediaNewLocation(instance.NativeReference, mrl);
break;
return Native.LibVLCMediaNewLocation(instance.NativeReference, mrl);
case FromType.FromPath:
NativeReference = Internal.LibVLCMediaNewPath(instance.NativeReference, mrl);
break;
return Native.LibVLCMediaNewPath(instance.NativeReference, mrl);
case FromType.AsNode:
NativeReference = Internal.LibVLCMediaNewAsNode(instance.NativeReference, mrl);
break;
return Native.LibVLCMediaNewAsNode(instance.NativeReference, mrl);
default:
return IntPtr.Zero;
}
if(NativeReference == IntPtr.Zero)
throw new ArgumentException($"Failed to construct media for {mrl} of type {type}");
}
/// <summary>
......@@ -353,23 +361,13 @@ namespace VideoLAN.LibVLC
/// <param name="instance">A libvlc instance</param>
/// <param name="fd">open file descriptor</param>
public Media(Instance instance, int fd)
: base(() => Native.LibVLCMediaNewFd(instance.NativeReference, fd), Native.LibVLCMediaRelease)
{
if (instance == null) throw new ArgumentNullException(nameof(instance));
NativeReference = Internal.LibVLCMediaNewFd(instance.NativeReference, fd);
if (NativeReference == IntPtr.Zero)
throw new ArgumentException($"Failed to construct media with {fd}");
}
public Media(MediaList mediaList)
: base(() => Native.LibVLCMediaListMedia(mediaList.NativeReference), Native.LibVLCMediaRelease)
{
if (mediaList == null) throw new ArgumentNullException(nameof(mediaList));
//NativeReference = Internal.LibVLCMediaListMedia(mediaList.__Instance);
if(NativeReference == IntPtr.Zero)
throw new ArgumentException($"Failed to construct media with {mediaList}");
}
/// <summary>
......@@ -380,8 +378,15 @@ namespace VideoLAN.LibVLC
/// <param name="options"></param>
[LibVLC(3)]
public Media(Instance instance, Stream stream, params string[] options)
: base(() => CtorFromCallbacks(instance, stream), Native.LibVLCMediaRelease)
{
if(options.Any())
Native.LibVLCMediaAddOption(NativeReference, options.ToString());
}
static IntPtr CtorFromCallbacks(Instance instance, Stream stream)
{
if(instance == null) throw new ArgumentNullException(nameof(instance));
if (instance == null) throw new ArgumentNullException(nameof(instance));
if (stream == null) throw new ArgumentNullException(nameof(stream));
var opaque = AddStream(stream);
......@@ -389,30 +394,19 @@ namespace VideoLAN.LibVLC
if (opaque == IntPtr.Zero)
throw new InvalidOperationException("Cannot create opaque parameter");
NativeReference = Internal.LibVLCMediaNewCallbacks(instance.NativeReference,
Marshal.GetFunctionPointerForDelegate(new OpenMedia(CallbackOpenMedia)),
Marshal.GetFunctionPointerForDelegate(new ReadMedia(CallbackReadMedia)),
Marshal.GetFunctionPointerForDelegate(new SeekMedia(CallbackSeekMedia)),
return Native.LibVLCMediaNewCallbacks(instance.NativeReference,
Marshal.GetFunctionPointerForDelegate(new OpenMedia(CallbackOpenMedia)),
Marshal.GetFunctionPointerForDelegate(new ReadMedia(CallbackReadMedia)),
Marshal.GetFunctionPointerForDelegate(new SeekMedia(CallbackSeekMedia)),
Marshal.GetFunctionPointerForDelegate(new CloseMedia(CallbackCloseMedia)),
opaque);
if(options.Any())
Internal.LibVLCMediaAddOption(NativeReference, options.ToString());
if (NativeReference == IntPtr.Zero)
throw new ArgumentException($"Failed to construct media with {instance}, {stream}");
}
public Media(IntPtr mediaPtr)
: base(() => mediaPtr, Native.LibVLCMediaRelease)
{
if(mediaPtr == IntPtr.Zero)
throw new ArgumentNullException(nameof(mediaPtr));
NativeReference = mediaPtr;
}
public Media() { }
/// <summary>Add an option to the media.</summary>
/// <param name="options">the options (as a string)</param>
/// <remarks>
......@@ -431,7 +425,7 @@ namespace VideoLAN.LibVLC
{
if(string.IsNullOrEmpty(options)) throw new ArgumentNullException(nameof(options));
Internal.LibVLCMediaAddOption(NativeReference, options);
Native.LibVLCMediaAddOption(NativeReference, options);
}
/// <summary>Add an option to the media with configurable flags.</summary>
......@@ -451,7 +445,7 @@ namespace VideoLAN.LibVLC
{
if (string.IsNullOrEmpty(options)) throw new ArgumentNullException(nameof(options));
Internal.LibVLCMediaAddOptionFlag(NativeReference, options, flags);
Native.LibVLCMediaAddOptionFlag(NativeReference, options, flags);
}
string _mrl;
......@@ -462,7 +456,7 @@ namespace VideoLAN.LibVLC
{
if (string.IsNullOrEmpty(_mrl))
{
var mrlPtr = Internal.LibVLCMediaGetMrl(NativeReference);
var mrlPtr = Native.LibVLCMediaGetMrl(NativeReference);
_mrl = Utf8StringMarshaler.GetInstance().MarshalNativeToManaged(mrlPtr) as string;
}
return _mrl;
......@@ -472,7 +466,7 @@ namespace VideoLAN.LibVLC
/// <summary>Duplicate a media descriptor object.</summary>
public Media Duplicate()
{
var duplicatePtr = Internal.LibVLCMediaDuplicate(NativeReference);
var duplicatePtr = Native.LibVLCMediaDuplicate(NativeReference);
if(duplicatePtr == IntPtr.Zero) throw new Exception("Failure to duplicate");
return new Media(duplicatePtr);
}
......@@ -485,7 +479,7 @@ namespace VideoLAN.LibVLC
/// </remarks>
public string Meta(MetadataType metadataType)
{
var metaPtr = Internal.LibVLCMediaGetMeta(NativeReference, metadataType);
var metaPtr = Native.LibVLCMediaGetMeta(NativeReference, metadataType);
if (metaPtr == IntPtr.Zero) return string.Empty;
return Utf8StringMarshaler.GetInstance().MarshalNativeToManaged(metaPtr) as string;
}
......@@ -500,26 +494,23 @@ namespace VideoLAN.LibVLC
{
if(string.IsNullOrEmpty(value)) throw new ArgumentNullException(value);
Internal.LibVLCMediaSetMeta(NativeReference, metadataType, value);
Native.LibVLCMediaSetMeta(NativeReference, metadataType, value);
}
/// <summary>Save the meta previously set</summary>
/// <returns>true if the write operation was successful</returns>
public bool SaveMeta()
{
var r = Internal.LibVLCMediaSaveMeta(NativeReference);
return r != 0;
}
public bool SaveMeta() => Native.LibVLCMediaSaveMeta(NativeReference) != 0;
/// <summary>
/// Get current <see cref="VLCState"/> of media descriptor object.
/// </summary>
public VLCState State => Internal.LibVLCMediaGetState(NativeReference);
public VLCState State => Native.LibVLCMediaGetState(NativeReference);
/// <summary>Get the current statistics about the media
/// structure that contain the statistics about the media
/// </summary>
public MediaStats Statistics => Internal.LibVLCMediaGetStats(NativeReference, out var mediaStats) == 0 ? default(MediaStats) : mediaStats;
public MediaStats Statistics => Native.LibVLCMediaGetStats(NativeReference, out var mediaStats) == 0
? default(MediaStats) : mediaStats;
MediaEventManager _eventManager;
/// <summary>
......@@ -532,7 +523,7 @@ namespace VideoLAN.LibVLC
get
{
if (_eventManager != null) return _eventManager;
var eventManagerPtr = Internal.LibVLCMediaEventManager(NativeReference);
var eventManagerPtr = Native.LibVLCMediaEventManager(NativeReference);
_eventManager = new MediaEventManager(eventManagerPtr);
return _eventManager;
}
......@@ -540,7 +531,7 @@ namespace VideoLAN.LibVLC
/// <summary>Get duration (in ms) of media descriptor object item.</summary>
/// <returns>duration of media item or -1 on error</returns>
public long Duration => Internal.LibVLCMediaGetDuration(NativeReference);
public long Duration => Native.LibVLCMediaGetDuration(NativeReference);
/// <summary>Parse a media.
/// This fetches (local) art, meta data and tracks information.
......@@ -551,10 +542,7 @@ namespace VideoLAN.LibVLC
/// libvlc_media_get_meta
/// libvlc_media_get_tracks_info
/// </summary>
public void Parse()
{
Internal.LibVLCMediaParse(NativeReference);
}
public void Parse() => Native.LibVLCMediaParse(NativeReference);
/// <summary>Parse a media.
/// This fetches (local) art, meta data and tracks information.
......@@ -573,16 +561,17 @@ namespace VideoLAN.LibVLC
/// TODO: return task by checking libvlc_MediaParsedChanged
public Task ParseAsync()
{
Internal.LibVLCMediaParseAsync(NativeReference);
Native.LibVLCMediaParseAsync(NativeReference);
return Task.CompletedTask;
}
/// <summary>Return true is the media descriptor object is parsed</summary>
/// <returns>true if media object has been parsed otherwise it returns false</returns>
public bool IsParsed => Internal.LibVLCMediaIsParsed(NativeReference) != 0;
public bool IsParsed => Native.LibVLCMediaIsParsed(NativeReference) != 0;
/// <summary>Parse the media asynchronously with options.</summary>
/// <param name="parseOptions">parse options</param>
/// <param name="token">cancellation cancellationToken</param>
/// <param name="timeout">
/// <para>maximum time allowed to preparse the media. If -1, the</para>
/// <para>default &quot;preparse-timeout&quot; option will be used as a timeout. If 0, it will</para>
......@@ -606,9 +595,71 @@ namespace VideoLAN.LibVLC
/// <para>libvlc_media_parse_flag_t</para>
/// <para>LibVLC 3.0.0 or later</para>
/// </remarks>
public bool ParseWithOptions(MediaParseOptions parseOptions, int timeout = -1)
public Task<bool> ParseAsyncWithOptions(MediaParseOptions parseOptions = MediaParseOptions.ParseLocal, CancellationToken cancellationToken = default(CancellationToken),
int timeout = -1)
{
return Internal.LibVLCMediaParseWithOptions(NativeReference, parseOptions, timeout) != 0;
return ParseAsyncWithOptionsInternal(() =>
Native.LibVLCMediaParseWithOptions(NativeReference, parseOptions, 0) != 0, cancellationToken, timeout);
}
TaskCompletionSource<bool> _tcs;
async Task<bool> ParseAsyncWithOptionsInternal(Func<bool> nativeCall, CancellationToken cancellationToken, int timeout)
{
try
{
if (cancellationToken.IsCancellationRequested)
cancellationToken.ThrowIfCancellationRequested();
_tcs = new TaskCompletionSource<bool>();
var timeoutToken = new CancellationTokenSource(timeout);
EventManager.ParsedChanged += OnParsedChanged;
cancellationToken.Register(() =>
{
EventManager.ParsedChanged -= OnParsedChanged;
Native.LibVLCMediaParseStop(NativeReference);
_tcs?.TrySetCanceled();
});
timeoutToken.Token.Register(() =>
{
EventManager.ParsedChanged -= OnParsedChanged;
Native.LibVLCMediaParseStop(NativeReference);
_tcs?.TrySetCanceled();
});
var result = nativeCall();
}
catch (OperationCanceledException)
{
_tcs?.TrySetCanceled();
return false;
}
catch (Exception ex)
{
_tcs?.TrySetException(ex);
return false;
}
finally
{
}
//EventManager.ParsedChanged -= OnParsedChanged;
if (_tcs == null)
return false;
return await _tcs.Task;
}
void OnParsedChanged(object sender, MediaParsedChangedEventArgs mediaParsedChangedEventArgs)
{
if (ParsedStatus == MediaParsedStatus.Done)
_tcs?.TrySetResult(true);
else if (ParsedStatus == MediaParsedStatus.Failed)
_tcs?.TrySetException(new VLCException($"parsing of {this} failed"));
else _tcs?.TrySetResult(false);
EventManager.ParsedChanged -= OnParsedChanged;
}
/// <summary>Get Parsed status for media descriptor object.</summary>
......@@ -618,7 +669,7 @@ namespace VideoLAN.LibVLC
/// <para>libvlc_media_parsed_status_t</para>
/// <para>LibVLC 3.0.0 or later</para>
/// </remarks>
public MediaParsedStatus ParsedStatus => Internal.LibVLCMediaGetParsedStatus(NativeReference);
public MediaParsedStatus ParsedStatus => Native.LibVLCMediaGetParsedStatus(NativeReference);
/// <summary>Stop the parsing of the media</summary>
/// <remarks>
......@@ -627,10 +678,7 @@ namespace VideoLAN.LibVLC
/// <para>libvlc_media_parse_with_options</para>
/// <para>LibVLC 3.0.0 or later</para>
/// </remarks>
public void ParseStop()
{
Internal.LibVLCMediaParseStop(NativeReference);
}
public void ParseStop() => Native.LibVLCMediaParseStop(NativeReference);
// TODO: Whats userData?
//public IntPtr UserData
......@@ -655,7 +703,7 @@ namespace VideoLAN.LibVLC
get
{
var arrayResultPtr = IntPtr.Zero;
var count = Internal.LibVLCMediaTracksGet(NativeReference, ref arrayResultPtr);
var count = Native.LibVLCMediaTracksGet(NativeReference, ref arrayResultPtr);
if (count == 0 || arrayResultPtr == IntPtr.Zero) return Enumerable.Empty<MediaTrack>();
var tracks = new List<MediaTrack>();
......@@ -667,7 +715,7 @@ namespace VideoLAN.LibVLC
}
Internal.LibVLCMediaTracksRelease(arrayResultPtr, count);
Native.LibVLCMediaTracksRelease(arrayResultPtr, count);
return tracks;
}
......@@ -683,12 +731,12 @@ namespace VideoLAN.LibVLC
{
get
{
var ptr = Internal.LibVLCMediaSubitems(NativeReference);
return new MediaList(ptr);
var ptr = Native.LibVLCMediaSubitems(NativeReference);
return new MediaList(ptr); //should cache MediaList C# object.
}
}
public MediaType Type => Internal.LibVLCMediaGetType(NativeReference);
public MediaType Type => Native.LibVLCMediaGetType(NativeReference);
/// <summary>Add a slave to the current media.</summary>
/// <param name="type">subtitle or audio</param>
......@@ -703,20 +751,18 @@ namespace VideoLAN.LibVLC
/// <para>libvlc_media_player_play())</para>
/// <para>LibVLC 3.0.0 and later.</para>
/// </remarks>
public bool AddSlave(MediaSlaveType type, uint priority, string uri)
{
return Internal.LibVLCMediaAddSlaves(NativeReference, type, priority, uri) != 0;
}
[LibVLC(3)]
public bool AddSlave(MediaSlaveType type, uint priority, string uri) =>
Native.LibVLCMediaAddSlaves(NativeReference, type, priority, uri) != 0;
/// <summary>
/// <para>Clear all slaves previously added by libvlc_media_slaves_add() or</para>
/// <para>internally.</para>
/// </summary>
/// <remarks>LibVLC 3.0.0 and later.</remarks>
public void ClearSlaves()
{
Internal.LibVLCMediaClearSlaves(NativeReference);
}
[LibVLC(3)]
public void ClearSlaves() => Native.LibVLCMediaClearSlaves(NativeReference);
/// <summary>Get a media descriptor's slave list</summary>
/// <para>address to store an allocated array of slaves (must be</para>
......@@ -729,12 +775,13 @@ namespace VideoLAN.LibVLC
/// <para>LibVLC 3.0.0 and later.</para>
/// <para>libvlc_media_slaves_add</para>
/// </remarks>
[LibVLC(3)]
public IEnumerable<MediaSlave> Slaves
{
get
{
var slaveArrayPtr = IntPtr.Zero;
var count = Internal.LibVLCMediaGetSlaves(NativeReference, ref slaveArrayPtr);
var count = Native.LibVLCMediaGetSlaves(NativeReference, ref slaveArrayPtr);
if (count == 0) return Enumerable.Empty<MediaSlave>();
var slaves = new List<MediaSlave>();
......@@ -744,21 +791,11 @@ namespace VideoLAN.LibVLC
var managedStruct = Marshal.PtrToStructure<MediaSlave>(ptr);
slaves.Add(managedStruct);
}
Internal.LibVLCMediaReleaseSlaves(slaveArrayPtr, count);
Native.LibVLCMediaReleaseSlaves(slaveArrayPtr, count);
return slaves;
}
}
public void Dispose()
{
if (NativeReference == IntPtr.Zero)
return;
Internal.LibVLCMediaRelease(NativeReference);
NativeReference = IntPtr.Zero;
}
public override bool Equals(object obj)
{
return obj is Media media &&
......@@ -892,7 +929,7 @@ namespace VideoLAN.LibVLC
void Retain()
{
if(NativeReference != IntPtr.Zero)
Internal.LibVLCMediaRetain(NativeReference);
Native.LibVLCMediaRetain(NativeReference);
}
#endregion
......@@ -1013,5 +1050,107 @@ namespace VideoLAN.LibVLC
public SubtitleTrack Subtitle;
}
public enum VLCState
{
NothingSpecial = 0,
Opening = 1,
Buffering = 2,
Playing = 3,
Paused = 4,
Stopped = 5,
Ended = 6,
Error = 7
}
/// <summary>Type of a media slave: subtitle or audio.</summary>
public enum MediaSlaveType
{
Subtitle = 0,
Audio = 1
}
public enum TrackType
{
Unknown = -1,
Audio = 0,
Video = 1,
Text = 2
}
// /// <summary>Viewpoint for video outputs</summary>
// /// <remarks>allocate using libvlc_video_new_viewpoint()</remarks>
[StructLayout(LayoutKind.Sequential)]
public struct VideoViewpoint
{
public float Yaw;
public float Pitch;
public float Roll;
public float Fov;
}
public struct AudioTrack
{
public uint Channels;
public uint Rate;
}
public struct VideoTrack
{
public uint Height;
public uint Width;
public uint SarNum;
public uint SarDen;
public uint FrameRateNum;
public uint FrameRateDen;
public VideoOrientation Orientation;
public VideoProjection Projection;
public VideoViewpoint Pose;
}
public struct SubtitleTrack
{
public IntPtr Encoding;
}
public enum VideoOrientation
{
/// <summary>Normal. Top line represents top, left column left.</summary>
TopLeft = 0,
/// <summary>Flipped horizontally</summary>
TopRight = 1,
/// <summary>Flipped vertically</summary>
BottomLeft = 2,
/// <summary>Rotated 180 degrees</summary>
BottomRight = 3,
/// <summary>Transposed</summary>
LeftTop = 4,
/// <summary>Rotated 90 degrees clockwise (or 270 anti-clockwise)</summary>
LeftBottom = 5,
/// <summary>Rotated 90 degrees anti-clockwise</summary>
RightTop = 6,
/// <summary>Anti-transposed</summary>
RightBottom = 7
}
[Flags]
public enum VideoProjection
{
Rectangular = 0,
/// <summary>360 spherical</summary>
Equirectangular = 1,
CubemapLayoutStandard = 256
}
/// <summary>A slave of a libvlc_media_t</summary>
/// <remarks>libvlc_media_slaves_get</remarks>
public struct MediaSlave
{
public IntPtr Uri;
public MediaSlaveType Type;
public uint Priority;
}
#endregion
}
// ----------------------------------------------------------------------------
// <auto-generated>
// This is autogenerated code by CppSharp.
// Do not edit this file or all your changes will be lost after re-generation.
// </auto-generated>
// ----------------------------------------------------------------------------
using System;
using System.Runtime.InteropServices;
using System.Security;
namespace VideoLAN.LibVLC
{
public enum TrackType
{
Unknown = -1,
Audio = 0,
Video = 1,
Text = 2
}
/// <summary>Note the order of libvlc_state_t enum must match exactly the order of</summary>
/// <remarks>
/// <para>mediacontrol_PlayerStatus,</para>
/// <para>input_state_e enums,</para>
/// <para>and VideoLAN.LibVLC.State (at bindings/cil/src/media.cs).</para>
/// <para>Expected states by web plugins are:</para>
/// <para>IDLE/CLOSE=0, OPENING=1, PLAYING=3, PAUSED=4,</para>
/// <para>STOPPING=5, ENDED=6, ERROR=7</para>
/// </remarks>
public enum VLCState
{
NothingSpecial = 0,
Opening = 1,
Buffering = 2,
Playing = 3,
Paused = 4,
Stopped = 5,
Ended = 6,
Error = 7
}
[Flags]
public enum MediaOption
{
Trusted = 2,
Unique = 256
}
public enum VideoOrientation
{
/// <summary>Normal. Top line represents top, left column left.</summary>
TopLeft = 0,
/// <summary>Flipped horizontally</summary>
TopRight = 1,
/// <summary>Flipped vertically</summary>
BottomLeft = 2,
/// <summary>Rotated 180 degrees</summary>
BottomRight = 3,
/// <summary>Transposed</summary>
LeftTop = 4,
/// <summary>Rotated 90 degrees clockwise (or 270 anti-clockwise)</summary>
LeftBottom = 5,
/// <summary>Rotated 90 degrees anti-clockwise</summary>
RightTop = 6,
/// <summary>Anti-transposed</summary>
RightBottom = 7
}
[Flags]
public enum VideoProjection
{
Rectangular = 0,
/// <summary>360 spherical</summary>
Equirectangular = 1,
CubemapLayoutStandard = 256
}
//// ----------------------------------------------------------------------------
//// <auto-generated>
//// This is autogenerated code by CppSharp.
//// Do not edit this file or all your changes will be lost after re-generation.
//// </auto-generated>
//// ----------------------------------------------------------------------------
//using System;
//using System.Runtime.InteropServices;
//using System.Security;
//namespace VideoLAN.LibVLC
//{
// /// <summary>Note the order of libvlc_state_t enum must match exactly the order of</summary>
// /// <remarks>
// /// <para>mediacontrol_PlayerStatus,</para>
// /// <para>input_state_e enums,</para>
// /// <para>and VideoLAN.LibVLC.State (at bindings/cil/src/media.cs).</para>
// /// <para>Expected states by web plugins are:</para>
// /// <para>IDLE/CLOSE=0, OPENING=1, PLAYING=3, PAUSED=4,</para>
// /// <para>STOPPING=5, ENDED=6, ERROR=7</para>
// /// </remarks>
// [Flags]
// public enum MediaOption
// {
// Trusted = 2,
// Unique = 256
// }
/// <summary>Type of a media slave: subtitle or audio.</summary>
public enum MediaSlaveType
{
Subtitle = 0,
Audio = 1
}
//public unsafe partial class Media
//{
// [StructLayout(LayoutKind.Explicit, Size = 0)]
// public partial struct __Internal
// {
// }
// 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>();
// protected void*[] __OriginalVTables;
// protected bool __ownsNativeInstance;
// internal static global::VideoLAN.LibVLC.Media __CreateInstance(global::System.IntPtr native, bool skipVTables = false)
// {
// return new global::VideoLAN.LibVLC.Media(native.ToPointer(), skipVTables);
// }
// internal static global::VideoLAN.LibVLC.Media __CreateInstance(global::VideoLAN.LibVLC.Media.__Internal native, bool skipVTables = false)
// {
// return new global::VideoLAN.LibVLC.Media(native, skipVTables);
// }
// private static void* __CopyValue(global::VideoLAN.LibVLC.Media.__Internal native)
// {
// var ret = Marshal.AllocHGlobal(sizeof(global::VideoLAN.LibVLC.Media.__Internal));
// *(global::VideoLAN.LibVLC.Media.__Internal*) ret = native;
// return ret.ToPointer();
// }
// private Media(global::VideoLAN.LibVLC.Media.__Internal native, bool skipVTables = false)
// : this(__CopyValue(native), skipVTables)
// {
// __ownsNativeInstance = true;
// NativeToManagedMap[NativeReference] = this;
// }
// protected Media(void* native, bool skipVTables = false)
// {
// if (native == null)
// return;
// NativeReference = new global::System.IntPtr(native);
// }
//}
// //public unsafe partial class Media
// //{
// // [StructLayout(LayoutKind.Explicit, Size = 0)]
// // public partial struct __Internal
// // {
// // }
// // 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>();
// // protected void*[] __OriginalVTables;
// // protected bool __ownsNativeInstance;
// // internal static global::VideoLAN.LibVLC.Media __CreateInstance(global::System.IntPtr native, bool skipVTables = false)
// // {
// // return new global::VideoLAN.LibVLC.Media(native.ToPointer(), skipVTables);
// // }
// // internal static global::VideoLAN.LibVLC.Media __CreateInstance(global::VideoLAN.LibVLC.Media.__Internal native, bool skipVTables = false)
// // {
// // return new global::VideoLAN.LibVLC.Media(native, skipVTables);
// // }
// // private static void* __CopyValue(global::VideoLAN.LibVLC.Media.__Internal native)
// // {
// // var ret = Marshal.AllocHGlobal(sizeof(global::VideoLAN.LibVLC.Media.__Internal));
// // *(global::VideoLAN.LibVLC.Media.__Internal*) ret = native;
// // return ret.ToPointer();
// // }
// // private Media(global::VideoLAN.LibVLC.Media.__Internal native, bool skipVTables = false)
// // : this(__CopyValue(native), skipVTables)
// // {
// // __ownsNativeInstance = true;
// // NativeToManagedMap[NativeReference] = this;
// // }
// // protected Media(void* native, bool skipVTables = false)
// // {
// // if (native == null)
// // return;
// // NativeReference = new global::System.IntPtr(native);
// // }
// //}
public unsafe partial class MediaTrackInfo : IDisposable
{
[StructLayout(LayoutKind.Explicit, Size = 28)]
public partial struct __Internal
{
[FieldOffset(0)]
internal uint i_codec;
[FieldOffset(4)]
internal int i_id;
[FieldOffset(8)]
internal global::VideoLAN.LibVLC.TrackType i_type;
[FieldOffset(12)]
internal int i_profile;
[FieldOffset(16)]
internal int i_level;
[FieldOffset(20)]
internal global::VideoLAN.LibVLC.MediaTrackInfo._.__Internal u;
[SuppressUnmanagedCodeSecurity]
[DllImport("libvlc", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="??0libvlc_media_track_info_t@@QEAA@AEBU0@@Z")]
internal static extern global::System.IntPtr cctor(global::System.IntPtr instance, global::System.IntPtr _0);
}
public unsafe partial struct _
{
[StructLayout(LayoutKind.Explicit, Size = 8)]
public partial struct __Internal
{
[FieldOffset(0)]
internal global::VideoLAN.LibVLC.MediaTrackInfo._.__.__Internal audio;
[FieldOffset(0)]
internal global::VideoLAN.LibVLC.MediaTrackInfo._.___.__Internal video;
}
public unsafe partial class __
{
[StructLayout(LayoutKind.Explicit, Size = 8)]
public partial struct __Internal
{
[FieldOffset(0)]
internal uint i_channels;
[FieldOffset(4)]
internal uint i_rate;
}
}
public unsafe partial class ___
{
[StructLayout(LayoutKind.Explicit, Size = 8)]
public partial struct __Internal
{
[FieldOffset(0)]
internal uint i_height;
[FieldOffset(4)]
internal uint i_width;
}
}
}
public global::System.IntPtr __Instance { get; protected set; }
protected int __PointerAdjustment;
internal static readonly global::System.Collections.Concurrent.ConcurrentDictionary<IntPtr, global::VideoLAN.LibVLC.MediaTrackInfo> NativeToManagedMap = new global::System.Collections.Concurrent.ConcurrentDictionary<IntPtr, global::VideoLAN.LibVLC.MediaTrackInfo>();
protected void*[] __OriginalVTables;
protected bool __ownsNativeInstance;
internal static global::VideoLAN.LibVLC.MediaTrackInfo __CreateInstance(global::System.IntPtr native, bool skipVTables = false)
{
return new global::VideoLAN.LibVLC.MediaTrackInfo(native.ToPointer(), skipVTables);
}
internal static global::VideoLAN.LibVLC.MediaTrackInfo __CreateInstance(global::VideoLAN.LibVLC.MediaTrackInfo.__Internal native, bool skipVTables = false)
{
return new global::VideoLAN.LibVLC.MediaTrackInfo(native, skipVTables);
}
private static void* __CopyValue(global::VideoLAN.LibVLC.MediaTrackInfo.__Internal native)
{
var ret = Marshal.AllocHGlobal(sizeof(global::VideoLAN.LibVLC.MediaTrackInfo.__Internal));
*(global::VideoLAN.LibVLC.MediaTrackInfo.__Internal*) ret = native;
return ret.ToPointer();
}
private MediaTrackInfo(global::VideoLAN.LibVLC.MediaTrackInfo.__Internal native, bool skipVTables = false)
: this(__CopyValue(native), skipVTables)
{
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
protected MediaTrackInfo(void* native, bool skipVTables = false)
{
if (native == null)
return;
__Instance = new global::System.IntPtr(native);
}
public MediaTrackInfo()
{
__Instance = Marshal.AllocHGlobal(sizeof(global::VideoLAN.LibVLC.MediaTrackInfo.__Internal));
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
public MediaTrackInfo(global::VideoLAN.LibVLC.MediaTrackInfo _0)
{
__Instance = Marshal.AllocHGlobal(sizeof(global::VideoLAN.LibVLC.MediaTrackInfo.__Internal));
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
*((global::VideoLAN.LibVLC.MediaTrackInfo.__Internal*) __Instance) = *((global::VideoLAN.LibVLC.MediaTrackInfo.__Internal*) _0.__Instance);
}
public void Dispose()
{
Dispose(disposing: true);
}
public virtual void Dispose(bool disposing)
{
if (__Instance == IntPtr.Zero)
return;
global::VideoLAN.LibVLC.MediaTrackInfo __dummy;
NativeToManagedMap.TryRemove(__Instance, out __dummy);
if (__ownsNativeInstance)
Marshal.FreeHGlobal(__Instance);
__Instance = IntPtr.Zero;
}
public uint ICodec
{
get
{
return ((global::VideoLAN.LibVLC.MediaTrackInfo.__Internal*) __Instance)->i_codec;
}
set
{
((global::VideoLAN.LibVLC.MediaTrackInfo.__Internal*) __Instance)->i_codec = value;
}
}
public int IId
{
get
{
return ((global::VideoLAN.LibVLC.MediaTrackInfo.__Internal*) __Instance)->i_id;
}
set
{
((global::VideoLAN.LibVLC.MediaTrackInfo.__Internal*) __Instance)->i_id = value;
}
}
public global::VideoLAN.LibVLC.TrackType IType
{
get
{
return ((global::VideoLAN.LibVLC.MediaTrackInfo.__Internal*) __Instance)->i_type;
}
set
{
((global::VideoLAN.LibVLC.MediaTrackInfo.__Internal*) __Instance)->i_type = value;
}
}
public int IProfile
{
get
{
return ((global::VideoLAN.LibVLC.MediaTrackInfo.__Internal*) __Instance)->i_profile;
}
set
{
((global::VideoLAN.LibVLC.MediaTrackInfo.__Internal*) __Instance)->i_profile = value;
}
}
public int ILevel
{
get
{
return ((global::VideoLAN.LibVLC.MediaTrackInfo.__Internal*) __Instance)->i_level;
}
set
{
((global::VideoLAN.LibVLC.MediaTrackInfo.__Internal*) __Instance)->i_level = value;
}
}
}
public struct AudioTrack
{
public uint Channels;
public uint Rate;
}
public struct VideoTrack
{
public uint Height;
public uint Width;
public uint SarNum;
public uint SarDen;
public uint FrameRateNum;
public uint FrameRateDen;
public VideoOrientation Orientation;
public VideoProjection Projection;
public VideoViewpoint Pose;
}
/// <summary>Viewpoint for video outputs</summary>
/// <remarks>allocate using libvlc_video_new_viewpoint()</remarks>
[StructLayout(LayoutKind.Sequential)]
public struct VideoViewpoint
{
public float Yaw;
public float Pitch;
public float Roll;
public float Fov;
}
public struct SubtitleTrack
{
public IntPtr Encoding;
}
// public unsafe partial class MediaTrackInfo : IDisposable
// {
// [StructLayout(LayoutKind.Explicit, Size = 28)]
// public partial struct __Internal
// {
// [FieldOffset(0)]
// internal uint i_codec;
// [FieldOffset(4)]
// internal int i_id;
// [FieldOffset(8)]
// internal global::VideoLAN.LibVLC.TrackType i_type;
// [FieldOffset(12)]
// internal int i_profile;
// [FieldOffset(16)]
// internal int i_level;
// [FieldOffset(20)]
// internal global::VideoLAN.LibVLC.MediaTrackInfo._.__Internal u;
// [SuppressUnmanagedCodeSecurity]
// [DllImport("libvlc", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
// EntryPoint="??0libvlc_media_track_info_t@@QEAA@AEBU0@@Z")]
// internal static extern global::System.IntPtr cctor(global::System.IntPtr instance, global::System.IntPtr _0);
// }
// public unsafe partial struct _
// {
// [StructLayout(LayoutKind.Explicit, Size = 8)]
// public partial struct __Internal
// {
// [FieldOffset(0)]
// internal global::VideoLAN.LibVLC.MediaTrackInfo._.__.__Internal audio;
// [FieldOffset(0)]
// internal global::VideoLAN.LibVLC.MediaTrackInfo._.___.__Internal video;
// }
// public unsafe partial class __
// {
// [StructLayout(LayoutKind.Explicit, Size = 8)]
// public partial struct __Internal
// {
// [FieldOffset(0)]
// internal uint i_channels;
// [FieldOffset(4)]
// internal uint i_rate;
// }
// }
// public unsafe partial class ___
// {
// [StructLayout(LayoutKind.Explicit, Size = 8)]
// public partial struct __Internal
// {
// [FieldOffset(0)]
// internal uint i_height;
// [FieldOffset(4)]
// internal uint i_width;
// }
// }
// }
// public global::System.IntPtr __Instance { get; protected set; }
// protected int __PointerAdjustment;
// internal static readonly global::System.Collections.Concurrent.ConcurrentDictionary<IntPtr, global::VideoLAN.LibVLC.MediaTrackInfo> NativeToManagedMap = new global::System.Collections.Concurrent.ConcurrentDictionary<IntPtr, global::VideoLAN.LibVLC.MediaTrackInfo>();
// protected void*[] __OriginalVTables;
// protected bool __ownsNativeInstance;
// internal static global::VideoLAN.LibVLC.MediaTrackInfo __CreateInstance(global::System.IntPtr native, bool skipVTables = false)
// {
// return new global::VideoLAN.LibVLC.MediaTrackInfo(native.ToPointer(), skipVTables);
// }
// internal static global::VideoLAN.LibVLC.MediaTrackInfo __CreateInstance(global::VideoLAN.LibVLC.MediaTrackInfo.__Internal native, bool skipVTables = false)
// {
// return new global::VideoLAN.LibVLC.MediaTrackInfo(native, skipVTables);
// }
// private static void* __CopyValue(global::VideoLAN.LibVLC.MediaTrackInfo.__Internal native)
// {
// var ret = Marshal.AllocHGlobal(sizeof(global::VideoLAN.LibVLC.MediaTrackInfo.__Internal));
// *(global::VideoLAN.LibVLC.MediaTrackInfo.__Internal*) ret = native;
// return ret.ToPointer();
// }
// private MediaTrackInfo(global::VideoLAN.LibVLC.MediaTrackInfo.__Internal native, bool skipVTables = false)
// : this(__CopyValue(native), skipVTables)
// {
// __ownsNativeInstance = true;
// NativeToManagedMap[__Instance] = this;
// }
// protected MediaTrackInfo(void* native, bool skipVTables = false)
// {
// if (native == null)
// return;
// __Instance = new global::System.IntPtr(native);
// }
// public MediaTrackInfo()
// {
// __Instance = Marshal.AllocHGlobal(sizeof(global::VideoLAN.LibVLC.MediaTrackInfo.__Internal));
// __ownsNativeInstance = true;
// NativeToManagedMap[__Instance] = this;
// }
// public MediaTrackInfo(global::VideoLAN.LibVLC.MediaTrackInfo _0)
// {
// __Instance = Marshal.AllocHGlobal(sizeof(global::VideoLAN.LibVLC.MediaTrackInfo.__Internal));
// __ownsNativeInstance = true;
// NativeToManagedMap[__Instance] = this;
// *((global::VideoLAN.LibVLC.MediaTrackInfo.__Internal*) __Instance) = *((global::VideoLAN.LibVLC.MediaTrackInfo.__Internal*) _0.__Instance);
// }
// public void Dispose()
// {
// Dispose(disposing: true);
// }
// public virtual void Dispose(bool disposing)
// {
// if (__Instance == IntPtr.Zero)
// return;
// global::VideoLAN.LibVLC.MediaTrackInfo __dummy;
// NativeToManagedMap.TryRemove(__Instance, out __dummy);
// if (__ownsNativeInstance)
// Marshal.FreeHGlobal(__Instance);
// __Instance = IntPtr.Zero;
// }
// public uint ICodec
// {
// get
// {
// return ((global::VideoLAN.LibVLC.MediaTrackInfo.__Internal*) __Instance)->i_codec;
// }
// set
// {
// ((global::VideoLAN.LibVLC.MediaTrackInfo.__Internal*) __Instance)->i_codec = value;
// }
// }
// public int IId
// {
// get
// {
// return ((global::VideoLAN.LibVLC.MediaTrackInfo.__Internal*) __Instance)->i_id;
// }
// set
// {
// ((global::VideoLAN.LibVLC.MediaTrackInfo.__Internal*) __Instance)->i_id = value;
// }
// }
// public global::VideoLAN.LibVLC.TrackType IType
// {
// get
// {
// return ((global::VideoLAN.LibVLC.MediaTrackInfo.__Internal*) __Instance)->i_type;
// }
// set
// {
// ((global::VideoLAN.LibVLC.MediaTrackInfo.__Internal*) __Instance)->i_type = value;
// }
// }
// public int IProfile
// {
// get
// {
// return ((global::VideoLAN.LibVLC.MediaTrackInfo.__Internal*) __Instance)->i_profile;
// }
// set
// {
// ((global::VideoLAN.LibVLC.MediaTrackInfo.__Internal*) __Instance)->i_profile = value;
// }
// }
// public int ILevel
// {
// get
// {
// return ((global::VideoLAN.LibVLC.MediaTrackInfo.__Internal*) __Instance)->i_level;
// }
// set
// {
// ((global::VideoLAN.LibVLC.MediaTrackInfo.__Internal*) __Instance)->i_level = value;
// }
// }
// }
/// <summary>A slave of a libvlc_media_t</summary>
/// <remarks>libvlc_media_slaves_get</remarks>
public struct MediaSlave
{
public IntPtr Uri;
public MediaSlaveType Type;
public uint Priority;
}
public unsafe partial class libvlc_media
{
public partial struct __Internal
{
[SuppressUnmanagedCodeSecurity]
[DllImport("libvlc", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="libvlc_media_get_codec_description")]
internal static extern global::System.IntPtr LibvlcMediaGetCodecDescription(global::VideoLAN.LibVLC.TrackType i_type, uint i_codec);
}
// public unsafe partial class libvlc_media
// {
///// <summary>
///// <para>Retain a reference to a media descriptor object (libvlc_media_t). Use</para>
///// <para>libvlc_media_release() to decrement the reference count of a</para>
///// <para>media descriptor object.</para>
///// </summary>
///// <param name="p_md">the media descriptor</param>
//public static void LibvlcMediaRetain(global::VideoLAN.LibVLC.Media p_md)
//{
// var __arg0 = ReferenceEquals(p_md, null) ? global::System.IntPtr.Zero : p_md.NativeReference;
// __Internal.LibvlcMediaRetain(__arg0);
//}
/// <summary>
/// <para>Sets media descriptor's user_data. user_data is specialized data</para>
/// <para>accessed by the host application, VLC.framework uses it as a pointer to</para>
/// <para>an native object that references a libvlc_media_t pointer</para>
/// </summary>
/// <param name="p_md">media descriptor object</param>
/// <param name="p_new_user_data">pointer to user data</param>
//public static void LibvlcMediaSetUserData(global::VideoLAN.LibVLC.Media p_md, global::System.IntPtr p_new_user_data)
//{
// var __arg0 = ReferenceEquals(p_md, null) ? global::System.IntPtr.Zero : p_md.NativeReference;
// __Internal.LibvlcMediaSetUserData(__arg0, p_new_user_data);
//}
///// <summary>
///// <para>Get media descriptor's user_data. user_data is specialized data</para>
///// <para>accessed by the host application, VLC.framework uses it as a pointer to</para>
///// <para>an native object that references a libvlc_media_t pointer</para>
///// </summary>
///// <param name="p_md">media descriptor object</param>
//public static global::System.IntPtr LibvlcMediaGetUserData(global::VideoLAN.LibVLC.Media p_md)
//{
// var __arg0 = ReferenceEquals(p_md, null) ? global::System.IntPtr.Zero : p_md.NativeReference;
// var __ret = __Internal.LibvlcMediaGetUserData(__arg0);
// return __ret;
//}
// /// <summary>
// /// <para>Sets media descriptor's user_data. user_data is specialized data</para>
// /// <para>accessed by the host application, VLC.framework uses it as a pointer to</para>
// /// <para>an native object that references a libvlc_media_t pointer</para>
// /// </summary>
// /// <param name="p_md">media descriptor object</param>
// /// <param name="p_new_user_data">pointer to user data</param>
// //public static void LibvlcMediaSetUserData(global::VideoLAN.LibVLC.Media p_md, global::System.IntPtr p_new_user_data)
// //{
// // var __arg0 = ReferenceEquals(p_md, null) ? global::System.IntPtr.Zero : p_md.NativeReference;
// // __Internal.LibvlcMediaSetUserData(__arg0, p_new_user_data);
// //}
// ///// <summary>
// ///// <para>Get media descriptor's user_data. user_data is specialized data</para>
// ///// <para>accessed by the host application, VLC.framework uses it as a pointer to</para>
// ///// <para>an native object that references a libvlc_media_t pointer</para>
// ///// </summary>
// ///// <param name="p_md">media descriptor object</param>
// //public static global::System.IntPtr LibvlcMediaGetUserData(global::VideoLAN.LibVLC.Media p_md)
// //{
// // var __arg0 = ReferenceEquals(p_md, null) ? global::System.IntPtr.Zero : p_md.NativeReference;
// // var __ret = __Internal.LibvlcMediaGetUserData(__arg0);
// // return __ret;
// //}
/// <summary>Get codec description from media elementary stream</summary>
/// <param name="i_type">i_type from libvlc_media_track_t</param>
/// <param name="i_codec">i_codec or i_original_fourcc from libvlc_media_track_t</param>
/// <returns>codec description</returns>
/// <remarks>
/// <para>LibVLC 3.0.0 and later.</para>
/// <para>libvlc_media_track_t</para>
/// </remarks>
public static string LibvlcMediaGetCodecDescription(global::VideoLAN.LibVLC.TrackType i_type, uint i_codec)
{
var __ret = __Internal.LibvlcMediaGetCodecDescription(i_type, i_codec);
return Marshal.PtrToStringAnsi(__ret);
}
// /// <summary>Get codec description from media elementary stream</summary>
// /// <param name="i_type">i_type from libvlc_media_track_t</param>
// /// <param name="i_codec">i_codec or i_original_fourcc from libvlc_media_track_t</param>
// /// <returns>codec description</returns>
// /// <remarks>
// /// <para>LibVLC 3.0.0 and later.</para>
// /// <para>libvlc_media_track_t</para>
// /// </remarks>
// public static string LibvlcMediaGetCodecDescription(global::VideoLAN.LibVLC.TrackType i_type, uint i_codec)
// {
// var __ret = __Internal.LibvlcMediaGetCodecDescription(i_type, i_codec);
// return Marshal.PtrToStringAnsi(__ret);
// }
......@@ -473,5 +357,5 @@ namespace VideoLAN.LibVLC
}
}
// }
//}