OSDN Git Service

LinGui: Picture Filter enhancements
[handbrake-jp/handbrake-jp-git.git] / gtk / src / main.c
index d1a002a..779e8c5 100644 (file)
@@ -33,6 +33,7 @@
 #include <config.h>
 
 #include <gtk/gtk.h>
+#include <gst/gst.h>
 #include <glib/gstdio.h>
 #include <gio/gio.h>
 #include "hbversion.h"
@@ -47,6 +48,7 @@
 #include "settings.h"
 #include "resources.h"
 #include "presets.h"
+#include "preview.h"
 
 
 /*
@@ -224,6 +226,7 @@ bind_chapter_tree_model (signal_user_data_t *ud)
        g_debug("Done\n");
 }
 
+
 extern void queue_list_selection_changed_cb(void);
 extern void queue_remove_clicked_cb(void);
 extern void queue_list_size_allocate_cb(void);
@@ -420,9 +423,10 @@ IoRedirect(signal_user_data_t *ud)
        }
        // Open activity log.
        // TODO: Put this in the same directory as the encode destination
-       config = ghb_get_user_config_dir();
+       config = ghb_get_user_config_dir(NULL);
        path = g_strdup_printf("%s/%s", config, "Activity.log");
        ud->activity_log = g_io_channel_new_file (path, "w", NULL);
+       ud->job_activity_log = NULL;
        ghb_ui_update(ud, "activity_location", ghb_string_value(path));
        g_free(path);
        g_free(config);
@@ -498,9 +502,12 @@ main (int argc, char *argv[])
        textdomain (GETTEXT_PACKAGE);
 #endif
 
+       if (!g_thread_supported())
+               g_thread_init(NULL);
        context = g_option_context_new ("- Rip and encode DVD or MPEG file");
        g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
        g_option_context_add_group (context, gtk_get_option_group (TRUE));
+       g_option_context_add_group (context, gst_init_get_option_group ());
        g_option_context_parse (context, &argc, &argv, &error);
        g_option_context_free(context);
        
@@ -514,19 +521,15 @@ main (int argc, char *argv[])
        ghb_hal_init();
 #endif
 
-       ud = g_malloc(sizeof(signal_user_data_t));
+       ud = g_malloc0(sizeof(signal_user_data_t));
        ud->debug = ghb_debug;
-       ud->cancel_encode = FALSE;
        g_log_set_handler (NULL, G_LOG_LEVEL_DEBUG, debug_log_handler, ud);
        ud->settings = ghb_settings_new();
-       ud->queue = NULL;
-       ud->current_job = NULL;
-       ud->current_dvd_device = NULL;
-       ud->dont_clear_presets = FALSE;
        // Enable events that alert us to media change events
        watch_volumes (ud);
        ud->builder = create_builder_or_die (BUILDER_NAME);
        // Redirect stderr to the activity window
+       ghb_preview_init(ud);
        IoRedirect(ud);
        ghb_log("Handbrake Version: %s (%d)", HB_VERSION, HB_BUILD);
        ghb_init_dep_map();
@@ -540,7 +543,7 @@ main (int argc, char *argv[])
        g_signal_connect(buffer, "changed", (GCallback)x264_entry_changed_cb, ud);
 
        ghb_file_menu_add_dvd(ud);
-       ghb_backend_init(ud->builder, 1, 0);
+       ghb_combo_init(ud->builder);
 
        g_debug("ud %p\n", ud);
        g_debug("ud->builder %p\n", ud->builder);
@@ -566,22 +569,14 @@ main (int argc, char *argv[])
 
        ghb_prefs_to_ui(ud);
 
+       gint logLevel;
+       logLevel = ghb_settings_get_int(ud->settings, "LoggingLevel");
+       ghb_backend_init(logLevel);
+
        if (ghb_settings_get_boolean(ud->settings, "hbfd"))
        {
                ghb_hbfd(ud, TRUE);
        }
-       gboolean tweaks = ghb_settings_get_boolean(ud->settings, "allow_tweaks");
-       GtkWidget *widget;
-       widget = GHB_WIDGET(ud->builder, "PictureDeinterlace");
-       tweaks ? gtk_widget_hide(widget) : gtk_widget_show(widget);
-       widget = GHB_WIDGET(ud->builder, "tweak_PictureDeinterlace");
-       !tweaks ? gtk_widget_hide(widget) : gtk_widget_show(widget);
-
-       widget = GHB_WIDGET(ud->builder, "PictureDenoise");
-       tweaks ? gtk_widget_hide(widget) : gtk_widget_show(widget);
-       widget = GHB_WIDGET(ud->builder, "tweak_PictureDenoise");
-       !tweaks ? gtk_widget_hide(widget) : gtk_widget_show(widget);
-
        gchar *source = ghb_settings_get_string(ud->settings, "default_source");
        ghb_dvd_set_current(source, ud);
        g_free(source);
@@ -616,6 +611,7 @@ main (int argc, char *argv[])
        }
        // Reload and check status of the last saved queue
        g_idle_add((GSourceFunc)ghb_reload_queue, ud);
+       g_thread_create((GThreadFunc)ghb_check_update, ud, FALSE, NULL);
        // Start timer for monitoring libhb status, 500ms
        g_timeout_add (500, ghb_timer_cb, (gpointer)ud);
        // Everything should be go-to-go.  Lets rock!