summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authorDamiano Galassi <[email protected]>2016-01-10 08:11:17 +0100
committerDamiano Galassi <[email protected]>2016-01-10 08:11:17 +0100
commit45c6f4b53d656e18ecfe9e00b142409e08cd3cd5 (patch)
tree17402386f67cfdbb49e37c492a49d58b0d29a184 /macosx
parent361c5143f3be4ab72bd08bed724b05007e4d108b (diff)
MacGui: add rotate filter support to HBJob.
Diffstat (limited to 'macosx')
-rw-r--r--macosx/HBFilters.h1
-rw-r--r--macosx/HBFilters.m15
-rw-r--r--macosx/HBJob+HBJobConversion.m7
3 files changed, 23 insertions, 0 deletions
diff --git a/macosx/HBFilters.h b/macosx/HBFilters.h
index 6ad82529c..432e232ff 100644
--- a/macosx/HBFilters.h
+++ b/macosx/HBFilters.h
@@ -29,6 +29,7 @@ extern NSString * const HBFiltersChangedNotification;
@property (nonatomic, readwrite, copy) NSString *denoiseCustomString;
@property (nonatomic, readwrite) int deblock;
+@property (nonatomic, readwrite) int rotate;
@property (nonatomic, readwrite) BOOL grayscale;
@property (nonatomic, readwrite, weak, nullable) NSUndoManager *undo;
diff --git a/macosx/HBFilters.m b/macosx/HBFilters.m
index 902f9b8ba..da90e78af 100644
--- a/macosx/HBFilters.m
+++ b/macosx/HBFilters.m
@@ -255,6 +255,16 @@ NSString * const HBFiltersChangedNotification = @"HBFiltersChangedNotification";
[self postChangedNotification];
}
+- (void)setRotate:(int)rotate
+{
+ if (rotate != _rotate)
+ {
+ [[self.undo prepareWithInvocationTarget:self] setRotate:_rotate];
+ }
+ _rotate = rotate;
+ [self postChangedNotification];
+}
+
+ (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key
{
NSSet *retval = nil;
@@ -316,6 +326,7 @@ NSString * const HBFiltersChangedNotification = @"HBFiltersChangedNotification";
copy->_deblock = _deblock;
copy->_grayscale = _grayscale;
+ copy->_rotate = _rotate;
}
return copy;
@@ -346,6 +357,7 @@ NSString * const HBFiltersChangedNotification = @"HBFiltersChangedNotification";
encodeInt(_deblock);
encodeBool(_grayscale);
+ encodeInt(_rotate);
}
- (instancetype)initWithCoder:(NSCoder *)decoder
@@ -366,6 +378,7 @@ NSString * const HBFiltersChangedNotification = @"HBFiltersChangedNotification";
decodeInt(_deblock);
decodeBool(_grayscale);
+ decodeInt(_rotate);
_notificationsEnabled = YES;
@@ -390,6 +403,7 @@ NSString * const HBFiltersChangedNotification = @"HBFiltersChangedNotification";
preset[@"PictureDeblock"] = @(self.deblock);
preset[@"VideoGrayScale"] = @(self.grayscale);
+ preset[@"PictureRotate"] = @(self.grayscale);
}
- (void)applyPreset:(HBPreset *)preset
@@ -419,6 +433,7 @@ NSString * const HBFiltersChangedNotification = @"HBFiltersChangedNotification";
self.deblock = [preset[@"PictureDeblock"] intValue];
self.grayscale = [preset[@"VideoGrayScale"] boolValue];
+ self.rotate = [preset[@"PictureRotate"] intValue];
}
self.notificationsEnabled = YES;
diff --git a/macosx/HBJob+HBJobConversion.m b/macosx/HBJob+HBJobConversion.m
index 78fc16229..1a7bd4c08 100644
--- a/macosx/HBJob+HBJobConversion.m
+++ b/macosx/HBJob+HBJobConversion.m
@@ -482,6 +482,13 @@
hb_add_filter(job, filter, NULL);
}
+ // Add rotate filter
+ if (self.filters.rotate)
+ {
+ filter = hb_filter_init(HB_FILTER_ROTATE);
+ hb_add_filter(job, filter, [NSString stringWithFormat:@"%d", self.filters.rotate].UTF8String);
+ }
+
// Add framerate shaping filter
filter = hb_filter_init(HB_FILTER_VFR);
hb_add_filter(job, filter, [[NSString stringWithFormat:@"%d:%d:%d",