diff options
author | jstebbins <[email protected]> | 2010-04-27 18:24:12 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2010-04-27 18:24:12 +0000 |
commit | 8e7e8e21ff68e9972b79cac98e95d6abe483ec48 (patch) | |
tree | 6c180666dc2fdee056f287708327461e93b6dec3 | |
parent | 2324f99d7e145625623e31be70dea6d705bed80a (diff) |
LinGui: drop dependency on hal, use udev instead
this means support for older linux versions is being dropped.
ubuntu 9.10 and above and fedora 12 and above are known to work.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3270 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | doc/BUILD-Linux | 24 | ||||
-rw-r--r-- | doc/texi/Building.linux.texi | 17 | ||||
-rw-r--r-- | gtk/configure.ac | 2 | ||||
-rw-r--r-- | gtk/src/callbacks.c | 110 | ||||
-rw-r--r-- | gtk/src/callbacks.h | 2 | ||||
-rw-r--r-- | gtk/src/hb-backend.c | 1 | ||||
-rw-r--r-- | gtk/src/main.c | 4 | ||||
-rw-r--r-- | gtk/src/queuehandler.c | 2 |
8 files changed, 52 insertions, 110 deletions
diff --git a/doc/BUILD-Linux b/doc/BUILD-Linux index ecfc415d4..e84b31c10 100644 --- a/doc/BUILD-Linux +++ b/doc/BUILD-Linux @@ -1,4 +1,4 @@ -Guide to Building HandBrake svn3023 (2009121001) on Linux +Guide to Building HandBrake svn3269 (2010042701) on Linux ********************************************************* Table of Contents @@ -86,7 +86,7 @@ The GTK UI introduces some significant extra build requirements. If you intend to disable building the GUI with `configure --disable-gtk' you will not need many of these packages installed: -Ubuntu 8.04 - 9.10 packages: +Ubuntu 9.10 - 10.04 packages: * subversion (cli/gui) * yasm (cli/gui) @@ -109,9 +109,7 @@ Ubuntu 8.04 - 9.10 packages: * libgtk2.0-dev (gui) - * libhal-dev (gui) - - * libhal-storage-dev (gui) + * libgudev-1.0-dev (gui) * libwebkit-dev (gui) @@ -121,16 +119,14 @@ Ubuntu 8.04 - 9.10 packages: * libgstreamer-plugins-base0.10-dev (gui) -Ubuntu 8.04, substitute libwebkitgtk-dev for libwebkit-dev - To install these packages: sudo apt-get install subversion yasm build-essential \ autoconf libtool zlib1g-dev libbz2-dev intltool libglib2.0-dev \ - libdbus-glib-1-dev libgtk2.0-dev libhal-dev libhal-storage-dev \ + libdbus-glib-1-dev libgtk2.0-dev libgudev-1.0-dev \ libwebkit-dev libnotify-dev libgstreamer0.10-dev \ libgstreamer-plugins-base0.10-dev -Fedora 9 - 12 package groups: +Fedora 12 - 13 package groups: * Development Tools * Development Libraries @@ -152,7 +148,7 @@ Additional Fedora packages: * dbus-glib-devel (gui) - * hal-devel (gui) + * libgudev1-devel (gui) * webkitgtk-devel (gui) @@ -162,11 +158,9 @@ Additional Fedora packages: * gstreamer-plugins-base-devel (gui) -Fedora 9 & 10, substitute WebKit-gtk-devel for webkitgtk-devel - To install these packages: sudo yum install yasm zlib-devel bzip2-devel \ - dbus-glib-devel hal-devel webkitgtk-devel libnotify-devel\ + dbus-glib-devel libgudev1-devel webkitgtk-devel libnotify-devel\ gstreamer-devel gstreamer-plugins-base-devel 3 QuickStart @@ -554,7 +548,7 @@ Appendix A Project Repository Details root: svn://svn.handbrake.fr/HandBrake branch: trunk uuid: b64f7644-9d1e-0410-96f1-a4d463321fa5 - rev: 3023 - date: 2009-12-10 09:44:05 -0800 + rev: 3269 + date: 2010-04-27 09:51:55 -0700 type: developer diff --git a/doc/texi/Building.linux.texi b/doc/texi/Building.linux.texi index e1b75591b..6b283a5c4 100644 --- a/doc/texi/Building.linux.texi +++ b/doc/texi/Building.linux.texi @@ -36,7 +36,7 @@ The following are the recommended specifications for building on @value{OS.linux The @b{GTK UI} introduces some significant extra build requirements. If you intend to disable building the GUI with @command{configure --disable-gtk} you will not need many of these packages installed: -Ubuntu 8.04 - 9.10 packages: +Ubuntu 9.10 - 10.04 packages: @itemize @bullet @item subversion (cli/gui) @item yasm (cli/gui) @@ -49,26 +49,23 @@ Ubuntu 8.04 - 9.10 packages: @item libglib2.0-dev (gui) @item libdbus-glib-1-dev (gui) @item libgtk2.0-dev (gui) -@item libhal-dev (gui) -@item libhal-storage-dev (gui) +@item libgudev-1.0-dev (gui) @item libwebkit-dev (gui) @item libnotify-dev (gui) @item libgstreamer0.10-dev (gui) @item libgstreamer-plugins-base0.10-dev (gui) @end itemize -Ubuntu 8.04, substitute libwebkitgtk-dev for libwebkit-dev - To install these packages: @example sudo apt-get install subversion yasm build-essential \ autoconf libtool zlib1g-dev libbz2-dev intltool libglib2.0-dev \ -libdbus-glib-1-dev libgtk2.0-dev libhal-dev libhal-storage-dev \ +libdbus-glib-1-dev libgtk2.0-dev libgudev-1.0-dev \ libwebkit-dev libnotify-dev libgstreamer0.10-dev \ libgstreamer-plugins-base0.10-dev @end example -Fedora 9 - 12 package groups: +Fedora 12 - 13 package groups: @itemize @bullet @item Development Tools @item Development Libraries @@ -88,19 +85,17 @@ Additional Fedora packages: @item zlib-devel (cli/gui) @item bzip2-devel (cli/gui) @item dbus-glib-devel (gui) -@item hal-devel (gui) +@item libgudev1-devel (gui) @item webkitgtk-devel (gui) @item libnotify-devel (gui) @item gstreamer-devel (gui) @item gstreamer-plugins-base-devel (gui) @end itemize -Fedora 9 & 10, substitute WebKit-gtk-devel for webkitgtk-devel - To install these packages: @example sudo yum install yasm zlib-devel bzip2-devel \ -dbus-glib-devel hal-devel webkitgtk-devel libnotify-devel\ +dbus-glib-devel libgudev1-devel webkitgtk-devel libnotify-devel\ gstreamer-devel gstreamer-plugins-base-devel @end example diff --git a/gtk/configure.ac b/gtk/configure.ac index 0a1b2517d..0323214f2 100644 --- a/gtk/configure.ac +++ b/gtk/configure.ac @@ -76,7 +76,7 @@ case $host in mingw_flag=yes ;; *) - GHB_PACKAGES="gtk+-2.0 >= 2.10 gthread-2.0 gstreamer-0.10 gstreamer-interfaces-0.10 gstreamer-video-0.10 gstreamer-pbutils-0.10 gio-2.0 hal hal-storage libnotify" + GHB_PACKAGES="gtk+-2.0 >= 2.10 gthread-2.0 gstreamer-0.10 gstreamer-interfaces-0.10 gstreamer-video-0.10 gstreamer-pbutils-0.10 gio-2.0 libnotify gudev-1.0" mingw_flag=no ;; esac diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c index 9f89ba9d8..682b90cf6 100644 --- a/gtk/src/callbacks.c +++ b/gtk/src/callbacks.c @@ -22,7 +22,8 @@ #if !defined(_WIN32) #include <poll.h> -#include <libhal-storage.h> +#define G_UDEV_API_IS_SUBJECT_TO_CHANGE 1 +#include <gudev/gudev.h> #include <dbus/dbus-glib.h> #include <dbus/dbus-glib-lowlevel.h> @@ -3785,7 +3786,7 @@ dvd_device_list() } #if !defined(_WIN32) -static LibHalContext *hal_ctx = NULL; +static GUdevClient *udev_ctx = NULL; #endif gboolean @@ -3793,27 +3794,43 @@ ghb_is_cd(GDrive *gd) { #if !defined(_WIN32) gchar *device; - LibHalDrive *halDrive; - LibHalDriveType dtype; + GUdevDevice *udd; - if (hal_ctx == NULL) + if (udev_ctx == NULL) return FALSE; device = g_drive_get_identifier(gd, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE); if (device == NULL) return FALSE; - halDrive = libhal_drive_from_device_file (hal_ctx, device); + + udd = g_udev_client_query_by_device_file(udev_ctx, device); g_free(device); - if (halDrive == NULL) + + if (udd == NULL) + { + g_message("udev: Failed to lookup device %s", device); return FALSE; - dtype = libhal_drive_get_type(halDrive); - libhal_drive_free(halDrive); - return (dtype == LIBHAL_DRIVE_TYPE_CDROM); + } + + gint val; + val = g_udev_device_get_property_as_int(udd, "ID_CDROM_DVD"); + if (val == 1) + return TRUE; + + return FALSE; #else return FALSE; #endif } +void +ghb_udev_init() +{ +#if !defined(_WIN32) + udev_ctx = g_udev_client_new(NULL); +#endif +} + #if defined(_WIN32) static void handle_media_change(const gchar *device, gboolean insert, signal_user_data_t *ud) @@ -3962,12 +3979,6 @@ drive_changed_cb(GVolumeMonitor *gvm, GDrive *gd, signal_user_data_t *ud) #endif #if !defined(_WIN32) -static void -dbus_init (void) -{ - dbus_g_thread_init(); -} - #define GPM_DBUS_PM_SERVICE "org.freedesktop.PowerManagement" #define GPM_DBUS_PM_PATH "/org/freedesktop/PowerManagement" #define GPM_DBUS_PM_INTERFACE "org.freedesktop.PowerManagement" @@ -4070,11 +4081,11 @@ ghb_suspend_gpm() #endif } +#if !defined(_WIN32) static gboolean ghb_can_shutdown_gpm() { gboolean can_shutdown = FALSE; -#if !defined(_WIN32) DBusGConnection *conn; DBusGProxy *proxy; GError *error = NULL; @@ -4115,14 +4126,14 @@ ghb_can_shutdown_gpm() } g_object_unref(G_OBJECT(proxy)); dbus_g_connection_unref(conn); -#endif return can_shutdown; } +#endif +#if !defined(_WIN32) static void ghb_shutdown_gpm() { -#if !defined(_WIN32) DBusGConnection *conn; DBusGProxy *proxy; GError *error = NULL; @@ -4160,8 +4171,8 @@ ghb_shutdown_gpm() } g_object_unref(G_OBJECT(proxy)); dbus_g_connection_unref(conn); -#endif } +#endif void ghb_inhibit_gpm() @@ -4480,65 +4491,6 @@ ghb_uninhibit_gsm() #endif } -void -ghb_hal_init() -{ -#if !defined(_WIN32) - DBusGConnection *gconn; - DBusConnection *conn; - GError *gerror = NULL; - DBusError error; - char **devices; - int nr; - - dbus_init (); - - if (!(hal_ctx = libhal_ctx_new ())) { - g_warning ("failed to create a HAL context!"); - return; - } - - gconn = dbus_g_bus_get(DBUS_BUS_SYSTEM, &gerror); - if (gerror != NULL) - { - g_warning("DBUS cannot connect: %s", gerror->message); - g_error_free(gerror); - return; - } - conn = dbus_g_connection_get_connection(gconn); - libhal_ctx_set_dbus_connection (hal_ctx, conn); - dbus_error_init (&error); - if (!libhal_ctx_init (hal_ctx, &error)) { - g_warning ("libhal_ctx_init failed: %s", error.message ? error.message : "unknown"); - dbus_error_free (&error); - libhal_ctx_free (hal_ctx); - dbus_g_connection_unref(gconn); - hal_ctx = NULL; - return; - } - - /* - * Do something to ping the HAL daemon - the above functions will - * succeed even if hald is not running, so long as DBUS is. But we - * want to exit silently if hald is not running, to behave on - * pre-2.6 systems. - */ - if (!(devices = libhal_get_all_devices (hal_ctx, &nr, &error))) { - g_warning ("seems that HAL is not running: %s", error.message ? error.message : "unknown"); - dbus_error_free (&error); - - libhal_ctx_shutdown (hal_ctx, NULL); - libhal_ctx_free (hal_ctx); - hal_ctx = NULL; - dbus_g_connection_unref(gconn); - return; - } - - libhal_free_string_array (devices); - dbus_g_connection_unref(gconn); -#endif -} - G_MODULE_EXPORT gboolean tweak_setting_cb( GtkWidget *widget, diff --git a/gtk/src/callbacks.h b/gtk/src/callbacks.h index a124ab59f..f873c871f 100644 --- a/gtk/src/callbacks.h +++ b/gtk/src/callbacks.h @@ -41,7 +41,7 @@ void debug_log_handler( const gchar *domain, GLogLevelFlags flags, const gchar *msg, gpointer ud); void ghb_hbfd(signal_user_data_t *ud, gboolean hbfd); gboolean ghb_file_menu_add_dvd(signal_user_data_t *ud); -void ghb_hal_init(void); +void ghb_udev_init(void); gboolean ghb_message_dialog( GtkMessageType type, const gchar *message, const gchar *no, const gchar *yes); diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c index 55f9747c9..97f7d8df1 100644 --- a/gtk/src/hb-backend.c +++ b/gtk/src/hb-backend.c @@ -2017,7 +2017,6 @@ ghb_longest_title() hb_title_t * title; gint ii; gint count = 0; - guint64 longest = 0; gint titleindex = 0; gint feature; diff --git a/gtk/src/main.c b/gtk/src/main.c index 3782efe95..20e9f8518 100644 --- a/gtk/src/main.c +++ b/gtk/src/main.c @@ -37,6 +37,7 @@ #if !defined(_WIN32) #include <gst/gst.h> #include <libnotify/notify.h> +#include <dbus/dbus-glib.h> #else #include <windows.h> #include <io.h> @@ -800,8 +801,9 @@ main (int argc, char *argv[]) ghb_load_icons(); #if !defined(_WIN32) - ghb_hal_init(); + dbus_g_thread_init(); #endif + ghb_udev_init(); ghb_write_pid_file(); ud = g_malloc0(sizeof(signal_user_data_t)); diff --git a/gtk/src/queuehandler.c b/gtk/src/queuehandler.c index 3b91a2464..7be812b70 100644 --- a/gtk/src/queuehandler.c +++ b/gtk/src/queuehandler.c @@ -94,7 +94,7 @@ add_to_queue_list(signal_user_data_t *ud, GValue *settings, GtkTreeIter *piter) vqtype = ghb_settings_get_boolean(settings, "vquality_type_constant"); if (!vqtype) pass2 = ghb_settings_get_boolean(settings, "VideoTwoPass"); - const gchar *points; + const gchar *points = "Chapters"; if (ghb_settings_combo_int(settings, "PtoPType") == 0) points = "Chapters"; else if (ghb_settings_combo_int(settings, "PtoPType") == 1) |