]> granicus.if.org Git - handbrake/commitdiff
MacGui: add rotate filter support to HBJob.
authorDamiano Galassi <damiog@gmail.com>
Sun, 10 Jan 2016 07:11:17 +0000 (08:11 +0100)
committerDamiano Galassi <damiog@gmail.com>
Sun, 10 Jan 2016 07:11:17 +0000 (08:11 +0100)
macosx/HBFilters.h
macosx/HBFilters.m
macosx/HBJob+HBJobConversion.m

index 6ad82529c9196f98dc6de097714af9a6b86f4098..432e232fff835222b96afd15363b094ae2824031 100644 (file)
@@ -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;
index 902f9b8bad57221c46859a4a1def0be8a9c32eeb..da90e78afa7f2ad1950f3e79f65c357274cff37e 100644 (file)
@@ -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;
index 78fc16229fe2dc04515bc599fa32a6732be40f98..1a7bd4c087d70e9fb08331e4855b06aeb64972fb 100644 (file)
         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",