internal void VlcControl_Playing(object sender, VlcMediaPlayerPlayingEventArgs e)
        {
            VlcControl control = (VlcControl)sender;

            Size        size    = new Size(-1, -1);
            Side        side    = (control == form.mediaViewerLeft.VlcControl) ? Side.Left : Side.Right;
            RichTextBox infoBox = (side == Side.Left) ? form.infoRichTextBoxLeft : form.infoRichTextBoxRight;

            VlcMedia media = control.GetCurrentMedia();

            // Currently grabbing tracksinformation 0, could be wrong in some cases.
            size.Width  = media.TracksInformations.Length > 0 ? (int)media.TracksInformations[0].Video.Width : -1;
            size.Height = media.TracksInformations.Length > 0 ? (int)media.TracksInformations[0].Video.Height : -1;

            if (size != new Size(-1, -1))
            {
                // Update appropriate fileprint with the new found size, just incase it's needed later.
                (side == Side.Left ? inspectingDuplicate.fileprint1 : inspectingDuplicate.fileprint2).SetVideoSize(size);

                infoBox.Invoke(() =>
                {
                    if (!infoBox.Text.Contains("Width"))
                    {
                        infoBox.AppendText($"Duration: {media.Duration.Seconds}s\n");

                        ShowFileInfo(side, size, false);
                    }
                });
            }
        }
Esempio n. 2
0
        private void ObtenerDatosVideo()
        {
            var mediaInformation = vlcControl1.GetCurrentMedia().Tracks;

            foreach (var mediaTrack in mediaInformation)
            {
                if (mediaTrack.TrackInfo is VideoTrack)
                {
                    videoHeight = Convert.ToInt32(((VideoTrack)mediaTrack.TrackInfo).Height);
                    videoWidth  = Convert.ToInt32(((VideoTrack)mediaTrack.TrackInfo).Width);
                    break;
                }
            }
        }
Esempio n. 3
0
        public void UnloadMedia(bool forceVideoWait = false)
        {
            if (Enabled)
            {
                Console.WriteLine($"{Name} Unloading Media!");

                if (pictureBox.Image != null)
                {
                    pictureBox.Image.Dispose();
                }

                pictureBox.Image = null;

                CurrentMedia = null;

                if (vlcControl != null)
                {
                    if (forceVideoWait)
                    {
                        vlcControl.Stop();
                        vlcControl.ResetMedia();

                        while (vlcControl.GetCurrentMedia() != null)
                        {
                            //Block while waiting for media to unload.
                        }
                    }
                    else
                    {
                        ThreadPool.QueueUserWorkItem(_ =>
                        {
                            vlcControl.Stop();
                            vlcControl.ResetMedia();
                        });
                    }
                }

                //Invoke((MethodInvoker)delegate { NotifyPropertyChanged(nameof(EnableButtons)); });
                NotifyPropertyChanged(nameof(EnableButtons));
            }
        }
Esempio n. 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            Button btn = (Button)sender;
            VlcControl control = (VlcControl)btn.Tag;
            VlcMedia media = control.GetCurrentMedia();

            if (btn.Text == "Rec.")
            {
                control.Stop();
                string[] prms = new string[] { ":sout=#duplicate{dst=std{access=file,mux=mp4,dst='" + media.Title.Substring(7).Replace("/", "_").Replace(":", "-") + ".mp4'},dst=display}" };
                control.Play(new Uri(media.Mrl), prms);
                control.Refresh();
                btn.Text = "Stop";
            }
            else
            {
                control.Stop();
                string[] prms = new string[] { "" };
                control.Play(new Uri(media.Mrl), prms);
                btn.Text = "Rec.";
            }
        }
Esempio n. 5
0
        private void OnVlcPlaying(object sender, Vlc.DotNet.Core.VlcMediaPlayerPlayingEventArgs e)
        {
            VlcControl vlc = (VlcControl)sender;

            vlc.UseWaitCursor = false;

            vlcOverlay[vlc.TabIndex].HideNotification();

            var mediaInformations = vlc.GetCurrentMedia().TracksInformations;

            foreach (var mediaInformation in mediaInformations)
            {
                if (mediaInformation.Type == Vlc.DotNet.Core.Interops.Signatures.MediaTrackTypes.Audio)
                {
                    log.Debug(string.Format("{0} Audio info - Codec: {1}, Channels: {2}, Rate: {3}", vlc.Name, mediaInformation.CodecName, mediaInformation.Audio.Channels, mediaInformation.Audio.Rate));
                    vlcOverlay[vlc.TabIndex].ShowNotification("Audio stream active", 5000);
                    vlcOverlay[vlc.TabIndex].ShowMuteButton(true);
                }
                else if (mediaInformation.Type == Vlc.DotNet.Core.Interops.Signatures.MediaTrackTypes.Video)
                {
                    log.Debug(string.Format("{0} Video info - Codec: {1}, Height: {2}, Width: {3}", vlc.Name, mediaInformation.CodecName, mediaInformation.Video.Height, mediaInformation.Video.Width));
                }
            }
        }