public void FromVegas(Vegas vegas) { string rendererName = Script.Args.ValueOf("renderer"); string templateName = Script.Args.ValueOf("template"); Renderer renderer = vegas.Renderers.FindByName(rendererName); RenderTemplate template = null; if (renderer != null) { template = renderer.Templates.FindByName(templateName); } if (template == null) { vegas.ShowError("Render template not found."); return; } string path = vegas.Project.FilePath; string saveas = Path.GetDirectoryName(path) + "\\" + Path.GetFileNameWithoutExtension(path) + ".rendered.mp4"; RenderStatus status = vegas.Render(saveas, template); if (status == RenderStatus.Complete || status == RenderStatus.Canceled || status == RenderStatus.Quit) { vegas.Exit(); } else { vegas.ShowError("Render incomplete. Please try again."); return; } }
void FireLivePreviewEndedEvent (RenderStatus status, Exception ex) { if (Ended != null) { var args = new LivePreviewEndedEventArgs (status, ex); Ended (this, args); } }
public RunningRender(string renderId, string jobId, RenderStatus renderStatus, List <Uri> needMoreResources, bool needMoreDom) { RenderId = renderId; JobId = jobId; RenderStatus = renderStatus; NeedMoreResources = needMoreResources; NeedMoreDom = needMoreDom; }
private void SampleRenderingStatus_(Dictionary <RunningRender, RenderRequest> runningRenders, List <string> ids, List <RenderStatusResults> renderStatusResultsList) { logger_.Verbose("enter - renderStatusResultsList size: {0}", renderStatusResultsList.Count); for (int i = renderStatusResultsList.Count - 1; i >= 0; i--) { RenderStatusResults renderStatusResults = renderStatusResultsList[i]; if (renderStatusResults == null) { continue; } RenderStatus renderStatus = renderStatusResults.Status; bool isRenderedStatus = renderStatus == RenderStatus.Rendered; bool isErrorStatus = renderStatus == RenderStatus.Error; logger_.Verbose("renderStatusResults - {0}", renderStatusResults); if (isRenderedStatus || isErrorStatus) { string removedId = ids[i]; ids.RemoveAt(i); foreach (KeyValuePair <RunningRender, RenderRequest> kvp in runningRenders) { RunningRender renderedRender = kvp.Key; RenderRequest renderRequest = kvp.Value; if (renderedRender.RenderId.Equals(removedId, StringComparison.OrdinalIgnoreCase)) { VisualGridTask task = runningRenders[renderedRender].Task; for (int k = openTasks_.Count - 1; k >= 0; k--) { VisualGridTask openTask = openTasks_[k]; if (openTask.RunningTest == task.RunningTest) { if (isRenderedStatus) { logger_.Verbose("setting openTask {0} render result: {1} to url {2}", openTask, renderStatusResults, result_.Url); openTask.SetRenderResult(renderStatusResults); } else { logger_.Verbose("setting openTask {0} render error: {1} to url {2}", openTask, removedId, result_.Url); openTask.SetRenderError(removedId, renderStatusResults.Error, renderRequest); } openTasks_.RemoveAt(k); } } logger_.Verbose("setting task {0} render result: {1} to url {2}", task, renderStatusResults, result_.Url); task.SetRenderResult(renderStatusResults); break; } } } } logger_.Verbose("exit"); }
public static void PlayRender() { bool needToBegin = Play == RenderStatus.Stop; Play = RenderStatus.Play; if (needToBegin) { BeginThreadedRendering(); } }
public void FromVegas(Vegas vegas) { string rendererName = Script.Args.ValueOf("renderer"); string templateName = Script.Args.ValueOf("template"); string saveas = Script.Args.ValueOf("saveas", true); Renderer renderer = vegas.Renderers.FindByName(rendererName); RenderTemplate template = null; if (renderer != null) { template = renderer.Templates.FindByName(templateName); } if (template == null) { vegas.ShowError("Render template not found."); return; } if (string.IsNullOrWhiteSpace(saveas)) { SaveFileDialog saveFileDialog = new SaveFileDialog { Filter = ".mp4 file (*.mp4)|*.mp4", Title = "Select render location", InitialDirectory = vegas.Project.FilePath, CheckPathExists = true, AddExtension = true }; if (saveFileDialog.ShowDialog() == DialogResult.OK) { saveas = Path.GetFullPath(saveFileDialog.FileName); } } if (string.IsNullOrWhiteSpace(saveas)) { vegas.ShowError("No valid save path exists."); return; } RenderStatus status = vegas.Render(saveas, template); if (status == RenderStatus.Complete || status == RenderStatus.Canceled || status == RenderStatus.Quit) { vegas.Exit(); } else { vegas.ShowError("Render incomplete. Please try again."); return; } }
private RenderStatus CalcWorstStatus_(List <RunningRender> runningRenders, RenderStatus worstStatus) { foreach (RunningRender runningRender in runningRenders) { RenderStatus renderStatus = runningRender.RenderStatus; if (renderStatus == RenderStatus.NeedMoreResources && (worstStatus == RenderStatus.Rendered || worstStatus == RenderStatus.Rendering)) { worstStatus = RenderStatus.NeedMoreResources; } else if (renderStatus == RenderStatus.Error) { worstStatus = RenderStatus.Error; break; } } return(worstStatus); }
public void SetRenderStatus(RenderStatus Status) { this.Invoke(new Action(() => { switch (Status) { case RenderStatus.Ready: lbl_RenderStatus.Text = "准备就绪"; break; case RenderStatus.Buffing: lbl_RenderStatus.Text = "正在缓冲"; break; case RenderStatus.Playing: lbl_RenderStatus.Text = "正在播放"; break; case RenderStatus.Paused: lbl_RenderStatus.Text = "播放暂停"; break; case RenderStatus.Stop: lbl_RenderStatus.Text = "正在停止"; break; } })); }
//Creates a temporary WAV file, exporting all audio in the span of the VideoEvent public string CreateVideoEventWAV(VideoEvent videoEvent) { string currentMediaPath = videoEvent.ActiveTake.MediaPath; string currentMediaPathWithoutExt = Path.ChangeExtension(currentMediaPath, null); Timecode eventStart = videoEvent.Start; Timecode eventLength = videoEvent.Length; string waveOutPath = currentMediaPathWithoutExt + WAV_TEMP_SUFFIX + WAV_EXT; Renderer renderer = util.FindRenderer(WAV_RENDERER_NAME); if (renderer == null) { util.ShowError("Renderer \"" + WAV_RENDERER_NAME + "\" not found"); return(null); } RenderTemplate renderTemplate = util.FindRenderTemplate(renderer, WAV_RENDER_TEMPLATE_NAME); if (renderTemplate == null) { util.ShowError("RenderTemplate \"" + WAV_RENDER_TEMPLATE_NAME + "\" not found"); return(null); } RenderArgs renderArgs = new RenderArgs(); renderArgs.OutputFile = waveOutPath; renderArgs.RenderTemplate = renderTemplate; renderArgs.Start = eventStart; renderArgs.Length = eventLength; RenderStatus renderStatus = util.DoRender(renderArgs); if (renderStatus == RenderStatus.Complete) { return(waveOutPath); } return(null); }
public bool RenderFile(FileInfo fiVeg, FileInfo fiRendered, RenderTemplate renderTemplate, RenderStatusManager rsm, object dr) { DateTime renderStart = DateTime.Now; DateTime renderEnd; TimeSpan renderTime; rsm.Dialog.Hide(); // Temporarily hide because during load the UX kills it. rsm.UpdateField(dr, RenderStatusManager.Fields.Names.RenderStart, renderStart); if (myVegas.Project != null) { // No close method so create a clean new project without the ability to prompt for save of existing // and then open after that. myVegas.NewProject(false, false); } myVegas.UpdateUI(); rsm.UpdateField(dr, RenderStatusManager.Fields.Names.RenderStatus, "Loading"); myVegas.OpenFile(fiVeg.FullName); myVegas.UpdateUI(); myVegas.WaitForIdle(); rsm.Dialog.Show(); // Render RenderArgs ra = new RenderArgs(); ra.OutputFile = fiRendered.FullName; ra.RenderTemplate = renderTemplate; Timecode projectLength = GetProjectLength(); rsm.UpdateField(dr, RenderStatusManager.Fields.Names.ProjectLength, projectLength); ra.Length = projectLength; ra.StartNanos = 0; rsm.UpdateField(dr, RenderStatusManager.Fields.Names.RenderStatus, "Rendering"); RenderStatus status = myVegas.Render(ra); renderEnd = DateTime.Now; renderTime = renderEnd - renderStart; rsm.UpdateField(dr, RenderStatusManager.Fields.Names.RenderEnd, renderEnd); rsm.UpdateField(dr, RenderStatusManager.Fields.Names.RenderTime, renderTime); rsm.UpdateField(dr, RenderStatusManager.Fields.Names.RenderStatus, status.ToString()); return(status == RenderStatus.Complete); }
public RenderStatus DoRender(RenderArgs args) { RenderStatus status = vegas.Render(args); switch (status) { case RenderStatus.Complete: case RenderStatus.Canceled: break; case RenderStatus.Failed: default: ShowError("Render failed:\n" + "\n File name: " + args.OutputFile + "\n Template: " + args.RenderTemplate.Name); break; } return(status); }
RenderStatus DoRender(RenderArgs args) { RenderStatus status = myVegas.Render(args); switch (status) { case RenderStatus.Complete: case RenderStatus.Canceled: break; case RenderStatus.Failed: default: StringBuilder msg = new StringBuilder("Render failed:\n"); msg.Append("\n file name: "); msg.Append(args.OutputFile); msg.Append("\n Template: "); msg.Append(args.RenderTemplate.Name); throw new ApplicationException(msg.ToString()); } return(status); }
public bool renderProject( Vegas myVegas, string projectFilePath, string rendererName, string templateName, string outputFilePath ) { if (myVegas.OpenProject(projectFilePath)) { RenderArgs renderArgs = new RenderArgs(myVegas.Project); renderArgs.RenderTemplate = findTemplate(rendererName, templateName, myVegas.Renderers); renderArgs.OutputFile = outputFilePath; RenderStatus renderStatus = myVegas.Render(renderArgs); if (renderStatus == RenderStatus.Complete) { return(true); } } return(false); }
// perform the render. The Render method returns a member of the // RenderStatus enumeration. If it is anything other than OK, // exit the loops. This will throw an error message string if the // render does not complete successfully. RenderStatus DoRender(String filePath, RenderItem renderItem, Timecode start, Timecode length) { ValidateFilePath(filePath); // make sure the file does not already exist if (!OverwriteExistingFiles && File.Exists(filePath)) { throw new ApplicationException("File already exists: " + filePath); } // perform the render. The Render method returns // a member of the RenderStatus enumeration. If // it is anything other than OK, exit the loops. RenderStatus status = myVegas.Render(filePath, renderItem.Template, start, length); switch (status) { case RenderStatus.Complete: case RenderStatus.Canceled: break; case RenderStatus.Failed: default: StringBuilder msg = new StringBuilder("Render failed:\n"); msg.Append("\n file name: "); msg.Append(filePath); msg.Append("\n Renderer: "); msg.Append(renderItem.Renderer.FileTypeName); msg.Append("\n Template: "); msg.Append(renderItem.Template.Name); msg.Append("\n Start Time: "); msg.Append(start.ToString()); msg.Append("\n Length: "); msg.Append(length.ToString()); throw new ApplicationException(msg.ToString()); } return(status); }
/** * Now Render the project * */ public void RenderProject() { String totalLength = myVegas.Project.Length.ToString(); dbg("\n projectpath:"); dbg(projectPath); dbg("\n dir:"); dbg(projectPath); dbg("\n length:"); dbg(totalLength); dbg("\n Template description"); dbg(this.renderTemplate.Description); dbg("\n output filename:"); dbg(this.outputFilename); RenderStatus status = myVegas.Project.Render(projectPath + outputFilename, renderTemplate); switch (status) { case RenderStatus.Complete: MessageBox.Show("Incredible, we did it..."); break; case RenderStatus.Canceled: MessageBox.Show("cancel"); break; case RenderStatus.Failed: default: StringBuilder msg = new StringBuilder("Render failed:\n"); msg.Append("\n file name: "); msg.Append(outputFilename); msg.Append("\n Template: "); msg.Append(renderTemplate.Name); throw new ApplicationException(msg.ToString()); } }
public LivePreviewEndedEventArgs(RenderStatus status, Exception?exception) { this.Status = status; this.Exception = exception; }
// Use this for initialization void Start() { RS = Camera.main.GetComponent <RenderStatus>(); }
public static bool Send_Msg_To_Readies_Q(RenderStatus status, String item_id, DateTime beforeProcessingTime) { try { Dictionary<string, object> dict = new Dictionary<string, object>(); DateTime current = DateTime.Now; TimeSpan duration = current - beforeProcessingTime; dict["item_id"] = item_id; //dict["url"] = @"http://" + Utils.my_ip + @"/testim/yofi_" + item_id + ".jpg"; dict["url"] = @"http://s3.amazonaws.com/" + S3.bucketName + @"/" + item_id + ".jpg"; dict["duration"] = Math.Round(duration.TotalSeconds, 3); dict["status"] = status.ToString(); JavaScriptSerializer serializer = new JavaScriptSerializer(); //creating serializer instance of JavaScriptSerializer class string jsonString = serializer.Serialize((object)dict); SendMessageRequest sendMessageRequest = new SendMessageRequest(); sendMessageRequest.QueueUrl = ready_Q_url; //URL from initial queue creation sendMessageRequest.MessageBody = Utils.EncodeTo64(jsonString); Console.WriteLine("Before sending ready msg(" + sendMessageRequest.MessageBody + ")."); sqs.SendMessage(sendMessageRequest); Console.WriteLine("After sending ready msg(" + sendMessageRequest.MessageBody + ")."); } catch (AmazonSQSException ex) { Console.WriteLine("Caught Exception: " + ex.Message); Console.WriteLine("Response Status Code: " + ex.StatusCode); Console.WriteLine("Error Code: " + ex.ErrorCode); Console.WriteLine("Error Type: " + ex.ErrorType); Console.WriteLine("Request ID: " + ex.RequestId); Console.WriteLine("XML: " + ex.XML); return false; } return true; }
void DoBatchRender(ArrayList selectedTemplates, String basePath, RenderMode renderMode) { String outputDirectory = Path.GetDirectoryName(basePath); String baseFileName = Path.GetFileName(basePath); // make sure templates are selected if ((null == selectedTemplates) || (0 == selectedTemplates.Count)) { throw new ApplicationException("No render templates selected."); } // make sure the output directory exists if (!Directory.Exists(outputDirectory)) { throw new ApplicationException("The output directory does not exist."); } RenderStatus status = RenderStatus.Canceled; // enumerate through each selected render template foreach (RenderItem renderItem in selectedTemplates) { // construct the file name (most of it) String filename = Path.Combine(outputDirectory, FixFileName(baseFileName) + FixFileName(renderItem.Renderer.FileTypeName) + "_" + FixFileName(renderItem.Template.Name)); if (RenderMode.Regions == renderMode) { int regionIndex = 0; foreach (Sony.Vegas.Region region in myVegas.Project.Regions) { String regionFilename = String.Format("{0}[{1}]{2}", filename, regionIndex.ToString(), renderItem.Extension); // Render the region status = DoRender(regionFilename, renderItem, region.Position, region.Length); if (RenderStatus.Canceled == status) { break; } regionIndex++; } } else { filename += renderItem.Extension; Timecode renderStart, renderLength; if (renderMode == RenderMode.Selection) { renderStart = myVegas.SelectionStart; renderLength = myVegas.SelectionLength; } else { renderStart = new Timecode(); renderLength = myVegas.Project.Length; } status = DoRender(filename, renderItem, renderStart, renderLength); } if (RenderStatus.Canceled == status) { break; } } }
/// <summary> /// Machine data synchronization mechanism. /// </summary> private void Machine_Update() { do { try { lock (this.MachineDisplay) { if (this.Machine_TempData != null) { // clear old data .. this.Machine_TempData.Clear(); } // change lock flag .. IsLock = true; // reload data .. this.Machine_TempData = this.GenerateMachineData("MachineCache"); // add, update items .. foreach (DataRow row in this.Machine_TempData.Rows) { // mapping refresh display columns .. #region Mapping Machine Data Display if (!this.MachineDisplay.Rows.Contains(row["Machine_Id"])) { DataRow drow = this.MachineDisplay.NewRow(); drow["Machine_Id"] = row["Machine_Id"]; drow["HostName"] = row["HostName"]; drow["Ip"] = row["Ip"]; drow["IsEnable"] = row["IsEnable"]; drow["Last_Online_Time"] = row["Last_Online_Time"]; drow["Machine_Status"] = row["Machine_Status"]; drow["Machine_Priority"] = row["Machine_Priority"]; drow["TCore"] = 0; drow["UCore"] = 0; drow["Note"] = row["Note"]; // add to machine data displayer collection .. this.MachineDisplay.Rows.Add(drow); } else { if (RenderStatus != null) { DataRow[] rows = this.MachineDisplay.Select(string.Format("Machine_Id = '{0}'", row["Machine_Id"])), renders = RenderStatus.Select(string.Format("MachineId = '{0}'", row["Machine_Id"])); if (rows.Length > 0 && renders.Length > 0) { // update row data .. rows[0]["HostName"] = row["HostName"]; rows[0]["Ip"] = row["Ip"]; rows[0]["IsEnable"] = row["IsEnable"]; rows[0]["Last_Online_Time"] = row["Last_Online_Time"]; if (Convert.ToUInt16(renders[0]["ConnectFail"]) >= 5) { rows[0]["Machine_Status"] = MachineStatusFlag.OFFLINE; } else { rows[0]["Machine_Status"] = row["Machine_Status"]; } rows[0]["Machine_Priority"] = row["Machine_Priority"]; rows[0]["TCore"] = renders[0]["TCore"]; rows[0]["UCore"] = renders[0]["UCore"]; rows[0]["Note"] = row["Note"]; } } else { DataRow[] rows = this.MachineDisplay.Select(string.Format("Machine_Id = '{0}'", row["Machine_Id"])); if (rows.Length > 0) { // update row data .. rows[0]["HostName"] = row["HostName"]; rows[0]["Ip"] = row["Ip"]; rows[0]["IsEnable"] = row["IsEnable"]; rows[0]["Last_Online_Time"] = row["Last_Online_Time"]; rows[0]["Machine_Status"] = row["Machine_Status"]; rows[0]["Machine_Priority"] = row["Machine_Priority"]; rows[0]["TCore"] = 0; rows[0]["UCore"] = 0; rows[0]["Note"] = row["Note"]; } } } #endregion } // delete items .. foreach (DataRow row in this.MachineDisplay.Rows) { if (this.Machine_TempData.Rows.Find(row["Machine_Id"]) == null) { row.Delete(); } } // commit data changes .. this.MachineDisplay.AcceptChanges(); // change lock flag .. IsLock = false; #region Process Render Machine Status For Client if (MachineStatus == null) { // create machine table schema .. MachineStatus = this.MachineDisplay.Clone(); } // clear all row(s) .. MachineStatus.Rows.Clear(); // declare filiter condition .. string expression = string.Format("Machine_Status = '{0}'", MachineStatusFlag.RENDER); // copy selected row(s) to machine status property .. this.MachineDisplay.Select(expression).CopyToDataTable(MachineStatus, LoadOption.PreserveChanges); #endregion // release thread object locked .. this.runEvents[1].Set(); } } catch (Exception ex) { string ExceptionMsg = ex.Message + ex.StackTrace; // write to log file .. this.EnvLog.Writer(AssemblyInfoClass.ProductInfo, Log.Level.Error, ExceptionMsg, true); } Thread.Sleep(200); } while (!requestStop && updateEvents[1].WaitOne()); }
/// <summary> /// Creates a new, empty render result /// </summary> public RenderResult() { RenderArea = Rectangle.Empty; Status = RenderStatus.None; }
public async Task <RenderStatusResults> CallAsync() { logger_.Verbose("enter"); List <RunningRender> runningRenders = null; isTaskStarted_ = true; RenderRequest[] requests = new RenderRequest[0]; try { logger_.Verbose("step 1"); AddRenderingTaskToOpenTasks_(); bool isSecondRequestAlreadyHappened = false; //Parse to Map logger_.Verbose("step 2"); //Build RenderRequests requests = PrepareDataForRG_(result_); logger_.Verbose("step 3"); bool stillRunning = true; bool isForcePutAlreadyDone = false; Stopwatch timeoutTimer = Stopwatch.StartNew(); do { try { runningRenders = await connector_.RenderAsync(requests); } catch (Exception e) { var settings = JsonUtils.CreateSerializerSettings(); string j = JsonConvert.SerializeObject(requests, settings); string responseBodyStr = string.Empty; if (e is WebException we && we.Response != null) { Stream stream = we.Response.GetResponseStream(); byte[] responseBodyBytes = CommonUtils.ReadToEnd(stream); responseBodyStr = Encoding.UTF8.GetString(responseBodyBytes); } logger_.Verbose("/render throws exception. sleeping for 1.5s"); Thread.Sleep(1500); if (responseBodyStr.Contains("Second request, yet still some resources were not PUT in renderId")) { if (isSecondRequestAlreadyHappened) { logger_.Verbose("Second request already happened"); } isSecondRequestAlreadyHappened = true; } logger_.Verbose("Error (1): " + e); logger_.Verbose("Error Response Body: " + responseBodyStr); } logger_.Verbose("step 4.1"); if (runningRenders == null) { logger_.Verbose("ERROR - runningRenders is null."); SetRenderErrorToTasks_(requests); continue; } for (int i = 0; i < requests.Length; i++) { RenderRequest request = requests[i]; request.RenderId = runningRenders[i].RenderId; } logger_.Verbose("step 4.2"); RunningRender runningRender = runningRenders[0]; RenderStatus worstStatus = runningRender.RenderStatus; worstStatus = CalcWorstStatus_(runningRenders, worstStatus); bool isNeedMoreDom = runningRender.NeedMoreDom; if (isForcePutNeeded_ && !isForcePutAlreadyDone) { ForcePutAllResources_(requests[0].Resources, runningRender); isForcePutAlreadyDone = true; } logger_.Verbose("step 4.3"); stillRunning = (worstStatus == RenderStatus.NeedMoreResources || isNeedMoreDom) && (timeoutTimer.Elapsed.TotalSeconds < FETCH_TIMEOUT_SECONDS); if (stillRunning) { SendMissingResources_(runningRenders, requests[0].Dom, requests[0].Resources, isNeedMoreDom); } logger_.Verbose("step 4.4"); } while (stillRunning); } catch (Exception e) { logger_.Log("Error: " + e); SetRenderErrorToTasks_(requests); } Dictionary <RunningRender, RenderRequest> mapping = MapRequestToRunningRender_(runningRenders, requests); logger_.Verbose("step 5"); try { PollRenderingStatus_(mapping); } catch (Exception e) { isTaskInException = true; // FOR DEBUGGING logger_.Log("Error (2): " + e); foreach (VisualGridTask visualGridTask in taskList_) { visualGridTask.SetExceptionAndAbort(e); } } IsTaskComplete = true; logger_.Verbose("exit"); return(null); }
public static void StopRender() { Play = RenderStatus.Stop; }
public LivePreviewEndedEventArgs (RenderStatus status, Exception exception) { this.Status = status; this.Exception = exception; }
public void Render(ScriptPortal.Vegas.Vegas myVegas) { SetProgressBounds(Count); using (UndoBlock undo = new UndoBlock("Render tracks")) { for (int i = 0; i < Count; i++) { var ri = this[i]; foreach (var trk in myVegas.Project.Tracks) { trk.Mute = !ri.Tracks.Contains(trk); } // padding if (ri.RenderParams.GetParam <bool>(RenderTags.DoPadding)) { if (ri.RenderTemplate.RendererID != myVegas.Renderers.FindByName("Wave (Microsoft)").ID) { ErrorLog( String.Format( "The region {0} could not be padded. Padded rendering can only be performed on .WAV (PCM) files.", ri.Region.Label)); } else { var paddingTime = Timecode.FromSeconds(ri.PaddingSeconds); if (ri.Start - paddingTime < myVegas.Project.Ruler.StartTime) { ErrorLog(String.Format( "The region {0} could not be padded. Move your region further into the project.", ri.Region.Label)); } else { ri.Start -= paddingTime; ri.Length += paddingTime; ri.Length += paddingTime; } } } if (File.Exists(ri.FilePath) && ri.RenderParams.GetParam <bool>(RenderTags.DoReadonly)) { // check readonly var attr = File.GetAttributes(ri.FilePath); if (attr.IsSet(FileAttributes.ReadOnly)) { File.SetAttributes(ri.FilePath, attr & ~FileAttributes.ReadOnly); } } SetProgress(i); SetProgressStatus("Rendering " + ri.FilePath); RenderStatus status = myVegas.Render(ri.FilePath, ri.RenderTemplate, ri.Start, ri.Length); if (status != RenderStatus.Complete) { ErrorLog(String.Format("{0} raised error {1}", ri.FilePath, status.ToString())); } else { // file successfully rendered // strip padding if (ri.RenderParams.GetParam <bool>(RenderTags.DoPadding)) { WaveFile.StripPadding(ri.FilePath, ri.PaddingSeconds); } } } foreach (ScriptPortal.Vegas.Track trk in myVegas.Project.Tracks) { trk.Mute = false; } undo.Cancel = true; // we didn't really do anything useful. } }
public void FromVegas(Vegas vegas) { if (vegas.Project.Length.ToMilliseconds() == 0) { return; } SetDllDirectory(VegasDir + "\\Script Depends"); string RegKey = "HKEY_CURRENT_USER\\Software\\Sony Creative Software\\Vegas Pro\\frameserver"; int AddBuffer = 1; int RenderLoop = 1; string outputDirectory = ""; try { AddBuffer = (int)Registry.GetValue(RegKey, "AddBuffer", 1); RenderLoop = (int)Registry.GetValue(RegKey, "RenderLoopRegion", 1); outputDirectory = (string)Registry.GetValue(RegKey, "TempDir", ""); } catch {} string outDirDefualt = Environment.GetEnvironmentVariable("TEMP") + "\\frameserver"; if (outputDirectory == "") { outputDirectory = outDirDefualt; } if (!Directory.Exists(outputDirectory)) { try { Directory.CreateDirectory(outputDirectory); } catch { outputDirectory = outDirDefualt; Directory.CreateDirectory(outputDirectory); } } // Start virtual file system, AviSynth and HandBrake ahktextdll(Unzip(Convert.FromBase64String(StartScriptData)), "", ""); while (!ahkReady()) { Thread.Sleep(100); } ahkassign("TempFileDir", outputDirectory); ahkassign("AddBuffer", AddBuffer.ToString()); ahkassign("RegKey", RegKey); ahkassign("VegasDir", VegasDir); ahkPause("Off"); Regex videoRendererRegexp = new Regex(@"DebugMode FrameServer", RegexOptions.Compiled | RegexOptions.IgnoreCase); Regex videoTemplateRegexp = new Regex(@"Project Default", RegexOptions.Compiled | RegexOptions.IgnoreCase); try { //Add an empty event to first video track to solve frameserver audio bug if (AddBuffer > 0) { foreach (Track CurTrack in vegas.Project.Tracks) { if (CurTrack.IsVideo()) { TargetTrack = CurTrack; emptyEvent = new VideoEvent(vegas.Project, vegas.Project.Length, Timecode.FromMilliseconds(1000), null); CurTrack.Events.Add(emptyEvent); break; } } } // Check timeline's loop-region Timecode renderStart = new Timecode(); Timecode renderLength = vegas.Project.Length; if (RenderLoop > 0) { renderStart = vegas.SelectionStart; if (AddBuffer > 0) { renderLength = vegas.SelectionLength + Timecode.FromMilliseconds(1000); } else { renderLength = vegas.SelectionLength; } } //Define export path and file name string projDir, projName, videoOutputFile; string projFile = vegas.Project.FilePath; if ((null == projFile) || (0 == projFile.Length)) { projDir = ""; projName = "Untitled"; } else { projDir = Path.GetDirectoryName(projFile) + Path.DirectorySeparatorChar; projName = Path.GetFileNameWithoutExtension(projFile); } videoOutputFile = outputDirectory + "\\" + OutFileName + ".avi"; if (null == videoOutputFile) { throw new Exception("Process terminated"); } Renderer aviRenderer = FindRenderer(videoRendererRegexp, vegas); if (null == aviRenderer) { throw new Exception("Could not find DebugMode FrameServer"); } // Start export RenderTemplate videoTemplate = FindRenderTemplate(aviRenderer, videoTemplateRegexp, vegas); if (null == videoTemplate) { throw new Exception("Could not find the render preset defined by the script"); } RenderStatus renderStatus = vegas.Render(videoOutputFile, videoTemplate, renderStart, renderLength); if (AddBuffer > 0) { TargetTrack.Events.Remove(emptyEvent); } } catch (Exception ex) { if (AddBuffer > 0) { TargetTrack.Events.Remove(emptyEvent); } MessageBox.Show(ex.ToString()); } }
public void Deliver(RenderStatus status, string result) { this.Result = result; this.Status = status; }
public static void PauseRender() { Play = RenderStatus.Pause; }
public virtual void SetCameraRenderStatusFeedback(Camera camera, RenderStatus renderStatus) { cameraToRenderStatus[camera] = renderStatus; }