diff options
author | ritsuka <[email protected]> | 2014-12-27 10:46:04 +0000 |
---|---|---|
committer | ritsuka <[email protected]> | 2014-12-27 10:46:04 +0000 |
commit | df8b2ff3e109699e3dadd88404911f8dfc7b210a (patch) | |
tree | 8489fee4edaf57adf55f69d0c0d28f61a5757057 /macosx/HBCore.m | |
parent | 8df584534c0c39f5c2f298d8ba480cc906743bbf (diff) |
MacGui: change the queue to work with serialized HBJob objects, remove the NSDictionary job representation and the duplicate prepareJob method. Implement NSCopying protocol in HBJob.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6655 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx/HBCore.m')
-rw-r--r-- | macosx/HBCore.m | 64 |
1 files changed, 63 insertions, 1 deletions
diff --git a/macosx/HBCore.m b/macosx/HBCore.m index 84fc15cd5..fb46f20de 100644 --- a/macosx/HBCore.m +++ b/macosx/HBCore.m @@ -5,7 +5,7 @@ It may be used under the terms of the GNU General Public License. */ #import "HBCore.h" -#import "HBTitle.h" +#import "HBJob.h" #import "HBDVDDetector.h" #import "HBUtilities.h" @@ -231,6 +231,68 @@ NSString *HBCoreMuxingNotification = @"HBCoreMuxingNotification"; #pragma mark - Encodes +- (void)encodeJob:(HBJob *)job +{ + hb_job_t *hb_job = job.hb_job; + + [HBUtilities writeToActivityLog: "processNewQueueEncode number of passes expected is: %d", (job.video.twoPass + 1)]; + hb_job_set_file(hb_job, job.destURL.fileSystemRepresentation); + + // If scanning we need to do some extra setup of the job. + if (hb_job->indepth_scan == 1) + { + char *encoder_preset_tmp = hb_job->encoder_preset != NULL ? strdup(hb_job->encoder_preset) : NULL; + char *encoder_tune_tmp = hb_job->encoder_tune != NULL ? strdup(hb_job->encoder_tune) : NULL; + char *encoder_options_tmp = hb_job->encoder_options != NULL ? strdup(hb_job->encoder_options) : NULL; + char *encoder_profile_tmp = hb_job->encoder_profile != NULL ? strdup(hb_job->encoder_profile) : NULL; + char *encoder_level_tmp = hb_job->encoder_level != NULL ? strdup(hb_job->encoder_level) : NULL; + /* + * When subtitle scan is enabled do a fast pre-scan job + * which will determine which subtitles to enable, if any. + */ + hb_job_set_encoder_preset (hb_job, NULL); + hb_job_set_encoder_tune (hb_job, NULL); + hb_job_set_encoder_options(hb_job, NULL); + hb_job_set_encoder_profile(hb_job, NULL); + hb_job_set_encoder_level (hb_job, NULL); + hb_job->pass = -1; + hb_add(self.hb_handle, hb_job); + /* + * reset the advanced settings + */ + hb_job_set_encoder_preset (hb_job, encoder_preset_tmp); + hb_job_set_encoder_tune (hb_job, encoder_tune_tmp); + hb_job_set_encoder_options(hb_job, encoder_options_tmp); + hb_job_set_encoder_profile(hb_job, encoder_profile_tmp); + hb_job_set_encoder_level (hb_job, encoder_level_tmp); + free(encoder_preset_tmp); + free(encoder_tune_tmp); + free(encoder_options_tmp); + free(encoder_profile_tmp); + free(encoder_level_tmp); + } + + if (job.video.twoPass) + { + hb_job->indepth_scan = 0; + hb_job->pass = 1; + hb_add(self.hb_handle, hb_job); + hb_job->pass = 2; + hb_add(self.hb_handle, hb_job); + } + else + { + hb_job->indepth_scan = 0; + hb_job->pass = 0; + hb_add(self.hb_handle, hb_job); + } + + // Free the job + hb_job_close(&hb_job); + + [self start]; +} + - (void)start { // Start the timer to handle libhb state changes |