本文整理汇总了C#中HandBrake.ApplicationServices.Model.EncodeTask类的典型用法代码示例。如果您正苦于以下问题:C# EncodeTask类的具体用法?C# EncodeTask怎么用?C# EncodeTask使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EncodeTask类属于HandBrake.ApplicationServices.Model命名空间,在下文中一共展示了EncodeTask类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Export
/// <summary>
/// Export a MacGui style plist preset.
/// </summary>
/// <param name="path">
/// The path.
/// </param>
/// <param name="preset">
/// The preset.
/// </param>
/// <param name="build">
/// The build.PictureModulusPictureModulus
/// </param>
public static void Export(string path, Preset preset, string build)
{
if (string.IsNullOrEmpty(path))
{
return;
}
EncodeTask parsed = new EncodeTask(preset.Task);
using (XmlTextWriter xmlWriter = new XmlTextWriter(path, Encoding.UTF8) { Formatting = Formatting.Indented })
{
// Header
xmlWriter.WriteStartDocument();
xmlWriter.WriteDocType(
"plist", "-//Apple//DTD PLIST 1.0//EN", @"http://www.apple.com/DTDs/PropertyList-1.0.dtd", null);
xmlWriter.WriteStartElement("plist");
xmlWriter.WriteStartElement("array");
// Add New Preset Here. Can write multiple presets here if required in future.
WritePreset(xmlWriter, parsed, preset, build);
// Footer
xmlWriter.WriteEndElement();
xmlWriter.WriteEndElement();
xmlWriter.WriteEndDocument();
// Closeout
xmlWriter.Close();
}
}
示例2: GenerateTabbedComponentsQuery
private static string GenerateTabbedComponentsQuery(EncodeTask task, bool filters, int width, int height, int verbose, bool noDvdNav, double x264Step)
{
string query = string.Empty;
// Output Settings
query += OutputSettingsQuery(task);
// Filters Panel
if (filters)
query += FiltersQuery(task);
// Picture Settings
query += PictureSettingsQuery(task, width, height);
// Video Settings
query += VideoSettingsQuery(task, x264Step);
// Audio Settings
query += AudioSettingsQuery(task);
// Subtitles Panel
query += SubtitlesQuery(task);
// Chapter Markers
query += ChapterMarkersQuery(task);
// X264 Panel
query += X264Query(task);
// Extra Settings
query += ExtraSettings(verbose.ToString(), noDvdNav);
return query;
}
示例3: GeneratePreviewQuery
/// <summary>
/// Generate a Query for a Preview Encode
/// </summary>
/// <param name="task">
/// The task.
/// </param>
/// <param name="configuration">
/// The configuration.
/// </param>
/// <param name="duration">
/// The duration.
/// </param>
/// <param name="startAtPreview">
/// The start At Preview.
/// </param>
/// <returns>
/// A Cli query suitable for generating a preview video.
/// </returns>
public static string GeneratePreviewQuery(EncodeTask task, HBConfiguration configuration, int duration, string startAtPreview)
{
string query = string.Empty;
query += SourceQuery(task, duration, startAtPreview, configuration.PreviewScanCount);
query += DestinationQuery(task);
query += GenerateTabbedComponentsQuery(task, true, configuration.Verbosity, configuration.IsDvdNavDisabled, configuration.DisableQuickSyncDecoding, false, false);
return query;
}
示例4: GenerateQuery
/// <summary>
/// Generate a CLI Query for an EncodeTask Model object
/// </summary>
/// <param name="task">
/// The task.
/// </param>
/// <returns>
/// A Cli Query
/// </returns>
public static string GenerateQuery(EncodeTask task)
{
string query = string.Empty;
query += SourceQuery(task, null, null);
query += DestinationQuery(task);
query += GenerateTabbedComponentsQuery(task, true);
return query;
}
示例5: GeneratePreviewQuery
/// <summary>
/// Generate a Query for a Preview Encode
/// </summary>
/// <param name="task">
/// The task.
/// </param>
/// <param name="duration">
/// The duration.
/// </param>
/// <param name="startAtPreview">
/// The start At Preview.
/// </param>
/// <returns>
/// A Cli query suitable for generating a preview video.
/// </returns>
public static string GeneratePreviewQuery(EncodeTask task, int duration, string startAtPreview)
{
string query = string.Empty;
query += SourceQuery(task, duration, startAtPreview);
query += DestinationQuery(task);
query += GenerateTabbedComponentsQuery(task, true);
return query;
}
示例6: GeneratePreviewQuery
/// <summary>
/// Generate a Query for a Preview Encode
/// </summary>
/// <param name="task">
/// The task.
/// </param>
/// <param name="duration">
/// The duration.
/// </param>
/// <param name="startAtPreview">
/// The start At Preview.
/// </param>
/// <param name="previewScanCount">
/// The preview Scan Count.
/// </param>
/// <param name="verbosity">
/// The verbosity.
/// </param>
/// <param name="disableLibDvdNav">
/// The disable Lib Dvd Nav.
/// </param>
/// <param name="disableQsvDecode">
/// The disable Qsv Decode.
/// </param>
/// <returns>
/// A Cli query suitable for generating a preview video.
/// </returns>
public static string GeneratePreviewQuery(EncodeTask task, int duration, string startAtPreview, int previewScanCount, int verbosity, bool disableLibDvdNav, bool disableQsvDecode)
{
string query = string.Empty;
query += SourceQuery(task, duration, startAtPreview, previewScanCount);
query += DestinationQuery(task);
query += GenerateTabbedComponentsQuery(task, true, verbosity, disableLibDvdNav, disableQsvDecode);
return query;
}
示例7: GenerateQuery
/// <summary>
/// Generate a CLI Query for an EncodeTask Model object
/// </summary>
/// <param name="task">
/// The task.
/// </param>
/// <param name="previewScanCount">
/// The preview Scan Count.
/// </param>
/// <param name="verbosity">
/// The verbosity.
/// </param>
/// <param name="disableLibDvdNav">
/// The disable Lib Dvd Nav.
/// </param>
/// <returns>
/// A Cli Query
/// </returns>
public static string GenerateQuery(EncodeTask task, int previewScanCount, int verbosity, bool disableLibDvdNav)
{
string query = string.Empty;
query += SourceQuery(task, null, null, previewScanCount);
query += DestinationQuery(task);
query += GenerateTabbedComponentsQuery(task, true, verbosity, disableLibDvdNav);
return query;
}
示例8: GenerateQuery
/// <summary>
/// Generate a CLI Query for an EncodeTask Model object
/// </summary>
/// <param name="task">
/// The task.
/// </param>
/// <param name="configuration">
/// The configuration.
/// </param>
/// <returns>
/// A Cli Query
/// </returns>
public static string GenerateQuery(EncodeTask task, HBConfiguration configuration)
{
if (string.IsNullOrEmpty(task.Source))
{
return "No source selected";
}
string query = string.Empty;
query += SourceQuery(task, null, null, configuration.PreviewScanCount);
query += DestinationQuery(task);
query += GenerateTabbedComponentsQuery(task, true, configuration.Verbosity, configuration.IsDvdNavDisabled, configuration.DisableQuickSyncDecoding, configuration.EnableDxva, configuration.ScalingMode == VideoScaler.BicubicCl);
return query;
}
示例9: SourceQuery
private static string SourceQuery(EncodeTask task, int mode, int duration, string preview, string previewTotal)
{
string query = string.Empty;
query += string.Format(" -i \"{0}\"", task.Source);
query += string.Format(" -t {0}", task.Title);
query += string.Format(" --angle {0}", task.Angle);
// Decide what part of the video we want to encode.
switch (task.PointToPointMode)
{
case PointToPointMode.Chapters: // Chapters
if (task.StartPoint == task.EndPoint)
query += string.Format(" -c {0}", task.StartPoint);
else
query += string.Format(" -c {0}-{1}", task.StartPoint, task.EndPoint);
break;
case PointToPointMode.Seconds: // Seconds
int calculatedDuration = task.EndPoint - task.StartPoint;
query += string.Format(" --start-at duration:{0} --stop-at duration:{1}", task.StartPoint, calculatedDuration);
break;
case PointToPointMode.Frames: // Frames
calculatedDuration = task.EndPoint - task.StartPoint;
query += string.Format(" --start-at frame:{0} --stop-at frame:{1}", task.StartPoint, calculatedDuration);
break;
case PointToPointMode.Preview: // Preview
query += " --previews " + previewTotal + " ";
query += " --start-at-preview " + preview;
query += " --stop-at duration:" + duration + " ";
break;
default:
break;
}
return query;
}
示例10: FiltersQuery
/// <summary>
/// Generate the Command Line Arguments for the Filters Tab
/// </summary>
/// <param name="task">
/// The encode task.
/// </param>
/// <returns>
/// A Cli Query as a string
/// </returns>
private static string FiltersQuery(EncodeTask task)
{
string query = string.Empty;
switch (task.Detelecine) // DeTelecine
{
case Detelecine.Off:
query += string.Empty;
break;
case Detelecine.Default:
query += " --detelecine";
break;
case Detelecine.Custom:
query += string.Format(" --detelecine=\"{0}\"", task.CustomDetelecine);
break;
default:
query += string.Empty;
break;
}
switch (task.Decomb) // Decomb
{
case Decomb.Off:
query += string.Empty;
break;
case Decomb.Default:
query += " --decomb";
break;
case Decomb.Custom:
query += string.Format(" --decomb=\"{0}\"", task.CustomDecomb);
break;
case Decomb.Fast:
query += " --decomb=\"fast\"";
break;
case Decomb.Bob:
query += " --decomb=\"bob\"";
break;
default:
query += string.Empty;
break;
}
switch (task.Deinterlace) // DeInterlace
{
case Deinterlace.Fast:
query += " --deinterlace=\"fast\"";
break;
case Deinterlace.Slow:
query += " --deinterlace=\"slow\"";
break;
case Deinterlace.Slower:
query += " --deinterlace=\"slower\"";
break;
case Deinterlace.Custom:
query += string.Format(" --deinterlace=\"{0}\"", task.CustomDeinterlace);
break;
case Deinterlace.Bob:
query += " --deinterlace=\"bob\"";
break;
default:
query += string.Empty;
break;
}
switch (task.Denoise) // Denoise
{
case Denoise.Weak:
query += " --denoise=\"weak\"";
break;
case Denoise.Medium:
query += " --denoise=\"medium\"";
break;
case Denoise.Strong:
query += " --denoise=\"strong\"";
break;
case Denoise.Custom:
query += string.Format(" --denoise=\"{0}\"", task.CustomDenoise);
break;
default:
query += string.Empty;
break;
}
if (task.Deblock != 0)
query += string.Format(" --deblock={0}", task.Deblock);
if (task.Grayscale)
query += " -g ";
return query;
//.........这里部分代码省略.........
示例11: GenerateTabbedComponentsQuery
/// <summary>
/// Generate a Query from an Encode Task Object.
/// </summary>
/// <param name="task">
/// The task.
/// </param>
/// <param name="enableFilters">
/// The enableFilters.
/// </param>
/// <param name="verbosity">
/// The verbosity.
/// </param>
/// <param name="disableLibDvdNav">
/// The disable Lib Dvd Nav.
/// </param>
/// <returns>
/// The CLI query for the Tabbed section of the main window UI
/// </returns>
private static string GenerateTabbedComponentsQuery(EncodeTask task, bool enableFilters, int verbosity, bool disableLibDvdNav)
{
string query = string.Empty;
// Output Settings
query += OutputSettingsQuery(task);
// Filters Panel
if (enableFilters)
query += FiltersQuery(task);
// Picture Settings
query += PictureSettingsQuery(task);
// Video Settings
query += VideoSettingsQuery(task);
// Audio Settings
query += AudioSettingsQuery(task);
// Subtitles Panel
query += SubtitlesQuery(task);
// Chapter Markers
query += ChapterMarkersQuery(task);
// Advanced Panel
query += AdvancedQuery(task);
// Extra Settings
query += ExtraSettings(verbosity, disableLibDvdNav);
return query;
}
示例12: ChapterMarkersQuery
/// <summary>
/// Generate the Command Line Arguments for the Chapter markers tab
/// </summary>
/// <param name="task">
/// The encode task.
/// </param>
/// <returns>
/// A Cli Query as a string
/// </returns>
private static string ChapterMarkersQuery(EncodeTask task)
{
string query = string.Empty;
// Attach Source name and dvd title to the start of the chapters.csv filename.
// This is for the queue. It allows different chapter name files for each title.
string destName = Path.GetFileNameWithoutExtension(task.Destination);
string sourceTitle = task.Title.ToString();
if (task.IncludeChapterMarkers && destName != null)
{
if (destName.Trim() != String.Empty)
{
string path = sourceTitle != "Automatic"
? Path.Combine(Path.GetTempPath(), destName + "-" + sourceTitle + "-chapters.csv")
: Path.Combine(Path.GetTempPath(), destName + "-chapters.csv");
if (ChapterCsvSave(task.ChapterNames, path) == false)
query += " -m ";
else
query += " --markers=" + "\"" + path + "\"";
}
else
query += " -m";
}
return query;
}
示例13: DestinationQuery
/// <summary>
/// Generate the Command Line Arguments for the Destination File
/// </summary>
/// <param name="task">
/// The encode task.
/// </param>
/// <returns>
/// A Cli Query as a string
/// </returns>
private static string DestinationQuery(EncodeTask task)
{
string query = string.Empty;
if (task.PointToPointMode == PointToPointMode.Preview)
query += string.Format(" -o \"{0}\" ", task.Destination.Replace(".m", "_sample.m"));
else
query += string.Format(" -o \"{0}\" ", task.Destination);
return query;
}
示例14: SetSource
/// <summary>
/// Setup this window for a new source
/// </summary>
/// <param name="title">
/// The title.
/// </param>
/// <param name="preset">
/// The preset.
/// </param>
/// <param name="task">
/// The task.
/// </param>
public void SetSource(Title title, Preset preset, EncodeTask task)
{
}
示例15: AudioSettingsQuery
/// <summary>
/// Generate the Command Line Arguments for the Audio Settings Tab
/// </summary>
/// <param name="task">
/// The encode task.
/// </param>
/// <returns>
/// A Cli Query as a string
/// </returns>
private static string AudioSettingsQuery(EncodeTask task)
{
string query = string.Empty;
ObservableCollection<AudioTrack> audioTracks = task.AudioTracks;
List<int> tracks = new List<int>();
List<AudioEncoder> codecs = new List<AudioEncoder>();
List<Mixdown> mixdowns = new List<Mixdown>();
List<double> samplerates = new List<double>();
List<int> bitrates = new List<int>();
List<double> drcs = new List<double>();
List<double> gains = new List<double>();
List<string> trackNames = new List<string>();
// No Audio
if (audioTracks.Count == 0)
query += " -a none ";
// Gather information about each audio track and store them in the declared lists.
foreach (AudioTrack track in audioTracks)
{
if (track.Track == null)
{
continue;
}
tracks.Add(track.Track.Value);
// Audio Codec (-E)
codecs.Add(track.Encoder);
// Audio Mixdown (-6)
mixdowns.Add(track.IsPassthru ? Mixdown.None : track.MixDown);
// Sample Rate (-R)
samplerates.Add(track.IsPassthru ? 0 : track.SampleRate);
// Audio Bitrate (-B)
bitrates.Add(track.IsPassthru ? 0 : track.Bitrate);
// DRC (-D)
drcs.Add(track.IsPassthru ? 0 : track.DRC);
// Gain (--gain)
gains.Add(track.IsPassthru ? 0 : track.Gain);
// Audio Track Name (--aname)
trackNames.Add(track.TrackName);
}
// Audio Track (-a)
string audioItems = string.Empty;
bool firstLoop = true;
foreach (int item in tracks)
{
if (firstLoop)
{
audioItems = item.ToString();
firstLoop = false;
}
else
audioItems += "," + item;
}
if (audioItems.Trim() != String.Empty)
query += " -a " + audioItems;
firstLoop = true;
audioItems = string.Empty; // Reset for another pass.
// Audio Codec (-E)
foreach (AudioEncoder item in codecs)
{
if (firstLoop)
{
audioItems = Converters.GetCliAudioEncoder(item);
firstLoop = false;
}
else
audioItems += "," + Converters.GetCliAudioEncoder(item);
}
if (audioItems.Trim() != String.Empty)
query += " -E " + audioItems;
firstLoop = true;
audioItems = string.Empty; // Reset for another pass.
// Audio Mixdown (-6)
foreach (Mixdown item in mixdowns)
{
if (firstLoop)
{
//.........这里部分代码省略.........