Update of /cvsroot/xine/gnome-xine/src In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv541/src Modified Files: desktop_integration.c engine.c globals.h gtkvideo.c http.c main.c player.c script_engine.c utils.c Log Message: Sync with master hg repository, changeset 1736. Index: desktop_integration.c =================================================================== RCS file: /cvsroot/xine/gnome-xine/src/desktop_integration.c,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- desktop_integration.c 19 Jul 2006 01:51:47 -0000 1.27 +++ desktop_integration.c 12 Nov 2006 14:02:40 -0000 1.28 @@ -31,7 +31,9 @@ #include <stdlib.h> #include <stdio.h> #include <dlfcn.h> +#ifdef HAVE_ALLOCA_H #include <alloca.h> +#endif #include <string.h> #include <sys/types.h> #include <sys/stat.h> @@ -54,7 +56,6 @@ void (*application_registry_set_value) (const char *app_id, const char *key, const char *value); void (*application_registry_set_bool_value) (const char *app_id, const char *key, int value); void (*application_registry_remove_mime_type) (const char *app_id, const char *mime_type); - #ifndef GNOME_VFS_DISABLE_DEPRECATED void (*mime_freeze) (void); void (*mime_thaw) (void); Index: engine.c =================================================================== RCS file: /cvsroot/xine/gnome-xine/src/engine.c,v retrieving revision 1.46 retrieving revision 1.47 diff -u -r1.46 -r1.47 --- engine.c 10 Aug 2006 00:43:50 -0000 1.46 +++ engine.c 12 Nov 2006 14:02:40 -0000 1.47 @@ -30,13 +30,15 @@ #include <stdarg.h> #include <errno.h> +#include <glib/gthread.h> + #include "engine.h" #include "ui.h" #include "utils.h" se_t *gse; /* global script engine */ xine_t *xine; /* global xine instance */ -pthread_mutex_t engine_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; +GStaticRecMutex engine_lock = G_STATIC_REC_MUTEX_INIT; gboolean initialised = FALSE; @@ -135,6 +137,10 @@ gtk_label_set_use_markup (GTK_LABEL (label), TRUE); vbox = GTK_BOX (GTK_DIALOG (about)->vbox); gtk_box_pack_end (vbox, label, FALSE, FALSE, 2); + g_object_connect (about, + "signal::delete-event", G_CALLBACK (gtk_widget_hide_on_delete), NULL, + "signal::response", G_CALLBACK (gtk_widget_hide), NULL, + NULL); } window_show (about, NULL); @@ -172,10 +178,10 @@ g_warning ("JS execution during startup: %s: %s", src, cmd); #endif - if (pthread_mutex_lock (&engine_lock)) + if (!g_static_rec_mutex_trylock (&engine_lock)) { g_critical (_("JS execution attempted while lock already held.\n" - "Try to reproduce this in a debugger (set a breakpoint on g_critical).\n" + "Try to reproduce this in a debugger (set a breakpoint on g_log).\n" "Get a backtrace of all gxine threads and report it!")); engine_queue_push (cmd, NULL, cb, cb_data, ecb, src); return 1; @@ -224,11 +230,11 @@ else { /* return 0 iff the result type wasn't recognised */ - pthread_mutex_unlock (&engine_lock); + g_static_rec_mutex_unlock (&engine_lock); return 0; } - pthread_mutex_unlock (&engine_lock); + g_static_rec_mutex_unlock (&engine_lock); return 1; } @@ -300,10 +306,10 @@ /* js_lock must be recursive since, if the engine is busy, this function * WILL be re-entered from the same thread with the lock already held. */ - static pthread_mutex_t js_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; + static GStaticRecMutex js_lock = G_STATIC_REC_MUTEX_INIT; exec_t *js; - pthread_mutex_lock (&js_lock); + g_static_rec_mutex_lock (&js_lock); while ((js = g_async_queue_try_pop (js_queue))) { /* This function is entered with the GDK lock held. This is bad, from @@ -322,7 +328,7 @@ free (js->src); free (js); } - pthread_mutex_unlock (&js_lock); + g_static_rec_mutex_unlock (&js_lock); return TRUE; } @@ -556,37 +562,47 @@ #ifdef LOCK_DEBUG #include <assert.h> -static __thread int m_depth = 0; +static __thread int m_depth = 0, g_depth = 0; +static pthread_mutex_t guard = PTHREAD_MUTEX_INITIALIZER; #include <sys/syscall.h> -_syscall0 (pid_t, gettid); +#include <unistd.h> +#define gettid() (int) syscall (__NR_gettid) int gxine_mutex_lock (pthread_mutex_t *mutex, const char *fn, int line) { - int l = m_depth++; + (pthread_mutex_lock) (&guard); + int l = m_depth++ + g_depth; + (pthread_mutex_unlock) (&guard); g_printerr ("%*s lock %5d: %s %d\n", l + 3, "pth", gettid (), fn, line); return (pthread_mutex_lock) (mutex); } int gxine_mutex_unlock (pthread_mutex_t *mutex, const char *fn, int line) { - int l = --m_depth; - assert (l >= 0); + (pthread_mutex_lock) (&guard); + int l = --m_depth + g_depth; + assert (m_depth >= 0); + (pthread_mutex_unlock) (&guard); g_printerr ("%*s unlock %5d: %s %d\n", l + 3, "pth", gettid (), fn, line); return (pthread_mutex_unlock) (mutex); } void gxine_threads_enter (const char *fn, int line) { - int l = m_depth++; + (pthread_mutex_lock) (&guard); + int l = g_depth++ + m_depth; + (pthread_mutex_unlock) (&guard); g_printerr ("%*s lock %5d: %s %d\n", l + 3, "gdk", gettid (), fn, line); (gdk_threads_enter) (); } void gxine_threads_leave (const char *fn, int line) { - int l = --m_depth; - assert (l >= 0); + (pthread_mutex_lock) (&guard); + int l = --g_depth + m_depth; + /* assert (l >= 0); ** -1 unavoidably occurs in one instance */ + (pthread_mutex_unlock) (&guard); g_printerr ("%*s unlock %5d: %s %d\n", l + 3, "gdk", gettid (), fn, line); (gdk_threads_leave) (); } Index: globals.h =================================================================== RCS file: /cvsroot/xine/gnome-xine/src/globals.h,v retrieving revision 1.41 retrieving revision 1.42 diff -u -r1.41 -r1.42 --- globals.h 19 Jul 2006 01:51:47 -0000 1.41 +++ globals.h 12 Nov 2006 14:02:40 -0000 1.42 @@ -48,8 +48,9 @@ extern GtkWidget *menubar, *popup_menu; extern GtkWidget *keypad; extern GSList *infobars, *timewidgets; -extern pthread_mutex_t engine_lock, widgets_update_lock; +extern pthread_mutex_t widgets_update_lock; extern gboolean initialised; +extern GStaticRecMutex engine_lock; extern GdkPixbuf *gxine_logo; Index: gtkvideo.c =================================================================== RCS file: /cvsroot/xine/gnome-xine/src/gtkvideo.c,v retrieving revision 1.128 retrieving revision 1.129 diff -u -r1.128 -r1.129 --- gtkvideo.c 27 Aug 2006 18:34:05 -0000 1.128 +++ gtkvideo.c 12 Nov 2006 14:02:40 -0000 1.129 @@ -1333,7 +1333,7 @@ if (fullscreen == is_fullscreen (priv)) return; - pthread_mutex_lock (&engine_lock); + g_static_rec_mutex_lock (&engine_lock); display = gtv_get_xdisplay (gtv); XLockDisplay (display); toplevel = GTK_WINDOW (gtk_widget_get_toplevel (>v->widget)); @@ -1386,7 +1386,7 @@ } XUnlockDisplay (display); - pthread_mutex_unlock (&engine_lock); + g_static_rec_mutex_unlock (&engine_lock); } gint gtk_video_is_fullscreen (GtkVideo *gtv) @@ -1917,11 +1917,42 @@ return (gtv && gtv->priv) ? gtv->priv->auto_rescale : FALSE; } +static int screensaver_poke (const char *const argv[], const char *name) +{ + int ret = 60; /* default return = try again in 4 minutes */ + GError *err = NULL; + + g_spawn_async (NULL, (gchar **)argv, NULL, + G_SPAWN_SEARCH_PATH | G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL, + NULL, NULL, NULL, &err); + if (err) + { + g_printerr (_("gtkvideo: can't poke %s: %s\n"), name, err->message); + if (err->domain == G_SPAWN_ERROR) + switch (err->code) + { + case G_SPAWN_ERROR_ACCES: + case G_SPAWN_ERROR_PERM: + case G_SPAWN_ERROR_NOEXEC: + case G_SPAWN_ERROR_NOENT: + case G_SPAWN_ERROR_ISDIR: + g_printerr (_("gtkvideo: not trying again\n")); + ret = -1; + break; + default: + ret = 60; + break; + } + g_error_free (err); + } + + return ret; +} + static gboolean gtv_unblank_screen (GtkVideo *gtv) { gtk_video_private_t *priv = gtv->priv; Display *display; - static int gnome_screensaver = 0; if (!is_fullscreen (priv)) return FALSE; @@ -1950,44 +1981,34 @@ XForceScreenSaver (display, ScreenSaverReset); } -#ifdef GNOME_SCREENSAVER_COMMAND if (!screensaver_is_running_dbus (priv)) { +#ifdef GNOME_SCREENSAVER_COMMAND /* poke GNOME screensaver (assume that $PATH is sane) */ + static int gnome_screensaver = 0; if (gnome_screensaver > 0) --gnome_screensaver; if (!gnome_screensaver) { - GError *err = NULL; - const char *const argv[] = { GNOME_SCREENSAVER_COMMAND, "--poke", NULL }; - g_spawn_async (NULL, (gchar **)argv, NULL, - G_SPAWN_SEARCH_PATH | G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL, - NULL, NULL, NULL, &err); - if (err) - { - g_printerr (_("gtkvideo: can't poke gnome-screensaver: %s\n"), - err->message); - if (err->domain == G_SPAWN_ERROR) - switch (err->code) - { - case G_SPAWN_ERROR_ACCES: - case G_SPAWN_ERROR_PERM: - case G_SPAWN_ERROR_NOEXEC: - case G_SPAWN_ERROR_NOENT: - case G_SPAWN_ERROR_ISDIR: - g_printerr (_("gtkvideo: not trying again\n")); - gnome_screensaver = -1; - break; - default: - gnome_screensaver = 60; /* try again in 4 minutes */ - break; - } - g_error_free (err); - } + static const char *const argv[] = { GNOME_SCREENSAVER_COMMAND, "--poke", NULL }; + /* screensaver name is used in "can't poke <name>" */ + gnome_screensaver = screensaver_poke (argv, _("gnome-screensaver")); } - } #endif +#ifdef X_SCREENSAVER_COMMAND + /* similarly, poke xscreensaver */ + static int x_screensaver = 0; + if (x_screensaver > 0) + --x_screensaver; + if (!x_screensaver) + { + static const char *const argv[] = { X_SCREENSAVER_COMMAND, "--deactivate", NULL }; + x_screensaver = screensaver_poke (argv, _("xscreensaver")); + } +#endif + } + XUnlockDisplay (display); return FALSE; Index: http.c =================================================================== RCS file: /cvsroot/xine/gnome-xine/src/http.c,v retrieving revision 1.33 retrieving revision 1.34 diff -u -r1.33 -r1.34 --- http.c 18 Sep 2006 18:59:24 -0000 1.33 +++ http.c 12 Nov 2006 14:02:40 -0000 1.34 @@ -35,6 +35,8 @@ #include <ctype.h> #include <errno.h> +#include <netinet/in.h> + #include "http.h" #include "utils.h" Index: main.c =================================================================== RCS file: /cvsroot/xine/gnome-xine/src/main.c,v retrieving revision 1.173 retrieving revision 1.174 diff -u -r1.173 -r1.174 --- main.c 2 Oct 2006 21:08:57 -0000 1.173 +++ main.c 12 Nov 2006 14:02:40 -0000 1.174 @@ -238,6 +238,20 @@ } #endif +/* Our own locking for GDK */ + +static GStaticRecMutex gdk_lock = G_STATIC_REC_MUTEX_INIT; + +static void gxine_gdk_lock (void) +{ + g_static_rec_mutex_lock (&gdk_lock); +} + +static void gxine_gdk_unlock (void) +{ + g_static_rec_mutex_unlock (&gdk_lock); +} + /* Main */ int main(int argc, char* argv[]) @@ -318,6 +332,7 @@ g_thread_init (NULL); console_output_init (); + gdk_threads_set_lock_functions (gxine_gdk_lock, gxine_gdk_unlock); gdk_threads_init (); /* Index: player.c =================================================================== RCS file: /cvsroot/xine/gnome-xine/src/player.c,v retrieving revision 1.90 retrieving revision 1.91 diff -u -r1.90 -r1.91 --- player.c 27 Aug 2006 18:30:52 -0000 1.90 +++ player.c 12 Nov 2006 14:02:40 -0000 1.91 @@ -153,19 +153,30 @@ _("No demuxer found - stream format not recognised.")); break; + case XINE_ERROR_DEMUX_FAILED: + display_error (FROM_XINE, _("The xine engine failed to start."), + _("Demuxing failed.\n" + "Maybe the stream is corrupt or of an unexpected type.")); + break; + case XINE_ERROR_MALFORMED_MRL: display_error (FROM_XINE, _("The xine engine failed to start."), _("The MRL is malformed.")); break; + case XINE_ERROR_INPUT_FAILED: + display_error (FROM_XINE, _("The xine engine failed to start."), + _("The stream could not be opened.")); + break; + + default: display_error (FROM_XINE, _("The xine engine failed to start."), _("Unknown error (code %d)"), error); } g_idle_add ((GSourceFunc)playlist_logo, NULL); - gdk_threads_leave (); - goto done; + goto done; /* will call gdk_threads_leave */ } gdk_threads_enter (); Index: script_engine.c =================================================================== RCS file: /cvsroot/xine/gnome-xine/src/script_engine.c,v retrieving revision 1.92 retrieving revision 1.93 diff -u -r1.92 -r1.93 --- script_engine.c 27 Aug 2006 18:31:39 -0000 1.92 +++ script_engine.c 12 Nov 2006 14:02:40 -0000 1.93 @@ -1559,7 +1559,11 @@ pthread_mutexattr_t attr; pthread_mutexattr_init (&attr); +#ifdef PTHREAD_MUTEX_RECURSIVE_NP pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE_NP); +#else /* *BSD does not have the _NP in the name */ + pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE); +#endif pthread_mutex_init (&se->lock, &attr); pthread_mutexattr_destroy (&attr); Index: utils.c =================================================================== RCS file: /cvsroot/xine/gnome-xine/src/utils.c,v retrieving revision 1.81 retrieving revision 1.82 diff -u -r1.81 -r1.82 --- utils.c 19 Jul 2006 01:51:47 -0000 1.81 +++ utils.c 12 Nov 2006 14:02:40 -0000 1.82 @@ -259,6 +259,8 @@ default:; } + gdk_threads_enter (); + dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_DESTROY_WITH_PARENT | (modal ? GTK_DIALOG_MODAL : 0), type, GTK_BUTTONS_CLOSE, "%s", primary ? : msg); @@ -278,6 +280,8 @@ gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); } + + gdk_threads_leave (); } |