summaryrefslogtreecommitdiffstats
path: root/macosx/Controller.m
diff options
context:
space:
mode:
authorritsuka <[email protected]>2014-12-21 13:08:20 +0000
committerritsuka <[email protected]>2014-12-21 13:08:20 +0000
commitf258fb8da28967d8f2e2ddaf814233058197044f (patch)
tree409f34bde3375606b68e81fe4bb0d860c816dc00 /macosx/Controller.m
parent6305d5f38aa273b0e8269db050eb1e958b55bd26 (diff)
MacGui: remove the last usage of title->job.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6636 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx/Controller.m')
-rw-r--r--macosx/Controller.m333
1 files changed, 0 insertions, 333 deletions
diff --git a/macosx/Controller.m b/macosx/Controller.m
index 9ba5a9b90..86e85df43 100644
--- a/macosx/Controller.m
+++ b/macosx/Controller.m
@@ -2414,339 +2414,6 @@ static void queueFSEventStreamCallback(
[self removeQueueFileItem:fqueueEditRescanItemNum];
}
-
-
-#pragma mark -
-#pragma mark Live Preview
-/* Note,this is much like prepareJob, but directly sets the job vars so Picture Preview
- * can encode to its temp preview directory and playback. This is *not* used for any actual user
- * encodes
- */
-- (void) prepareJobForPreview
-{
- hb_list_t * list = hb_get_titles(self.core.hb_handle);
- hb_title_t * title = (hb_title_t *) hb_list_item( list,
- (int)[fSrcTitlePopUp indexOfSelectedItem] );
- hb_job_t * job = title->job;
- /* set job->angle for libdvdnav */
- job->angle = (int)[fSrcAnglePopUp indexOfSelectedItem] + 1;
- /* Chapter selection */
- job->chapter_start = (int)[fSrcChapterStartPopUp indexOfSelectedItem] + 1;
- job->chapter_end = (int)[fSrcChapterEndPopUp indexOfSelectedItem] + 1;
-
- /* Format (Muxer) and Video Encoder */
- job->mux = (int)[[fDstFormatPopUp selectedItem] tag];
-
- /* Video Encoder */
- [self.job.video prepareVideoForJobPreview:job andTitle:title];
-
- /* Picture Size Settings */
- HBPicture *pict = self.job.picture;
- job->width = pict.width;
- job->height = pict.height;
-
- job->anamorphic.keep_display_aspect = pict.keepDisplayAspect;
- job->anamorphic.mode = pict.anamorphicMode;
- job->modulus = pict.modulus;
- job->par.num = pict.parWidth;
- job->par.den = pict.parHeight;
-
- /* Here we use the crop values saved at the time the preset was saved */
- job->crop[0] = pict.cropTop;
- job->crop[1] = pict.cropBottom;
- job->crop[2] = pict.cropLeft;
- job->crop[3] = pict.cropRight;
-
- /* Subtitle settings */
- BOOL one_burned = NO;
- int i = 0;
-
- for (id subtitleDict in fSubtitlesViewController.subtitles)
- {
- int subtitle = [subtitleDict[keySubTrackIndex] intValue];
- int force = [subtitleDict[keySubTrackForced] intValue];
- int burned = [subtitleDict[keySubTrackBurned] intValue];
- int def = [subtitleDict[keySubTrackDefault] intValue];
-
- // if i is 0, then we are in the first item of the subtitles which we need to
- // check for the "Foreign Audio Search" which would be keySubTrackIndex of -1
-
- /* if we are on the first track and using "Foreign Audio Search" */
- if (i == 0 && subtitle == -1)
- {
- [HBUtilities writeToActivityLog: "Foreign Language Search: %d", 1];
-
- job->indepth_scan = 1;
-
- if (burned != 1)
- {
- job->select_subtitle_config.dest = PASSTHRUSUB;
- }
- else
- {
- job->select_subtitle_config.dest = RENDERSUB;
- }
-
- job->select_subtitle_config.force = force;
- job->select_subtitle_config.default_track = def;
- }
- else
- {
- /* if we are getting the subtitles from an external srt file */
- if ([subtitleDict[keySubTrackType] intValue] == SRTSUB)
- {
- hb_subtitle_config_t sub_config;
-
- sub_config.offset = [subtitleDict[keySubTrackSrtOffset] intValue];
-
- /* we need to srncpy file name and codeset */
- strncpy(sub_config.src_filename, [subtitleDict[keySubTrackSrtFilePath] UTF8String], 255);
- sub_config.src_filename[255] = 0;
- strncpy(sub_config.src_codeset, [subtitleDict[keySubTrackSrtCharCode] UTF8String], 39);
- sub_config.src_codeset[39] = 0;
-
- if( !burned && hb_subtitle_can_pass( SRTSUB, job->mux ) )
- {
- sub_config.dest = PASSTHRUSUB;
- }
- else if( hb_subtitle_can_burn( SRTSUB ) )
- {
- // Only allow one subtitle to be burned into the video
- if( one_burned )
- continue;
- one_burned = TRUE;
- sub_config.dest = RENDERSUB;
- }
-
- sub_config.force = 0;
- sub_config.default_track = def;
- hb_srt_add( job, &sub_config, [subtitleDict[keySubTrackLanguageIsoCode] UTF8String]);
- continue;
- }
-
- /* We are setting a source subtitle so access the source subtitle info */
- hb_subtitle_t * subt = (hb_subtitle_t *) hb_list_item( title->list_subtitle, subtitle );
-
- if( subt != NULL )
- {
- hb_subtitle_config_t sub_config = subt->config;
-
- if( !burned && hb_subtitle_can_pass( subt->source, job->mux ) )
- {
- sub_config.dest = PASSTHRUSUB;
- }
- else if( hb_subtitle_can_burn( subt->source ) )
- {
- // Only allow one subtitle to be burned into the video
- if( one_burned )
- continue;
- one_burned = TRUE;
- sub_config.dest = RENDERSUB;
- }
-
- sub_config.force = force;
- sub_config.default_track = def;
- hb_subtitle_add( job, &sub_config, subtitle );
- }
- }
- i++;
- }
- if( one_burned )
- {
- hb_filter_object_t *filter = hb_filter_init( HB_FILTER_RENDER_SUB );
- hb_add_filter( job, filter, [[NSString stringWithFormat:@"%d:%d:%d:%d",
- job->crop[0], job->crop[1],
- job->crop[2], job->crop[3]] UTF8String] );
- }
-
- /* Auto Passthru */
- job->acodec_copy_mask = 0;
- HBAudioDefaults *audioDefaults = self.job.audioDefaults;
- if (audioDefaults.allowAACPassthru)
- {
- job->acodec_copy_mask |= HB_ACODEC_FFAAC;
- }
- if (audioDefaults.allowAC3Passthru)
- {
- job->acodec_copy_mask |= HB_ACODEC_AC3;
- }
- if (audioDefaults.allowDTSHDPassthru)
- {
- job->acodec_copy_mask |= HB_ACODEC_DCA_HD;
- }
- if (audioDefaults.allowDTSPassthru)
- {
- job->acodec_copy_mask |= HB_ACODEC_DCA;
- }
- if (audioDefaults.allowMP3Passthru)
- {
- job->acodec_copy_mask |= HB_ACODEC_MP3;
- }
- job->acodec_fallback = audioDefaults.encoderFallback;
-
- // First clear out any audio tracks in the job currently
- int audiotrack_count = hb_list_count(job->list_audio);
- for (i = 0; i < audiotrack_count; i++)
- {
- hb_audio_t *temp_audio = (hb_audio_t *) hb_list_item(job->list_audio, 0);
- hb_list_rem(job->list_audio, temp_audio);
- }
-
- /* Audio tracks and mixdowns */
- for (NSDictionary *audioDict in fAudioController.audioTracks)
- {
- hb_audio_config_t *audio = (hb_audio_config_t *)calloc(1, sizeof(*audio));
- hb_audio_config_init(audio);
- audio->in.track = [audioDict[@"Track"] intValue];
- /* We go ahead and assign values to our audio->out.<properties> */
- audio->out.track = audio->in.track;
- audio->out.codec = [audioDict[@"JobEncoder"] intValue];
- audio->out.compression_level = hb_audio_compression_get_default(audio->out.codec);
- audio->out.mixdown = [audioDict[@"JobMixdown"] intValue];
- audio->out.normalize_mix_level = 0;
- audio->out.bitrate = [audioDict[@"JobBitrate"] intValue];
- audio->out.samplerate = [audioDict[@"JobSamplerate"] intValue];
- audio->out.dynamic_range_compression = [audioDict[@"TrackDRCSlider"] doubleValue];
- audio->out.gain = [audioDict[@"TrackGainSlider"] doubleValue];
- audio->out.dither_method = hb_audio_dither_get_default();
-
- hb_audio_add(job, audio);
- free(audio);
- }
-
- /* Filters */
- HBFilters *filters = self.job.filters;
-
- /* Though Grayscale is not really a filter, per se
- * we put it here since its in the filters panel
- */
-
- if (filters.grayscale)
- {
- job->grayscale = 1;
- }
- else
- {
- job->grayscale = 0;
- }
-
- /* Now lets call the filters if applicable.
- * The order of the filters is critical */
-
- /* Detelecine */
- if (filters.detelecine == 1)
- {
- hb_filter_object_t *filter = hb_filter_init(HB_FILTER_DETELECINE);
- /* use a custom detelecine string */
- hb_add_filter(job, filter, [filters.detelecineCustomString UTF8String]);
- }
- else if (filters.detelecine == 2)
- {
- /* Default */
- hb_filter_object_t *filter = hb_filter_init(HB_FILTER_DETELECINE);
- hb_add_filter(job, filter, NULL);
- }
- if (filters.useDecomb == YES)
- {
- /* Decomb */
- hb_filter_object_t *filter = hb_filter_init(HB_FILTER_DECOMB);
- if (filters.decomb == 1)
- {
- /* use a custom decomb string */
- hb_add_filter(job, filter, [filters.decombCustomString UTF8String]);
- }
- else if (filters.decomb == 2)
- {
- /* use libhb defaults */
- hb_add_filter(job, filter, NULL);
- }
- else if (filters.decomb == 3)
- {
- /* use old defaults (decomb fast) */
- hb_add_filter(job, filter, "7:2:6:9:1:80");
- }
- else if (filters.decomb == 4)
- {
- /* decomb 3 with bobbing enabled */
- hb_add_filter(job, filter, "455");
- }
- }
- else
- {
- /* Deinterlace */
- hb_filter_object_t *filter = hb_filter_init(HB_FILTER_DEINTERLACE);
- if (filters.deinterlace == 1)
- {
- /* we add the custom string if present */
- hb_add_filter(job, filter, [filters.deinterlaceCustomString UTF8String]);
- }
- else if (filters.deinterlace == 2)
- {
- /* Run old deinterlacer fd by default */
- hb_add_filter(job, filter, "0");
- }
- else if (filters.deinterlace == 3)
- {
- /* Yadif mode 0 (without spatial deinterlacing) */
- hb_add_filter(job, filter, "1");
- }
- else if (filters.deinterlace == 4)
- {
- /* Yadif (with spatial deinterlacing) */
- hb_add_filter(job, filter, "3");
- }
- else if (filters.deinterlace == 5)
- {
- /* Yadif (with spatial deinterlacing and bobbing) */
- hb_add_filter(job, filter, "15");
- }
- }
-
- /* Denoise */
- if (![filters.denoise isEqualToString:@"off"])
- {
- int filter_id = HB_FILTER_HQDN3D;
- if ([filters.denoise isEqualToString:@"nlmeans"])
- filter_id = HB_FILTER_NLMEANS;
-
- if ([filters.denoisePreset isEqualToString:@"none"])
- {
- const char *filter_str;
- filter_str = [filters.denoiseCustomString UTF8String];
- hb_filter_object_t *filter = hb_filter_init(filter_id);
- hb_add_filter(job, filter, filter_str);
- }
- else
- {
- const char *filter_str, *preset, *tune;
- preset = [filters.denoisePreset UTF8String];
- tune = [filters.denoiseTune UTF8String];
- filter_str = hb_generate_filter_settings(filter_id, preset, tune);
- hb_filter_object_t *filter = hb_filter_init(filter_id);
- hb_add_filter(job, filter, filter_str);
- }
- }
-
- /* Deblock (uses pp7 default) */
- /* NOTE: even though there is a valid deblock setting of 0 for the filter, for
- * the macgui's purposes a value of 0 actually means to not even use the filter
- * current hb_filter_deblock.settings valid ranges are from 5 - 15
- */
- if (filters.deblock != 0)
- {
- hb_filter_object_t *filter = hb_filter_init( HB_FILTER_DEBLOCK );
- NSString *deblockStringValue = [NSString stringWithFormat: @"%ld",(long)filters.deblock];
- hb_add_filter( job, filter, [deblockStringValue UTF8String] );
- }
-
- /* Add Crop/Scale filter */
- hb_filter_object_t *filter = hb_filter_init( HB_FILTER_CROP_SCALE );
- hb_add_filter( job, filter, [[NSString stringWithFormat:@"%d:%d:%d:%d:%d:%d",
- job->width, job->height,
- job->crop[0], job->crop[1],
- job->crop[2], job->crop[3]] UTF8String] );
-}
-
#pragma mark -
#pragma mark Job Handling