[totem] Implement Narrowspace's SetURL function
- From: Bastien Nocera <hadess src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [totem] Implement Narrowspace's SetURL function
- Date: Thu, 21 Jan 2010 20:16:10 +0000 (UTC)
commit 1f01e518a3348338b9e381814c455884376fdc38
Author: Bastien Nocera <hadess hadess net>
Date: Thu Jan 21 20:15:14 2010 +0000
Implement Narrowspace's SetURL function
browser-plugin/totemNarrowSpacePlugin.cpp | 9 ++++++++-
browser-plugin/totemPlugin.cpp | 24 ++++++++++++++++++++++++
browser-plugin/totemPlugin.h | 1 +
3 files changed, 33 insertions(+), 1 deletions(-)
---
diff --git a/browser-plugin/totemNarrowSpacePlugin.cpp b/browser-plugin/totemNarrowSpacePlugin.cpp
index 1367e5e..91cf8b9 100644
--- a/browser-plugin/totemNarrowSpacePlugin.cpp
+++ b/browser-plugin/totemNarrowSpacePlugin.cpp
@@ -523,8 +523,15 @@ totemNarrowSpacePlayer::InvokeByIndex (int aIndex,
/* void SetTime (in unsigned long time); */
case eSetTrackEnabled:
/* void SetTrackEnabled (in unsigned long index, in boolean enabled); */
- case eSetURL:
+ case eSetURL: {
/* void SetURL (in AUTF8String url); */
+ NPString url;
+ if (!GetNPStringFromArguments (argv, argc, 0, url))
+ return false;
+
+ Plugin()->SetURL (url);
+ return true;
+ }
case eStep:
/* void Step (in long count); */
case eShowDefaultView:
diff --git a/browser-plugin/totemPlugin.cpp b/browser-plugin/totemPlugin.cpp
index e2c48be..d167040 100644
--- a/browser-plugin/totemPlugin.cpp
+++ b/browser-plugin/totemPlugin.cpp
@@ -1618,6 +1618,30 @@ totemPlugin::SetURL (const char* aURL)
#ifdef TOTEM_NARROWSPACE_PLUGIN
+void
+totemPlugin::SetURL (const NPString& aURL)
+{
+ g_free (mSrcURI);
+
+ /* If |src| is empty, don't resolve the URI! Otherwise we may
+ * try to load an (probably iframe) html document as our video stream.
+ */
+ if (!aURL.UTF8Characters || !aURL.UTF8Length) {
+ mSrcURI = NULL;
+ return;
+ }
+
+ mSrcURI = g_strndup (aURL.UTF8Characters, aURL.UTF8Length);
+
+ UnsetStream ();
+
+ if (mAutoPlay) {
+ RequestStream (true); //FIXME
+ } else {
+ mWaitingForButtonPress = true;
+ }
+}
+
bool
totemPlugin::SetQtsrc (const char* aURL)
{
diff --git a/browser-plugin/totemPlugin.h b/browser-plugin/totemPlugin.h
index c119c6d..14c5667 100644
--- a/browser-plugin/totemPlugin.h
+++ b/browser-plugin/totemPlugin.h
@@ -291,6 +291,7 @@ class totemPlugin {
public:
bool SetQtsrc (const char* aURL);
bool SetHref (const char* aURL);
+ void SetURL (const NPString&);
const char* QtSrc () const { return mQtsrcURI; }
const char* Href () const { return mHref; }
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]