]> granicus.if.org Git - handbrake/commitdiff
MacGui: added some enum to HBJob model to make things nicer in swift, plus two method...
authorDamiano Galassi <damiog@gmail.com>
Mon, 14 Mar 2016 08:50:42 +0000 (09:50 +0100)
committerDamiano Galassi <damiog@gmail.com>
Mon, 14 Mar 2016 08:50:50 +0000 (09:50 +0100)
macosx/HBChapter.h
macosx/HBOutputRedirect.h
macosx/HBOutputRedirect.m
macosx/HBPicture.h
macosx/HBPicture.m
macosx/HBUtilities.h
macosx/HBUtilities.m
macosx/HBVideo.h
macosx/HBVideo.m

index caee0be8b17e6d1098b8b9b704be47c6938d57d2..bef15d599f03bf4da19c45d37305827a9d10b03a 100644 (file)
@@ -14,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
 
 @property (nonatomic, readwrite) NSString *title;
 @property (nonatomic, readonly) NSString *duration;
-@property (nonatomic, readwrite) NSUInteger index;
+@property (nonatomic, readonly) NSUInteger index;
 
 @property (nonatomic, readwrite, weak, nullable) NSUndoManager *undo;
 
index 2679051fd1cf8f99115b7978784aa0657d87ad86..6c1fc718cfa6362a6920c88e2a8a4522c8939edd 100644 (file)
@@ -29,8 +29,8 @@ NS_ASSUME_NONNULL_BEGIN
  */
 @interface HBOutputRedirect : NSObject
 
-+ (id)stdoutRedirect;
-+ (id)stderrRedirect;
++ (instancetype)stdoutRedirect;
++ (instancetype)stderrRedirect;
 
 - (void)addListener:(id <HBOutputRedirectListening>)aListener;
 - (void)removeListener:(id <HBOutputRedirectListening>)aListener;
index 2dfc297e1e85f559f16582e53492c660d2f8b565..7c121735dcb25284ae1c1d3280522b35e76e2ac5 100644 (file)
@@ -69,7 +69,7 @@ int   stderrwrite(void *inFD, const char *buffer, int size)
 /**
  * Returns HBOutputRedirect object used to redirect stdout.
  */
-+ (id)stdoutRedirect
++ (instancetype)stdoutRedirect
 {
        if (!g_stdoutRedirect)
                g_stdoutRedirect = [[HBOutputRedirect alloc] initWithStream:stdout selector:@selector(stdoutRedirect:)];
@@ -80,7 +80,7 @@ int   stderrwrite(void *inFD, const char *buffer, int size)
 /**
  * Returns HBOutputRedirect object used to redirect stderr.
  */
-+ (id)stderrRedirect
++ (instancetype)stderrRedirect
 {
        if (!g_stderrRedirect)
                g_stderrRedirect = [[HBOutputRedirect alloc] initWithStream:stderr selector:@selector(stderrRedirect:)];
index ee0fa99f5015d26682d40b0ea10c88f0afe3ebf1..74830139f9b516bf3dc55901a981fe2840018994 100644 (file)
 
 NS_ASSUME_NONNULL_BEGIN
 
+typedef NS_ENUM(NSUInteger, HBPictureAnarmophicMode) {
+    HBPictureAnarmophicModeNone,
+    HBPictureAnarmophicModeStrict,
+    HBPictureAnarmophicModeLoose,
+    HBPictureAnarmophicModeCustom
+};
+
 extern NSString * const HBPictureChangedNotification;
 
 /**
@@ -24,7 +31,7 @@ extern NSString * const HBPictureChangedNotification;
 @property (nonatomic, readwrite) int height;
 
 @property (nonatomic, readwrite) BOOL keepDisplayAspect;
-@property (nonatomic, readwrite) int anamorphicMode;
+@property (nonatomic, readwrite) HBPictureAnarmophicMode anamorphicMode;
 @property (nonatomic, readwrite) int modulus;
 
 /**
index b1fc690a6995d0d671e3bef0f57dbc9a713d4952..6760bf1e174d8533019efa88da6c1d0302b96f2a 100644 (file)
@@ -46,7 +46,7 @@ NSString * const HBPictureChangedNotification = @"HBPictureChangedNotification";
         _sourceWidth = 1280;
         _sourceHeight = 720;
 
-        _anamorphicMode = HB_ANAMORPHIC_NONE;
+        _anamorphicMode = HBPictureAnarmophicModeNone;
 
         _parWidth = 1;
         _parHeight = 1;
@@ -345,7 +345,7 @@ NSString * const HBPictureChangedNotification = @"HBPictureChangedNotification";
     }
 }
 
-- (void)setAnamorphicMode:(int)anamorphicMode
+- (void)setAnamorphicMode:(HBPictureAnarmophicMode)anamorphicMode
 {
     if (anamorphicMode != _anamorphicMode)
     {
index 7e40a01350c98c8b0b74002748109f842bd50e5a..fb35b4354e1537b15b3ebaf5a8aa80623631a328 100644 (file)
@@ -57,8 +57,9 @@ NS_ASSUME_NONNULL_BEGIN
                              bitrate:(int)bitrate
                           videoCodec:(uint32_t)codec;
 
-@end
++ (NSString *)iso6392CodeFor:(NSString *)language;
++ (NSString *)languageCodeForIso6392Code:(NSString *)language;
 
+@end
 
 NS_ASSUME_NONNULL_END
-
index 46f1aae034e4c9c17acc1a8e70970070c85d5f75..de3fa6b9515017464ac5064da6c0d5a206451530 100644 (file)
@@ -11,6 +11,7 @@
 #import "HBJob.h"
 
 #include "common.h"
+#include "lang.h"
 
 @implementation HBUtilities
 
     return [name copy];
 }
 
++ (NSString *)iso6392CodeFor:(NSString *)aLanguage
+{
+    iso639_lang_t *lang = lang_for_english(aLanguage.UTF8String);
+    if (lang)
+    {
+        return @(lang->iso639_2);
+    }
+    return @"und";
+}
+
++ (NSString *)languageCodeForIso6392Code:(NSString *)aLanguage
+{
+    iso639_lang_t *lang = lang_for_code2(aLanguage.UTF8String);
+    if (lang)
+    {
+        return @(lang->eng_name);
+    }
+    return @"Unknown";
+}
 
 @end
index f8515e5dbd90c6b87a711361648b71ebe6642299..a8ceef80866eb91a45dd504fa75eeb0c7b51886d 100644 (file)
 
 NS_ASSUME_NONNULL_BEGIN
 
+typedef NS_ENUM(NSUInteger, HBVideoQualityType) {
+    HBVideoQualityTypeAvgBitrate,
+    HBVideoQualityTypeConstantQuality,
+};
+
+typedef NS_ENUM(NSUInteger, HBVideoFrameRateMode) {
+    HBVideoFrameRateModeVFR_PFR,
+    HBVideoFrameRateModeCFR,
+};
+
 extern NSString * const HBVideoChangedNotification;
 
 /**
@@ -24,12 +34,12 @@ extern NSString * const HBVideoChangedNotification;
 
 @property (nonatomic, readwrite) int encoder;
 
-@property (nonatomic, readwrite) int qualityType;
+@property (nonatomic, readwrite) HBVideoQualityType qualityType;
 @property (nonatomic, readwrite) int avgBitrate;
 @property (nonatomic, readwrite) double quality;
 
+@property (nonatomic, readwrite) HBVideoFrameRateMode frameRateMode;
 @property (nonatomic, readwrite) int frameRate;
-@property (nonatomic, readwrite) int frameRateMode;
 
 @property (nonatomic, readwrite) BOOL twoPass;
 @property (nonatomic, readwrite) BOOL turboTwoPass;
index 14c14f47c701144e8272cf8a7208d48111f3c919..df4c98a99ae369a9b3ca0af862a7a774bba6b7ed 100644 (file)
@@ -108,7 +108,7 @@ NSString * const HBVideoChangedNotification = @"HBVideoChangedNotification";
     [self postChangedNotification];
 }
 
-- (void)setQualityType:(int)qualityType
+- (void)setQualityType:(HBVideoQualityType)qualityType
 {
     if (qualityType != _qualityType)
     {
@@ -148,7 +148,7 @@ NSString * const HBVideoChangedNotification = @"HBVideoChangedNotification";
     [self postChangedNotification];
 }
 
-- (void)setFrameRateMode:(int)frameRateMode
+- (void)setFrameRateMode:(HBVideoFrameRateMode)frameRateMode
 {
     if (frameRateMode != _frameRateMode)
     {