diff options
author | ritsuka <[email protected]> | 2015-01-30 08:00:02 +0000 |
---|---|---|
committer | ritsuka <[email protected]> | 2015-01-30 08:00:02 +0000 |
commit | 98e54a8b93fc92e9d417375afe746049e54ed78d (patch) | |
tree | e28ad062f626706370f5e1ae7e8bf582cffb0986 /macosx | |
parent | 399c64860c4ec5d8a29f34e3b130ff7018337290 (diff) |
MacGui: let HBAudioTrackPreset know the current container.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6827 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/HBAudioDefaults.h | 5 | ||||
-rw-r--r-- | macosx/HBAudioDefaults.m | 29 | ||||
-rw-r--r-- | macosx/HBAudioDefaultsController.m | 2 | ||||
-rw-r--r-- | macosx/HBAudioTrackPreset.h | 3 | ||||
-rw-r--r-- | macosx/HBAudioTrackPreset.m | 31 |
5 files changed, 68 insertions, 2 deletions
diff --git a/macosx/HBAudioDefaults.h b/macosx/HBAudioDefaults.h index a99ff05d3..01a838517 100644 --- a/macosx/HBAudioDefaults.h +++ b/macosx/HBAudioDefaults.h @@ -24,6 +24,11 @@ typedef NS_ENUM(NSUInteger, HBAudioTrackSelectionBehavior) { @property (nonatomic, readwrite, retain) NSMutableArray *tracksArray; +/** + * Adds a new track preset. + */ +- (void)addTrack; + @property(nonatomic, readwrite) BOOL allowAACPassthru; @property(nonatomic, readwrite) BOOL allowAC3Passthru; @property(nonatomic, readwrite) BOOL allowDTSHDPassthru; diff --git a/macosx/HBAudioDefaults.m b/macosx/HBAudioDefaults.m index d6b184f33..693b29986 100644 --- a/macosx/HBAudioDefaults.m +++ b/macosx/HBAudioDefaults.m @@ -38,6 +38,13 @@ [super dealloc]; } +- (void)addTrack +{ + HBAudioTrackPreset *track = [[HBAudioTrackPreset alloc] initWithContainer:self.container]; + [self insertObject:track inTracksArrayAtIndex:[self countOfTracksArray]]; + [track release]; +} + - (NSArray *)audioEncoderFallbacks { NSMutableArray *fallbacks = [[NSMutableArray alloc] init]; @@ -311,4 +318,26 @@ return self; } +#pragma mark KVC + +- (NSUInteger)countOfTracksArray +{ + return self.tracksArray.count; +} + +- (HBAudioTrackPreset *)objectInTracksArrayAtIndex:(NSUInteger)index +{ + return self.tracksArray[index]; +} + +- (void)insertObject:(HBAudioTrackPreset *)track inTracksArrayAtIndex:(NSUInteger)index; +{ + [self.tracksArray insertObject:track atIndex:index]; +} + +- (void)removeObjectFromTracksArrayAtIndex:(NSUInteger)index +{ + [self.tracksArray removeObjectAtIndex:index]; +} + @end diff --git a/macosx/HBAudioDefaultsController.m b/macosx/HBAudioDefaultsController.m index 5452b186a..31b8dee6c 100644 --- a/macosx/HBAudioDefaultsController.m +++ b/macosx/HBAudioDefaultsController.m @@ -76,7 +76,7 @@ static void *HBAudioDefaultsContex = &HBAudioDefaultsContex; } else { - [self.tracksController add:sender]; + [self.settings addTrack]; } } diff --git a/macosx/HBAudioTrackPreset.h b/macosx/HBAudioTrackPreset.h index bc9475443..61b739079 100644 --- a/macosx/HBAudioTrackPreset.h +++ b/macosx/HBAudioTrackPreset.h @@ -13,6 +13,9 @@ */ @interface HBAudioTrackPreset : NSObject <NSCoding, NSCopying> +- (instancetype)initWithContainer:(int)container; +- (void)containerChanged:(int)container; + /** * track properties. */ diff --git a/macosx/HBAudioTrackPreset.m b/macosx/HBAudioTrackPreset.m index 00aacd1a0..da7fd6748 100644 --- a/macosx/HBAudioTrackPreset.m +++ b/macosx/HBAudioTrackPreset.m @@ -12,14 +12,22 @@ static void *HBAudioEncoderContex = &HBAudioEncoderContex; +@interface HBAudioTrackPreset () + +@property (nonatomic, readwrite) int container; + +@end + @implementation HBAudioTrackPreset - (instancetype)init { self = [super init]; - if (self) { + if (self) + { // defaults settings _encoder = HB_ACODEC_CA_AAC; + _container = HB_MUX_MKV; _sampleRate = 0; _bitRate = 160; _mixdown = HB_AMIXDOWN_DOLBYPLII; @@ -27,6 +35,21 @@ static void *HBAudioEncoderContex = &HBAudioEncoderContex; return self; } +- (instancetype)initWithContainer:(int)container +{ + self = [self init]; + if (self) + { + _container = container; + } + return self; +} + +- (void)containerChanged:(int)container +{ + // Do things here +} + #pragma mark - Setters override - (void)setEncoder:(int)encoder @@ -230,6 +253,8 @@ static void *HBAudioEncoderContex = &HBAudioEncoderContex; copy->_gain = _gain; copy->_drc = _drc; + + copy->_container = _container; } return copy; @@ -248,6 +273,8 @@ static void *HBAudioEncoderContex = &HBAudioEncoderContex; encodeInt(_gain); encodeDouble(_drc); + + encodeInt(_container); } - (id)initWithCoder:(NSCoder *)decoder @@ -262,6 +289,8 @@ static void *HBAudioEncoderContex = &HBAudioEncoderContex; decodeInt(_gain); decodeDouble(_drc); + decodeInt(_container); + return self; } |