diff options
author | randomengy <[email protected]> | 2013-03-31 20:55:00 +0000 |
---|---|---|
committer | randomengy <[email protected]> | 2013-03-31 20:55:00 +0000 |
commit | b37e7f1b4078fa478424a80fbaf1f56639e50eaa (patch) | |
tree | e0f9e61f67ebc56bd0258f000243c40ec12eb8fe /win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs | |
parent | 09e3a53c02d90e793885983a384a9283b8243590 (diff) |
Exposing DurationPts on titles and chapters from scans, along with some conversion functions.
Adding values to ScanProgressEventArgs to expose more fine-tuned progress.
Updating structs to catch up to most recent HB SVN.
Added a new VideoRangeType: All. This allows you to specify an entire title to convert without counting chapters.
We now create the filter list sorted and pass in the RENDERSUB filter with correct cropping values. This fixes burned-in subtitles getting cut off by cropping.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5369 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs')
-rw-r--r-- | win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs | 42 |
1 files changed, 31 insertions, 11 deletions
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs index 1dc2a1e74..e7f172e32 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs @@ -17,10 +17,10 @@ namespace HandBrake.Interop using HandBrake.Interop.SourceData;
using HandBrake.Interop.Model;
- /// <summary>
- /// The converters.
- /// </summary>
- public static class Converters
+ /// <summary>
+ /// Converters for various encoding values.
+ /// </summary>
+ public static class Converters
{
/// <summary>
/// Video Frame Rates
@@ -35,7 +35,7 @@ namespace HandBrake.Interop {24, 1125000},
{25, 1080000},
{29.97, 900900},
- {30, 900000},
+ {30, 900000},
{50, 540000},
{59.94, 450450},
{60, 450000}
@@ -94,8 +94,8 @@ namespace HandBrake.Interop return NativeConstants.HB_ACODEC_DCA_HD_PASS;
case AudioEncoder.Vorbis:
return NativeConstants.HB_ACODEC_VORBIS;
- case AudioEncoder.ffflac:
- return NativeConstants.HB_ACODEC_FFFLAC;
+ case AudioEncoder.ffflac:
+ return NativeConstants.HB_ACODEC_FFFLAC;
}
return 0;
@@ -128,8 +128,8 @@ namespace HandBrake.Interop case NativeConstants.HB_ACODEC_CA_AAC:
case NativeConstants.HB_ACODEC_CA_HAAC:
return AudioCodec.Aac;
- case NativeConstants.HB_ACODEC_FFFLAC:
- return AudioCodec.Flac;
+ case NativeConstants.HB_ACODEC_FFFLAC:
+ return AudioCodec.Flac;
default:
return AudioCodec.Other;
}
@@ -204,11 +204,31 @@ namespace HandBrake.Interop public static HBMixdown NativeToMixdown(hb_mixdown_s mixdown)
{
return new HBMixdown
- {
+ {
Id = mixdown.amixdown,
ShortName = mixdown.short_name,
DisplayName = mixdown.human_readable_name
- };
+ };
+ }
+
+ /// <summary>
+ /// Converts the PTS amount to a TimeSpan. There may be some accuracy loss here.
+ /// </summary>
+ /// <param name="pts">The PTS to convert.</param>
+ /// <returns>The timespan for it.</returns>
+ public static TimeSpan PtsToTimeSpan(ulong pts)
+ {
+ return TimeSpan.FromTicks((long)((pts * 10000000) / 90000));
+ }
+
+ /// <summary>
+ /// Converts the PTS amount to seconds.
+ /// </summary>
+ /// <param name="pts">The PTS to convert.</param>
+ /// <returns>The corresponding number of seconds.</returns>
+ public static double PtsToSeconds(ulong pts)
+ {
+ return (double)pts / 90000;
}
}
}
|