summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--macosx/HBCore.h6
-rw-r--r--macosx/HBCore.m80
-rw-r--r--macosx/HBJob.h23
-rw-r--r--macosx/HBJob.m156
-rw-r--r--macosx/HBPicture.h15
-rw-r--r--macosx/HBPicture.m5
-rw-r--r--macosx/HBTitle.h34
-rw-r--r--macosx/HBTitle.m218
-rw-r--r--macosx/HBVideo.h37
-rw-r--r--macosx/HBVideo.m5
-rw-r--r--macosx/HandBrake.xcodeproj/project.pbxproj6
11 files changed, 382 insertions, 203 deletions
diff --git a/macosx/HBCore.h b/macosx/HBCore.h
index 71b352517..a9dd127e4 100644
--- a/macosx/HBCore.h
+++ b/macosx/HBCore.h
@@ -5,6 +5,7 @@
It may be used under the terms of the GNU General Public License. */
#import <Cocoa/Cocoa.h>
+
#include "hb.h"
// These constants specify the current state of HBCore.
@@ -101,6 +102,11 @@ extern NSString *HBCoreMuxingNotification;
- (void)cancelScan;
/**
+ * An array of HBTitles found by the latest scan.
+ */
+@property (nonatomic, readonly) NSArray *titles;
+
+/**
* Starts the libhb encoding session.
*
* This method must be called after all jobs have been added.
diff --git a/macosx/HBCore.m b/macosx/HBCore.m
index 669c3ff74..d506fcb81 100644
--- a/macosx/HBCore.m
+++ b/macosx/HBCore.m
@@ -5,6 +5,7 @@
It may be used under the terms of the GNU General Public License. */
#import "HBCore.h"
+#import "HBTitle.h"
#import "HBDVDDetector.h"
#import "HBUtilities.h"
@@ -44,6 +45,8 @@ NSString *HBCoreMuxingNotification = @"HBCoreMuxingNotification";
/// Timer used to poll libhb for state changes.
@property (nonatomic, readwrite, retain) NSTimer *updateTimer;
+@property (nonatomic, readwrite) NSArray *titles;
+
- (void)stateUpdateTimer:(NSTimer *)timer;
@end
@@ -63,27 +66,9 @@ NSString *HBCoreMuxingNotification = @"HBCoreMuxingNotification";
/**
* Initializes HBCore.
*/
-- (id)init
+- (instancetype)init
{
- if (self = [super init])
- {
- _state = HBStateIdle;
- _hb_state = malloc(sizeof(struct hb_state_s));
- }
- return self;
-}
-
-/**
- * Releases resources.
- */
-- (void)dealloc
-{
- [self stopUpdateTimer];
- hb_close(&_hb_handle);
- _hb_handle = NULL;
-
- free(_hb_state);
- [super dealloc];
+ return [self initWithLoggingLevel:0];
}
/**
@@ -96,9 +81,12 @@ NSString *HBCoreMuxingNotification = @"HBCoreMuxingNotification";
*/
- (instancetype)initWithLoggingLevel:(int)loggingLevel
{
- self = [self init];
+ self = [super init];
if (self)
{
+ _state = HBStateIdle;
+ _hb_state = malloc(sizeof(struct hb_state_s));
+
_hb_handle = hb_init(loggingLevel, 0);
if (!_hb_handle)
{
@@ -110,16 +98,23 @@ NSString *HBCoreMuxingNotification = @"HBCoreMuxingNotification";
return self;
}
+/**
+ * Releases resources.
+ */
+- (void)dealloc
+{
+ [self stopUpdateTimer];
+ hb_close(&_hb_handle);
+ _hb_handle = NULL;
+
+ free(_hb_state);
+ [super dealloc];
+}
+
#pragma mark - Scan
- (BOOL)canScan:(NSURL *)url error:(NSError **)error
{
- if (!_hb_handle)
- {
- // Libhb is not open so we cannot do anything.
- return NO;
- }
-
if (![[NSFileManager defaultManager] fileExistsAtPath:url.path]) {
if (*error) {
*error = [NSError errorWithDomain:@"HBErrorDomain"
@@ -152,7 +147,7 @@ NSString *HBCoreMuxingNotification = @"HBCoreMuxingNotification";
// compatible libdvdcss not found
[HBUtilities writeToActivityLog: "libdvdcss.2.dylib not found for decrypting physical dvd"];
- if (*error) {
+ if (error) {
*error = [NSError errorWithDomain:@"HBErrorDomain" code:101 userInfo:@{ NSLocalizedDescriptionKey: @"libdvdcss.2.dylib not found for decrypting physical dvd" }];
}
}
@@ -204,6 +199,23 @@ NSString *HBCoreMuxingNotification = @"HBCoreMuxingNotification";
self.state = HBStateScanning;
}
+/**
+ * Creates an array of lightweight HBTitles instances.
+ */
+- (void)scanDone
+{
+ hb_title_set_t *title_set = hb_get_title_set(_hb_handle);
+ NSMutableArray *titles = [NSMutableArray array];
+
+ for (int i = 0; i < hb_list_count(title_set->list_title); i++)
+ {
+ hb_title_t *title = (hb_title_t *) hb_list_item(title_set->list_title, i);
+ [titles addObject:[[[HBTitle alloc] initWithTitle:title featured:(title->index == title_set->feature)] autorelease]];
+ }
+
+ self.titles = [[titles copy] autorelease];
+}
+
- (void)cancelScan
{
hb_scan_stop(_hb_handle);
@@ -225,6 +237,16 @@ NSString *HBCoreMuxingNotification = @"HBCoreMuxingNotification";
self.state = HBStateWorking;
}
+- (void)workDone
+{
+ // HB_STATE_WORKDONE happpens as a result of libhb finishing all its jobs
+ // or someone calling hb_stop. In the latter case, hb_stop does not clear
+ // out the remaining passes/jobs in the queue. We'll do that here.
+ hb_job_t *job;
+ while ((job = hb_job(_hb_handle, 0)))
+ hb_rem(_hb_handle, job);
+}
+
- (void)stop
{
hb_stop(_hb_handle);
@@ -357,6 +379,7 @@ NSString *HBCoreMuxingNotification = @"HBCoreMuxingNotification";
*/
- (void)handleHBStateScanDone
{
+ [self scanDone];
[[NSNotificationCenter defaultCenter] postNotificationName:HBCoreScanDoneNotification object:self];
}
@@ -384,6 +407,7 @@ NSString *HBCoreMuxingNotification = @"HBCoreMuxingNotification";
*/
- (void)handleHBStateWorkDone
{
+ [self workDone];
[[NSNotificationCenter defaultCenter] postNotificationName:HBCoreWorkDoneNotification object:self];
}
diff --git a/macosx/HBJob.h b/macosx/HBJob.h
index ebc6a8cbd..fc8bbb956 100644
--- a/macosx/HBJob.h
+++ b/macosx/HBJob.h
@@ -6,10 +6,10 @@
#import <Foundation/Foundation.h>
-#include "hb.h"
-
@class HBPreset;
+@class HBTitle;
+
@class HBVideo;
@class HBPicture;
@class HBFilters;
@@ -17,15 +17,24 @@
@class HBAudioDefaults;
@class HBSubtitlesDefaults;
+typedef NS_ENUM(NSUInteger, HBJobStatus) {
+ HBJobStatusNone,
+ HBJobStatusWorking,
+ HBJobStatusCompleted,
+ HBJobStatusCanceled
+};
+
/**
* HBJob
*/
@interface HBJob : NSObject <NSCoding, NSCopying>
-- (instancetype)initWithTitle:(hb_title_t *)title url:(NSURL *)fileURL andPreset:(HBPreset *)preset;
+- (instancetype)initWithTitle:(HBTitle *)title url:(NSURL *)fileURL andPreset:(HBPreset *)preset;
+
+@property (nonatomic, readonly) HBJobStatus status;
// libhb
-@property (nonatomic, readonly) hb_title_t *title;
+@property (nonatomic, readonly) HBTitle *title;
@property (nonatomic, readonly) NSURL *fileURL;
// Old job format
@@ -33,7 +42,6 @@
@property (nonatomic, readonly) NSAttributedString *jobDescription;
// Job settings
-
@property (nonatomic, readwrite) int fileFormat;
@property (nonatomic, readwrite) BOOL mp4LargeFile;
@@ -48,9 +56,4 @@
@property (nonatomic, readonly) HBAudioDefaults *audioDefaults;
@property (nonatomic, readonly) HBSubtitlesDefaults *subtitlesDefaults;
-// File resources
-@property (nonatomic, readonly) NSMutableArray *audioTracks;
-@property (nonatomic, readonly) NSMutableArray *subtitlesTracks;
-@property (nonatomic, readonly) NSMutableArray *chapters;
-
@end
diff --git a/macosx/HBJob.m b/macosx/HBJob.m
index a7943f3c0..1330c8de7 100644
--- a/macosx/HBJob.m
+++ b/macosx/HBJob.m
@@ -5,169 +5,45 @@
It may be used under the terms of the GNU General Public License. */
#import "HBJob.h"
+#import "HBTitle.h"
+
#import "HBAudioDefaults.h"
#import "HBSubtitlesDefaults.h"
+
+#import "HBFilters.h"
+#import "HBVideo.h"
+#import "HBPicture.h"
+
#import "HBPreset.h"
#include "lang.h"
-extern NSString *keyAudioTrackIndex;
-extern NSString *keyAudioTrackName;
-extern NSString *keyAudioInputBitrate;
-extern NSString *keyAudioInputSampleRate;
-extern NSString *keyAudioInputCodec;
-extern NSString *keyAudioInputCodecParam;
-extern NSString *keyAudioInputChannelLayout;
-extern NSString *keyAudioTrackLanguageIsoCode;
-
-extern NSString *keySubTrackName;
-extern NSString *keySubTrackIndex;
-extern NSString *keySubTrackLanguage;
-extern NSString *keySubTrackLanguageIsoCode;
-extern NSString *keySubTrackType;
-
-extern NSString *keySubTrackForced;
-extern NSString *keySubTrackBurned;
-extern NSString *keySubTrackDefault;
-
-extern NSString *keySubTrackSrtOffset;
-extern NSString *keySubTrackSrtFilePath;
-extern NSString *keySubTrackSrtCharCode;
-
@implementation HBJob
-- (instancetype)initWithTitle:(hb_title_t *)title url:(NSURL *)fileURL andPreset:(HBPreset *)preset
+- (instancetype)initWithTitle:(HBTitle *)title url:(NSURL *)fileURL andPreset:(HBPreset *)preset
{
self = [super init];
if (self) {
_title = title;
_fileURL = [fileURL copy];
- _audioTracks = [[NSMutableArray alloc] init];
- _subtitlesTracks = [[NSMutableArray alloc] init];
- _chapters = [[NSMutableArray alloc] init];
-
_audioDefaults = [[HBAudioDefaults alloc] init];
_subtitlesDefaults = [[HBSubtitlesDefaults alloc] init];
- [self loadAudioTracks];
- [self loadSubtitlesTracks];
- [self loadChapters];
- }
- return self;
-}
-
-- (void)applyPreset:(HBPreset *)preset
-{
- [self.audioDefaults applySettingsFromPreset:preset.content];
- [self.subtitlesDefaults applySettingsFromPreset:preset.content];
-}
+ _video = [[HBVideo alloc] init];
+ _picture = [[HBPicture alloc] init];
+ _filters = [[HBFilters alloc] init];
-#pragma mark - initialization
-
-- (void)loadAudioTracks
-{
- hb_audio_config_t *audio;
- hb_list_t *list = self.title->list_audio;
- int count = hb_list_count(list);
-
- // Initialize the audio list of available audio tracks from this title
- for (int i = 0; i < count; i++)
- {
- audio = (hb_audio_config_t *) hb_list_audio_config_item(list, i);
- [self.audioTracks addObject: @{keyAudioTrackIndex: @(i + 1),
- keyAudioTrackName: [NSString stringWithFormat: @"%d: %s", i, audio->lang.description],
- keyAudioInputBitrate: @(audio->in.bitrate / 1000),
- keyAudioInputSampleRate: @(audio->in.samplerate),
- keyAudioInputCodec: [NSNumber numberWithUnsignedInteger: audio->in.codec],
- keyAudioInputCodecParam: [NSNumber numberWithUnsignedInteger: audio->in.codec_param],
- keyAudioInputChannelLayout: @(audio->in.channel_layout),
- keyAudioTrackLanguageIsoCode: @(audio->lang.iso639_2)}];
- }
-}
-
-- (void)loadSubtitlesTracks
-{
- hb_subtitle_t *subtitle;
- hb_list_t *list = self.title->list_audio;
- int count = hb_list_count(list);
-
- NSMutableArray *forcedSourceNamesArray = [[NSMutableArray alloc] init];
- //NSString *foreignAudioSearchTrackName = nil;
-
- for (int i = 0; i < count; i++)
- {
- subtitle = (hb_subtitle_t *)hb_list_item(self.title->list_subtitle, i);
-
- /* Human-readable representation of subtitle->source */
- NSString *bitmapOrText = subtitle->format == PICTURESUB ? @"Bitmap" : @"Text";
- NSString *subSourceName = @(hb_subsource_name(subtitle->source));
-
- /* if the subtitle track can be forced, add its source name to the array */
- if (hb_subtitle_can_force(subtitle->source) && [forcedSourceNamesArray containsObject:subSourceName] == NO)
- {
- [forcedSourceNamesArray addObject:subSourceName];
- }
-
- // Use the native language name if available
- iso639_lang_t *language = lang_for_code2(subtitle->iso639_2);
- NSString *nativeLanguage = strlen(language->native_name) ? @(language->native_name) : @(language->eng_name);
-
- /* create a dictionary of source subtitle information to store in our array */
- [self.subtitlesTracks addObject:@{keySubTrackName: [NSString stringWithFormat:@"%d: %@ (%@) (%@)", i, nativeLanguage, bitmapOrText, subSourceName],
- keySubTrackIndex: @(i),
- keySubTrackType: @(subtitle->source),
- keySubTrackLanguage: nativeLanguage,
- keySubTrackLanguageIsoCode: @(subtitle->iso639_2)}];
+ [self applyPreset:preset];
}
- /* now set the name of the Foreign Audio Search track */
- if ([forcedSourceNamesArray count])
- {
- [forcedSourceNamesArray sortUsingComparator:^(id obj1, id obj2)
- {
- return [((NSString *)obj1) compare:((NSString *)obj2)];
- }];
-
- NSString *tempList = @"";
- for (NSString *tempString in forcedSourceNamesArray)
- {
- if ([tempList length])
- {
- tempList = [tempList stringByAppendingString:@", "];
- }
- tempList = [tempList stringByAppendingString:tempString];
- }
- //foreignAudioSearchTrackName = [NSString stringWithFormat:@"Foreign Audio Search (Bitmap) (%@)", tempList];
- }
- else
- {
- //foreignAudioSearchTrackName = @"Foreign Audio Search (Bitmap)";
- }
- [forcedSourceNamesArray release];
+ return self;
}
-- (void)loadChapters
+- (void)applyPreset:(HBPreset *)preset
{
- for (int i = 0; i < hb_list_count(self.title->job->list_chapter); i++)
- {
- hb_chapter_t *chapter = hb_list_item(self.title->job->list_chapter, i);
- if (chapter != NULL)
- {
- if (chapter->title != NULL)
- {
- [self.chapters addObject:[NSString
- stringWithFormat:@"%s",
- chapter->title]];
- }
- else
- {
- [self.chapters addObject:[NSString
- stringWithFormat:@"Chapter %d",
- i + 1]];
- }
- }
- }
+ [@[self.audioDefaults, self.subtitlesDefaults, self.video, self.picture, self.filters] makeObjectsPerformSelector:@selector(applySettingsFromPreset:)
+ withObject:preset.content];
}
#pragma mark - NSCoding
diff --git a/macosx/HBPicture.h b/macosx/HBPicture.h
index 4366d3e6d..24c695877 100644
--- a/macosx/HBPicture.h
+++ b/macosx/HBPicture.h
@@ -10,12 +10,17 @@
@interface HBPicture : NSObject
-/*
- width
- height
+- (void)applySettingsFromPreset:(NSDictionary *)preset;
+
+@property (nonatomic, readwrite) int width;
+@property (nonatomic, readwrite) int height;
+
+@property (nonatomic, readwrite) BOOL autocrop;
+@property (nonatomic, readwrite) int *crop;
- autocrop
- crop[]
+@property (nonatomic, readwrite) int modulus;
+
+/*
anamorphic {
mode
keepDisplayAspect
diff --git a/macosx/HBPicture.m b/macosx/HBPicture.m
index bdbd2a677..6b6e6869b 100644
--- a/macosx/HBPicture.m
+++ b/macosx/HBPicture.m
@@ -10,4 +10,9 @@
@implementation HBPicture
+- (void)applySettingsFromPreset:(NSDictionary *)preset
+{
+
+}
+
@end
diff --git a/macosx/HBTitle.h b/macosx/HBTitle.h
new file mode 100644
index 000000000..e0d5ebdf6
--- /dev/null
+++ b/macosx/HBTitle.h
@@ -0,0 +1,34 @@
+/* HBTitle.h $
+
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr/>.
+ It may be used under the terms of the GNU General Public License. */
+
+#import <Foundation/Foundation.h>
+#include "hb.h"
+
+/**
+ * HBTitles is an interface to the low-level hb_title_t.
+ * the properties ara lazy-loaded.
+ */
+@interface HBTitle : NSObject
+
+/**
+ * Returns an HBTitle object initialized with a given title.
+ * It must be called only inside HBCore.
+ *
+ * @param title the lihhb title to wrap.
+ * @param featured whether the title is the featured one or not.
+ */
+- (instancetype)initWithTitle:(hb_title_t *)title featured:(BOOL)featured;
+
+@property (nonatomic, readonly) NSString *name;
+@property (nonatomic, readonly, getter=isFeatured) BOOL featured;
+
+@property (nonatomic, readonly) hb_title_t *title;
+
+@property (nonatomic, readonly) NSArray *audioTracks;
+@property (nonatomic, readonly) NSArray *subtitlesTracks;
+@property (nonatomic, readonly) NSArray *chapters;
+
+@end
diff --git a/macosx/HBTitle.m b/macosx/HBTitle.m
new file mode 100644
index 000000000..cde1c6100
--- /dev/null
+++ b/macosx/HBTitle.m
@@ -0,0 +1,218 @@
+/* HBTitle.m $
+
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr/>.
+ It may be used under the terms of the GNU General Public License. */
+
+#import "HBTitle.h"
+
+#include "lang.h"
+
+extern NSString *keyAudioTrackIndex;
+extern NSString *keyAudioTrackName;
+extern NSString *keyAudioInputBitrate;
+extern NSString *keyAudioInputSampleRate;
+extern NSString *keyAudioInputCodec;
+extern NSString *keyAudioInputCodecParam;
+extern NSString *keyAudioInputChannelLayout;
+extern NSString *keyAudioTrackLanguageIsoCode;
+
+extern NSString *keySubTrackName;
+extern NSString *keySubTrackIndex;
+extern NSString *keySubTrackLanguage;
+extern NSString *keySubTrackLanguageIsoCode;
+extern NSString *keySubTrackType;
+
+extern NSString *keySubTrackForced;
+extern NSString *keySubTrackBurned;
+extern NSString *keySubTrackDefault;
+
+extern NSString *keySubTrackSrtOffset;
+extern NSString *keySubTrackSrtFilePath;
+extern NSString *keySubTrackSrtCharCode;
+
+@interface HBTitle ()
+
+@property (nonatomic, readwrite) NSString *name;
+
+@property (nonatomic, readwrite) NSArray *audioTracks;
+@property (nonatomic, readwrite) NSArray *subtitlesTracks;
+@property (nonatomic, readwrite) NSArray *chapters;
+
+@end
+
+@implementation HBTitle
+
+- (instancetype)initWithTitle:(hb_title_t *)title featured:(BOOL)featured
+{
+ self = [super init];
+ if (self)
+ {
+ if (!title)
+ {
+ [self release];
+ return nil;
+ }
+
+ _featured = featured;
+ }
+
+ return self;
+}
+
+- (NSString *)name
+{
+ if (!_name)
+ {
+ if (self.title->type == HB_BD_TYPE)
+ {
+ _name = [NSString stringWithFormat:@"%s %d (%05d.MPLS) - %02dh%02dm%02ds",
+ self.title->name, self.title->index, self.title->playlist,
+ self.title->hours, self.title->minutes, self.title->seconds];
+ }
+ else
+ {
+ _name = [NSString stringWithFormat:@"%s %d - %02dh%02dm%02ds",
+ self.title->name, self.title->index,
+ self.title->hours, self.title->minutes, self.title->seconds];
+ }
+
+ [_name retain];
+ }
+
+ return _name;
+}
+
+- (NSArray *)audioTracks
+{
+ if (!_audioTracks)
+ {
+ NSMutableArray *tracks = [NSMutableArray array];
+ hb_audio_config_t *audio;
+ hb_list_t *list = self.title->list_audio;
+ int count = hb_list_count(list);
+
+ // Initialize the audio list of available audio tracks from this title
+ for (int i = 0; i < count; i++)
+ {
+ audio = (hb_audio_config_t *) hb_list_audio_config_item(list, i);
+ [tracks addObject: @{keyAudioTrackIndex: @(i + 1),
+ keyAudioTrackName: [NSString stringWithFormat: @"%d: %s", i, audio->lang.description],
+ keyAudioInputBitrate: @(audio->in.bitrate / 1000),
+ keyAudioInputSampleRate: @(audio->in.samplerate),
+ keyAudioInputCodec: @(audio->in.codec),
+ keyAudioInputCodecParam: @(audio->in.codec_param),
+ keyAudioInputChannelLayout: @(audio->in.channel_layout),
+ keyAudioTrackLanguageIsoCode: @(audio->lang.iso639_2)}];
+ }
+
+ _audioTracks = [tracks copy];
+ }
+
+ return _audioTracks;
+}
+
+- (NSArray *)subtitlesTracks
+{
+ if (!_subtitlesTracks)
+ {
+ NSMutableArray *tracks = [NSMutableArray array];
+ hb_subtitle_t *subtitle;
+ hb_list_t *list = self.title->list_audio;
+ int count = hb_list_count(list);
+
+ NSMutableArray *forcedSourceNamesArray = [[NSMutableArray alloc] init];
+ //NSString *foreignAudioSearchTrackName = nil;
+
+ for (int i = 0; i < count; i++)
+ {
+ subtitle = (hb_subtitle_t *)hb_list_item(self.title->list_subtitle, i);
+
+ /* Human-readable representation of subtitle->source */
+ NSString *bitmapOrText = subtitle->format == PICTURESUB ? @"Bitmap" : @"Text";
+ NSString *subSourceName = @(hb_subsource_name(subtitle->source));
+
+ /* if the subtitle track can be forced, add its source name to the array */
+ if (hb_subtitle_can_force(subtitle->source) && [forcedSourceNamesArray containsObject:subSourceName] == NO)
+ {
+ [forcedSourceNamesArray addObject:subSourceName];
+ }
+
+ // Use the native language name if available
+ iso639_lang_t *language = lang_for_code2(subtitle->iso639_2);
+ NSString *nativeLanguage = strlen(language->native_name) ? @(language->native_name) : @(language->eng_name);
+
+ /* create a dictionary of source subtitle information to store in our array */
+ [tracks addObject:@{keySubTrackName: [NSString stringWithFormat:@"%d: %@ (%@) (%@)", i, nativeLanguage, bitmapOrText, subSourceName],
+ keySubTrackIndex: @(i),
+ keySubTrackType: @(subtitle->source),
+ keySubTrackLanguage: nativeLanguage,
+ keySubTrackLanguageIsoCode: @(subtitle->iso639_2)}];
+ }
+
+ /* now set the name of the Foreign Audio Search track */
+ if ([forcedSourceNamesArray count])
+ {
+ [forcedSourceNamesArray sortUsingComparator:^(id obj1, id obj2)
+ {
+ return [((NSString *)obj1) compare:((NSString *)obj2)];
+ }];
+
+ NSString *tempList = @"";
+ for (NSString *tempString in forcedSourceNamesArray)
+ {
+ if ([tempList length])
+ {
+ tempList = [tempList stringByAppendingString:@", "];
+ }
+ tempList = [tempList stringByAppendingString:tempString];
+ }
+ //foreignAudioSearchTrackName = [NSString stringWithFormat:@"Foreign Audio Search (Bitmap) (%@)", tempList];
+ }
+ else
+ {
+ //foreignAudioSearchTrackName = @"Foreign Audio Search (Bitmap)";
+ }
+ [forcedSourceNamesArray release];
+
+ _subtitlesTracks = [tracks copy];
+ }
+
+ return _subtitlesTracks;
+}
+
+- (NSArray *)chapters
+{
+ if (_chapters)
+ {
+ NSMutableArray *chapters = [NSMutableArray array];
+
+ for (int i = 0; i < hb_list_count(self.title->job->list_chapter); i++)
+ {
+ hb_chapter_t *chapter = hb_list_item(self.title->job->list_chapter, i);
+
+ if (chapter != NULL)
+ {
+ if (chapter->title != NULL)
+ {
+ [chapters addObject:[NSString
+ stringWithFormat:@"%s",
+ chapter->title]];
+ }
+ else
+ {
+ [chapters addObject:[NSString
+ stringWithFormat:@"Chapter %d",
+ i + 1]];
+ }
+ }
+ }
+
+ _chapters = [chapters copy];
+ }
+
+ return _chapters;
+}
+
+
+@end
diff --git a/macosx/HBVideo.h b/macosx/HBVideo.h
index 3c174824f..9e217611c 100644
--- a/macosx/HBVideo.h
+++ b/macosx/HBVideo.h
@@ -10,25 +10,22 @@
@interface HBVideo : NSObject
-/*
- videoEncoder
- videoEncoderTag
-
- qualityType
- avgBitrate
- quality
-
- frameRate
- frameRateTag
- frameRateMode
-
- fastFirstPass
- twoPass
- turboTwoPass
-
- encoderOptions {
- x264
- lav
- }*/
+- (void)applySettingsFromPreset:(NSDictionary *)preset;
+
+@property (nonatomic, readwrite) int videoEncoder;
+
+@property (nonatomic, readwrite) int qualityType;
+@property (nonatomic, readwrite) int avgBitrate;
+@property (nonatomic, readwrite) float quality;
+
+@property (nonatomic, readwrite) int frameRate;
+@property (nonatomic, readwrite) int frameRateMode;
+
+
+@property (nonatomic, readwrite) BOOL fastFirstPass;
+@property (nonatomic, readwrite) BOOL twoPass;
+@property (nonatomic, readwrite) BOOL turboTwoPass;
+
+@property (nonatomic, readwrite, copy) NSString *videoOptionExtra;
@end
diff --git a/macosx/HBVideo.m b/macosx/HBVideo.m
index ce662fbc4..9160934e9 100644
--- a/macosx/HBVideo.m
+++ b/macosx/HBVideo.m
@@ -10,4 +10,9 @@
@implementation HBVideo
+- (void)applySettingsFromPreset:(NSDictionary *)preset
+{
+
+}
+
@end
diff --git a/macosx/HandBrake.xcodeproj/project.pbxproj b/macosx/HandBrake.xcodeproj/project.pbxproj
index 1a4bf405f..188f0db40 100644
--- a/macosx/HandBrake.xcodeproj/project.pbxproj
+++ b/macosx/HandBrake.xcodeproj/project.pbxproj
@@ -137,6 +137,7 @@
A93E0ED71972958C00FD67FB /* Video.xib in Resources */ = {isa = PBXBuildFile; fileRef = A93E0ED51972958C00FD67FB /* Video.xib */; };
A9523937199A6AAE00588AEF /* HBFilters.m in Sources */ = {isa = PBXBuildFile; fileRef = A9523936199A6AAE00588AEF /* HBFilters.m */; };
A967E4BA1A16768200DF1DFC /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = A967E4B91A16768200DF1DFC /* [email protected] */; };
+ A971281F1A2C75180088C076 /* HBTitle.m in Sources */ = {isa = PBXBuildFile; fileRef = A971281E1A2C75180088C076 /* HBTitle.m */; };
A98C29C41977B10600AF5DED /* HBLanguagesSelection.m in Sources */ = {isa = PBXBuildFile; fileRef = A98C29C31977B10600AF5DED /* HBLanguagesSelection.m */; };
A9935213196F38A70069C6B7 /* ChaptersTitles.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9935211196F38A70069C6B7 /* ChaptersTitles.xib */; };
A9AA447A1970664A00D7DEFC /* HBUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = A9AA44791970664A00D7DEFC /* HBUtilities.m */; };
@@ -374,6 +375,8 @@
A9523935199A6AAE00588AEF /* HBFilters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBFilters.h; sourceTree = "<group>"; };
A9523936199A6AAE00588AEF /* HBFilters.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBFilters.m; sourceTree = "<group>"; };
A967E4B91A16768200DF1DFC /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
+ A971281D1A2C75180088C076 /* HBTitle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBTitle.h; sourceTree = "<group>"; };
+ A971281E1A2C75180088C076 /* HBTitle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBTitle.m; sourceTree = "<group>"; };
A98C29C21977B10600AF5DED /* HBLanguagesSelection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBLanguagesSelection.h; sourceTree = "<group>"; };
A98C29C31977B10600AF5DED /* HBLanguagesSelection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBLanguagesSelection.m; sourceTree = "<group>"; };
A9935212196F38A70069C6B7 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = ChaptersTitles.xib; sourceTree = "<group>"; };
@@ -840,6 +843,8 @@
children = (
A9DEC8721A23C87500C79B48 /* HBCore.h */,
A9DEC8731A23C87500C79B48 /* HBCore.m */,
+ A971281D1A2C75180088C076 /* HBTitle.h */,
+ A971281E1A2C75180088C076 /* HBTitle.m */,
A9DEC87D1A23DF6F00C79B48 /* HBJob.h */,
A9DEC87E1A23DF6F00C79B48 /* HBJob.m */,
A9DEC8751A23C88D00C79B48 /* HBVideo.h */,
@@ -1143,6 +1148,7 @@
273F20B214ADBE670021BE6D /* HBImageAndTextCell.m in Sources */,
273F20B314ADBE670021BE6D /* HBOutputPanelController.m in Sources */,
273F20B414ADBE670021BE6D /* HBOutputRedirect.m in Sources */,
+ A971281F1A2C75180088C076 /* HBTitle.m in Sources */,
273F20B514ADBE670021BE6D /* HBPreferencesController.m in Sources */,
A9DC6C52196F04F6002AE6B4 /* HBSubtitlesController.m in Sources */,
A9F472891976B7F30009EC65 /* HBSubtitlesDefaultsController.m in Sources */,