diff options
author | ritsuka <[email protected]> | 2014-12-21 13:08:20 +0000 |
---|---|---|
committer | ritsuka <[email protected]> | 2014-12-21 13:08:20 +0000 |
commit | f258fb8da28967d8f2e2ddaf814233058197044f (patch) | |
tree | 409f34bde3375606b68e81fe4bb0d860c816dc00 /macosx | |
parent | 6305d5f38aa273b0e8269db050eb1e958b55bd26 (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')
-rw-r--r-- | macosx/Controller.h | 1 | ||||
-rw-r--r-- | macosx/Controller.m | 333 | ||||
-rw-r--r-- | macosx/HBJob.m | 20 | ||||
-rw-r--r-- | macosx/HBPreviewController.m | 1 | ||||
-rw-r--r-- | macosx/HBPreviewGenerator.m | 4 | ||||
-rw-r--r-- | macosx/HBVideo.h | 2 | ||||
-rw-r--r-- | macosx/HBVideo.m | 112 |
7 files changed, 13 insertions, 460 deletions
diff --git a/macosx/Controller.h b/macosx/Controller.h index 46e73ce25..5e81c1595 100644 --- a/macosx/Controller.h +++ b/macosx/Controller.h @@ -262,7 +262,6 @@ extern NSString *keyContainerTag; -(void)showGrowlDoneNotification:(NSString *) filePath; - (IBAction)showDebugOutputPanel:(id)sender; -- (void) prepareJobForPreview; - (void) remindUserOfSleepOrShutdown; - (int) hbInstances; 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 diff --git a/macosx/HBJob.m b/macosx/HBJob.m index 0358929e7..946f24997 100644 --- a/macosx/HBJob.m +++ b/macosx/HBJob.m @@ -246,16 +246,18 @@ } } - if (self.video.qualityType != 2) + switch (self.video.qualityType) { - job->vquality = -1.0; - job->vbitrate = self.video.avgBitrate; - } - if (self.video.qualityType == 2) - { - job->vquality = self.video.quality; - job->vbitrate = 0; - + case 0: + // ABR + job->vquality = -1.0; + job->vbitrate = self.video.avgBitrate; + break; + case 1: + // Constant Quality + job->vquality = self.video.quality; + job->vbitrate = 0; + break; } job->grayscale = self.filters.grayscale; diff --git a/macosx/HBPreviewController.m b/macosx/HBPreviewController.m index 21cc58f33..96a631d80 100644 --- a/macosx/HBPreviewController.m +++ b/macosx/HBPreviewController.m @@ -902,7 +902,6 @@ typedef enum ViewMode : NSUInteger { return; self.generator.delegate = self; - [self.delegate prepareJobForPreview]; [self.generator createMovieAsyncWithImageIndex:self.pictureIndex andDuration:[[fPreviewMovieLengthPopUp titleOfSelectedItem] intValue]]; diff --git a/macosx/HBPreviewGenerator.m b/macosx/HBPreviewGenerator.m index f089ade22..fa589bd00 100644 --- a/macosx/HBPreviewGenerator.m +++ b/macosx/HBPreviewGenerator.m @@ -202,7 +202,7 @@ typedef enum EncodeState : NSUInteger { if (self.core || index >= self.imagesCount) return NO; - hb_job_t *job = self.job.title.hb_title->job; + hb_job_t *job = self.job.hb_job; /* Generate the file url and directories. */ if (job->mux & HB_MUX_MASK_MP4) @@ -286,7 +286,7 @@ typedef enum EncodeState : NSUInteger { hb_add(self.core.hb_handle, job); /* we need to clean up the various lists after the job(s) have been set */ - hb_job_reset(job); + hb_job_close(&job); [self registerCoreNotifications]; self.cancelled = NO; diff --git a/macosx/HBVideo.h b/macosx/HBVideo.h index ad7824b48..72208ae8a 100644 --- a/macosx/HBVideo.h +++ b/macosx/HBVideo.h @@ -18,8 +18,6 @@ - (void)applyVideoSettingsFromQueue:(NSDictionary *)queueToApply; - (void)prepareVideoForQueueFileJob:(NSMutableDictionary *)queueFileJob; -- (void)prepareVideoForJobPreview:(hb_job_t *)job andTitle:(hb_title_t *)title; - @property (nonatomic, readwrite) int encoder; @property (nonatomic, readwrite) int qualityType; diff --git a/macosx/HBVideo.m b/macosx/HBVideo.m index 1fbe684c2..48c5a8a15 100644 --- a/macosx/HBVideo.m +++ b/macosx/HBVideo.m @@ -700,118 +700,6 @@ queueFileJob[@"VideoTurboTwoPass"] = @(self.turboTwoPass); } -- (void)prepareVideoForJobPreview:(hb_job_t *)job andTitle:(hb_title_t *)title -{ - job->vcodec = self.encoder; - job->fastfirstpass = 0; - - job->chapter_markers = 0; - - if (job->vcodec == HB_VCODEC_X264) - { - /* advanced x264 options */ - NSString *tmpString; - // translate zero-length strings to NULL for libhb - const char *encoder_preset = NULL; - const char *encoder_tune = NULL; - const char *encoder_options = NULL; - const char *encoder_profile = NULL; - const char *encoder_level = NULL; - if (self.advancedOptions) - { - // we are using the advanced panel - if ([(tmpString = self.videoOptionExtra) length]) - { - encoder_options = [tmpString UTF8String]; - } - } - else - { - // we are using the x264 preset system - if ([(tmpString = self.tune) length]) - { - encoder_tune = [tmpString UTF8String]; - } - if ([(tmpString = self.videoOptionExtra) length]) - { - encoder_options = [tmpString UTF8String]; - } - if ([(tmpString = self.profile) length]) - { - encoder_profile = [tmpString UTF8String]; - } - if ([(tmpString = self.level) length]) - { - encoder_level = [tmpString UTF8String]; - } - encoder_preset = [self.preset UTF8String]; - } - hb_job_set_encoder_preset (job, encoder_preset); - hb_job_set_encoder_tune (job, encoder_tune); - hb_job_set_encoder_options(job, encoder_options); - hb_job_set_encoder_profile(job, encoder_profile); - hb_job_set_encoder_level (job, encoder_level); - } - else if (job->vcodec & HB_VCODEC_FFMPEG_MASK) - { - hb_job_set_encoder_options(job, [self.videoOptionExtra UTF8String]); - } - - /* Video settings */ - int fps_mode, fps_num, fps_den; - if (self.frameRate > 0 ) - { - /* a specific framerate has been chosen */ - fps_num = 27000000; - fps_den = (int)self.frameRate; - if (self.frameRateMode == 1) - { - // CFR - fps_mode = 1; - } - else - { - // PFR - fps_mode = 2; - } - } - else - { - /* same as source */ - fps_num = title->vrate.num; - fps_den = title->vrate.den; - if (self.frameRateMode == 1) - { - // CFR - fps_mode = 1; - } - else - { - // VFR - fps_mode = 0; - } - } - - switch (self.qualityType) - { - case 0: - /* ABR */ - job->vquality = -1.0; - job->vbitrate = self.avgBitrate; - break; - case 1: - /* Constant Quality */ - job->vquality = self.quality; - job->vbitrate = 0; - break; - } - - /* Add framerate shaping filter */ - hb_filter_object_t *filter = hb_filter_init(HB_FILTER_VFR); - hb_add_filter(job, filter, [[NSString stringWithFormat:@"%d:%d:%d", - fps_mode, fps_num, fps_den] UTF8String]); -} - @end #pragma mark - Value Trasformers |