本文整理汇总了C#中Job.ApplyPreset方法的典型用法代码示例。如果您正苦于以下问题:C# Job.ApplyPreset方法的具体用法?C# Job.ApplyPreset怎么用?C# Job.ApplyPreset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Job
的用法示例。
在下文中一共展示了Job.ApplyPreset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Encode
/// <summary>
/// Encodes the job using any passed presets and custom destinations
/// </summary>
/// <param name="job"></param>
/// <param name="PresetName"></param>
/// <param name="Destination"></param>
private static void Encode(Job EncoderJob, string PresetName, string Destination)
{
// Set up the progress callback function
EncoderJob.EncodeProgress += new EventHandler<EncodeProgressEventArgs> (OnProgress);
//Sets preset if it was set and encodes job
try
{
if (PresetName != null)
{
Preset PresetToUse = Preset.FromFile (PresetName);
EncoderJob.ApplyPreset (PresetToUse);
foreach (MediaItem Item in EncoderJob.MediaItems)
{
TimeSpan ClipDuration = TimeSpan.FromTicks (Item.FileDuration.Ticks);
//TimeSpan AudioDuration = TimeSpan.FromTicks (Item.AudioOverlayEndTime.Ticks - 1);
//TimeSpan UsedDuration = (ClipDuration > AudioDuration) ? AudioDuration : ClipDuration;
foreach (Source ItemSource in Item.Sources)
{
foreach (Clip ItemClip in ItemSource.Clips)
{
ItemClip.StartTime = TimeSpan.Zero;
ItemClip.EndTime = ClipDuration;
}
}
}
}
EncoderJob.CreateSubfolder = false;
EncoderJob.OutputDirectory = Destination;
EncoderJob.DefaultMediaOutputFileName = "{OriginalFilename}" + "_" + Path.GetFileNameWithoutExtension (PresetName)
+ "_" + ".{DefaultExtension}";
EncoderJob.Encode ();
}
catch (EncodeErrorException Excp)
{
// Console.WriteLine("EncodeErrorException Error: " + Excp.ToString());
WMB.Basics.ReportErrorToEventViewer("EncodeErrorException bei \"" + PresetName + "\"):\r\n"
+ Excp.ToString ());
return;
}
catch (PresetNotFoundException Excp)
{
// Console.WriteLine("PresetNotFoundException: " + Excp.ToString());
WMB.Basics.ReportErrorToEventViewer("PresetNotFoundException bei \"" + PresetName + "\"):\r\n"
+ Excp.ToString());
return;
}
}