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); }
public VideoService( AudioService audioService, VideoUtil videoUtil, ContentValidator content, SubtitleValidator subtitle, BackgroundValidator background) { _audioService = audioService; _videoUtil = videoUtil; _content = content; _subtitle = subtitle; _background = background; }
public ReplayView(Window window, ReplayUtil replayUtil, VideoUtil videoUtil) { this.videoUtil = videoUtil; this.VideoPath = replayUtil.ReplayPath; GetFile(); this.SearchCommand = new DelegateCommand(Search); this.SearchAllCommand = new DelegateCommand(SearchAll); timer = new Timer();//时间函数 timer.Interval = 50; timer.Elapsed += new ElapsedEventHandler(Time_Elapsed); timer.Start(); PlayImage = "Image/Play.png"; }
public void TestManagedReferences() { Caps tmp = VideoUtil.FormatToTemplateCaps(Gst.Video.VideoFormat.RGBX); Caps caps = tmp.Copy(); caps[0]["width"] = 640; caps[0]["height"] = 480; caps.Append(tmp); Caps any = Caps.NewAny(); caps.Merge(any); }
private void selectAudio1Button_Click(object sender, EventArgs e) { openFileDialog.Filter = VideoUtil.GenerateCombinedFilter(ContainerManager.AudioTypes.ValuesArray); if (openFileDialog.ShowDialog() == DialogResult.OK) { FileSize f = FileSize.Of2(openFileDialog.FileName) ?? FileSize.Empty; size.CertainValue = f; AudioType aud2Type = VideoUtil.guessAudioType(openFileDialog.FileName); if (audio1Type.Items.Contains(aud2Type)) { audio1Type.SelectedItem = aud2Type; } } }
/// <summary> /// Gets the --fps value /// </summary> /// <returns>the --fps value</returns> public void getFPS(ref int fps_n, ref int fps_d) { string custom = _xs.CustomEncoderOptions; string strCustomValue; if (!extractCustomCommand("fps", out strCustomValue)) { return; } _xs.CustomEncoderOptions = custom; int fpsnum, fpsden; System.Globalization.CultureInfo culture = System.Globalization.CultureInfo.CreateSpecificCulture("en-US"); if (strCustomValue.Contains("/")) { if (!Int32.TryParse(strCustomValue.Split('/')[0], System.Globalization.NumberStyles.None, culture, out fpsnum)) { return; } if (!Int32.TryParse(strCustomValue.Split('/')[1], System.Globalization.NumberStyles.None, culture, out fpsden)) { return; } } else { double fps; if (!Double.TryParse(strCustomValue, System.Globalization.NumberStyles.AllowDecimalPoint, culture, out fps)) { return; } if (!VideoUtil.GetFPSDetails(fps, null, out fpsnum, out fpsden)) { return; } } if (_log != null) { _log.LogEvent("custom frame rate: " + fpsnum + "/" + fpsden); } fps_n = fpsnum; fps_d = fpsden; }
public async void ProcessVideos() { foreach (var file in RarList.FileList) { Task <bool> rarTask = null; Task <bool> thumbnailTask = null; Task <bool> coverTask = null; try { var videoTasks = new List <Task>(); if (CompressToRar) { rarTask = VideoUtil.ToRAR(file.Path, file.FileName); videoTasks.Add(rarTask); } if (GetThumbnail) { thumbnailTask = VideoCover.GetSnapshot(file.Path, file.FileName); videoTasks.Add(thumbnailTask); } if (GetCover) { coverTask = VideoCover.DownloadCovers(file.FileName); videoTasks.Add(coverTask); } await Task.WhenAll(videoTasks); if (rarTask != null) { file.RarStatus = await rarTask ? "OK" : "Error"; } if (thumbnailTask != null) { file.ThumbnailStatus = await thumbnailTask ? "OK" : "Error"; } if (coverTask != null) { file.CoverStatus = await coverTask ? "OK" : "Error"; } } catch (Exception ex) { Message = ex.InnerException != null ? ex.InnerException.Message : ex.Message; } } }
public static void ShowVideo(string videoAssetPath, Action onVideoWindowClose = null) { var window = (VideoWindow)ScriptableObject.CreateInstance <VideoWindow>(); window.playingClip = AssetDatabase.LoadAssetAtPath <VideoClip>(videoAssetPath); window.previewID = VideoUtil.PlayPreview(window.playingClip); Vector2 size = new Vector2(window.playingClip.width * videoClipSizeScale, window.playingClip.height * videoClipSizeScale); window.maxSize = window.minSize = size; window.position = VideoUtil.GetMainWindowCenteredPosition(size); window.titleContent = new GUIContent("VideoWindow"); window.ShowPopup(); window.Focus(); window.onVideoWindowClosed = onVideoWindowClose; instance = window; }
private void selectAudioFile(string file) { FileSize f = FileSize.Of2(file) ?? FileSize.Empty; //size.CertainValue = f; size.Text = f.ToString(); audio1Bitrate.Value = (length > 0) ? (long)(f.Bytes * 8) / 1000L / length : 0; name.Text = System.IO.Path.GetFileName(file); AudioType aud2Type = VideoUtil.guessAudioType(file); if (audio1Type.Items.Contains(aud2Type)) { audio1Type.SelectedItem = aud2Type; } }
public void GetVideoIdTest() { Assert.AreEqual("sm44422222222222222", VideoUtil.GetVideoId("sm44422222222222222")); Assert.AreEqual("so44422222", VideoUtil.GetVideoId("so44422222")); Assert.AreEqual("sm9", VideoUtil.GetVideoId("http://www.niconico.jp/sm9")); Assert.AreEqual("sm9", VideoUtil.GetVideoId("sm9 koreha")); Assert.AreEqual("123456", VideoUtil.GetVideoId("123456")); Assert.AreEqual("123456", VideoUtil.GetVideoId("http://www.niconico.jp/123456")); Assert.AreEqual("123456", VideoUtil.GetVideoId("http://www.niconico.jp/123456?eco=1")); Assert.AreEqual("123456", VideoUtil.GetVideoId("123456 xxx")); Assert.AreEqual(null, VideoUtil.GetVideoId("ss123456")); Assert.AreEqual(null, VideoUtil.GetVideoId("日本語")); Assert.AreEqual(null, VideoUtil.GetVideoId("xxxxxxxxxxxxxxxxx")); Assert.Catch(() => VideoUtil.GetVideoId(null)); Assert.AreEqual(null, VideoUtil.GetVideoId("12x3456")); }
public Besplitter(MainForm info) { this.info = info; InitializeComponent(); filters = new OutputFileType[] { AudioType.AC3, AudioType.MP2, AudioType.MP3, AudioType.RAWAAC, AudioType.WAV, AudioType.PCM }; input.Filter = VideoUtil.GenerateCombinedFilter(filters); output.Filter = input.Filter; }
static bool Register() { GLib.GType gtype = (GLib.GType) typeof(TransformSample); SetDetails(gtype, "Transform Sample", "Filter/Effect/Video", "Draws a moving line on top of a video stream and handles mouse clicks", "Sebastian Dröge <*****@*****.**>"); Caps tmp = VideoUtil.FormatToTemplateCaps((BitConverter.IsLittleEndian) ? VideoFormat.BGRX : VideoFormat.XRGB); Caps caps = tmp.Copy(); caps[0]["width"] = 640; caps[0]["height"] = 480; caps.Append(tmp); AddPadTemplate(gtype, new PadTemplate("src", PadDirection.Src, PadPresence.Always, caps)); AddPadTemplate(gtype, new PadTemplate("sink", PadDirection.Sink, PadPresence.Always, caps)); return(ElementFactory.Register(null, "transformsample", (uint)Gst.Rank.None, gtype)); }
private void b_action_Click(object sender, EventArgs e) { if (b_action.Text == "Обзор") { if (openFileDialog1.ShowDialog() == DialogResult.OK) { pictureBox1.Image = ResizeImg(Image.FromFile(openFileDialog1.FileName), 300, 300); } } else if (b_action.Text == "Снимок") { VideoUtil.CloseVideoSource(); b_action.Text = "Видео"; } else if (b_action.Text == "Видео") { VideoUtil.Start(comboBox1.SelectedIndex - 1); VideoUtil.VideoSource.NewFrame += videoSource_NewFrame; b_action.Text = "Снимок"; } }
public async Task <IActionResult> GetVideo(string name, bool thumb = true) { if (thumb) { var bytes = (await VideosService.GetItemThumbContents(name)).First; if (bytes == null) { bytes = (await VideosService.GetItemContents(name)).First; if (bytes != null) { bytes = await VideoUtil.CreateThumbnail(bytes); await VideosService.UpdateItemThumbContents(name, bytes); } } return(File(bytes, "image/jpeg")); } else { var bytes = (await VideosService.GetItemContents(name)).First; return(File(bytes, "video/mp4")); } }
private void button1_Click(object sender, EventArgs e) { //FolderBrowserDialog fbd = new FolderBrowserDialog(); //fbd.ShowDialog(); //string path = fbd.SelectedPath; string path = @"D:\娱乐\movie"; if (path.Length > 0) { VideoUtil myMpeg; VideoInfo vi; string[] files = Directory.GetFiles(path); listBox1.Items.Clear(); foreach (string file in files) { myMpeg = new VideoUtil(file); vi = myMpeg.GetVideoInfo(); listBox1.Items.Add(null == vi ? file + " 无法识别!": vi.ToString()); } } }
public AutoEncodeWindow(VideoStream videoStream, List<AudioJob> audioStreams, MainForm mainForm, bool prerender, VideoInfo vInfo) : this() { this.vInfo = vInfo; mainForm.Log.Add(log); this.videoStream = videoStream; this.audioStreams = audioStreams; this.prerender = prerender; this.mainForm = mainForm; jobUtil = new JobUtil(mainForm); vUtil = new VideoUtil(mainForm); muxProvider = mainForm.MuxProvider; container.Items.AddRange(muxProvider.GetSupportedContainers().ToArray()); splitting.MinimumFileSize = new FileSize(Unit.MB, 1); }
public async Task WriteOutput(string megaLinks, string rgLinks) { string imageCode = null; string imageCodeBlog = null; var isUncensored = VideoInfo.IsUncensored(id); var megaBackup = megaLinks; var rgBackup = rgLinks; var outputId = id; if (!isUncensored && !RealStreetAngels.Match(id) && !SiroutoDouga.Match(id)) { outputId = id.ToUpper(); int dash = 0; for (int i = 0; i < outputId.Length - 1; i++) { if (char.IsLetter(outputId[i])) { if (!char.IsDigit(outputId[i + 1])) { continue; } dash = i + 1; } } if (dash > 0) { outputId = outputId.Insert(dash, "-"); } } var flinks = new Dictionary <int, string> { { 0, ForumLinks1 }, { 1, ForumLinks2 }, { 2, ForumLinks3 }, //{ 3, ForumLinks4 }, }; var wlinks = new Dictionary <int, string> { { 0, WebLinks1 }, { 1, WebLinks2 }, { 2, WebLinks3 }, //{ 3, WebLinks4 }, }; if (flinks.Count(p => !string.IsNullOrEmpty(p.Value)) == 1 || wlinks.Count(p => !string.IsNullOrEmpty(p.Value)) == 1) { imageCode = flinks.First().Value; imageCodeBlog = wlinks.First().Value; } else { var fIndex = imageHostIndex % flinks.Count; var wIndex = fIndex < flinks.Count - 1 ? fIndex + 1 : 0; imageCode = flinks[fIndex]; imageCodeBlog = wlinks[wIndex]; if (string.IsNullOrEmpty(imageCode) || string.IsNullOrEmpty(imageCodeBlog)) { imageCode = flinks.Where(l => !string.IsNullOrEmpty(l.Value)).Select(l => l.Value).Random(); var imgCodeIndex = flinks.FirstOrDefault(l => l.Value == imageCode).Key; imageCodeBlog = wlinks.Where(l => l.Key != imgCodeIndex && !string.IsNullOrEmpty(l.Value)).Select(l => l.Value).Random(); } } imageHostIndex++; try { string filePath = null; string uploadPath = null; foreach (var path in UploadPaths) { if (!Directory.Exists(path)) { continue; } filePath = Directory.GetFiles(path, string.Format("{0}*.part*.rar", id), SearchOption.TopDirectoryOnly) .FirstOrDefault(); if (filePath == null) { continue; } uploadPath = path; break; } string fileFormat = null, fileSize = null; if (!string.IsNullOrEmpty(filePath) && !string.IsNullOrEmpty(uploadPath)) { fileFormat = VideoUtil.GetFileFormat(filePath); fileSize = VideoUtil.GetFileSizeGB(uploadPath, id) + "GB"; } var ouoShortening = urlShortenings.First(u => u.Name == "Ouo"); megaLinks = await ShortenFirstLink(ouoShortening, megaLinks); if (rgLinks.Contains("zippyshare")) { var eraShortening = urlShortenings.First(u => u.Name == "ERA.AC"); rgLinks = await ShortenFirstLink(eraShortening, rgLinks); } string links1 = null, links2 = null; switch (rnd.Next(0, 1000) % 2) { case 0: links1 = megaLinks; links2 = rgLinks; break; case 1: links1 = rgLinks; links2 = megaLinks; break; } var content = string.Empty; content = string.Format("{0}\\nor\\n{1}", links1, links2); content += "\\n\\nAll links are interchangeable and no password."; content = content.Replace("\\n", "<br />"); var contentBackup = string.Format("{0}\\nor\\n{1}", megaBackup, rgBackup); contentBackup += "\\n\\nAll links are interchangeable and no password."; contentBackup = contentBackup.Replace("\\n", "<br />"); var linksBackup = new LinksBackup { Id = id, Links = contentBackup, }; var linksPage = Blogger.CreateLinksPost(content); var shortenedLinks = new List <string>(); if (string.IsNullOrEmpty(linksPage)) { await GenerateOutput(outputId, fileSize, fileFormat, imageCode, imageCodeBlog, linksPage, linksBackup, isUncensored, shortenedLinks); } else { var firstShortenedLink = linksPage; if (isUncensored) { firstShortenedLink = await ouoShortening.GetLink(linksPage); } foreach (var urlShortening in urlShortenings.Where(u => u.Enabled)) { var shortenedLink = await urlShortening.GetLink(firstShortenedLink); if (!string.IsNullOrEmpty(shortenedLink)) { shortenedLinks.Add(shortenedLink); } } await GenerateOutput(outputId, fileSize, fileFormat, imageCode, imageCodeBlog, linksPage, linksBackup, isUncensored, shortenedLinks); } GenerateJavLibrary(shortenedLinks.Where(l => !l.Contains("shink")), fileSize, fileFormat, imageCode); GenerateWestern(shortenedLinks, fileSize, fileFormat, imageCode); GeneratePornBB(shortenedLinks, fileSize, fileFormat, imageCode); } catch (Exception ex) { logger.ErrorException(ex.Message, ex); } }
private void btnStartRecord_Click(object sender, EventArgs e) { videoUtil = new VideoUtil(@"d:\aaasss.avi"); videoUtil.MessageEvent += videoUtil_MessageEvent; videoUtil.StartRecord(); }
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 override void fillInfo() { base.fillInfo(); Type = AType = VideoUtil.guessAudioType(Filename); }
private void MainForm_FormClosed(object sender, FormClosedEventArgs e) { VideoUtil.CloseVideoSource(); }
public static async void TestBvToAv() { var AvId = await VideoUtil.BvToAv("BV17x411w7KC"); Console.WriteLine(AvId); }
private void OnDestroy() { VideoUtil.StopPreview(previewID); }
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 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; }
/* * 添加已选择的视频 */ private Canvas initSelectedVideo(StorageVideo video) { VideoListTag tag = new VideoListTag(); tag.isSelected = false; tag.storageVideo = video; Canvas selectedVideoCanvas = new Canvas(); selectedVideoCanvas.Name = "selectedVideoCanvas"; selectedVideoCanvas.Width = 100; selectedVideoCanvas.Height = 100; selectedVideoCanvas.Margin = new Thickness(10); selectedVideoCanvas.Tag = tag; //1.按钮 StorageImage storageImage = storageImageBll.get(video.storageImageId); string imgFullPath = FileUtil.notExistsShowDefault(storageImage?.url, Params.ImageNotExists); imgFullPath = AppDomain.CurrentDomain.BaseDirectory + imgFullPath; Image videoImage = new Image(); videoImage.Name = "videoImage1"; videoImage.Width = 100; videoImage.Height = 75; videoImage.Source = FileUtil.readImage2(imgFullPath, 200); videoImage.Stretch = Stretch.UniformToFill; //2.按钮行 Canvas bg = new Canvas(); bg.Name = "bg"; bg.Background = Brushes.Black; bg.Width = 100; bg.Height = 24; bg.Opacity = 0.6; bg.SetValue(Canvas.BottomProperty, 25.0); bg.SetValue(Canvas.LeftProperty, 0.0); //时长 string mmss = VideoUtil.duration2mmss(video.duration); Label lLabel = new Label(); lLabel.Width = 50; lLabel.Height = 24; lLabel.Content = mmss; lLabel.Foreground = Brushes.White; lLabel.SetValue(Canvas.LeftProperty, 0.0); lLabel.SetValue(Canvas.TopProperty, 0.0); bg.Children.Add(lLabel); //删除按钮 Button rbtn = new Button(); rbtn.Width = 16; rbtn.Height = 16; rbtn.BorderThickness = new Thickness(0); rbtn.Background = new ImageBrush { ImageSource = FileUtil.readImage(AppDomain.CurrentDomain.BaseDirectory + App.localStorage.icoRemove) , Stretch = Stretch.UniformToFill }; rbtn.SetValue(Canvas.RightProperty, -8.0); rbtn.SetValue(Canvas.TopProperty, -8.0); rbtn.Click += rbtnRemoveSelectedVideoClick; //标题 string videoFullPath = FileUtil.notExistsShowDefault(video?.url, Params.VideoNotExists); string fullFolder = FileUtil.getDirectory(AppDomain.CurrentDomain.BaseDirectory + videoFullPath); Label titleLabel = new Label(); titleLabel.Width = 100; titleLabel.Height = 25; titleLabel.Content = video.origFilename; titleLabel.Tag = fullFolder; titleLabel.SetValue(Canvas.LeftProperty, 0.0); titleLabel.SetValue(Canvas.BottomProperty, 0.0); titleLabel.ToolTip = video.origFilename; titleLabel.PreviewMouseLeftButtonUp += titleLabel_PreviewMouseLeftButtonUp; selectedVideoCanvas.Children.Add(videoImage); selectedVideoCanvas.Children.Add(bg); selectedVideoCanvas.Children.Add(titleLabel); selectedVideoCanvas.Children.Add(rbtn); return(selectedVideoCanvas); }
public static async void TestAvToBv() { var BvId = await VideoUtil.AvToBv(170001); Console.WriteLine(BvId); }
/* * 初始化一个图片控件 */ private Canvas initOneVideo(StorageVideo storageVideo) { VideoListTag tag = new VideoListTag(); tag.isSelected = false; tag.storageVideo = storageVideo; Canvas videoCanvas = new Canvas(); videoCanvas.Name = "videoCanvas"; videoCanvas.Width = 100; videoCanvas.Height = 100; videoCanvas.Margin = new Thickness(10); videoCanvas.Tag = tag; //1.按钮 StorageImage storageImage = storageImageBll.get(storageVideo.storageImageId); string imgFullPath = FileUtil.notExistsShowDefault(storageImage?.url, Params.ImageNotExists); imgFullPath = AppDomain.CurrentDomain.BaseDirectory + imgFullPath; Image videoImage = new Image(); videoImage.Name = "videoImage1"; videoImage.Width = 100; videoImage.Height = 75; videoImage.Source = FileUtil.readImage2(imgFullPath, 200); videoImage.Stretch = Stretch.UniformToFill; //2.按钮行 Canvas bg = new Canvas(); bg.Name = "bg"; bg.Background = Brushes.Black; bg.Width = 100; bg.Height = 24; bg.Opacity = 0.6; bg.SetValue(Canvas.BottomProperty, 25.0); bg.SetValue(Canvas.LeftProperty, 0.0); //时长 string mmss = VideoUtil.duration2mmss(storageVideo.duration); Label lLabel = new Label(); lLabel.Width = 50; lLabel.Height = 24; lLabel.Content = mmss; lLabel.Foreground = Brushes.White; lLabel.SetValue(Canvas.LeftProperty, 0.0); lLabel.SetValue(Canvas.TopProperty, 0.0); bg.Children.Add(lLabel); //删除按钮 Button rbtn = new Button(); rbtn.Width = 16; rbtn.Height = 16; rbtn.BorderThickness = new Thickness(0); rbtn.Background = new ImageBrush { ImageSource = FileUtil.readImage(AppDomain.CurrentDomain.BaseDirectory + "/myfile/sysimg/ico-image-remove.png") , Stretch = Stretch.UniformToFill }; rbtn.SetValue(Canvas.RightProperty, -8.0); rbtn.SetValue(Canvas.TopProperty, -8.0); // bg.Children.Add(rbtn); // rbtn.Click += rbtnClick; //标题 Label titleLabel = new Label(); titleLabel.Width = 100; titleLabel.Height = 25; titleLabel.Content = storageVideo.origFilename; titleLabel.SetValue(Canvas.LeftProperty, 0.0); titleLabel.SetValue(Canvas.BottomProperty, 0.0); titleLabel.ToolTip = storageVideo.origFilename; //勾选 Button selectButton = new Button(); selectButton.Name = "selectButton"; selectButton.Tag = storageVideo.id; selectButton.Width = 24; selectButton.Height = 24; selectButton.BorderThickness = new Thickness(0); selectButton.SetValue(Canvas.LeftProperty, 7.0); selectButton.SetValue(Canvas.TopProperty, 7.0); selectButton.Background = new ImageBrush { ImageSource = new BitmapImage(new Uri(@"Resources/ico_media_select.png", UriKind.Relative)), Stretch = Stretch.UniformToFill }; selectButton.Visibility = Visibility.Hidden; videoCanvas.MouseEnter += videoCanvasMouseEnter; videoCanvas.MouseLeave += videoCanvasMouseLeave; videoCanvas.MouseLeftButtonDown += selectButtonClick; selectButton.Click += selectButtonClick; videoCanvas.Children.Add(videoImage); videoCanvas.Children.Add(bg); videoCanvas.Children.Add(titleLabel); videoCanvas.Children.Add(selectButton); // videoCanvas.Children.Add(rbtn); return(videoCanvas); }
/// <summary> /// at first, the job from the currently configured settings is generated. In addition, we find out if this job is /// a part of an automated series of jobs. If so, it means the first generated job was the second pass, and we have /// to create the first pass using the same settings /// then, all the generated jobs are returned /// </summary> /// <returns>an Array of VideoJobs in the order they are to be encoded</returns> public JobChain prepareVideoJob(string movieInput, string movieOutput, VideoCodecSettings settings, Dar? dar, bool prerender, bool checkVideo, Zone[] zones) { bool twoPasses = false, threePasses = false; if (settings.EncodingMode == 4) // automated twopass twoPasses = true; else if (settings.EncodingMode == 8) // automated threepass threePasses = true; VideoJob prerenderJob = null; string hfyuFile = null; string inputAVS = movieInput; if (prerender) { hfyuFile = Path.Combine(Path.GetDirectoryName(movieInput), "hfyu_" + Path.GetFileNameWithoutExtension(movieInput) + ".avi"); inputAVS = Path.ChangeExtension(hfyuFile, ".avs"); if (File.Exists(hfyuFile)) { if (MessageBox.Show("The intended temporary file, " + hfyuFile + " already exists.\r\n" + "Do you wish to over-write it?", "File already exists", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.No) return null; } if (File.Exists(inputAVS)) { if (MessageBox.Show("The intended temporary file, " + inputAVS + " already exists.\r\n" + "Do you wish to over-write it?", "File already exists", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.No) return null; } try { StreamWriter hfyuWrapper = new StreamWriter(inputAVS, false, Encoding.Default); hfyuWrapper.WriteLine("AviSource(\"" + hfyuFile + "\")"); hfyuWrapper.Close(); } catch (IOException) { return null; } prerenderJob = this.generateVideoJob(movieInput, hfyuFile, new hfyuSettings(), dar, zones); if (prerenderJob == null) return null; } if (checkVideo) { VideoUtil vUtil = new VideoUtil(mainForm); string error = vUtil.checkVideo(movieInput); if (error != null) { bool bContinue = mainForm.DialogManager.createJobs(error); if (!bContinue) { MessageBox.Show("Job creation aborted due to invalid AviSynth script"); return null; } } } VideoJob job = this.generateVideoJob(inputAVS, movieOutput, settings, prerender, dar, zones); VideoJob firstpass = null; VideoJob middlepass = null; if (job != null) { if (twoPasses || threePasses) // we just created the last pass, now create previous one(s) { job.FilesToDelete.Add(job.Settings.Logfile); if (job.Settings.SettingsID.Equals("x264")) job.FilesToDelete.Add(mbtreeFile); firstpass = cloneJob(job); firstpass.Output = ""; // the first pass has no output firstpass.Settings.EncodingMode = 2; firstpass.DAR = dar; if (threePasses) { firstpass.Settings.EncodingMode = 5; // change to 3 pass 3rd pass just for show middlepass = cloneJob(job); middlepass.Settings.EncodingMode = 6; // 3 pass 2nd pass if (mainForm.Settings.Keep2of3passOutput) // give the 2nd pass a new name { middlepass.Output = Path.Combine(Path.GetDirectoryName(job.Output), Path.GetFileNameWithoutExtension(job.Output) + "-2ndpass" + Path.GetExtension(job.Output)); job.FilesToDelete.Add(middlepass.Output); } middlepass.DAR = dar; } } if (prerender) { job.FilesToDelete.Add(hfyuFile); job.FilesToDelete.Add(inputAVS); } List<VideoJob> jobList = new List<VideoJob>(); if (prerenderJob != null) jobList.Add(prerenderJob); if (firstpass != null) jobList.Add(firstpass); if (middlepass != null) // we have a middle pass jobList.Add(middlepass); jobList.Add(job); return new SequentialChain(jobList.ToArray()); } return null; }