totem r5119 - in trunk: . browser-plugin browser-plugin/idl
- From: hadess svn gnome org
- To: svn-commits-list gnome org
- Subject: totem r5119 - in trunk: . browser-plugin browser-plugin/idl
- Date: Thu, 14 Feb 2008 00:46:36 +0000 (GMT)
Author: hadess
Date: Thu Feb 14 00:46:36 2008
New Revision: 5119
URL: http://svn.gnome.org/viewvc/totem?rev=5119&view=rev
Log:
2008-02-14 Bastien Nocera <hadess hadess net>
* browser-plugin/org_gnome_totem_PluginViewer.xml:
* browser-plugin/totem-plugin-viewer.c: (totem_pl_item_free),
(totem_embedded_clear_playlist), (totem_embedded_add_item),
(totem_embedded_open_uri), (totem_embedded_open_stream),
(totem_embedded_set_local_file), (totem_embedded_set_playlist),
(totem_embedded_push_parser):
* browser-plugin/totemPlugin.h:
* browser-plugin/totemPlugin.cpp: Implement ClearPlaylist
and AddItem, to manipulate the playlist
* browser-plugin/idl/totemIConePlaylist.idl: Fix prototype
for add
* browser-plugin/totemConePlugin.cpp: Implement ::Add,
and ::Clear
* browser-plugin/totemPluginGlue.cpp: Fix a compilation
warning
* src/backend/bacon-video-widget-gst-0.10.c:
(bacon_video_widget_stop): Fix warning when _stop()
is called in logo mode
Modified:
trunk/ChangeLog
trunk/browser-plugin/idl/totemIConePlaylist.idl
trunk/browser-plugin/org_gnome_totem_PluginViewer.xml
trunk/browser-plugin/totem-plugin-viewer.c
trunk/browser-plugin/totemConePlugin.cpp
trunk/browser-plugin/totemPlugin.cpp
trunk/browser-plugin/totemPlugin.h
trunk/browser-plugin/totemPluginGlue.cpp
Modified: trunk/browser-plugin/idl/totemIConePlaylist.idl
==============================================================================
--- trunk/browser-plugin/idl/totemIConePlaylist.idl (original)
+++ trunk/browser-plugin/idl/totemIConePlaylist.idl Thu Feb 14 00:46:36 2008
@@ -31,7 +31,7 @@
readonly attribute boolean isPlaying;
readonly attribute totemIConePlaylistItems items;
- void add (in AUTF8String MRL, in AUTF8String name, in AUTF8String options);
+ long add (in AUTF8String MRL, in AUTF8String name, in AUTF8String options);
/*
* We don't seem to be able to have 2 functions with the same name
Modified: trunk/browser-plugin/org_gnome_totem_PluginViewer.xml
==============================================================================
--- trunk/browser-plugin/org_gnome_totem_PluginViewer.xml (original)
+++ trunk/browser-plugin/org_gnome_totem_PluginViewer.xml Thu Feb 14 00:46:36 2008
@@ -49,6 +49,10 @@
<method name="SetVolume">
<arg type="d" name="Volume" direction="in" />
</method>
+ <method name="ClearPlaylist" />
+ <method name="AddItem">
+ <arg type="s" name="URI" direction="in" />
+ </method>
<signal name="ButtonPress">
<arg type="u" name="Time" />
Modified: trunk/browser-plugin/totem-plugin-viewer.c
==============================================================================
--- trunk/browser-plugin/totem-plugin-viewer.c (original)
+++ trunk/browser-plugin/totem-plugin-viewer.c Thu Feb 14 00:46:36 2008
@@ -175,8 +175,6 @@
static gboolean totem_embedded_play (TotemEmbedded *embedded, GError **error);
static void totem_embedded_set_logo_by_name (TotemEmbedded *embedded, const char *name);
-static void totem_embedded_clear_playlist (TotemEmbedded *embedded);
-
static void totem_embedded_update_menu (TotemEmbedded *emb);
static void on_open1_activate (GtkButton *button, TotemEmbedded *emb);
static void totem_embedded_toggle_fullscreen (TotemEmbedded *emb);
@@ -943,6 +941,61 @@
emb->stream_uri = NULL;
}
+static void
+totem_pl_item_free (gpointer data, gpointer user_data)
+{
+ TotemPlItem *item = (TotemPlItem *) data;
+
+ if (!item)
+ return;
+ g_free (item->uri);
+ g_free (item);
+}
+
+static gboolean
+totem_embedded_clear_playlist (TotemEmbedded *embedded, GError *error)
+{
+ g_list_foreach (embedded->playlist, (GFunc) totem_pl_item_free, NULL);
+ g_list_free (embedded->playlist);
+
+ embedded->playlist = NULL;
+ embedded->current = NULL;
+ embedded->num_items = 0;
+
+ totem_embedded_set_uri (embedded, NULL, NULL, FALSE);
+
+ bacon_video_widget_close (embedded->bvw);
+
+ return TRUE;
+}
+
+static gboolean
+totem_embedded_add_item (TotemEmbedded *embedded, const char *uri, GError *error)
+{
+ TotemPlItem *item;
+
+ g_message ("totem_embedded_add_item: %s", uri);
+
+ item = g_new0 (TotemPlItem, 1);
+ item->uri = g_strdup (uri);
+ item->duration = -1;
+ item->starttime = -1;
+
+ embedded->playlist = g_list_append (embedded->playlist, item);
+ embedded->num_items++;
+
+ if (embedded->current_uri == NULL) {
+ embedded->current = embedded->playlist;
+ totem_embedded_set_uri (embedded,
+ (const char *) uri,
+ embedded->base_uri /* FIXME? */,
+ FALSE);
+ totem_embedded_open_internal (embedded, FALSE, NULL /* FIXME */);
+ }
+
+ return TRUE;
+}
+
static gboolean
totem_embedded_open_uri (TotemEmbedded *emb,
const char *uri,
@@ -951,9 +1004,7 @@
{
g_message ("totem_embedded_open_uri: uri %s base_uri: %s", uri, base_uri);
- totem_embedded_clear_playlist (emb);
-
- bacon_video_widget_close (emb->bvw);
+ totem_embedded_clear_playlist (emb, NULL);
totem_embedded_set_uri (emb, uri, base_uri, FALSE);
@@ -968,9 +1019,7 @@
{
g_message ("totem_embedded_open_stream called: uri %s, base_uri: %s", uri, base_uri);
- totem_embedded_clear_playlist (emb);
-
- bacon_video_widget_close (emb->bvw);
+ totem_embedded_clear_playlist (emb, NULL);
totem_embedded_set_uri (emb, uri, base_uri, TRUE);
/* We can only have one item in the "playlist" when
@@ -1054,7 +1103,7 @@
g_message ("Setting the current path to %s", path);
- totem_embedded_clear_playlist (emb);
+ totem_embedded_clear_playlist (emb, NULL);
file_uri = g_filename_to_uri (path, NULL, error);
if (!file_uri)
@@ -1100,7 +1149,7 @@
g_message ("Setting the current playlist to %s (base: %s)",
path, base_uri);
- totem_embedded_clear_playlist (emb);
+ totem_embedded_clear_playlist (emb, NULL);
file_uri = g_filename_to_uri (path, NULL, error);
if (!file_uri)
@@ -2058,28 +2107,6 @@
}
static void
-totem_pl_item_free (gpointer data, gpointer user_data)
-{
- TotemPlItem *item = (TotemPlItem *) data;
-
- if (!item)
- return;
- g_free (item->uri);
- g_free (item);
-}
-
-static void
-totem_embedded_clear_playlist (TotemEmbedded *embedded)
-{
- g_list_foreach (embedded->playlist, (GFunc) totem_pl_item_free, NULL);
- g_list_free (embedded->playlist);
-
- embedded->playlist = NULL;
- embedded->current = NULL;
- embedded->num_items = 0;
-}
-
-static void
entry_metadata_foreach (const char *key,
const char *value,
gpointer data)
@@ -2129,7 +2156,6 @@
TotemPlParserResult res;
emb->parser_id = 0;
- totem_embedded_clear_playlist (emb);
parser = totem_pl_parser_new ();
g_object_set (parser, "force", TRUE,
Modified: trunk/browser-plugin/totemConePlugin.cpp
==============================================================================
--- trunk/browser-plugin/totemConePlugin.cpp (original)
+++ trunk/browser-plugin/totemConePlugin.cpp Thu Feb 14 00:46:36 2008
@@ -174,11 +174,16 @@
/* void add (in AUTF8String MRL) */
NS_IMETHODIMP
-totemScriptablePlugin::Add(const nsACString & aURL, const nsACString & aName, const nsACString & aOptions)
+totemScriptablePlugin::Add(const nsACString & aURL, const nsACString & aName, const nsACString & aOptions, PRInt32 *aItemNumber)
{
- TOTEM_SCRIPTABLE_WARN_UNIMPLEMENTED ();
+ TOTEM_SCRIPTABLE_LOG_ACCESS ();
- return NS_ERROR_NOT_IMPLEMENTED;
+ NS_ENSURE_STATE (IsValid ());
+
+ /* FIXME */
+ *aItemNumber = 0;
+
+ return mPlugin->AddItem (aURL);
}
/* void play () */
@@ -264,9 +269,11 @@
NS_IMETHODIMP
totemScriptablePlugin::Clear()
{
- TOTEM_SCRIPTABLE_WARN_UNIMPLEMENTED ();
+ TOTEM_SCRIPTABLE_LOG_ACCESS ();
- return NS_ERROR_NOT_IMPLEMENTED;
+ NS_ENSURE_STATE (IsValid ());
+
+ return mPlugin->ClearPlaylist ();
}
/* totemIConeInput */
Modified: trunk/browser-plugin/totemPlugin.cpp
==============================================================================
--- trunk/browser-plugin/totemPlugin.cpp (original)
+++ trunk/browser-plugin/totemPlugin.cpp Thu Feb 14 00:46:36 2008
@@ -244,7 +244,46 @@
G_TYPE_INVALID);
return NS_OK;
+}
+
+nsresult
+totemPlugin::ClearPlaylist (void)
+{
+ D ("ClearPlaylist");
+
+ /* FIXME: queue the action instead */
+ if (!mViewerReady)
+ return NS_OK;
+
+ NS_ASSERTION (mViewerProxy, "No viewer proxy");
+ dbus_g_proxy_call_no_reply (mViewerProxy,
+ "ClearPlaylist",
+ G_TYPE_INVALID,
+ G_TYPE_INVALID);
+
+ return NS_OK;
+}
+nsresult
+totemPlugin::AddItem (const nsACString &aURI)
+{
+ const nsCString string (aURI);
+ const char *str = string.get ();
+
+ D ("AddItem '%s'", str);
+
+ /* FIXME: queue the action instead */
+ if (!mViewerReady)
+ return NS_OK;
+
+ NS_ASSERTION (mViewerProxy, "No viewer proxy");
+ dbus_g_proxy_call_no_reply (mViewerProxy,
+ "AddItem",
+ G_TYPE_STRING, str,
+ G_TYPE_INVALID,
+ G_TYPE_INVALID);
+
+ return NS_OK;
}
/* Viewer interaction */
Modified: trunk/browser-plugin/totemPlugin.h
==============================================================================
--- trunk/browser-plugin/totemPlugin.h (original)
+++ trunk/browser-plugin/totemPlugin.h Thu Feb 14 00:46:36 2008
@@ -60,6 +60,8 @@
nsresult DoCommand (const char *aCommand);
nsresult SetVolume (gdouble aVolume);
+ nsresult ClearPlaylist (void);
+ nsresult AddItem (const nsACString &aURI);
nsresult SetSrc (const nsACString &aURL);
@@ -297,6 +299,6 @@
const char *mime_alias;
} totemPluginMimeEntry;
-char *totem_plugin_get_long_description (void);
+const char *totem_plugin_get_long_description (void);
#endif /* __TOTEM_PLUGIN_H__ */
Modified: trunk/browser-plugin/totemPluginGlue.cpp
==============================================================================
--- trunk/browser-plugin/totemPluginGlue.cpp (original)
+++ trunk/browser-plugin/totemPluginGlue.cpp Thu Feb 14 00:46:36 2008
@@ -203,7 +203,7 @@
D ("Print");
}
-char *
+const char *
totem_plugin_get_long_description (void)
{
return "The <a href=\"http://www.gnome.org/projects/totem/\">Totem</a> " PACKAGE_VERSION " plugin handles video and audio streams.";
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]