OSDN Git Service

LinGui: remove target file size option
[handbrake-jp/handbrake-jp-git.git] / gtk / src / hb-backend.c
index 04d262e..0f7bba1 100644 (file)
@@ -2,7 +2,7 @@
  *            hb-backend.c
  *
  *  Fri Mar 28 10:38:44 2008
- *  Copyright  2008  John Stebbins
+ *  Copyright  2008-2011  John Stebbins
  *  <john at stebbins dot name>
  ****************************************************************************/
 
@@ -303,9 +303,9 @@ combo_opts_t bpyramid_opts =
 
 static options_map_t d_weightp_opts[] =
 {
-       {"Off",   "0", 0, "0"},
-       {"Blind", "1", 1, "1"},
-       {"Smart", "2", 2, "2"},
+       {"Off",    "0", 0, "0"},
+       {"Simple", "1", 1, "1"},
+       {"Smart",  "2", 2, "2"},
 };
 combo_opts_t weightp_opts =
 {
@@ -1890,14 +1890,20 @@ title_opts_set(GtkBuilder *builder, const gchar *name)
                {
                        if (title->duration != 0)
                        {
-                               titles[ii]  = g_strdup_printf ("%d - %02dh%02dm%02ds - %s",
+                char *tmp;
+                               tmp  = g_strdup_printf ("%d - %02dh%02dm%02ds - %s",
                                        title->index, title->hours, title->minutes, title->seconds, 
                                        title->name);
+                titles[ii] = g_markup_escape_text(tmp, -1);
+                g_free(tmp);
                        }
                        else
                        {
-                               titles[ii]  = g_strdup_printf ("%d - %s", 
+                char *tmp;
+                               tmp  = g_strdup_printf ("%d - %s", 
                                                                                title->index, title->name);
+                titles[ii] = g_markup_escape_text(tmp, -1);
+                g_free(tmp);
                        }
                }
                else
@@ -3850,24 +3856,6 @@ set_preview_job_settings(hb_job_t *job, GValue *settings)
        }
 }
 
-gint
-ghb_calculate_target_bitrate(GValue *settings, gint titleindex)
-{
-       hb_list_t  * list;
-       hb_title_t * title;
-       hb_job_t   * job;
-       gint size;
-
-       if (h_scan == NULL) return 1500;
-       list = hb_get_titles( h_scan );
-    title = hb_list_item( list, titleindex );
-       if (title == NULL) return 1500;
-       job   = title->job;
-       if (job == NULL) return 1500;
-       size = ghb_settings_get_int(settings, "VideoTargetSize");
-       return hb_calc_bitrate( job, size );
-}
-
 gboolean
 ghb_validate_filter_string(const gchar *str, gint max_fields)
 {
@@ -4339,11 +4327,28 @@ ghb_validate_vquality(GValue *settings)
                                max = 62;
                        } break;
                }
-               if (vquality < min || vquality > max)
+               if (vcodec == HB_VCODEC_X264 && vquality == 0.0)
                {
                        message = g_strdup_printf(
-                                               "Interesting video quality choise: %d\n\n"
-                                               "Typical values range from %d to %d.\n"
+                                               "Warning: lossless h.264 selected\n\n"
+                                               "Lossless h.264 is not well supported by\n"
+                                               "many players and editors.\n\n"
+                        "It will produce enormous output files.\n\n"
+                                               "Are you sure you wish to use this setting?",
+                                               (gint)vquality, min, max);
+                       if (!ghb_message_dialog(GTK_MESSAGE_QUESTION, message, 
+                                                                       "Cancel", "Continue"))
+                       {
+                               g_free(message);
+                               return FALSE;
+                       }
+                       g_free(message);
+               }
+               else if (vquality < min || vquality > max)
+               {
+                       message = g_strdup_printf(
+                                               "Interesting video quality choice: %d\n\n"
+                                               "Typical values range from %d to %d.\n\n"
                                                "Are you sure you wish to use this setting?",
                                                (gint)vquality, min, max);
                        if (!ghb_message_dialog(GTK_MESSAGE_QUESTION, message, 
@@ -4415,6 +4420,7 @@ add_job(hb_handle_t *h, GValue *js, gint unique_id, gint titleindex)
                gint start, end;
                gint num_chapters = hb_list_count(title->list_chapter);
                gint duration = title->duration / 90000;
+               job->chapter_markers = FALSE;
                job->chapter_start = 1;
                job->chapter_end = num_chapters;
 
@@ -4428,8 +4434,6 @@ add_job(hb_handle_t *h, GValue *js, gint unique_id, gint titleindex)
                }
                if (ghb_settings_combo_int(js, "PtoPType") == 1)
                {
-                       job->chapter_start = 1;
-                       job->chapter_end = num_chapters;
                        start = ghb_settings_get_int(js, "start_point");
                        end = ghb_settings_get_int(js, "end_point");
                        job->pts_to_start = (int64_t)MIN(duration-1, start) * 90000;
@@ -4438,8 +4442,6 @@ add_job(hb_handle_t *h, GValue *js, gint unique_id, gint titleindex)
                }
                if (ghb_settings_combo_int(js, "PtoPType") == 2)
                {
-                       job->chapter_start = 1;
-                       job->chapter_end = num_chapters;
                        start = ghb_settings_get_int(js, "start_point");
                        end = ghb_settings_get_int(js, "end_point");
                        gint64 max_frames;
@@ -4448,7 +4450,10 @@ add_job(hb_handle_t *h, GValue *js, gint unique_id, gint titleindex)
                        job->frame_to_stop = (int64_t)MAX(start, end-1) - 
                                                                 job->frame_to_start;
                }
-               job->chapter_markers = ghb_settings_get_boolean(js, "ChapterMarkers");
+               if (job->chapter_start != job->chapter_end)
+               {
+                       job->chapter_markers = ghb_settings_get_boolean(js, "ChapterMarkers");
+               }
                if (job->chapter_start == job->chapter_end)
                        job->chapter_markers = 0;
                if ( job->chapter_markers )
@@ -4609,18 +4614,18 @@ add_job(hb_handle_t *h, GValue *js, gint unique_id, gint titleindex)
        {
                job->vrate = title->rate;
                job->vrate_base = title->rate_base;
-               job->cfr = 0;
        }
        else
        {
                job->vrate = 27000000;
                job->vrate_base = vrate;
-               gboolean pfr = ghb_settings_get_boolean(js, "VideoFrameratePFR");
-               if (pfr)
-                       job->cfr = 2;
-               else
-                       job->cfr = 1;
        }
+       if (ghb_settings_get_boolean(js, "VideoFrameratePFR"))
+               job->cfr = 2;
+       else if (ghb_settings_get_boolean(js, "VideoFramerateCFR"))
+               job->cfr = 1;
+       else
+               job->cfr = 0;
 
        const GValue *audio_list;
        gint count, ii;
@@ -4679,17 +4684,6 @@ add_job(hb_handle_t *h, GValue *js, gint unique_id, gint titleindex)
         hb_audio_add( job, &audio );
                tcount++;
        }
-       // I was tempted to move this up with the reset of the video quality
-       // settings, but I suspect the settings above need to be made
-       // first in order for hb_calc_bitrate to be accurate.
-       if (ghb_settings_get_boolean(js, "vquality_type_target"))
-       {
-               gint size;
-               
-               size = ghb_settings_get_int(js, "VideoTargetSize");
-        job->vbitrate = hb_calc_bitrate( job, size );
-               job->vquality = -1.0;
-       }
 
        dest_str = ghb_settings_get_string(js, "destination");
        job->file = dest_str;