[totem] Implement SetTime in the NarrowSpace plugin
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem] Implement SetTime in the NarrowSpace plugin
- Date: Sat, 10 Apr 2010 15:54:57 +0000 (UTC)
commit 9e6af35511b3aed2a981d1d62fba666543850072
Author: Bastien Nocera <hadess hadess net>
Date: Sat Apr 10 16:35:00 2010 +0100
Implement SetTime in the NarrowSpace plugin
browser-plugin/org_gnome_totem_PluginViewer.xml | 3 +++
browser-plugin/totem-plugin-viewer.c | 12 ++++++++++++
browser-plugin/totemGMPControls.cpp | 2 +-
browser-plugin/totemNarrowSpacePlugin.cpp | 14 ++++++++++++--
browser-plugin/totemPlugin.cpp | 19 +++++++++++++++++++
browser-plugin/totemPlugin.h | 3 ++-
6 files changed, 49 insertions(+), 4 deletions(-)
---
diff --git a/browser-plugin/org_gnome_totem_PluginViewer.xml b/browser-plugin/org_gnome_totem_PluginViewer.xml
index 2218d27..61c963a 100644
--- a/browser-plugin/org_gnome_totem_PluginViewer.xml
+++ b/browser-plugin/org_gnome_totem_PluginViewer.xml
@@ -62,6 +62,9 @@
<method name="SetFullscreen">
<arg type="b" name="FullscreenEnabled" direction="in" />
</method>
+ <method name="SetTime">
+ <arg type="t" name="Time" direction="in" />
+ </method>
<signal name="ButtonPress">
<arg type="u" name="Time" />
diff --git a/browser-plugin/totem-plugin-viewer.c b/browser-plugin/totem-plugin-viewer.c
index 2601902..d9fddfd 100644
--- a/browser-plugin/totem-plugin-viewer.c
+++ b/browser-plugin/totem-plugin-viewer.c
@@ -789,6 +789,18 @@ totem_embedded_set_fullscreen (TotemEmbedded *emb,
}
static gboolean
+totem_embedded_set_time (TotemEmbedded *emb,
+ guint64 time,
+ GError **error)
+{
+ g_message ("totem_embedded_set_time: %"G_GUINT64_FORMAT, time);
+
+ bacon_video_widget_seek_time (emb->bvw, time, NULL);
+
+ return TRUE;
+}
+
+static gboolean
totem_embedded_open_uri (TotemEmbedded *emb,
const char *uri,
const char *base_uri,
diff --git a/browser-plugin/totemGMPControls.cpp b/browser-plugin/totemGMPControls.cpp
index 4166550..8dbcfb7 100644
--- a/browser-plugin/totemGMPControls.cpp
+++ b/browser-plugin/totemGMPControls.cpp
@@ -150,7 +150,7 @@ totemGMPControls::GetPropertyByIndex (int aIndex,
switch (Properties (aIndex)) {
case eCurrentPosition:
/* attribute double currentPosition; */
- return DoubleVariant (_result, double (Plugin()->Time()) / 1000.0);
+ return DoubleVariant (_result, double (Plugin()->GetTime()) / 1000.0);
case eCurrentItem:
/* attribute totemIGMPMedia currentItem; */
diff --git a/browser-plugin/totemNarrowSpacePlugin.cpp b/browser-plugin/totemNarrowSpacePlugin.cpp
index 91cf8b9..a9f06ab 100644
--- a/browser-plugin/totemNarrowSpacePlugin.cpp
+++ b/browser-plugin/totemNarrowSpacePlugin.cpp
@@ -306,7 +306,7 @@ totemNarrowSpacePlayer::InvokeByIndex (int aIndex,
case eGetTime:
/* unsigned long GetTime (); */
- return Int32Variant (_result, Plugin()->Time());
+ return Int32Variant (_result, Plugin()->GetTime());
case eGetEndTime:
/* unsigned long GetEndTime (); */
@@ -315,7 +315,7 @@ totemNarrowSpacePlayer::InvokeByIndex (int aIndex,
case eGetTimeScale:
/* unsigned long GetTimeScale (); */
- return Int32Variant (_result, 1000); /* FIXME? */
+ return Int32Variant (_result, 1000); /* TimeScale is in milli-seconds */
case eGetRate:
/* float GetRate (); */
@@ -519,10 +519,20 @@ totemNarrowSpacePlayer::InvokeByIndex (int aIndex,
/* void SetTarget (in AUTF8String target); */
case eSetTiltAngle:
/* void SetTiltAngle (in float angle); */
+ TOTEM_WARN_INVOKE_UNIMPLEMENTED (aIndex, totemNarrowSpacePlayer);
+ return VoidVariant (_result);
case eSetTime:
/* void SetTime (in unsigned long time); */
+ int32_t time;
+ if (!GetInt32FromArguments (argv, argc, 0, time))
+ return false;
+
+ Plugin()->SetTime (time);
+ return true;
case eSetTrackEnabled:
/* void SetTrackEnabled (in unsigned long index, in boolean enabled); */
+ TOTEM_WARN_INVOKE_UNIMPLEMENTED (aIndex, totemNarrowSpacePlayer);
+ return VoidVariant (_result);
case eSetURL: {
/* void SetURL (in AUTF8String url); */
NPString url;
diff --git a/browser-plugin/totemPlugin.cpp b/browser-plugin/totemPlugin.cpp
index 7c6f5a4..874ff96 100644
--- a/browser-plugin/totemPlugin.cpp
+++ b/browser-plugin/totemPlugin.cpp
@@ -277,6 +277,25 @@ totemPlugin::Command (const char *aCommand)
}
void
+totemPlugin::SetTime (guint64 aTime)
+{
+ D ("SetTime '%lu'", aTime);
+
+ /* FIXME: queue the action instead */
+ if (!mViewerReady)
+ return;
+
+ mTime = aTime;
+
+ assert (mViewerProxy);
+ dbus_g_proxy_call_no_reply (mViewerProxy,
+ "SetTime",
+ G_TYPE_UINT64, GetTime(),
+ G_TYPE_INVALID,
+ G_TYPE_INVALID);
+}
+
+void
totemPlugin::SetVolume (double aVolume)
{
D ("SetVolume '%f'", aVolume);
diff --git a/browser-plugin/totemPlugin.h b/browser-plugin/totemPlugin.h
index 7c05d1d..1cd33d1 100644
--- a/browser-plugin/totemPlugin.h
+++ b/browser-plugin/totemPlugin.h
@@ -408,7 +408,8 @@ class totemPlugin {
int32_t BytesLength () const { return mBytesLength; }
- uint32_t Time () const { return mTime; }
+ uint64_t GetTime () const { return mTime; }
+ void SetTime (uint64_t aTime);
TotemStates State () const { return mState; }
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]