本文整理汇总了C#中HandBrakeWPF.Services.Presets.Model.Preset类的典型用法代码示例。如果您正苦于以下问题:C# Preset类的具体用法?C# Preset怎么用?C# Preset使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Preset类属于HandBrakeWPF.Services.Presets.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>
/// <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:beppec56,项目名称:HandBrake-git_svn-mirror,代码行数:43,代码来源:PlistFactory.cs
示例2: Preset
/// <summary>
/// Initializes a new instance of the <see cref="PropertyChangedBase"/> class.
/// Creates an instance of <see cref="T:HandBrakeWPF.Utilities.PropertyChangedBase"/>.
/// </summary>
public Preset(Preset preset)
{
this.Category = preset.Category;
this.Description = preset.Description;
this.IsBuildIn = preset.IsBuildIn;
this.Name = preset.Name;
this.PictureSettingsMode = preset.PictureSettingsMode;
this.Task = new EncodeTask(preset.Task);
this.AudioTrackBehaviours = new AudioBehaviours(preset.AudioTrackBehaviours);
this.SubtitleTrackBehaviours = new SubtitleBehaviours(preset.SubtitleTrackBehaviours);
}
开发者ID:sr55,项目名称:HandBrake,代码行数:15,代码来源:Preset.cs
示例3: 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,
AudioTrackBehaviours = new AudioBehaviours(),
SubtitleTrackBehaviours = new SubtitleBehaviours()
};
// 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:lvaleriu,项目名称:HandBrake,代码行数:61,代码来源:PlistPresetFactory.cs
示例4: Setup
/// <summary>
/// The setup.
/// </summary>
/// <param name="scannedSource">
/// The scanned source.
/// </param>
/// <param name="srcName">
/// The src Name.
/// </param>
/// <param name="addAction">
/// The add Action.
/// </param>
/// <param name="preset">
/// The preset.
/// </param>
public void Setup(Source scannedSource, string srcName, Action<IEnumerable<SelectionTitle>> addAction, Preset preset)
{
this.TitleList.Clear();
this.addToQueue = addAction;
if (scannedSource != null)
{
IEnumerable<Title> titles = orderedByTitle
? scannedSource.Titles
: scannedSource.Titles.OrderByDescending(o => o.Duration).ToList();
foreach (Title item in titles)
{
SelectionTitle title = new SelectionTitle(item, srcName) { IsSelected = true };
TitleList.Add(title);
}
}
if (preset != null)
{
this.CurrentPreset = string.Format(ResourcesUI.QueueSelection_UsingPreset, preset.Name);
}
this.NotifyOfPropertyChange(() => this.IsAutoNamingEnabled);
}
开发者ID:galad87,项目名称:HandBrake-VideoToolbox,代码行数:40,代码来源:QueueSelectionViewModel.cs
示例5: 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.Task.IncludeChapterMarkers = preset.Task.IncludeChapterMarkers;
this.NotifyOfPropertyChange(() => this.Task);
}
开发者ID:KonaBlend,项目名称:HandBrake,代码行数:15,代码来源:ChaptersViewModel.cs
示例6: SetSource
/// <summary>
/// Setup this window for a new source
/// </summary>
/// <param name="source">
/// The source.
/// </param>
/// <param name="title">
/// The title.
/// </param>
/// <param name="preset">
/// The preset.
/// </param>
/// <param name="task">
/// The task.
/// </param>
public void SetSource(Source source, 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:beppec56,项目名称:HandBrake-git_svn-mirror,代码行数:29,代码来源:SubtitlesViewModel.cs
示例7: SetSource
/// <summary>
/// Setup this window for a new source
/// </summary>
/// <param name="source">
/// The source.
/// </param>
/// <param name="title">
/// The title.
/// </param>
/// <param name="preset">
/// The preset.
/// </param>
/// <param name="task">
/// The task.
/// </param>
public void SetSource(Source source, Title title, Preset preset, EncodeTask task)
{
this.Task = task;
this.NotifyOfPropertyChange(() => this.AdvancedOptionsString);
}
开发者ID:2wayne,项目名称:HandBrake,代码行数:20,代码来源:X264ViewModel.cs
示例8: Add
/// <summary>
/// Add a new preset to the system.
/// Performs an Update if it already exists
/// </summary>
/// <param name="preset">
/// A Preset to add
/// </param>
/// <returns>
/// True if added,
/// False if name already exists
/// </returns>
public bool Add(Preset preset)
{
if (this.CheckIfPresetExists(preset.Name) == false)
{
this.presets.Add(preset);
this.LastPresetAdded = preset;
// Update the presets file
this.UpdatePresetFiles();
return true;
}
this.Update(preset);
return true;
}
开发者ID:beppec56,项目名称:HandBrake-git_svn-mirror,代码行数:26,代码来源:PresetService.cs
示例9: SetSource
/// <summary>
/// Setup the window after a scan.
/// </summary>
/// <param name="source">
/// The source.
/// </param>
/// <param name="selectedTitle">
/// The selected title.
/// </param>
/// <param name="currentPreset">
/// The Current preset
/// </param>
/// <param name="encodeTask">
/// The task.
/// </param>
public void SetSource(Source source, Title selectedTitle, Preset currentPreset, EncodeTask encodeTask)
{
this.Task = encodeTask;
}
开发者ID:sr55,项目名称:HandBrake,代码行数:19,代码来源:MetaDataViewModel.cs
示例10: SetSource
/// <summary>
/// Setup this window for a new source
/// </summary>
/// <param name="source">
/// The source.
/// </param>
/// <param name="title">
/// The title.
/// </param>
/// <param name="preset">
/// The preset.
/// </param>
/// <param name="task">
/// The task.
/// </param>
public void SetSource(Source source, Title title, Preset preset, EncodeTask task)
{
this.currentTitle = title;
this.Task = task;
this.scannedSource = source;
if (title != null)
{
// Set cached info
this.sourceParValues = title.ParVal;
this.sourceResolution = title.Resolution;
// Update the cropping values, preffering those in the presets.
if (!preset.Task.HasCropping)
{
this.Task.Cropping.Top = title.AutoCropDimensions.Top;
this.Task.Cropping.Bottom = title.AutoCropDimensions.Bottom;
this.Task.Cropping.Left = title.AutoCropDimensions.Left;
this.Task.Cropping.Right = title.AutoCropDimensions.Right;
this.IsCustomCrop = false;
}
else
{
this.Task.Cropping.Left = preset.Task.Cropping.Left;
this.Task.Cropping.Right = preset.Task.Cropping.Right;
this.Task.Cropping.Top = preset.Task.Cropping.Top;
this.Task.Cropping.Bottom = preset.Task.Cropping.Bottom;
this.IsCustomCrop = true;
}
if (preset.PictureSettingsMode == PresetPictureSettingsMode.None)
{
// We have no instructions, so simply set it to the source.
this.Task.Width = this.GetModulusValue(this.sourceResolution.Width - this.CropLeft - this.CropRight);
this.MaintainAspectRatio = true;
}
else
{
// Set the Max Width / Height available to the user controls
if (this.sourceResolution.Width < this.MaxWidth)
{
this.MaxWidth = this.sourceResolution.Width;
}
else if (this.sourceResolution.Width > this.MaxWidth)
{
this.MaxWidth = preset.Task.MaxWidth ?? this.sourceResolution.Width;
}
if (this.sourceResolution.Height < this.MaxHeight)
{
this.MaxHeight = this.sourceResolution.Height;
}
else if (this.sourceResolution.Height > this.MaxHeight)
{
this.MaxHeight = preset.Task.MaxHeight ?? this.sourceResolution.Height;
}
// Set the Width, and Maintain Aspect ratio. That should calc the Height for us.
if (this.SelectedAnamorphicMode == Anamorphic.None)
{
this.Task.Width = preset.Task.Width ?? (this.MaxWidth - this.CropLeft - this.CropRight);
// Note: This will be auto-corrected in the property if it's too large.
}
else
{
this.Task.Width = preset.Task.Width ?? this.MaxWidth;
int cropHeight = this.Task.Cropping.Top + this.Task.Cropping.Bottom;
this.Task.Height = (preset.Task.Height ?? this.MaxHeight) - cropHeight;
}
// If our height is too large, let it downscale the width for us by setting the height to the lower value.
if (!this.MaintainAspectRatio && this.Height > this.MaxHeight)
{
this.Task.Height = this.MaxHeight;
}
}
// Set Screen Controls
this.SourceInfo = string.Format(
"{0}x{1}, PAR: {2}/{3}",
title.Resolution.Width,
title.Resolution.Height,
title.ParVal.Width,
//.........这里部分代码省略.........
开发者ID:galad87,项目名称:HandBrake-VideoToolbox,代码行数:101,代码来源:PictureSettingsViewModel.cs
示例11: 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;
}
this.SetRF(preset.Task.Quality);
this.TwoPass = preset.Task.TwoPass;
this.TurboFirstPass = preset.Task.TurboFirstPass;
this.Task.VideoBitrate = preset.Task.VideoBitrate;
this.NotifyOfPropertyChange(() => this.Task);
if (preset.Task != null)
{
this.HandleEncoderChange(preset.Task.VideoEncoder);
HBVideoEncoder encoder = HandBrakeEncoderHelpers.VideoEncoders.FirstOrDefault(s => s.ShortName == EnumHelper<VideoEncoder>.GetShortName(preset.Task.VideoEncoder));
if (encoder != null)
{
if (preset.Task.VideoEncoder == VideoEncoder.X264 || preset.Task.VideoEncoder == VideoEncoder.X265 || preset.Task.VideoEncoder == VideoEncoder.QuickSync)
{
this.VideoLevel = preset.Task.VideoLevel != null ? preset.Task.VideoLevel.Clone() : this.VideoLevels.FirstOrDefault();
this.VideoProfile = preset.Task.VideoProfile != null ? preset.Task.VideoProfile.Clone() : this.VideoProfiles.FirstOrDefault();
this.VideoPresetValue = preset.Task.VideoPreset != null ? this.VideoPresets.IndexOf(preset.Task.VideoPreset) : 0;
this.FastDecode = preset.Task.VideoTunes != null && preset.Task.VideoTunes.Contains(VideoTune.FastDecode);
this.VideoTune = (preset.Task.VideoTunes != null && preset.Task.VideoTunes.Any() ? preset.Task.VideoTunes.FirstOrDefault(t => !Equals(t, VideoTune.FastDecode)) : this.VideoTunes.FirstOrDefault())
?? VideoTune.None;
}
}
this.ExtraArguments = preset.Task.ExtraAdvancedArguments;
this.UseAdvancedTab = !string.IsNullOrEmpty(preset.Task.AdvancedEncoderOptions) && this.ShowAdvancedTab;
}
}
开发者ID:mhochmann,项目名称:HandBrake,代码行数:67,代码来源:VideoViewModel.cs
示例12: AutoName
/// <summary>
/// Function which generates the filename and path automatically based on
/// the Source Name, DVD title and DVD Chapters
/// </summary>
/// <param name="task">
/// The task.
/// </param>
/// <param name="sourceOrLabelName">
/// The Source or Label Name
/// </param>
/// <returns>
/// The Generated FileName
/// </returns>
public static string AutoName(EncodeTask task, string sourceOrLabelName, Preset presetName)
{
IUserSettingService userSettingService = IoC.Get<IUserSettingService>();
if (task.Destination == null)
{
task.Destination = string.Empty;
}
string autoNamePath = string.Empty;
if (task.Title != 0)
{
// Get the Source Name and remove any invalid characters
string sourceName = Path.GetInvalidFileNameChars().Aggregate(sourceOrLabelName, (current, character) => current.Replace(character.ToString(), string.Empty));
string sanitisedPresetName = presetName != null ? Path.GetInvalidFileNameChars().Aggregate(presetName.Name, (current, character) => current.Replace(character.ToString(), string.Empty)) : string.Empty;
// Remove Underscores
if (userSettingService.GetUserSetting<bool>(UserSettingConstants.AutoNameRemoveUnderscore))
sourceName = sourceName.Replace("_", " ");
if (userSettingService.GetUserSetting<bool>(UserSettingConstants.RemovePunctuation))
{
sourceName = sourceName.Replace("-", string.Empty);
sourceName = sourceName.Replace(",", string.Empty);
sourceName = sourceName.Replace(".", string.Empty);
}
// Switch to "Title Case"
if (userSettingService.GetUserSetting<bool>(UserSettingConstants.AutoNameTitleCase))
sourceName = sourceName.ToTitleCase();
// Get the Selected Title Number
string dvdTitle = task.Title.ToString();
// Get the Chapter Start and Chapter End Numbers
string chapterStart = task.StartPoint.ToString();
string chapterFinish = task.EndPoint.ToString();
string combinedChapterTag = chapterStart;
if (chapterFinish != chapterStart && chapterFinish != string.Empty)
combinedChapterTag = chapterStart + "-" + chapterFinish;
/*
* File Name
*/
string destinationFilename;
if (userSettingService.GetUserSetting<string>(UserSettingConstants.AutoNameFormat) != string.Empty)
{
destinationFilename = userSettingService.GetUserSetting<string>(UserSettingConstants.AutoNameFormat);
destinationFilename =
destinationFilename
.Replace("{source}", sourceName)
.Replace(Constants.Title, dvdTitle)
.Replace(Constants.Chapters, combinedChapterTag)
.Replace(Constants.Date, DateTime.Now.Date.ToShortDateString().Replace('/', '-'))
.Replace(Constants.Time,DateTime.Now.ToString("HH:mm"))
.Replace(Constants.Preset, sanitisedPresetName);
if (task.VideoEncodeRateType == VideoEncodeRateType.ConstantQuality)
{
destinationFilename = destinationFilename.Replace(Constants.Quality, task.Quality.ToString());
destinationFilename = destinationFilename.Replace(Constants.Bitrate, string.Empty);
}
else
{
destinationFilename = destinationFilename.Replace(Constants.Bitrate, task.VideoBitrate.ToString());
destinationFilename = destinationFilename.Replace(Constants.Quality, string.Empty);
}
}
else
destinationFilename = sourceName + "_T" + dvdTitle + "_C" + combinedChapterTag;
/*
* File Extension
*/
if (task.OutputFormat == OutputFormat.Mp4)
{
switch (userSettingService.GetUserSetting<int>(UserSettingConstants.UseM4v))
{
case 0: // Automatic
destinationFilename += task.IncludeChapterMarkers || MP4Helper.RequiresM4v(task) ? ".m4v" : ".mp4";
break;
case 1: // Always MP4
destinationFilename += ".mp4";
break;
case 2: // Always M4V
destinationFilename += ".m4v";
break;
//.........这里部分代码省略.........
开发者ID:sr55,项目名称:HandBrake,代码行数:101,代码来源:AutoNameHelper.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;
// Handle built-in presets.
if (preset.IsBuildIn)
{
preset.PictureSettingsMode = PresetPictureSettingsMode.Custom;
}
// Setup the Picture Sizes
switch (preset.PictureSettingsMode)
{
default:
case PresetPictureSettingsMode.Custom:
case PresetPictureSettingsMode.SourceMaximum:
// Anamorphic Mode
this.SelectedAnamorphicMode = preset.Task.Anamorphic;
// Modulus
if (preset.Task.Modulus.HasValue)
{
this.SelectedModulus = preset.Task.Modulus;
}
// Set the Maintain Aspect ratio.
this.MaintainAspectRatio = preset.Task.KeepDisplayAspect;
// Set the Maximum so libhb can correctly manage the size.
if (preset.PictureSettingsMode == PresetPictureSettingsMode.SourceMaximum)
{
this.MaxWidth = this.sourceResolution.Width;
this.MaxHeight = this.sourceResolution.Height;
}
else
{
this.MaxWidth = preset.Task.MaxWidth ?? this.sourceResolution.Width;
this.MaxHeight = preset.Task.MaxHeight ?? this.sourceResolution.Height;
}
// Set the width, then check the height doesn't breach the max height and correct if necessary.
int width = this.GetModulusValue(this.GetRes((this.sourceResolution.Width - this.CropLeft - this.CropRight), preset.Task.MaxWidth));
this.Width = width;
// If we have a max height, make sure we havn't breached it.
int height = this.GetModulusValue(this.GetRes((this.sourceResolution.Height - this.CropTop - this.CropBottom), preset.Task.MaxHeight));
if (preset.Task.MaxHeight.HasValue && this.Height > preset.Task.MaxHeight.Value)
{
this.Height = height;
}
break;
case PresetPictureSettingsMode.None:
// Do Nothing except reset the Max Width/Height
this.MaxWidth = this.sourceResolution.Width;
this.MaxHeight = this.sourceResolution.Height;
this.SelectedAnamorphicMode = preset.Task.Anamorphic;
break;
}
// Custom Anamorphic
if (preset.Task.Anamorphic == Anamorphic.Custom)
{
this.DisplayWidth = preset.Task.DisplayWidth != null ? int.Parse(preset.Task.DisplayWidth.ToString()) : 0;
this.ParWidth = preset.Task.PixelAspectX;
this.ParHeight = preset.Task.PixelAspectY;
}
// Cropping
if (preset.Task.HasCropping)
{
this.IsCustomCrop = true;
this.CropLeft = preset.Task.Cropping.Left;
this.CropRight = preset.Task.Cropping.Right;
this.CropTop = preset.Task.Cropping.Top;
this.CropBottom = preset.Task.Cropping.Bottom;
}
else
{
this.IsCustomCrop = false;
}
this.NotifyOfPropertyChange(() => this.Task);
this.UpdateVisibileControls();
}
开发者ID:galad87,项目名称:HandBrake-VideoToolbox,代码行数:95,代码来源:PictureSettingsViewModel.cs
示例14: SetupLanguages
/// <summary>
/// The setup languages.
/// </summary>
/// <param name="preset">
/// The preset.
/// </param>
public void SetupLanguages(Preset preset)
{
if (preset != null)
{
this.SetupLanguages(preset.SubtitleTrackBehaviours);
}
}
开发者ID:2wayne,项目名称:HandBrake,代码行数:13,代码来源:SubtitlesDefaultsViewModel.cs
示例15: Equals
/// <summary>
/// The equals.
/// </summary>
/// <param name="other">
/// The other.
/// </param>
/// <returns>
/// The <see cref="bool"/>.
/// </returns>
protected bool Equals(Preset other)
{
return string.Equals(this.Name, other.Name);
}
开发者ID:KonaBlend,项目名称:HandBrake,代码行数:13,代码来源:Preset.cs
示例16: SetPreset
/// <summary>
/// Set the selected preset
/// </summary>
/// <param name="preset">
/// The preset.
/// </param>
/// <param name="encodeTask">
/// The task.
/// </param>
public void SetPreset(Preset preset, EncodeTask encodeTask)
{
this.Task = encodeTask;
}
开发者ID:sr55,项目名称:HandBrake,代码行数:13,代码来源:MetaDataViewModel.cs
示例17: SetSource
/// <summary>
/// Setup this window for a new source
/// </summary>
/// <param name="source">
/// The source.
/// </param>
/// <param name="title">
/// The title.
/// </param>
/// <param name="preset">
/// The preset.
/// </param>
/// <param name="task">
/// The task.
/// </param>
public void SetSource(Source source, Title title, Preset preset, EncodeTask task)
{
this.Task = task;
this.NotifyOfPropertyChange(() => this.Task);
if (preset != null)
{
this.IncludeChapterMarkers = preset.Task.IncludeChapterMarkers;
}
this.sourceChaptersList = title.Chapters;
this.SetSourceChapters(title.Chapters);
}
开发者ID:KonaBlend,项目名称:HandBrake,代码行数:28,代码来源:ChaptersViewModel.cs
示例18: 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 == true;
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 "DenoisePreset":
preset.Task.DenoisePreset = (DenoisePreset)kvp.Value; // TODO to be confirmed.
break;
case "DenoiseTune":
preset.Task.DenoiseTune = (DenoiseTune)kvp.Value; // TODO to be confirmed.
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);
}
//.........这里部分代码省略.........
开发者ID:lvaleriu,项目名称:HandBrake,代码行数:101,代码来源:PlistPresetFactory.cs
示例19: 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.CurrentTask = task;
if (preset != null)
{
// Properties
this.SelectedDenoise = preset.Task.Denoise;
this.SelectedDecomb = preset.Task.Decomb;
this.SelectedDeInterlace = preset.Task.Deinterlace;
this.SelectedDetelecine = preset.Task.Detelecine;
this.Grayscale = preset.Task.Grayscale;
this.DeblockValue = preset.Task.Deblock == 0 ? 4 : preset.Task.Deblock;
this.SelectedDenoisePreset = preset.Task.DenoisePreset;
this.SelectedDenoiseTune = preset.Task.DenoiseTune;
// Custom Values
this.CustomDecomb = preset.Task.CustomDecomb;
this.CustomDeinterlace = preset.Task.CustomDeinterlace;
this.CustomDetelecine = preset.Task.CustomDetelecine;
this.CustomDenoise = preset.Task.CustomDenoise;
}
else
{
// Default everything to off
this.SelectedDenoise = Denoise.Off;
this.SelectedDecomb = Decomb.Off;
this.SelectedDeInterlace = Deinterlace.Off;
this.SelectedDetelecine = Detelecine.Off;
this.Grayscale = false;
this.DeblockValue = 0;
}
}
开发者ID:mhochmann,项目名称:HandBrake,代码行数:42,代码来源:FiltersViewModel.cs
示例20: SetDefault
/// <summary>
/// Set Default Preset
/// </summary>
/// <param name="name">
/// The name.
/// </param>
public void SetDefault(Preset name)
{
foreach (Preset preset in this.presets)
{
preset.IsDefault = false;
}
name.IsDefault = true;
this.UpdatePresetFiles();
}
开发者ID:beppec56,项目名称:HandBrake-git_svn-mirror,代码行数:16,代码来源:PresetService.cs
注:本文中的HandBrakeWPF.Services.Presets.Model.Preset类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论