]> git.sesse.net Git - vlc/blobdiff - bindings/cil/src/libvlc.cs
Cleanup instance and media class
[vlc] / bindings / cil / src / libvlc.cs
index 4625472ecb5a6920fd6fc7965efb920bb27dfc7a..6f66b583ee6ee0d60bc192d20c04312758935f7e 100644 (file)
@@ -1,11 +1,7 @@
 /**
  * @file libvlc.cs
- * @brief Bindings to LibVLC for the .NET Common Intermediate Language
- * @ingroup API
- *
- * @defgroup API Managed interface to LibVLC
- * This is the primary class library for .NET applications
- * to embed and control LibVLC.
+ * @brief Unmanaged LibVLC APIs
+ * @ingroup Internals
  *
  * @defgroup Internals LibVLC internals
  * This covers internal marshalling functions to use the native LibVLC.
@@ -35,11 +31,12 @@ using System.Runtime.InteropServices;
 namespace VideoLAN.LibVLC
 {
     /**
-     * @brief InstanceHandle: unmanaged LibVLC instance pointer
+     * @brief Native: unmanaged LibVLC APIs
      * @ingroup Internals
      */
-    internal sealed class InstanceHandle : NonNullHandle
+    internal static class LibVLC
     {
+        /* core.c */
         [DllImport ("libvlc.dll", EntryPoint="libvlc_get_version")]
         public static extern IntPtr GetVersion ();
 
@@ -47,139 +44,99 @@ namespace VideoLAN.LibVLC
         public static extern IntPtr GetCompiler ();
 
         [DllImport ("libvlc.dll", EntryPoint="libvlc_get_changeset")]
-        public static extern IntPtr GetChangeSet ();
+        public static extern IntPtr GetChangeset ();
 
         [DllImport ("libvlc.dll", EntryPoint="libvlc_new")]
         public static extern
-        InstanceHandle Create (int argc, U8String[] argv,
-                               NativeException ex);
+        InstanceHandle Create (int argc, U8String[] argv, NativeException ex);
 
         /*[DllImport ("libvlc.dll", EntryPoint="libvlc_retain")]
-        public static extern void Hold (InstanceHandle h,
-                                         NativeException ex);*/
+        public static extern
+        void Retain (InstanceHandle h, NativeException ex);*/
 
         [DllImport ("libvlc.dll", EntryPoint="libvlc_release")]
-        private static extern void Release (IntPtr h,
-                                            NativeException ex);
+        public static extern
+        void Release (IntPtr h, NativeException ex);
 
         [DllImport ("libvlc.dll", EntryPoint="libvlc_add_intf")]
-        public static extern void AddInterface (InstanceHandle h,
-                                                  U8String name,
-                                                  NativeException ex);
+        public static extern
+        void AddIntf (InstanceHandle h, U8String name, NativeException ex);
 
         [DllImport ("libvlc.dll", EntryPoint="libvlc_wait")]
-        public static extern void Run (InstanceHandle h);
+        public static extern
+        void Wait (InstanceHandle h);
 
         [DllImport ("libvlc.dll", EntryPoint="libvlc_get_vlc_instance")]
-        public static extern NonNullHandle GetVLC (InstanceHandle h);
+        public static extern
+        SafeHandle GetVLCInstance (InstanceHandle h);
 
-        protected override void Destroy ()
-        {
-            Release (handle, null);
-        }
-    };
+        /* media.c */
+        [DllImport ("libvlc.dll", EntryPoint="libvlc_media_new")]
+        public static extern
+        MediaHandle MediaCreate (InstanceHandle inst, U8String mrl,
+                                 NativeException ex);
 
-    /**
-     * @brief VLC: VLC media player instance
-     * @ingroup API
-     *
-     * The VLC class provides represent a run-time instance of a media player.
-     * An instance can spawn multiple independent medias, however
-     * configuration settings, message logging, etc are common to all medias
-     * from the same instance.
-     */
-    public class VLC : BaseObject
-    {
-        internal InstanceHandle Handle
-        {
-            get
-            {
-                return handle as InstanceHandle;
-            }
-        }
-
-        /**
-         * Loads the native LibVLC and creates a LibVLC instance.
-         *
-         * @param args VLC command line parameters for the LibVLC Instance.
-         */
-        public VLC (string[] args)
-        {
-            U8String[] argv = new U8String[args.Length];
-            for (int i = 0; i < args.Length; i++)
-                argv[i] = new U8String (args[i]);
-
-            handle = InstanceHandle.Create (argv.Length, argv, ex);
-            Raise ();
-        }
-
-        /**
-         * Starts a VLC interface plugin.
-         *
-         * @param name name of the interface plugin (e.g. "http", "qt4", ...)
-         */
-        public void AddInterface (string name)
-        {
-            U8String uname = new U8String (name);
-
-            InstanceHandle.AddInterface (Handle, uname, ex);
-            Raise ();
-        }
-
-        /**
-         * Waits until VLC instance exits. This can happen if a fatal error
-         * occurs (e.g. cannot parse the arguments), if the user has quit
-         * through an interface, or if the special vlc://quit item was played.
-         */
-        public void Run ()
-        {
-            InstanceHandle.Run (Handle);
-        }
-
-        /**
-         * The human-readable LibVLC version number.
-         */
-        public static string Version
-        {
-            get
-            {
-                return U8String.FromNative (InstanceHandle.GetVersion ());
-            }
-        }
-
-        /**
-         * The human-readable LibVLC C compiler infos.
-         */
-        public static string Compiler
-        {
-            get
-            {
-                return U8String.FromNative (InstanceHandle.GetCompiler ());
-            }
-        }
-
-        /**
-         * The unique commit identifier from the LibVLC source control system,
-         * or "exported" if unknown.
-         */
-        public static string ChangeSet
-        {
-            get
-            {
-                return U8String.FromNative (InstanceHandle.GetChangeSet ());
-            }
-        }
-
-        /**
-         * The unmanaged VLC-internal instance object.
-         * Do not use this unless you really know what you are doing.
-         */
-        public SafeHandle Object
-        {
-            get
-            {
-                return InstanceHandle.GetVLC (Handle);
-            }
-        }
+        [DllImport ("libvlc.dll", EntryPoint="libvlc_media_new_as_node")]
+        public static extern
+        MediaHandle MediaCreateAsNode (InstanceHandle inst, U8String name,
+                                       NativeException ex);
+
+        [DllImport ("libvlc.dll", EntryPoint="libvlc_media_add_option")]
+        public static extern
+        void MediaAddOption (MediaHandle media, U8String options,
+                             NativeException ex);
+
+        [DllImport ("libvlc.dll",
+                    EntryPoint="libvlc_media_add_option_untrusted")]
+        public static extern
+        void MediaAddUntrustedOption (MediaHandle media, U8String options,
+                                      NativeException ex);
+
+        [DllImport ("libvlc.dll", EntryPoint="libvlc_media_release")]
+        public static extern
+        void MediaRelease (IntPtr ptr);
+
+        [DllImport ("libvlc.dll", EntryPoint="libvlc_media_get_mrl")]
+        public static extern
+        void MediaGetMRL (MediaHandle media);
+
+        [DllImport ("libvlc.dll", EntryPoint="libvlc_media_duplicate")]
+        public static extern
+        MediaHandle MediaDuplicate (MediaHandle media);
+
+        /*[DllImport ("libvlc.dll", EntryPoint="libvlc_media_read_meta")]
+        public static extern
+        MediaHandle MediaDuplicate (MediaHandle media, int type,
+                                    NativeException ex);*/
+
+        /*[DllImport ("libvlc.dll", EntryPoint="libvlc_media_get_state")]
+        public static extern
+        int MediaGetState (MediaHandle media, NativeException ex);*/
+
+        /*[DllImport ("libvlc.dll", EntryPoint="libvlc_media_subitems")]
+        public static extern
+        MediaListHandle MediaSubItems (MediaHandle media, NativeException ex);*/
+
+        /*[DllImport ("libvlc.dll", EntryPoint="libvlc_media_get_state")]
+        public static extern
+        EventManagerHandle MediaGetEventManager (MediaHandle media,
+                                                 NativeException ex);*/
+
+        [DllImport ("libvlc.dll", EntryPoint="libvlc_media_get_duration")]
+        public static extern
+        long MediaGetDuration (MediaHandle media, NativeException ex);
+
+        [DllImport ("libvlc.dll", EntryPoint="libvlc_media_is_preparsed")]
+        public static extern
+        int MediaIsPreparsed (MediaHandle media, NativeException ex);
+
+        /*[DllImport ("libvlc.dll", EntryPoint="libvlc_media_set_user_data")]
+        public static extern
+        void MediaIsPreparsed (MediaHandle media, IntPtr data,
+                               NativeException ex);*/
+
+        /*[DllImport ("libvlc.dll", EntryPoint="libvlc_media_get_user_data")]
+        public static extern
+        IntPtr MediaIsPreparsed (MediaHandle media, NativeException ex);*/
     };
 };