summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authorritsuka <[email protected]>2014-12-22 17:12:16 +0000
committerritsuka <[email protected]>2014-12-22 17:12:16 +0000
commitee10e1fdb417c7f1047406522379c85c47143bfd (patch)
tree1ed8f1ae02ee7296162c640bb238a425af93a02b /macosx
parent6bcb7bd0894f9f44637b9668e5b5d3d388aef152 (diff)
MacGui: set the chapter titles directly in HBJob. Move more things over to HBTitle and HBJob.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6642 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx')
-rw-r--r--macosx/Controller.m80
-rw-r--r--macosx/English.lproj/ChaptersTitles.xib36
-rw-r--r--macosx/HBChapterTitlesController.h13
-rw-r--r--macosx/HBChapterTitlesController.m42
-rw-r--r--macosx/HBJob.h15
-rw-r--r--macosx/HBJob.m36
-rw-r--r--macosx/HBRange.h28
-rw-r--r--macosx/HBRange.m26
-rw-r--r--macosx/HBTitle.h2
-rw-r--r--macosx/HBTitle.m5
-rw-r--r--macosx/HandBrake.xcodeproj/project.pbxproj6
11 files changed, 176 insertions, 113 deletions
diff --git a/macosx/Controller.m b/macosx/Controller.m
index efbcdb74c..a13849748 100644
--- a/macosx/Controller.m
+++ b/macosx/Controller.m
@@ -674,7 +674,6 @@ NSString *keyContainerTag = @"keyContainerTag";
fVideoController.enabled = b;
fAudioController.enabled = b;
fSubtitlesViewController.enabled = b;
- fChapterTitlesController.enabled = b;
}
/**
@@ -1994,15 +1993,15 @@ static void queueFSEventStreamCallback(
}
else
{
- [queueFileJob setObject:@(fChapterTitlesController.createChapterMarkers) forKey:@"ChapterMarkers"];
+ [queueFileJob setObject:@(self.job.chaptersEnabled) forKey:@"ChapterMarkers"];
}
/* We need to get the list of chapter names to put into an array and store
* in our queue, so they can be reapplied in prepareJob when this queue
* item comes up if Chapter Markers is set to on.
*/
- [queueFileJob setObject:fChapterTitlesController.chapterTitlesArray forKey:@"ChapterNames"];
-
+ [queueFileJob setObject:[[self.job.chapterTitles copy] autorelease] forKey:@"ChapterNames"];
+
/* Mux mp4 with http optimization */
[queueFileJob setObject:[NSNumber numberWithInteger:[fDstMp4HttpOptFileCheck state]] forKey:@"Mp4HttpOptimize"];
/* Add iPod uuid atom */
@@ -2303,7 +2302,7 @@ static void queueFSEventStreamCallback(
[self formatPopUpChanged:nil];
/* Chapter Markers*/
- fChapterTitlesController.createChapterMarkers = [[queueToApply objectForKey:@"ChapterMarkers"] boolValue];
+ self.job.chaptersEnabled = [[queueToApply objectForKey:@"ChapterMarkers"] boolValue];
[fChapterTitlesController addChaptersFromQueue:[queueToApply objectForKey:@"ChapterNames"]];
/* Mux mp4 with http optimization */
@@ -3338,80 +3337,77 @@ static void queueFSEventStreamCallback(
self.selectedPreset = [self createPresetFromCurrentSettings];
}
- HBTitle *hbtitle = [self.core.titles objectAtIndex:fSrcTitlePopUp.indexOfSelectedItem];
- self.job = [[[HBJob alloc] initWithTitle:hbtitle
- url:[NSURL fileURLWithPath:fSrcDVD2Field.stringValue]
+ HBTitle *hbtitle = self.core.titles[fSrcTitlePopUp.indexOfSelectedItem];
+ HBJob *job = [[[HBJob alloc] initWithTitle:hbtitle
andPreset:self.selectedPreset] autorelease];
hb_title_t *title = hbtitle.hb_title;
- /* If we are a stream type and a batch scan, grok the output file name from title->name upon title change */
+ // If we are a stream type and a batch scan, grok the output file name from title->name upon title change
if ((title->type == HB_STREAM_TYPE || title->type == HB_FF_STREAM_TYPE) && self.core.titles.count > 1)
{
- /* we set the default name according to the new title->name */
+ // we set the default name according to the new title->name
[fDstFile2Field setStringValue: [NSString stringWithFormat:
@"%@/%@.%@", [[fDstFile2Field stringValue] stringByDeletingLastPathComponent],
[NSString stringWithUTF8String: title->name],
[[fDstFile2Field stringValue] pathExtension]]];
- /* Change the source to read out the parent folder also */
+ // Change the source to read out the parent folder also
[fSrcDVD2Field setStringValue:[NSString stringWithFormat:@"%@/%@", browsedSourceDisplayName,[NSString stringWithUTF8String: title->name]]];
}
- /* For point a to point b pts encoding, set the start and end fields to 0 and the title duration in seconds respectively */
+ // For point a to point b pts encoding, set the start and end fields to 0 and the title duration in seconds respectively
int duration = (title->hours * 3600) + (title->minutes * 60) + (title->seconds);
[fSrcTimeStartEncodingField setStringValue: [NSString stringWithFormat: @"%d", 0]];
[fSrcTimeEndEncodingField setStringValue: [NSString stringWithFormat: @"%d", duration]];
- /* For point a to point b frame encoding, set the start and end fields to 0 and the title duration * announced fps in seconds respectively */
+ // For point a to point b frame encoding, set the start and end fields to 0 and the title duration * announced fps in seconds respectively
[fSrcFrameStartEncodingField setStringValue: [NSString stringWithFormat: @"%d", 1]];
- //[fSrcFrameEndEncodingField setStringValue: [NSString stringWithFormat: @"%d", ((title->hours * 3600) + (title->minutes * 60) + (title->seconds)) * 24]];
- [fSrcFrameEndEncodingField setStringValue: [NSString stringWithFormat: @"%d", duration * (title->vrate.num / title->vrate.den)]];
-
- /* Update encode start / stop variables */
+ [fSrcFrameEndEncodingField setStringValue: [NSString stringWithFormat: @"%d", duration * (title->vrate.num / title->vrate.den)]];
- /* Update chapter popups */
+ // Update chapter popups
[fSrcChapterStartPopUp removeAllItems];
[fSrcChapterEndPopUp removeAllItems];
- for( int i = 0; i < hb_list_count( title->list_chapter ); i++ )
- {
- [fSrcChapterStartPopUp addItemWithTitle: [NSString
- stringWithFormat: @"%d", i + 1]];
- [fSrcChapterEndPopUp addItemWithTitle: [NSString
- stringWithFormat: @"%d", i + 1]];
- }
+
+ [hbtitle.chapters enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
+ NSString *title = [NSString stringWithFormat: @"%lu", idx + 1];
+ [fSrcChapterStartPopUp addItemWithTitle:title];
+ [fSrcChapterEndPopUp addItemWithTitle: title];
+ }];
[fSrcChapterStartPopUp selectItemAtIndex: 0];
- [fSrcChapterEndPopUp selectItemAtIndex:
- hb_list_count( title->list_chapter ) - 1];
+ [fSrcChapterEndPopUp selectItemAtIndex:hbtitle.chapters.count - 1];
[self chapterPopUpChanged:nil];
[fSrcAnglePopUp removeAllItems];
- for( int i = 0; i < title->angle_count; i++ )
+
+ for (int i = 0; i < hbtitle.angles; i++)
{
- [fSrcAnglePopUp addItemWithTitle: [NSString stringWithFormat: @"%d", i + 1]];
+ [fSrcAnglePopUp addItemWithTitle:[NSString stringWithFormat: @"%d", i + 1]];
}
[fSrcAnglePopUp selectItemAtIndex: 0];
// Set the jobs info to the view controllers
- fPictureController.picture = self.job.picture;
- fPictureController.filters = self.job.filters;
- fPreviewController.job = self.job;
+ fPictureController.picture = job.picture;
+ fPictureController.filters = job.filters;
+ fPreviewController.job = job;
- fVideoController.video = self.job.video;
- fAudioController.job = self.job;
- fSubtitlesViewController.job = self.job;
- fChapterTitlesController.job = self.job;
+ fVideoController.video = job.video;
+ fAudioController.job = job;
+ fSubtitlesViewController.job = job;
+ fChapterTitlesController.job = job;
// Set Auto Crop to on upon selecting a new title
- self.job.picture.autocrop = YES;
+ job.picture.autocrop = YES;
+
+ self.job = job;
- /* If Auto Naming is on. We create an output filename of dvd name - title number */
+ // If Auto Naming is on. We create an output filename of dvd name - title number
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultAutoNaming"])
{
[self updateFileName];
}
- /* apply the current preset */
+ // apply the current preset
[self applyPreset:self.selectedPreset];
}
@@ -3577,7 +3573,7 @@ static void queueFSEventStreamCallback(
BOOL anyCodecAC3 = [fAudioController anyCodecMatches: HB_ACODEC_AC3] || [fAudioController anyCodecMatches: HB_ACODEC_AC3_PASS];
/* Chapter markers are enabled if the checkbox is ticked and we are doing p2p or we have > 1 chapter */
- BOOL chapterMarkers = (fChapterTitlesController.createChapterMarkers) &&
+ BOOL chapterMarkers = (self.job.chaptersEnabled) &&
([fEncodeStartStopPopUp indexOfSelectedItem] != 0 ||
[fSrcChapterStartPopUp indexOfSelectedItem] < [fSrcChapterEndPopUp indexOfSelectedItem]);
@@ -3807,8 +3803,6 @@ the user is using "Custom" settings by determining the sender*/
[fDstFormatPopUp selectItemWithTag:format];
[self formatPopUpChanged:nil];
- /* Chapter Markers*/
- fChapterTitlesController.createChapterMarkers = [[chosenPreset objectForKey:@"ChapterMarkers"] boolValue];
/* check to see if we have only one chapter */
[self chapterPopUpChanged:nil];
@@ -3904,7 +3898,7 @@ the user is using "Custom" settings by determining the sender*/
preset[@"PresetDescription"] = currentPreset[@"PresetDescription"];
preset[@"FileFormat"] = fDstFormatPopUp.titleOfSelectedItem;
- preset[@"ChapterMarkers"] = @(fChapterTitlesController.createChapterMarkers);
+ preset[@"ChapterMarkers"] = @(self.job.chaptersEnabled);
// Mux mp4 with http optimization
preset[@"Mp4HttpOptimize"] = @(fDstMp4HttpOptFileCheck.state);
diff --git a/macosx/English.lproj/ChaptersTitles.xib b/macosx/English.lproj/ChaptersTitles.xib
index 2f69cc1ae..1fd94e892 100644
--- a/macosx/English.lproj/ChaptersTitles.xib
+++ b/macosx/English.lproj/ChaptersTitles.xib
@@ -1,22 +1,19 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5056" systemVersion="13F7" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6254" systemVersion="14C81f" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<dependencies>
<deployment version="1060" identifier="macosx"/>
- <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="5056"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6254"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="HBChapterTitlesController">
<connections>
<outlet property="fChapterTable" destination="InF-gR-Lia" id="DSk-hZ-TGI"/>
<outlet property="fChapterTableNameColumn" destination="Z6H-lJ-ipr" id="TkJ-3q-ejW"/>
- <outlet property="fCreateChaptersMarkers" destination="7Xf-c0-jsr" id="RqA-eo-yhD"/>
- <outlet property="fLoadChaptersButton" destination="Ron-3B-rYg" id="6Tt-yt-c0U"/>
- <outlet property="fSaveChaptersButton" destination="3SP-6e-RPS" id="LxX-yO-VCg"/>
<outlet property="view" destination="qs9-Xl-pXA" id="km6-16-y27"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
- <customObject id="-3" userLabel="Application"/>
+ <customObject id="-3" userLabel="Application" customClass="NSObject"/>
<view id="qs9-Xl-pXA">
<rect key="frame" x="0.0" y="0.0" width="926" height="322"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
@@ -29,7 +26,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" headerView="0rK-Rs-NTb" id="InF-gR-Lia">
- <rect key="frame" x="0.0" y="0.0" width="884" height="248"/>
+ <rect key="frame" x="0.0" y="0.0" width="884" height="19"/>
<autoresizingMask key="autoresizingMask"/>
<size key="intercellSpacing" width="3" height="2"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
@@ -63,6 +60,11 @@
</tableColumn>
</tableColumns>
<connections>
+ <binding destination="-2" name="enabled" keyPath="self.job" id="leT-dv-Prc">
+ <dictionary key="options">
+ <string key="NSValueTransformerName">NSIsNotNil</string>
+ </dictionary>
+ </binding>
<outlet property="dataSource" destination="-2" id="7rd-Et-5BT"/>
<outlet property="delegate" destination="-2" id="DOu-XY-6Tq"/>
</connections>
@@ -74,7 +76,7 @@
<rect key="frame" x="-100" y="-100" width="488" height="15"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
- <scroller key="verticalScroller" verticalHuggingPriority="750" horizontal="NO" id="yp0-pp-Yw7">
+ <scroller key="verticalScroller" verticalHuggingPriority="750" doubleValue="1" horizontal="NO" id="yp0-pp-Yw7">
<rect key="frame" x="869" y="17" width="16" height="248"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
@@ -92,7 +94,12 @@
</buttonCell>
<connections>
<action selector="createChapterMarkersChanged:" target="-2" id="J6X-VM-8Me"/>
- <binding destination="-2" name="value" keyPath="createChapterMarkers" id="7It-q2-Xl3"/>
+ <binding destination="-2" name="enabled" keyPath="self.job" id="JMA-67-MXH">
+ <dictionary key="options">
+ <string key="NSValueTransformerName">NSIsNotNil</string>
+ </dictionary>
+ </binding>
+ <binding destination="-2" name="value" keyPath="self.job.chaptersEnabled" id="7wG-le-s1k"/>
</connections>
</button>
<button verticalHuggingPriority="750" id="Ron-3B-rYg">
@@ -104,6 +111,11 @@
</buttonCell>
<connections>
<action selector="browseForChapterFile:" target="-2" id="yMS-zB-Pa6"/>
+ <binding destination="-2" name="enabled" keyPath="self.job" id="Rla-9q-ULw">
+ <dictionary key="options">
+ <string key="NSValueTransformerName">NSIsNotNil</string>
+ </dictionary>
+ </binding>
</connections>
</button>
<button verticalHuggingPriority="750" id="3SP-6e-RPS">
@@ -115,9 +127,15 @@
</buttonCell>
<connections>
<action selector="browseForChapterFileSave:" target="-2" id="kKu-5B-QsT"/>
+ <binding destination="-2" name="enabled" keyPath="self.job" id="TZV-TC-ydR">
+ <dictionary key="options">
+ <string key="NSValueTransformerName">NSIsNotNil</string>
+ </dictionary>
+ </binding>
</connections>
</button>
</subviews>
+ <point key="canvasLocation" x="131" y="343"/>
</view>
<userDefaultsController representsSharedInstance="YES" id="coy-s6-QLx"/>
</objects>
diff --git a/macosx/HBChapterTitlesController.h b/macosx/HBChapterTitlesController.h
index c0fdaec23..07b23d0ae 100644
--- a/macosx/HBChapterTitlesController.h
+++ b/macosx/HBChapterTitlesController.h
@@ -12,21 +12,10 @@
/**
* HBChapterTitlesController
*/
-@interface HBChapterTitlesController : NSViewController <HBViewValidation>
+@interface HBChapterTitlesController : NSViewController
- (void)addChaptersFromQueue:(NSMutableArray *)newChaptersArray;
@property (nonatomic, readwrite, assign) HBJob *job;
-/**
- * Enable/disable chapters markers
- */
-@property (readwrite, nonatomic) BOOL createChapterMarkers;
-
-/**
- * Get the list of chapter titles
- */
-@property (readonly, nonatomic) NSArray *chapterTitlesArray;
-
-
@end
diff --git a/macosx/HBChapterTitlesController.m b/macosx/HBChapterTitlesController.m
index debfcb63f..2016bcb97 100644
--- a/macosx/HBChapterTitlesController.m
+++ b/macosx/HBChapterTitlesController.m
@@ -10,64 +10,46 @@
@interface HBChapterTitlesController () <NSTableViewDataSource, NSTableViewDelegate>
{
- NSMutableArray *fChapterTitlesArray;
-
IBOutlet NSTableView * fChapterTable;
- IBOutlet NSButton * fLoadChaptersButton;
- IBOutlet NSButton * fSaveChaptersButton;
- IBOutlet NSButton * fCreateChaptersMarkers;
IBOutlet NSTableColumn * fChapterTableNameColumn;
}
+@property (nonatomic, readwrite, retain) NSMutableArray *chapterTitles;
+
@end
@implementation HBChapterTitlesController
-@synthesize enabled = _enabled;
-
- (instancetype)init
{
self = [super initWithNibName:@"ChaptersTitles" bundle:nil];
if (self)
{
- fChapterTitlesArray = [[[NSMutableArray alloc] init] retain];
+ _chapterTitles = [[NSMutableArray alloc] init];
}
return self;
}
- (void)dealloc
{
- [fChapterTitlesArray release];
- [super dealloc];
+ [_chapterTitles release];
+ [super dealloc];
}
- (void)setJob:(HBJob *)job
{
- [fChapterTitlesArray removeAllObjects];
- [fChapterTitlesArray addObjectsFromArray:job.title.chapters];
+ _job = job;
+ self.chapterTitles = job.chapterTitles;
[fChapterTable reloadData];
}
- (void)addChaptersFromQueue:(NSMutableArray *)newChaptersArray
{
- [fChapterTitlesArray removeAllObjects];
- [fChapterTitlesArray addObjectsFromArray:newChaptersArray];
+ [self.chapterTitles removeAllObjects];
+ [self.chapterTitles addObjectsFromArray:newChaptersArray];
[fChapterTable reloadData];
}
-- (void)setEnabled:(BOOL)enabled
-{
- [fCreateChaptersMarkers setEnabled:enabled];
- [fChapterTable setEnabled:enabled];
- [fLoadChaptersButton setEnabled:enabled];
- [fSaveChaptersButton setEnabled:enabled];
-}
-
-- (NSArray *)chapterTitlesArray
-{
- return [NSArray arrayWithArray:fChapterTitlesArray];
-}
-
- (IBAction)createChapterMarkersChanged:(id)sender
{
[[NSNotificationCenter defaultCenter] postNotificationName:HBMixdownChangedNotification object:self];
@@ -75,7 +57,7 @@
- (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView
{
- return [fChapterTitlesArray count];
+ return self.chapterTitles.count;
}
- (void)tableView:(NSTableView *)aTableView
@@ -85,7 +67,7 @@
{
if (aTableColumn != nil && [[aTableColumn identifier] intValue] == 2)
{
- [fChapterTitlesArray replaceObjectAtIndex:rowIndex
+ [self.chapterTitles replaceObjectAtIndex:rowIndex
withObject:[NSString
stringWithString:anObject]];
}
@@ -101,7 +83,7 @@
}
else
{
- return [NSString stringWithString:[fChapterTitlesArray
+ return [NSString stringWithString:[self.chapterTitles
objectAtIndex:rowIndex]];
}
return @"__DATA ERROR__";
diff --git a/macosx/HBJob.h b/macosx/HBJob.h
index 119a81fb7..29b8dd89f 100644
--- a/macosx/HBJob.h
+++ b/macosx/HBJob.h
@@ -8,6 +8,7 @@
#import "HBTitle.h"
+#import "HBRange.h"
#import "HBVideo.h"
#import "HBPicture.h"
#import "HBFilters.h"
@@ -20,7 +21,7 @@
@class HBPreset;
typedef NS_ENUM(NSUInteger, HBJobState) {
- HBJobStateNone,
+ HBJobStateReady,
HBJobStateWorking,
HBJobStateCompleted,
HBJobStateCanceled
@@ -31,7 +32,7 @@ typedef NS_ENUM(NSUInteger, HBJobState) {
*/
@interface HBJob : NSObject <NSCoding, NSCopying>
-- (instancetype)initWithTitle:(HBTitle *)title url:(NSURL *)fileURL andPreset:(HBPreset *)preset;
+- (instancetype)initWithTitle:(HBTitle *)title andPreset:(HBPreset *)preset;
- (void)applyPreset:(HBPreset *)preset;
/**
@@ -47,17 +48,15 @@ typedef NS_ENUM(NSUInteger, HBJobState) {
// Libhb job
@property (nonatomic, readonly) hb_job_t *hb_job;
-
-// Old job format
-@property (nonatomic, readwrite, retain) NSDictionary *jobDict;
@property (nonatomic, readonly) NSAttributedString *jobDescription;
// Job settings
-@property (nonatomic, readwrite) int fileFormat;
+@property (nonatomic, readwrite) int container;
@property (nonatomic, readwrite) BOOL mp4HttpOptimize;
@property (nonatomic, readwrite) BOOL mp4iPodCompatible;
+@property (nonatomic, readonly) HBRange *range;
@property (nonatomic, readonly) HBVideo *video;
@property (nonatomic, readonly) HBPicture *picture;
@property (nonatomic, readonly) HBFilters *filters;
@@ -65,8 +64,8 @@ typedef NS_ENUM(NSUInteger, HBJobState) {
@property (nonatomic, readonly) NSMutableArray *audioTracks;
@property (nonatomic, readonly) NSMutableArray *subtitlesTracks;
-@property (nonatomic, readonly) BOOL chaptersEnabled;
-@property (nonatomic, readonly) NSMutableArray *chapterNames;
+@property (nonatomic, readwrite) BOOL chaptersEnabled;
+@property (nonatomic, readonly) NSMutableArray *chapterTitles;
// Defaults settings
@property (nonatomic, readonly) HBAudioDefaults *audioDefaults;
diff --git a/macosx/HBJob.m b/macosx/HBJob.m
index 5e334bae2..803460d21 100644
--- a/macosx/HBJob.m
+++ b/macosx/HBJob.m
@@ -15,22 +15,21 @@
@implementation HBJob
-- (instancetype)initWithTitle:(HBTitle *)title url:(NSURL *)fileURL andPreset:(HBPreset *)preset
+- (instancetype)initWithTitle:(HBTitle *)title andPreset:(HBPreset *)preset
{
self = [super init];
if (self) {
NSParameterAssert(title);
- NSParameterAssert(fileURL);
NSParameterAssert(preset);
_title = title;
- _fileURL = [fileURL copy];
- _fileFormat = HB_MUX_MP4;
+ _container = HB_MUX_MP4;
_audioDefaults = [[HBAudioDefaults alloc] init];
_subtitlesDefaults = [[HBSubtitlesDefaults alloc] init];
+ _range = [[HBRange alloc] init];
_video = [[HBVideo alloc] init];
_picture = [[HBPicture alloc] initWithTitle:title];
_filters = [[HBFilters alloc] init];
@@ -38,6 +37,8 @@
_audioTracks = [[NSMutableArray alloc] init];
_subtitlesTracks = [[NSMutableArray alloc] init];
+ _chapterTitles = [title.chapters mutableCopy];
+
[self applyPreset:preset];
}
@@ -46,8 +47,19 @@
- (void)applyPreset:(HBPreset *)preset
{
+ NSDictionary *content = preset.content;
+
+ self.container = hb_container_get_from_name(hb_container_sanitize_name([content[@"FileFormat"] UTF8String]));
+
+ // Mux mp4 with http optimization
+ self.mp4HttpOptimize = [content[@"Mp4HttpOptimize"] boolValue];
+ self.mp4iPodCompatible = [content[@"Mp4iPodCompatible"] boolValue];
+
+ // Chapter Markers
+ self.chaptersEnabled = [content[@"ChapterMarkers"] boolValue];
+
[@[self.audioDefaults, self.subtitlesDefaults, self.video, self.picture, self.filters] makeObjectsPerformSelector:@selector(applySettingsFromPreset:)
- withObject:preset.content];
+ withObject:content];
}
- (void)dealloc
@@ -119,7 +131,7 @@
}*/
// Format (Muxer) and Video Encoder
- job->mux = self.fileFormat;
+ job->mux = self.container;
job->vcodec = self.video.encoder;
// We set http optimized mp4 here
@@ -138,7 +150,7 @@
// Also, note that if for some reason we don't apply chapter names, the
// chapters just come out 001, 002, etc. etc.
int i = 0;
- for (NSString *name in self.chapterNames)
+ for (NSString *name in self.chapterTitles)
{
hb_chapter_t *chapter = (hb_chapter_t *) hb_list_item(job->list_chapter, i);
if (chapter != NULL)
@@ -583,10 +595,11 @@
encodeObject(_fileURL);
encodeObject(_destURL);
- encodeInt(_fileFormat);
+ encodeInt(_container);
encodeBool(_mp4HttpOptimize);
encodeBool(_mp4iPodCompatible);
+ encodeObject(_range);
encodeObject(_video);
encodeObject(_picture);
encodeObject(_filters);
@@ -595,7 +608,7 @@
encodeObject(_subtitlesTracks);
encodeBool(_chaptersEnabled);
- encodeObject(_chapterNames);
+ encodeObject(_chapterTitles);
encodeObject(_audioDefaults);
encodeObject(_subtitlesDefaults);
@@ -610,10 +623,11 @@
decodeObject(_fileURL);
decodeObject(_destURL);
- decodeInt(_fileFormat);
+ decodeInt(_container);
decodeBool(_mp4HttpOptimize);
decodeBool(_mp4iPodCompatible);
+ decodeObject(_range);
decodeObject(_video);
decodeObject(_picture);
decodeObject(_filters);
@@ -622,7 +636,7 @@
decodeObject(_subtitlesTracks);
decodeBool(_chaptersEnabled);
- decodeObject(_chapterNames);
+ decodeObject(_chapterTitles);
decodeObject(_audioDefaults);
decodeObject(_subtitlesDefaults);
diff --git a/macosx/HBRange.h b/macosx/HBRange.h
new file mode 100644
index 000000000..06ea826ca
--- /dev/null
+++ b/macosx/HBRange.h
@@ -0,0 +1,28 @@
+/* HBRange.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>
+
+typedef NS_ENUM(NSUInteger, HBRangeType) {
+ HBRangeTypeChapters,
+ HBRangeTypeFrames,
+ HBRangeTypeSeconds,
+};
+
+@interface HBRange : NSObject <NSCoding>
+
+@property (nonatomic, readwrite) HBRangeType type;
+
+@property (nonatomic, readwrite) NSInteger chapterStart;
+@property (nonatomic, readwrite) NSInteger chapterStop;
+
+@property (nonatomic, readwrite) NSInteger frameStart;
+@property (nonatomic, readwrite) NSInteger frameStop;
+
+@property (nonatomic, readwrite) NSInteger secondsStart;
+@property (nonatomic, readwrite) NSInteger secondsStop;
+
+@end
diff --git a/macosx/HBRange.m b/macosx/HBRange.m
new file mode 100644
index 000000000..be39652ef
--- /dev/null
+++ b/macosx/HBRange.m
@@ -0,0 +1,26 @@
+/* HBRange.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 "HBRange.h"
+#import "NSCodingMacro.h"
+
+@implementation HBRange
+
+#pragma mark - NSCoding
+
+- (void)encodeWithCoder:(NSCoder *)coder
+{
+ [coder encodeInt:1 forKey:@"HBRangeVersion"];
+}
+
+- (id)initWithCoder:(NSCoder *)decoder
+{
+ self = [super init];
+
+ return self;
+}
+
+@end
diff --git a/macosx/HBTitle.h b/macosx/HBTitle.h
index 64f2fd9ab..a26d46f50 100644
--- a/macosx/HBTitle.h
+++ b/macosx/HBTitle.h
@@ -27,6 +27,8 @@
@property (nonatomic, readonly) hb_title_t *hb_title;
+@property (nonatomic, readonly) NSInteger angles;
+
@property (nonatomic, readonly) NSArray *audioTracks;
@property (nonatomic, readonly) NSArray *subtitlesTracks;
@property (nonatomic, readonly) NSArray *chapters;
diff --git a/macosx/HBTitle.m b/macosx/HBTitle.m
index 20c985691..274b47c7a 100644
--- a/macosx/HBTitle.m
+++ b/macosx/HBTitle.m
@@ -96,6 +96,11 @@ extern NSString *keySubTrackSrtCharCode;
}
}
+- (NSInteger)angles
+{
+ return self.hb_title->angle_count;
+}
+
- (NSArray *)audioTracks
{
if (!_audioTracks)
diff --git a/macosx/HandBrake.xcodeproj/project.pbxproj b/macosx/HandBrake.xcodeproj/project.pbxproj
index 11b7933a4..8aadc4a08 100644
--- a/macosx/HandBrake.xcodeproj/project.pbxproj
+++ b/macosx/HandBrake.xcodeproj/project.pbxproj
@@ -113,6 +113,7 @@
46AB433515F98A2B009C0961 /* DockTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = 46AB433415F98A2B009C0961 /* DockTextField.m */; };
A90A0CAF1988D57200DA65CE /* HBAudioTrackPreset.m in Sources */ = {isa = PBXBuildFile; fileRef = A90A0CAE1988D57200DA65CE /* HBAudioTrackPreset.m */; };
A91726E7197291BC00D1AFEF /* HBChapterTitlesController.m in Sources */ = {isa = PBXBuildFile; fileRef = A91726E6197291BC00D1AFEF /* HBChapterTitlesController.m */; };
+ A91806711A4807B000FC9BED /* HBRange.m in Sources */ = {isa = PBXBuildFile; fileRef = A91806701A4807B000FC9BED /* HBRange.m */; };
A91C024D1A16516A00DEA6F3 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = A91C024C1A16516A00DEA6F3 /* [email protected] */; };
A91C02521A165EA200DEA6F3 /* EncodeComplete.png in Resources */ = {isa = PBXBuildFile; fileRef = A91C02501A165EA200DEA6F3 /* EncodeComplete.png */; };
A91C02531A165EA200DEA6F3 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = A91C02511A165EA200DEA6F3 /* [email protected] */; };
@@ -348,6 +349,8 @@
A90A0CAE1988D57200DA65CE /* HBAudioTrackPreset.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBAudioTrackPreset.m; sourceTree = "<group>"; };
A91726E5197291BC00D1AFEF /* HBChapterTitlesController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBChapterTitlesController.h; sourceTree = "<group>"; };
A91726E6197291BC00D1AFEF /* HBChapterTitlesController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBChapterTitlesController.m; sourceTree = "<group>"; };
+ A918066F1A4807B000FC9BED /* HBRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBRange.h; sourceTree = "<group>"; };
+ A91806701A4807B000FC9BED /* HBRange.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBRange.m; sourceTree = "<group>"; };
A919C7AC199369180049E6A3 /* HBViewValidation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBViewValidation.h; sourceTree = "<group>"; };
A91C024C1A16516A00DEA6F3 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
A91C02501A165EA200DEA6F3 /* EncodeComplete.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = EncodeComplete.png; sourceTree = "<group>"; };
@@ -854,6 +857,8 @@
A971281E1A2C75180088C076 /* HBTitle.m */,
A9DEC87D1A23DF6F00C79B48 /* HBJob.h */,
A9DEC87E1A23DF6F00C79B48 /* HBJob.m */,
+ A918066F1A4807B000FC9BED /* HBRange.h */,
+ A91806701A4807B000FC9BED /* HBRange.m */,
A9DEC8751A23C88D00C79B48 /* HBVideo.h */,
A9DEC8761A23C88D00C79B48 /* HBVideo.m */,
A9DEC8781A23C89E00C79B48 /* HBPicture.h */,
@@ -1144,6 +1149,7 @@
A98C29C41977B10600AF5DED /* HBLanguagesSelection.m in Sources */,
A9BB0F2719A0ECE40079F1C1 /* HBHUDButtonCell.m in Sources */,
A932E273198834130047D13E /* HBAudioDefaults.m in Sources */,
+ A91806711A4807B000FC9BED /* HBRange.m in Sources */,
A9DEC8771A23C88D00C79B48 /* HBVideo.m in Sources */,
A9523937199A6AAE00588AEF /* HBFilters.m in Sources */,
A9AA447A1970664A00D7DEFC /* HBUtilities.m in Sources */,