本文整理汇总了C#中HandBrake.ApplicationServices.Model.Preset类的典型用法代码示例。如果您正苦于以下问题:C# Preset类的具体用法?C# Preset怎么用?C# Preset使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Preset类属于HandBrake.ApplicationServices.Model命名空间,在下文中一共展示了Preset类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Export
/// <summary>
/// Export a MacGui style plist preset.
/// </summary>
/// <param name="path">
/// The path.
/// </param>
/// <param name="preset">
/// The preset.
/// </param>
public static void Export(string path, Preset preset)
{
EncodeTask parsed = QueryParserUtility.Parse(preset.Query);
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);
// Footer
xmlWriter.WriteEndElement();
xmlWriter.WriteEndElement();
xmlWriter.WriteEndDocument();
// Closeout
xmlWriter.Close();
}
开发者ID:shkolnik,项目名称:HandBrake,代码行数:34,代码来源:PlistUtility.cs
示例2: 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();
}
}
开发者ID:JuannyWang,项目名称:HandBrake-QuickSync-Mac,代码行数:43,代码来源:PlistUtility.cs
示例3: SetPresetCropWarningLabel
/// <summary>
/// Set the Preset Crop Warning Label
/// </summary>
/// <param name="selectedPreset">
/// The Selected preset
/// </param>
public void SetPresetCropWarningLabel(Preset selectedPreset)
{
if (this.check_customCrop.Checked)
{
lbl_presetCropWarning.Visible = true;
if (selectedPreset != null && selectedPreset.CropSettings == false) lbl_presetCropWarning.Visible = false;
else if (selectedPreset == null) lbl_presetCropWarning.Visible = false;
}
else
{
lbl_presetCropWarning.Visible = false;
}
}
开发者ID:vandhanaa,项目名称:Handbrake,代码行数:19,代码来源:PictureSettings.cs
示例4: CreatePreset
/// <summary>
/// The create preset.
/// </summary>
/// <param name="plist">
/// The plist.
/// </param>
/// <returns>
/// The <see cref="Preset"/>.
/// </returns>
public static Preset CreatePreset(PList plist)
{
Preset preset = new Preset { Task = new EncodeTask(), Category = PresetService.UserPresetCatgoryName };
// Parse the settings out.
foreach (var item in plist)
{
if (item.Key == "AudioList")
{
List<AudioTrack> tracks = ParseAudioTracks(item.Value);
preset.Task.AudioTracks = new ObservableCollection<AudioTrack>(tracks);
}
else
{
ParseSetting(item, preset);
}
}
// Handle the PictureDecombDeinterlace key
if (preset.UseDeinterlace)
{
preset.Task.Decomb = Decomb.Off;
preset.Task.CustomDecomb = string.Empty;
}
// Depending on the selected preset options, we may need to change some settings around.
// If the user chose not to use fitlers, remove them.
if (!preset.UsePictureFilters)
{
preset.Task.Detelecine = Detelecine.Off;
preset.Task.Denoise = Denoise.Off;
preset.Task.Deinterlace = Deinterlace.Off;
preset.Task.Decomb = Decomb.Off;
preset.Task.Deblock = 0;
preset.Task.Grayscale = false;
}
// IF we are using Source Max, Set the Max Width / Height values.
if (preset.PictureSettingsMode == PresetPictureSettingsMode.SourceMaximum)
{
preset.Task.MaxWidth = preset.Task.Height;
preset.Task.MaxHeight = preset.Task.Width;
}
return preset;
}
开发者ID:RichardMarks,项目名称:HandBrakeMirror,代码行数:55,代码来源:PlistPresetFactory.cs
示例5: selectPreset
/// <summary>
/// Select the selected preset and setup the GUI
/// </summary>
private void selectPreset()
{
if (treeView_presets.SelectedNode != null)
{
// Ok, so, we've selected a preset. Now we want to load it.
string presetName = treeView_presets.SelectedNode.Text;
Preset preset = presetHandler.GetPreset(presetName);
if (preset != null)
{
string query = presetHandler.GetPreset(presetName).Query;
if (query != null)
{
// Ok, Reset all the H264 widgets before changing the preset
x264Panel.Reset2Defaults();
// Now load the preset
PresetLoader.LoadPreset(this, preset);
// The x264 widgets will need updated, so do this now:
x264Panel.StandardizeOptString();
x264Panel.SetCurrentSettingsInPanel();
// Finally, let this window have a copy of the preset settings.
this.currentlySelectedPreset = preset;
PictureSettings.SetPresetCropWarningLabel(preset);
}
}
}
}
开发者ID:altoplano,项目名称:HandBrake,代码行数:33,代码来源:frmMain.cs
示例6: SetupLanguages
/// <summary>
/// The setup languages.
/// </summary>
/// <param name="preset">
/// The preset.
/// </param>
private void SetupLanguages(Preset preset)
{
// Step 1, Set the behaviour mode
this.AudioBehaviours.SelectedBehaviour = AudioBehaviourModes.None;
this.AudioBehaviours.SelectedLangauges.Clear();
// Step 2, Get all the languages
IDictionary<string, string> langList = LanguageUtilities.MapLanguages();
langList = (from entry in langList orderby entry.Key ascending select entry).ToDictionary(pair => pair.Key, pair => pair.Value);
// Step 3, Setup Available Languages
this.AvailableLanguages.Clear();
foreach (string item in langList.Keys)
{
this.AvailableLanguages.Add(item);
}
// Step 4, Set the Selected Languages
if (preset != null && preset.AudioTrackBehaviours != null)
{
this.AudioBehaviours.SelectedBehaviour = preset.AudioTrackBehaviours.SelectedBehaviour;
foreach (string selectedItem in preset.AudioTrackBehaviours.SelectedLangauges)
{
this.AvailableLanguages.Remove(selectedItem);
this.AudioBehaviours.SelectedLangauges.Add(selectedItem);
}
}
}
开发者ID:Jesper87,项目名称:HandBrake,代码行数:35,代码来源:AudioViewModel.cs
示例7: pmnu_saveChanges_Click
/// <summary>
/// RMenu - Save Changes to Preset
/// </summary>
/// <param name="sender">
/// The sender.
/// </param>
/// <param name="e">
/// The e.
/// </param>
private void pmnu_saveChanges_Click(object sender, EventArgs e)
{
if (this.selectedTitle == null)
{
MessageBox.Show(
"Please scan a source before trying to update a preset.",
"Error",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
return;
}
DialogResult result =
MessageBox.Show(
"Do you wish to include picture settings when updating the preset: " +
treeView_presets.SelectedNode.Text, "Update Preset", MessageBoxButtons.YesNoCancel,
MessageBoxIcon.Question);
string query = QueryGenerator.GenerateQueryForPreset(
this, QueryPictureSettingsMode.SourceMaximum, true, 0, 0);
Preset preset = new Preset
{
Name = this.treeView_presets.SelectedNode.Text,
Query = query,
CropSettings = (result == DialogResult.Yes),
AudioPassthruSettings = this.AudioSettings.PassthruSettings,
Task = QueryParserUtility.Parse(query),
};
presetHandler.Update(preset);
}
开发者ID:altoplano,项目名称:HandBrake,代码行数:39,代码来源:frmMain.cs
示例8: ParseSetting
/// <summary>
/// Parse a setting and set it in the given preset.
/// </summary>
/// <param name="kvp">
/// The kvp setting pair.
/// </param>
/// <param name="preset">
/// The preset object.
/// </param>
private static void ParseSetting(KeyValuePair<string, dynamic> kvp, Preset preset)
{
switch (kvp.Key)
{
// Output Settings
case "FileFormat":
preset.Task.OutputFormat = Converters.GetFileFormat(kvp.Value.Replace("file", string.Empty).Trim());
break;
case "Mp4HttpOptimize":
preset.Task.OptimizeMP4 = kvp.Value == 1;
break;
case "Mp4iPodCompatible":
preset.Task.IPod5GSupport = kvp.Value == 1;
break;
// Picture Settings
case "PictureAutoCrop":
preset.Task.HasCropping = kvp.Value != 1;
break;
case "PictureTopCrop":
preset.Task.Cropping.Top = kvp.Value;
break;
case "PictureBottomCrop":
preset.Task.Cropping.Bottom = kvp.Value;
break;
case "PictureLeftCrop":
preset.Task.Cropping.Left = kvp.Value;
break;
case "PictureRightCrop":
preset.Task.Cropping.Right = kvp.Value;
break;
case "PictureHeight":
preset.Task.Height = kvp.Value == null || kvp.Value == 0 ? null : kvp.Value;
break;
case "PictureWidth":
preset.Task.Width = kvp.Value == null || kvp.Value == 0 ? null : kvp.Value;
break;
case "PictureKeepRatio":
preset.Task.KeepDisplayAspect = kvp.Value == 1;
break;
case "PicturePAR":
preset.Task.Anamorphic = (Anamorphic)kvp.Value;
break;
case "PictureModulus":
preset.Task.Modulus = kvp.Value;
break;
// Filters
case "PictureDeblock":
preset.Task.Deblock = kvp.Value;
break;
case "PictureDecomb":
preset.Task.Decomb = (Decomb)kvp.Value;
break;
case "PictureDecombCustom":
preset.Task.CustomDecomb = kvp.Value;
break;
case "PictureDecombDeinterlace":
preset.UseDeinterlace = kvp.Value == 1;
break;
case "PictureDeinterlace":
preset.Task.Deinterlace = (Deinterlace)kvp.Value;
break;
case "PictureDeinterlaceCustom":
preset.Task.CustomDeinterlace = kvp.Value;
break;
case "PictureDenoise":
preset.Task.Denoise = (Denoise)kvp.Value;
break;
case "PictureDenoiseCustom":
preset.Task.CustomDenoise = kvp.Value;
break;
case "PictureDetelecine":
preset.Task.Detelecine = (Detelecine)kvp.Value;
break;
case "PictureDetelecineCustom":
preset.Task.CustomDetelecine = kvp.Value;
break;
// Video Tab
case "VideoAvgBitrate":
if (!string.IsNullOrEmpty(kvp.Value))
{
preset.Task.VideoBitrate = int.Parse(kvp.Value);
}
break;
case "VideoEncoder":
preset.Task.VideoEncoder = EnumHelper<VideoEncoder>.GetValue(kvp.Value);
break;
case "VideoFramerate":
preset.Task.Framerate = kvp.Value == "Same as source" || string.IsNullOrEmpty(kvp.Value) ? null : double.Parse(kvp.Value, CultureInfo.InvariantCulture);
//.........这里部分代码省略.........
开发者ID:RichardMarks,项目名称:HandBrakeMirror,代码行数:101,代码来源:PlistPresetFactory.cs
示例9: 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)
{
this.SourceTracks.Clear();
this.SourceTracks.Add(ForeignAudioSearchTrack);
foreach (Subtitle subtitle in title.Subtitles)
{
this.SourceTracks.Add(subtitle);
}
this.Task = task;
this.NotifyOfPropertyChange(() => this.Task);
this.AutomaticSubtitleSelection();
}
开发者ID:bingo2011,项目名称:HandBrakeMirror,代码行数:26,代码来源:SubtitlesViewModel.cs
示例10: SetPreset
/// <summary>
/// Setup this tab for the specified preset.
/// </summary>
/// <param name="preset">
/// The preset.
/// </param>
/// <param name="task">
/// The task.
/// </param>
public void SetPreset(Preset preset, EncodeTask task)
{
this.Task = task;
if (preset == null || preset.Task == null)
{
return;
}
this.SelectedVideoEncoder = preset.Task.VideoEncoder;
this.SelectedFramerate = preset.Task.Framerate.HasValue ? preset.Task.Framerate.Value.ToString(CultureInfo.InvariantCulture) : SameAsSource;
this.IsConstantQuantity = preset.Task.VideoEncodeRateType == VideoEncodeRateType.ConstantQuality;
switch (preset.Task.FramerateMode)
{
case FramerateMode.CFR:
this.IsConstantFramerate = true;
break;
case FramerateMode.VFR:
this.IsVariableFramerate = true;
this.ShowPeakFramerate = false;
break;
case FramerateMode.PFR:
this.IsPeakFramerate = true;
this.ShowPeakFramerate = true;
break;
}
double cqStep = userSettingService.GetUserSetting<double>(UserSettingConstants.X264Step);
double rfValue = 0;
this.SetQualitySliderBounds();
switch (this.SelectedVideoEncoder)
{
case VideoEncoder.FFMpeg:
case VideoEncoder.FFMpeg2:
if (preset.Task.Quality.HasValue)
{
int cq;
int.TryParse(preset.Task.Quality.Value.ToString(CultureInfo.InvariantCulture), out cq);
this.RF = 32 - cq;
}
break;
case VideoEncoder.X264:
double multiplier = 1.0 / cqStep;
if (preset.Task.Quality.HasValue)
{
rfValue = preset.Task.Quality.Value * multiplier;
}
this.RF = this.QualityMax - (int)Math.Round(rfValue, 0);
break;
case VideoEncoder.Theora:
if (preset.Task.Quality.HasValue)
{
this.RF = (int)preset.Task.Quality.Value;
}
break;
}
this.Task.TwoPass = preset.Task.TwoPass;
this.Task.TurboFirstPass = preset.Task.TurboFirstPass;
this.Task.VideoBitrate = preset.Task.VideoBitrate;
this.NotifyOfPropertyChange(() => this.Task);
if (preset.Task != null)
{
this.SetEncoder(preset.Task.VideoEncoder);
this.X264PresetValue = preset.Task.VideoEncoder == VideoEncoder.X264
? (int)preset.Task.X264Preset
: (int)x264Preset.Medium;
this.H264Profile = preset.Task.VideoEncoder == VideoEncoder.X264 ? preset.Task.H264Profile : x264Profile.None;
this.X264Tune = preset.Task.VideoEncoder == VideoEncoder.X264 ? preset.Task.X264Tune : x264Tune.None;
this.H264Level = preset.Task.VideoEncoder == VideoEncoder.X264 ? preset.Task.H264Level : "Auto";
this.FastDecode = preset.Task.VideoEncoder == VideoEncoder.X264 && preset.Task.FastDecode;
this.ExtraArguments = preset.Task.ExtraAdvancedArguments;
this.UseAdvancedTab = !string.IsNullOrEmpty(preset.Task.AdvancedEncoderOptions) && this.ShowAdvancedTab;
}
}
开发者ID:betabot7,项目名称:HandBrakeMirror,代码行数:92,代码来源:VideoViewModel.cs
示例11: SetSource
/// <summary>
/// Set the Source Title
/// </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)
{
this.SourceTracks = title.AudioTracks;
this.SetPreset(preset, task);
this.AutomaticTrackSelection();
}
开发者ID:seven1240,项目名称:HandBrake,代码行数:19,代码来源:AudioViewModel.cs
示例12: AddEncodeSettings
/// <summary>
/// Add the encode settings to the preset
/// </summary>
/// <param name="xmlWriter">
/// The xml writer.
/// </param>
/// <param name="parsed">
/// The parsed.
/// </param>
/// <param name="preset">
/// The preset.
/// </param>
/// <param name="build">
/// The build.
/// </param>
private static void AddEncodeSettings(XmlTextWriter xmlWriter, EncodeTask parsed, Preset preset, string build)
{
AddEncodeElement(xmlWriter, "AudioAllowAACPass", "integer", getNullBoolValue(parsed.AllowedPassthruOptions.AudioAllowAACPass));
AddEncodeElement(xmlWriter, "AudioAllowAC3Pass", "integer", getNullBoolValue(parsed.AllowedPassthruOptions.AudioAllowAC3Pass));
AddEncodeElement(xmlWriter, "AudioAllowDTSHDPass", "integer", getNullBoolValue(parsed.AllowedPassthruOptions.AudioAllowDTSHDPass));
AddEncodeElement(xmlWriter, "AudioAllowDTSPass", "integer", getNullBoolValue(parsed.AllowedPassthruOptions.AudioAllowDTSPass));
AddEncodeElement(xmlWriter, "AudioAllowMP3Pass", "integer", getNullBoolValue(parsed.AllowedPassthruOptions.AudioAllowMP3Pass));
AddEncodeElement(xmlWriter, "AudioEncoderFallback", "string", EnumHelper<AudioEncoder>.GetDisplay(parsed.AllowedPassthruOptions.AudioEncoderFallback));
AddEncodeElement(xmlWriter, "ChapterMarkers", "integer", parsed.IncludeChapterMarkers ? "1" : "0");
AddEncodeElement(xmlWriter, "Default", "integer", "0");
AddEncodeElement(xmlWriter, "FileFormat", "string", (parsed.OutputFormat == OutputFormat.Mp4 || parsed.OutputFormat == OutputFormat.M4V) ? "MP4 file" : "MKV file");
AddBooleanElement(xmlWriter, "Folder", false);
AddEncodeElement(xmlWriter, "Mp4HttpOptimize", "integer", parsed.OptimizeMP4 ? "1" : "0");
AddEncodeElement(xmlWriter, "Mp4LargeFile", "integer", parsed.LargeFile ? "1" : "0");
AddEncodeElement(xmlWriter, "Mp4iPodCompatible", "integer", parsed.IPod5GSupport ? "1" : "0");
AddEncodeElement(xmlWriter, "PictureAutoCrop", "integer", "1");
AddEncodeElement(xmlWriter, "PictureBottomCrop", "integer", parsed.Cropping.Bottom.ToString());
// Filters
AddEncodeElement(xmlWriter, "PictureDeblock", "integer", parsed.Deblock.ToString());
switch (parsed.Decomb)
{
case Decomb.Off:
AddEncodeElement(xmlWriter, "PictureDecomb", "integer", "0");
AddEncodeElement(xmlWriter, "PictureDecombCustom", "string", string.Empty);
break;
case Decomb.Default:
AddEncodeElement(xmlWriter, "PictureDecomb", "integer", "2");
AddEncodeElement(xmlWriter, "PictureDecombCustom", "string", string.Empty);
break;
case Decomb.Fast:
AddEncodeElement(xmlWriter, "PictureDecomb", "integer", "3");
AddEncodeElement(xmlWriter, "PictureDecombCustom", "string", string.Empty);
break;
case Decomb.Bob:
AddEncodeElement(xmlWriter, "PictureDecomb", "integer", "4");
AddEncodeElement(xmlWriter, "PictureDecombCustom", "string", string.Empty);
break;
case Decomb.Custom:
AddEncodeElement(xmlWriter, "PictureDecomb", "integer", "1");
AddEncodeElement(xmlWriter, "PictureDecombCustom", "string", parsed.CustomDecomb);
break;
}
AddEncodeElement(xmlWriter, "PictureDecombDeinterlace", "integer", parsed.Decomb != Decomb.Off ? "0" : "1");
switch (parsed.Deinterlace)
{
case Deinterlace.Off:
AddEncodeElement(xmlWriter, "PictureDeinterlace", "integer", "0");
AddEncodeElement(xmlWriter, "PictureDeinterlaceCustom", "string", string.Empty);
break;
case Deinterlace.Fast:
AddEncodeElement(xmlWriter, "PictureDeinterlace", "integer", "2");
AddEncodeElement(xmlWriter, "PictureDeinterlaceCustom", "string", string.Empty);
break;
case Deinterlace.Slow:
AddEncodeElement(xmlWriter, "PictureDeinterlace", "integer", "3");
AddEncodeElement(xmlWriter, "PictureDeinterlaceCustom", "string", string.Empty);
break;
case Deinterlace.Slower:
AddEncodeElement(xmlWriter, "PictureDeinterlace", "integer", "4");
AddEncodeElement(xmlWriter, "PictureDeinterlaceCustom", "string", string.Empty);
break;
case Deinterlace.Bob:
AddEncodeElement(xmlWriter, "PictureDeinterlace", "integer", "5");
AddEncodeElement(xmlWriter, "PictureDeinterlaceCustom", "string", string.Empty);
break;
case Deinterlace.Custom:
AddEncodeElement(xmlWriter, "PictureDeinterlace", "integer", "1");
AddEncodeElement(xmlWriter, "PictureDeinterlaceCustom", "string", parsed.CustomDeinterlace);
break;
}
switch (parsed.Denoise)
{
case Denoise.Off:
AddEncodeElement(xmlWriter, "PictureDenoise", "integer", "0");
AddEncodeElement(xmlWriter, "PictureDenoiseCustom", "string", string.Empty);
break;
case Denoise.Weak:
AddEncodeElement(xmlWriter, "PictureDenoise", "integer", "2");
AddEncodeElement(xmlWriter, "PictureDenoiseCustom", "string", string.Empty);
break;
//.........这里部分代码省略.........
开发者ID:JuannyWang,项目名称:HandBrake-QuickSync-Mac,代码行数:101,代码来源:PlistUtility.cs
示例13: SetPreset
/// <summary>
/// Setup this tab for the specified preset.
/// </summary>
/// <param name="preset">
/// The preset.
/// </param>
/// <param name="task">
/// The task.
/// </param>
public void SetPreset(Preset preset, EncodeTask task)
{
this.Task = task;
this.currentPreset = preset;
if (preset != null && preset.Task != null)
{
int mode = this.UserSettingService.GetUserSetting<int>(UserSettingConstants.DubModeAudio);
if (mode >= 1)
{
this.AutomaticTrackSelection();
}
else
{
this.AddTracksFromPreset(preset);
}
this.AutomaticTrackSelection();
this.Task.AllowedPassthruOptions = new AllowedPassthru(preset.Task.AllowedPassthruOptions);
}
this.NotifyOfPropertyChange(() => this.Task);
}
开发者ID:kevleyski,项目名称:HandBrake,代码行数:32,代码来源:AudioViewModel.cs
示例14: AddEncodeSettings
/// <summary>
/// Add the encode settings to the preset
/// </summary>
/// <param name="xmlWriter">
/// The xml writer.
/// </param>
/// <param name="parsed">
/// The parsed.
/// </param>
/// <param name="preset">
/// The preset.
/// </param>
private static void AddEncodeSettings(XmlTextWriter xmlWriter, EncodeTask parsed, Preset preset)
{
AddEncodeElement(xmlWriter, "ChapterMarkers", "integer", parsed.IncludeChapterMarkers ? "1" : "0");
AddEncodeElement(xmlWriter, "Default", "integer", "0");
AddEncodeElement(xmlWriter, "FileFormat", "string", Converters.GetFileFormat(parsed.OutputFormat) + " file");
AddBooleanElement(xmlWriter, "Folder", false);
AddEncodeElement(xmlWriter, "Mp4HttpOptimize", "integer", parsed.OptimizeMP4 ? "1" : "0");
AddEncodeElement(xmlWriter, "Mp4LargeFile", "integer", parsed.LargeFile ? "1" : "0");
AddEncodeElement(xmlWriter, "Mp4iPodCompatible", "integer", parsed.IPod5GSupport ? "1" : "0");
AddEncodeElement(xmlWriter, "PictureAutoCrop", "integer", "1");
AddEncodeElement(xmlWriter, "PictureBottomCrop", "integer", parsed.Cropping.Bottom.ToString());
// Filters
AddEncodeElement(xmlWriter, "PictureDeblock", "integer", parsed.Deblock.ToString());
switch (parsed.Decomb)
{
case Decomb.Off:
AddEncodeElement(xmlWriter, "PictureDecomb", "integer", "0");
AddEncodeElement(xmlWriter, "PictureDecombCustom", "string", string.Empty);
break;
case Decomb.Default:
AddEncodeElement(xmlWriter, "PictureDecomb", "integer", "1");
AddEncodeElement(xmlWriter, "PictureDecombCustom", "string", string.Empty);
break;
default:
AddEncodeElement(xmlWriter, "PictureDecomb", "integer", "2");
AddEncodeElement(xmlWriter, "PictureDecombCustom", "string", parsed.CustomDecomb);
break;
}
AddEncodeElement(xmlWriter, "PictureDecombDeinterlace", "integer", parsed.Decomb != Decomb.Off ? "0" : "1");
switch (parsed.Deinterlace)
{
case Deinterlace.Off:
AddEncodeElement(xmlWriter, "PictureDeinterlace", "integer", "0");
AddEncodeElement(xmlWriter, "PictureDeinterlaceCustom", "string", string.Empty);
break;
case Deinterlace.Fast:
AddEncodeElement(xmlWriter, "PictureDeinterlace", "integer", "1");
AddEncodeElement(xmlWriter, "PictureDeinterlaceCustom", "string", string.Empty);
break;
case Deinterlace.Slow:
AddEncodeElement(xmlWriter, "PictureDeinterlace", "integer", "2");
AddEncodeElement(xmlWriter, "PictureDeinterlaceCustom", "string", string.Empty);
break;
case Deinterlace.Slower:
AddEncodeElement(xmlWriter, "PictureDeinterlace", "integer", "3");
AddEncodeElement(xmlWriter, "PictureDeinterlaceCustom", "string", string.Empty);
break;
default:
AddEncodeElement(xmlWriter, "PictureDeinterlace", "integer", "4");
AddEncodeElement(xmlWriter, "PictureDeinterlaceCustom", "string", parsed.CustomDeinterlace);
break;
}
switch (parsed.Denoise)
{
case Denoise.Off:
AddEncodeElement(xmlWriter, "PictureDenoise", "integer", "0");
AddEncodeElement(xmlWriter, "PictureDenoiseCustom", "string", string.Empty);
break;
case Denoise.Weak:
AddEncodeElement(xmlWriter, "PictureDenoise", "integer", "1");
AddEncodeElement(xmlWriter, "PictureDenoiseCustom", "string", string.Empty);
break;
case Denoise.Medium:
AddEncodeElement(xmlWriter, "PictureDenoise", "integer", "2");
AddEncodeElement(xmlWriter, "PictureDenoiseCustom", "string", string.Empty);
break;
case Denoise.Strong:
AddEncodeElement(xmlWriter, "PictureDenoise", "integer", "3");
AddEncodeElement(xmlWriter, "PictureDenoiseCustom", "string", string.Empty);
break;
default:
AddEncodeElement(xmlWriter, "PictureDenoise", "integer", "4");
AddEncodeElement(xmlWriter, "PictureDenoiseCustom", "string", parsed.CustomDenoise);
break;
}
int detelecine;
switch (parsed.Detelecine)
{
case Detelecine.Off:
detelecine = 0;
break;
case Detelecine.Default:
detelecine = 2;
//.........这里部分代码省略.........
开发者ID:shkolnik,项目名称:HandBrake,代码行数:101,代码来源:PlistUtility.cs
示例15: ImportPreset
/// <summary>
/// Import a plist preset
/// </summary>
private void ImportPreset()
{
if (openPreset.ShowDialog() == DialogResult.OK)
{
EncodeTask parsed = PlistPresetHandler.Import(openPreset.FileName);
if (presetHandler.CheckIfPresetExists(parsed.PresetName))
{
if (!presetHandler.CanUpdatePreset(parsed.PresetName))
{
MessageBox.Show(
"You can not import a preset with the same name as a built-in preset.",
"Error",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
return;
}
DialogResult result =
MessageBox.Show("This preset appears to already exist. Would you like to overwrite it?",
"Overwrite preset?",
MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
if (result == DialogResult.Yes)
{
Preset preset = new Preset
{
Name = parsed.PresetName,
Query = QueryGeneratorUtility.GenerateQuery(parsed),
CropSettings = parsed.UsesPictureSettings,
Description = string.Empty,
AudioPassthruSettings = parsed.AllowedPassthruOptions
};
presetHandler.Update(preset);
}
}
else
{
Preset preset = new Preset
{
Name = parsed.PresetName,
Query = QueryGeneratorUtility.GenerateQuery(parsed),
CropSettings = parsed.UsesPictureSettings,
Description = string.Empty,
AudioPassthruSettings = parsed.AllowedPassthruOptions
};
if (presetHandler.Add(preset))
{
TreeNode preset_treeview = new TreeNode(parsed.PresetName)
{
ForeColor = Color.Black,
Tag = preset,
};
treeView_presets.Nodes.Add(preset_treeview);
}
}
}
}
开发者ID:seifscape,项目名称:HandBrake,代码行数:62,代码来源:frmMain.cs
示例16: AddTracksFromPreset
/// <summary>
/// Add the required tracks for the current preset
/// </summary>
/// <param name="preset">
/// The preset.
/// </param>
private void AddTracksFromPreset(Preset preset)
{
// Clear out the old tracks
this.Task.AudioTracks.Clear();
// Add the preset audio tracks with the preferred language
foreach (AudioTrack track in preset.Task.AudioTracks)
{
this.Task.AudioTracks.Add(new AudioTrack(track) { ScannedTrack = this.GetPreferredAudioTrack() });
}
}
开发者ID:kevleyski,项目名称:HandBrake,代码行数:17,代码来源:AudioViewModel.cs
示例17: LoadPreset
/// <summary>
/// This function takes in a Query which has been parsed by QueryParser and
/// set's all the GUI widgets correctly.
/// </summary>
/// <param name="mainWindow">
/// FrmMain window
/// </param>
/// <param name="preset">
/// The preset.
/// </param>
public static void LoadPreset(frmMain mainWindow, Preset preset)
{
// Send the query from the file to the Query Parser class
EncodeTask presetQuery = preset.Task ?? QueryParserUtility.Parse(preset.Query);
if (preset.Task == null)
{
preset.Task = presetQuery;
}
#region Source
// Reset some vaules to stock first to prevent errors.
mainWindow.check_iPodAtom.CheckState = CheckState.Unchecked;
// Now load all the new settings onto the main window
string destination = mainWindow.text_destination.Text;
destination = destination.Replace(".mp4", "." + presetQuery.OutputFormat);
destination = destination.Replace(".m4v", "." + presetQuery.OutputFormat);
destination = destination.Replace(".mkv", "." + presetQuery.OutputFormat);
mainWindow.text_destination.Text = destination;
#endregion
#region Destination and Output Settings
if (presetQuery.OutputFormat == OutputFormat.Mp4 || presetQuery.OutputFormat == OutputFormat.M4V)
{
if (mainWindow.drop_format.SelectedIndex == 0)
{
mainWindow.SetExtension(".mp4");
}
else
{
mainWindow.drop_format.SelectedIndex = 0;
}
}
else if (presetQuery.OutputFormat == OutputFormat.Mkv)
{
if (mainWindow.drop_format.SelectedIndex == 1)
{
mainWindow.SetExtension(".mkv");
}
else
{
mainWindow.drop_format.SelectedIndex = 1;
}
|
请发表评论