X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;ds=sidebyside;f=gtk%2Fsrc%2Fqueuehandler.c;h=adf409e1671fec707f3655192183bc19e18af3b0;hb=2cea0d49ba2d6aa6ba96d575b47d2d313515be11;hp=e92ecf3c3213a66213bfc58119561cd5738a88ef;hpb=0ed703931ce2487ab4937ea5f49d357fe5eeb023;p=handbrake-jp%2Fhandbrake-jp-git.git diff --git a/gtk/src/queuehandler.c b/gtk/src/queuehandler.c index e92ecf3c..adf409e1 100644 --- a/gtk/src/queuehandler.c +++ b/gtk/src/queuehandler.c @@ -36,6 +36,8 @@ queue_list_selection_changed_cb(GtkTreeSelection *selection, signal_user_data_t // This is purely cosmetic. if (gtk_tree_selection_get_selected(selection, &store, &iter)) { + GtkWidget *widget = GHB_WIDGET (ud->builder, "queue_edit"); + gtk_widget_set_sensitive (widget, TRUE); if (gtk_tree_model_iter_parent (store, &piter, &iter)) { GtkTreePath *path; @@ -49,6 +51,11 @@ queue_list_selection_changed_cb(GtkTreeSelection *selection, signal_user_data_t gtk_tree_path_free(path); } } + else + { + GtkWidget *widget = GHB_WIDGET (ud->builder, "queue_edit"); + gtk_widget_set_sensitive (widget, FALSE); + } } static void @@ -63,7 +70,7 @@ add_to_queue_list(signal_user_data_t *ud, GValue *settings, GtkTreeIter *piter) gchar *dest, *preset, *vol_name, *basename; const gchar *vcodec, *container; gchar *fps, *vcodec_abbr; - gint title, start_chapter, end_chapter, width, height, vqvalue; + gint title, start_chapter, end_chapter, width, height; gint source_width, source_height; gboolean pass2, anamorphic, round_dim, keep_aspect, vqtype, turbo; gboolean tweaks; @@ -77,7 +84,7 @@ add_to_queue_list(signal_user_data_t *ud, GValue *settings, GtkTreeIter *piter) title = ghb_settings_combo_int(settings, "title"); start_chapter = ghb_settings_get_int(settings, "start_chapter"); end_chapter = ghb_settings_get_int(settings, "end_chapter"); - pass2 = ghb_settings_get_boolean(settings, "two_pass"); + pass2 = ghb_settings_get_boolean(settings, "VideoTwoPass"); vol_name = ghb_settings_get_string(settings, "volume_label"); dest = ghb_settings_get_string(settings, "destination"); basename = g_path_get_basename(dest); @@ -121,16 +128,18 @@ add_to_queue_list(signal_user_data_t *ud, GValue *settings, GtkTreeIter *piter) gboolean markers; gboolean preset_modified; gint mux; + const GValue *path; - container = ghb_settings_combo_option(settings, "container"); - mux = ghb_settings_combo_int(settings, "container"); + container = ghb_settings_combo_option(settings, "FileFormat"); + mux = ghb_settings_combo_int(settings, "FileFormat"); preset_modified = ghb_settings_get_boolean(settings, "preset_modified"); - preset = ghb_settings_get_string(settings, "preset"); - markers = ghb_settings_get_boolean(settings, "chapter_markers"); + path = ghb_settings_get_value(settings, "preset"); + preset = ghb_preset_path_string(path); + markers = ghb_settings_get_boolean(settings, "ChapterMarkers"); if (preset_modified) g_string_append_printf(str, - "Customized Preset Based On: %s\n", + "Modified Preset Based On: %s\n", preset); else g_string_append_printf(str, @@ -152,9 +161,9 @@ add_to_queue_list(signal_user_data_t *ud, GValue *settings, GtkTreeIter *piter) { gboolean ipod, http, large; - ipod = ghb_settings_get_boolean(settings, "ipod_file"); - http = ghb_settings_get_boolean(settings, "http_optimize_mp4"); - large = ghb_settings_get_boolean(settings, "large_mp4"); + ipod = ghb_settings_get_boolean(settings, "Mp4iPodCompatible"); + http = ghb_settings_get_boolean(settings, "Mp4HttpOptimize"); + large = ghb_settings_get_boolean(settings, "Mp4LargeFile"); if (http || ipod || large) { g_string_append_printf(str, "MP4 Options:"); @@ -173,8 +182,8 @@ add_to_queue_list(signal_user_data_t *ud, GValue *settings, GtkTreeIter *piter) width = ghb_settings_get_int(settings, "scale_width"); height = ghb_settings_get_int(settings, "scale_height"); anamorphic = ghb_settings_get_boolean(settings, "anamorphic"); - round_dim = ghb_settings_get_boolean(settings, "round_dimensions"); - keep_aspect = ghb_settings_get_boolean(settings, "keep_aspect"); + round_dim = ghb_settings_get_boolean(settings, "ModDimensions"); + keep_aspect = ghb_settings_get_boolean(settings, "PictureKeepRatio"); gchar *aspect_desc; if (anamorphic) @@ -200,39 +209,51 @@ add_to_queue_list(signal_user_data_t *ud, GValue *settings, GtkTreeIter *piter) } } vqtype = ghb_settings_get_boolean(settings, "vquality_type_constant"); - vqvalue = 0; gchar *vq_desc = "Error"; gchar *vq_units = ""; + gchar *vqstr; + gdouble vqvalue; if (!vqtype) { vqtype = ghb_settings_get_boolean(settings, "vquality_type_target"); if (!vqtype) { // Has to be bitrate - vqvalue = ghb_settings_get_int(settings, "video_bitrate"); + vqvalue = ghb_settings_get_int(settings, "VideoAvgBitrate"); vq_desc = "Bitrate:"; vq_units = "kbps"; } else { // Target file size - vqvalue = ghb_settings_get_int(settings, "video_target"); + vqvalue = ghb_settings_get_int(settings, "VideoTargetSize"); vq_desc = "Target Size:"; vq_units = "MB"; } + vqstr = g_strdup_printf("%d", (gint)vqvalue); } else { // Constant quality - vqvalue = ghb_settings_get_int(settings, "video_quality"); + vqvalue = ghb_settings_get_double(settings, "VideoQualitySlider"); vq_desc = "Constant Quality:"; + if (ghb_settings_get_boolean(settings, "directqp")) + { + vqstr = g_strdup_printf("%d", (gint)vqvalue); + vq_units = "(crf)"; + } + else + { + vqstr = g_strdup_printf("%.1f", 100*vqvalue); + vq_units = "%"; + } } - fps = ghb_settings_get_string(settings, "framerate"); + fps = ghb_settings_get_string(settings, "VideoFramerate"); if (strcmp("source", fps) == 0) { g_free(fps); - if (ghb_settings_get_boolean(settings, "detelecine")) + if (ghb_settings_get_boolean(settings, "PictureDetelecine")) fps = g_strdup("Same As Source (vfr detelecine)"); else fps = g_strdup("Same As Source (variable)"); @@ -244,8 +265,8 @@ add_to_queue_list(signal_user_data_t *ud, GValue *settings, GtkTreeIter *piter) g_free(fps); fps = tmp; } - vcodec = ghb_settings_combo_option(settings, "video_codec"); - vcodec_abbr = ghb_settings_get_string(settings, "video_codec"); + vcodec = ghb_settings_combo_option(settings, "VideoEncoder"); + vcodec_abbr = ghb_settings_get_string(settings, "VideoEncoder"); source_width = ghb_settings_get_int(settings, "source_width"); source_height = ghb_settings_get_int(settings, "source_height"); g_string_append_printf(str, @@ -255,9 +276,9 @@ add_to_queue_list(signal_user_data_t *ud, GValue *settings, GtkTreeIter *piter) gboolean decomb; gboolean filters = FALSE; - decomb = ghb_settings_get_boolean(settings, "decomb"); + decomb = ghb_settings_get_boolean(settings, "PictureDecomb"); g_string_append_printf(str, "Filters:"); - if (ghb_settings_get_boolean(settings, "detelecine")) + if (ghb_settings_get_boolean(settings, "PictureDetelecine")) { g_string_append_printf(str, " - Detelecine"); filters = TRUE; @@ -270,31 +291,31 @@ add_to_queue_list(signal_user_data_t *ud, GValue *settings, GtkTreeIter *piter) else { gint deint = ghb_settings_combo_int(settings, - tweaks ? "tweak_deinterlace":"deinterlace"); + tweaks ? "tweak_PictureDeinterlace":"PictureDeinterlace"); if (deint) { const gchar *opt = ghb_settings_combo_option(settings, - tweaks ? "tweak_deinterlace":"deinterlace"); + tweaks ? "tweak_PictureDeinterlace":"PictureDeinterlace"); g_string_append_printf(str, " - Deinterlace: %s", opt); filters = TRUE; } } gint denoise = ghb_settings_combo_int(settings, - tweaks ? "tweak_denoise":"denoise"); + tweaks ? "tweak_PictureDenoise":"PictureDenoise"); if (denoise) { const gchar *opt = ghb_settings_combo_option(settings, - tweaks ? "tweak_denoise":"denoise"); + tweaks ? "tweak_PictureDenoise":"PictureDenoise"); g_string_append_printf(str, " - Denoise: %s", opt); filters = TRUE; } - gint deblock = ghb_settings_get_int(settings, "deblock"); + gint deblock = ghb_settings_get_int(settings, "PictureDeblock"); if (deblock >= 5) { g_string_append_printf(str, " - Deblock (%d)", deblock); filters = TRUE; } - if (ghb_settings_get_boolean(settings, "grayscale")) + if (ghb_settings_get_boolean(settings, "VideoGrayScale")) { g_string_append_printf(str, " - Grayscale"); filters = TRUE; @@ -304,10 +325,10 @@ add_to_queue_list(signal_user_data_t *ud, GValue *settings, GtkTreeIter *piter) g_string_append_printf(str, "\n"); g_string_append_printf(str, - "Video: %s, Framerate: %s, %s %d%s\n", - vcodec, fps, vq_desc, vqvalue, vq_units); + "Video: %s, Framerate: %s, %s %s%s\n", + vcodec, fps, vq_desc, vqstr, vq_units); - turbo = ghb_settings_get_boolean(settings, "turbo"); + turbo = ghb_settings_get_boolean(settings, "VideoTurboTwoPass"); if (turbo) { g_string_append_printf(str, "Turbo: On\n"); @@ -333,16 +354,16 @@ add_to_queue_list(signal_user_data_t *ud, GValue *settings, GtkTreeIter *piter) asettings = ghb_array_get_nth(audio_list, ii); - acodec = ghb_settings_combo_option(asettings, "audio_codec"); - bitrate = ghb_settings_get_string(asettings, "audio_bitrate"); - samplerate = ghb_settings_get_string(asettings, "audio_rate"); + acodec = ghb_settings_combo_option(asettings, "AudioEncoder"); + bitrate = ghb_settings_get_string(asettings, "AudioBitrate"); + samplerate = ghb_settings_get_string(asettings, "AudioSamplerate"); if (strcmp("source", samplerate) == 0) { g_free(samplerate); samplerate = g_strdup("Same As Source"); } - track = ghb_settings_get_string(asettings, "audio_track_long"); - mix = ghb_settings_combo_option(asettings, "audio_mix"); + track = ghb_settings_get_string(asettings, "AudioTrackDescription"); + mix = ghb_settings_combo_option(asettings, "AudioMixdown"); g_string_append_printf(str, "Audio: %s, Encoder: %s, Mixdown: %s, SampleRate: %s, Bitrate: %s", track, acodec, mix, samplerate, bitrate); @@ -363,25 +384,6 @@ add_to_queue_list(signal_user_data_t *ud, GValue *settings, GtkTreeIter *piter) g_free(preset); } -static gint64 -estimate_file_size(signal_user_data_t *ud) -{ - ghb_title_info_t tinfo; - gint duration; - gint bitrate; - gint64 size; - gint titleindex; - - titleindex = ghb_settings_combo_int(ud->settings, "title"); - if (titleindex < 0) return 0; - - if (!ghb_get_title_info(&tinfo, titleindex)) return 0; - duration = ((tinfo.hours*60)+tinfo.minutes)*60+tinfo.seconds; - bitrate = ghb_guess_bitrate(ud->settings); - size = (gint64)duration * (gint64)bitrate/8; - return size; -} - void audio_list_refresh(signal_user_data_t *ud) { @@ -390,7 +392,7 @@ audio_list_refresh(signal_user_data_t *ud) GtkListStore *store; gboolean done; gint row = 0; - GValue *audio_list; + const GValue *audio_list; g_debug("ghb_audio_list_refresh ()"); treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "audio_list")); @@ -409,19 +411,19 @@ audio_list_refresh(signal_user_data_t *ud) return; asettings = ghb_array_get_nth(audio_list, row); - track = ghb_settings_combo_option(asettings, "audio_track"); - codec = ghb_settings_combo_option(asettings, "audio_codec"); - br = ghb_settings_combo_option(asettings, "audio_bitrate"); - sr = ghb_settings_combo_option(asettings, "audio_rate"); - mix = ghb_settings_combo_option(asettings, "audio_mix"); - drc = ghb_settings_get_string(asettings, "audio_drc"); + track = ghb_settings_combo_option(asettings, "AudioTrack"); + codec = ghb_settings_combo_option(asettings, "AudioEncoder"); + br = ghb_settings_combo_option(asettings, "AudioBitrate"); + sr = ghb_settings_combo_option(asettings, "AudioSamplerate"); + mix = ghb_settings_combo_option(asettings, "AudioMixdown"); + drc = ghb_settings_get_string(asettings, "AudioTrackDRCSlider"); - s_track = ghb_settings_get_string(asettings, "audio_track"); - s_codec = ghb_settings_get_string(asettings, "audio_codec"); - s_br = ghb_settings_get_string(asettings, "audio_bitrate"); - s_sr = ghb_settings_get_string(asettings, "audio_rate"); - s_mix = ghb_settings_get_string(asettings, "audio_mix"); - s_drc = ghb_settings_get_double(asettings, "audio_drc"); + s_track = ghb_settings_get_string(asettings, "AudioTrack"); + s_codec = ghb_settings_get_string(asettings, "AudioEncoder"); + s_br = ghb_settings_get_string(asettings, "AudioBitrate"); + s_sr = ghb_settings_get_string(asettings, "AudioSamplerate"); + s_mix = ghb_settings_get_string(asettings, "AudioMixdown"); + s_drc = ghb_settings_get_double(asettings, "AudioTrackDRCSlider"); gtk_list_store_set(GTK_LIST_STORE(store), &iter, // These are displayed in list @@ -530,7 +532,7 @@ validate_settings(signal_user_data_t *ud) size = g_file_info_get_attribute_uint64(info, G_FILE_ATTRIBUTE_FILESYSTEM_FREE); - gint64 fsize = estimate_file_size(ud); + gint64 fsize = (guint64)10 * 1024 * 1024 * 1024; if (size < fsize) { message = g_strdup_printf( @@ -583,11 +585,6 @@ validate_settings(signal_user_data_t *ud) { return FALSE; } - // Validate container settings - if (!ghb_validate_container(ud)) - { - return FALSE; - } // Validate filter settings if (!ghb_validate_filters(ud)) { @@ -1058,7 +1055,8 @@ ghb_reload_queue(signal_user_data_t *ud) return FALSE; } -gboolean queue_key_press_cb( +gboolean +queue_key_press_cb( GtkWidget *widget, GdkEventKey *event, signal_user_data_t *ud) @@ -1118,3 +1116,51 @@ gboolean queue_key_press_cb( return FALSE; } +GValue *ghb_queue_edit_settings = NULL; + +void +queue_edit_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) +{ + GtkTreeView *treeview; + GtkTreeSelection *selection; + GtkTreeModel *store; + GtkTreeIter iter; + gint row; + gint *indices; + gint status; + + g_debug("queue_key_press_cb ()"); + treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "queue_list")); + store = gtk_tree_view_get_model(treeview); + + selection = gtk_tree_view_get_selection (treeview); + if (gtk_tree_selection_get_selected(selection, &store, &iter)) + { + GtkTreePath *treepath; + + treepath = gtk_tree_model_get_path (store, &iter); + // Find the entry in the queue + indices = gtk_tree_path_get_indices (treepath); + row = indices[0]; + // Can only free the treepath After getting what I need from + // indices since this points into treepath somewhere. + gtk_tree_path_free (treepath); + if (row < 0) return; + if (row >= ghb_array_len(ud->queue)) + return; + ghb_queue_edit_settings = ghb_array_get_nth(ud->queue, row); + status = ghb_settings_get_int(ghb_queue_edit_settings, "job_status"); + if (status == GHB_QUEUE_PENDING) + { + // Remove the selected item + gtk_tree_store_remove(GTK_TREE_STORE(store), &iter); + // Remove the corresponding item from the queue list + ghb_array_remove(ud->queue, row); + } + gchar *source; + source = ghb_settings_get_string(ghb_queue_edit_settings, "source"); + ghb_do_scan(ud, source, FALSE); + g_free(source); + } +} +