示例#1
0
        public void Start(int forceWidth = 0, int forceHeight = 0)
        {
            if (store.Count > 0)
            {
                store[0].Stop();
            }

            store.Add(this);

            library = LibVLCLibrary.Load(null);

            inst = library.m_libvlc_new(4,
                                        new string[] { ":sout-udp-caching=0", ":udp-caching=0", ":rtsp-caching=0", ":tcp-caching=0" });
            //libvlc_new()                                    // Load the VLC engine
            m = library.libvlc_media_new_location(inst, playurl);

            // Create a new player
            mp = library.libvlc_media_player_new_from_media(m); // Create a media player playing environement
            library.libvlc_media_release(m);                    // No need to keep the media now

            vlc_lock_delegate    = new LibVLCLibrary.libvlc_video_lock_cb(vlc_lock);
            vlc_unlock_delegate  = new LibVLCLibrary.libvlc_video_unlock_cb(vlc_unlock);
            vlc_picture_delegate = new LibVLCLibrary.libvlc_video_display_cb(vlc_picture);

            library.libvlc_video_set_callbacks(mp,
                                               vlc_lock_delegate,
                                               vlc_unlock_delegate,
                                               vlc_picture_delegate);

            if (forceWidth != 0 && forceHeight != 0)
            {
                this.Width  = forceWidth;
                this.Height = forceHeight;

                library.libvlc_video_set_format(this.mp, "RV32", (uint)Width, (uint)Height, (uint)Width * 4);
            }
            else
            {
                vlc_video_format_delegate  = Setup;
                vlc_video_cleanup_delegate = Cleanup;

                library.libvlc_video_set_format_callbacks(mp, vlc_video_format_delegate, vlc_video_cleanup_delegate);
            }

            library.libvlc_media_player_play(mp); // play the media_player
        }
示例#2
0
        public void Start(int forceWidth = 0, int forceHeight = 0)
        {
            if (store.Count > 0)
                store[0].Stop();

            store.Add(this);

            library = LibVLCLibrary.Load(null);

            inst = library.m_libvlc_new(4,
                new string[] {":sout-udp-caching=0", ":udp-caching=0", ":rtsp-caching=0", ":tcp-caching=0"});
                //libvlc_new()                                    // Load the VLC engine
            m = library.libvlc_media_new_location(inst, playurl);

            // Create a new player
            mp = library.libvlc_media_player_new_from_media(m); // Create a media player playing environement
            library.libvlc_media_release(m); // No need to keep the media now

            vlc_lock_delegate = new LibVLCLibrary.libvlc_video_lock_cb(vlc_lock);
            vlc_unlock_delegate = new LibVLCLibrary.libvlc_video_unlock_cb(vlc_unlock);
            vlc_picture_delegate = new LibVLCLibrary.libvlc_video_display_cb(vlc_picture);

            library.libvlc_video_set_callbacks(mp,
                vlc_lock_delegate,
                vlc_unlock_delegate,
                vlc_picture_delegate);

            if (forceWidth != 0 && forceHeight != 0)
            {
                this.Width = forceWidth;
                this.Height = forceHeight;

                library.libvlc_video_set_format(this.mp, "RV24", (uint)Width, (uint)Height, (uint)Width * 4);
            }
            else
            {
                vlc_video_format_delegate = Setup;
                vlc_video_cleanup_delegate = Cleanup;

                library.libvlc_video_set_format_callbacks(mp, vlc_video_format_delegate, vlc_video_cleanup_delegate);
            }

            library.libvlc_media_player_play(mp); // play the media_player
        }