totem r5342 - in trunk: . bindings/python src src/plugins/youtube
- From: pwithnall svn gnome org
- To: svn-commits-list gnome org
- Subject: totem r5342 - in trunk: . bindings/python src src/plugins/youtube
- Date: Mon, 7 Apr 2008 23:12:48 +0100 (BST)
Author: pwithnall
Date: Mon Apr 7 23:12:47 2008
New Revision: 5342
URL: http://svn.gnome.org/viewvc/totem?rev=5342&view=rev
Log:
2008-04-07 Philip Withnall <pwithnall svn gnome org>
* bindings/python/totem.defs:
* bindings/python/totem.override:
* src/plugins/youtube/youtube.py:
* src/totem-object.c: (totem_get_video_widget_backend_name):
* src/totem.h: Add runtime checks for flvdemux and souphttpsrc and
display an error if they're not present for YouTube videos.
(Closes: #522547)
Modified:
trunk/ChangeLog
trunk/bindings/python/totem.defs
trunk/bindings/python/totem.override
trunk/src/plugins/youtube/youtube.py
trunk/src/totem-object.c
trunk/src/totem.h
Modified: trunk/bindings/python/totem.defs
==============================================================================
--- trunk/bindings/python/totem.defs (original)
+++ trunk/bindings/python/totem.defs Mon Apr 7 23:12:47 2008
@@ -401,6 +401,12 @@
(return-type "GtkWidget*")
)
+(define-method get_video_widget_backend_name
+ (of-object "TotemObject")
+ (c-name "totem_get_video_widget_backend_name")
+ (return-type "char*")
+)
+
(define-method get_current_time
(of-object "TotemObject")
(c-name "totem_get_current_time")
@@ -452,3 +458,18 @@
)
)
+
+;; From totem-interface.h
+
+(define-method interface_error_with_link
+ (of-object "TotemObject")
+ (c-name "totem_interface_error_with_link")
+ (return-type "none")
+ (parameters
+ '("const-char*" "title")
+ '("const-char*" "reason")
+ '("const-char*" "uri")
+ '("const-char*" "label")
+ '("GtkWindow" "parent")
+ )
+)
Modified: trunk/bindings/python/totem.override
==============================================================================
--- trunk/bindings/python/totem.override (original)
+++ trunk/bindings/python/totem.override Mon Apr 7 23:12:47 2008
@@ -66,6 +66,23 @@
return Py_None;
}
%%
+override totem_interface_error_with_link kwargs
+static PyObject *
+_wrap_totem_interface_error_with_link (PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "title", "reason", "uri", "label", "parent", NULL };
+ char *title, *reason, *uri, *label;
+ PyGObject *parent;
+
+ if (!PyArg_ParseTupleAndKeywords (args, kwargs, "ssssO!:TotemObject.interface_error_with_link", kwlist, &title, &reason, &uri, &label, &PyGtkWindow_Type, &parent))
+ return NULL;
+
+ totem_interface_error_with_link (title, reason, uri, label, GTK_WINDOW(parent->obj), TOTEM_OBJECT(self->obj));
+
+ Py_INCREF (Py_None);
+ return Py_None;
+}
+%%
override totem_plugin_load_interface kwargs
static PyObject *
_wrap_totem_plugin_load_interface (PyGObject *self, PyObject *args, PyObject *kwargs)
Modified: trunk/src/plugins/youtube/youtube.py
==============================================================================
--- trunk/src/plugins/youtube/youtube.py (original)
+++ trunk/src/plugins/youtube/youtube.py Mon Apr 7 23:12:47 2008
@@ -27,6 +27,7 @@
def __init__ (self):
totem.Plugin.__init__(self)
self.debug = False
+ self.gstreamer_plugins_present = True
self.max_results = 20
self.button_down = False
@@ -45,6 +46,23 @@
self.vadjust = {}
self.liststore = {}
def activate (self, totem_object):
+ """Check for the availability of the flvdemux and souphttpsrc GStreamer plugins"""
+ bvw_name = totem_object.get_video_widget_backend_name ()
+
+ if bvw_name.find ("GStreamer") != -1:
+ try:
+ import pygst
+ pygst.require ("0.10")
+ import gst
+
+ registry = gst.registry_get_default ()
+ if registry.find_plugin ("flvdemux") == None or registry.find_plugin ("souphttpsrc") == None:
+ """This means an error will be displayed when they try to play anything"""
+ self.gstreamer_plugins_present = False
+ except ImportError:
+ """Do nothing; either it's using xine or python-gstreamer isn't installed"""
+
+ """Continue loading the plugin as before"""
self.builder = self.load_interface ("youtube.ui", True, totem_object.get_main_window (), self)
self.totem = totem_object
@@ -79,7 +97,7 @@
treeview = self.builder.get_object ("yt_treeview_" + treeview_name)
treeview.set_property ("totem", self.totem)
treeview.connect ("row-activated", self.on_row_activated)
- treeview.connect ("starting-video", self.on_starting_video)
+ treeview.connect_after ("starting-video", self.on_starting_video)
treeview.insert_column_with_attributes (0, _("Videos"), renderer, thumbnail=0, title=1)
self.vadjust[treeview_name] = treeview.get_vadjustment ()
@@ -117,6 +135,15 @@
else:
return False
def on_starting_video (self, treeview, path, user_data):
+ """Display an error if the required GStreamer plugins aren't installed"""
+ if self.gstreamer_plugins_present == False:
+ self.totem.interface_error_with_link (_("Totem cannot play this type of media (%s) because you do not have the appropriate plugins to handle it.") % _("YouTube"),
+ _("Please install the necessary plugins and restart Totem to be able to play this media."),
+ "http://www.gnome.org/projects/totem/#codecs",
+ _("More information about media plugins"),
+ self.totem.get_main_window ())
+ return False
+
model, rows = treeview.get_selection ().get_selected_rows ()
iter = model.get_iter (rows[0])
youtube_id = model.get_value (iter, 3)
Modified: trunk/src/totem-object.c
==============================================================================
--- trunk/src/totem-object.c (original)
+++ trunk/src/totem-object.c Mon Apr 7 23:12:47 2008
@@ -37,6 +37,7 @@
#include "totem-plugins-engine.h"
#include "ev-sidebar.h"
#include "totem-playlist.h"
+#include "bacon-video-widget.h"
enum {
PROP_0,
@@ -233,6 +234,12 @@
return GTK_WIDGET (totem->bvw);
}
+char *
+totem_get_video_widget_backend_name (Totem *totem)
+{
+ return bacon_video_widget_get_backend_name (totem->bvw);
+}
+
gint64
totem_get_current_time (Totem *totem)
{
Modified: trunk/src/totem.h
==============================================================================
--- trunk/src/totem.h (original)
+++ trunk/src/totem.h Mon Apr 7 23:12:47 2008
@@ -166,6 +166,7 @@
GtkWindow *totem_get_main_window (Totem *totem);
GtkUIManager *totem_get_ui_manager (Totem *totem);
GtkWidget *totem_get_video_widget (Totem *totem);
+char *totem_get_video_widget_backend_name (Totem *totem);
/* Current media information */
char * totem_get_short_title (Totem *totem);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]