diff options
author | sr55 <[email protected]> | 2015-01-10 18:14:11 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2015-01-10 18:14:11 +0000 |
commit | 2d7ab4d15eb9ea450787831445cbf79d5192d18c (patch) | |
tree | dbc3547f778aecfd0ee35cd065d54971260f92a5 | |
parent | 0c5b67ec4b331028bac27c6761ae371dc75391b2 (diff) |
WinGui:
- Fix the DRC call
- Adding a HandBrake instance manager for scanning to make calls into the libhb helper methods easier.
- Remove codecparam from the audio models
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6724 b64f7644-9d1e-0410-96f1-a4d463321fa5
13 files changed, 110 insertions, 18 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Scan/LibScan.cs b/win/CS/HandBrake.ApplicationServices/Services/Scan/LibScan.cs index 90998ecc7..6d1dcb104 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Scan/LibScan.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Scan/LibScan.cs @@ -226,8 +226,7 @@ namespace HandBrake.ApplicationServices.Services.Scan this.scanLog = new StreamWriter(this.dvdInfoPath);
// Create a new HandBrake Instance.
- this.instance = new HandBrakeInstance();
- this.instance.Initialize(1);
+ this.instance = HandBrakeInstanceManager.GetScanInstance(configuraiton.Verbosity);
this.instance.ScanProgress += this.InstanceScanProgress;
this.instance.ScanCompleted += this.InstanceScanCompleted;
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeEncoderHelpers.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeEncoderHelpers.cs index c42203566..b2fbf75d6 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeEncoderHelpers.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeEncoderHelpers.cs @@ -9,6 +9,7 @@ namespace HandBrake.Interop
{
+ using System;
using System.Collections.Generic;
using System.Linq;
@@ -59,7 +60,7 @@ namespace HandBrake.Interop private static List<HBRate> audioSampleRates;
/// <summary>
- /// Initializes static members of the EncoderHelpers class.
+ /// Initializes static members of the HandBrakeEncoderHelpers class.
/// </summary>
static HandBrakeEncoderHelpers()
{
@@ -322,12 +323,15 @@ namespace HandBrake.Interop /// <param name="encoder">
/// The encoder to use for DRC.
/// </param>
+ /// <param name="title">
+ /// The title.
+ /// </param>
/// <returns>
/// True if DRC can be applied to the track with the given encoder.
/// </returns>
- public static bool CanApplyDrc(AudioTrack track, HBAudioEncoder encoder)
+ public static bool CanApplyDrc(AudioTrack track, HBAudioEncoder encoder, int title)
{
- return HBFunctions.hb_audio_can_apply_drc(track.CodecId, track.CodecParam, encoder.Id) > 0;
+ return HBFunctions.hb_audio_can_apply_drc2(HandBrakeInstanceManager.LastScanHandle, title, track.TrackNumber, encoder.Id) > 0;
}
/// <summary>
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs index 9962eca4d..a77f36ddb 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs @@ -111,6 +111,17 @@ namespace HandBrake.Interop public event EventHandler<EncodeCompletedEventArgs> EncodeCompleted;
/// <summary>
+ /// Gets the handle.
+ /// </summary>
+ internal IntPtr Handle
+ {
+ get
+ {
+ return this.Handle;
+ }
+ }
+
+ /// <summary>
/// Gets the list of titles on this instance.
/// </summary>
public List<Title> Titles
@@ -360,8 +371,6 @@ namespace HandBrake.Interop }
}
-
-
/// <summary>
/// Starts an encode with the given job.
/// </summary>
@@ -591,6 +600,5 @@ namespace HandBrake.Interop }
}
}
-
}
}
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstanceManager.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstanceManager.cs new file mode 100644 index 000000000..1ef749bd8 --- /dev/null +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstanceManager.cs @@ -0,0 +1,70 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="HandBrakeInstanceManager.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 instance manager.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop
+{
+ using System;
+
+ using HandBrake.Interop.Interfaces;
+
+ /// <summary>
+ /// The HandBrake Instance manager.
+ /// Only supports scanning right now.
+ /// </summary>
+ public static class HandBrakeInstanceManager
+ {
+ private static HandBrakeInstance scanInstance;
+
+ /// <summary>
+ /// Gets the scanInstance.
+ /// </summary>
+ /// <param name="verbosity">
+ /// The verbosity.
+ /// </param>
+ /// <returns>
+ /// The <see cref="IHandBrakeInstance"/>.
+ /// </returns>
+ public static IHandBrakeInstance GetScanInstance(int verbosity)
+ {
+ if (scanInstance != null)
+ {
+ scanInstance.Dispose();
+ scanInstance = null;
+ }
+
+ HandBrakeInstance newInstance = new HandBrakeInstance();
+ newInstance.Initialize(verbosity);
+ scanInstance = newInstance;
+
+ return scanInstance;
+ }
+
+ /// <summary>
+ /// Gets the last scan scan instance.
+ /// </summary>
+ public static IHandBrakeInstance LastScanScanInstance
+ {
+ get
+ {
+ return scanInstance;
+ }
+ }
+
+ /// <summary>
+ /// Gets the handle.
+ /// </summary>
+ internal static IntPtr LastScanHandle
+ {
+ get
+ {
+ return scanInstance.Handle;
+ }
+ }
+ }
+}
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj index 6df1d6a36..f153d2dca 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj @@ -152,6 +152,7 @@ </ItemGroup>
<ItemGroup>
<Compile Include="Attributes\ShortName.cs" />
+ <Compile Include="HandBrakeInstanceManager.cs" />
<Compile Include="HandBrakeUnitConversionHelpers.cs" />
<Compile Include="EventArgs\EncodeCompletedEventArgs.cs" />
<Compile Include="EventArgs\EncodeProgressEventArgs.cs" />
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/HbFunctions.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/HbFunctions.cs index d3bbb19f8..2b1e4a770 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/HbFunctions.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/HbFunctions.cs @@ -277,8 +277,9 @@ namespace HandBrake.Interop.HbLib //const char* hb_audio_dither_get_description(int method);
//const hb_dither_t* hb_audio_dither_get_next(const hb_dither_t *last);
- [DllImport("hb.dll", EntryPoint = "hb_audio_can_apply_drc", CallingConvention = CallingConvention.Cdecl)]
- public static extern int hb_audio_can_apply_drc(uint codec, uint codec_param, int encoder);
+ // hb_audio_can_apply_drc2(hb_handle_t *h, int title_idx, int audio_idx, int encoder)
+ [DllImport("hb.dll", EntryPoint = "hb_audio_can_apply_drc2", CallingConvention = CallingConvention.Cdecl)]
+ public static extern int hb_audio_can_apply_drc2(IntPtr handle, int title_index, int audio_index, int encoder);
[DllImport("hb.dll", EntryPoint = "hb_mixdown_is_supported", CallingConvention = CallingConvention.Cdecl)]
public static extern int hb_mixdown_is_supported(int mixdown, uint codec, ulong layout);
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Factories/ScanFactory.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Factories/ScanFactory.cs index 61ffa892e..df2e4918c 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Factories/ScanFactory.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Factories/ScanFactory.cs @@ -172,8 +172,7 @@ namespace HandBrake.Interop.Json.Factories AudioTrack newAudio = new AudioTrack
{
TrackNumber = currentAudioTrack,
- // CodecParam = audio.config.input.codec_param,
- // CodecId = audio.config.input.codec,
+ CodecId = Convert.ToUInt32(track.Codec),
Language = track.Language,
LanguageCode = track.LanguageCode,
Description = track.Description,
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Scan/AudioList.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Scan/AudioList.cs index b91511cfc..aaacee197 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Scan/AudioList.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Scan/AudioList.cs @@ -43,5 +43,10 @@ namespace HandBrake.Interop.Json.Scan /// Gets or sets the sample rate.
/// </summary>
public int SampleRate { get; set; }
+
+ /// <summary>
+ /// Gets or sets the codec.
+ /// </summary>
+ public int Codec { get; set; }
}
}
\ 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 db1ef5549..61438ee67 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Scan/AudioTrack.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Scan/AudioTrack.cs @@ -25,11 +25,6 @@ namespace HandBrake.Interop.Model.Scan public uint CodecId { get; set; }
/// <summary>
- /// Gets or sets the codec parameters for this track.
- /// </summary>
- public uint CodecParam { get; set; }
-
- /// <summary>
/// Gets or sets the language (if detected) of this Audio Track
/// </summary>
public string Language { get; set; }
diff --git a/win/CS/HandBrake10.sln.DotSettings b/win/CS/HandBrake10.sln.DotSettings index 7df7d44b1..ddd8bf654 100644 --- a/win/CS/HandBrake10.sln.DotSettings +++ b/win/CS/HandBrake10.sln.DotSettings @@ -19,6 +19,7 @@ <s:String x:Key="/Default/CodeStyle/CodeCleanup/Profiles/=StyleCop/@EntryIndexedValue"><?xml version="1.0" encoding="utf-16"?><Profile name="StyleCop"><CSArrangeThisQualifier>True</CSArrangeThisQualifier><CSOptimizeUsings><OptimizeUsings>True</OptimizeUsings><EmbraceInRegion>False</EmbraceInRegion><RegionName></RegionName></CSOptimizeUsings><CSReformatCode>True</CSReformatCode><CSReorderTypeMembers>True</CSReorderTypeMembers><StyleCop.Documentation><SA1600ElementsMustBeDocumented>True</SA1600ElementsMustBeDocumented><SA1604ElementDocumentationMustHaveSummary>True</SA1604ElementDocumentationMustHaveSummary><SA1609PropertyDocumentationMustHaveValueDocumented>True</SA1609PropertyDocumentationMustHaveValueDocumented><SA1611ElementParametersMustBeDocumented>True</SA1611ElementParametersMustBeDocumented><SA1615ElementReturnValueMustBeDocumented>True</SA1615ElementReturnValueMustBeDocumented><SA1617VoidReturnValueMustNotBeDocumented>True</SA1617VoidReturnValueMustNotBeDocumented><SA1618GenericTypeParametersMustBeDocumented>True</SA1618GenericTypeParametersMustBeDocumented><SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes>True</SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes><SA1628DocumentationTextMustBeginWithACapitalLetter>True</SA1628DocumentationTextMustBeginWithACapitalLetter><SA1629DocumentationTextMustEndWithAPeriod>True</SA1629DocumentationTextMustEndWithAPeriod><SA1633SA1641UpdateFileHeader>ReplaceCopyrightElement</SA1633SA1641UpdateFileHeader><SA1639FileHeaderMustHaveSummary>True</SA1639FileHeaderMustHaveSummary><SA1642ConstructorSummaryDocumentationMustBeginWithStandardText>True</SA1642ConstructorSummaryDocumentationMustBeginWithStandardText><SA1643DestructorSummaryDocumentationMustBeginWithStandardText>True</SA1643DestructorSummaryDocumentationMustBeginWithStandardText><SA1644DocumentationHeadersMustNotContainBlankLines>True</SA1644DocumentationHeadersMustNotContainBlankLines></StyleCop.Documentation><StyleCop.Layout><SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine>True</SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine><SA1509OpeningCurlyBracketsMustNotBePrecededByBlankLine>True</SA1509OpeningCurlyBracketsMustNotBePrecededByBlankLine><SA1510ChainedStatementBlocksMustNotBePrecededByBlankLine>True</SA1510ChainedStatementBlocksMustNotBePrecededByBlankLine><SA1511WhileDoFooterMustNotBePrecededByBlankLine>True</SA1511WhileDoFooterMustNotBePrecededByBlankLine><SA1512SingleLineCommentsMustNotBeFollowedByBlankLine>True</SA1512SingleLineCommentsMustNotBeFollowedByBlankLine><SA1513ClosingCurlyBracketMustBeFollowedByBlankLine>True</SA1513ClosingCurlyBracketMustBeFollowedByBlankLine><SA1514ElementDocumentationHeaderMustBePrecededByBlankLine>True</SA1514ElementDocumentationHeaderMustBePrecededByBlankLine><SA1515SingleLineCommentMustBeProceededByBlankLine>True</SA1515SingleLineCommentMustBeProceededByBlankLine></StyleCop.Layout><StyleCop.Maintainability><SA1119StatementMustNotUseUnnecessaryParenthesis>True</SA1119StatementMustNotUseUnnecessaryParenthesis></StyleCop.Maintainability><StyleCop.Ordering><AlphabeticalUsingDirectives>Alphabetical</AlphabeticalUsingDirectives><ExpandUsingDirectives>FullyQualify</ExpandUsingDirectives><SA1212PropertyAccessorsMustFollowOrder>True</SA1212PropertyAccessorsMustFollowOrder><SA1213EventAccessorsMustFollowOrder>True</SA1213EventAccessorsMustFollowOrder></StyleCop.Ordering><StyleCop.Readability><SA1100DoNotPrefixCallsWithBaseUnlessLocalImplementationExists>True</SA1100DoNotPrefixCallsWithBaseUnlessLocalImplementationExists><SA1106CodeMustNotContainEmptyStatements>True</SA1106CodeMustNotContainEmptyStatements><SA1108BlockStatementsMustNotContainEmbeddedComments>True</SA1108BlockStatementsMustNotContainEmbeddedComments><SA1109BlockStatementsMustNotContainEmbeddedRegions>True</SA1109BlockStatementsMustNotContainEmbeddedRegions><SA1120CommentsMustContainText>True</SA1120CommentsMustContainText><SA1121UseBuiltInTypeAlias>True</SA1121UseBuiltInTypeAlias><SA1122UseStringEmptyForEmptyStrings>True</SA1122UseStringEmptyForEmptyStrings><SA1123DoNotPlaceRegionsWithinElements>True</SA1123DoNotPlaceRegionsWithinElements><SA1124CodeMustNotContainEmptyRegions>True</SA1124CodeMustNotContainEmptyRegions></StyleCop.Readability><StyleCop.Spacing><SA1001CommasMustBeSpacedCorrectly>True</SA1001CommasMustBeSpacedCorrectly><SA1005SingleLineCommentsMustBeginWithSingleSpace>True</SA1005SingleLineCommentsMustBeginWithSingleSpace><SA1006PreprocessorKeywordsMustNotBePrecededBySpace>True</SA1006PreprocessorKeywordsMustNotBePrecededBySpace><SA1021NegativeSignsMustBeSpacedCorrectly>True</SA1021NegativeSignsMustBeSpacedCorrectly><SA1022PositiveSignsMustBeSpacedCorrectly>True</SA1022PositiveSignsMustBeSpacedCorrectly><SA1025CodeMustNotContainMultipleWhitespaceInARow>True</SA1025CodeMustNotContainMultipleWhitespaceInARow></StyleCop.Spacing></Profile></s:String> <s:String x:Key="/Default/CodeStyle/CodeCleanup/RecentlyUsedProfile/@EntryValue">Default: Full Cleanup</s:String> <s:String x:Key="/Default/CodeStyle/CodeCleanup/SilentCleanupProfile/@EntryValue">StyleCop</s:String> + <s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/ThisQualifier/INSTANCE_MEMBERS_QUALIFY_MEMBERS/@EntryValue">All</s:String> <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_ARGUMENT/@EntryValue">False</s:Boolean> <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_ARRAY_AND_OBJECT_INITIALIZER/@EntryValue">True</s:Boolean> <s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/BLANK_LINES_AROUND_SINGLE_LINE_AUTO_PROPERTY/@EntryValue">1</s:Int64> @@ -489,7 +490,9 @@ <s:Boolean x:Key="/Default/Environment/MemoryUsageIndicator/IsVisible/@EntryValue">True</s:Boolean> <s:Boolean x:Key="/Default/Environment/OpenDocument/OpenDocumentAfterModification/@EntryValue">True</s:Boolean> <s:Boolean x:Key="/Default/Environment/SearchAndNavigation/MergeOccurences/@EntryValue">True</s:Boolean> + <s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpFileLayoutPatternsUpgrade/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean> + <s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002EJavaScript_002ECodeStyle_002ESettingsUpgrade_002EJsCodeFormatterSettingsUpgrader/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/Environment/UpdatesManger/IsDownloadUpdateDataAllowed/@EntryValue">False</s:Boolean> <s:String x:Key="/Default/Environment/UserInterface/ShortcutSchemeName/@EntryValue">VS</s:String> diff --git a/win/CS/HandBrakeWPF/Commands/ProcessShortcutCommand.cs b/win/CS/HandBrakeWPF/Commands/ProcessShortcutCommand.cs index 912ea6f11..b27355df9 100644 --- a/win/CS/HandBrakeWPF/Commands/ProcessShortcutCommand.cs +++ b/win/CS/HandBrakeWPF/Commands/ProcessShortcutCommand.cs @@ -100,6 +100,12 @@ namespace HandBrakeWPF.Commands {
mainViewModel.ShowCliQuery();
}
+
+ if (gesture.Modifiers == (ModifierKeys.Control | ModifierKeys.Shift) && gesture.Key == Key.G)
+ {
+ GC.Collect();
+ MessageBox.Show("DEBUG: Garbage Collection Completed");
+ }
}
}
diff --git a/win/CS/HandBrakeWPF/Properties/Resources.resx b/win/CS/HandBrakeWPF/Properties/Resources.resx index 3cff5b87d..fa9de5a2a 100644 --- a/win/CS/HandBrakeWPF/Properties/Resources.resx +++ b/win/CS/HandBrakeWPF/Properties/Resources.resx @@ -272,7 +272,7 @@ A value of 0 means lossless and will result in a file size that is larger than t unless the source was also lossless.
Suggested values are: 18 to 20 for Standard Definition and 20 to 23 for High Definition.
-x265 is early on in it's development, so there are no recommended values yet. You'll have to experiment.
+x265 is a new encoder, so there are no recommended values yet. You'll have to experiment.
FFMpeg's and Theora's scale is more linear. These encoders do not have a lossless mode.</value>
</data>
diff --git a/win/CS/HandBrakeWPF/Views/ShellView.xaml.cs b/win/CS/HandBrakeWPF/Views/ShellView.xaml.cs index bb757662c..03059a2a8 100644 --- a/win/CS/HandBrakeWPF/Views/ShellView.xaml.cs +++ b/win/CS/HandBrakeWPF/Views/ShellView.xaml.cs @@ -81,6 +81,7 @@ namespace HandBrakeWPF.Views this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.O, ModifierKeys.Control)), new KeyGesture(Key.O, ModifierKeys.Control)));
this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.R, ModifierKeys.Control)), new KeyGesture(Key.R, ModifierKeys.Control)));
this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.D, ModifierKeys.Control | ModifierKeys.Shift)), new KeyGesture(Key.D, ModifierKeys.Control | ModifierKeys.Shift)));
+ this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.G, ModifierKeys.Control | ModifierKeys.Shift)), new KeyGesture(Key.G, ModifierKeys.Control | ModifierKeys.Shift)));
// Enable Windows 7 Taskbar progress indication.
if (this.TaskbarItemInfo == null)
|