diff options
author | sr55 <[email protected]> | 2014-12-20 14:36:56 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2014-12-20 14:36:56 +0000 |
commit | 064322050804f20792408bcd45609276d4ba4240 (patch) | |
tree | 2612d590804ad45dc3eed848ba349696cf80384d /win | |
parent | 541c3053f07d7cf9b90f168ee27fa121082d677b (diff) |
WinGui: Switch to using the new JSON based scan API.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6622 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win')
27 files changed, 982 insertions, 294 deletions
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Converters/Converters.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Converters/Converters.cs index a5c2be460..a0fc06409 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Converters/Converters.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Converters/Converters.cs @@ -66,42 +66,6 @@ namespace HandBrake.Interop.Converters }
/// <summary>
- /// Convert Native HB Internal Audio int to a AudioCodec model.
- /// </summary>
- /// <param name="codec">
- /// The codec.
- /// </param>
- /// <returns>
- /// An AudioCodec object.
- /// </returns>
- public static AudioCodec NativeToAudioCodec(uint codec)
- {
- switch (codec)
- {
- case NativeConstants.HB_ACODEC_AC3:
- return AudioCodec.Ac3;
- case NativeConstants.HB_ACODEC_DCA:
- return AudioCodec.Dts;
- case NativeConstants.HB_ACODEC_DCA_HD:
- return AudioCodec.DtsHD;
- case NativeConstants.HB_ACODEC_LAME:
- case NativeConstants.HB_ACODEC_MP3:
- return AudioCodec.Mp3;
- case NativeConstants.HB_ACODEC_FFAAC:
- case NativeConstants.HB_ACODEC_CA_AAC:
- case NativeConstants.HB_ACODEC_CA_HAAC:
- case NativeConstants.HB_ACODEC_FDK_HAAC: // TODO Check this is correct
- case NativeConstants.HB_ACODEC_FDK_AAC: // TODO Check this is correct
- return AudioCodec.Aac;
- case NativeConstants.HB_ACODEC_FFFLAC:
- return AudioCodec.Flac;
-
- default:
- return AudioCodec.Other;
- }
- }
-
- /// <summary>
/// Converts a native HB encoder structure to an Encoder model.
/// </summary>
/// <param name="encoder">The structure to convert.</param>
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/EventArgs/ScanProgressEventArgs.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/EventArgs/ScanProgressEventArgs.cs index 56c3c116a..15439e970 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/EventArgs/ScanProgressEventArgs.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/EventArgs/ScanProgressEventArgs.cs @@ -19,7 +19,7 @@ namespace HandBrake.Interop.EventArgs /// <summary>
/// Gets or sets the total progress fraction for the scan.
/// </summary>
- public float Progress { get; set; }
+ public double Progress { get; set; }
/// <summary>
/// Gets or sets the current preview being processed on the scan.
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs index b51b6d470..b67c26a4e 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs @@ -12,22 +12,31 @@ namespace HandBrake.Interop using System;
using System.Collections.Generic;
using System.Diagnostics;
+ using System.Drawing;
+ using System.Drawing.Imaging;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
- using System.Windows.Media;
+ using System.Timers;
using System.Windows.Media.Imaging;
using HandBrake.Interop.EventArgs;
using HandBrake.Interop.HbLib;
using HandBrake.Interop.Helpers;
using HandBrake.Interop.Interfaces;
+ using HandBrake.Interop.Json.Factories;
+ using HandBrake.Interop.Json.Scan;
+ using HandBrake.Interop.Json.State;
using HandBrake.Interop.Model;
using HandBrake.Interop.Model.Encoding;
using HandBrake.Interop.Model.Scan;
+ using Newtonsoft.Json;
+
+ using Size = HandBrake.Interop.Model.Size;
+
/// <summary>
/// A wrapper for a HandBrake instance.
/// </summary>
@@ -66,12 +75,12 @@ namespace HandBrake.Interop /// <summary>
/// The timer to poll for scan status.
/// </summary>
- private System.Timers.Timer scanPollTimer;
+ private Timer scanPollTimer;
/// <summary>
/// The timer to poll for encode status.
/// </summary>
- private System.Timers.Timer encodePollTimer;
+ private Timer encodePollTimer;
/// <summary>
/// The list of original titles in native structure form.
@@ -109,6 +118,11 @@ namespace HandBrake.Interop private bool disposed;
/// <summary>
+ /// The last scan.
+ /// </summary>
+ private JsonScanObject lastScan;
+
+ /// <summary>
/// Finalizes an instance of the HandBrakeInstance class.
/// </summary>
~HandBrakeInstance()
@@ -251,7 +265,7 @@ namespace HandBrake.Interop HBFunctions.hb_scan(this.hbHandle, pathPtr, titleIndex, previewCount, 1, (ulong)(minDuration.TotalSeconds * 90000));
Marshal.FreeHGlobal(pathPtr);
- this.scanPollTimer = new System.Timers.Timer();
+ this.scanPollTimer = new Timer();
this.scanPollTimer.Interval = ScanPollIntervalMs;
// Lambda notation used to make sure we can view any JIT exceptions the method throws
@@ -306,8 +320,8 @@ namespace HandBrake.Interop // We've copied the data out of unmanaged memory. Clean up that memory now.
InteropUtilities.FreeMemory(allocatedMemory);
- var bitmap = new System.Drawing.Bitmap(outputWidth, outputHeight);
- System.Drawing.Imaging.BitmapData bitmapData = bitmap.LockBits(new System.Drawing.Rectangle(0, 0, outputWidth, outputHeight), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppRgb);
+ var bitmap = new Bitmap(outputWidth, outputHeight);
+ BitmapData bitmapData = bitmap.LockBits(new Rectangle(0, 0, outputWidth, outputHeight), ImageLockMode.WriteOnly, PixelFormat.Format32bppRgb);
IntPtr ptr = bitmapData.Scan0;
@@ -323,7 +337,7 @@ namespace HandBrake.Interop {
try
{
- bitmap.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Bmp);
+ bitmap.Save(memoryStream, ImageFormat.Bmp);
}
finally
{
@@ -575,7 +589,7 @@ namespace HandBrake.Interop // Should be safe to clean up the job we started with; a copy is in the queue now.
InteropUtilities.CloseJob(nativeJobPtr);
- this.encodePollTimer = new System.Timers.Timer();
+ this.encodePollTimer = new Timer();
this.encodePollTimer.Interval = EncodePollIntervalMs;
this.encodePollTimer.Elapsed += (o, e) =>
@@ -803,47 +817,50 @@ namespace HandBrake.Interop /// </summary>
private void PollScanProgress()
{
- var state = new hb_state_s();
- HBFunctions.hb_get_state(this.hbHandle, ref state);
+ IntPtr json = HBFunctions.hb_get_state_json(this.hbHandle);
+ string statusJson = Marshal.PtrToStringAnsi(json);
+ JsonState state = JsonConvert.DeserializeObject<JsonState>(statusJson);
- if (state.state == NativeConstants.HB_STATE_SCANNING)
+ if (state.State == NativeConstants.HB_STATE_SCANNING)
{
if (this.ScanProgress != null)
{
- hb_state_scanning_anon scanningState = state.param.scanning;
-
this.ScanProgress(this, new ScanProgressEventArgs
- {
- Progress = scanningState.progress,
- CurrentPreview = scanningState.preview_cur,
- Previews = scanningState.preview_count,
- CurrentTitle = scanningState.title_cur,
- Titles = scanningState.title_count
- });
+ {
+ Progress = state.Scanning.Progress,
+ CurrentPreview = state.Scanning.Preview,
+ Previews = state.Scanning.PreviewCount,
+ CurrentTitle = state.Scanning.Title,
+ Titles = state.Scanning.TitleCount
+ });
}
}
- else if (state.state == NativeConstants.HB_STATE_SCANDONE)
+ else if (state.State == NativeConstants.HB_STATE_SCANDONE)
{
this.titles = new List<Title>();
IntPtr titleSetPtr = HBFunctions.hb_get_title_set(this.hbHandle);
- hb_title_set_s titleSet = InteropUtilities.ToStructureFromPtr<hb_title_set_s>(titleSetPtr);
- this.originalTitles = titleSet.list_title.ToListFromHandBrakeList<hb_title_s>();
+ var jsonMsg = HBFunctions.hb_get_title_set_json(this.hbHandle);
+ string scanJson = Marshal.PtrToStringAnsi(jsonMsg);
+ JsonScanObject scanObject = JsonConvert.DeserializeObject<JsonScanObject>(scanJson);
+ lastScan = scanObject;
- foreach (hb_title_s title in this.originalTitles)
+ foreach (Title title in ScanFactory.CreateTitleSet(scanObject))
{
- this.titles.Add(this.ConvertTitle(title));
- }
+ // Convert the Path to UTF-8.
+ byte[] bytes = Encoding.Default.GetBytes(title.Path);
+ string utf8Str = Encoding.UTF8.GetString(bytes);
+ title.Path = utf8Str;
- if (this.originalTitles.Count > 0)
- {
- this.featureTitle = titleSet.feature;
- }
- else
- {
- this.featureTitle = 0;
+ // Set the Main Title.
+ this.featureTitle = title.IsMainFeature ? title.TitleNumber : 0;
+
+ this.titles.Add(title);
}
+ hb_title_set_s titleSet = InteropUtilities.ToStructureFromPtr<hb_title_set_s>(titleSetPtr);
+ this.originalTitles = titleSet.list_title.ToListFromHandBrakeList<hb_title_s>();
+
this.scanPollTimer.Stop();
if (this.ScanCompleted != null)
@@ -1455,7 +1472,7 @@ namespace HandBrake.Interop int subtitleAddSucceded = HBFunctions.hb_subtitle_add(ref nativeJob, ref subtitleConfig, sourceSubtitle.TrackNumber - 1);
if (subtitleAddSucceded == 0)
{
- System.Diagnostics.Debug.WriteLine("Subtitle add failed");
+ Debug.WriteLine("Subtitle add failed");
}
}
}
@@ -1476,7 +1493,7 @@ namespace HandBrake.Interop int srtAddSucceded = HBFunctions.hb_srt_add(ref nativeJob, ref subtitleConfig, srtSubtitle.LanguageCode);
if (srtAddSucceded == 0)
{
- System.Diagnostics.Debug.WriteLine("SRT add failed");
+ Debug.WriteLine("SRT add failed");
}
}
}
@@ -1850,147 +1867,6 @@ namespace HandBrake.Interop }
/// <summary>
- /// Converts a native title to a Title object.
- /// </summary>
- /// <param name="title">The native title structure.</param>
- /// <returns>The managed Title object.</returns>
- private Title ConvertTitle(hb_title_s title)
- {
- var newTitle = new Title
- {
- TitleNumber = title.index,
- Playlist = title.playlist,
- Resolution = new Size(title.geometry.width, title.geometry.height),
- ParVal = new Size(title.geometry.par.num, title.geometry.par.den),
- Duration = Converters.Converters.PtsToTimeSpan(title.duration),
- DurationPts = title.duration,
- AutoCropDimensions = new Cropping
- {
- Top = title.crop[0],
- Bottom = title.crop[1],
- Left = title.crop[2],
- Right = title.crop[3]
- },
- AspectRatio = title.container_dar.den != 0 ? Math.Round((decimal)title.container_dar.num / title.container_dar.den, 2) : 1.0m, // TODO FIx
- AngleCount = title.angle_count,
- VideoCodecName = title.video_codec_name,
- Framerate = ((double)title.vrate.num) / title.vrate.den,
- FramerateNumerator = title.vrate.num,
- FramerateDenominator = title.vrate.den,
- Path = Encoding.UTF8.GetString(title.path).TrimEnd('\0')
- };
-
- switch (title.type)
- {
- case hb_title_type_anon.HB_STREAM_TYPE:
- newTitle.InputType = InputType.Stream;
- break;
- case hb_title_type_anon.HB_DVD_TYPE:
- newTitle.InputType = InputType.Dvd;
- break;
- case hb_title_type_anon.HB_BD_TYPE:
- newTitle.InputType = InputType.Bluray;
- break;
- }
-
- int currentSubtitleTrack = 1;
- List<hb_subtitle_s> subtitleList = title.list_subtitle.ToListFromHandBrakeList<hb_subtitle_s>();
- foreach (hb_subtitle_s subtitle in subtitleList)
- {
- var newSubtitle = new Subtitle
- {
- TrackNumber = currentSubtitleTrack,
- Language = subtitle.lang,
- LanguageCode = subtitle.iso639_2
- };
-
- if (subtitle.format == hb_subtitle_s_subtype.PICTURESUB)
- {
- newSubtitle.SubtitleType = SubtitleType.Picture;
- }
- else if (subtitle.format == hb_subtitle_s_subtype.TEXTSUB)
- {
- newSubtitle.SubtitleType = SubtitleType.Text;
- }
-
- newSubtitle.SubtitleSourceInt = (int)subtitle.source;
-
- switch (subtitle.source)
- {
- case hb_subtitle_s_subsource.CC608SUB:
- newSubtitle.SubtitleSource = SubtitleSource.CC608;
- break;
- case hb_subtitle_s_subsource.CC708SUB:
- newSubtitle.SubtitleSource = SubtitleSource.CC708;
- break;
- case hb_subtitle_s_subsource.SRTSUB:
- newSubtitle.SubtitleSource = SubtitleSource.SRT;
- break;
- case hb_subtitle_s_subsource.SSASUB:
- newSubtitle.SubtitleSource = SubtitleSource.SSA;
- break;
- case hb_subtitle_s_subsource.TX3GSUB:
- newSubtitle.SubtitleSource = SubtitleSource.TX3G;
- break;
- case hb_subtitle_s_subsource.UTF8SUB:
- newSubtitle.SubtitleSource = SubtitleSource.UTF8;
- break;
- case hb_subtitle_s_subsource.VOBSUB:
- newSubtitle.SubtitleSource = SubtitleSource.VobSub;
- break;
- case hb_subtitle_s_subsource.PGSSUB:
- newSubtitle.SubtitleSource = SubtitleSource.PGS;
- break;
- default:
- break;
- }
-
- newTitle.Subtitles.Add(newSubtitle);
-
- currentSubtitleTrack++;
- }
-
- int currentAudioTrack = 1;
- List<hb_audio_s> audioList = title.list_audio.ToListFromHandBrakeList<hb_audio_s>();
- foreach (hb_audio_s audio in audioList)
- {
- var newAudio = new AudioTrack
- {
- TrackNumber = currentAudioTrack,
- Codec = Converters.Converters.NativeToAudioCodec(audio.config.input.codec),
- CodecParam = audio.config.input.codec_param,
- CodecId = audio.config.input.codec,
- Language = audio.config.lang.simple,
- LanguageCode = audio.config.lang.iso639_2,
- Description = audio.config.lang.description,
- ChannelLayout = audio.config.input.channel_layout,
- SampleRate = audio.config.input.samplerate,
- Bitrate = audio.config.input.bitrate
- };
-
- newTitle.AudioTracks.Add(newAudio);
-
- currentAudioTrack++;
- }
-
- List<hb_chapter_s> chapterList = title.list_chapter.ToListFromHandBrakeList<hb_chapter_s>();
- foreach (hb_chapter_s chapter in chapterList)
- {
- var newChapter = new Chapter
- {
- Name = chapter.title,
- ChapterNumber = chapter.index,
- Duration = Converters.Converters.PtsToTimeSpan(chapter.duration),
- DurationPts = chapter.duration
- };
-
- newTitle.Chapters.Add(newChapter);
- }
-
- return newTitle;
- }
-
- /// <summary>
/// Gets the cropping to use for the given encoding profile and title.
/// </summary>
/// <param name="profile">The encoding profile to use.</param>
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj index a9b72db13..2b70bb55a 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj @@ -124,6 +124,10 @@ <CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
</PropertyGroup>
<ItemGroup>
+ <Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\libraries\json\Net40\Newtonsoft.Json.dll</HintPath>
+ </Reference>
<Reference Include="PresentationCore">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
@@ -163,6 +167,7 @@ <Compile Include="HbLib\hb_filter_ids.cs" />
<Compile Include="HbLib\hb_filter_object_s.cs" />
<Compile Include="HbLib\hb_geometry.cs" />
+ <Compile Include="HbLib\hb_handle_s.cs" />
<Compile Include="HbLib\hb_mixdown_s.cs" />
<Compile Include="HbLib\hb_rate_s.cs" />
<Compile Include="HbLib\hb_state_s.cs" />
@@ -175,6 +180,23 @@ <Compile Include="HbLib\NativeConstants.cs" />
<Compile Include="Interfaces\IHandBrakeInstance.cs" />
<Compile Include="Helpers\InteropUtilities.cs" />
+ <Compile Include="Json\Factories\ScanFactory.cs" />
+ <Compile Include="Json\Scan\AudioList.cs" />
+ <Compile Include="Json\Scan\ChapterList.cs" />
+ <Compile Include="Json\Scan\Color.cs" />
+ <Compile Include="Json\Scan\Duration.cs" />
+ <Compile Include="Json\Scan\Duration2.cs" />
+ <Compile Include="Json\Scan\FrameRate.cs" />
+ <Compile Include="Json\Scan\Geometry.cs" />
+ <Compile Include="Json\Scan\JsonScanObject.cs" />
+ <Compile Include="Json\Scan\MetaData.cs" />
+ <Compile Include="Json\Scan\PAR.cs" />
+ <Compile Include="Json\Scan\SubtitleList.cs" />
+ <Compile Include="Json\Scan\TitleList.cs" />
+ <Compile Include="Json\State\JsonState.cs" />
+ <Compile Include="Json\State\Scanning.cs" />
+ <Compile Include="Json\State\WorkDone.cs" />
+ <Compile Include="Json\State\Working.cs" />
<Compile Include="Model\Encoding\PictureRotation.cs" />
<Compile Include="Model\Encoding\x265\x265Preset.cs" />
<Compile Include="Model\Encoding\x265\x265Profile.cs" />
@@ -223,13 +245,11 @@ <Compile Include="Helpers\NativeList.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="EventArgs\ScanProgressEventArgs.cs" />
- <Compile Include="Model\Scan\AudioCodec.cs" />
<Compile Include="Model\Scan\AudioTrack.cs" />
<Compile Include="Model\Scan\Chapter.cs" />
<Compile Include="Model\Scan\InputType.cs" />
<Compile Include="Model\Scan\Subtitle.cs" />
<Compile Include="Model\Scan\SubtitleSource.cs" />
- <Compile Include="Model\Scan\SubtitleType.cs" />
<Compile Include="Model\Scan\Title.cs" />
<Compile Include="Helpers\Utilities.cs" />
</ItemGroup>
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/HbFunctions.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/HbFunctions.cs index 243632ba9..1763d0a74 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/HbFunctions.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/HbFunctions.cs @@ -478,5 +478,40 @@ namespace HandBrake.Interop.HbLib [DllImport("hb.dll", EntryPoint = "hb_qsv_info_init", CallingConvention = CallingConvention.Cdecl)]
public static extern int hb_qsv_info_init();
+
+
+ /* JSON API */
+
+ // char * hb_get_title_set_json(hb_handle_t * h);
+ [DllImport("hb.dll", EntryPoint = "hb_get_title_set_json", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_get_title_set_json(IntPtr hbHandle);
+
+ // char * hb_title_to_json(const hb_title_t * title);
+ [DllImport("hb.dll", EntryPoint = "hb_title_to_json", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_title_to_json(ref hb_title_s title);
+
+ // char * hb_job_init_json(hb_handle_t *h, int title_index);
+ [DllImport("hb.dll", EntryPoint = "hb_job_init_json", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_job_init_json(IntPtr hbHandle, int title_index);
+
+ // char * hb_job_to_json(const hb_job_t * job);
+ [DllImport("hb.dll", EntryPoint = "hb_job_to_json", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_job_to_json(IntPtr hb_job_t);
+
+ // hb_job_t * hb_json_to_job(hb_handle_t * h, const char * json_job);
+ [DllImport("hb.dll", EntryPoint = "hb_json_to_job", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_json_to_job(IntPtr hbHandle, IntPtr json_job);
+
+ // int hb_add_json( hb_handle_t *, const char * )
+ [DllImport("hb.dll", EntryPoint = "hb_add_json", CallingConvention = CallingConvention.Cdecl)]
+ public static extern int hb_add_json(IntPtr hbHandle, IntPtr json_job);
+
+ //char * hb_set_anamorphic_size_json(const char * json_param);
+ [DllImport("hb.dll", EntryPoint = "hb_set_anamorphic_size_json", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_set_anamorphic_size_json(IntPtr json_param);
+
+ // char * hb_get_state_json(hb_handle_t * h);
+ [DllImport("hb.dll", EntryPoint = "hb_get_state_json", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_get_state_json(IntPtr hbHandle);
}
}
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Factories/ScanFactory.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Factories/ScanFactory.cs new file mode 100644 index 000000000..446ae5c1b --- /dev/null +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Factories/ScanFactory.cs @@ -0,0 +1,255 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="ScanFactory.cs" company="HandBrake Project (http://handbrake.fr)">
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
+// </copyright>
+// <summary>
+// The scan factory.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Json.Factories
+{
+ using System;
+ using System.Collections.Generic;
+
+ using HandBrake.Interop.Json.Scan;
+ using HandBrake.Interop.Model;
+ using HandBrake.Interop.Model.Scan;
+
+ /// <summary>
+ /// This factory takes the JSON objects deserialized from libhb for the scan information
+ /// and converts them into the internal Title objects.
+ /// </summary>
+ internal class ScanFactory
+ {
+ /// <summary>
+ /// The create title set.
+ /// </summary>
+ /// <param name="scan">
+ /// The scan.
+ /// </param>
+ /// <returns>
+ /// The <see cref="IEnumerable"/>.
+ /// </returns>
+ internal static IEnumerable<Title> CreateTitleSet(JsonScanObject scan)
+ {
+ List<Title> titles = new List<Title>();
+
+ if (scan != null)
+ {
+ foreach (TitleList item in scan.TitleList)
+ {
+ Title title = CreateTitle(item);
+
+ if (title.TitleNumber == scan.MainFeature)
+ {
+ title.IsMainFeature = true;
+ }
+
+ titles.Add(title);
+ }
+ }
+
+ return titles;
+ }
+
+ /// <summary>
+ /// The create title.
+ /// </summary>
+ /// <param name="title">
+ /// The title.
+ /// </param>
+ /// <returns>
+ /// The <see cref="Title"/>.
+ /// </returns>
+ private static Title CreateTitle(TitleList title)
+ {
+ Title newTitle = new Title
+ {
+ TitleNumber = title.Index,
+ Playlist = title.Playlist,
+ Resolution = new Size(title.Geometry.Width, title.Geometry.Height),
+ ParVal = new Size(title.Geometry.PAR.Num, title.Geometry.PAR.Den),
+ Duration = new TimeSpan(title.Duration.Hours, title.Duration.Minutes, title.Duration.Seconds),
+ AutoCropDimensions = new Cropping
+ {
+ Top = title.Crop[0],
+ Bottom = title.Crop[1],
+ Left = title.Crop[2],
+ Right = title.Crop[3]
+ },
+ //AspectRatio = (double)title.Geometry.DAR.Width / title.Geometry.DAR.Height,
+ AngleCount = title.AngleCount,
+ VideoCodecName = title.VideoCodec,
+ Framerate = ((double)title.FrameRate.Num) / title.FrameRate.Den,
+ FramerateNumerator = title.FrameRate.Num,
+ FramerateDenominator = title.FrameRate.Den,
+ Path = title.Path
+ };
+
+ switch (title.Type)
+ {
+ case 2:
+ newTitle.InputType = InputType.Stream;
+ break;
+ case 0:
+ newTitle.InputType = InputType.Dvd;
+ break;
+ case 1:
+ newTitle.InputType = InputType.Bluray;
+ break;
+ case 3:
+ newTitle.InputType = InputType.FFStream;
+ break;
+ }
+
+ foreach (Subtitle subtitleTrack in CreateSubtitleTracks(title.SubtitleList))
+ {
+ newTitle.Subtitles.Add(subtitleTrack);
+ }
+
+ foreach (AudioTrack audioTrack in CreateAudioTracks(title.AudioList))
+ {
+ newTitle.AudioTracks.Add(audioTrack);
+ }
+
+ foreach (Chapter chapter in CreateChapters(title.ChapterList))
+ {
+ newTitle.Chapters.Add(chapter);
+ }
+
+ return newTitle;
+ }
+
+ /// <summary>
+ /// The create subtitle tracks.
+ /// </summary>
+ /// <param name="subtitles">
+ /// The subtitles.
+ /// </param>
+ /// <returns>
+ /// The <see cref="IEnumerable"/>.
+ /// </returns>
+ private static IEnumerable<Subtitle> CreateSubtitleTracks(IEnumerable<SubtitleList> subtitles)
+ {
+ List<Subtitle> subtiles = new List<Subtitle>();
+
+ int currentSubtitleTrack = 1;
+ foreach (SubtitleList subtitle in subtitles)
+ {
+ Subtitle newSubtitle = new Subtitle
+ {
+ TrackNumber = currentSubtitleTrack,
+ Language = subtitle.Language,
+ LanguageCode = subtitle.LanguageCode,
+ SubtitleSourceInt = subtitle.Source,
+ // SubtitleSource = null,
+ };
+
+
+ //switch (subtitle.subsource)
+ //{
+ // case hb_subtitle_s_subsource.CC608SUB:
+ // newSubtitle.SubtitleSource = SubtitleSource.CC608;
+ // break;
+ // case hb_subtitle_s_subsource.CC708SUB:
+ // newSubtitle.SubtitleSource = SubtitleSource.CC708;
+ // break;
+ // case hb_subtitle_s_subsource.SRTSUB:
+ // newSubtitle.SubtitleSource = SubtitleSource.SRT;
+ // break;
+ // case hb_subtitle_s_subsource.SSASUB:
+ // newSubtitle.SubtitleSource = SubtitleSource.SSA;
+ // break;
+ // case hb_subtitle_s_subsource.TX3GSUB:
+ // newSubtitle.SubtitleSource = SubtitleSource.TX3G;
+ // break;
+ // case hb_subtitle_s_subsource.UTF8SUB:
+ // newSubtitle.SubtitleSource = SubtitleSource.UTF8;
+ // break;
+ // case hb_subtitle_s_subsource.VOBSUB:
+ // newSubtitle.SubtitleSource = SubtitleSource.VobSub;
+ // break;
+ // case hb_subtitle_s_subsource.PGSSUB:
+ // newSubtitle.SubtitleSource = SubtitleSource.PGS;
+ // break;
+ // default:
+ // break;
+ //}
+
+ subtiles.Add(newSubtitle);
+
+ currentSubtitleTrack++;
+ }
+
+ return subtiles;
+ }
+
+ /// <summary>
+ /// The create audio tracks.
+ /// </summary>
+ /// <param name="audioTracks">
+ /// The audio tracks.
+ /// </param>
+ /// <returns>
+ /// The <see cref="IEnumerable"/>.
+ /// </returns>
+ private static IEnumerable<AudioTrack> CreateAudioTracks(IEnumerable<AudioList> audioTracks)
+ {
+ List<AudioTrack> tracks = new List<AudioTrack>();
+
+ int currentAudioTrack = 1;
+ foreach (AudioList track in audioTracks)
+ {
+ AudioTrack newAudio = new AudioTrack
+ {
+ TrackNumber = currentAudioTrack,
+ // CodecParam = audio.config.input.codec_param,
+ // CodecId = audio.config.input.codec,
+ Language = track.Language,
+ LanguageCode = track.LanguageCode,
+ Description = track.Description,
+ ChannelLayout = (ulong)track.ChannelLayout,
+ SampleRate = track.SampleRate,
+ Bitrate = track.BitRate
+ };
+
+ tracks.Add(newAudio);
+
+ currentAudioTrack++;
+ }
+ return tracks;
+ }
+
+ /// <summary>
+ /// The create chapters.
+ /// </summary>
+ /// <param name="chapters">
+ /// The chapters.
+ /// </param>
+ /// <returns>
+ /// The <see cref="IEnumerable"/>.
+ /// </returns>
+ private static IEnumerable<Chapter> CreateChapters(IEnumerable<ChapterList> chapters)
+ {
+ List<Chapter> tracks = new List<Chapter>();
+
+ int currentTrack = 1;
+ foreach (ChapterList chapter in chapters)
+ {
+ Chapter newChapter = new Chapter
+ {
+ Name = chapter.Name,
+ ChapterNumber = currentTrack,
+ Duration = new TimeSpan(chapter.Duration.Hours, chapter.Duration.Minutes, chapter.Duration.Seconds),
+ // DurationPts = chapter.duration
+ };
+
+ tracks.Add(newChapter);
+ currentTrack++;
+ }
+
+ return tracks;
+ }
+ }
+}
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Scan/AudioList.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Scan/AudioList.cs new file mode 100644 index 000000000..b91511cfc --- /dev/null +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Scan/AudioList.cs @@ -0,0 +1,47 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="AudioList.cs" company="HandBrake Project (http://handbrake.fr)">
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
+// </copyright>
+// <summary>
+// The audio list.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Json.Scan
+{
+ /// <summary>
+ /// The audio list.
+ /// </summary>
+ internal class AudioList
+ {
+ /// <summary>
+ /// Gets or sets the bit rate.
+ /// </summary>
+ public int BitRate { get; set; }
+
+ /// <summary>
+ /// Gets or sets the channel layout.
+ /// </summary>
+ public int ChannelLayout { get; set; }
+
+ /// <summary>
+ /// Gets or sets the description.
+ /// </summary>
+ public string Description { get; set; }
+
+ /// <summary>
+ /// Gets or sets the language.
+ /// </summary>
+ public string Language { get; set; }
+
+ /// <summary>
+ /// Gets or sets the language code.
+ /// </summary>
+ public string LanguageCode { get; set; }
+
+ /// <summary>
+ /// Gets or sets the sample rate.
+ /// </summary>
+ public int SampleRate { get; set; }
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Scan/ChapterList.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Scan/ChapterList.cs new file mode 100644 index 000000000..b5573268a --- /dev/null +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Scan/ChapterList.cs @@ -0,0 +1,27 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="ChapterList.cs" company="HandBrake Project (http://handbrake.fr)">
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
+// </copyright>
+// <summary>
+// The chapter list.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Json.Scan
+{
+ /// <summary>
+ /// The chapter list.
+ /// </summary>
+ internal class ChapterList
+ {
+ /// <summary>
+ /// Gets or sets the duration.
+ /// </summary>
+ public Duration2 Duration { get; set; }
+
+ /// <summary>
+ /// Gets or sets the name.
+ /// </summary>
+ public string Name { get; set; }
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Scan/Color.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Scan/Color.cs new file mode 100644 index 000000000..5b162bd3c --- /dev/null +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Scan/Color.cs @@ -0,0 +1,32 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="Color.cs" company="HandBrake Project (http://handbrake.fr)">
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
+// </copyright>
+// <summary>
+// The color.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Json.Scan
+{
+ /// <summary>
+ /// The color.
+ /// </summary>
+ internal class Color
+ {
+ /// <summary>
+ /// Gets or sets the matrix.
+ /// </summary>
+ public int Matrix { get; set; }
+
+ /// <summary>
+ /// Gets or sets the primary.
+ /// </summary>
+ public int Primary { get; set; }
+
+ /// <summary>
+ /// Gets or sets the transfer.
+ /// </summary>
+ public int Transfer { get; set; }
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Scan/Duration.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Scan/Duration.cs new file mode 100644 index 000000000..ac7f0b083 --- /dev/null +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Scan/Duration.cs @@ -0,0 +1,37 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="Duration.cs" company="HandBrake Project (http://handbrake.fr)">
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
+// </copyright>
+// <summary>
+// The duration.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Json.Scan
+{
+ /// <summary>
+ /// The duration.
+ /// </summary>
+ internal class Duration
+ {
+ /// <summary>
+ /// Gets or sets the hours.
+ /// </summary>
+ public int Hours { get; set; }
+
+ /// <summary>
+ /// Gets or sets the minutes.
+ /// </summary>
+ public int Minutes { get; set; }
+
+ /// <summary>
+ /// Gets or sets the seconds.
+ /// </summary>
+ public int Seconds { get; set; }
+
+ /// <summary>
+ /// Gets or sets the ticks.
+ /// </summary>
+ public int Ticks { get; set; }
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Scan/Duration2.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Scan/Duration2.cs new file mode 100644 index 000000000..54471780d --- /dev/null +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Scan/Duration2.cs @@ -0,0 +1,37 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="Duration2.cs" company="HandBrake Project (http://handbrake.fr)">
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
+// </copyright>
+// <summary>
+// The duration 2.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Json.Scan
+{
+ /// <summary>
+ /// The duration 2.
+ /// </summary>
+ internal class Duration2
+ {
+ /// <summary>
+ /// Gets or sets the hours.
+ /// </summary>
+ public int Hours { get; set; }
+
+ /// <summary>
+ /// Gets or sets the minutes.
+ /// </summary>
+ public int Minutes { get; set; }
+
+ /// <summary>
+ /// Gets or sets the seconds.
+ /// </summary>
+ public int Seconds { get; set; }
+
+ /// <summary>
+ /// Gets or sets the ticks.
+ /// </summary>
+ public int Ticks { get; set; }
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Scan/FrameRate.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Scan/FrameRate.cs new file mode 100644 index 000000000..0ecdbd69c --- /dev/null +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Scan/FrameRate.cs @@ -0,0 +1,28 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="FrameRate.cs" company="HandBrake Project (http://handbrake.fr)">
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
+// </copyright>
+// <summary>
+// The frame rate.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Json.Scan
+{
+ /// <summary>
+ /// The frame rate.
+ /// </summary>
+ internal class FrameRate
+ {
+
+ /// <summary>
+ /// Gets or sets the den.
+ /// </summary>
+ public int Den { get; set; }
+
+ /// <summary>
+ /// Gets or sets the num.
+ /// </summary>
+ public int Num { get; set; }
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Scan/Geometry.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Scan/Geometry.cs new file mode 100644 index 000000000..414a07a0c --- /dev/null +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Scan/Geometry.cs @@ -0,0 +1,32 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="Geometry.cs" company="HandBrake Project (http://handbrake.fr)">
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
+// </copyright>
+// <summary>
+// The geometry.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Json.Scan
+{
+ /// <summary>
+ /// The geometry.
+ /// </summary>
+ internal class Geometry
+ {
+ /// <summary>
+ /// Gets or sets the height.
+ /// </summary>
+ public int Height { get; set; }
+
+ /// <summary>
+ /// Gets or sets the par.
+ /// </summary>
+ public PAR PAR { get; set; }
+
+ /// <summary>
+ /// Gets or sets the width.
+ /// </summary>
+ public int Width { get; set; }
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Scan/JsonScanObject.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Scan/JsonScanObject.cs new file mode 100644 index 000000000..74fb03977 --- /dev/null +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Scan/JsonScanObject.cs @@ -0,0 +1,29 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="JsonScanObject.cs" company="HandBrake Project (http://handbrake.fr)">
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
+// </copyright>
+// <summary>
+// The root object.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Json.Scan
+{
+ using System.Collections.Generic;
+
+ /// <summary>
+ /// The root object.
+ /// </summary>
+ internal class JsonScanObject
+ {
+ /// <summary>
+ /// Gets or sets the main feature.
+ /// </summary>
+ public int MainFeature { get; set; }
+
+ /// <summary>
+ /// Gets or sets the title list.
+ /// </summary>
+ public List<TitleList> TitleList { get; set; }
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Scan/SubtitleType.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Scan/MetaData.cs index 4486e029d..5b5545bba 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Scan/SubtitleType.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Scan/MetaData.cs @@ -1,20 +1,18 @@ // --------------------------------------------------------------------------------------------------------------------
-// <copyright file="SubtitleType.cs" company="HandBrake Project (http://handbrake.fr)">
+// <copyright file="MetaData.cs" company="HandBrake Project (http://handbrake.fr)">
// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
// </copyright>
// <summary>
-// Defines the SubtitleType type.
+// The meta data.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
-namespace HandBrake.Interop.Model.Scan
+namespace HandBrake.Interop.Json.Scan
{
/// <summary>
- /// The subtitle type.
+ /// The meta data.
/// </summary>
- public enum SubtitleType
- {
- Picture,
- Text
- }
-}
+ internal class MetaData
+ {
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Scan/PAR.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Scan/PAR.cs new file mode 100644 index 000000000..ef7e55020 --- /dev/null +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Scan/PAR.cs @@ -0,0 +1,27 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="PAR.cs" company="HandBrake Project (http://handbrake.fr)">
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
+// </copyright>
+// <summary>
+// The par.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Json.Scan
+{
+ /// <summary>
+ /// The par.
+ /// </summary>
+ internal class PAR
+ {
+ /// <summary>
+ /// Gets or sets the height.
+ /// </summary>
+ public int Num { get; set; }
+
+ /// <summary>
+ /// Gets or sets the width.
+ /// </summary>
+ public int Den { get; set; }
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Scan/SubtitleList.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Scan/SubtitleList.cs new file mode 100644 index 000000000..dcc73869d --- /dev/null +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Scan/SubtitleList.cs @@ -0,0 +1,37 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="SubtitleList.cs" company="HandBrake Project (http://handbrake.fr)">
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
+// </copyright>
+// <summary>
+// The subtitle list.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Json.Scan
+{
+ /// <summary>
+ /// The subtitle list.
+ /// </summary>
+ internal class SubtitleList
+ {
+ /// <summary>
+ /// Gets or sets the format.
+ /// </summary>
+ public int Format { get; set; }
+
+ /// <summary>
+ /// Gets or sets the language.
+ /// </summary>
+ public string Language { get; set; }
+
+ /// <summary>
+ /// Gets or sets the language code.
+ /// </summary>
+ public string LanguageCode { get; set; }
+
+ /// <summary>
+ /// Gets or sets the source.
+ /// </summary>
+ public int Source { get; set; }
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Scan/TitleList.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Scan/TitleList.cs new file mode 100644 index 000000000..c65962c66 --- /dev/null +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Scan/TitleList.cs @@ -0,0 +1,104 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="TitleList.cs" company="HandBrake Project (http://handbrake.fr)">
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
+// </copyright>
+// <summary>
+// The title list.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Json.Scan
+{
+ using System.Collections.Generic;
+
+ /// <summary>
+ /// The title list.
+ /// </summary>
+ internal class TitleList
+ {
+ /// <summary>
+ /// Gets or sets the angle count.
+ /// </summary>
+ public int AngleCount { get; set; }
+
+ /// <summary>
+ /// Gets or sets the audio list.
+ /// </summary>
+ public List<AudioList> AudioList { get; set; }
+
+ /// <summary>
+ /// Gets or sets the chapter list.
+ /// </summary>
+ public List<ChapterList> ChapterList { get; set; }
+
+ /// <summary>
+ /// Gets or sets the color.
+ /// </summary>
+ public Color Color { get; set; }
+
+ /// <summary>
+ /// Gets or sets the cropping values
+ /// </summary>
+ public List<int> Crop { get; set; }
+
+ /// <summary>
+ /// Gets or sets the duration.
+ /// </summary>
+ public Duration Duration { get; set; }
+
+ /// <summary>
+ /// Gets or sets the frame rate.
+ /// </summary>
+ public FrameRate FrameRate { get; set; }
+
+ /// <summary>
+ /// Gets or sets the geometry.
+ /// </summary>
+ public Geometry Geometry { get; set; }
+
+ /// <summary>
+ /// Gets or sets the index.
+ /// </summary>
+ public int Index { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether interlace detected.
+ /// </summary>
+ public bool InterlaceDetected { get; set; }
+
+ /// <summary>
+ /// Gets or sets the meta data.
+ /// </summary>
+ public MetaData MetaData { get; set; }
+
+ /// <summary>
+ /// Gets or sets the name.
+ /// </summary>
+ public string Name { get; set; }
+
+ /// <summary>
+ /// Gets or sets the path.
+ /// </summary>
+ public string Path { get; set; }
+
+ /// <summary>
+ /// Gets or sets the playlist.
+ /// </summary>
+ public int Playlist { get; set; }
+
+ /// <summary>
+ /// Gets or sets the subtitle list.
+ /// </summary>
+ public List<SubtitleList> SubtitleList { get; set; }
+
+ /// <summary>
+ /// Gets or sets the type.
+ /// </summary>
+ public int Type { get; set; }
+
+ /// <summary>
+ /// Gets or sets the video codec.
+ /// </summary>
+ public string VideoCodec { get; set; }
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/State/JsonState.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/State/JsonState.cs new file mode 100644 index 000000000..3671fe866 --- /dev/null +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/State/JsonState.cs @@ -0,0 +1,37 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="JsonState.cs" company="HandBrake Project (http://handbrake.fr)">
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
+// </copyright>
+// <summary>
+// The hand brake state.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Json.State
+{
+ /// <summary>
+ /// The hand brake state.
+ /// </summary>
+ public class JsonState
+ {
+ /// <summary>
+ /// Gets or sets the scanning.
+ /// </summary>
+ public Scanning Scanning { get; set; }
+
+ /// <summary>
+ /// Gets or sets the working.
+ /// </summary>
+ public Working Working { get; set; }
+
+ /// <summary>
+ /// Gets or sets the work done.
+ /// </summary>
+ public WorkDone WorkDone { get; set; }
+
+ /// <summary>
+ /// Gets or sets the state.
+ /// </summary>
+ public int State { get; set; }
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/State/Scanning.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/State/Scanning.cs new file mode 100644 index 000000000..af1aae793 --- /dev/null +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/State/Scanning.cs @@ -0,0 +1,42 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="Scanning.cs" company="HandBrake Project (http://handbrake.fr)">
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
+// </copyright>
+// <summary>
+// The scanning.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Json.State
+{
+ /// <summary>
+ /// The scanning.
+ /// </summary>
+ public class Scanning
+ {
+ /// <summary>
+ /// Gets or sets the preview.
+ /// </summary>
+ public int Preview { get; set; }
+
+ /// <summary>
+ /// Gets or sets the preview count.
+ /// </summary>
+ public int PreviewCount { get; set; }
+
+ /// <summary>
+ /// Gets or sets the progress.
+ /// </summary>
+ public double Progress { get; set; }
+
+ /// <summary>
+ /// Gets or sets the title.
+ /// </summary>
+ public int Title { get; set; }
+
+ /// <summary>
+ /// Gets or sets the title count.
+ /// </summary>
+ public int TitleCount { get; set; }
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/State/WorkDone.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/State/WorkDone.cs new file mode 100644 index 000000000..95093c50a --- /dev/null +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/State/WorkDone.cs @@ -0,0 +1,22 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="WorkDone.cs" company="HandBrake Project (http://handbrake.fr)">
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
+// </copyright>
+// <summary>
+// The work done.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Json.State
+{
+ /// <summary>
+ /// The work done.
+ /// </summary>
+ public class WorkDone
+ {
+ /// <summary>
+ /// Gets or sets the error.
+ /// </summary>
+ public int Error { get; set; }
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/State/Working.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/State/Working.cs new file mode 100644 index 000000000..ff781c093 --- /dev/null +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/State/Working.cs @@ -0,0 +1,62 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="Working.cs" company="HandBrake Project (http://handbrake.fr)">
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
+// </copyright>
+// <summary>
+// The working.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Json.State
+{
+ /// <summary>
+ /// The working.
+ /// </summary>
+ public class Working
+ {
+ /// <summary>
+ /// Gets or sets the hours.
+ /// </summary>
+ public int Hours { get; set; }
+
+ /// <summary>
+ /// Gets or sets the job.
+ /// </summary>
+ public int Job { get; set; }
+
+ /// <summary>
+ /// Gets or sets the job count.
+ /// </summary>
+ public int JobCount { get; set; }
+
+ /// <summary>
+ /// Gets or sets the minutes.
+ /// </summary>
+ public int Minutes { get; set; }
+
+ /// <summary>
+ /// Gets or sets the progress.
+ /// </summary>
+ public double Progress { get; set; }
+
+ /// <summary>
+ /// Gets or sets the rate.
+ /// </summary>
+ public double Rate { get; set; }
+
+ /// <summary>
+ /// Gets or sets the rate avg.
+ /// </summary>
+ public double RateAvg { get; set; }
+
+ /// <summary>
+ /// Gets or sets the seconds.
+ /// </summary>
+ public int Seconds { get; set; }
+
+ /// <summary>
+ /// Gets or sets the sequence id.
+ /// </summary>
+ public int SequenceID { get; set; }
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Scan/AudioCodec.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Scan/AudioCodec.cs deleted file mode 100644 index 41b363dac..000000000 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Scan/AudioCodec.cs +++ /dev/null @@ -1,53 +0,0 @@ -// --------------------------------------------------------------------------------------------------------------------
-// <copyright file="AudioCodec.cs" company="HandBrake Project (http://handbrake.fr)">
-// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
-// </copyright>
-// <summary>
-// Defines the AudioCodec type.
-// </summary>
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace HandBrake.Interop.Model.Scan
-{
- /// <summary>
- /// The audio codec.
- /// Only contains 2 real codecs at the moment as those are what we care about. More will be added later.
- /// </summary>
- public enum AudioCodec
- {
- /// <summary>
- /// The ac 3.
- /// </summary>
- Ac3,
-
- /// <summary>
- /// The dts.
- /// </summary>
- Dts,
-
- /// <summary>
- /// The dts hd.
- /// </summary>
- DtsHD,
-
- /// <summary>
- /// The mp 3.
- /// </summary>
- Mp3,
-
- /// <summary>
- /// The aac.
- /// </summary>
- Aac,
-
- /// <summary>
- /// The other.
- /// </summary>
- Other,
-
- /// <summary>
- /// The flac.
- /// </summary>
- Flac,
- }
-}
\ No newline at end of file diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Scan/AudioTrack.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Scan/AudioTrack.cs index 2bf275fdd..db1ef5549 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Scan/AudioTrack.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Scan/AudioTrack.cs @@ -20,11 +20,6 @@ namespace HandBrake.Interop.Model.Scan public int TrackNumber { get; set; }
/// <summary>
- /// Gets or sets the audio codec of this Track.
- /// </summary>
- public AudioCodec Codec { get; set; }
-
- /// <summary>
/// Gets or sets the audio codec ID for this track.
/// </summary>
public uint CodecId { get; set; }
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Scan/InputType.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Scan/InputType.cs index e3156ea8e..b3bc96d42 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Scan/InputType.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Scan/InputType.cs @@ -23,6 +23,9 @@ namespace HandBrake.Interop.Model.Scan Dvd,
[Display(Name = "Blu-ray")]
- Bluray
+ Bluray,
+
+ [Display(Name = "File")]
+ FFStream
}
}
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Scan/Subtitle.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Scan/Subtitle.cs index fda0dbb6c..03caf765f 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Scan/Subtitle.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Scan/Subtitle.cs @@ -32,11 +32,6 @@ namespace HandBrake.Interop.Model.Scan public string LanguageCode { get; set; }
/// <summary>
- /// Gets or sets the subtitle type.
- /// </summary>
- public SubtitleType SubtitleType { get; set; }
-
- /// <summary>
/// Gets or sets the subtitle source.
/// </summary>
public SubtitleSource SubtitleSource { get; set; }
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Scan/Title.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Scan/Title.cs index fb2a67b64..8f5880123 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Scan/Title.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Scan/Title.cs @@ -89,11 +89,6 @@ namespace HandBrake.Interop.Model.Scan public TimeSpan Duration { get; set; }
/// <summary>
- /// Gets or sets the duration of the title in PTS.
- /// </summary>
- public ulong DurationPts { get; set; }
-
- /// <summary>
/// Gets or sets the resolution (width/height) of this Title
/// </summary>
public Size Resolution { get; set; }
@@ -185,5 +180,10 @@ namespace HandBrake.Interop.Model.Scan return this.ToString();
}
}
+
+ /// <summary>
+ /// Gets or sets a value indicating whether is main feature.
+ /// </summary>
+ public bool IsMainFeature { get; set; }
}
}
\ No newline at end of file |