$OpenBSD: patch-src_thread_c,v 1.8 2011/01/18 11:03:20 dcoppa Exp $

fix an assertion failure

fixes from upstream:
set the MEDIAENDED state correctly when running as plugin
bump QuickTime emulation to 7.6.9 (fix apple.com movie trailers)

--- src/thread.c.orig	Fri Nov  5 17:16:22 2010
+++ src/thread.c	Tue Jan 18 10:36:05 2011
@@ -448,7 +448,7 @@ gboolean thread_reader(GIOChannel * source, GIOConditi
 		if (embed_window == 0)
 			idledata->cachepercent = 0.0;
 
-		if (g_ascii_strncasecmp(vo, "gl2", strlen("gl2")) != 0) {
+		if (vo != NULL && g_ascii_strncasecmp(vo, "gl2", strlen("gl2")) != 0) {
 		    cmd = g_strdup_printf("brightness %i\n", idledata->brightness);
 		    send_command(cmd, TRUE);
 		    g_free(cmd);
@@ -1302,7 +1302,10 @@ gpointer launch_player(gpointer data)
 
     if (g_strrstr(threaddata->filename, "apple.com")) {
         argv[arg++] = g_strdup_printf("-user-agent");
-        argv[arg++] = g_strdup_printf("QuickTime/7.6.4");
+        argv[arg++] = g_strdup_printf("QuickTime/7.6.9");
+    } else {
+        argv[arg++] = g_strdup_printf("-user-agent");
+        argv[arg++] = g_strdup_printf("Mozilla/5.0");
     }
 
     /* disable msg stuff to make sure extra console characters don't mess around */
@@ -1495,6 +1498,7 @@ gpointer launch_player(gpointer data)
 
                     // nothing is on the playlist and we are not looping so ask plugin for next item
                     if (embed_window != 0 || control_id != 0) {
+                        js_state = STATE_MEDIAENDED;
                         dbus_send_event("MediaComplete", 0);
                         dbus_open_next();
                     }
