コード例 #1
0
        private void OnLoad(object sender, EventArgs e)
        {
            Width += 100;
            Controls.Add(c);
            Controls.Add(bnPause);
            Controls.Add(bnAr43);
            Controls.Add(bnAr169);
            Controls.Add(bnAr);

            Text = "libvlc version: " + VlcInstance.VlcLibraryVersion;

            VlcConfig vlcConfig = new VlcConfig();

            vlcConfig.PluginPath = "C:\\Program Files\\VideoLAN\\VLC\\Plugins";

            _v = new VlcInstance(vlcConfig);

            _v.Parent = c.Handle;
            _v.VlcPlaylist.Add("X:\\videos\\300.avi");
            _v.VlcPlaylist.Play();

            _logForm = new LogForm(_v);
            _logForm.Show();
            _logForm.Top  = this.Top;
            _logForm.Left = this.Right;
        }
コード例 #2
0
 public VideoCreator(Int32[] PassData, int LengthinSeconds, string CurrentAVI, long SeekTime)
 {
     InitializeComponent();
     Data = PassData;
     Zoom = 0.15f;
     WavePen = new Pen(Color.Black);
     CaptureBMP = new Bitmap(CapPanel.Width, CapPanel.Height);
     VideoBMP = new Bitmap(640, 480);
     EEG = new Bitmap(950, 221);
     //Initalize Player instance;
     //string[] args = new string[] { "--no-directx-hw-yuv" }; //--no-overlay
     string[] args = new string[] { "","--no-directx-hw-yuv" }; //
     instance = new VlcInstance(args);
     f = Graphics.FromImage(EEG);
     PanelGraph = CapPanel.CreateGraphics();
     drawCapture(Data, f, 950, 221, 1);
     LiS = LengthinSeconds;
     TempEEG = new Bitmap(EEG);
     EEGPanel.BackgroundImage = TempEEG;
     media = new VlcMedia(instance, CurrentAVI);
     rect = new Rectangle(0, 0, CapPanel.Width, CapPanel.Height);
     /*Rectangle rect = new Rectangle(0, 0, VideoBMP.Width, VideoBMP.Height);
     System.Drawing.Imaging.BitmapData bmpData = VideoBMP.LockBits(rect, System.Drawing.Imaging.ImageLockMode.ReadWrite,
         VideoBMP.PixelFormat);
     IntPtr ptr = bmpData.Scan0;*/
     Handle = media.Handle;
     Mem = new MemoryRenderer(LibVlc.libvlc_media_player_new_from_media(media.Handle));
     Mem.SetFormat(new BitmapFormat(640,480, ChromaType.RV24));
     Mem.Play();
     Thread.Sleep(1000);
     Mem.seek(SeekTime);
     Mem.Pause();
     //LibVlc.libvlc_media_player_pause(Handle);
 }
コード例 #3
0
        public void SettingsControllerConstructorTest()
        {
            VlcInstance        instance = new VlcInstance(VlcInstanceArgs);
            SettingsController target   = new SettingsController();

            Assert.IsInstanceOfType(target, typeof(SettingsController));
        }
コード例 #4
0
        public void VlcMediaPlayerConstructorTest()
        {
            VlcInstance    instance = new VlcInstance(VlcInstanceArgs);
            VlcMediaPlayer player   = instance.CreatePlayer(BaseTestFilePath + "n900_extremely_short.avi");

            Assert.IsInstanceOfType(player, typeof(VlcMediaPlayer));
            Assert.IsInstanceOfType(player.Media, typeof(VlcMedia));
        }
コード例 #5
0
        public void CreatePlayerTest()
        {
            VlcInstance    target    = new VlcInstance(VlcInstanceArgs);
            string         mediaPath = BaseTestFilePath + "n900_extremely_short.avi";
            VlcMediaPlayer actual;

            actual = target.CreatePlayer(mediaPath);
            Assert.IsInstanceOfType(actual, typeof(VlcMediaPlayer));
        }
コード例 #6
0
        public void VlcInstanceConstructorTest()
        {
            VlcInstance target = new VlcInstance(VlcInstanceArgs);

            Assert.IsInstanceOfType(target, typeof(VlcInstance));
            target.Dispose();

            target = new VlcInstance(new string[] {});
        }
コード例 #7
0
        public LogForm(VlcInstance inst)
        {
            _lb.IntegralHeight      = false;
            _lb.HorizontalScrollbar = true;
            _inst = inst;
            _th   = new Thread(new ThreadStart(this.ThreadMethod));

            this.Load   += new EventHandler(this.OnLoad);
            this.Layout += new LayoutEventHandler(this.OnLayout);
        }
コード例 #8
0
        public void AspectRatioTest()
        {
            VlcInstance    instance = new VlcInstance(VlcInstanceArgs);
            VlcMediaPlayer player   = instance.CreatePlayer(BaseTestFilePath + "n900_extremely_short.avi");

            player.Play();
            Assert.AreEqual("1.66", player.Media.AspectRatio);
            player.Stop();
            player.Dispose();
            instance.Dispose();
        }
コード例 #9
0
        public void SubtitleTracksTest()
        {
            VlcInstance    instance = null;
            VlcMediaPlayer player   = null;

            instance = new VlcInstance(VlcInstanceArgs);
            player   = instance.CreatePlayer(BaseTestFilePath + "mewmew-vorbis-ssa.mkv");
            Assert.IsInstanceOfType(player, typeof(VlcMediaPlayer));
            player.Play();
            Assert.AreEqual(player.Media.Length, 58183);
            ArrayList subtitles = player.Media.SubtitleTracks;

            Assert.AreEqual(subtitles.Count, 17);

            Assert.AreEqual("Disable", ((VLCLibrary.libvlc_track_description_t)subtitles[0]).psz_name);
            Assert.IsTrue(player.ChangeSubtitleTrack(0));
            Assert.AreEqual("Track 1 - [English]", ((VLCLibrary.libvlc_track_description_t)subtitles[1]).psz_name);
            Assert.IsTrue(player.ChangeSubtitleTrack(1));
            Assert.AreEqual("Track 2 - [Nederlands]", ((VLCLibrary.libvlc_track_description_t)subtitles[2]).psz_name);
            Assert.IsTrue(player.ChangeSubtitleTrack(2));
            Assert.AreEqual("Track 3 - [English]", ((VLCLibrary.libvlc_track_description_t)subtitles[3]).psz_name);
            Assert.IsTrue(player.ChangeSubtitleTrack(3));
            Assert.AreEqual("Track 4 - [Suomi]", ((VLCLibrary.libvlc_track_description_t)subtitles[4]).psz_name);
            Assert.IsTrue(player.ChangeSubtitleTrack(4));
            Assert.AreEqual("Track 5 - [Français]", ((VLCLibrary.libvlc_track_description_t)subtitles[5]).psz_name);
            Assert.IsTrue(player.ChangeSubtitleTrack(5));
            Assert.AreEqual("Track 6 - [Deutsch]", ((VLCLibrary.libvlc_track_description_t)subtitles[6]).psz_name);
            Assert.IsTrue(player.ChangeSubtitleTrack(6));
            Assert.AreEqual("Track 7 - [עברית]", ((VLCLibrary.libvlc_track_description_t)subtitles[7]).psz_name);
            Assert.IsTrue(player.ChangeSubtitleTrack(7));
            Assert.AreEqual("Track 8 - [Magyar]", ((VLCLibrary.libvlc_track_description_t)subtitles[8]).psz_name);
            Assert.IsTrue(player.ChangeSubtitleTrack(8));
            Assert.AreEqual("Track 9 - [Italiano]", ((VLCLibrary.libvlc_track_description_t)subtitles[9]).psz_name);
            Assert.IsTrue(player.ChangeSubtitleTrack(9));
            Assert.AreEqual("Track 10 - [日本語]", ((VLCLibrary.libvlc_track_description_t)subtitles[10]).psz_name);
            Assert.IsTrue(player.ChangeSubtitleTrack(10));
            Assert.AreEqual("Track 11 - [Norsk]", ((VLCLibrary.libvlc_track_description_t)subtitles[11]).psz_name);
            Assert.IsTrue(player.ChangeSubtitleTrack(11));
            Assert.AreEqual("Track 12 - [Polski]", ((VLCLibrary.libvlc_track_description_t)subtitles[12]).psz_name);
            Assert.IsTrue(player.ChangeSubtitleTrack(12));
            Assert.AreEqual("Track 13 - [Português]", ((VLCLibrary.libvlc_track_description_t)subtitles[13]).psz_name);
            Assert.IsTrue(player.ChangeSubtitleTrack(13));
            Assert.AreEqual("Track 14 - [Русский]", ((VLCLibrary.libvlc_track_description_t)subtitles[14]).psz_name);
            Assert.IsTrue(player.ChangeSubtitleTrack(14));
            Assert.AreEqual("Track 15 - [Español]", ((VLCLibrary.libvlc_track_description_t)subtitles[15]).psz_name);
            Assert.IsTrue(player.ChangeSubtitleTrack(15));
            Assert.AreEqual("Track 16 - [Svenska]", ((VLCLibrary.libvlc_track_description_t)subtitles[16]).psz_name);
            Assert.IsTrue(player.ChangeSubtitleTrack(16));

            player.Stop();
            player.Dispose();

            instance.Dispose();
        }
コード例 #10
0
        public void ChangeSubtitleTrackTest()
        {
            VlcInstance    instance = new VlcInstance(VlcInstanceArgs);
            VlcMediaPlayer player   = instance.CreatePlayer(BaseTestFilePath + "mewmew-vorbis-ssa.mkv");

            player.Play();

            int currentSubtitleTrackId = VLCLibrary.Instance.video_get_spu(player.Handle);

            player.ChangeSubtitleTrack(3);
            Assert.AreNotEqual(currentSubtitleTrackId, VLCLibrary.Instance.video_get_spu(player.Handle));
        }
コード例 #11
0
        public void VlcMediaConstructorTest()
        {
            VlcInstance    instance = null;
            VlcMediaPlayer player   = null;

            instance = new VlcInstance(VlcInstanceArgs);
            player   = instance.CreatePlayer(BaseTestFilePath + "n900_extremely_short.avi");
            Assert.IsInstanceOfType(player, typeof(VlcMediaPlayer));
            player.Play();
            Assert.AreEqual(player.Media.Length, 5000);
            player.Stop();
            player.Dispose();
        }
コード例 #12
0
        public void LengthTest()
        {
            VlcInstance    instance = null;
            VlcMediaPlayer player   = null;

            instance = new VlcInstance(VlcInstanceArgs);
            player   = instance.CreatePlayer(BaseTestFilePath + "mewmew-vorbis-ssa.mkv");
            Assert.IsInstanceOfType(player, typeof(VlcMediaPlayer));
            player.Play();
            Assert.AreEqual(player.Media.Length, 58183);

            player.Stop();
            player.Dispose();

            instance.Dispose();
        }
コード例 #13
0
        public MainWindow()
        {
            InitializeComponent();

            System.Windows.Forms.Panel aVideoPanel = new System.Windows.Forms.Panel();
            aVideoPanel.BackColor = System.Drawing.Color.Black;
            VideoWindow.Child     = aVideoPanel;

            // If not installed in Provide path to your VLC.
            myVlcInstance = new VlcInstance(@"c:\Program Files\VideoLAN\VLC\");

            // Use TCP messaging.
            // You can try to use UDP or WebSockets too.
            myVideoChannel = new TcpMessagingSystemFactory()
                             //myVideoChannel = new UdpMessagingSystemFactory()
                             // Note: Provide address of your service here.
                             .CreateDuplexOutputChannel("tcp://172.20.10.9:8093/");
            myVideoChannel.ResponseMessageReceived += OnResponseMessageReceived;
        }
コード例 #14
0
ファイル: Form1.cs プロジェクト: achang131/DM_Player
        public Form1()
        {
            InitializeComponent();

            string[] args = new string[] {
                "-I", "dummy", "--ignore-config",
                @"--plugin-path=C:\Users\Alan\Documents\GitHub\DM_Player\lib under test\testVLC\testVLC\bin\Debug\plugins",
                "--vout-filter=deinterlace", "--deinterlace-mode=blend"
            };

            Pbase = new VlcInstance();

            player = new VlcMediaPlayer(Pbase, panel1.Handle);

            player.setDeinterlace("auto");
            player.setKeyInput   = true;
            player.setMouseInput = true;

            player.vlc.StateChange += new EventHandler(player_StateChange);
            player.PlayTimeChange  += new EventHandler <VlcMediaPlayer.PlayTimeArgs>(player_PlayTimeChange);
            this.FormClosed        += new FormClosedEventHandler(Form1_FormClosed);
            AllocConsole();
        }
コード例 #15
0
ファイル: AudioPlayer.cs プロジェクト: pilgarlicx/SharpPlayer
        public void SetupWithVLC(string libVlcCore_path, string libVlc_path)
        {
            var vlc = new VlcInstance(libVlcCore_path, libVlc_path);

            Setup(vlc);
        }
コード例 #16
0
ファイル: AudioPlayer.cs プロジェクト: pilgarlicx/SharpPlayer
        public void SetupWithVLC(string libVlc_directory)
        {
            var vlc = new VlcInstance(libVlc_directory);

            Setup(vlc);
        }
コード例 #17
0
ファイル: AudioPlayer.cs プロジェクト: pilgarlicx/SharpPlayer
        public void SetupWithVLC()
        {
            var vlc = new VlcInstance();

            Setup(vlc);
        }
コード例 #18
0
ファイル: MainForm.cs プロジェクト: KyleThomson/biopacvideo
        public CManage()
        {
            InitializeComponent();
            this.WindowState = FormWindowState.Maximized;
            ACQ = new ACQReader(); //Class to read from ACQ file
            graph = new Mygraph(); //Small Class for containing EEG area.
            DSF = new DetectedSeizureFileType();
            VideoOffset = new float[16];
            string[] args = new string[] { "" };
            instance = new VlcInstance(args);
            INI = new IniFile(Directory.GetCurrentDirectory() + "\\SeizurePlayback.ini");
            ACQ.initDisplay(10, 10);
            g = this.CreateGraphics(); //Graphics object for main form
            OffsetBox.Text = VideoOffset[0].ToString();
            //Create Instances
            CurrentAVI = ""; //No default AVI loaded
            SeizureCount = new int[16]; //Create Array for Seizure Counts;

            //Graphics area of the form to display the EEG. It would be better if these were dynamically resized.
            //I don't have time for that shit.

            ChanPos = new int[16];
            VisChecks = new CheckBox[16];
            VisChecks[0] = VisChan1;
            VisChecks[1] = VisChan2;
            VisChecks[2] = VisChan3;
            VisChecks[3] = VisChan4;
            VisChecks[4] = VisChan5;
            VisChecks[5] = VisChan6;
            VisChecks[6] = VisChan7;
            VisChecks[7] = VisChan8;
            VisChecks[8] = VisChan9;
            VisChecks[9] = VisChan10;
            VisChecks[10] = VisChan11;
            VisChecks[11] = VisChan12;
            VisChecks[12] = VisChan13;
            VisChecks[13] = VisChan14;
            VisChecks[14] = VisChan15;
            VisChecks[15] = VisChan16;

            INIload();
            TimeBox.SelectedIndex = 1; //Default Time Scale
            Step = MaxDispSize; //Setting Step to max display size makes sure the image refreshes.

            //Add Mouse Handlers
            this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.MyMouseUp);
            this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.MouseDownHandler);
            this.KeyPreview = true;
            this.KeyPress += new KeyPressEventHandler(Form1_KeyPress);
            ResizeBool = true;
            //Start up the display thread.
            this.Resize += new System.EventHandler(this.MainForm_Resize);
            ThreadDisplay = new Thread(new ThreadStart(DisplayThread));
            ThreadDisplay.Start();
            OffsetBox.Enabled = false;
            graph.X1 = 5;
            graph.X2 = this.Size.Width - 10;
            graph.Y1 = 6;
            graph.Y2 = VideoPanel.Location.Y - 11; //this.Size.Height - VideoPanel.Location.Y;
            Console.WriteLine(this.Size.Height);
            Console.WriteLine(VideoPanel.Location.Y - 11);
            ACQ.initDisplay(graph.X2 - graph.X1, graph.Y2 - graph.Y1);    //Create the graphics box to display EEG.
        }
コード例 #19
0
 public void MyTestInitialize()
 {
     instance = new VlcInstance(VlcInstanceArgs);
 }
コード例 #20
0
        public frmUNIcastPlayer()
        {
            InitializeComponent();

            // Load settings
            IniFile ini = new IniFile(Path.Combine(Environment.CurrentDirectory, IniFile));
            string  str = ini.IniReadValue(Section, KeyStream);

            if (!Address.TryParse(str, out streamAddress))
            {
                streamAddress = DefaultStreamAddress;
                ini.IniWriteValue(Section, KeyStream, streamAddress.ToString());
            }
            str = ini.IniReadValue(Section, KeyMessage);
            if (!Address.TryParse(str, out messageAddress))
            {
                messageAddress = DefaultMessageAddress;
                ini.IniWriteValue(Section, KeyMessage, messageAddress.ToString());
            }
            str = ini.IniReadValue(Section, KeyHWA);
            if (!Boolean.TryParse(str, out enableHWA))
            {
                enableHWA = DefaultHWA;
                ini.IniWriteValue(Section, KeyHWA, enableHWA.ToString());
            }

            Debug.WriteLine("streamAddress: " + streamAddress);
            Debug.WriteLine("messageAddress: " + messageAddress);
            Debug.WriteLine("HWA: " + enableHWA);

            // Last supported VLC version: VLC 2.0.8 "Twoflower"
            string[] args = new string[] {
                "-I", "dummy", "--ignore-config",

                // don't display file path
                "--no-video-title-show",

                // keep showing logo
                // http://stackoverflow.com/questions/15992874/logo-appears-for-only-a-second-and-then-disappears
                "--sub-filter=logo",

                // Caching value for network resources, in milliseconds.
                "--network-caching=60",

                // C:\Program Files (x86)\VideoLAN\VLC\plugins"
                @"--plugin-path=VLC_PLUGIN_PATH"
            };

            // Enable hardware acceleration based on settings
            if (enableHWA)
            {
                List <string> argsList = args.ToList();
                argsList.Add("--ffmpeg-hw");
                args = argsList.ToArray();
            }
            else
            {
                ibtnHWA.Visible = false;
            }

            instance = new VlcInstance(args);
            player   = null;

            cropMode = CropMode.NoCropping;

            margin = this.Width - ucVLC.Width;

            this.MinimumSize = DefaultClientSize;

            Debug.WriteLine(LibVlc.GetLibVlcVersion());

            media  = new VlcMedia(instance, String.Format("udp://@{0}", streamAddress));
            player = new VlcMediaPlayer(media);

            stoppedDelegate = new LibVlc.EventCallbackDelegate(MediaPlayerStopped);
            playingDelegate = new LibVlc.EventCallbackDelegate(MediaPlayerPlaying);

            player.EventAttach(LibVlc.libvlc_event_e.libvlc_MediaStateChanged, stoppedDelegate);
            player.EventAttach(LibVlc.libvlc_event_e.libvlc_MediaPlayerStopped, stoppedDelegate);
            player.EventAttach(LibVlc.libvlc_event_e.libvlc_MediaPlayerPlaying, playingDelegate);

            player.Drawable = ucVLC.Handle;
            //ucVLC.BringToFront();
            player.Play();

            multicastClient = new MulticastClient(messageAddress.IP, messageAddress.Port);
            multicastClient.OnInputPositionReceived += multicastClient_OnInputPositionReceived;
            multicastClient.BeginReceive();
        }
コード例 #21
0
    public static void Main(string[] args)
    {
        if (args.Length < 1)
        {
            Console.WriteLine("Please specify a file to play");
            return;
        }

        VlcConfig vlcConfig = new VlcConfig();

        vlcConfig.PluginPath = "C:\\Program Files\\VideoLAN\\VLC\\Plugins";

        VlcInstance e = new VlcInstance(vlcConfig);

        Console.WriteLine("Engine Init");
        Console.WriteLine("-------------------");
        foreach (VlcLogMessage vlm in e.VlcLog)
        {
            Console.WriteLine("{0} {1} {2} {3} {4}", vlm.Severity, vlm.Type, vlm.Name, vlm.Header, vlm.Message);
        }

        e.VlcLog.Clear();

        int id = e.VlcPlaylist.Add(args[0], "");

        Console.WriteLine("-------------------");
        Console.WriteLine("Added {0}", args[0]);
        Console.WriteLine("-------------------");

        foreach (VlcLogMessage vlm in e.VlcLog)
        {
            Console.WriteLine("{0} {1} {2} {3} {4}", vlm.Severity, vlm.Type, vlm.Name, vlm.Header, vlm.Message);
        }

        e.VlcLog.Clear();
        e.VlcPlaylist.Play(id);

        Console.WriteLine("-------------------");
        Console.WriteLine("Playing {0}", id);
        Console.WriteLine("-------------------");

        foreach (VlcLogMessage vlm in e.VlcLog)
        {
            Console.WriteLine("{0} {1} {2} {3} {4}", vlm.Severity, vlm.Type, vlm.Name, vlm.Header, vlm.Message);
        }

        e.VlcLog.Clear();

        while (e.VlcPlaylist.IsPlaying)
        {
            foreach (VlcLogMessage vlm in e.VlcLog)
            {
                Console.WriteLine("{0} {1} {2} {3} {4}", vlm.Severity, vlm.Type, vlm.Name, vlm.Header, vlm.Message);
            }

            e.VlcLog.Clear();

            System.Threading.Thread.Sleep(5000);
            if (!e.VlcInput.IsInvalid)
            {
                Console.Write("{0} / {1}\r", e.VlcInput.Time / 1000, e.VlcInput.Length / 1000);
            }
        }
        Console.ReadLine();
    }
コード例 #22
-1
ファイル: Player.cs プロジェクト: Konzertheld/SharpShuffle
        public Player()
        {
            // Initialization (TODO: Make all the stuff configurable, of course)
            Playlist = new Playlist();
            PlayedHistory = new List<Song>();
            totalHistory = new List<Song>();
            Queue = new List<Song>();
            RandomSettings = new PlayerRandomSettings(100, true);
            PlaybackState = TP_PLAYBACKSTATE.Stopped;
            playbackMode = TP_PLAYBACKMODE.Playlist;
            playbackDirection = TP_PLAYBACKDIRECTION.Forward;
            PlaybackLoggingMode = TP_PLAYBACKLOG.After80Percent;
            historyPosition = -1;

            // VLC Initialization
            string[] args = new string[] {
                "--ignore-config",
                @"--plugin-path=C:\Program Files (x86)\VideoLAN\VLC\plugins",
                //,"--vout-filter=deinterlace", "--deinterlace-mode=blend"
            };

            instance = new VlcInstance(args);
            vlc = null;
            factory = new MediaPlayerFactory();
            /*vlc = factory.CreatePlayer<IVideoPlayer>();
            vlc.Events.MediaEnded += new EventHandler(Events_MediaEnded);
            vlc.Events.TimeChanged += new EventHandler<Declarations.Events.MediaPlayerTimeChanged>(Events_TimeChanged);
            vlc.Events.PlayerPlaying += new EventHandler(Events_PlayerPlaying);*/
        }