crf = job->crf;
if (job->x264opts)
x264opts = [[NSString stringWithUTF8String:job->x264opts] retain];
- memcpy(audio_mixdowns, job->audio_mixdowns, sizeof(audio_mixdowns));
- acodec = job->acodec;
- abitrate = job->abitrate;
- arate = job->arate;
+ /* So, with the advent of job->list_audio's I decided why not just use an NSString and concatanate
+ all of the info we need for all of the audio values to display right into an NSString here ? So I
+ did. I have no idea why we are reading libhb stuff just to display it in the queue gui. So here we
+ are with a huge string. But its easy to change and saves alot of messing about. Maybe we move a bunch
+ of other display stuff into strings for display for each job. It's not like they have to actually do
+ anything.*/
+ hb_audio_config_t * audio;
+ NSString * thisJobAudioCodecs = [NSString stringWithFormat:@""];
+ NSString * thisJobAudioInfo = [NSString stringWithFormat:@""];
+ for( int i = 0; i < hb_list_count(job->list_audio); i++ )
+ {
+ audio = (hb_audio_config_t *) hb_list_audio_config_item( job->list_audio, i );
+ /* Output Codec */
+ NSString *outputCodec;
+ if (audio->out.codec == HB_ACODEC_AC3)
+ outputCodec = @"AC3";
+ else if (audio->out.codec == HB_ACODEC_FAAC)
+ outputCodec = @"AAC";
+ else if (audio->out.codec == HB_ACODEC_LAME)
+ outputCodec = @"MP3";
+ else if (audio->out.codec == HB_ACODEC_VORBIS)
+ outputCodec = @"Vorbis";
+ else
+ outputCodec = @"Unknown Codec";
+ /* Add the codec to the audio codecs list ( We should check against dupes)*/
+ thisJobAudioCodecs = [thisJobAudioCodecs stringByAppendingString:[NSString stringWithFormat:@" %@,",outputCodec]];
+ if (i > 0)
+ {
+ /* Insert a line break so that we get each track on a separate line */
+ /* Wicked HACK alert!!, use 18 whitespaces to align offset in display for list > 2 to offset "Audio" in the queue display
+ Please Fix Me because this is embarrassing (but it works) */
+ thisJobAudioInfo = [thisJobAudioInfo stringByAppendingString:@"\n "];
+ }
+ /* Detailed Job audio track info*/
+ /* Track Number and Mixdown Info */
+ if (audio->out.mixdown == HB_ACODEC_AC3)// Remember for ac3 passthru the mixdown uses the source codec
+ thisJobAudioInfo = [thisJobAudioInfo stringByAppendingString:[NSString stringWithFormat:@"Track %d: Source: %@ Output: %@, Pass-Thru", i + 1, [NSString stringWithUTF8String:audio->lang.description], outputCodec]];
+ else if (audio->out.mixdown == HB_AMIXDOWN_MONO)
+ thisJobAudioInfo = [thisJobAudioInfo stringByAppendingString:[NSString stringWithFormat:@"Track %d: Source: %@ Output: %@, Mono", i + 1, [NSString stringWithUTF8String:audio->lang.description], outputCodec]];
+ else if (audio->out.mixdown == HB_AMIXDOWN_STEREO)
+ thisJobAudioInfo = [thisJobAudioInfo stringByAppendingString:[NSString stringWithFormat:@"Track %d: Source: %@ Output: %@, Stereo", i + 1, [NSString stringWithUTF8String:audio->lang.description], outputCodec]];
+ else if (audio->out.mixdown == HB_AMIXDOWN_DOLBY)
+ thisJobAudioInfo = [thisJobAudioInfo stringByAppendingString:[NSString stringWithFormat:@"Track %d: Source: %@ Output: %@, Dolby Surround", i + 1, [NSString stringWithUTF8String:audio->lang.description], outputCodec]];
+ else if (audio->out.mixdown == HB_AMIXDOWN_DOLBYPLII)
+ thisJobAudioInfo = [thisJobAudioInfo stringByAppendingString:[NSString stringWithFormat:@"Track %d: Source: %@ Output: %@, Dolby Pro Logic II", i + 1, [NSString stringWithUTF8String:audio->lang.description], outputCodec]];
+ else if (audio->out.mixdown == HB_AMIXDOWN_6CH)
+ thisJobAudioInfo = [thisJobAudioInfo stringByAppendingString:[NSString stringWithFormat:@"Track %d: Source: %@ Output: %@, 6 Channel Discreet", i + 1, [NSString stringWithUTF8String:audio->lang.description], outputCodec]];
+ else
+ thisJobAudioInfo = [thisJobAudioInfo stringByAppendingString:[NSString stringWithFormat:@"Track %d: Source: %@ Output: Unknown Codec Info", i + 1, [NSString stringWithUTF8String:audio->lang.description]]];
+
+ thisJobAudioInfo = [thisJobAudioInfo stringByAppendingString:[NSString stringWithFormat:@", %d kbps, %d Hz", audio->out.bitrate, audio->out.samplerate]];
+
+ }
+ audioinfo_summary = [[NSString stringWithFormat:@"%@",thisJobAudioInfo]retain];
+ audioinfo_codecs = [[NSString stringWithFormat:@"%@",thisJobAudioCodecs]retain];
+
subtitle = job->subtitle;
mux = job->mux;
if (job->file)
titleHeight = job->title->height;
if (job->subtitle >= 0)
{
- hb_subtitle_t * aSubtitle = (hb_subtitle_t *) hb_list_item(job->title->list_subtitle, 0);
+ hb_subtitle_t * aSubtitle = (hb_subtitle_t *) hb_list_item(job->title->list_subtitle, job->subtitle);
if (aSubtitle)
subtitleLang = [[NSString stringWithUTF8String:aSubtitle->lang] retain];
}
+ // Calculate and store output dimensions and anamorphic dimensions
+ if (pixel_ratio == 1) // Original PAR Implementation, now called Strict Anamorphic
+ {
+ output_width = titleWidth - crop[2] - crop[3];
+ output_height = titleHeight - crop[0] - crop[1];
+ anamorphic_width = output_width * pixel_aspect_width / pixel_aspect_height;
+ anamorphic_height = output_height;
+ }
+ else if (pixel_ratio == 2) // Loose Anamorphic
+ {
+ // call hb_set_anamorphic_size to do a "dry run" to get the values to be
+ // used by libhb for loose anamorphic.
+ int par_width, par_height;
+ hb_set_anamorphic_size(job, &output_width, &output_height, &par_width, &par_height);
+ anamorphic_width = output_width * par_width / par_height;
+ anamorphic_height = output_height;
+ }
+ else // No Anamorphic
+ {
+ output_width = width;
+ output_height = height;
+ anamorphic_width = 0; // not needed for this case
+ anamorphic_height = 0; // not needed for this case
+ }
+
}
return self;
}
[file release];
[titleName release];
[subtitleLang release];
+ [audioinfo_summary release];
+ [audioinfo_codecs release];
[super dealloc];
}
jobFormatInfo = @"unknown";
if (chapter_markers == 1)
- jobFormatInfo = [NSString stringWithFormat:@"%@ Container, %@ Video + %@ Audio, Chapter Markers\n", jobFormatInfo, jobVideoCodec, jobAudioCodec];
+ jobFormatInfo = [NSString stringWithFormat:@"%@ Container, %@ Video + %@ Audio, Chapter Markers\n", jobFormatInfo, jobVideoCodec, audioinfo_codecs];
else
- jobFormatInfo = [NSString stringWithFormat:@"%@ Container, %@ Video + %@ Audio\n", jobFormatInfo, jobVideoCodec, jobAudioCodec];
+ jobFormatInfo = [NSString stringWithFormat:@"%@ Container, %@ Video + %@ Audio\n", jobFormatInfo, jobVideoCodec, audioinfo_codecs];
[finalString appendString: @"Format: " withAttributes:detailBoldAttr];
[finalString appendString: jobFormatInfo withAttributes:detailAttr];
if (withPictureInfo)
{
NSString * jobPictureInfo;
- // integers for picture values deinterlace, crop[4], keep_ratio, grayscale, pixel_ratio, pixel_aspect_width, pixel_aspect_height,
- // maxWidth, maxHeight
- if (pixel_ratio == 1)
- {
- int croppedWidth = titleWidth - crop[2] - crop[3];
- int displayparwidth = croppedWidth * pixel_aspect_width / pixel_aspect_height;
- int displayparheight = titleHeight - crop[0] - crop[1];
- jobPictureInfo = [NSString stringWithFormat:@"%dx%d (%dx%d Anamorphic)", displayparwidth, displayparheight, width, displayparheight];
- }
+ if (pixel_ratio == 1) // Original PAR Implementation, now called Strict Anamorphic
+ jobPictureInfo = [NSString stringWithFormat:@"%d x %d (%d x %d Strict Anamorphic)", output_width, output_height, anamorphic_width, anamorphic_height];
+ else if (pixel_ratio == 2) // Loose Anamorphic
+ jobPictureInfo = [NSString stringWithFormat:@"%d x %d (%d x %d Loose Anamorphic)", output_width, output_height, anamorphic_width, anamorphic_height];
else
- jobPictureInfo = [NSString stringWithFormat:@"%dx%d", width, height];
+ jobPictureInfo = [NSString stringWithFormat:@"%d x %d", output_width, output_height];
if (keep_ratio == 1)
jobPictureInfo = [jobPictureInfo stringByAppendingString:@" Keep Aspect Ratio"];
if (withAudioInfo)
{
- NSString * jobAudioInfo;
- if ([jobAudioCodec isEqualToString: @"AC3"])
- jobAudioInfo = [NSString stringWithFormat:@"%@, Pass-Through", jobAudioCodec];
- else
- jobAudioInfo = [NSString stringWithFormat:@"%@, %d kbps, %d Hz", jobAudioCodec, abitrate, arate];
-
- // we now get the audio mixdown info for each of the two gui audio tracks
- // lets do it the long way here to get a handle on things.
- // Hardcoded for two tracks for gui: audio_mixdowns[i] audio_mixdowns[i]
- int ai; // counter for each audios [] , macgui only allows for two audio tracks currently
- for( ai = 0; ai < 2; ai++ )
- {
- if (audio_mixdowns[ai] == HB_AMIXDOWN_MONO)
- jobAudioInfo = [jobAudioInfo stringByAppendingString:[NSString stringWithFormat:@", Track %d: Mono", ai + 1]];
- if (audio_mixdowns[ai] == HB_AMIXDOWN_STEREO)
- jobAudioInfo = [jobAudioInfo stringByAppendingString:[NSString stringWithFormat:@", Track %d: Stereo", ai + 1]];
- if (audio_mixdowns[ai] == HB_AMIXDOWN_DOLBY)
- jobAudioInfo = [jobAudioInfo stringByAppendingString:[NSString stringWithFormat:@", Track %d: Dolby Surround", ai + 1]];
- if (audio_mixdowns[ai] == HB_AMIXDOWN_DOLBYPLII)
- jobAudioInfo = [jobAudioInfo stringByAppendingString:[NSString stringWithFormat:@", Track %d: Dolby Pro Logic II", ai + 1]];
- if (audio_mixdowns[ai] == HB_AMIXDOWN_6CH)
- jobAudioInfo = [jobAudioInfo stringByAppendingString:[NSString stringWithFormat:@", Track %d: 6-channel discreet", ai + 1]];
- }
if (withIcon) // implies indent the info
[finalString appendString: @"\t" withAttributes:detailBoldAttr];
[finalString appendString: @"Audio: " withAttributes:detailBoldAttr];
- [finalString appendString:[NSString stringWithFormat:@"%@\n", jobAudioInfo] withAttributes:detailAttr];
+ [finalString appendString:[NSString stringWithFormat:@"%@\n", audioinfo_summary] withAttributes:detailAttr];
}
if (withSubtitleInfo)
{
- // subtitle can == -1 in two cases:
+ // subtitle scan == -1 in two cases:
// autoselect: when pass == -1
// none: when pass != -1
if ((subtitle == -1) && (pass == -1))
return firstJob ? firstJob->titleName : nil;
}
-- (NSString *) path
+- (NSString *) destinationPath
{
HBJob * firstJob = [self jobAtIndex:0];
return firstJob ? firstJob->file : nil;
return fCurrentJob;
}
+#pragma mark -
+
//------------------------------------------------------------------------------------
// Displays and brings the queue window to the front
//------------------------------------------------------------------------------------
fCurrentJobGroup = aJobGroup;
}
+#pragma mark - Finding job groups
+
+//------------------------------------------------------------------------------------
+// Returns the first pending job with a specified destination path or nil if no such
+// job exists.
+//------------------------------------------------------------------------------------
+- (HBJobGroup *) pendingJobGroupWithDestinationPath: (NSString *)path
+{
+ HBJobGroup * aJobGroup;
+ NSEnumerator * groupEnum = [fJobGroups objectEnumerator];
+ while ( (aJobGroup = [groupEnum nextObject]) )
+ {
+ if ([[aJobGroup destinationPath] isEqualToString: path])
+ return aJobGroup;
+ }
+ return nil;
+}
+
//------------------------------------------------------------------------------------
// Locates and returns a HBJob whose sequence_id matches a specified value.
//------------------------------------------------------------------------------------
[fProgressBar setIndeterminate:NO];
[fProgressBar stopAnimation:nil];
[fProgressBar setDoubleValue:0.0];
+
+
}
else
withSubtitleInfo: YES]];
}
}
-
else
+ {
[fJobDescTextField setStringValue: @"No encodes pending"];
+
+ }
+
}
//------------------------------------------------------------------------------------
while (row != NSNotFound)
{
HBJobGroup * jobGroup = [fOutlineView itemAtRow: row];
- if ([[jobGroup path] length])
- [[NSWorkspace sharedWorkspace] selectFile:[jobGroup path] inFileViewerRootedAtPath:nil];
+ if ([[jobGroup destinationPath] length])
+ [[NSWorkspace sharedWorkspace] selectFile:[jobGroup destinationPath] inFileViewerRootedAtPath:nil];
row = [selectedRows indexGreaterThanIndex: row];
}
//------------------------------------------------------------------------------------
- (void)currentJobChanged: (HBJob *) currentJob
{
+ /* if the job has a destination path, lets perform finished job notifications in fHBController
+ * We call this here so that we pickup the last job in the queue and single encodes before fCurrentJob
+ * is released. So for the first job and the beginning of single encodes we check for the existence
+ * of a valid fCurrentJob jobGroup
+ */
[currentJob retain];
+ /* We need to compare the job group to determine if this is the end of a job group
+ * or just the end of a job within a group to keep from sending encode done notification
+ * after the first pass in a two pass encode
+ */
+ HBJobGroup * theJobGroupCheck = [currentJob jobGroup];
+ if ((theJobGroupCheck == nil) || (theJobGroupCheck != fCurrentJobGroup))
+ {
+ /* we need to make sure that we are not at the beginning of a queue and also that the job hasn't
+ * been cancelled
+ */
+ if ([[fCurrentJob jobGroup] destinationPath] && [fCurrentJobGroup status] != HBStatusCanceled)
+ {
+ /* send encode messages to fHBController. User prefs are grokked there. */
+ [fHBController showGrowlDoneNotification: [[fCurrentJob jobGroup] destinationPath]];
+ [fHBController sendToMetaX: [[fCurrentJob jobGroup] destinationPath]];
+ }
+ }
[fCurrentJob release];
fCurrentJob = currentJob;
// all other cases are assumed to be a successful encode. BTW, libhb
// doesn't currently report errors back to the GUI.
if ([fCurrentJobGroup status] != HBStatusCanceled)
+ {
[fCurrentJobGroup setStatus:HBStatusCompleted];
+ }
+
+
}
// Set the new group