3 * @brief Media descriptor class
7 /**********************************************************************
8 * Copyright (C) 2007-2009 RĂ©mi Denis-Courmont. *
9 * This program is free software; you can redistribute and/or modify *
10 * it under the terms of the GNU General Public License as published *
11 * by the Free Software Foundation; version 2 of the license, or (at *
12 * your option) any later version. *
14 * This program is distributed in the hope that it will be useful, *
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
17 * See the GNU General Public License for more details. *
19 * You should have received a copy of the GNU General Public License *
20 * along with this program; if not, you can get it from: *
21 * http://www.gnu.org/copyleft/gpl.html *
22 **********************************************************************/
25 //using System.Collections.Generic;
26 using System.Runtime.InteropServices;
28 namespace VideoLAN.LibVLC
31 * @brief MediaHandle: unmanaged LibVLC media pointer
34 internal sealed class MediaHandle : NonNullHandle
36 [DllImport ("libvlc.dll",
37 EntryPoint="libvlc_media_new")]
39 MediaHandle Create (InstanceHandle inst, U8String mrl,
42 [DllImport ("libvlc.dll",
43 EntryPoint="libvlc_media_release")]
44 private static extern void Release (IntPtr ptr);
46 [DllImport ("libvlc.dll",
47 EntryPoint="libvlc_media_add_option")]
48 public static extern void AddOption (MediaHandle ptr, U8String options,
51 [DllImport ("libvlc.dll",
52 EntryPoint="libvlc_media_add_option_untrusted")]
53 public static extern void AddUntrustedOption (MediaHandle ptr,
57 protected override void Destroy ()
64 * @brief Media: a source media
65 * Use this class to extract meta-informations from a media.
67 public class Media : BaseObject
69 internal MediaHandle Handle
73 return handle as MediaHandle;
78 * Creates a Media object.
80 * @param instance VLC instance
81 * @param mrl Media Resource Locator (file path or URL)
83 public Media (VLC instance, string mrl)
85 U8String umrl = new U8String (mrl);
87 handle = MediaHandle.Create (instance.Handle, umrl, ex);
91 public void AddOptions (string options, bool trusted)
93 U8String uopts = new U8String (options);
96 MediaHandle.AddOption (Handle, uopts, ex);
98 MediaHandle.AddUntrustedOption (Handle, uopts, ex);