}
[fSrcDVD2Field setStringValue:browsedSourceDisplayName];
+ // use the correct extension based on the container
+ int format = [fDstFormatPopUp indexOfSelectedItem];
+ char *ext = "mp4";
+ if (format == 1)
+ {
+ ext = "mkv";
+ }
+
/* If its a queue rescan for edit, get the queue item output path */
/* if not, its a new source scan. */
/* Check to see if the last destination has been set,use if so, if not, use Desktop */
else if ([[NSUserDefaults standardUserDefaults] stringForKey:@"LastDestinationDirectory"])
{
[fDstFile2Field setStringValue: [NSString stringWithFormat:
- @"%@/%@.mp4", [[NSUserDefaults standardUserDefaults] stringForKey:@"LastDestinationDirectory"],[browsedSourceDisplayName stringByDeletingPathExtension]]];
+ @"%@/%@.%s", [[NSUserDefaults standardUserDefaults] stringForKey:@"LastDestinationDirectory"],[browsedSourceDisplayName stringByDeletingPathExtension],ext]];
}
else
{
[fDstFile2Field setStringValue: [NSString stringWithFormat:
- @"%@/Desktop/%@.mp4", NSHomeDirectory(),[browsedSourceDisplayName stringByDeletingPathExtension]]];
+ @"%@/Desktop/%@.%s", NSHomeDirectory(),[browsedSourceDisplayName stringByDeletingPathExtension],ext]];
+ }
+
+ // set m4v extension if necessary - do not override user-specified .mp4 extension
+ if (format == 0 && applyQueueToScan != YES)
+ {
+ [self autoSetM4vExtension: sender];
}
/* See if this is the main feature according to libhb */
}
[fSrcTitlePopUp addItemWithTitle: [NSString
- stringWithFormat: @"%s %d - %02dh%02dm%02ds",
- title->name,title->index, title->hours, title->minutes,
+ stringWithFormat: @"%@ %d - %02dh%02dm%02ds",
+ currentSource, title->index, title->hours, title->minutes,
title->seconds]];
}
/* Set the queue status field in the main window */
NSMutableString * string;
- if (fPendingCount == 1)
+ if (fPendingCount == 0)
+ {
+ string = [NSMutableString stringWithFormat: NSLocalizedString( @"No encode pending", @"" )];
+ }
+ else if (fPendingCount == 1)
{
string = [NSMutableString stringWithFormat: NSLocalizedString( @"%d encode pending", @"" ), fPendingCount];
}
else
{
- string = [NSMutableString stringWithFormat: NSLocalizedString( @"%d encode(s) pending", @"" ), fPendingCount];
+ string = [NSMutableString stringWithFormat: NSLocalizedString( @"%d encodes pending", @"" ), fPendingCount];
}
[fQueueStatus setStringValue:string];
}
{
nextPendingFound = YES;
nextPendingIndex = [QueueFileArray indexOfObject: tempObject];
- [self writeToActivityLog: "getNextPendingQueueIndex next pending encod index is:%d", nextPendingIndex];
+ [self writeToActivityLog: "getNextPendingQueueIndex next pending encode index is:%d", nextPendingIndex];
}
i++;
}
[self writeToActivityLog: "scanning specifically for title: %d", scanTitleNum];
}
- /* We use our advance pref to determine how many previews to scan */
- int hb_num_previews = [[[NSUserDefaults standardUserDefaults] objectForKey:@"PreviewsNumber"] intValue];
- hb_scan( fQueueEncodeLibhb, [path UTF8String], scanTitleNum, hb_num_previews, 0 , 0 );
+ /* Only scan 10 previews before an encode - additional previews are only useful for autocrop and static previews,
+ * which are already taken care of at this point */
+ hb_scan( fQueueEncodeLibhb, [path UTF8String], scanTitleNum, 10, 0, 0 );
}
}
fqueueEditRescanItemNum = selectedQueueItem;
[self writeToActivityLog: "rescanQueueItemToMainWindow: Re-scanning queue item at index:%d",fqueueEditRescanItemNum];
applyQueueToScan = YES;
+ /* Make sure we release the display name before reassigning it */
+ [browsedSourceDisplayName release];
/* Set the browsedSourceDisplayName for showNewScan */
- browsedSourceDisplayName = [[QueueFileArray objectAtIndex:fqueueEditRescanItemNum] objectForKey:@"SourceName"];
+ browsedSourceDisplayName = [[[QueueFileArray objectAtIndex:fqueueEditRescanItemNum] objectForKey:@"SourceName"] retain];
[self performScan:scanPath scanTitleNum:scanTitleNum];
}
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);
+ strncpy(sub_config.src_filename, [[tempObject objectForKey:@"subtitleSourceSrtFilePath"] UTF8String], 255);
+ sub_config.src_filename[255] = 0;
+ strncpy(sub_config.src_codeset, [[tempObject objectForKey:@"subtitleTrackSrtCharCode"] UTF8String], 39);
+ sub_config.src_codeset[39] = 0;
sub_config.force = 0;
sub_config.dest = PASSTHRUSUB;
continue;
one_burned = TRUE;
}
+
+ /* Besides VOBSUBS we can also burn in SSA text subs */
+ if (subt->source == SSASUB && burned)
+ {
+ sub_config.dest = RENDERSUB;
+ }
+
sub_config.force = force;
sub_config.default_track = def;
hb_subtitle_add( job, &sub_config, subtitle );
{
sub_config.dest = PASSTHRUSUB;
}
- else if ( burned && subt->format == PICTURESUB )
+ else if ( burned )
{
// Only allow one subtitle to be burned into the video
if (one_burned)
continue;
one_burned = TRUE;
}
+
+ /* Besides VOBSUBS we can also burn in SSA text subs */
+ if (subt->source == SSASUB && burned)
+ {
+ sub_config.dest = RENDERSUB;
+ }
+
sub_config.force = force;
sub_config.default_track = def;
hb_subtitle_add( job, &sub_config, subtitle );
NSString *destinationDirectory = [[fDstFile2Field stringValue] stringByDeletingLastPathComponent];
[[NSUserDefaults standardUserDefaults] setObject:destinationDirectory forKey:@"LastDestinationDirectory"];
+ currentQueueEncodeIndex = [self getNextPendingQueueIndex];
[self performNewQueueScan:[[QueueFileArray objectAtIndex:currentQueueEncodeIndex] objectForKey:@"SourcePath"] scanTitleNum:[[[QueueFileArray objectAtIndex:currentQueueEncodeIndex] objectForKey:@"TitleNumber"]intValue]];
-
+
}
}
switch( format )
{
case 0:
- /*Get Default MP4 File Extension*/
- if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultMpegName"] > 0)
- {
- ext = "m4v";
- }
- else
- {
- ext = "mp4";
- }
+ [self autoSetM4vExtension: nil];
/* Add additional video encoders here */
menuItem = [[fVidEncoderPopUp menu] addItemWithTitle:@"H.264 (x264)" action: NULL keyEquivalent: @""];
[menuItem setTag: HB_VCODEC_X264];
{
if ( [fDstFormatPopUp indexOfSelectedItem] )
return;
-
+
NSString * extension = @"mp4";
-
- BOOL anyCodecAC3 = [fAudioDelegate anyCodecMatches: HB_ACODEC_AC3];
- if (YES == anyCodecAC3 ||
- [fCreateChapterMarkers state] == NSOnState ||
- [[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultMpegName"] > 0 )
+
+ BOOL anyCodecAC3 = [fAudioDelegate anyCodecMatches: HB_ACODEC_AC3] || [fAudioDelegate anyCodecMatches: HB_ACODEC_AC3_PASS];
+
+ if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"DefaultMpegExtension"] isEqualToString: @".m4v"] ||
+ ((YES == anyCodecAC3 || [fCreateChapterMarkers state] == NSOnState) &&
+ [[[NSUserDefaults standardUserDefaults] objectForKey:@"DefaultMpegExtension"] isEqualToString: @"Auto"] ))
{
extension = @"m4v";
}
-
+
if( [extension isEqualTo: [[fDstFile2Field stringValue] pathExtension]] )
return;
else
[fDstFile2Field setStringValue: [NSString stringWithFormat:@"%@.%@",
- [[fDstFile2Field stringValue] stringByDeletingPathExtension], extension]];
+ [[fDstFile2Field stringValue] stringByDeletingPathExtension], extension]];
}
/* Method to determine if we should change the UI
{
[fVidQualityRFField setStringValue: [NSString stringWithFormat: @"%.2f", sliderRfInverse]];
}
+ /* Show a warning if x264 and rf 0 which is lossless */
+ if ([[fVidEncoderPopUp selectedItem] tag] == HB_VCODEC_X264 && sliderRfInverse == 0.0)
+ {
+ [fVidQualityRFField setStringValue: [NSString stringWithFormat: @"%.2f (Warning: Lossless)", sliderRfInverse]];
+ }
+
[self customSettingUsed: sender];
}
#pragma mark -
+- (BOOL) hasValidPresetSelected
+
+{
+ return ([fPresetsOutlineView selectedRow] >= 0 && [[[fPresetsOutlineView itemAtRow:[fPresetsOutlineView selectedRow]] objectForKey:@"Folder"] intValue] != 1);
+}
+
+// This causes all audio tracks from the title to be used based on the current preset
+- (IBAction) addAllAudioTracks: (id) sender
+
+{
+ [fAudioDelegate addAllTracksFromPreset: [fPresetsOutlineView itemAtRow:[fPresetsOutlineView selectedRow]]];
+ return;
+}
+
- (IBAction) browseImportSrtFile: (id) sender
{
//}
}
+- (void) outlineViewSelectionDidChange: (NSNotification *) ignored
+
+{
+ [self willChangeValueForKey: @"hasValidPresetSelected"];
+ [self didChangeValueForKey: @"hasValidPresetSelected"];
+ return;
+}
+
#pragma mark -
#pragma mark Preset Outline View Methods (dragging related)
- (IBAction)selectPreset:(id)sender
{
- if ([fPresetsOutlineView selectedRow] >= 0 && [[[fPresetsOutlineView itemAtRow:[fPresetsOutlineView selectedRow]] objectForKey:@"Folder"] intValue] != 1)
+ if (YES == [self hasValidPresetSelected])
{
chosenPreset = [fPresetsOutlineView itemAtRow:[fPresetsOutlineView selectedRow]];
[fPresetSelectedDisplay setStringValue:[chosenPreset objectForKey:@"PresetName"]];
/* now get and add selected presets to export */
}
- if ([fPresetsOutlineView selectedRow] >= 0 && [[[fPresetsOutlineView itemAtRow:[fPresetsOutlineView selectedRow]] objectForKey:@"Folder"] intValue] != 1)
+ if (YES == [self hasValidPresetSelected])
{
[presetsToExport addObject:[fPresetsOutlineView itemAtRow:[fPresetsOutlineView selectedRow]]];
[presetsToExport writeToFile:exportPresetsFile atomically:YES];