コード例 #1
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);
 }
コード例 #2
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);
 }
コード例 #3
0
        public static IntPtr libvlc_new(string[] parameters, ref libvlc_exception_t exception)
        {
            if (parameters.Length > 10)
            {
                throw new ArgumentException("Too many items in array, maximum 10 allowed", "parameters");
            }
            //
            PointerToArrayOfPointerHelper argv = new PointerToArrayOfPointerHelper();

            argv.pointers = new IntPtr[11];
            //
            Assembly assembly = Assembly.GetEntryAssembly();

            if (assembly != null)
            {
                argv.pointers[0] = Marshal.StringToHGlobalAnsi(assembly.Location);
            }
            else
            {
                assembly         = Assembly.GetExecutingAssembly();
                argv.pointers[0] = Marshal.StringToHGlobalAnsi(assembly.Location);
            }

            for (int i = 0; i < parameters.Length; i++)
            {
                argv.pointers[i + 1] = Marshal.StringToHGlobalAnsi(parameters[i]);
            }

            IntPtr argvPtr = IntPtr.Zero;

            try {
                int size = Marshal.SizeOf(typeof(PointerToArrayOfPointerHelper));
                argvPtr = Marshal.AllocHGlobal(size);
                Marshal.StructureToPtr(argv, argvPtr, false);

                return(libvlc_new(parameters.Length + 1, argvPtr, ref exception));
            } finally {
                for (int i = 0; i < parameters.Length + 1; i++)
                {
                    if (argv.pointers[i] != IntPtr.Zero)
                    {
                        Marshal.FreeHGlobal(argv.pointers[i]);
                    }
                }
                if (argvPtr != IntPtr.Zero)
                {
                    Marshal.FreeHGlobal(argvPtr);
                }
            }
        }
コード例 #4
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);
 }
コード例 #5
0
 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);
     }
 }
コード例 #6
0
        /// <summary>
        /// Helper to the original function, <paramref name="mrl"/> string will be
        /// converted to the UTF-8 encoding automatically and marshalled to the libvlc.
        /// </summary>
        public static IntPtr libvlc_media_new(IntPtr p_instance, string mrl, ref libvlc_exception_t exception)
        {
            IntPtr pMrl = IntPtr.Zero;

            try {
                byte[] bytes = Encoding.UTF8.GetBytes(mrl);
                //
                pMrl = Marshal.AllocHGlobal(bytes.Length + 1);
                Marshal.Copy(bytes, 0, pMrl, bytes.Length);
                Marshal.WriteByte(pMrl, bytes.Length, 0);
                //
                return(libvlc_media_new(p_instance, pMrl, ref exception));
            } finally {
                if (pMrl != IntPtr.Zero)
                {
                    Marshal.FreeHGlobal(pMrl);
                }
            }
        }
コード例 #7
0
 public static extern void libvlc_media_player_set_time(IntPtr libvlc_mediaplayer, Int64 time, ref libvlc_exception_t exception);
コード例 #8
0
 public static extern void libvlc_media_player_set_drawable(IntPtr libvlc_mediaplayer, Int32 libvlc_drawable,
                                                            ref libvlc_exception_t exception);
コード例 #9
0
 public static extern void libvlc_media_player_set_position(IntPtr libvlc_mediaplayer, float position, ref libvlc_exception_t exception);
コード例 #10
0
 public static extern IntPtr libvlc_log_iterator_next(IntPtr libvlc_log_iterator_t, ref libvlc_log_message_t p_buffer, ref libvlc_exception_t exception);
コード例 #11
0
 public static extern void libvlc_log_clear(IntPtr libvlc_log_t, ref libvlc_exception_t exception);
コード例 #12
0
 public static extern UInt32 libvlc_get_log_verbosity(IntPtr libvlc_instance_t, ref libvlc_exception_t exception);
コード例 #13
0
 public static bool libvlc_video_reparent(IntPtr libvlc_mediaplayer, Int32 libvlc_drawable_t,
                                          ref libvlc_exception_t exc)
 {
     return(libvlc_video_reparent_internal(libvlc_mediaplayer, libvlc_drawable_t, ref exc) != 0);
 }
コード例 #14
0
 public static extern void libvlc_video_set_spu(IntPtr libvlc_mediaplayer, int spu, ref libvlc_exception_t exception);
コード例 #15
0
 public static extern int libvlc_video_get_spu(IntPtr libvlc_mediaplayer, ref libvlc_exception_t exception);
コード例 #16
0
 public static bool libvlc_video_reparent(IntPtr libvlc_mediaplayer, Int32 libvlc_drawable_t,
                                          ref libvlc_exception_t exc) {
     return libvlc_video_reparent_internal(libvlc_mediaplayer, libvlc_drawable_t, ref exc) != 0;
 }
コード例 #17
0
 private static extern Int32 libvlc_video_reparent_internal(IntPtr libvlc_mediaplayer, Int32 libvlc_drawable_t,
                                                            ref libvlc_exception_t exc);
コード例 #18
0
 public static extern float libvlc_media_player_get_fps(IntPtr libvlc_media_player_t, ref libvlc_exception_t exception);
コード例 #19
0
 public static extern IntPtr libvlc_media_player_event_manager(IntPtr libvlc_media_player_t, ref libvlc_exception_t exception);
コード例 #20
0
 public static extern void libvlc_media_player_set_position(IntPtr libvlc_mediaplayer, float position, ref libvlc_exception_t exception);
コード例 #21
0
 public static extern float libvlc_media_player_get_fps(IntPtr libvlc_media_player_t, ref libvlc_exception_t exception);
コード例 #22
0
 public static extern void libvlc_video_take_snapshot(IntPtr libvlc_media_player_t,
                                                      IntPtr filePath, UInt32 i_width, UInt32 i_height, ref libvlc_exception_t exc);
コード例 #23
0
 public static extern void libvlc_video_set_spu(IntPtr libvlc_mediaplayer, int spu, ref libvlc_exception_t exception);
コード例 #24
0
 public static extern UInt32 libvlc_get_log_verbosity(IntPtr libvlc_instance_t, ref libvlc_exception_t exception);
コード例 #25
0
 public static extern IntPtr libvlc_log_open(IntPtr libvlc_instance_t, ref libvlc_exception_t exception);
コード例 #26
0
 public static extern void libvlc_set_log_verbosity(IntPtr libvlc_instance_t, UInt32 level, ref libvlc_exception_t exception);
コード例 #27
0
 public static extern void libvlc_log_iterator_free(IntPtr libvlc_log_iterator_t, ref libvlc_exception_t exception);
コード例 #28
0
 public static extern IntPtr libvlc_log_open(IntPtr libvlc_instance_t, ref libvlc_exception_t exception);
コード例 #29
0
 public static extern void libvlc_media_player_set_drawable(IntPtr libvlc_mediaplayer, Int32 libvlc_drawable,
                                                            ref libvlc_exception_t exception);
コード例 #30
0
 public static extern UInt32 libvlc_log_count(IntPtr libvlc_log_t, ref libvlc_exception_t exception);
コード例 #31
0
 public static extern void libvlc_media_player_stop(IntPtr libvlc_mediaplayer, ref libvlc_exception_t exception);
コード例 #32
0
 public static extern void libvlc_log_clear(IntPtr libvlc_log_t, ref libvlc_exception_t exception);
コード例 #33
0
 public static extern Int64 libvlc_media_player_get_time(IntPtr libvlc_mediaplayer, ref libvlc_exception_t exception);
コード例 #34
0
 public static extern IntPtr libvlc_log_get_iterator(IntPtr libvlc_log_t, ref libvlc_exception_t exception);
コード例 #35
0
 public static extern float libvlc_media_player_get_position(IntPtr libvlc_mediaplayer, ref libvlc_exception_t exception);
コード例 #36
0
 public static extern void libvlc_log_iterator_free(IntPtr libvlc_log_iterator_t, ref libvlc_exception_t exception);
コード例 #37
0
 public static extern IntPtr libvlc_media_player_event_manager(IntPtr libvlc_media_player_t, ref libvlc_exception_t exception);
コード例 #38
0
 public static extern Int32 libvlc_log_iterator_has_next(IntPtr libvlc_log_iterator_t, ref libvlc_exception_t exception);
コード例 #39
0
 private static extern Int32 libvlc_video_reparent_internal(IntPtr libvlc_mediaplayer, Int32 libvlc_drawable_t,
                                                            ref libvlc_exception_t exc);
コード例 #40
0
 public static extern IntPtr libvlc_log_iterator_next(IntPtr libvlc_log_iterator_t, ref libvlc_log_message_t p_buffer, ref libvlc_exception_t exception);
コード例 #41
0
 public static extern int libvlc_video_get_spu(IntPtr libvlc_mediaplayer, ref libvlc_exception_t exception);
コード例 #42
0
 public static extern void libvlc_media_player_set_time(IntPtr libvlc_mediaplayer, Int64 time, ref libvlc_exception_t exception);
コード例 #43
0
 public static extern void libvlc_video_take_snapshot(IntPtr libvlc_media_player_t,
                                                      IntPtr filePath, UInt32 i_width, UInt32 i_height, ref libvlc_exception_t exc);
コード例 #44
0
 public static extern int libvlc_audio_get_volume(IntPtr libvlc_instance, ref libvlc_exception_t exception);
コード例 #45
0
 public static extern void libvlc_set_log_verbosity(IntPtr libvlc_instance_t, UInt32 level, ref libvlc_exception_t exception);
コード例 #46
0
 public static extern libvlc_state_t libvlc_media_get_state(IntPtr libvlc_media_inst, ref libvlc_exception_t exc);
コード例 #47
0
 public static extern UInt32 libvlc_log_count(IntPtr libvlc_log_t, ref libvlc_exception_t exception);
コード例 #48
0
 public static extern IntPtr libvlc_media_player_new(IntPtr libvlc_instance, ref libvlc_exception_t exception);
コード例 #49
0
 public static extern IntPtr libvlc_log_get_iterator(IntPtr libvlc_log_t, ref libvlc_exception_t exception);
コード例 #50
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);
     }
 }
コード例 #51
0
 public static extern Int32 libvlc_log_iterator_has_next(IntPtr libvlc_log_iterator_t, ref libvlc_exception_t exception);
コード例 #52
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);
     }
 }
コード例 #53
0
 public static extern Int64 libvlc_media_player_get_time(IntPtr libvlc_mediaplayer, ref libvlc_exception_t exception);
コード例 #54
0
 public static extern void libvlc_audio_set_volume(IntPtr libvlc_instance, int volume, ref libvlc_exception_t exception);
コード例 #55
0
 public static extern IntPtr libvlc_media_player_new_from_media(IntPtr libvlc_media,
                                                                ref libvlc_exception_t exception);
コード例 #56
0
 public static extern float libvlc_media_player_get_position(IntPtr libvlc_mediaplayer, ref libvlc_exception_t exception);
コード例 #57
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);
     }
 }
コード例 #58
0
 public static extern void libvlc_audio_set_volume(IntPtr libvlc_instance, int volume, ref libvlc_exception_t exception);
コード例 #59
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);
     }
 }
コード例 #60
0
 public static extern void libvlc_media_player_set_media(IntPtr libvlc_media_player_t, IntPtr libvlc_media_t, ref libvlc_exception_t exception);