summaryrefslogtreecommitdiffstats
path: root/macosx/HBAudioTrackPreset.m
diff options
context:
space:
mode:
authorritsuka <[email protected]>2014-08-05 07:49:22 +0000
committerritsuka <[email protected]>2014-08-05 07:49:22 +0000
commit8d93fa6d55e1c1fda021d37a816dd9747194c32c (patch)
tree79622aefa93acfbffabab8bfbdb781f8a2055eed /macosx/HBAudioTrackPreset.m
parentdd3518f0e6ab8f3a12dbce90c35734c3227d5620 (diff)
MacGui: Modernized the objc syntax of HBAudio/HBAudioController and avoided the use of KVO to observer changes inside the same class.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6268 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx/HBAudioTrackPreset.m')
-rw-r--r--macosx/HBAudioTrackPreset.m51
1 files changed, 18 insertions, 33 deletions
diff --git a/macosx/HBAudioTrackPreset.m b/macosx/HBAudioTrackPreset.m
index 9f91c3ab8..dc829874b 100644
--- a/macosx/HBAudioTrackPreset.m
+++ b/macosx/HBAudioTrackPreset.m
@@ -24,34 +24,29 @@ static void *HBAudioEncoderContex = &HBAudioEncoderContex;
_sampleRate = 0;
_bitRate = 160;
_mixdown = HB_AMIXDOWN_DOLBYPLII;
-
- // add a serie of observers to keep the tracks properties in a valid state.
- [self addObserver:self forKeyPath:@"encoder" options:0 context:HBAudioEncoderContex];
- [self addObserver:self forKeyPath:@"mixdown" options:0 context:HBAudioEncoderContex];
- [self addObserver:self forKeyPath:@"sampleRate" options:0 context:HBAudioEncoderContex];
}
return self;
}
-- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
+#pragma mark - Setters override
+
+- (void)setEncoder:(int)encoder
{
- if (context == HBAudioEncoderContex)
- {
- // Validate the settings
- if ([keyPath isEqualToString:@"encoder"])
- {
- [self validateMixdown];
- [self validateBitrate];
- }
- else if ([keyPath isEqualToString:@"mixdown"] || [keyPath isEqualToString:@"sampleRate"])
- {
- [self validateBitrate];
- }
- }
- else
- {
- [super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
- }
+ _encoder = encoder;
+ [self validateMixdown];
+ [self validateBitrate];
+}
+
+- (void)setMixdown:(int)mixdown
+{
+ _mixdown = mixdown;
+ [self validateBitrate];
+}
+
+- (void)setSampleRate:(int)sampleRate
+{
+ _sampleRate = sampleRate;
+ [self validateBitrate];
}
#pragma mark -
@@ -155,16 +150,6 @@ static void *HBAudioEncoderContex = &HBAudioEncoderContex;
return retval;
}
-- (void)dealloc
-{
- // Remove the KVO observers before deallocing the instance.
- [self removeObserver:self forKeyPath:@"encoder"];
- [self removeObserver:self forKeyPath:@"mixdown"];
- [self removeObserver:self forKeyPath:@"sampleRate"];
-
- [super dealloc];
-}
-
#pragma mark - Options
- (NSArray *)encoders