diff options
author | Damiano Galassi <[email protected]> | 2016-03-14 09:50:42 +0100 |
---|---|---|
committer | Damiano Galassi <[email protected]> | 2016-03-14 09:50:50 +0100 |
commit | d961c289a20d9e2e84fd8c763baa1c6abdb4b414 (patch) | |
tree | 0a39d5d4208cf3bf9a1e5e6d137d661a2296725d /macosx | |
parent | ee4ae6d3a0aa6d06b7a5aedec7e88570c868b8a8 (diff) |
MacGui: added some enum to HBJob model to make things nicer in swift, plus two methods to convert from iso code to english language.
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/HBChapter.h | 2 | ||||
-rw-r--r-- | macosx/HBOutputRedirect.h | 4 | ||||
-rw-r--r-- | macosx/HBOutputRedirect.m | 4 | ||||
-rw-r--r-- | macosx/HBPicture.h | 9 | ||||
-rw-r--r-- | macosx/HBPicture.m | 4 | ||||
-rw-r--r-- | macosx/HBUtilities.h | 5 | ||||
-rw-r--r-- | macosx/HBUtilities.m | 20 | ||||
-rw-r--r-- | macosx/HBVideo.h | 14 | ||||
-rw-r--r-- | macosx/HBVideo.m | 4 |
9 files changed, 52 insertions, 14 deletions
diff --git a/macosx/HBChapter.h b/macosx/HBChapter.h index caee0be8b..bef15d599 100644 --- a/macosx/HBChapter.h +++ b/macosx/HBChapter.h @@ -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; diff --git a/macosx/HBOutputRedirect.h b/macosx/HBOutputRedirect.h index 2679051fd..6c1fc718c 100644 --- a/macosx/HBOutputRedirect.h +++ b/macosx/HBOutputRedirect.h @@ -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; diff --git a/macosx/HBOutputRedirect.m b/macosx/HBOutputRedirect.m index 2dfc297e1..7c121735d 100644 --- a/macosx/HBOutputRedirect.m +++ b/macosx/HBOutputRedirect.m @@ -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:)]; diff --git a/macosx/HBPicture.h b/macosx/HBPicture.h index ee0fa99f5..74830139f 100644 --- a/macosx/HBPicture.h +++ b/macosx/HBPicture.h @@ -11,6 +11,13 @@ 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; /** diff --git a/macosx/HBPicture.m b/macosx/HBPicture.m index b1fc690a6..6760bf1e1 100644 --- a/macosx/HBPicture.m +++ b/macosx/HBPicture.m @@ -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) { diff --git a/macosx/HBUtilities.h b/macosx/HBUtilities.h index 7e40a0135..fb35b4354 100644 --- a/macosx/HBUtilities.h +++ b/macosx/HBUtilities.h @@ -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 - diff --git a/macosx/HBUtilities.m b/macosx/HBUtilities.m index 46f1aae03..de3fa6b95 100644 --- a/macosx/HBUtilities.m +++ b/macosx/HBUtilities.m @@ -11,6 +11,7 @@ #import "HBJob.h" #include "common.h" +#include "lang.h" @implementation HBUtilities @@ -275,5 +276,24 @@ 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 diff --git a/macosx/HBVideo.h b/macosx/HBVideo.h index f8515e5db..a8ceef808 100644 --- a/macosx/HBVideo.h +++ b/macosx/HBVideo.h @@ -11,6 +11,16 @@ 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; diff --git a/macosx/HBVideo.m b/macosx/HBVideo.m index 14c14f47c..df4c98a99 100644 --- a/macosx/HBVideo.m +++ b/macosx/HBVideo.m @@ -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) { |