summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrake.Interop
diff options
context:
space:
mode:
Diffstat (limited to 'win/CS/HandBrake.Interop')
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Converters/Converters.cs4
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs62
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/HbFunctions.cs13
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Helpers/InteropUtilities.cs60
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Helpers/Languages.cs4
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoders.cs14
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/EncodingProfile.cs64
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/HBVideoEncoder.cs53
8 files changed, 170 insertions, 104 deletions
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Converters/Converters.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Converters/Converters.cs
index a707e0eb5..d0468ec27 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/Converters/Converters.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Converters/Converters.cs
@@ -192,8 +192,8 @@ namespace HandBrake.Interop.Converters
/// <returns>The converted structure.</returns>
public static Language NativeToLanguage(iso639_lang_t language)
{
- string englishName = InteropUtilities.ReadUtf8Ptr(language.eng_name);
- string nativeName = InteropUtilities.ReadUtf8Ptr(language.native_name);
+ string englishName = InteropUtilities.ToStringFromUtf8Ptr(language.eng_name);
+ string nativeName = InteropUtilities.ToStringFromUtf8Ptr(language.native_name);
return new Language
{
Code = language.iso639_2,
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs
index 54a2135ee..e97343852 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs
@@ -245,7 +245,7 @@ namespace HandBrake.Interop
{
this.previewCount = previewCount;
- IntPtr pathPtr = InteropUtilities.CreateUtf8Ptr(path);
+ IntPtr pathPtr = InteropUtilities.ToUtf8PtrFromString(path);
HBFunctions.hb_scan(this.hbHandle, pathPtr, titleIndex, previewCount, 1, (ulong)(minDuration.TotalSeconds * 90000));
Marshal.FreeHGlobal(pathPtr);
@@ -280,7 +280,7 @@ namespace HandBrake.Interop
public BitmapImage GetPreview(EncodeJob job, int previewNumber)
{
IntPtr nativeJobPtr = HBFunctions.hb_job_init_by_index(this.hbHandle, this.GetTitleIndex(job.Title));
- var nativeJob = InteropUtilities.ReadStructure<hb_job_s>(nativeJobPtr);
+ var nativeJob = InteropUtilities.ToStructureFromPtr<hb_job_s>(nativeJobPtr);
List<IntPtr> allocatedMemory = this.ApplyJob(ref nativeJob, job);
@@ -473,7 +473,7 @@ namespace HandBrake.Interop
this.currentJob = job;
IntPtr nativeJobPtr = HBFunctions.hb_job_init_by_index(this.hbHandle, this.GetTitleIndex(job.Title));
- var nativeJob = InteropUtilities.ReadStructure<hb_job_s>(nativeJobPtr);
+ var nativeJob = InteropUtilities.ToStructureFromPtr<hb_job_s>(nativeJobPtr);
this.encodeAllocatedMemory = this.ApplyJob(ref nativeJob, job, preview, previewNumber, previewSeconds, overallSelectedLengthSeconds);
@@ -490,31 +490,31 @@ namespace HandBrake.Interop
}
}
- string x264Options = profile.X264Options ?? string.Empty;
- IntPtr originalX264Options = Marshal.StringToHGlobalAnsi(x264Options);
- this.encodeAllocatedMemory.Add(originalX264Options);
+ string videoOptions = profile.VideoOptions ?? string.Empty;
+ IntPtr originalVideoOptions = Marshal.StringToHGlobalAnsi(videoOptions);
+ this.encodeAllocatedMemory.Add(originalVideoOptions);
- if (!string.IsNullOrEmpty(profile.X264Profile))
+ if (!string.IsNullOrEmpty(profile.VideoProfile))
{
- nativeJob.encoder_profile = Marshal.StringToHGlobalAnsi(profile.X264Profile);
+ nativeJob.encoder_profile = Marshal.StringToHGlobalAnsi(profile.VideoProfile);
this.encodeAllocatedMemory.Add(nativeJob.encoder_profile);
}
- if (!string.IsNullOrEmpty(profile.X264Preset))
+ if (!string.IsNullOrEmpty(profile.VideoPreset))
{
- nativeJob.encoder_preset = Marshal.StringToHGlobalAnsi(profile.X264Preset);
+ nativeJob.encoder_preset = Marshal.StringToHGlobalAnsi(profile.VideoPreset);
this.encodeAllocatedMemory.Add(nativeJob.encoder_preset);
}
- if (profile.X264Tunes != null && profile.X264Tunes.Count > 0)
+ if (profile.VideoTunes != null && profile.VideoTunes.Count > 0)
{
- nativeJob.encoder_tune = Marshal.StringToHGlobalAnsi(string.Join(",", profile.X264Tunes));
+ nativeJob.encoder_tune = Marshal.StringToHGlobalAnsi(string.Join(",", profile.VideoTunes));
this.encodeAllocatedMemory.Add(nativeJob.encoder_tune);
}
- if (!string.IsNullOrEmpty(job.EncodingProfile.H264Level))
+ if (!string.IsNullOrEmpty(job.EncodingProfile.VideoLevel))
{
- nativeJob.encoder_level = Marshal.StringToHGlobalAnsi(job.EncodingProfile.H264Level);
+ nativeJob.encoder_level = Marshal.StringToHGlobalAnsi(job.EncodingProfile.VideoLevel);
this.encodeAllocatedMemory.Add(nativeJob.encoder_level);
}
@@ -535,7 +535,7 @@ namespace HandBrake.Interop
{
// First pass. Apply turbo options if needed.
nativeJob.pass = 1;
- string firstPassAdvancedOptions = x264Options;
+ string firstPassAdvancedOptions = videoOptions;
if (job.EncodingProfile.TurboFirstPass)
{
if (firstPassAdvancedOptions == string.Empty)
@@ -555,7 +555,7 @@ namespace HandBrake.Interop
// Second pass. Apply normal options.
nativeJob.pass = 2;
- nativeJob.encoder_options = originalX264Options;
+ nativeJob.encoder_options = originalVideoOptions;
HBFunctions.hb_add(this.hbHandle, ref nativeJob);
}
@@ -563,7 +563,7 @@ namespace HandBrake.Interop
{
// One pass job.
nativeJob.pass = 0;
- nativeJob.encoder_options = originalX264Options;
+ nativeJob.encoder_options = originalVideoOptions;
HBFunctions.hb_add(this.hbHandle, ref nativeJob);
}
@@ -647,7 +647,7 @@ namespace HandBrake.Interop
}
IntPtr nativeJobPtr = HBFunctions.hb_job_init_by_index(this.hbHandle, this.GetTitleIndex(title));
- var nativeJob = InteropUtilities.ReadStructure<hb_job_s>(nativeJobPtr);
+ var nativeJob = InteropUtilities.ToStructureFromPtr<hb_job_s>(nativeJobPtr);
List<IntPtr> allocatedMemory = this.ApplyJob(ref nativeJob, job);
InteropUtilities.FreeMemory(allocatedMemory);
@@ -825,8 +825,8 @@ namespace HandBrake.Interop
this.titles = new List<Title>();
IntPtr titleSetPtr = HBFunctions.hb_get_title_set(this.hbHandle);
- hb_title_set_s titleSet = InteropUtilities.ReadStructure<hb_title_set_s>(titleSetPtr);
- this.originalTitles = titleSet.list_title.ToList<hb_title_s>();
+ hb_title_set_s titleSet = InteropUtilities.ToStructureFromPtr<hb_title_set_s>(titleSetPtr);
+ this.originalTitles = titleSet.list_title.ToListFromHandBrakeList<hb_title_s>();
foreach (hb_title_s title in this.originalTitles)
{
@@ -1068,11 +1068,11 @@ namespace HandBrake.Interop
if (string.IsNullOrWhiteSpace(job.CustomChapterNames[i]))
{
- chapterNamePtr = InteropUtilities.CreateUtf8Ptr("Chapter " + (i + 1));
+ chapterNamePtr = InteropUtilities.ToUtf8PtrFromString("Chapter " + (i + 1));
}
else
{
- chapterNamePtr = InteropUtilities.CreateUtf8Ptr(job.CustomChapterNames[i]);
+ chapterNamePtr = InteropUtilities.ToUtf8PtrFromString(job.CustomChapterNames[i]);
}
HBFunctions.hb_chapter_set_title__ptr(nativeChapters[i], chapterNamePtr);
@@ -1398,7 +1398,7 @@ namespace HandBrake.Interop
// areBframes
// color_matrix
- List<hb_audio_s> titleAudio = originalTitle.list_audio.ToList<hb_audio_s>();
+ List<hb_audio_s> titleAudio = originalTitle.list_audio.ToListFromHandBrakeList<hb_audio_s>();
var audioList = new List<hb_audio_s>();
int numTracks = 0;
@@ -1423,7 +1423,7 @@ namespace HandBrake.Interop
audioList.Add(this.ConvertAudioBack(outputTrack.Item1, titleAudio[outputTrack.Item2 - 1], numTracks++, allocatedMemory));
}
- NativeList nativeAudioList = InteropUtilities.ConvertListBack<hb_audio_s>(audioList);
+ NativeList nativeAudioList = InteropUtilities.ToHandBrakeListFromList<hb_audio_s>(audioList);
nativeJob.list_audio = nativeAudioList.Ptr;
allocatedMemory.AddRange(nativeAudioList.AllocatedMemory);
@@ -1431,7 +1431,7 @@ namespace HandBrake.Interop
{
if (job.Subtitles.SourceSubtitles != null && job.Subtitles.SourceSubtitles.Count > 0)
{
- List<hb_subtitle_s> titleSubtitles = originalTitle.list_subtitle.ToList<hb_subtitle_s>();
+ List<hb_subtitle_s> titleSubtitles = originalTitle.list_subtitle.ToListFromHandBrakeList<hb_subtitle_s>();
foreach (SourceSubtitle sourceSubtitle in job.Subtitles.SourceSubtitles)
{
@@ -1529,7 +1529,7 @@ namespace HandBrake.Interop
}
else
{
- IntPtr outputPathPtr = InteropUtilities.CreateUtf8Ptr(job.OutputPath);
+ IntPtr outputPathPtr = InteropUtilities.ToUtf8PtrFromString(job.OutputPath);
allocatedMemory.Add(outputPathPtr);
nativeJob.file = outputPathPtr;
}
@@ -1618,7 +1618,7 @@ namespace HandBrake.Interop
private void AddFilter(List<hb_filter_object_s> filterList, int filterType, string settings, List<IntPtr> allocatedMemory)
{
IntPtr settingsNativeString = Marshal.StringToHGlobalAnsi(settings);
- hb_filter_object_s filter = InteropUtilities.ReadStructure<hb_filter_object_s>(HBFunctions.hb_filter_init(filterType));
+ hb_filter_object_s filter = InteropUtilities.ToStructureFromPtr<hb_filter_object_s>(HBFunctions.hb_filter_init(filterType));
filter.settings = settingsNativeString;
allocatedMemory.Add(settingsNativeString);
@@ -1647,7 +1647,7 @@ namespace HandBrake.Interop
filterPtrList.Add(filterPtr);
}
- NativeList filterListNative = InteropUtilities.CreateIntPtrList(filterPtrList);
+ NativeList filterListNative = InteropUtilities.ToHandBrakeListFromPtrList(filterPtrList);
allocatedMemory.AddRange(filterListNative.AllocatedMemory);
return filterListNative;
@@ -1831,7 +1831,7 @@ namespace HandBrake.Interop
}
int currentSubtitleTrack = 1;
- List<hb_subtitle_s> subtitleList = title.list_subtitle.ToList<hb_subtitle_s>();
+ List<hb_subtitle_s> subtitleList = title.list_subtitle.ToListFromHandBrakeList<hb_subtitle_s>();
foreach (hb_subtitle_s subtitle in subtitleList)
{
var newSubtitle = new Subtitle
@@ -1888,7 +1888,7 @@ namespace HandBrake.Interop
}
int currentAudioTrack = 1;
- List<hb_audio_s> audioList = title.list_audio.ToList<hb_audio_s>();
+ List<hb_audio_s> audioList = title.list_audio.ToListFromHandBrakeList<hb_audio_s>();
foreach (hb_audio_s audio in audioList)
{
var newAudio = new AudioTrack
@@ -1910,7 +1910,7 @@ namespace HandBrake.Interop
currentAudioTrack++;
}
- List<hb_chapter_s> chapterList = title.list_chapter.ToList<hb_chapter_s>();
+ List<hb_chapter_s> chapterList = title.list_chapter.ToListFromHandBrakeList<hb_chapter_s>();
foreach (hb_chapter_s chapter in chapterList)
{
var newChapter = new Chapter
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/HbFunctions.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/HbFunctions.cs
index 0f8d59c86..9402d0940 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/HbFunctions.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/HbFunctions.cs
@@ -373,6 +373,19 @@ namespace HandBrake.Interop.HbLib
[DllImport("hb.dll", EntryPoint = "hb_container_get_next", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr hb_container_get_next(IntPtr last);
+ [DllImport("hb.dll", EntryPoint = "hb_video_encoder_get_presets", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_video_encoder_get_presets(int encoder);
+
+ [DllImport("hb.dll", EntryPoint = "hb_video_encoder_get_tunes", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_video_encoder_get_tunes(int encoder);
+
+ [DllImport("hb.dll", EntryPoint = "hb_video_encoder_get_profiles", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_video_encoder_get_profiles(int encoder);
+
+ [DllImport("hb.dll", EntryPoint = "hb_video_encoder_get_levels", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_video_encoder_get_levels(int encoder);
+
+
[DllImport("hb.dll", EntryPoint = "lang_get_next", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr lang_get_next(IntPtr last);
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Helpers/InteropUtilities.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Helpers/InteropUtilities.cs
index 0019aa2d2..6399beee2 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/Helpers/InteropUtilities.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Helpers/InteropUtilities.cs
@@ -28,7 +28,7 @@ namespace HandBrake.Interop.Helpers
/// <typeparam name="T">The type to convert the structure to.</typeparam>
/// <param name="structPtr">The pointer to the native structure.</param>
/// <returns>The converted structure.</returns>
- public static T ReadStructure<T>(IntPtr structPtr)
+ public static T ToStructureFromPtr<T>(IntPtr structPtr)
{
return (T)Marshal.PtrToStructure(structPtr, typeof(T));
}
@@ -38,7 +38,7 @@ namespace HandBrake.Interop.Helpers
/// </summary>
/// <param name="stringPtr">The pointer to the string.</param>
/// <returns>The resulting string.</returns>
- public static string ReadUtf8Ptr(IntPtr stringPtr)
+ public static string ToStringFromUtf8Ptr(IntPtr stringPtr)
{
var data = new List<byte>();
var ptr = stringPtr;
@@ -66,7 +66,7 @@ namespace HandBrake.Interop.Helpers
/// <returns>
/// The <see cref="IntPtr"/>.
/// </returns>
- public static IntPtr CreateUtf8Ptr(string str)
+ public static IntPtr ToUtf8PtrFromString(string str)
{
byte[] bytes = Encoding.UTF8.GetBytes(str);
IntPtr stringPtr = Marshal.AllocHGlobal(bytes.Length + 1);
@@ -87,7 +87,7 @@ namespace HandBrake.Interop.Helpers
/// <typeparam name="T">The type of structure in the list.</typeparam>
/// <param name="listPtr">The pointer to the native list.</param>
/// <returns>The converted managed list.</returns>
- public static List<T> ToList<T>(this IntPtr listPtr)
+ public static List<T> ToListFromHandBrakeList<T>(this IntPtr listPtr)
{
List<T> returnList = new List<T>();
NativeList nativeList = new NativeList(listPtr);
@@ -95,7 +95,7 @@ namespace HandBrake.Interop.Helpers
for (int i = 0; i < nativeList.Count; i++)
{
IntPtr itemPtr = nativeList[i];
- returnList.Add(ReadStructure<T>(itemPtr));
+ returnList.Add(ToStructureFromPtr<T>(itemPtr));
}
return returnList;
@@ -127,14 +127,14 @@ namespace HandBrake.Interop.Helpers
/// <param name="arrayPtr">The pointer to the array.</param>
/// <param name="count">The number of items in the array.</param>
/// <returns>The converted collection.</returns>
- public static IEnumerable<T> ConvertArray<T>(IntPtr arrayPtr, int count)
+ public static List<T> ToListFromNativeArray<T>(IntPtr arrayPtr, int count)
{
IntPtr currentItem = arrayPtr;
var result = new List<T>();
for (int i = 0; i < count; i++)
{
- T nativeEncoder = ReadStructure<T>(currentItem);
+ T nativeEncoder = ToStructureFromPtr<T>(currentItem);
result.Add(nativeEncoder);
currentItem = IntPtr.Add(currentItem, Marshal.SizeOf(typeof(T)));
@@ -144,11 +144,45 @@ namespace HandBrake.Interop.Helpers
}
/// <summary>
+ /// Takes an array pointer and converts it into a list of strings.
+ /// </summary>
+ /// <param name="arrayPtr">A pointer to a raw list of strings.</param>
+ /// <returns>The list of strings.</returns>
+ public static List<string> ToStringListFromArrayPtr(IntPtr arrayPtr)
+ {
+ if (arrayPtr == IntPtr.Zero)
+ {
+ return null;
+ }
+
+ return ToPtrListFromPtr(arrayPtr).Select(ptr => Marshal.PtrToStringAnsi(ptr)).ToList();
+ }
+
+ /// <summary>
+ /// Finds all the pointers starting at the given location and puts them in a list. Stops when it finds zero for a pointer.
+ /// </summary>
+ /// <param name="arrayPtr">The address of the list of pointers.</param>
+ /// <returns>The list of pointers.</returns>
+ public static List<IntPtr> ToPtrListFromPtr(IntPtr arrayPtr)
+ {
+ var result = new List<IntPtr>();
+ int ptrSize = Marshal.SizeOf(typeof(IntPtr));
+ IntPtr currentPtr = Marshal.ReadIntPtr(arrayPtr);
+ for (int i = 0; currentPtr != IntPtr.Zero; i++)
+ {
+ result.Add(currentPtr);
+ currentPtr = Marshal.ReadIntPtr(arrayPtr, (i + 1) * ptrSize);
+ }
+
+ return result;
+ }
+
+ /// <summary>
/// Creates a native HandBrake list from the given managed list of pointers.
/// </summary>
/// <param name="list">The managed list to convert.</param>
/// <returns>The converted native list.</returns>
- public static NativeList CreateIntPtrList(List<IntPtr> list)
+ public static NativeList ToHandBrakeListFromPtrList(List<IntPtr> list)
{
NativeList returnList = NativeList.CreateList();
@@ -166,7 +200,7 @@ namespace HandBrake.Interop.Helpers
/// <typeparam name="T">The type of structures in the list.</typeparam>
/// <param name="list">The managed list to convert.</param>
/// <returns>The converted native list.</returns>
- public static NativeList ConvertListBack<T>(List<T> list)
+ public static NativeList ToHandBrakeListFromList<T>(List<T> list)
{
NativeList returnList = NativeList.CreateList();
foreach (T item in list)
@@ -189,9 +223,9 @@ namespace HandBrake.Interop.Helpers
/// <param name="iterator">The iterator to use to build the list.</param>
/// <param name="converter">The converter to convert from the struct to the object.</param>
/// <returns>The list of objects.</returns>
- public static List<T2> GetListFromIterator<T1, T2>(Func<IntPtr, IntPtr> iterator, Func<T1, T2> converter)
+ public static List<T2> ToListFromIterator<T1, T2>(Func<IntPtr, IntPtr> iterator, Func<T1, T2> converter)
{
- return ReadStructureListFromIterator<T1>(iterator).Select(converter).ToList();
+ return ToListFromIterator<T1>(iterator).Select(converter).ToList();
}
/// <summary>
@@ -200,7 +234,7 @@ namespace HandBrake.Interop.Helpers
/// <typeparam name="T">The type of the struct.</typeparam>
/// <param name="iterator">The iterator to use to build the list.</param>
/// <returns>The list of structs.</returns>
- public static List<T> ReadStructureListFromIterator<T>(Func<IntPtr, IntPtr> iterator)
+ public static List<T> ToListFromIterator<T>(Func<IntPtr, IntPtr> iterator)
{
var structureList = new List<T>();
IntPtr current = IntPtr.Zero;
@@ -208,7 +242,7 @@ namespace HandBrake.Interop.Helpers
current = iterator(current);
while (current != IntPtr.Zero)
{
- T encoder = ReadStructure<T>(current);
+ T encoder = ToStructureFromPtr<T>(current);
structureList.Add(encoder);
current = iterator(current);
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Helpers/Languages.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Helpers/Languages.cs
index b89e190eb..7dfe40301 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/Helpers/Languages.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Helpers/Languages.cs
@@ -33,7 +33,7 @@ namespace HandBrake.Interop.Helpers
{
return allLanguages
?? (allLanguages =
- InteropUtilities.GetListFromIterator<iso639_lang_t, Language>(HBFunctions.lang_get_next, Converters.Converters.NativeToLanguage));
+ InteropUtilities.ToListFromIterator<iso639_lang_t, Language>(HBFunctions.lang_get_next, Converters.Converters.NativeToLanguage));
}
}
@@ -44,7 +44,7 @@ namespace HandBrake.Interop.Helpers
/// <returns>Object that describes the language.</returns>
public static Language Get(string code)
{
- iso639_lang_t language = InteropUtilities.ReadStructure<iso639_lang_t>(HBFunctions.lang_for_code2(code));
+ iso639_lang_t language = InteropUtilities.ToStructureFromPtr<iso639_lang_t>(HBFunctions.lang_for_code2(code));
return Converters.Converters.NativeToLanguage(language);
}
}
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoders.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoders.cs
index 593c1015f..ecf1b775a 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoders.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoders.cs
@@ -76,7 +76,7 @@ namespace HandBrake.Interop.Model
{
if (audioEncoders == null)
{
- audioEncoders = InteropUtilities.GetListFromIterator<hb_encoder_s, HBAudioEncoder>(HBFunctions.hb_audio_encoder_get_next, Converters.NativeToAudioEncoder);
+ audioEncoders = InteropUtilities.ToListFromIterator<hb_encoder_s, HBAudioEncoder>(HBFunctions.hb_audio_encoder_get_next, Converters.NativeToAudioEncoder);
}
return audioEncoders;
@@ -92,7 +92,7 @@ namespace HandBrake.Interop.Model
{
if (videoEncoders == null)
{
- videoEncoders = InteropUtilities.GetListFromIterator<hb_encoder_s, HBVideoEncoder>(HBFunctions.hb_video_encoder_get_next, Converters.NativeToVideoEncoder);
+ videoEncoders = InteropUtilities.ToListFromIterator<hb_encoder_s, HBVideoEncoder>(HBFunctions.hb_video_encoder_get_next, Converters.NativeToVideoEncoder);
}
return videoEncoders;
@@ -108,7 +108,7 @@ namespace HandBrake.Interop.Model
{
if (videoFramerates == null)
{
- videoFramerates = InteropUtilities.GetListFromIterator<hb_rate_s, HBRate>(HBFunctions.hb_video_framerate_get_next, Converters.NativeToRate);
+ videoFramerates = InteropUtilities.ToListFromIterator<hb_rate_s, HBRate>(HBFunctions.hb_video_framerate_get_next, Converters.NativeToRate);
}
return videoFramerates;
@@ -124,7 +124,7 @@ namespace HandBrake.Interop.Model
{
if (mixdowns == null)
{
- mixdowns = InteropUtilities.GetListFromIterator<hb_mixdown_s, HBMixdown>(HBFunctions.hb_mixdown_get_next, Converters.NativeToMixdown);
+ mixdowns = InteropUtilities.ToListFromIterator<hb_mixdown_s, HBMixdown>(HBFunctions.hb_mixdown_get_next, Converters.NativeToMixdown);
}
return mixdowns;
@@ -140,7 +140,7 @@ namespace HandBrake.Interop.Model
{
if (audioBitrates == null)
{
- audioBitrates = InteropUtilities.GetListFromIterator<hb_rate_s, int>(HBFunctions.hb_audio_bitrate_get_next, b => b.rate);
+ audioBitrates = InteropUtilities.ToListFromIterator<hb_rate_s, int>(HBFunctions.hb_audio_bitrate_get_next, b => b.rate);
}
return audioBitrates;
@@ -156,7 +156,7 @@ namespace HandBrake.Interop.Model
{
if (audioSampleRates == null)
{
- audioSampleRates = InteropUtilities.GetListFromIterator<hb_rate_s, HBRate>(HBFunctions.hb_audio_samplerate_get_next, Converters.NativeToRate);
+ audioSampleRates = InteropUtilities.ToListFromIterator<hb_rate_s, HBRate>(HBFunctions.hb_audio_samplerate_get_next, Converters.NativeToRate);
}
return audioSampleRates;
@@ -172,7 +172,7 @@ namespace HandBrake.Interop.Model
{
if (containers == null)
{
- containers = InteropUtilities.GetListFromIterator<hb_container_s, HBContainer>(HBFunctions.hb_container_get_next, Converters.NativeToContainer);
+ containers = InteropUtilities.ToListFromIterator<hb_container_s, HBContainer>(HBFunctions.hb_container_get_next, Converters.NativeToContainer);
}
return containers;
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/EncodingProfile.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/EncodingProfile.cs
index c1947745b..257c324d7 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/EncodingProfile.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/EncodingProfile.cs
@@ -193,61 +193,36 @@ namespace HandBrake.Interop.Model.Encoding
public string VideoEncoder { get; set; }
/// <summary>
- /// Gets or sets the x 264 options.
+ /// Gets or sets the video encoder options.
/// </summary>
- public string X264Options { get; set; }
+ public string VideoOptions { get; set; }
/// <summary>
- /// Gets or sets the x 264 profile.
+ /// Gets or sets the video encoder profile name.
/// </summary>
- public string X264Profile { get; set; }
+ public string VideoProfile { get; set; }
/// <summary>
- /// Gets or sets the x 264 preset.
+ /// Gets or sets the video encoder preset name.
/// </summary>
- public string X264Preset { get; set; }
+ public string VideoPreset { get; set; }
/// <summary>
- /// Gets or sets the x 264 tunes.
+ /// Gets or sets the video encoder tunes.
/// </summary>
- public List<string> X264Tunes { get; set; }
+ public List<string> VideoTunes { get; set; }
- /// <summary>
- /// Gets or sets the x 265 profile.
- /// </summary>
- public string X265Profile { get; set; }
-
- /// <summary>
- /// Gets or sets the x 265 preset.
- /// </summary>
- public string X265Preset { get; set; }
+ /// <summary>
+ /// Gets or sets the video encoder level.
+ /// </summary>
+ public string VideoLevel { get; set; }
/// <summary>
- /// Gets or sets the x 265 tunes.
- /// </summary>
- public List<string> X265Tunes { get; set; }
-
- /// <summary>
- /// Gets or sets the x 265 level.
- /// </summary>
- public List<string> X265Level { get; set; }
-
- /// <summary>
- /// Gets or sets the qsv preset.
- /// </summary>
- public string QsvPreset { get; set; }
-
- /// <summary>
- /// Gets or sets a value indicating whether qsv decode.
+ /// Gets or sets a value indicating whether to use QSV decoding.
/// </summary>
public bool QsvDecode { get; set; }
/// <summary>
- /// Gets or sets the h 264 level.
- /// </summary>
- public string H264Level { get; set; }
-
- /// <summary>
/// Gets or sets the video encode rate type.
/// </summary>
public VideoEncodeRateType VideoEncodeRateType { get; set; }
@@ -345,13 +320,12 @@ namespace HandBrake.Interop.Model.Encoding
Grayscale = this.Grayscale,
VideoEncoder = this.VideoEncoder,
- X264Options = this.X264Options,
- X264Profile = this.X264Profile,
- X264Preset = this.X264Preset,
- X264Tunes = this.X264Tunes,
- QsvPreset = this.QsvPreset,
- QsvDecode = this.QsvDecode,
- H264Level = this.H264Level,
+ VideoOptions = this.VideoOptions,
+ VideoProfile = this.VideoProfile,
+ VideoPreset = this.VideoPreset,
+ VideoTunes = this.VideoTunes,
+ VideoLevel = this.VideoLevel,
+ QsvDecode = this.QsvDecode,
VideoEncodeRateType = this.VideoEncodeRateType,
Quality = this.Quality,
TargetSize = this.TargetSize,
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/HBVideoEncoder.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/HBVideoEncoder.cs
index 98bbcc319..810994ba8 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/HBVideoEncoder.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/HBVideoEncoder.cs
@@ -9,13 +9,16 @@
namespace HandBrake.Interop.Model.Encoding
{
- /// <summary>
+ using System.Collections.Generic;
+
+ using HandBrake.Interop.HbLib;
+ using HandBrake.Interop.Helpers;
+
+ /// <summary>
/// The hb video encoder.
/// </summary>
public class HBVideoEncoder
{
- #region Public Properties
-
/// <summary>
/// Gets or sets the compatible containers.
/// </summary>
@@ -36,6 +39,48 @@ namespace HandBrake.Interop.Model.Encoding
/// </summary>
public string ShortName { get; set; }
- #endregion
+ /// <summary>
+ /// Gets the list of presets this encoder supports. (null if the encoder doesn't support presets)
+ /// </summary>
+ public List<string> Presets
+ {
+ get
+ {
+ return InteropUtilities.ToStringListFromArrayPtr(HBFunctions.hb_video_encoder_get_presets(this.Id));
+ }
+ }
+
+ /// <summary>
+ /// Gets the list of tunes this encoder supports. (null if the encoder doesn't support tunes)
+ /// </summary>
+ public List<string> Tunes
+ {
+ get
+ {
+ return InteropUtilities.ToStringListFromArrayPtr(HBFunctions.hb_video_encoder_get_tunes(this.Id));
+ }
+ }
+
+ /// <summary>
+ /// Gets the list of profiles this encoder supports. (null if the encoder doesn't support profiles)
+ /// </summary>
+ public List<string> Profiles
+ {
+ get
+ {
+ return InteropUtilities.ToStringListFromArrayPtr(HBFunctions.hb_video_encoder_get_profiles(this.Id));
+ }
+ }
+
+ /// <summary>
+ /// Gets the list of levels this encoder supports. (null if the encoder doesn't support levels)
+ /// </summary>
+ public List<string> Levels
+ {
+ get
+ {
+ return InteropUtilities.ToStringListFromArrayPtr(HBFunctions.hb_video_encoder_get_levels(this.Id));
+ }
+ }
}
} \ No newline at end of file