Beispiel #1
0
        protected override void Dispose(bool isDisposing)
        {
            try {
                // Release unmanaged resources
                libvlc_exception_t exc = new libvlc_exception_t();
                LibVlcInterop.libvlc_exception_init(ref exc);
                LibVlcInterop.libvlc_log_close(descriptor, ref exc);
                if (exc.b_raised != 0)
                {
                    // Do not throw any exception in finalizer thread
                    if (isDisposing)
                    {
                        throw new VlcInternalException(exc.Message);
                    }
                    else
                    {
#if DEBUG
                        Debugger.Log(0, Debugger.DefaultCategory, String.Format("libvlc exception during finalizing a {0} : {1}", GetType(), exc.Message));
#endif
                    }
                }
            } finally {
                base.Dispose(isDisposing);
            }
        }
Beispiel #2
0
        internal VlcEventManager(IntPtr p_event_manager)
        {
            _AttachedEvents = new List<VlcEventType>();

            this.p_event_manager = p_event_manager;
            //Initalize our exception pointer
            p_exception = new libvlc_exception_t();
            p_exception.Initalize();
        }
Beispiel #3
0
        internal VlcEventManager(IntPtr p_event_manager)
        {
            _AttachedEvents = new List <VlcEventType>();

            this.p_event_manager = p_event_manager;
            //Initalize our exception pointer
            p_exception = new libvlc_exception_t();
            p_exception.Initalize();
        }
Beispiel #4
0
        internal VlmStream(VideoLanManager Vlm, string Name)
        {
            this.Vlm = Vlm;
            _Name = Name;

            //Initalize our exception pointer
            p_exception = new libvlc_exception_t();
            p_exception.Initalize();
        }
Beispiel #5
0
        internal VlmStream(VideoLanManager Vlm, string Name)
        {
            this.Vlm = Vlm;
            _Name    = Name;

            //Initalize our exception pointer
            p_exception = new libvlc_exception_t();
            p_exception.Initalize();
        }
Beispiel #6
0
        internal VlcMediaList(VideoLanClient Vlc, IntPtr p_mlist)
        {
            this._Vlc = Vlc;

            //set our Media list pointer
            this.p_mlist = p_mlist;

            //Initalize our exception pointer
            p_exception = new libvlc_exception_t();
            p_exception.Initalize();
        }
Beispiel #7
0
        public void SetDisplayOutput(Int32 handle)
        {
            VerifyObjectIsNotDisposed();
            //
            libvlc_exception_t exc = new libvlc_exception_t();

            LibVlcInterop.libvlc_exception_init(ref exc);
            LibVlcInterop.libvlc_media_player_set_drawable(descriptor, handle, ref exc);
            if (exc.b_raised != 0)
            {
                throw new VlcInternalException(exc.Message);
            }
        }
Beispiel #8
0
        public void Pause()
        {
            VerifyObjectIsNotDisposed();
            //
            libvlc_exception_t exc = new libvlc_exception_t();

            LibVlcInterop.libvlc_exception_init(ref exc);
            LibVlcInterop.libvlc_media_player_pause(descriptor, ref exc);
            if (exc.b_raised != 0)
            {
                throw new VlcInternalException(exc.Message);
            }
        }
Beispiel #9
0
        public void Clear()
        {
            VerifyObjectIsNotDisposed();
            // Clear the vlc log source
            libvlc_exception_t exc = new libvlc_exception_t();

            LibVlcInterop.libvlc_exception_init(ref exc);
            LibVlcInterop.libvlc_log_clear(descriptor, ref exc);
            if (exc.b_raised != 0)
            {
                throw new VlcInternalException(exc.Message);
            }
        }
Beispiel #10
0
        /// <summary>
        /// Initializes a new instance of the <b>VlcMedia</b> class.
        /// </summary>
        /// <param name="p_media"></param>
        /// <param name="retain"></param>
        internal VlcMedia(IntPtr p_media, bool retain)
        {
            //set our Media instance pointer
            this.p_media = p_media;
            //Initalize our exception pointer
            p_exception = new libvlc_exception_t();
            p_exception.Initalize();

            if (retain && p_media != IntPtr.Zero)
            {
                InteropMethods.libvlc_media_retain(p_media);
            }
        }
Beispiel #11
0
        public VlcMediaPlayerInternal CreateVlcMediaPlayerInternal()
        {
            libvlc_exception_t exc = new libvlc_exception_t();

            LibVlcInterop.libvlc_exception_init(ref exc);
            IntPtr mediaplayerDescriptor = LibVlcInterop.libvlc_media_player_new(vlclibDescriptor, ref exc);

            if (exc.b_raised != 0)
            {
                throw new VlcInternalException(exc.Message);
            }
            //
            return(new VlcMediaPlayerInternal(mediaplayerDescriptor));
        }
Beispiel #12
0
        private void Initalize(string vlcDirectory, string[] args)
        {
            RootPath = vlcDirectory;

            //save the original EnviornmentDirectory.
            string originalDir = Environment.CurrentDirectory;

            //Set the directory to load the COM object libvlc.dll
            Environment.CurrentDirectory = vlcDirectory;

            p_exception = new libvlc_exception_t();
            p_exception.Initalize();
            p_instance = InteropMethods.libvlc_new(args.Length, args, ref p_exception);
            p_exception.CheckException();
            Environment.CurrentDirectory = originalDir;
        }
Beispiel #13
0
        internal VlcMediaPlayer(VideoLanClient Vlc, IntPtr p_media_player)
        {
            _Vlc = Vlc;

            //set our Media instance pointer
            this.p_media_player = p_media_player;
            //Initalize our exception pointer
            p_ex = new libvlc_exception_t();
            p_ex.Initalize();
            _Audio     = new VlcAudio(this);
            _Video     = new VlcVideo(this);
            _Chapters  = new VlcChapters(this);
            _Titles    = new VlcTitles(this);
            _Subtitles = new VlcSubtitles(this);

            this.InitalizeEvents();
        }
Beispiel #14
0
        public void SetMedia(VlcMediaInternal media)
        {
            if (media == null)
            {
                throw new ArgumentNullException("media");
            }
            //
            VerifyObjectIsNotDisposed();
            //
            libvlc_exception_t exc = new libvlc_exception_t();

            LibVlcInterop.libvlc_exception_init(ref exc);
            LibVlcInterop.libvlc_media_player_set_media(descriptor, media.Descriptor, ref exc);
            if (exc.b_raised != 0)
            {
                throw new VlcInternalException(exc.Message);
            }
        }
Beispiel #15
0
        public VlcLog CreateVlcLog(ILog log, ILogVerbosityManager logVerbosityManager)
        {
            if (log == null)
            {
                throw new ArgumentNullException("log");
            }
            //
            libvlc_exception_t exc = new libvlc_exception_t();

            LibVlcInterop.libvlc_exception_init(ref exc);
            IntPtr libvlc_log_t = LibVlcInterop.libvlc_log_open(vlclibDescriptor, ref exc);

            if (exc.b_raised != 0)
            {
                throw new VlcInternalException(exc.Message);
            }
            //
            return(new VlcLog(libvlc_log_t, logVerbosityManager, log));
        }
Beispiel #16
0
        public VlcMediaInternal CreateVlcMediaInternal(MediaInput mediaInput)
        {
            if (mediaInput == null)
            {
                throw new ArgumentNullException("mediaInput");
            }
            //
            libvlc_exception_t exc = new libvlc_exception_t();

            LibVlcInterop.libvlc_exception_init(ref exc);
            IntPtr mediaDescriptor = LibVlcInterop.libvlc_media_new(vlclibDescriptor, mediaInput.Source, ref exc);

            if (exc.b_raised != 0)
            {
                throw new VlcInternalException(exc.Message);
            }
            //
            return(new VlcMediaInternal(mediaDescriptor));
        }
Beispiel #17
0
        private static IntPtr createInstance(string[] parameters)
        {
            if (parameters == null)
            {
                throw new ArgumentNullException("parameters");
            }
            //
            libvlc_exception_t exc = new libvlc_exception_t();

            LibVlcInterop.libvlc_exception_init(ref exc);
            IntPtr res = LibVlcInterop.libvlc_new(parameters, ref exc);

            if (exc.b_raised != 0)
            {
                throw new VlcInternalException(exc.Message);
            }
            //
            return(res);
        }
        private void addOption(string option)
        {
            if (option == null)
            {
                throw new ArgumentNullException("option");
            }
            if (option.Length == 0)
            {
                throw new ArgumentException("String is empty.", "option");
            }
            //
            VerifyObjectIsNotDisposed();
            //
            libvlc_exception_t exc = new libvlc_exception_t();

            LibVlcInterop.libvlc_exception_init(ref exc);
            LibVlcInterop.libvlc_media_add_option(descriptor, option, ref exc);
            if (exc.b_raised != 0)
            {
                throw new VlcInternalException(exc.Message);
            }
        }
Beispiel #19
0
        public void TakeSnapshot(string filePath, int width, int height)
        {
            VerifyObjectIsNotDisposed();
            //
            libvlc_exception_t exc = new libvlc_exception_t();

            LibVlcInterop.libvlc_exception_init(ref exc);
            IntPtr filePathPtr = Marshal.StringToHGlobalAnsi(filePath);
            //
            uint uwidth  = Convert.ToUInt32(width);
            uint uheight = Convert.ToUInt32(height);

            //
            try {
                LibVlcInterop.libvlc_video_take_snapshot(descriptor, filePathPtr, uwidth, uheight, ref exc);
            } finally {
                Marshal.FreeHGlobal(filePathPtr);
            }
            //
            if (exc.b_raised != 0)
            {
                throw new VlcInternalException(exc.Message);
            }
        }
Beispiel #20
0
        public void UpdateMessages()
        {
            VerifyObjectIsNotDisposed();
            //
            libvlc_exception_t exc = new libvlc_exception_t();

            LibVlcInterop.libvlc_exception_init(ref exc);
            IntPtr iterator = LibVlcInterop.libvlc_log_get_iterator(descriptor, ref exc);

            if (exc.b_raised != 0)
            {
                throw new VlcInternalException(exc.Message);
            }
            //
            try {
                while (0 != LibVlcInterop.libvlc_log_iterator_has_next(iterator, ref exc))
                {
                    if (exc.b_raised != 0)
                    {
                        throw new VlcInternalException(exc.Message);
                    }
                    //
                    libvlc_log_message_t messageBuffer = new libvlc_log_message_t();
                    messageBuffer.sizeof_msg = Convert.ToUInt32(Marshal.SizeOf(typeof(libvlc_log_message_t)));
                    IntPtr ptrStructRes = LibVlcInterop.libvlc_log_iterator_next(iterator, ref messageBuffer, ref exc);
                    if (exc.b_raised != 0)
                    {
                        throw new VlcInternalException(exc.Message);
                    }
                    //
                    libvlc_log_message_t msgRes = (libvlc_log_message_t)Marshal.PtrToStructure(ptrStructRes, typeof(libvlc_log_message_t));
                    string text = String.Format("{0} {1} {2} : {3}", msgRes.Type, msgRes.Name, msgRes.Header, msgRes.Message);
                    //
                    switch (msgRes.Severity)
                    {
                    case libvlc_log_messate_t_severity.INFO: {
                        // INFO
                        logger.Info(text);
                        break;
                    }

                    case libvlc_log_messate_t_severity.ERR: {
                        // ERR
                        logger.Error(text);
                        break;
                    }

                    case libvlc_log_messate_t_severity.WARN: {
                        // WARN
                        logger.Warn(text);
                        break;
                    }

                    case libvlc_log_messate_t_severity.DBG: {
                        // DBG
                        logger.Debug(text);
                        break;
                    }

                    default: {
                        logger.Trace("Unknown severity : " + text);
                        break;
                    }
                    }
                }
            } finally {
                LibVlcInterop.libvlc_log_iterator_free(iterator, ref exc);
            }
        }
Beispiel #21
0
 static extern void libvlc_video_take_snapshot(IntPtr p_input, string Name, int w,int h, ref libvlc_exception_t p_exception);
Beispiel #22
0
 static extern int libvlc_video_get_width(IntPtr p_input, ref libvlc_exception_t p_exception);
Beispiel #23
0
 static extern IntPtr libvlc_playlist_get_input(ref libvlc_instance_t libvlc, ref libvlc_exception_t p_exception);
Beispiel #24
0
 static extern Int32 libvlc_exception_raised(ref libvlc_exception_t p_exception);
Beispiel #25
0
 public static extern void libvlc_exception_init(ref libvlc_exception_t pExp);
Beispiel #26
0
 public static extern int libvlc_exception_raised(ref libvlc_exception_t pExp);
Beispiel #27
0
 public static extern IntPtr libvlc_new(int nArgc, string[] Args, ref libvlc_exception_t pExp);
Beispiel #28
0
        private void LibVLCInit(string[] args)
        {
            IntPtr pLibVLC;
            libvlc_exception_t exp = new libvlc_exception_t();
            libvlc_exception_init(ref exp);

            pLibVLC = libvlc_new(args.Length, args, ref exp);
            if (0 != libvlc_exception_raised(ref exp))
            {
                //Console.WriteLine("Error: {0}", exp.psz_message);
                throw new Win32Exception(exp.psz_message);
            }
            else
            {
                _instanceVLC = (libvlc_instance_t)Marshal.PtrToStructure(pLibVLC, typeof(libvlc_instance_t));
                _pLibVLCHandle = pLibVLC;
                //Console.WriteLine("pLibVLC Done! - {0:X}", pLibVLC);
            }
        }
Beispiel #29
0
		static extern void libvlc_playlist_play(ref libvlc_instance_t libvlc, Int32 id, 
			Int32 optionsCount, IntPtr optionsAlwaysNull, ref libvlc_exception_t p_exception);
Beispiel #30
0
        internal VlcMediaPlayer(VideoLanClient Vlc, IntPtr p_media_player)
        {
            _Vlc = Vlc;

            //set our Media instance pointer
            this.p_media_player = p_media_player;
            //Initalize our exception pointer
            p_ex = new libvlc_exception_t();
            p_ex.Initalize();
            _Audio = new VlcAudio(this);
            _Video = new VlcVideo(this);
            _Chapters = new VlcChapters(this);
            _Titles = new VlcTitles(this);
            _Subtitles = new VlcSubtitles(this);

            this.InitalizeEvents();
        }
Beispiel #31
0
 static extern void libvlc_exception_clear(ref libvlc_exception_t p_exception);
Beispiel #32
0
        /// <summary>
        /// Initializes a new instance of the <b>VlcMedia</b> class.
        /// </summary>
        /// <param name="p_media"></param>
        /// <param name="retain"></param>
        internal VlcMedia(IntPtr p_media, bool retain)
        {
            //set our Media instance pointer
            this.p_media = p_media;
            //Initalize our exception pointer
            p_exception = new libvlc_exception_t();
            p_exception.Initalize();

            if (retain && p_media != IntPtr.Zero)
            {
                InteropMethods.libvlc_media_retain(p_media);
            }
        }
Beispiel #33
0
 static extern void libvlc_exception_init(out libvlc_exception_t p_exception);