X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=gtk%2Fsrc%2Fhb-backend.c;h=8ebdd1d179052f491dfe29ea7ab42228fb234154;hb=4b72a63eb61a01275493c4bfb51ba02152d1c5e1;hp=19ae7d8194569cd48ce4fc51162d6717cf455908;hpb=fdb09bb478a03a07f7de8c19a1ee4d75832533c8;p=handbrake-jp%2Fhandbrake-jp-git.git diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c index 19ae7d81..8ebdd1d1 100644 --- a/gtk/src/hb-backend.c +++ b/gtk/src/hb-backend.c @@ -1121,6 +1121,24 @@ ghb_find_closest_audio_bitrate(gint codec, gint rate) return result; } +gint +ghb_find_closest_audio_rate(gint rate) +{ + gint ii; + gint result; + + result = 0; + for (ii = 0; ii < hb_audio_rates_count; ii++) + { + if (rate <= hb_audio_rates[ii].rate) + { + result = hb_audio_rates[ii].rate; + break; + } + } + return result; +} + static gint lookup_audio_bitrate_int(const GValue *rate) { @@ -3187,9 +3205,9 @@ void ghb_backend_scan_stop() } void -ghb_backend_scan(const gchar *path, gint titleindex, gint preview_count) +ghb_backend_scan(const gchar *path, gint titleindex, gint preview_count, uint64_t min_duration) { - hb_scan( h_scan, path, titleindex, preview_count, 1 ); + hb_scan( h_scan, path, titleindex, preview_count, 1, min_duration ); hb_status.scan.state |= GHB_STATE_SCANNING; // initialize count and cur to something that won't cause FPE // when computing progress @@ -3201,7 +3219,7 @@ void ghb_backend_queue_scan(const gchar *path, gint titlenum) { g_debug("ghb_backend_queue_scan()"); - hb_scan( h_queue, path, titlenum, 10, 0 ); + hb_scan( h_queue, path, titlenum, 10, 0, 0 ); hb_status.queue.state |= GHB_STATE_SCANNING; } @@ -3561,7 +3579,6 @@ ghb_set_scale(signal_user_data_t *ud, gint mode) gint mod; gint max_width = 0; gint max_height = 0; - static gboolean busy = FALSE; g_debug("ghb_set_scale ()\n"); picture_settings_deps(ud); @@ -3575,19 +3592,13 @@ ghb_set_scale(signal_user_data_t *ud, gint mode) gint titleindex; titleindex = ghb_settings_combo_int(ud->settings, "title"); - title = hb_list_item( list, titleindex ); + title = hb_list_item( list, titleindex ); if (title == NULL) return; job = title->job; if (job == NULL) return; - if (busy) return; - busy = TRUE; - - if (!ud->dont_clear_presets && (keep_width || keep_height)) - { - ghb_settings_set_int(ud->settings, "PictureWidth", 0); - ghb_settings_set_int(ud->settings, "PictureHeight", 0); - } + if (ud->scale_busy) return; + ud->scale_busy = TRUE; // First configure widgets mod = ghb_settings_combo_int(ud->settings, "PictureModulus"); @@ -3691,10 +3702,13 @@ ghb_set_scale(signal_user_data_t *ud, gint mode) { width = ghb_settings_get_int(ud->settings, "scale_width"); height = ghb_settings_get_int(ud->settings, "scale_height"); - max_width = MOD_DOWN( - ghb_settings_get_int(ud->settings, "PictureWidth"), mod); - max_height = MOD_DOWN( - ghb_settings_get_int(ud->settings, "PictureHeight"), mod); + if (mode & GHB_PIC_USE_MAX) + { + max_width = MOD_DOWN( + ghb_settings_get_int(ud->settings, "PictureWidth"), mod); + max_height = MOD_DOWN( + ghb_settings_get_int(ud->settings, "PictureHeight"), mod); + } } g_debug("max_width %d, max_height %d\n", max_width, max_height); @@ -3706,15 +3720,9 @@ ghb_set_scale(signal_user_data_t *ud, gint mode) width = MOD_ROUND(width, mod); height = MOD_ROUND(height, mod); - // Adjust dims according to max values - if (max_height) - height = MIN(height, max_height); - if (max_width) - width = MIN(width, max_width); - + job->anamorphic.mode = pic_par; if (pic_par) { - job->anamorphic.mode = pic_par; // The scaler crashes if the dimensions are not divisible by 2 // Align mod 2. And so does something in x264_encoder_headers() job->modulus = mod; @@ -3724,7 +3732,7 @@ ghb_set_scale(signal_user_data_t *ud, gint mode) job->anamorphic.dar_height = 0; if (keep_height && pic_par == 2) - width = ((double)height * crop_width / crop_height) + mod / 2; + width = ((double)height * crop_width / crop_height); job->width = width; job->height = height; job->maxWidth = max_width; @@ -3753,6 +3761,9 @@ ghb_set_scale(signal_user_data_t *ud, gint mode) { job->anamorphic.keep_display_aspect = 1; } + // hb_set_anamorphic_size will adjust par, dar, and width/height + // to conform to job parameters that have been set, including + // maxWidth and maxHeight hb_set_anamorphic_size( job, &width, &height, &par_width, &par_height ); if (job->anamorphic.mode == 3 && !keep_aspect && @@ -3769,7 +3780,12 @@ ghb_set_scale(signal_user_data_t *ud, gint mode) } else { - job->anamorphic.mode = pic_par; + // Adjust dims according to max values + if (max_height) + height = MIN(height, max_height); + if (max_width) + width = MIN(width, max_width); + if (keep_aspect) { gdouble par; @@ -3848,7 +3864,7 @@ ghb_set_scale(signal_user_data_t *ud, gint mode) ghb_ui_update(ud, "PicturePARHeight", ghb_int64_value(par_height)); ghb_ui_update(ud, "PictureDisplayWidth", ghb_int64_value(disp_width)); ghb_ui_update(ud, "PictureDisplayHeight", ghb_int64_value(height)); - busy = FALSE; + ud->scale_busy = FALSE; } static void @@ -4678,7 +4694,11 @@ add_job(hb_handle_t *h, GValue *js, gint unique_id, gint titleindex) { job->vrate = 27000000; job->vrate_base = vrate; - job->cfr = 1; + gboolean pfr = ghb_settings_get_boolean(js, "VideoFrameratePFR"); + if (pfr) + job->cfr = 2; + else + job->cfr = 1; } const GValue *audio_list;