Esempio n. 1
0
 /// <summary>
 ///     Returns a list of video filters that are available.
 /// </summary>
 public List <ModuleDescription> GetVideoFilterList()
 {
     using (var list = new ModuleDescriptionList(LibVlcManager
                                                 .GetFunctionDelegate <libvlc_video_filter_list_get>().Invoke(InstancePointer)))
     {
         return(new List <ModuleDescription>(list));
     }
 }
Esempio n. 2
0
 /// <summary>
 ///     Try to start a user interface for the libvlc instance.
 /// </summary>
 /// <param name="name">interface name, or NULL for default</param>
 /// <returns>true on success, false on error.</returns>
 public bool AddInterface(string name)
 {
     using (var handle = new StringHandle(name))
     {
         return(LibVlcManager.GetFunctionDelegate <libvlc_add_intf>()
                .Invoke(InstancePointer, handle.UnsafePointer) == 0);
     }
 }
Esempio n. 3
0
        /// <summary>
        ///     Deattach a event with a callback.
        /// </summary>
        /// <param name="type">event type</param>
        public void Detach(EventType type)
        {
            if (!_attachedEvents.Contains(type))
            {
                return;
            }

            _attachedEvents.Remove(type);
            LibVlcManager.GetFunctionDelegate <libvlc_event_detach>()
            .Invoke(InstancePointer, (libvlc_event_e)type, _onVlcEventFired, null);
        }
Esempio n. 4
0
 /// <summary>
 ///     Sets the application name. LibVLC passes this as the user agent string when a protocol requires it.
 /// </summary>
 /// <param name="name">human-readable application name, e.g. "FooBar player 1.2.3"</param>
 /// <param name="http">HTTP User Agent, e.g. "FooBar/1.2.3 Python/2.6.0"</param>
 public void SetUserAgent(string name, string http)
 {
     using (var nameHandle = new StringHandle(name))
     {
         using (var httpHandle = new StringHandle(http))
         {
             LibVlcManager.GetFunctionDelegate <libvlc_set_user_agent>().Invoke(InstancePointer,
                                                                                nameHandle.UnsafePointer, httpHandle.UnsafePointer);
         }
     }
 }
Esempio n. 5
0
        protected void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            LibVlcManager.GetFunctionDelegate <libvlc_audio_equalizer_release>().Invoke(InstancePointer);
            InstancePointer = null;

            _disposed = true;
        }
Esempio n. 6
0
        protected void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            _onExitHandle.Free();
            VlcObjectManager.Remove(this);
            LibVlcManager.GetFunctionDelegate <libvlc_release>().Invoke(InstancePointer);
            InstancePointer = null;

            _disposed = true;
        }
Esempio n. 7
0
 /// <summary>
 ///     Sets some meta-information about the application.
 /// </summary>
 /// <param name="id">Java-style application identifier, e.g. "com.acme.foobar"</param>
 /// <param name="version">application version numbers, e.g. "1.2.3"</param>
 /// <param name="icon">application icon name, e.g. "foobar"</param>
 public void SetAppId(string id, string version, string icon)
 {
     using (var idHandle = new StringHandle(id))
     {
         using (var versionHandle = new StringHandle(version))
         {
             using (var iconHandle = new StringHandle(icon))
             {
                 LibVlcManager.GetFunctionDelegate <libvlc_set_app_id>().Invoke(InstancePointer,
                                                                                idHandle.UnsafePointer, versionHandle.UnsafePointer, iconHandle.UnsafePointer);
             }
         }
     }
 }
Esempio n. 8
0
        /// <summary>
        ///     Create a Vlc instance by options.
        /// </summary>
        /// <param name="argv"></param>
        /// <exception cref="VlcCreateFailException">Can't create a Vlc instence, check your Vlc options.</exception>
        /// <exception cref="Exception">A delegate callback throws an exception.</exception>
        public Vlc(string[] argv)
        {
            InstancePointer = argv == null
                ? LibVlcManager.GetFunctionDelegate <libvlc_new>().Invoke(0, IntPtr.Zero)
                : LibVlcManager.GetFunctionDelegate <libvlc_new>()
                              .Invoke(argv.Length, InteropHelper.StringArrayToPtr(argv));

            if (InstancePointer == null)
            {
                throw new VlcCreateFailException(VlcError.GetErrorMessage());
            }

            ExitHandler onExit = OnExit;

            _onExitHandle = GCHandle.Alloc(onExit);
            LibVlcManager.GetFunctionDelegate <libvlc_set_exit_handler>().Invoke(InstancePointer, onExit, null);

            VlcObjectManager.Add(this);
        }
Esempio n. 9
0
        private VlcMedia(IVlcObject parentVlcObject, void *pointer)
        {
            VlcInstance     = parentVlcObject.VlcInstance;
            InstancePointer = pointer;
            VlcObjectManager.Add(this);

            EventManager = new VlcEventManager(this,
                                               LibVlcManager.GetFunctionDelegate <libvlc_media_event_manager>().Invoke(InstancePointer));

            EventManager.Attach(EventType.MediaMetaChanged);
            EventManager.Attach(EventType.MediaSubItemAdded);
            EventManager.Attach(EventType.MediaDurationChanged);
            EventManager.Attach(EventType.MediaParsedChanged);
            EventManager.Attach(EventType.MediaFreed);
            EventManager.Attach(EventType.MediaStateChanged);
            EventManager.Attach(EventType.MediaSubItemTreeAdded);

            EventManager.VlcEventFired += OnVlcEventFired;
        }
Esempio n. 10
0
        private VlcMediaPlayer(IVlcObject parentVlcObject, void* pointer)
        {
            VlcInstance = parentVlcObject.VlcInstance;
            InstancePointer = pointer;
            VlcObjectManager.Add(this);

            EventManager = new VlcEventManager(this,
                LibVlcManager.GetFunctionDelegate<libvlc_media_player_event_manager>().Invoke(InstancePointer));

            EventManager.Attach(EventType.MediaPlayerPlaying);
            EventManager.Attach(EventType.MediaPlayerPaused);
            EventManager.Attach(EventType.MediaPlayerOpening);
            EventManager.Attach(EventType.MediaPlayerBuffering);
            EventManager.Attach(EventType.MediaPlayerStopped);
            EventManager.Attach(EventType.MediaPlayerForward);
            EventManager.Attach(EventType.MediaPlayerBackward);
            EventManager.Attach(EventType.MediaPlayerEndReached);
            EventManager.Attach(EventType.MediaPlayerMediaChanged);
            EventManager.Attach(EventType.MediaPlayerNothingSpecial);
            EventManager.Attach(EventType.MediaPlayerPausableChanged);
            EventManager.Attach(EventType.MediaPlayerPositionChanged);
            EventManager.Attach(EventType.MediaPlayerSeekableChanged);
            EventManager.Attach(EventType.MediaPlayerSnapshotTaken);
            EventManager.Attach(EventType.MediaPlayerTimeChanged);
            EventManager.Attach(EventType.MediaPlayerTitleChanged);
            EventManager.Attach(EventType.MediaPlayerLengthChanged);
            EventManager.Attach(EventType.MediaPlayerEncounteredError);
            EventManager.Attach(EventType.MediaPlayerVout);
            EventManager.Attach(EventType.MediaPlayerScrambledChanged);
            EventManager.Attach(EventType.MediaPlayerESAdded);
            EventManager.Attach(EventType.MediaPlayerESDeleted);
            EventManager.Attach(EventType.MediaPlayerESSelected);
            EventManager.Attach(EventType.MediaPlayerCorked);
            EventManager.Attach(EventType.MediaPlayerUncorked);
            EventManager.Attach(EventType.MediaPlayerMuted);
            EventManager.Attach(EventType.MediaPlayerUnmuted);
            EventManager.Attach(EventType.MediaPlayerAudioVolume);
            EventManager.Attach(EventType.MediaPlayerAudioDevice);
            EventManager.Attach(EventType.MediaPlayerChapterChanged);

            EventManager.VlcEventFired += OnVlcEventFired;
        }
Esempio n. 11
0
 protected override void Release(void **data)
 {
     LibVlcManager.GetFunctionDelegate <libvlc_media_tracks_release>()
     .Invoke((libvlc_media_track_t **)data, (uint)Count);
 }
Esempio n. 12
0
 protected override void Release(void **data)
 {
     LibVlcManager.GetFunctionDelegate <libvlc_free>().Invoke(data);
 }
Esempio n. 13
0
 protected override void Release(void *data)
 {
     LibVlcManager.GetFunctionDelegate <libvlc_audio_output_device_list_release>()
     .Invoke((libvlc_audio_output_device_t *)data);
 }
Esempio n. 14
0
 /// <summary>
 ///     Clear error message of current thread.
 /// </summary>
 /// <exception cref="Exception">A delegate callback throws an exception.</exception>
 public static void CleanError()
 {
     LibVlcManager.GetFunctionDelegate <libvlc_clearerr>().Invoke();
 }
Esempio n. 15
0
 /// <summary>
 ///     Get a readable error message.
 /// </summary>
 /// <returns>return a readable LibVlc error message, if there are no error will return <see cref="null" /></returns>
 /// <exception cref="Exception">A delegate callback throws an exception.</exception>
 public static string GetErrorMessage()
 {
     return(InteropHelper.PtrToString(LibVlcManager.GetFunctionDelegate <libvlc_errmsg>().Invoke()));
 }
Esempio n. 16
0
 protected override void Release(void *data)
 {
     LibVlcManager.GetFunctionDelegate <libvlc_module_description_list_release>()
     .Invoke((libvlc_module_description_t *)data);
 }
Esempio n. 17
0
 /// <summary>
 ///     Get event type name.
 /// </summary>
 /// <param name="type"></param>
 /// <returns></returns>
 public static string GetEventTypeName(EventType type)
 {
     return(InteropHelper.PtrToString(LibVlcManager.GetFunctionDelegate <libvlc_event_type_name>()
                                      .Invoke((libvlc_event_e)type)));
 }
Esempio n. 18
0
 /// <summary>
 ///     Create a new default equalizer, with all frequency values zeroed.
 /// </summary>
 public AudioEqualizer()
 {
     InstancePointer = LibVlcManager.GetFunctionDelegate <libvlc_audio_equalizer_new>().Invoke();
 }
Esempio n. 19
0
 /// <summary>
 ///     Create a new equalizer, with initial frequency values copied from an existing preset.
 /// </summary>
 /// <param name="index"></param>
 public AudioEqualizer(uint index)
 {
     InstancePointer = LibVlcManager.GetFunctionDelegate <libvlc_audio_equalizer_new_from_preset>().Invoke(index);
 }