Gentoo Archives: gentoo-commits

From: "Nirbheek Chauhan (nirbheek)" <nirbheek@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in media-video/totem/files: totem-2.26.5-firefox-plugin-apple-trailers.patch
Date: Wed, 30 Dec 2009 01:25:34
Message-Id: E1NPnJa-0007t0-SK@stork.gentoo.org
1 nirbheek 09/12/30 01:25:30
2
3 Added: totem-2.26.5-firefox-plugin-apple-trailers.patch
4 Log:
5 Fix playing of apple trailers using the firefox plugin, bug 292852
6 (Portage version: 2.1.7.16/cvs/Linux i686)
7
8 Revision Changes Path
9 1.1 media-video/totem/files/totem-2.26.5-firefox-plugin-apple-trailers.patch
10
11 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/media-video/totem/files/totem-2.26.5-firefox-plugin-apple-trailers.patch?rev=1.1&view=markup
12 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/media-video/totem/files/totem-2.26.5-firefox-plugin-apple-trailers.patch?rev=1.1&content-type=text/plain
13
14 Index: totem-2.26.5-firefox-plugin-apple-trailers.patch
15 ===================================================================
16 Fixes playing of apple trailers using the firefox plugin by changing the UA
17
18 Patch backported by Ryan May
19
20 http://bugs.gentoo.org/show_bug.cgi?id=292852
21
22 ---
23 --- browser-plugin/totemPlugin.cpp
24 +++ browser-plugin/totemPlugin.cpp
25 @@ -156,6 +156,15 @@
26 "The <a href=\"http://www.gnome.org/projects/totem/\">Totem</a> " PACKAGE_VERSION " plugin handles video and audio streams.";
27 #endif
28
29 +static const char kPluginUserAgent[] =
30 +#if defined(TOTEM_NARROWSPACE_PLUGIN)
31 + "Quicktime/"TOTEM_NARROWSPACE_VERSION;
32 +#elif defined(TOTEM_GMP_PLUGIN)
33 + "Windows-Media-Player/10.00.00.4019";
34 +#else
35 + "";
36 +#endif
37 +
38 #if defined(TOTEM_COMPLEX_PLUGIN) && defined(HAVE_NSTARRAY_H)
39 nsTArray<totemPlugin*> *totemPlugin::sPlugins;
40
41 @@ -463,10 +472,13 @@
42 return NPERR_NO_ERROR;
43 #endif /* TOTEM_COMPLEX_PLUGIN */
44
45 - const char *userAgent = NPN_UserAgent (mNPP);
46 - if (!userAgent) {
47 - /* See https://bugzilla.mozilla.org/show_bug.cgi?id=328778 */
48 - D ("User agent has more than 127 characters; fix your browser!");
49 + const char *userAgent = kPluginUserAgent;
50 + if (*kPluginUserAgent == '\0') {
51 + userAgent = NPN_UserAgent (mNPP);
52 + if (!userAgent) {
53 + /* See https://bugzilla.mozilla.org/show_bug.cgi?id=328778 */
54 + D ("User agent has more than 127 characters; fix your browser!");
55 + }
56 }
57
58 GPtrArray *arr = g_ptr_array_new ();
59 --- browser-plugin/totem-plugin-viewer.c
60 +++ browser-plugin/totem-plugin-viewer.c
61 @@ -2336,7 +2336,7 @@
62 /* FIXME: this won't work with gvfs:
63 * http://bugzilla.gnome.org/show_bug.cgi?id=534482 */
64 if (arg_user_agent != NULL) {
65 - g_setenv ("GNOME_VFS_HTTP_USER_AGENT", arg_user_agent, TRUE);
66 + g_setenv ("BACON_VIDEO_WIDGET_HTTP_USER_AGENT", arg_user_agent, TRUE);
67 g_free (arg_user_agent);
68 arg_user_agent = NULL;
69 }
70 --- src/backend/bacon-video-widget-gst-0.10.c
71 +++ src/backend/bacon-video-widget-gst-0.10.c
72 @@ -1686,6 +1686,21 @@
73 }
74
75 static void
76 +bvw_set_user_agent_on_element (BaconVideoWidget * bvw, GstElement * element)
77 +{
78 + const char *ua;
79 +
80 + ua = g_getenv ("BACON_VIDEO_WIDGET_HTTP_USER_AGENT");
81 + if (ua == NULL)
82 + return;
83 +
84 + if (g_object_class_find_property (G_OBJECT_GET_CLASS (element), "user-agent")) {
85 + GST_DEBUG ("Setting HTTP user-agent to '%s'", ua);
86 + g_object_set (element, "user-agent", ua, NULL);
87 + }
88 +}
89 +
90 +static void
91 playbin_source_notify_cb (GObject *play, GParamSpec *p, BaconVideoWidget *bvw)
92 {
93 GObject *source = NULL;
94 @@ -1709,6 +1724,7 @@
95 if (source) {
96 GST_DEBUG ("Got source of type %s", G_OBJECT_TYPE_NAME (source));
97 bvw_set_device_on_element (bvw, GST_ELEMENT (source));
98 + bvw_set_user_agent_on_element (bvw, GST_ELEMENT (source));
99 g_object_unref (source);
100 }
101 }