Exemplo n.º 1
0
        /// <summary>
        /// opens the AviSynth preview for a given AviSynth script
        /// gets the properties of the video, registers the callbacks, updates the video bitrate (we know the lenght of the video now) and updates the commandline
        /// with the scriptname
        /// </summary>
        /// <param name="fileName">the AviSynth script to be opened</param>
        private void openAvisynthScript(string fileName)
        {
            if (this.player != null) // make sure only one preview window is open at all times
            {
                player.Close();
            }
            player   = new VideoPlayer();
            info.DAR = null; // to be sure to initialize DAR values
            bool videoLoaded = player.loadVideo(mainForm, fileName, PREVIEWTYPE.CREDITS, true);

            if (videoLoaded)
            {
                info.DAR   = info.DAR ?? player.File.VideoInfo.DAR;
                player.DAR = info.DAR;
                FrameRate  = player.Framerate;
                player.IntroCreditsFrameSet += new IntroCreditsFrameSetCallback(player_IntroCreditsFrameSet);
                player.Closed += new EventHandler(player_Closed);
                player.Show();
                player.SetScreenSize();
                if (mainForm.Settings.AlwaysOnTop)
                {
                    player.TopMost = true;
                }
            }
        }
Exemplo n.º 2
0
 private void showVideoButton_Click(object sender, System.EventArgs e)
 {
     if (!this.videoInput.Equals(""))
     {
         if (player == null)
         {
             player = new VideoPlayer();
             bool videoLoaded = player.loadVideo(mainForm, videoInput, PREVIEWTYPE.CHAPTERS, false);
             if (videoLoaded)
             {
                 player.Closed     += new EventHandler(player_Closed);
                 player.ChapterSet += new ChapterSetCallback(player_ChapterSet);
                 if (introEndFrame > 0)
                 {
                     player.IntroEnd = this.introEndFrame;
                 }
                 if (creditsStartFrame > 0)
                 {
                     player.CreditsStart = this.creditsStartFrame;
                 }
                 player.Show();
                 player.SetScreenSize();
                 this.TopMost = player.TopMost = true;
                 if (!mainForm.Settings.AlwaysOnTop)
                 {
                     this.TopMost = player.TopMost = false;
                 }
             }
             else
             {
                 return;
             }
         }
         if (chapterListView.SelectedItems.Count == 1 && chapterListView.SelectedItems[0].Tag != null) // a zone has been selected, show that zone
         {
             Chapter chap        = (Chapter)chapterListView.SelectedItems[0].Tag;
             int     time        = Util.getTimeCode(chap.timecode);
             double  framerate   = player.Framerate;
             int     frameNumber = Util.convertTimecodeToFrameNumber(time, framerate);
             player.CurrentFrame = frameNumber;
         }
         else                 // no chapter has been selected.. but if start time is configured, show the frame in the preview
         {
             if (!startTime.Text.Equals(""))
             {
                 int    time        = Util.getTimeCode(startTime.Text);
                 double framerate   = player.Framerate;
                 int    frameNumber = Util.convertTimecodeToFrameNumber(time, framerate);
                 player.CurrentFrame = frameNumber;
             }
         }
     }
     else
     {
         MessageBox.Show("Please configure video input first", "No video input found", MessageBoxButtons.OK, MessageBoxIcon.Stop);
     }
 }
Exemplo n.º 3
0
 private void showVideoButton_Click(object sender, System.EventArgs e)
 {
     if (!this.input.Equals(""))
     {
         if (player == null)
         {
             player = new VideoPlayer();
             bool videoLoaded = player.loadVideo(mainForm, input, PREVIEWTYPE.ZONES, false);
             if (videoLoaded)
             {
                 player.ZoneSet += new ZoneSetCallback(player_ZoneSet);
                 player.Closed  += new EventHandler(player_Closed);
                 if (introEndFrame > 0)
                 {
                     player.IntroEnd = this.introEndFrame;
                 }
                 if (creditsStartFrame > 0)
                 {
                     player.CreditsStart = this.creditsStartFrame;
                 }
                 player.Show();
                 player.SetScreenSize();
             }
             else
             {
                 return;
             }
         }
         if (zoneListView.SelectedItems.Count == 1) // a zone has been selected, show that zone
         {
             Zone zone = (Zone)zoneListView.SelectedItems[0].Tag;
             player.ZoneStart = zone.startFrame;
             player.ZoneEnd   = zone.endFrame;
         }
         else // no zone has been selected.. but if start and / or end frame have been configured show them in the preview
         {
             if (!startFrame.Text.Equals(""))
             {
                 player.ZoneStart = Int32.Parse(startFrame.Text);
             }
             if (!endFrame.Text.Equals(""))
             {
                 player.ZoneEnd = Int32.Parse(endFrame.Text);
             }
         }
     }
     else
     {
         MessageBox.Show("Please configure video input first", "No video input found", MessageBoxButtons.OK, MessageBoxIcon.Stop);
     }
 }
Exemplo n.º 4
0
        private void showVideoButton_Click(object sender, System.EventArgs e)
        {
            if (String.IsNullOrEmpty(this.videoInput) || player == null)
            {
                using (OpenFileDialog d = new OpenFileDialog())
                {
                    d.Filter      = "AviSynth Script|*.avs";
                    d.Multiselect = false;
                    if (!String.IsNullOrEmpty(this.videoInput))
                    {
                        d.FileName = videoInput;
                    }
                    if (d.ShowDialog() != DialogResult.OK)
                    {
                        MessageBox.Show("Please configure video input first", "No video input found", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                        return;
                    }

                    this.videoInput = d.FileName;
                }
            }

            if (player == null)
            {
                player = new VideoPlayer();
            }

            if (player.loadVideo(MainForm.Instance, videoInput, PREVIEWTYPE.CHAPTERS, false))
            {
                player.Closed     += new EventHandler(player_Closed);
                player.ChapterSet += new ChapterSetCallback(player_ChapterSet);
                if (IntroEndFrame > 0)
                {
                    player.IntroEnd = this.IntroEndFrame;
                }
                if (CreditsStartFrame > 0)
                {
                    player.CreditsStart = this.CreditsStartFrame;
                }
                player.Show();
                player.SetScreenSize();
                this.TopMost = player.TopMost = true;
                if (!MainForm.Instance.Settings.AlwaysOnTop)
                {
                    player.TopMost = false;
                }
                if (!chkOnTop.Checked)
                {
                    this.TopMost = false;
                }

                bNoUpdates          = true;
                fpsChooserOut.Value = (decimal)player.Framerate;
                if (fpsChooserIn.Value == null || !bInputFPSKnown)
                {
                    fpsChooserIn.Value = (decimal)player.Framerate;
                }
                bNoUpdates = false;
            }
            else
            {
                return;
            }

            if (chapterListView.SelectedItems.Count == 1 && chapterListView.SelectedItems[0].Tag != null)
            {
                // a chapter has been selected, show that chapter
                SetPlayerPosition(pgc.Chapters[chapterListView.SelectedIndices[0]]);
            }
            else if (pgc.HasChapters)
            {
                // select first non 00:00:00 chapter
                Chapter chapter = pgc.Chapters[0];
                if (pgc.Chapters[0].Time.TotalMilliseconds == 0 && pgc.Chapters.Count > 1)
                {
                    chapter = pgc.Chapters[1];
                }
                SetPlayerPosition(chapter);
            }
        }