-/* This assumes that we have re-scanned and loaded up a new queue item to send to libhb as fQueueEncodeLibhb */
-- (void) processNewQueueEncode
-{
- hb_list_t * list = hb_get_titles( fQueueEncodeLibhb );
- hb_title_t * title = (hb_title_t *) hb_list_item( list,0 ); // is always zero since now its a single title scan
- hb_job_t * job = title->job;
-
- if( !hb_list_count( list ) )
- {
- [self writeToActivityLog: "processNewQueueEncode WARNING nothing found in the title list"];
- }
-
- NSMutableDictionary * queueToApply = [QueueFileArray objectAtIndex:currentQueueEncodeIndex];
- [self writeToActivityLog: "Preset: %s", [[queueToApply objectForKey:@"PresetName"] UTF8String]];
- [self writeToActivityLog: "processNewQueueEncode number of passes expected is: %d", ([[queueToApply objectForKey:@"VideoTwoPass"] intValue] + 1)];
- job->file = [[queueToApply objectForKey:@"DestinationPath"] UTF8String];
- //[self writeToActivityLog: "processNewQueueEncode sending to prepareJob"];
- [self prepareJob];
-
- /*
- * If scanning we need to do some extra setup of the job.
- */
- if( job->indepth_scan == 1 )
- {
- char *x264opts_tmp;
-
- /*
- * When subtitle scan is enabled do a fast pre-scan job
- * which will determine which subtitles to enable, if any.
- */
- job->pass = -1;
- x264opts_tmp = job->x264opts;
-
- job->x264opts = NULL;
-
- job->indepth_scan = 1;
-
-
- /*
- * Add the pre-scan job
- */
- hb_add( fQueueEncodeLibhb, job );
- job->x264opts = x264opts_tmp;
- }
-
-
- if( [[queueToApply objectForKey:@"VideoTwoPass"] intValue] == 1 )
- {
- job->indepth_scan = 0;
-
-
-
- job->pass = 1;
-
- hb_add( fQueueEncodeLibhb, job );
-
- job->pass = 2;
-
- job->x264opts = (char *)calloc(1024, 1); /* Fixme, this just leaks */
- strcpy(job->x264opts, [[queueToApply objectForKey:@"x264Option"] UTF8String]);
-
- hb_add( fQueueEncodeLibhb, job );
-
- }
- else
- {
- job->indepth_scan = 0;
- job->pass = 0;
-
- hb_add( fQueueEncodeLibhb, job );
- }
-
- NSString *destinationDirectory = [[queueToApply objectForKey:@"DestinationPath"] stringByDeletingLastPathComponent];
- [[NSUserDefaults standardUserDefaults] setObject:destinationDirectory forKey:@"LastDestinationDirectory"];
- /* Lets mark our new encode as 1 or "Encoding" */
- [queueToApply setObject:[NSNumber numberWithInt:1] forKey:@"Status"];
- [self saveQueueFileItem];
-
- /* we need to clean up the subtitle tracks after the job(s) have been set */
- int num_subtitle_tracks = hb_list_count(job->list_subtitle);
- int ii;
- for(ii = 0; ii < num_subtitle_tracks; ii++)
- {
- hb_subtitle_t * subtitle;
- subtitle = (hb_subtitle_t *)hb_list_item(job->list_subtitle, 0);
-
-
- hb_list_rem(job->list_subtitle, subtitle);
- free(subtitle);
- }
-
-
- /* We should be all setup so let 'er rip */
- [self doRip];
-}
-