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); } }
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); } }
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); } }
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); } }
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)); }
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); } }
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); }
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)); }
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)); }
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); } }
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); } }
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); } }