public OneClickPostProcessor(MainForm mainForm, D2VIndexJob ijob) { this.job = ijob; this.mainForm = mainForm; this.jobUtil = mainForm.JobUtil; this.vUtil = new VideoUtil(mainForm); }
public VobSubIndexWindow(MainForm mainForm) { InitializeComponent(); this.mainForm = mainForm; this.vUtil = new VideoUtil(mainForm); this.jobUtil = new JobUtil(mainForm); }
private static LogItem postprocess(MainForm mainForm, Job ajob) { if (!(ajob is D2VIndexJob)) return null; D2VIndexJob job = (D2VIndexJob)ajob; if (job.PostprocessingProperties != null) return null; StringBuilder logBuilder = new StringBuilder(); VideoUtil vUtil = new VideoUtil(mainForm); Dictionary<int, string> audioFiles = vUtil.getAllDemuxedAudio(job.AudioTracks, job.Output, 8); if (job.LoadSources) { if (job.DemuxMode != 0 && audioFiles.Count > 0) { string[] files = new string[audioFiles.Values.Count]; audioFiles.Values.CopyTo(files, 0); Util.ThreadSafeRun(mainForm, new MethodInvoker( delegate { mainForm.Audio.openAudioFile(files); })); } // if the above needed delegation for openAudioFile this needs it for openVideoFile? // It seems to fix the problem of ASW dissapearing as soon as it appears on a system (Vista X64) Util.ThreadSafeRun(mainForm, new MethodInvoker( delegate { AviSynthWindow asw = new AviSynthWindow(mainForm, job.Output); asw.OpenScript += new OpenScriptCallback(mainForm.Video.openVideoFile); asw.Show(); })); } return null; }
public void Run(MainForm info) { // normal video verification string error = null; if ((error = info.Video.verifyVideoSettings()) != null) { MessageBox.Show(error, "Unsupported video configuration", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } if ((error = info.Audio.verifyAudioSettings()) != null && !error.Equals("No audio input defined.")) { MessageBox.Show(error, "Unsupported audio configuration", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } if (info.Video.CurrentSettings.EncodingMode == 2 || info.Video.CurrentSettings.EncodingMode == 5) { MessageBox.Show("First pass encoding is not supported for automated encoding as no output is generated.\nPlease choose another encoding mode", "Improper configuration", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } VideoCodecSettings vSettings = info.Video.CurrentSettings.Clone(); Zone[] zones = info.Video.Info.Zones; // We can't simply modify the zones in place because that would reveal the final zones config to the user, including the credits/start zones bool cont = info.JobUtil.getFinalZoneConfiguration(vSettings, info.Video.Info.IntroEndFrame, info.Video.Info.CreditsStartFrame, ref zones); if (cont) { ulong length = 0; double framerate = 0.0; VideoStream myVideo = new VideoStream(); JobUtil.getInputProperties(out length, out framerate, info.Video.VideoInput); myVideo.Input = info.Video.Info.VideoInput; myVideo.Output = info.Video.Info.VideoOutput; myVideo.NumberOfFrames = length; myVideo.Framerate = (decimal)framerate; myVideo.DAR = info.Video.Info.DAR; myVideo.VideoType = info.Video.CurrentMuxableVideoType; myVideo.Settings = vSettings; VideoInfo vInfo = info.Video.Info.Clone(); // so we don't modify the data on the main form vInfo.Zones = zones; using (AutoEncodeWindow aew = new AutoEncodeWindow(myVideo, info.Audio.AudioStreams, info, info.Video.PrerenderJob, vInfo)) { if (aew.init()) { info.ClosePlayer(); aew.ShowDialog(); } else MessageBox.Show("The currently selected combination of video and audio output cannot be muxed", "Unsupported configuration", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }
public AdaptiveMuxWindow(MainForm mainForm) : base(mainForm) { InitializeComponent(); jobUtil = new JobUtil(mainForm); muxProvider = mainForm.MuxProvider; audioTracks[0].Filter = VideoUtil.GenerateCombinedFilter(ContainerManager.AudioTypes.ValuesArray); subtitleTracks[0].Filter = VideoUtil.GenerateCombinedFilter(ContainerManager.SubtitleTypes.ValuesArray); vInput.Filter = VideoUtil.GenerateCombinedFilter(ContainerManager.VideoTypes.ValuesArray); cbContainer.Visible = true; lbContainer.Visible = true; this.cbContainer.SelectedIndexChanged += new System.EventHandler(this.cbContainer_SelectedIndexChanged); }
public void Run(MainForm info) { using (Calculator calc = new Calculator(info)) { ulong nbFrames = 0; double framerate = 0.0; int hRes = 0, vRes = 0; Dar dar = new Dar(); if (!string.IsNullOrEmpty(info.Video.VideoInput)) JobUtil.getAllInputProperties(out nbFrames, out framerate, out hRes, out vRes, out dar, info.Video.VideoInput); calc.SetDefaults(nbFrames, framerate, hRes, vRes, info.Video.CurrentSettings, info.Audio.AudioStreams); DialogResult dr = calc.ShowDialog(); if (dr != DialogResult.OK) return; if (info.Video.CurrentSettings.EncoderType != calc.SelectedVCodec) return; VideoCodecSettings settings = info.Video.CurrentSettings; if (settings.EncodingMode == 1 || settings.EncodingMode == 9) { dr = MessageBox.Show("Copy calculated bitrate into current video settings and change encoding mode to automated " + info.Settings.NbPasses + "-pass?", "Save calculated bitrate?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr != DialogResult.Yes) return; if (info.Settings.NbPasses == 3) settings.EncodingMode = 8; // Automated 3-pass else settings.EncodingMode = 4; // Automated 2-pass } else { dr = MessageBox.Show("Copy calculated bitrate into current video settings?", "Save calculated bitrate?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr != DialogResult.Yes) return; } settings.BitrateQuantizer = calc.VideoBitrate; } }
public MuxWindow(IMuxing muxer, MainForm mainForm) : base(mainForm) { InitializeComponent(); this.muxer = muxer; if (muxer.GetSupportedAudioTypes().Count == 0) audio.Enabled = false; if (muxer.GetSupportedChapterTypes().Count == 0) chaptersGroupbox.Enabled = false; if (muxer.GetSupportedSubtitleTypes().Count == 0) subtitles.Enabled = false; if (muxer.GetSupportedChapterTypes().Count == 0) chaptersGroupbox.Enabled = false; if (muxer.GetSupportedDeviceTypes().Count == 0) cbType.Enabled = false; muxedInput.Filter = muxer.GetMuxedInputFilter(); audioTracks[0].Filter = muxer.GetAudioInputFilter(); output.Filter = muxer.GetOutputTypeFilter(); subtitleTracks[0].Filter = muxer.GetSubtitleInputFilter(); vInput.Filter = muxer.GetVideoInputFilter(); chapters.Filter = muxer.GetChapterInputFilter(); }
public baseMuxWindow(MainForm mainForm) : this() { this.mainForm = mainForm; this.settings = mainForm.Settings; muxProvider = mainForm.MuxProvider; cbType.Items.Add("Standard"); cbType.Items.AddRange(muxProvider.GetSupportedDevices().ToArray()); cbType.SelectedIndex = 0; }
private static IJobProcessor init(MainForm mf, Job j) { if (j is MuxJob && (j as MuxJob).MuxType == MuxerType.MKVMERGE) return new MkvMergeMuxer(mf.Settings.MkvmergePath); return null; }
/// <summary> /// launches the vobsub indexer /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void Run(MainForm info) { new VobSubIndexWindow(info).Show(); }
/// <summary> /// loads the video, sets up the proper window size and enables / disables the GUI buttons depending on the /// preview type set /// </summary> /// <param name="path">path of the video file to be loaded</param> /// <param name="type">type of window</param> /// <returns>true if the video could be opened, false if not</returns> public bool loadVideo(MainForm mainForm, string path, PREVIEWTYPE type, bool hasAR) { return loadVideo(mainForm, path, type, hasAR, false, -1); }
public OneClickWindow(MainForm mainForm, JobUtil jobUtil, VideoEncoderProvider vProv, AudioEncoderProvider aProv) { this.mainForm = mainForm; vUtil = new VideoUtil(mainForm); this.muxProvider = mainForm.MuxProvider; acceptableContainerTypes = muxProvider.GetSupportedContainers().ToArray(); InitializeComponent(); initTabs(); videoProfile.Manager = mainForm.Profiles; initAudioHandler(); avsProfile.Manager = mainForm.Profiles; initOneClickHandler(); audioTrack1.StandardItems = audioTrack2.StandardItems = new object[] { "None" }; audioTrack1.SelectedIndex = audioTrack2.SelectedIndex = 0; //if containerFormat has not yet been set by the oneclick profile, add supported containers if (containerFormat.Items.Count == 0) { containerFormat.Items.AddRange(muxProvider.GetSupportedContainers().ToArray()); this.containerFormat.SelectedIndex = 0; } //add device type if (devicetype.Items.Count == 0) { devicetype.Items.Add("Standard"); devicetype.Items.AddRange(muxProvider.GetSupportedDevices().ToArray()); this.devicetype.SelectedIndex = 0; } showAdvancedOptions_CheckedChanged(null, null); }
public void Run(MainForm info) { OneClickWindow ocmt = new OneClickWindow(info, info.JobUtil, info.Video.VideoEncoderProvider, new AudioEncoderProvider()); ocmt.Show(); }
/// <summary> /// loads the video, sets up the proper window size and enables / disables the GUI buttons depending on the /// preview type set /// </summary> /// <param name="path">path of the video file to be loaded</param> /// <param name="type">type of window</param> /// <param name="inlineAvs">true if path contain not filename but avsynth script to be parsed</param> /// <returns>true if the video could be opened, false if not</returns> public bool loadVideo(MainForm mainForm, string path, PREVIEWTYPE type, bool hasAR, bool inlineAvs) { return loadVideo(mainForm, path, type, hasAR, inlineAvs, -1); }
/// <summary> /// constructor that first initializes everything using the default constructor /// then opens a preview window with the video given as parameter /// </summary> /// <param name="videoInput">the DGIndex script to be loaded</param> public AviSynthWindow(MainForm mainForm, string videoInput) : this(mainForm) { openVideoSource(videoInput); }
private static IJobProcessor init(MainForm mf, Job j) { if (j is MuxJob && (j as MuxJob).MuxType == MuxerType.AVIMUXGUI) return new AMGMuxer(mf.Settings.AviMuxGUIPath); return null; }
/// <summary> /// loads the video, sets up the proper window size and enables / disables the GUI buttons depending on the /// preview type set /// </summary> /// <param name="path">path of the video file to be loaded</param> /// <param name="type">type of window</param> /// <param name="inlineAvs">true if path contain not filename but avsynth script to be parsed</param> /// <param name="startFrame">Select a specific frame to start off with or -1 for middle of video</param> /// <returns>true if the video could be opened, false if not</returns> public bool loadVideo(MainForm mainForm, string path, PREVIEWTYPE type, bool hasAR, bool inlineAvs, int startFrame) { lock (this) { if (file != null) file.Dispose(); if (videoPreview.Image != null) videoPreview.Image.Dispose(); // get rid of previous bitmap } try { if (inlineAvs) { file = AvsFile.ParseScript(path); } else { file = mainForm.MediaFileFactory.Open(path); if (file == null && !(file.Info.HasVideo && file.CanReadVideo)) throw new ArgumentException("The video stream cannot be opened"); } reader = file.GetVideoReader(); } catch (AviSynthException e) { MessageBox.Show("AviSynth script error:\r\n" + e.Message, "AviSynth error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } catch (ArgumentException e) { MessageBox.Show("AviSynth script error:\r\n" + e.Message, "AviSynth error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } catch (Exception e) { MessageBox.Show("The file " + path + " cannot be opened.\r\n Please make sure it's a valid AviSynth script and that AviSynth is " + " properly installed.\r\nYou can check the validity of your script and AviSynth installation by opening the file in your favorite media player.\r\n" + " If that works, try opening the video in VirtualDub(Mod) as well. If the former works and the latter doesn't, install a YV12 codec.\r\n" + "Error message for your reference: " + e.Message, "Cannot open video input", MessageBoxButtons.OK, MessageBoxIcon.Stop); return false; } if (reader != null && reader.FrameCount > 0) { this.positionSlider.Minimum = 0; this.positionSlider.Maximum = reader.FrameCount - 1; this.positionSlider.Value = startFrame >= 0 ? startFrame : reader.FrameCount / 2; this.positionSlider.TickFrequency = this.positionSlider.Maximum / 20; this.viewerType = type; this.hasAR = hasAR; this.videoWindowWidth = (int)file.Info.Width; this.videoWindowHeight = (int)file.Info.Height; zoomWidth = (int)file.Info.Width; doInitialAdjustment(); adjustSize(); positionSlider_Scroll(null, null); // makes the image visible this.Text = "Current position: " + this.positionSlider.Value + "/" + this.positionSlider.Maximum; isRunning = false; millisecondsPerFrame = (int)(1000 / file.Info.FPS); return true; } return false; }
public void Run(MainForm info) { new FileIndexerWindow(info).Show(); }
public FileIndexerWindow(MainForm mainForm, string fileName, bool autoReturn) : this(mainForm, fileName) { CheckDGIIndexer(); openVideo(fileName); this.loadOnComplete.Checked = true; this.closeOnQueue.Checked = true; checkIndexIO(); }
public FileIndexerWindow(MainForm mainForm, string fileName) : this(mainForm) { CheckDGIIndexer(); openVideo(fileName); }
public FileIndexerWindow(MainForm mainForm) { InitializeComponent(); this.mainForm = mainForm; this.vUtil = new VideoUtil(mainForm); this.jobUtil = new JobUtil(mainForm); CheckDGIIndexer(); }
private static LogItem postprocess(MainForm mainForm, Job ajob) { if (!(ajob is FFMSIndexJob)) return null; FFMSIndexJob job = (FFMSIndexJob)ajob; StringBuilder logBuilder = new StringBuilder(); //VideoUtil vUtil = new VideoUtil(mainForm); if (job.LoadSources) { // if the above needed delegation for openAudioFile this needs it for openVideoFile? // It seems to fix the problem of ASW dissapearing as soon as it appears on a system (Vista X64) Util.ThreadSafeRun(mainForm, new MethodInvoker( delegate { AviSynthWindow asw = new AviSynthWindow(mainForm, job.Output); asw.OpenScript += new OpenScriptCallback(mainForm.Video.openVideoFile); asw.Show(); })); } return null; }
private static IJobProcessor init(MainForm mf, Job j) { if (j is MuxJob && (j as MuxJob).MuxType == MuxerType.TSMUXER) return new tsMuxeR(mf.Settings.TSMuxerPath); return null; }
public void Run(MainForm info) { if (info.Video.VideoInput.Equals("")) MessageBox.Show("You first need to load an AviSynth script", "No video configured", MessageBoxButtons.OK, MessageBoxIcon.Warning); else { int compliantLevel = 15; x264Settings currentX264Settings = (x264Settings)MainForm.Instance.Profiles.GetCurrentSettings("x264"); bool succ = info.JobUtil.validateAVCLevel(info.Video.VideoInput, currentX264Settings, out compliantLevel); if (succ) MessageBox.Show("This file matches the criteria for the level chosen", "Video validated", MessageBoxButtons.OK, MessageBoxIcon.Information); else { if (compliantLevel == -1) MessageBox.Show("Unable to open video", "Test failed", MessageBoxButtons.OK, MessageBoxIcon.Error); else { AVCLevels al = new AVCLevels(); string[] levels = al.getLevels(); string levelRequired = levels[compliantLevel]; string message = "This video source cannot be encoded to comply with the chosen level.\n" + "You need at least " + levelRequired + " for this source. Do you want\n" + "to increase the level automatically now?"; DialogResult dr = MessageBox.Show(message, "Test failed", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) currentX264Settings.Level = compliantLevel; } } } }
private static IJobProcessor init(MainForm mf, Job j) { if (j is VideoJob && (j as VideoJob).Settings is x264Settings) return new x264Encoder(mf.Settings.X264Path); return null; }
public MainForm() { System.Reflection.Assembly a = System.Reflection.Assembly.GetExecutingAssembly(); Version appVersion = a.GetName().Version; string appVersionString = appVersion.ToString(); if (Properties.Settings.Default.ApplicationVersion != appVersion.ToString()) { Properties.Settings.Default.Upgrade(); CustomUserSettings.Default.Upgrade(); Properties.Settings.Default.ApplicationVersion = appVersionString; } Instance = this; constructMeGUIInfo(); InitializeComponent(); System.Reflection.Assembly myAssembly = this.GetType().Assembly; string name = this.GetType().Namespace + "."; name = ""; string[] resources = myAssembly.GetManifestResourceNames(); this.trayIcon.Icon = new Icon(myAssembly.GetManifestResourceStream(name + "App.ico")); this.Icon = trayIcon.Icon; this.TitleText = Application.ProductName + " " + Application.ProductVersion; this.TitleText += " x64"; if (MainForm.Instance.Settings.AutoUpdate == true && MainForm.Instance.Settings.AutoUpdateServerSubList == 1) this.TitleText += " DEVELOPMENT UPDATE SERVER"; setGUIInfo(); Jobs.showAfterEncodingStatus(Settings); this.videoEncodingComponent1.FileType = MainForm.Instance.Settings.MainFileFormat; }
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); }
static void Main(string[] args) { // Parse for the need to run the program elevated Boolean bRunElevated = false, bForceAdmin = false; foreach (string strParam in args) { if (strParam.Equals("-elevate")) bRunElevated = true; else if (strParam.Equals("-forceadmin")) bForceAdmin = true; } // Check if the program can write to the program and avisynth plugin dir if (FileUtil.IsDirWriteable(Path.GetDirectoryName(Application.ExecutablePath)) == false) bForceAdmin = true; // If needed run as elevated process if (bForceAdmin && !bRunElevated) { try { Process p = new Process(); p.StartInfo.FileName = Application.ExecutablePath; p.StartInfo.Arguments = "-elevate"; p.StartInfo.Verb = "runas"; p.Start(); return; } catch { } } System.Windows.Forms.Application.EnableVisualStyles(); if (!mySingleInstanceMutex.WaitOne(0, false)) { if (DialogResult.Yes != MessageBox.Show("Running MeGUI instance detected!\n\rThere's not really much point in running multiple copies of MeGUI, and it can cause problems.\n\rDo You still want to run yet another MeGUI instance?", "Running MeGUI instance detected", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)) return; } Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); CommandlineParser parser = new CommandlineParser(); parser.Parse(args); MainForm mainForm = new MainForm(); mainForm.handleCommandline(parser); if (parser.start) Application.Run(mainForm); }
public void Run(MainForm info) { info.ClosePlayer(); AviSynthWindow asw = new AviSynthWindow(info); asw.OpenScript += new OpenScriptCallback(info.Video.openVideoFile); asw.Show(); }
private static LogItem postprocess(MainForm mainForm, Job job) { if (!(job is D2VIndexJob)) return null; D2VIndexJob ijob = (D2VIndexJob)job; if (ijob.PostprocessingProperties == null) return null; OneClickPostProcessor p = new OneClickPostProcessor(mainForm, ijob); return p.postprocess(); }