summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authordynaflash <[email protected]>2009-07-16 18:36:08 +0000
committerdynaflash <[email protected]>2009-07-16 18:36:08 +0000
commit8bb7d25bba2dc06e8541f07583897c4030a1bc3c (patch)
treeea0073de04a728eaed1cb5f2fc43b4abe172601a /macosx
parenta13d7753343d914e2e25ac32ca756b3025b48de2 (diff)
MacGui: srt subtitle support initial implementation
- Allows adding an external srt sub file as a subtitle source. -- Adds fields for srt language, char code and offset in ms. - Known issues: adding the srt file to the sources list also adds a new subtitle track for that source, however to "set" it you have to click on it. - srt subtitles do not seem to work in preview even if set to default. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2699 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx')
-rw-r--r--macosx/Controller.h6
-rw-r--r--macosx/Controller.mm84
-rw-r--r--macosx/English.lproj/MainMenu.xib323
-rw-r--r--macosx/HBSubtitles.h13
-rw-r--r--macosx/HBSubtitles.m618
5 files changed, 955 insertions, 89 deletions
diff --git a/macosx/Controller.h b/macosx/Controller.h
index f1432b4ed..07a027231 100644
--- a/macosx/Controller.h
+++ b/macosx/Controller.h
@@ -139,7 +139,7 @@ BOOL fIsDragging;
IBOutlet NSTableView * fSubtitlesTable;
HBSubtitles * fSubtitlesDelegate;
- //NSMutableArray * subtitleArray;
+ IBOutlet NSButton * fBrowseSrtFileButton;
/* Audio box */
@@ -304,10 +304,14 @@ BOOL fIsDragging;
returnCode: (int) returnCode contextInfo: (void *) contextInfo;
- (IBAction) videoMatrixChanged: (id) sender;
+
- (IBAction) qualitySliderChanged: (id) sender;
- (void) setupQualitySlider;
- (IBAction) audioDRCSliderChanged: (id) sender;
+- (IBAction) browseImportSrtFile: (id) sender;
+- (void) browseImportSrtFileDone: (NSSavePanel *) sheet
+ returnCode: (int) returnCode contextInfo: (void *) contextInfo;
- (IBAction) showPicturePanel: (id) sender;
- (void) picturePanelFullScreen;
diff --git a/macosx/Controller.mm b/macosx/Controller.mm
index 712622aaa..f7e79c484 100644
--- a/macosx/Controller.mm
+++ b/macosx/Controller.mm
@@ -2924,6 +2924,24 @@ bool one_burned = FALSE;
subt = (hb_subtitle_t *)hb_list_item(title->list_subtitle, subtitle);
+ /* if we are getting the subtitles from an external srt file */
+ if ([[tempObject objectForKey:@"subtitleSourceTrackType"] isEqualToString:@"SRT"])
+ {
+ hb_subtitle_config_t sub_config;
+
+ sub_config.offset = [[tempObject objectForKey:@"subtitleTrackSrtOffset"] intValue];
+
+ /* we need to srncpy file path and char code */
+ strncpy(sub_config.src_filename, [[tempObject objectForKey:@"subtitleSourceSrtFilePath"] UTF8String], 128);
+ strncpy(sub_config.src_codeset, [[tempObject objectForKey:@"subtitleTrackSrtCharCode"] UTF8String], 40);
+
+ sub_config.force = 0;
+ sub_config.dest = hb_subtitle_config_s::PASSTHRUSUB;
+ sub_config.default_track = def;
+
+ hb_srt_add( job, &sub_config, [[tempObject objectForKey:@"subtitleTrackSrtLanguageIso3"] UTF8String]);
+ }
+
if (subt != NULL)
{
[self writeToActivityLog: "Setting Subtitle: %s", subt];
@@ -3440,6 +3458,27 @@ bool one_burned = FALSE;
subt = (hb_subtitle_t *)hb_list_item(title->list_subtitle, subtitle);
+ /* if we are getting the subtitles from an external srt file */
+ if ([[tempObject objectForKey:@"subtitleSourceTrackType"] isEqualToString:@"SRT"])
+ {
+ hb_subtitle_config_t sub_config;
+
+ sub_config.offset = [[tempObject objectForKey:@"subtitleTrackSrtOffset"] intValue];
+
+ /* we need to srncpy file name and codeset */
+ //sub_config.src_filename = [[tempObject objectForKey:@"subtitleSourceSrtFilePath"] UTF8String];
+ strncpy(sub_config.src_filename, [[tempObject objectForKey:@"subtitleSourceSrtFilePath"] UTF8String], 128);
+ //sub_config.src_codeset = [[tempObject objectForKey:@"subtitleTrackSrtCharCode"] UTF8String];
+ strncpy(sub_config.src_codeset, [[tempObject objectForKey:@"subtitleTrackSrtCharCode"] UTF8String], 40);
+
+ sub_config.force = 0;
+ sub_config.dest = hb_subtitle_config_s::PASSTHRUSUB;
+ sub_config.default_track = def;
+
+ hb_srt_add( job, &sub_config, [[tempObject objectForKey:@"subtitleTrackSrtLanguageIso3"] UTF8String]);
+ }
+
+
if (subt != NULL)
{
[self writeToActivityLog: "Setting Subtitle: %s", subt];
@@ -5660,6 +5699,51 @@ the user is using "Custom" settings by determining the sender*/
//[self customSettingUsed: sender];
}
+#pragma mark -
+
+- (IBAction) browseImportSrtFile: (id) sender
+{
+
+ NSOpenPanel * panel;
+
+ panel = [NSOpenPanel openPanel];
+ [panel setAllowsMultipleSelection: NO];
+ [panel setCanChooseFiles: YES];
+ [panel setCanChooseDirectories: NO ];
+ NSString * sourceDirectory;
+ if ([[NSUserDefaults standardUserDefaults] stringForKey:@"LastSrtImportDirectory"])
+ {
+ sourceDirectory = [[NSUserDefaults standardUserDefaults] stringForKey:@"LastSrtImportDirectory"];
+ }
+ else
+ {
+ sourceDirectory = @"~/Desktop";
+ sourceDirectory = [sourceDirectory stringByExpandingTildeInPath];
+ }
+ /* we open up the browse srt sheet here and call for browseImportSrtFileDone after the sheet is closed */
+ NSArray *fileTypes = [NSArray arrayWithObjects:@"plist", @"srt", nil];
+ [panel beginSheetForDirectory: sourceDirectory file: nil types: fileTypes
+ modalForWindow: fWindow modalDelegate: self
+ didEndSelector: @selector( browseImportSrtFileDone:returnCode:contextInfo: )
+ contextInfo: sender];
+}
+
+- (void) browseImportSrtFileDone: (NSSavePanel *) sheet
+ returnCode: (int) returnCode contextInfo: (void *) contextInfo
+{
+ if( returnCode == NSOKButton )
+ {
+ NSString *importSrtDirectory = [[sheet filename] stringByDeletingLastPathComponent];
+ NSString *importSrtFilePath = [sheet filename];
+ [[NSUserDefaults standardUserDefaults] setObject:importSrtDirectory forKey:@"LastSrtImportDirectory"];
+
+ /* now pass the string off to fSubtitlesDelegate to add the srt file to the dropdown */
+ [fSubtitlesDelegate createSubtitleSrtTrack:importSrtFilePath];
+
+ [fSubtitlesTable reloadData];
+
+ }
+}
#pragma mark -
#pragma mark Open New Windows
diff --git a/macosx/English.lproj/MainMenu.xib b/macosx/English.lproj/MainMenu.xib
index 48d64461b..8c5b68454 100644
--- a/macosx/English.lproj/MainMenu.xib
+++ b/macosx/English.lproj/MainMenu.xib
@@ -8,8 +8,7 @@
<string key="IBDocument.HIToolboxVersion">353.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="5196"/>
- <integer value="58"/>
+ <integer value="2"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -1942,7 +1941,7 @@
<object class="NSTableView" id="587237088">
<reference key="NSNextResponder" ref="705918581"/>
<int key="NSvFlags">256</int>
- <string key="NSFrameSize">{700, 265}</string>
+ <string key="NSFrameSize">{700, 252}</string>
<reference key="NSSuperview" ref="705918581"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTableHeaderView" key="NSHeaderView" id="569585004">
@@ -1962,7 +1961,7 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSTableColumn" id="274341565">
<string key="NSIdentifier">track</string>
- <double key="NSWidth">3.140000e+02</double>
+ <double key="NSWidth">1.670000e+02</double>
<double key="NSMinWidth">4.000000e+01</double>
<double key="NSMaxWidth">1.000000e+03</double>
<object class="NSTableHeaderCell" key="NSHeaderCell">
@@ -2022,7 +2021,7 @@
</object>
<object class="NSTableColumn" id="1033748386">
<string key="NSIdentifier">forced</string>
- <double key="NSWidth">1.390000e+02</double>
+ <double key="NSWidth">7.500000e+01</double>
<double key="NSMinWidth">1.000000e+01</double>
<double key="NSMaxWidth">3.402823e+38</double>
<object class="NSTableHeaderCell" key="NSHeaderCell">
@@ -2060,7 +2059,7 @@
</object>
<object class="NSTableColumn" id="362209136">
<string key="NSIdentifier">burned</string>
- <double key="NSWidth">1.210000e+02</double>
+ <double key="NSWidth">6.500000e+01</double>
<double key="NSMinWidth">1.000000e+01</double>
<double key="NSMaxWidth">3.402823e+38</double>
<object class="NSTableHeaderCell" key="NSHeaderCell">
@@ -2093,7 +2092,7 @@
</object>
<object class="NSTableColumn" id="270619684">
<string key="NSIdentifier">default</string>
- <double key="NSWidth">1.140000e+02</double>
+ <double key="NSWidth">6.800000e+01</double>
<double key="NSMinWidth">1.000000e+01</double>
<double key="NSMaxWidth">3.402823e+38</double>
<object class="NSTableHeaderCell" key="NSHeaderCell">
@@ -2124,6 +2123,141 @@
<bool key="NSIsEditable">YES</bool>
<reference key="NSTableView" ref="587237088"/>
</object>
+ <object class="NSTableColumn" id="116912874">
+ <string key="NSIdentifier">srt_lang</string>
+ <double key="NSWidth">1.120000e+02</double>
+ <double key="NSMinWidth">1.000000e+01</double>
+ <double key="NSMaxWidth">3.402823e+38</double>
+ <object class="NSTableHeaderCell" key="NSHeaderCell">
+ <int key="NSCellFlags">75628032</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">Srt Language</string>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSBackgroundColor" ref="1045207104"/>
+ <reference key="NSTextColor" ref="188451177"/>
+ </object>
+ <object class="NSPopUpButtonCell" key="NSDataCell" id="688461412">
+ <int key="NSCellFlags">-2076049856</int>
+ <int key="NSCellFlags2">133120</int>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSControlView" ref="587237088"/>
+ <int key="NSButtonFlags">100679935</int>
+ <int key="NSButtonFlags2">129</int>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">400</int>
+ <int key="NSPeriodicInterval">75</int>
+ <object class="NSMenuItem" key="NSMenuItem" id="341659302">
+ <reference key="NSMenu" ref="808277525"/>
+ <string key="NSTitle">Pop Up</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <int key="NSState">1</int>
+ <reference key="NSOnImage" ref="447995298"/>
+ <reference key="NSMixedImage" ref="760317610"/>
+ <string key="NSAction">_popUpItemAction:</string>
+ <reference key="NSTarget" ref="688461412"/>
+ </object>
+ <bool key="NSMenuItemRespectAlignment">YES</bool>
+ <object class="NSMenu" key="NSMenu" id="808277525">
+ <string key="NSTitle">OtherViews</string>
+ <object class="NSMutableArray" key="NSMenuItems">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="341659302"/>
+ </object>
+ </object>
+ <int key="NSPreferredEdge">3</int>
+ <bool key="NSUsesItemFromMenu">YES</bool>
+ <bool key="NSAltersState">YES</bool>
+ <int key="NSArrowPosition">1</int>
+ </object>
+ <int key="NSResizingMask">3</int>
+ <bool key="NSIsResizeable">YES</bool>
+ <bool key="NSIsEditable">YES</bool>
+ <reference key="NSTableView" ref="587237088"/>
+ </object>
+ <object class="NSTableColumn" id="180322215">
+ <string key="NSIdentifier">srt_charcode</string>
+ <double key="NSWidth">1.230000e+02</double>
+ <double key="NSMinWidth">1.000000e+01</double>
+ <double key="NSMaxWidth">3.402823e+38</double>
+ <object class="NSTableHeaderCell" key="NSHeaderCell">
+ <int key="NSCellFlags">75628032</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">Srt Char Code</string>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSBackgroundColor" ref="1045207104"/>
+ <reference key="NSTextColor" ref="188451177"/>
+ </object>
+ <object class="NSPopUpButtonCell" key="NSDataCell" id="483232645">
+ <int key="NSCellFlags">-2076049856</int>
+ <int key="NSCellFlags2">133120</int>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSControlView" ref="587237088"/>
+ <int key="NSButtonFlags">100679935</int>
+ <int key="NSButtonFlags2">129</int>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">400</int>
+ <int key="NSPeriodicInterval">75</int>
+ <object class="NSMenuItem" key="NSMenuItem" id="66454705">
+ <reference key="NSMenu" ref="427130300"/>
+ <string key="NSTitle">Pop Up</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <int key="NSState">1</int>
+ <reference key="NSOnImage" ref="447995298"/>
+ <reference key="NSMixedImage" ref="760317610"/>
+ <string key="NSAction">_popUpItemAction:</string>
+ <reference key="NSTarget" ref="483232645"/>
+ </object>
+ <bool key="NSMenuItemRespectAlignment">YES</bool>
+ <object class="NSMenu" key="NSMenu" id="427130300">
+ <string key="NSTitle">OtherViews</string>
+ <object class="NSMutableArray" key="NSMenuItems">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="66454705"/>
+ </object>
+ </object>
+ <int key="NSPreferredEdge">3</int>
+ <bool key="NSUsesItemFromMenu">YES</bool>
+ <bool key="NSAltersState">YES</bool>
+ <int key="NSArrowPosition">1</int>
+ </object>
+ <int key="NSResizingMask">3</int>
+ <bool key="NSIsResizeable">YES</bool>
+ <bool key="NSIsEditable">YES</bool>
+ <reference key="NSTableView" ref="587237088"/>
+ </object>
+ <object class="NSTableColumn" id="526590234">
+ <string key="NSIdentifier">srt_offset</string>
+ <double key="NSWidth">6.900000e+01</double>
+ <double key="NSMinWidth">1.000000e+01</double>
+ <double key="NSMaxWidth">3.402823e+38</double>
+ <object class="NSTableHeaderCell" key="NSHeaderCell">
+ <int key="NSCellFlags">75628032</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">Srt Offset</string>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSBackgroundColor" ref="1045207104"/>
+ <reference key="NSTextColor" ref="188451177"/>
+ </object>
+ <object class="NSTextFieldCell" key="NSDataCell" id="43785715">
+ <int key="NSCellFlags">337772096</int>
+ <int key="NSCellFlags2">272630784</int>
+ <string key="NSContents">Text</string>
+ <reference key="NSSupport" ref="273283760"/>
+ <reference key="NSControlView" ref="587237088"/>
+ <reference key="NSBackgroundColor" ref="242973447"/>
+ <reference key="NSTextColor" ref="701609070"/>
+ </object>
+ <int key="NSResizingMask">3</int>
+ <bool key="NSIsResizeable">YES</bool>
+ <bool key="NSIsEditable">YES</bool>
+ <reference key="NSTableView" ref="587237088"/>
+ </object>
</object>
<double key="NSIntercellSpacingWidth">3.000000e+00</double>
<double key="NSIntercellSpacingHeight">2.000000e+00</double>
@@ -2148,9 +2282,8 @@
<bool key="NSAllowsTypeSelect">NO</bool>
</object>
</object>
- <string key="NSFrame">{{0, 17}, {700, 265}}</string>
+ <string key="NSFrame">{{0, 17}, {700, 252}}</string>
<reference key="NSSuperview" ref="596256174"/>
- <reference key="NSNextKeyView" ref="587237088"/>
<reference key="NSDocView" ref="587237088"/>
<object class="NSColor" key="NSBGColor" id="355843302">
<int key="NSColorSpace">6</int>
@@ -2189,16 +2322,14 @@
</object>
<string key="NSFrameSize">{700, 17}</string>
<reference key="NSSuperview" ref="596256174"/>
- <reference key="NSNextKeyView" ref="569585004"/>
<reference key="NSDocView" ref="569585004"/>
<reference key="NSBGColor" ref="355843302"/>
<int key="NScvFlags">4</int>
</object>
<reference ref="10217663"/>
</object>
- <string key="NSFrame">{{9, 7}, {700, 282}}</string>
+ <string key="NSFrame">{{9, 7}, {700, 269}}</string>
<reference key="NSSuperview" ref="756255803"/>
- <reference key="NSNextKeyView" ref="705918581"/>
<int key="NSsFlags">512</int>
<reference key="NSVScroller" ref="40751315"/>
<reference key="NSHScroller" ref="892147391"/>
@@ -2207,6 +2338,26 @@
<reference key="NSCornerView" ref="10217663"/>
<bytes key="NSScrollAmts">QSAAAEEgAABBmAAAQZgAAA</bytes>
</object>
+ <object class="NSButton" id="377401502">
+ <reference key="NSNextResponder" ref="756255803"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{16, 283}, {116, 16}}</string>
+ <reference key="NSSuperview" ref="756255803"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="206924163">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">134479872</int>
+ <string key="NSContents">Add External SRT ...</string>
+ <reference key="NSSupport" ref="22"/>
+ <reference key="NSControlView" ref="377401502"/>
+ <int key="NSButtonFlags">-2038284033</int>
+ <int key="NSButtonFlags2">129</int>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
</object>
<string key="NSFrame">{{10, 25}, {714, 305}}</string>
<reference key="NSSuperview" ref="712502892"/>
@@ -2746,7 +2897,7 @@
<object class="NSTextField" id="1023408378">
<reference key="NSNextResponder" ref="168918359"/>
<int key="NSvFlags">264</int>
- <string key="NSFrame">{{27, 440}, {47, 14}}</string>
+ <string key="NSFrame">{{27, 437}, {47, 17}}</string>
<reference key="NSSuperview" ref="168918359"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="834340599">
@@ -6317,6 +6468,22 @@
</object>
<int key="connectionID">5245</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">fBrowseSrtFileButton</string>
+ <reference key="source" ref="2258723"/>
+ <reference key="destination" ref="377401502"/>
+ </object>
+ <int key="connectionID">5248</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">browseImportSrtFile:</string>
+ <reference key="source" ref="2258723"/>
+ <reference key="destination" ref="377401502"/>
+ </object>
+ <int key="connectionID">5249</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -9433,6 +9600,7 @@
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="596256174"/>
+ <reference ref="377401502"/>
</object>
<reference key="parent" ref="799016137"/>
</object>
@@ -9467,6 +9635,9 @@
<reference ref="1033748386"/>
<reference ref="362209136"/>
<reference ref="270619684"/>
+ <reference ref="116912874"/>
+ <reference ref="180322215"/>
+ <reference ref="526590234"/>
</object>
<reference key="parent" ref="596256174"/>
</object>
@@ -9549,6 +9720,98 @@
<reference key="object" ref="569585004"/>
<reference key="parent" ref="596256174"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">5246</int>
+ <reference key="object" ref="377401502"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="206924163"/>
+ </object>
+ <reference key="parent" ref="756255803"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">5247</int>
+ <reference key="object" ref="206924163"/>
+ <reference key="parent" ref="377401502"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">5250</int>
+ <reference key="object" ref="116912874"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="688461412"/>
+ </object>
+ <reference key="parent" ref="587237088"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">5252</int>
+ <reference key="object" ref="180322215"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="483232645"/>
+ </object>
+ <reference key="parent" ref="587237088"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">5254</int>
+ <reference key="object" ref="526590234"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="43785715"/>
+ </object>
+ <reference key="parent" ref="587237088"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">5268</int>
+ <reference key="object" ref="688461412"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="808277525"/>
+ </object>
+ <reference key="parent" ref="116912874"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">5269</int>
+ <reference key="object" ref="808277525"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="341659302"/>
+ </object>
+ <reference key="parent" ref="688461412"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">5270</int>
+ <reference key="object" ref="341659302"/>
+ <reference key="parent" ref="808277525"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">5271</int>
+ <reference key="object" ref="483232645"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="427130300"/>
+ </object>
+ <reference key="parent" ref="180322215"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">5272</int>
+ <reference key="object" ref="427130300"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="66454705"/>
+ </object>
+ <reference key="parent" ref="483232645"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">5273</int>
+ <reference key="object" ref="66454705"/>
+ <reference key="parent" ref="427130300"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">5278</int>
+ <reference key="object" ref="43785715"/>
+ <reference key="parent" ref="526590234"/>
+ </object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@@ -10297,6 +10560,18 @@
<string>5233.IBPluginDependency</string>
<string>5234.IBPluginDependency</string>
<string>5244.IBPluginDependency</string>
+ <string>5246.IBPluginDependency</string>
+ <string>5247.IBPluginDependency</string>
+ <string>5250.IBPluginDependency</string>
+ <string>5252.IBPluginDependency</string>
+ <string>5254.IBPluginDependency</string>
+ <string>5268.IBPluginDependency</string>
+ <string>5269.IBPluginDependency</string>
+ <string>5270.IBPluginDependency</string>
+ <string>5271.IBPluginDependency</string>
+ <string>5272.IBPluginDependency</string>
+ <string>5273.IBPluginDependency</string>
+ <string>5278.IBPluginDependency</string>
<string>56.IBPluginDependency</string>
<string>56.ImportedFromIB2</string>
<string>57.IBEditorWindowLastContentRect</string>
@@ -10645,9 +10920,9 @@
<reference ref="9"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
- <string>{{59, 306}, {760, 550}}</string>
+ <string>{{210, 306}, {760, 550}}</string>
<boolean value="YES"/>
- <string>{{59, 306}, {760, 550}}</string>
+ <string>{{210, 306}, {760, 550}}</string>
<reference ref="9"/>
<string>{{65, 541}, {760, 550}}</string>
<reference ref="6"/>
@@ -11085,6 +11360,18 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
<string>{{13, 672}, {235, 153}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -11120,7 +11407,7 @@
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">5245</int>
+ <int key="maxID">5278</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -11149,6 +11436,7 @@
<string>browseExportPresetFile:</string>
<string>browseFile:</string>
<string>browseImportPresetFile:</string>
+ <string>browseImportSrtFile:</string>
<string>browseSources:</string>
<string>calculateBitrate:</string>
<string>calculatePictureSizing:</string>
@@ -11241,6 +11529,7 @@
<string>id</string>
<string>id</string>
<string>id</string>
+ <string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="outlets">
@@ -11287,6 +11576,7 @@
<string>fAudTrack4Label</string>
<string>fAudTrack4MixPopUp</string>
<string>fAudTrack4RatePopUp</string>
+ <string>fBrowseSrtFileButton</string>
<string>fChapterTable</string>
<string>fCreateChapterMarkers</string>
<string>fDstBrowseButton</string>
@@ -11396,6 +11686,7 @@
<string>NSTextField</string>
<string>NSPopUpButton</string>
<string>NSPopUpButton</string>
+ <string>NSButton</string>
<string>NSTableView</string>
<string>NSButton</string>
<string>NSButton</string>
diff --git a/macosx/HBSubtitles.h b/macosx/HBSubtitles.h
index 990492db2..6cc55356b 100644
--- a/macosx/HBSubtitles.h
+++ b/macosx/HBSubtitles.h
@@ -7,11 +7,20 @@
#import <Cocoa/Cocoa.h>
#include "hb.h"
+
+
+
@interface HBSubtitles : NSObject {
hb_title_t *fTitle;
-NSMutableArray *subtitleArray;
+NSMutableArray *subtitleArray; // contains the output subtitle track info
+NSMutableArray *subtitleSourceArray;// contains the source subtitle track info
+NSMutableArray *languagesArray; // array of languages taken from lang.c
+int languagesArrayDefIndex;
+NSMutableArray *charCodeArray; // array of character codes
+int charCodeArrayDefIndex;
int container;
+
}
// Trigger a refresh of data
@@ -21,6 +30,8 @@ int container;
- (void)addSubtitleTrack;
- (NSDictionary *)createSubtitleTrack;
- (NSMutableArray*) getSubtitleArray: (NSMutableArray *) subtitlesArray ;
+// Add an srt file
+- (void)createSubtitleSrtTrack:(NSString *)filePath;
- (void)containerChanged:(int) newContainer;
diff --git a/macosx/HBSubtitles.m b/macosx/HBSubtitles.m
index 9c4a630e5..3d3b3476b 100644
--- a/macosx/HBSubtitles.m
+++ b/macosx/HBSubtitles.m
@@ -8,6 +8,13 @@
#import "HBSubtitles.h"
#include "hb.h"
+
+
+
+
+
+
+
@implementation HBSubtitles
- (id)init
{
@@ -17,6 +24,236 @@
fTitle = NULL;
}
+ /* setup our array of languages */
+ languagesArray = [[NSMutableArray alloc] init];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Any",@"und",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Afar",@"aar",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Abkhazian",@"abk",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Afrikaans",@"afr",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Akan",@"ak",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Albanian",@"sqi",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Amharic",@"amh",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Arabic",@"ara",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Aragonese",@"arg",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Armenian",@"hye",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Assamese",@"asm",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Avaric",@"ava",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Avestan",@"ave",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Aymara",@"aym",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Azerbaijani",@"aze",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Bashkir",@"bak",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Bambara",@"bam",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Basque",@"eus",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Belarusian",@"bel",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Bengali",@"ben",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Bihari",@"bih",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Bislama",@"bis",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Bosnian",@"bos",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Breton",@"bre",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Bulgarian",@"bul",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Burmese",@"mya",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Catalan",@"cat",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Chamorro",@"cha",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Chechen",@"che",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Chinese",@"zho",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Church Slavic",@"chu",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Chuvash",@"chv",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Cornish",@"cor",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Corsican",@"cos",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Cree",@"cre",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Czech",@"ces",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Danish",@"dan",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Divehi",@"div",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Dutch",@"nld",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Dzongkha",@"dzo",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"English",@"eng",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Esperanto",@"epo",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Estonian",@"est",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Ewe",@"ewe",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Faroese",@"fao",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Fijian",@"fij",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Finnish",@"fin",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"French",@"fra",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Western Frisian",@"fry",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Fulah",@"ful",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Georgian",@"kat",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"German",@"deu",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Gaelic (Scots)",@"gla",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Irish",@"gle",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Galician",@"glg",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Manx",@"glv",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Greek, Modern",@"ell",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Guarani",@"grn",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Gujarati",@"guj",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Haitian",@"hat",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Hausa",@"hau",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Hebrew",@"heb",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Herero",@"her",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Hindi",@"hin",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Hiri Motu",@"hmo",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Hungarian",@"hun",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Igbo",@"ibo",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Icelandic",@"isl",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Ido",@"ido",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Sichuan Yi",@"iii",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Inuktitut",@"iku",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Interlingue",@"ile",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Interlingua",@"ina",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Indonesian",@"ind",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Inupiaq",@"ipk",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Italian",@"ita",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Javanese",@"jav",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Japanese",@"jpn",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Kalaallisut (Greenlandic)",@"kal",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Kannada",@"kan",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Kashmiri",@"kas",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Kanuri",@"kau",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Kazakh",@"kaz",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Central Khmer",@"khm",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Kikuyu",@"kik",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Kinyarwanda",@"kin",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Kirghiz",@"kir",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Komi",@"kom",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Kongo",@"kon",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Korean",@"kor",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Kuanyama",@"kua",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Kurdish",@"kur",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Lao",@"lao",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Latin",@"lat",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Latvian",@"lav",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Limburgan",@"lim",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Lingala",@"lin",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Lithuanian",@"lit",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Luxembourgish",@"ltz",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Luba-Katanga",@"lub",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Ganda",@"lug",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Macedonian",@"mkd",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Marshallese",@"mah",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Malayalam",@"mal",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Maori",@"mri",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Marathi",@"mar",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Malay",@"msa",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Malagasy",@"mlg",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Maltese",@"mlt",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Moldavian",@"mol",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Mongolian",@"mon",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Nauru",@"nau",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Navajo",@"nav",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Ndebele, South",@"nbl",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Ndebele, North",@"nde",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Ndonga",@"ndo",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Nepali",@"nep",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Norwegian Nynorsk",@"nno",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Norwegian Bokmål",@"nob",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Norwegian",@"nor",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Chichewa; Nyanja",@"nya",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Occitan (post 1500); Provençal",@"oci",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Ojibwa",@"oji",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Oriya",@"ori",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Oromo",@"orm",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Ossetian; Ossetic",@"und",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Panjabi",@"pan",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Persian",@"fas",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Pali",@"pli",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Portuguese",@"por",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Pushto",@"pus",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Quechua",@"que",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Romansh",@"roh",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Romanian",@"ron",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Rundi",@"run",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Russian",@"rus",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Sango",@"sag",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Sanskrit",@"san",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Serbian",@"srp",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Croatian",@"hrv",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Sinhala",@"sin",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Slovak",@"slk",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Slovenian",@"slv",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Northern Sami",@"sme",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Samoan",@"smo",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Shona",@"sna",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Sindhi",@"snd",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Somali",@"som",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Sotho, Southern",@"sot",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Spanish",@"spa",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Sardinian",@"srd",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Swati",@"ssw",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Sundanese",@"sun",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Swahili",@"swa",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Swedish",@"swe",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Tahitian",@"tah",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Tamil",@"tam",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Tatar",@"tat",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Telugu",@"tel",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Tajik",@"tgk",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Tagalog",@"tgl",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Thai",@"tha",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Tibetan",@"bod",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Tigrinya",@"tir",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Tonga (Tonga Islands)",@"ton",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Tswana",@"tsn",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Tsonga",@"tso",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Turkmen",@"tuk",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Turkish",@"tur",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Twi",@"twi",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Uighur",@"uig",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Ukrainian",@"ukr",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Urdu",@"urd",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Uzbek",@"uzb",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Venda",@"ven",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Vietnamese",@"vie",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Volapük",@"vol",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Welsh",@"cym",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Walloon",@"wln",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Wolof",@"wol",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Xhosa",@"xho",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Yiddish",@"yid",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Yoruba",@"yor",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"ZhuangZhuang",@"zha",nil]];
+ [languagesArray addObject:[NSArray arrayWithObjects:@"Zulu",@"zul",nil]];
+
+ languagesArrayDefIndex = 40;
+
+ /* populate the charCodeArray */
+ charCodeArray = [[NSMutableArray alloc] init];
+ [charCodeArray addObject:@"ANSI_X3.4-1968"];
+ [charCodeArray addObject:@"ANSI_X3.4-1986"];
+ [charCodeArray addObject:@"ANSI_X3.4"];
+ [charCodeArray addObject:@"ANSI_X3.110-1983"];
+ [charCodeArray addObject:@"ANSI_X3.110"];
+ [charCodeArray addObject:@"ASCII"];
+ [charCodeArray addObject:@"ECMA-114"];
+ [charCodeArray addObject:@"ECMA-118"];
+ [charCodeArray addObject:@"ECMA-128"];
+ [charCodeArray addObject:@"ECMA-CYRILLIC"];
+ [charCodeArray addObject:@"IEC_P27-1"];
+ [charCodeArray addObject:@"ISO-8859-1"];
+ [charCodeArray addObject:@"ISO-8859-2"];
+ [charCodeArray addObject:@"ISO-8859-3"];
+ [charCodeArray addObject:@"ISO-8859-4"];
+ [charCodeArray addObject:@"ISO-8859-5"];
+ [charCodeArray addObject:@"ISO-8859-6"];
+ [charCodeArray addObject:@"ISO-8859-7"];
+ [charCodeArray addObject:@"ISO-8859-8"];
+ [charCodeArray addObject:@"ISO-8859-9"];
+ [charCodeArray addObject:@"ISO-8859-9E"];
+ [charCodeArray addObject:@"ISO-8859-10"];
+ [charCodeArray addObject:@"ISO-8859-11"];
+ [charCodeArray addObject:@"ISO-8859-13"];
+ [charCodeArray addObject:@"ISO-8859-14"];
+ [charCodeArray addObject:@"ISO-8859-15"];
+ [charCodeArray addObject:@"ISO-8859-16"];
+ [charCodeArray addObject:@"UTF-7"];
+ [charCodeArray addObject:@"UTF-8"];
+ [charCodeArray addObject:@"UTF-16"];
+ [charCodeArray addObject:@"UTF-16LE"];
+ [charCodeArray addObject:@"UTF-16BE"];
+ [charCodeArray addObject:@"UTF-32"];
+ [charCodeArray addObject:@"UTF-32LE"];
+ [charCodeArray addObject:@"UTF-32BE"];
+
+ charCodeArrayDefIndex = 11;
+
return self;
}
@@ -30,6 +267,56 @@
return;
}
+ /* reset the subtitle source array */
+ if (subtitleSourceArray)
+ {
+ [subtitleSourceArray release];
+ }
+ subtitleSourceArray = [[NSMutableArray alloc] init];
+
+ /* now populate the array with the source subtitle track info */
+ if (fTitle)
+ {
+ hb_subtitle_t *subtitle;
+ hb_subtitle_config_t sub_config;
+ int i;
+ for(i = 0; i < hb_list_count( fTitle->list_subtitle ); i++ )
+ {
+ NSString * trackTypeString = @"";
+ int isPictureSub = 0;
+ subtitle = (hb_subtitle_t *) hb_list_item( fTitle->list_subtitle, i );
+ sub_config = subtitle->config;
+
+ if (subtitle->format == PICTURESUB)
+ {
+ trackTypeString = @"- (Bitmap)";
+ isPictureSub = 0;
+ }
+ else
+ {
+ trackTypeString = @"- (Text)";
+ }
+
+ /* create a dictionary of source subtitle information to store in our array */
+ NSString *popupName = [NSString stringWithFormat:@"%d - %@ %@",i,[NSString stringWithUTF8String:subtitle->lang],trackTypeString];
+ NSMutableDictionary *newSubtitleSourceTrack = [[NSMutableDictionary alloc] init];
+ /* Subtitle Source track popup index */
+ [newSubtitleSourceTrack setObject:[NSNumber numberWithInt:i] forKey:@"sourceTrackNum"];
+ /* Subtitle Source track type */
+ [newSubtitleSourceTrack setObject:popupName forKey:@"sourceTrackName"];
+ /* Subtitle Source track type (Source, Srt, etc.) */
+ [newSubtitleSourceTrack setObject:@"Source" forKey:@"sourceTrackType"];
+ /* Subtitle Source track popup isPictureSub */
+ [newSubtitleSourceTrack setObject:[NSNumber numberWithInt:isPictureSub] forKey:@"sourceTrackisPictureSub"];
+
+ [subtitleSourceArray addObject:newSubtitleSourceTrack];
+ [newSubtitleSourceTrack autorelease];
+ }
+ }
+
+
+
+ /* reset the subtitle output array */
if (subtitleArray)
{
[subtitleArray release];
@@ -67,11 +354,76 @@
return newSubtitleTrack;
}
+- (void)createSubtitleSrtTrack:(NSString *)filePath
+{
+ /* Create a new entry for the subtitle source array so it shows up in our subtitle source list */
+ NSString *displayname = [filePath lastPathComponent];// grok an appropriate display name from the srt subtitle */
+ /* create a dictionary of source subtitle information to store in our array */
+ NSMutableDictionary *newSubtitleSourceTrack = [[NSMutableDictionary alloc] init];
+ /* Subtitle Source track popup index */
+ [newSubtitleSourceTrack setObject:[NSNumber numberWithInt:[subtitleSourceArray count]+1] forKey:@"sourceTrackNum"];
+ /* Subtitle Source track type */
+ [newSubtitleSourceTrack setObject:displayname forKey:@"sourceTrackName"];
+ /* Subtitle Source track type (Source, Srt, etc.) */
+ [newSubtitleSourceTrack setObject:@"SRT" forKey:@"sourceTrackType"];
+ /* Subtitle Source track type */
+ [newSubtitleSourceTrack setObject:filePath forKey:@"sourceSrtFilePath"];
+ /* Subtitle Source track popup isPictureSub */
+ [newSubtitleSourceTrack setObject:[NSNumber numberWithInt:0] forKey:@"sourceTrackisPictureSub"];
+
+ [subtitleSourceArray addObject:newSubtitleSourceTrack];
+ [newSubtitleSourceTrack autorelease];
+
+ /* Now create a new srt subtitle dictionary assuming the user wants to add it to their list
+ * Note: the subtitle array always has last entry for "None", so we need to replace its
+ * position in the array and tack a "None" track back on the end of the list */
+ [subtitleArray removeObjectAtIndex:[subtitleArray count] - 1];
+
+
+ NSMutableDictionary *newSubtitleSrtTrack = [[NSMutableDictionary alloc] init];
+ /* Subtitle Source track popup index */
+ if ([subtitleArray count] == 0) // we now have an empty array so this will be our first track
+ {
+ [newSubtitleSrtTrack setObject:[NSNumber numberWithInt:[subtitleSourceArray count] + 1] forKey:@"subtitleSourceTrackNum"];
+ }
+ else
+ {
+ [newSubtitleSrtTrack setObject:[NSNumber numberWithInt:[subtitleSourceArray count]] forKey:@"subtitleSourceTrackNum"];
+ }
+ /* Subtitle Source track popup language */
+ [newSubtitleSrtTrack setObject:displayname forKey:@"subtitleSourceTrackName"];
+ /* Subtitle Source track popup isPictureSub */
+ [newSubtitleSrtTrack setObject:[NSNumber numberWithInt:0] forKey:@"subtitleSourceTrackisPictureSub"];
+ /* Subtitle track forced state */
+ [newSubtitleSrtTrack setObject:[NSNumber numberWithInt:0] forKey:@"subtitleTrackForced"];
+ /* Subtitle track burned state */
+ [newSubtitleSrtTrack setObject:[NSNumber numberWithInt:0] forKey:@"subtitleTrackBurned"];
+ /* Subtitle track default state */
+ [newSubtitleSrtTrack setObject:[NSNumber numberWithInt:0] forKey:@"subtitleTrackDefault"];
+
+ /* now the srt only info, Language, Chart Code and offset */
+ [newSubtitleSrtTrack setObject:filePath forKey:@"subtitleSourceSrtFilePath"];
+ [newSubtitleSrtTrack setObject:[NSNumber numberWithInt:languagesArrayDefIndex] forKey:@"subtitleTrackSrtLanguageIndex"];
+ [newSubtitleSrtTrack setObject:[[languagesArray objectAtIndex:languagesArrayDefIndex] objectAtIndex:0] forKey:@"subtitleTrackSrtLanguageLong"];
+ [newSubtitleSrtTrack setObject:[[languagesArray objectAtIndex:languagesArrayDefIndex] objectAtIndex:1] forKey:@"subtitleTrackSrtLanguageIso3"];
+
+ [newSubtitleSrtTrack setObject:[NSNumber numberWithInt:charCodeArrayDefIndex] forKey:@"subtitleTrackSrtCharCodeIndex"];
+ [newSubtitleSrtTrack setObject:[charCodeArray objectAtIndex:charCodeArrayDefIndex] forKey:@"subtitleTrackSrtCharCode"];
+
+ [newSubtitleSrtTrack setObject:[NSNumber numberWithInt:0] forKey:@"subtitleTrackSrtOffset"];
+
+
+ [subtitleArray addObject:newSubtitleSrtTrack];
+ [newSubtitleSrtTrack release];
+
+ /* now add back the none track to the end of the array */
+ [self addSubtitleTrack];
+
+
+}
+
- (NSMutableArray*) getSubtitleArray: (NSMutableArray *) subtitlesArray
{
- //NSMutableArray *returnSubtitlesArray = [[NSMutableArray alloc] init];
- //[returnSubtitlesArray initWithArray:subtitleArray];
- //[returnSubtitlesArray autorelease];
return subtitleArray;
}
@@ -109,16 +461,9 @@ container = newContainer;
if ([[aTableColumn identifier] isEqualToString:@"track"])
{
/* 'track' is a popup of all available source subtitle tracks for the given title */
-
-
NSPopUpButtonCell *cellTrackPopup = [[NSPopUpButtonCell alloc] init];
[cellTrackPopup autorelease];
/* Set the Popups properties */
- /* Following two lines can be used to show kind of a text field with indicator arrows which
- * will popup when clicked on. Comment out for a standard style popup */
- //[cellTrackPopup setShowsBorderOnlyWhileMouseInside:YES];
- //[cellTrackPopup setBordered:NO];
-
[cellTrackPopup setControlSize:NSSmallControlSize];
[cellTrackPopup setFont:[NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSSmallControlSize]]];
@@ -134,71 +479,97 @@ container = newContainer;
[[cellTrackPopup menu] addItemWithTitle: @"Foreign Audio Search - (Bitmap)" action: NULL keyEquivalent: @""];
}
- if (fTitle)
+ int i;
+ for(i = 0; i < [subtitleSourceArray count]; i++ )
{
- hb_subtitle_t *subtitle;
- hb_subtitle_config_t sub_config;
- int i;
- for(i = 0; i < hb_list_count( fTitle->list_subtitle ); i++ )
- {
- NSString * trackTypeString = @"";
- subtitle = (hb_subtitle_t *) hb_list_item( fTitle->list_subtitle, i );
- sub_config = subtitle->config;
-
- if (subtitle->format == PICTURESUB)
- {
- trackTypeString = @"- (Bitmap)";
- }
- else
- {
- trackTypeString = @"- (Text)";
- }
-
-
- NSString *popupMenuItemDescription = [NSString stringWithFormat:@"%d - %@ %@",i,[NSString stringWithUTF8String:subtitle->lang],trackTypeString];
-
- [[cellTrackPopup menu] addItemWithTitle: popupMenuItemDescription action: NULL keyEquivalent: @""];
- }
+ [[cellTrackPopup menu] addItemWithTitle: [[subtitleSourceArray objectAtIndex:i] objectForKey: @"sourceTrackName"] action: NULL keyEquivalent: @""];
}
+
[aTableColumn setDataCell:cellTrackPopup];
}
else if ([[aTableColumn identifier] isEqualToString:@"forced"])
{
- /* 'forced' is a checkbox to determine if a given source track is only to be forced */
- NSButtonCell *cellForcedCheckBox = [[NSButtonCell alloc] init];
- [cellForcedCheckBox autorelease];
- [cellForcedCheckBox setButtonType:NSSwitchButton];
- [cellForcedCheckBox setImagePosition:NSImageOnly];
- [cellForcedCheckBox setAllowsMixedState:NO];
- [aTableColumn setDataCell:cellForcedCheckBox];
-
+ /* 'forced' is a checkbox to determine if a given source track is only to be forced */
+ NSButtonCell *cellForcedCheckBox = [[NSButtonCell alloc] init];
+ [cellForcedCheckBox autorelease];
+ [cellForcedCheckBox setButtonType:NSSwitchButton];
+ [cellForcedCheckBox setImagePosition:NSImageOnly];
+ [cellForcedCheckBox setAllowsMixedState:NO];
+ [aTableColumn setDataCell:cellForcedCheckBox];
+
}
else if ([[aTableColumn identifier] isEqualToString:@"burned"])
{
- /* 'burned' is a checkbox to determine if a given source track is only to be burned */
- NSButtonCell *cellBurnedCheckBox = [[NSButtonCell alloc] init];
- [cellBurnedCheckBox autorelease];
- [cellBurnedCheckBox setButtonType:NSSwitchButton];
- [cellBurnedCheckBox setImagePosition:NSImageOnly];
- [cellBurnedCheckBox setAllowsMixedState:NO];
- [aTableColumn setDataCell:cellBurnedCheckBox];
+ /* 'burned' is a checkbox to determine if a given source track is only to be burned */
+ NSButtonCell *cellBurnedCheckBox = [[NSButtonCell alloc] init];
+ [cellBurnedCheckBox autorelease];
+ [cellBurnedCheckBox setButtonType:NSSwitchButton];
+ [cellBurnedCheckBox setImagePosition:NSImageOnly];
+ [cellBurnedCheckBox setAllowsMixedState:NO];
+ [aTableColumn setDataCell:cellBurnedCheckBox];
}
else if ([[aTableColumn identifier] isEqualToString:@"default"])
{
- NSButtonCell *cellDefaultCheckBox = [[NSButtonCell alloc] init];
- [cellDefaultCheckBox autorelease];
- [cellDefaultCheckBox setButtonType:NSSwitchButton];
- [cellDefaultCheckBox setImagePosition:NSImageOnly];
- [cellDefaultCheckBox setAllowsMixedState:NO];
- [aTableColumn setDataCell:cellDefaultCheckBox];
+ NSButtonCell *cellDefaultCheckBox = [[NSButtonCell alloc] init];
+ [cellDefaultCheckBox autorelease];
+ [cellDefaultCheckBox setButtonType:NSSwitchButton];
+ [cellDefaultCheckBox setImagePosition:NSImageOnly];
+ [cellDefaultCheckBox setAllowsMixedState:NO];
+ [aTableColumn setDataCell:cellDefaultCheckBox];
+ }
+ /* These next three columns only apply to srt's. they are disabled for source subs */
+ else if ([[aTableColumn identifier] isEqualToString:@"srt_lang"])
+ {
+ /* 'srt_lang' is a popup of commonly used languages to be matched to the source srt file */
+ NSPopUpButtonCell *cellSrtLangPopup = [[NSPopUpButtonCell alloc] init];
+ [cellSrtLangPopup autorelease];
+ /* Set the Popups properties */
+ [cellSrtLangPopup setControlSize:NSSmallControlSize];
+ [cellSrtLangPopup setFont:[NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSSmallControlSize]]];
+ /* list our languages as per the languagesArray */
+ int i;
+ for(i = 0; i < [languagesArray count]; i++ )
+ {
+ [[cellSrtLangPopup menu] addItemWithTitle: [[languagesArray objectAtIndex:i] objectAtIndex:0] action: NULL keyEquivalent: @""];
+ }
+ [aTableColumn setDataCell:cellSrtLangPopup];
+ }
+ else if ([[aTableColumn identifier] isEqualToString:@"srt_charcode"])
+ {
+ /* 'srt_charcode' is a popup of commonly used character codes to be matched to the source srt file */
+ NSPopUpButtonCell *cellSrtCharCodePopup = [[NSPopUpButtonCell alloc] init];
+ [cellSrtCharCodePopup autorelease];
+ /* Set the Popups properties */
+ [cellSrtCharCodePopup setControlSize:NSSmallControlSize];
+ [cellSrtCharCodePopup setFont:[NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSSmallControlSize]]];
+ /* list our character codes, as per charCodeArray */
+
+ int i;
+ for(i = 0; i < [charCodeArray count]; i++ )
+ {
+ [[cellSrtCharCodePopup menu] addItemWithTitle: [charCodeArray objectAtIndex:i] action: NULL keyEquivalent: @""];
+ }
+ [aTableColumn setDataCell:cellSrtCharCodePopup];
+
+ }
+ else if ([[aTableColumn identifier] isEqualToString:@"srt_offset"])
+ {
+ if ([[subtitleArray objectAtIndex:rowIndex] objectForKey:@"subtitleTrackSrtOffset"])
+ {
+ cellEntry = [NSString stringWithFormat:@"%d",[[[subtitleArray objectAtIndex:rowIndex] objectForKey:@"subtitleTrackSrtOffset"] intValue]];
+ }
+ else
+ {
+ cellEntry = [NSString stringWithFormat:@"%d",0];
+ }
}
else
{
- cellEntry = nil;
+ cellEntry = nil;
}
-
+
return cellEntry;
}
@@ -215,6 +586,7 @@ container = newContainer;
{
int sourceSubtitleIndex;
bool isPictureSub = FALSE;
+
if (rowIndex == 0)
{
sourceSubtitleIndex = [anObject intValue] - 2;
@@ -230,11 +602,7 @@ container = newContainer;
}
else
{
- hb_subtitle_t * subtitle;
- hb_subtitle_config_t sub_config;
- subtitle = (hb_subtitle_t *) hb_list_item( fTitle->list_subtitle, sourceSubtitleIndex );
- sub_config = subtitle->config;
- if (subtitle->format == PICTURESUB)
+ if ([[[subtitleSourceArray objectAtIndex:sourceSubtitleIndex] objectForKey:@"sourceTrackisPictureSub"] intValue] ==1)
{
isPictureSub = TRUE;
}
@@ -249,8 +617,28 @@ container = newContainer;
/* if we are not picture sub, then we must be a text sub, handbrake does not support burning in text subs */
[[subtitleArray objectAtIndex:rowIndex] setObject:[NSNumber numberWithInt:0] forKey:@"subtitleTrackBurned"];
}
+
+ /* check to see if we are an srt, in which case set our file path and source track type kvp's*/
+
+ if (rowIndex == 0 && [anObject intValue] == 1) // we are foreign lang search
+ {
+ [[subtitleArray objectAtIndex:rowIndex] setObject:@"Source" forKey:@"subtitleSourceTrackType"];
+ }
+ else
+ {
+ if ([[[subtitleSourceArray objectAtIndex:sourceSubtitleIndex] objectForKey:@"sourceTrackType"] isEqualToString:@"SRT"])
+ {
+ [[subtitleArray objectAtIndex:rowIndex] setObject:@"SRT" forKey:@"subtitleSourceTrackType"];
+ [[subtitleArray objectAtIndex:rowIndex] setObject:[[subtitleSourceArray objectAtIndex:sourceSubtitleIndex] objectForKey:@"sourceSrtFilePath"] forKey:@"subtitleSourceSrtFilePath"];
+ }
+ else
+ {
+ [[subtitleArray objectAtIndex:rowIndex] setObject:@"Source" forKey:@"subtitleSourceTrackType"];
+ }
+ }
+
}
- }
+ }
else if ([[aTableColumn identifier] isEqualToString:@"forced"])
{
[[subtitleArray objectAtIndex:rowIndex] setObject:[NSNumber numberWithInt:[anObject intValue]] forKey:@"subtitleTrackForced"];
@@ -270,7 +658,7 @@ container = newContainer;
{
[tempObject setObject:[NSNumber numberWithInt:0] forKey:@"subtitleTrackBurned"];
}
- i++;
+ i++;
}
}
}
@@ -289,17 +677,36 @@ container = newContainer;
{
[tempObject setObject:[NSNumber numberWithInt:0] forKey:@"subtitleTrackDefault"];
}
- i++;
+ i++;
}
}
}
+ /* These next three columns only apply to srt's. they are disabled for source subs */
+ else if ([[aTableColumn identifier] isEqualToString:@"srt_lang"])
+ {
+
+ [[subtitleArray objectAtIndex:rowIndex] setObject:[NSNumber numberWithInt:[anObject intValue]] forKey:@"subtitleTrackSrtLanguageIndex"];
+ [[subtitleArray objectAtIndex:rowIndex] setObject:[[languagesArray objectAtIndex:[anObject intValue]] objectAtIndex:0] forKey:@"subtitleTrackSrtLanguageLong"];
+ [[subtitleArray objectAtIndex:rowIndex] setObject:[[languagesArray objectAtIndex:[anObject intValue]] objectAtIndex:1] forKey:@"subtitleTrackSrtLanguageIso3"];
+
+ }
+ else if ([[aTableColumn identifier] isEqualToString:@"srt_charcode"])
+ {
+ /* charCodeArray */
+ [[subtitleArray objectAtIndex:rowIndex] setObject:[NSNumber numberWithInt:[anObject intValue]] forKey:@"subtitleTrackSrtCharCodeIndex"];
+ [[subtitleArray objectAtIndex:rowIndex] setObject:[charCodeArray objectAtIndex:[anObject intValue]] forKey:@"subtitleTrackSrtCharCode"];
+ }
+ else if ([[aTableColumn identifier] isEqualToString:@"srt_offset"])
+ {
+ [[subtitleArray objectAtIndex:rowIndex] setObject:anObject forKey:@"subtitleTrackSrtOffset"];
+ }
/* now lets do a bit of logic to add / remove tracks as necessary via the "None" track (index 0) */
if ([[aTableColumn identifier] isEqualToString:@"track"])
{
-
+
/* since mp4 only supports burned in vobsubs (bitmap) we need to make sure burned in is specified */
if (container == HB_MUX_MP4 && [anObject intValue] != 0)
{
@@ -311,15 +718,16 @@ container = newContainer;
}
}
-
- /* We use the track popup index number (presumes index 0 is "None" which is ignored and only used to remove tracks if need be)
+
+ /* We use the track popup index number (presumes index 0 is "None" which is ignored and only used to remove tracks if need be)
* to determine whether to 1 modify an existing track, 2. add a new empty "None" track or 3. remove an existing track.
*/
-
+
if ([anObject intValue] != 0 && rowIndex == [subtitleArray count] - 1) // if we have a last track which != "None"
{
/* add a new empty None track */
[self addSubtitleTrack];
+
}
else if ([anObject intValue] == 0 && rowIndex != ([subtitleArray count] -1))// if this track is set to "None" and not the last track displayed
{
@@ -333,8 +741,8 @@ container = newContainer;
/* increment the index of the subtitle menu item by one, to account for Foreign Language Search which is unique to the first track */
[[subtitleArray objectAtIndex: 1] setObject:[NSNumber numberWithInt:trackOneSelectedIndex + 1] forKey:@"subtitleSourceTrackNum"];
}
- /* now that we have made the adjustment for track one (index 0) go ahead and delete the track */
- [subtitleArray removeObjectAtIndex: rowIndex];
+ /* now that we have made the adjustment for track one (index 0) go ahead and delete the track */
+ [subtitleArray removeObjectAtIndex: rowIndex];
}
@@ -375,7 +783,17 @@ container = newContainer;
if ([[aTableColumn identifier] isEqualToString:@"forced"])
{
+ if ([[[subtitleArray objectAtIndex:rowIndex] objectForKey:@"subtitleSourceTrackType"] isEqualToString:@"SRT"])
+ {
+ [aCell setState:0];
+ [[subtitleArray objectAtIndex:rowIndex] setObject:0 forKey:@"subtitleTrackForced"];
+ [aCell setEnabled:NO];
+ }
+ else
+ {
+ [aCell setEnabled:YES];
[aCell setState:[[[subtitleArray objectAtIndex:rowIndex] objectForKey:@"subtitleTrackForced"] intValue]];
+ }
}
else if ([[aTableColumn identifier] isEqualToString:@"burned"])
{
@@ -397,6 +815,64 @@ container = newContainer;
{
[aCell setState:[[[subtitleArray objectAtIndex:rowIndex] objectForKey:@"subtitleTrackDefault"] intValue]];
}
+ /* These next three columns only apply to srt's. they are disabled for source subs */
+ else if ([[aTableColumn identifier] isEqualToString:@"srt_lang"])
+ {
+ /* We have an srt file so set the track type (Source or SRT, and the srt file path ) kvp's*/
+ if ([[[subtitleArray objectAtIndex:rowIndex] objectForKey:@"subtitleSourceTrackType"] isEqualToString:@"SRT"])
+ {
+ [aCell setEnabled:YES];
+ if([[subtitleArray objectAtIndex:rowIndex] objectForKey:@"subtitleTrackSrtLanguageIndex"])
+ {
+ [aCell selectItemAtIndex:[[[subtitleArray objectAtIndex:rowIndex] objectForKey:@"subtitleTrackSrtLanguageIndex"] intValue]];
+ }
+ else
+ {
+ [aCell selectItemAtIndex:languagesArrayDefIndex]; // English
+ [[subtitleArray objectAtIndex:rowIndex] setObject:[NSNumber numberWithInt:languagesArrayDefIndex] forKey:@"subtitleTrackSrtLanguageIndex"];
+ [[subtitleArray objectAtIndex:rowIndex] setObject:[[languagesArray objectAtIndex:languagesArrayDefIndex] objectAtIndex:0] forKey:@"subtitleTrackSrtLanguageLong"];
+ [[subtitleArray objectAtIndex:rowIndex] setObject:[[languagesArray objectAtIndex:languagesArrayDefIndex] objectAtIndex:1] forKey:@"subtitleTrackSrtLanguageIso3"];
+
+ }
+ }
+ else
+ {
+ [aCell setEnabled:NO];
+ }
+ }
+ else if ([[aTableColumn identifier] isEqualToString:@"srt_charcode"])
+ {
+ /* We have an srt file so set the track type (Source or SRT, and the srt file path ) kvp's*/
+ if ([[[subtitleArray objectAtIndex:rowIndex] objectForKey:@"subtitleSourceTrackType"] isEqualToString:@"SRT"])
+ {
+ [aCell setEnabled:YES];
+ if ([[subtitleArray objectAtIndex:rowIndex] objectForKey:@"subtitleTrackSrtCharCodeIndex"])
+ {
+ [aCell selectItemAtIndex:[[[subtitleArray objectAtIndex:rowIndex] objectForKey:@"subtitleTrackSrtCharCodeIndex"] intValue]];
+ }
+ else
+ {
+ [aCell selectItemAtIndex:charCodeArrayDefIndex]; // ISO-8859-1
+ [[subtitleArray objectAtIndex:rowIndex] setObject:[NSNumber numberWithInt:charCodeArrayDefIndex] forKey:@"subtitleTrackSrtCharCodeIndex"];
+ [[subtitleArray objectAtIndex:rowIndex] setObject:[charCodeArray objectAtIndex:charCodeArrayDefIndex] forKey:@"subtitleTrackSrtCharCode"];
+ }
+ }
+ else
+ {
+ [aCell setEnabled:NO];
+ }
+ }
+ else if ([[aTableColumn identifier] isEqualToString:@"srt_offset"])
+ {
+ if ([[[subtitleArray objectAtIndex:rowIndex] objectForKey:@"subtitleSourceTrackType"] isEqualToString:@"SRT"])
+ {
+ [aCell setEnabled:YES];
+ }
+ else
+ {
+ [aCell setEnabled:NO];
+ }
+ }
}