private void previewButton_Click(object sender, System.EventArgs e) { // If the player is null, create a new one. // Otherwise use the existing player to load the latest preview. if (player == null || player.IsDisposed) player = new VideoPlayer(); bool videoLoaded = player.loadVideo(mainForm, avisynthScript.Text, PREVIEWTYPE.REGULAR, false, true, player.CurrentFrame); if (videoLoaded) { player.disableIntroAndCredits(); reader = player.Reader; isPreviewMode = true; sendCropValues(); player.Show(); } }
private bool showOriginal() { if (player == null || player.IsDisposed) { player = new VideoPlayer(); } this.isPreviewMode = false; if (player.loadVideo(mainForm, originalScript, PREVIEWTYPE.REGULAR, false, originalInlineAvs, player.CurrentFrame)) { player.Show(); reader = player.Reader; sendCropValues(); if (mainForm.Settings.AlwaysOnTop) player.TopMost = true; return true; } else { player.Close(); player = null; return false; } }
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(); } 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); }
public AviSynthWindow(MainForm mainForm) { this.loaded = false; this.mainForm = mainForm; InitializeComponent(); avsProfile.Manager = MainForm.Instance.Profiles; this.controlsToDisable = new List<Control>(); this.controlsToDisable.Add(reopenOriginal); this.controlsToDisable.Add(filtersGroupbox); this.controlsToDisable.Add(deinterlacingGroupBox); this.controlsToDisable.Add(mpegOptGroupBox); this.controlsToDisable.Add(aviOptGroupBox); this.controlsToDisable.Add(resNCropGroupbox); this.controlsToDisable.Add(previewAvsButton); this.controlsToDisable.Add(saveButton); this.controlsToDisable.Add(arChooser); this.controlsToDisable.Add(inputDARLabel); this.controlsToDisable.Add(signalAR); this.controlsToDisable.Add(avisynthScript); this.controlsToDisable.Add(openDLLButton); this.controlsToDisable.Add(dgOptions); enableControls(false); script = new StringBuilder(); this.path = mainForm.MeGUIPath; this.resizeFilterType.Items.Clear(); this.resizeFilterType.DataSource = ScriptServer.ListOfResizeFilterType; this.resizeFilterType.BindingContext = new BindingContext(); this.noiseFilterType.Items.Clear(); this.noiseFilterType.DataSource = ScriptServer.ListOfDenoiseFilterType; this.noiseFilterType.BindingContext = new BindingContext(); this.deintFieldOrder.Items.Clear(); this.deintFieldOrder.DataSource = ScriptServer.ListOfFieldOrders; this.deintFieldOrder.BindingContext = new BindingContext(); this.deintSourceType.Items.Clear(); this.deintSourceType.DataSource = ScriptServer.ListOfSourceTypes; this.deintSourceType.BindingContext = new BindingContext(); this.cbNvDeInt.Items.Clear(); this.cbNvDeInt.DataSource = ScriptServer.ListOfNvDeIntType; this.cbNvDeInt.BindingContext = new BindingContext(); deintFieldOrder.SelectedIndex = -1; deintSourceType.SelectedIndex = -1; cbNvDeInt.SelectedIndex = 0; cbCharset.SelectedIndex = 0; this.noiseFilterType.SelectedIndexChanged += new System.EventHandler(this.noiseFilterType_SelectedIndexChanged); this.resizeFilterType.SelectedIndexChanged += new System.EventHandler(this.resizeFilterType_SelectedIndexChanged); this.cbNvDeInt.SelectedIndexChanged += new System.EventHandler(this.cbNvDeInt_SelectedIndexChanged); player = null; this.crop.Checked = false; this.cropLeft.Value = 0; this.cropTop.Value = 0; this.cropRight.Value = 0; this.cropBottom.Value = 0; deinterlaceType.DataSource = new DeinterlaceFilter[] { new DeinterlaceFilter("Do nothing (source not detected)", "#blank deinterlace line") }; this.jobUtil = new JobUtil(mainForm); this.showScript(); this.loaded = true; ProfileChanged(null, null); }
/// <summary> /// callback for the video player window closing /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void player_Closed(object sender, EventArgs e) { info.DAR = player.DAR; this.player = null; }
/// <summary> /// handler for the WindowClosed event /// sets the player back to null so that the next time preview is pressed /// we open a new window /// </summary> private void player_Closed(object sender, EventArgs e) { player = null; }
/// <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.Info.DAR; player.DAR = info.DAR; player.IntroCreditsFrameSet += new IntroCreditsFrameSetCallback(player_IntroCreditsFrameSet); player.Closed += new EventHandler(player_Closed); player.Show(); if (mainForm.Settings.AlwaysOnTop) player.TopMost = true; } }
internal void ClosePlayer() { if (this.player != null) { player.Close(); player = null; } }
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(); } else return; } if (chapterListView.SelectedItems.Count == 1) // 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); }
/// <summary> /// callback for the video player window closing /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void player_Closed(object sender, EventArgs e) { this.player = null; }