Fix trailers.apple.com. It works well now (yay!)

From upstream svn
This commit is contained in:
dcoppa 2011-07-12 08:12:28 +00:00
parent 9c199e02f7
commit d370e0b0f0
8 changed files with 286 additions and 6 deletions

View File

@ -1,8 +1,9 @@
# $OpenBSD: Makefile,v 1.22 2011/07/04 13:33:30 dcoppa Exp $
# $OpenBSD: Makefile,v 1.23 2011/07/12 08:12:29 dcoppa Exp $
COMMENT = gnome-mplayer browser media plugin
V = 1.0.4
DISTNAME = gecko-mediaplayer-${V}
REVISION = 0
CATEGORIES = www
MAINTAINER = David Coppa <dcoppa@openbsd.org>

View File

@ -1,7 +1,9 @@
$OpenBSD: patch-configure,v 1.7 2011/07/04 13:33:30 dcoppa Exp $
$OpenBSD: patch-configure,v 1.8 2011/07/12 08:12:29 dcoppa Exp $
Use '-pthread' instead of '-lpthread' for libpthread linkage
Remove -ldl
Fix GECKO_CFLAGS and GECKO_LIBS
--- configure.orig Thu Apr 21 16:59:11 2011

View File

@ -0,0 +1,73 @@
$OpenBSD: patch-src_plugin_cpp,v 1.6 2011/07/12 08:12:29 dcoppa Exp $
Fix apple.com/trailers (upstream svn revisions r468 and r470)
--- src/plugin.cpp.orig Mon Jun 20 17:00:33 2011
+++ src/plugin.cpp Tue Jul 12 09:31:06 2011
@@ -1320,7 +1320,7 @@ int progress_callback(void *clientp, double dltotal, d
ListItem *item = (ListItem *) clientp;
gdouble percent, rate;
gchar *text;
- gboolean ok_to_play;
+ gboolean ok_to_play = FALSE;
gint id;
gboolean ready;
gboolean newwindow;
@@ -1364,8 +1364,6 @@ int progress_callback(void *clientp, double dltotal, d
rate);
}
send_signal_with_string(plugin, item, "SetProgressText", text);
- if (!item->opened)
- send_signal_with_string(plugin, item, "SetURL", item->src);
if (plugin->post_dom_events && plugin->id != NULL) {
postDOMEvent(plugin->mInstance, plugin->id, "qt_progress");
postDOMEvent(plugin->mInstance, plugin->id, "qt_durationchange");
@@ -1391,7 +1389,6 @@ int progress_callback(void *clientp, double dltotal, d
if (ok_to_play == FALSE) {
if (item->bitrate == 0 && item->bitrate_requests < 5
&& ((gint) (percent * 100) > item->bitrate_requests)) {
- item->bitrate = request_bitrate(plugin, item, item->local);
item->bitrate_requests++;
}
if (item->bitrate > 0) {
@@ -1418,6 +1415,7 @@ int progress_callback(void *clientp, double dltotal, d
if (!item->streaming) {
printf("in progress_callback\n");
plugin->playlist = list_parse_qt(plugin->playlist, item);
+ plugin->playlist = list_parse_qt2(plugin->playlist, item);
plugin->playlist = list_parse_asx(plugin->playlist, item);
plugin->playlist = list_parse_qml(plugin->playlist, item);
plugin->playlist = list_parse_ram(plugin->playlist, item);
@@ -1493,13 +1491,14 @@ gpointer CURLGetURLNotify(gpointer data)
}
fclose(local);
- printf("fetched %s to %s\n", item->src, item->local);
+ printf("fetched %s to %s opened = %i\n", item->src, item->local, item->opened);
+ send_signal_with_double(plugin, item, "SetCachePercent", 1.0);
send_signal_with_double(plugin, item, "SetCachePercent", 0.0);
item->retrieved = TRUE;
}
- if ((!item->opened)) {
+ if (!item->opened) {
id = item->controlid;
path = g_strdup(item->path);
ready = item->playerready;
@@ -1509,13 +1508,14 @@ gpointer CURLGetURLNotify(gpointer data)
if (!item->streaming) {
printf("in CURLGetURLNotify\n");
plugin->playlist = list_parse_qt(plugin->playlist, item);
+ plugin->playlist = list_parse_qt2(plugin->playlist, item);
plugin->playlist = list_parse_asx(plugin->playlist, item);
plugin->playlist = list_parse_qml(plugin->playlist, item);
plugin->playlist = list_parse_ram(plugin->playlist, item);
}
// printf("item->play = %i\n", item->play);
// printf("item->src = %i\n", item->src);
- // printf("calling open_location from Write\n");
+ // printf("calling open_location from CURLGetURLNotify\n");
if (item->play) {
send_signal_with_integer(plugin, item, "SetGUIState", PLAYING);
open_location(plugin, item, TRUE);

View File

@ -1,7 +1,8 @@
# $OpenBSD: Makefile,v 1.42 2011/07/04 13:32:55 dcoppa Exp $
# $OpenBSD: Makefile,v 1.43 2011/07/12 08:12:28 dcoppa Exp $
COMMENT = GTK+/GNOME frontend for MPlayer
DISTNAME = gnome-mplayer-1.0.4
REVISION = 0
CATEGORIES = x11 multimedia
MAINTAINER = David Coppa <dcoppa@openbsd.org>

View File

@ -1,10 +1,13 @@
$OpenBSD: patch-src_gui_c,v 1.15 2011/07/04 13:32:55 dcoppa Exp $
$OpenBSD: patch-src_gui_c,v 1.16 2011/07/12 08:12:29 dcoppa Exp $
Fix an issue when alsa is not being used
(upstream svn revision r2151)
--- src/gui.c.orig Mon Jul 4 14:43:40 2011
+++ src/gui.c Mon Jul 4 14:44:57 2011
Raise event on incomplete QuickTime file, and mark it for retry
(fix apple.com/trailers) - upstream svn revision r2152
--- src/gui.c.orig Mon Jun 27 16:59:45 2011
+++ src/gui.c Mon Jul 11 10:19:19 2011
@@ -5073,7 +5073,7 @@ void menuitem_config_callback(GtkMenuItem * menuitem,
gtk_spin_button_set_value(GTK_SPIN_BUTTON(config_volume), gm_pref_store_get_int(gm_store, VOLUME));
gm_pref_store_free(gm_store);
@ -14,3 +17,15 @@ Fix an issue when alsa is not being used
gtk_entry_set_alignment(GTK_ENTRY(config_volume), 1);
gtk_widget_show(config_volume);
i++;
@@ -6052,6 +6052,11 @@ void player_attribute_changed_callback(GmtkMediaTracke
g_strlcpy(idledata->media_info, text, 1024);
g_thread_create(get_cover_art, metadata, FALSE, NULL);
break;
+
+ case ATTRIBUTE_RETRY_ON_FULL_CACHE:
+ idledata->retry_on_full_cache = gmtk_media_player_get_attribute_boolean (GMTK_MEDIA_PLAYER(media), ATTRIBUTE_RETRY_ON_FULL_CACHE);
+ break;
+
default:
if (verbose) {
printf("Unhandled attribute change %i\n", attribute);

View File

@ -0,0 +1,122 @@
$OpenBSD: patch-src_libgmtk_gmtk_media_player_c,v 1.1 2011/07/12 08:12:29 dcoppa Exp $
Raise event on incomplete QuickTime file, and mark it for retry
(fix apple.com/trailers) - upstream svn revision r2152
--- src/libgmtk/gmtk_media_player.c.orig Tue Jun 28 18:19:18 2011
+++ src/libgmtk/gmtk_media_player.c Mon Jul 11 10:19:19 2011
@@ -69,15 +69,27 @@ gboolean signal_event(gpointer data)
if (event && event->event_name != NULL
&& (event->player->restart == FALSE || event->event_data_int == ATTRIBUTE_AF_EXPORT_FILENAME)) {
- if (g_strcasecmp(event->event_name, "position-changed") == 0 ||
- g_strcasecmp(event->event_name, "cache-percent-changed") == 0) {
- g_signal_emit_by_name(event->player, event->event_name, event->event_data_double);
- } else if (g_strcasecmp(event->event_name, "size_allocate") == 0) {
- g_signal_emit_by_name(event->player, event->event_name, event->event_allocation);
- } else {
- g_signal_emit_by_name(event->player, event->event_name, event->event_data_int);
- }
+ switch (event->type) {
+ case EVENT_TYPE_INT:
+ g_signal_emit_by_name(event->player, event->event_name, event->event_data_int);
+ break;
+
+ case EVENT_TYPE_DOUBLE:
+ g_signal_emit_by_name(event->player, event->event_name, event->event_data_double);
+ break;
+
+ case EVENT_TYPE_BOOLEAN:
+ g_signal_emit_by_name(event->player, event->event_name, event->event_data_boolean);
+ break;
+
+ case EVENT_TYPE_ALLOCATION:
+ g_signal_emit_by_name(event->player, event->event_name, event->event_allocation);
+ break;
+
+ default:
+ printf("undefined event %s\n", event->event_name);
+ }
g_free(event->event_name);
}
if (event)
@@ -93,6 +105,7 @@ void create_event_int(GmtkMediaPlayer * player, const
event = g_new0(GmtkMediaPlayerEvent, 1);
event->player = player;
+ event->type = EVENT_TYPE_INT;
event->event_name = g_strdup(name);
event->event_data_int = value;
g_idle_add(signal_event, event);
@@ -104,17 +117,31 @@ void create_event_double(GmtkMediaPlayer * player, con
event = g_new0(GmtkMediaPlayerEvent, 1);
event->player = player;
+ event->type = EVENT_TYPE_DOUBLE;
event->event_name = g_strdup(name);
event->event_data_double = value;
g_idle_add(signal_event, event);
}
+void create_event_boolean(GmtkMediaPlayer * player, const gchar * name, gboolean value)
+{
+ GmtkMediaPlayerEvent *event;
+
+ event = g_new0(GmtkMediaPlayerEvent, 1);
+ event->player = player;
+ event->type = EVENT_TYPE_BOOLEAN;
+ event->event_name = g_strdup(name);
+ event->event_data_boolean = value;
+ g_idle_add(signal_event, event);
+}
+
void create_event_allocation(GmtkMediaPlayer * player, const gchar * name, GtkAllocation * allocation)
{
GmtkMediaPlayerEvent *event;
event = g_new0(GmtkMediaPlayerEvent, 1);
event->player = player;
+ event->type = EVENT_TYPE_ALLOCATION;
event->event_name = g_strdup(name);
event->event_allocation = allocation;
g_idle_add(signal_event, event);
@@ -300,6 +327,7 @@ static void gmtk_media_player_init(GmtkMediaPlayer * p
player->channel_in = NULL;
player->channel_out = NULL;
player->channel_err = NULL;
+ player->retry_on_full_cache = FALSE;
}
static void gmtk_media_player_dispose(GObject * object)
@@ -993,6 +1021,10 @@ gboolean gmtk_media_player_get_attribute_boolean(GmtkM
ret = player->hardware_ac3;
break;
+ case ATTRIBUTE_RETRY_ON_FULL_CACHE:
+ ret = player->retry_on_full_cache;
+ break;
+
default:
if (player->debug)
printf("Unsupported Attribute\n");
@@ -1788,6 +1820,7 @@ gpointer launch_mplayer(gpointer data)
player->title_is_menu = FALSE;
player->enable_divx = TRUE;
player->disable_xvmc = FALSE;
+ player->retry_on_full_cache = FALSE;
g_mutex_lock(player->thread_running);
@@ -2477,6 +2510,11 @@ gboolean thread_reader_error(GIOChannel * source, GIOC
error_msg = g_strdup_printf(_("Compressed SWF format not supported"));
}
+ if (strstr(mplayer_output->str, "MOV: missing header (moov/cmov) chunk") != NULL) {
+ player->retry_on_full_cache = TRUE;
+ create_event_boolean(player, "attribute-changed", ATTRIBUTE_RETRY_ON_FULL_CACHE);
+ }
+
if (strstr(mplayer_output->str, "Title: ") != 0) {
buf = strstr(mplayer_output->str, "Title:");
buf = strstr(mplayer_output->str, "Title: ") + strlen("Title: ");

View File

@ -0,0 +1,51 @@
$OpenBSD: patch-src_libgmtk_gmtk_media_player_h,v 1.1 2011/07/12 08:12:29 dcoppa Exp $
Raise event on incomplete QuickTime file, and mark it for retry
(fix apple.com/trailers) - upstream svn revision r2152
--- src/libgmtk/gmtk_media_player.h.orig Tue Jun 28 15:29:18 2011
+++ src/libgmtk/gmtk_media_player.h Mon Jul 11 10:19:19 2011
@@ -170,7 +170,8 @@ typedef enum {
ATTRIBUTE_ENABLE_FRAME_DROP,
ATTRIBUTE_TITLE,
ATTRIBUTE_ARTIST,
- ATTRIBUTE_ALBUM
+ ATTRIBUTE_ALBUM,
+ ATTRIBUTE_RETRY_ON_FULL_CACHE
} GmtkMediaPlayerMediaAttributes;
typedef enum {
@@ -201,6 +202,13 @@ typedef enum {
COMMAND_SWITCH_FRAME_DROP
} GmtkMediaPlayerCommand;
+typedef enum {
+ EVENT_TYPE_INT,
+ EVENT_TYPE_DOUBLE,
+ EVENT_TYPE_BOOLEAN,
+ EVENT_TYPE_ALLOCATION
+} GmtkMediaPlayerEventType;
+
typedef struct _GmtkMediaPlayer GmtkMediaPlayer;
typedef struct _GmtkMediaPlayerClass GmtkMediaPlayerClass;
@@ -222,9 +230,11 @@ typedef struct _GmtkMediaPlayerAudioTrack {
typedef struct _GmtkMediaPlayerEvent {
GmtkMediaPlayer *player;
+ GmtkMediaPlayerEventType type;
gchar *event_name;
gint event_data_int;
gdouble event_data_double;
+ gboolean event_data_boolean;
GtkAllocation *event_allocation;
} GmtkMediaPlayerEvent;
@@ -304,6 +314,7 @@ struct _GmtkMediaPlayer {
gchar *album;
gboolean enable_divx;
gboolean disable_xvmc;
+ gboolean retry_on_full_cache;
gboolean deinterlace;
gboolean frame_drop;

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-src_main_c,v 1.11 2011/07/12 08:12:29 dcoppa Exp $
Raise event on incomplete QuickTime file, and mark it for retry
(fix apple.com/trailers) - upstream svn revision r2152
--- src/main.c.orig Mon Jun 27 16:59:45 2011
+++ src/main.c Mon Jul 11 10:19:19 2011
@@ -534,6 +534,7 @@ gint play_iter(GtkTreeIter * playiter, gint restart_se
idledata->width = width;
idledata->height = height;
+ idledata->retry_on_full_cache = FALSE;
idledata->cachepercent = -1.0;
g_strlcpy(idledata->info, uri, 1024);
set_media_info(idledata);