]> granicus.if.org Git - handbrake/commitdiff
MacGui: added a new HBTitle class to wraps the hb_tltle_t parts used by the mac gui...
authorritsuka <damiog@gmail.com>
Wed, 3 Dec 2014 19:16:55 +0000 (19:16 +0000)
committerritsuka <damiog@gmail.com>
Wed, 3 Dec 2014 19:16:55 +0000 (19:16 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6576 b64f7644-9d1e-0410-96f1-a4d463321fa5

macosx/HBCore.h
macosx/HBCore.m
macosx/HBJob.h
macosx/HBJob.m
macosx/HBPicture.h
macosx/HBPicture.m
macosx/HBTitle.h [new file with mode: 0644]
macosx/HBTitle.m [new file with mode: 0644]
macosx/HBVideo.h
macosx/HBVideo.m
macosx/HandBrake.xcodeproj/project.pbxproj

index 71b352517998bba3aac22f5d973cc453f1e20eb6..a9dd127e4ef7c10a4c5875f31d44db17f37e3283 100644 (file)
@@ -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.
@@ -100,6 +101,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.
  *
index 669c3ff743041a1c6b554646afae7f2679c538ea..d506fcb815da2788e807ae61240eddb230c01498 100644 (file)
@@ -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];    
 }
 
index ebc6a8cbde68353898db5f3658c346df3077dfab..fc8bbb9560894ec0805b83b3c2d15df5ebea58a9 100644 (file)
@@ -6,10 +6,10 @@
 
 #import <Foundation/Foundation.h>
 
-#include "hb.h"
-
 @class HBPreset;
 
+@class HBTitle;
+
 @class HBVideo;
 @class HBPicture;
 @class HBFilters;
 @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
index a7943f3c06237071a312c80063c101897e7080b4..1330c8de7760963fc31f775c1cc1cc2203b9cab1 100644 (file)
  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
index 4366d3e6d4f966d83fc5203f857c1175615becf3..24c6958771846496f705793aecc7ef29384e566a 100644 (file)
 
 @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
index bdbd2a67785eb34cbf7851e83bc7ef3c123f25de..6b6e6869b86571f4078ec200486dcac38cc10a04 100644 (file)
@@ -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 (file)
index 0000000..e0d5ebd
--- /dev/null
@@ -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 (file)
index 0000000..cde1c61
--- /dev/null
@@ -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
index 3c174824f2091a295954c60ff5144ab938281af9..9e217611c5cd25a0ab57d483ed0986f0844208cf 100644 (file)
 
 @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
index ce662fbc42eefb52d031418c79a5ac02f275f333..9160934e94e07948afc1b406876f9b51d6239cbd 100644 (file)
@@ -10,4 +10,9 @@
 
 @implementation HBVideo
 
+- (void)applySettingsFromPreset:(NSDictionary *)preset
+{
+
+}
+
 @end
index 1a4bf405f52a062ffdcd7d8812c4ad6678678402..188f0db40ce10c20cc65ddee9b940e8f97ea69c8 100644 (file)
                A93E0ED71972958C00FD67FB /* Video.xib in Resources */ = {isa = PBXBuildFile; fileRef = A93E0ED51972958C00FD67FB /* Video.xib */; };
                A9523937199A6AAE00588AEF /* HBFilters.m in Sources */ = {isa = PBXBuildFile; fileRef = A9523936199A6AAE00588AEF /* HBFilters.m */; };
                A967E4BA1A16768200DF1DFC /* EncodeCanceled@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A967E4B91A16768200DF1DFC /* EncodeCanceled@2x.png */; };
+               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 */; };
                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 /* EncodeCanceled@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "EncodeCanceled@2x.png"; 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>"; };
                        children = (
                                A9DEC8721A23C87500C79B48 /* HBCore.h */,
                                A9DEC8731A23C87500C79B48 /* HBCore.m */,
+                               A971281D1A2C75180088C076 /* HBTitle.h */,
+                               A971281E1A2C75180088C076 /* HBTitle.m */,
                                A9DEC87D1A23DF6F00C79B48 /* HBJob.h */,
                                A9DEC87E1A23DF6F00C79B48 /* HBJob.m */,
                                A9DEC8751A23C88D00C79B48 /* HBVideo.h */,
                                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 */,