diff options
-rw-r--r-- | ChangeLog | 34 | ||||
-rw-r--r-- | browser-plugin/org_gnome_totem_PluginViewer.xml | 9 | ||||
-rw-r--r-- | browser-plugin/totem-plugin-viewer-constants.h | 3 | ||||
-rw-r--r-- | browser-plugin/totem-plugin-viewer.c | 121 | ||||
-rw-r--r-- | browser-plugin/totemComplexPlugin.cpp | 5 | ||||
-rw-r--r-- | browser-plugin/totemComplexPlugin.h | 1 | ||||
-rw-r--r-- | browser-plugin/totemConePlugin.cpp | 93 | ||||
-rw-r--r-- | browser-plugin/totemConePlugin.h | 3 | ||||
-rw-r--r-- | browser-plugin/totemGMPSettings.cpp | 9 | ||||
-rw-r--r-- | browser-plugin/totemGMPSettings.h | 1 | ||||
-rw-r--r-- | browser-plugin/totemNarrowSpacePlugin.cpp | 16 | ||||
-rw-r--r-- | browser-plugin/totemNarrowSpacePlugin.h | 2 | ||||
-rw-r--r-- | browser-plugin/totemPlugin.cpp | 56 | ||||
-rw-r--r-- | browser-plugin/totemPlugin.h | 7 | ||||
-rw-r--r-- | browser-plugin/totempluginviewer-marshal.list | 1 |
15 files changed, 285 insertions, 76 deletions
@@ -1,3 +1,37 @@ +2008-02-15 Bastien Nocera <hadess@hadess.net> + + * browser-plugin/org_gnome_totem_PluginViewer.xml: + * browser-plugin/totem-plugin-viewer-constants.h: + * browser-plugin/totempluginviewer-marshal.list: + * browser-plugin/totem-plugin-viewer.c: + (totem_embedded_class_init), (totem_embedded_save_volume), + (totem_embedded_stop), (totem_embedded_set_volume), + (totem_embedded_set_fullscreen), + (totem_embedded_toggle_fullscreen), (cb_vol), (on_tick), + (totem_embedded_action_volume_relative), + (totem_embedded_construct): + Implement a property change signal when fullscreen state + or volume changes + + * browser-plugin/totemPlugin.cpp: + * browser-plugin/totemPlugin.h: As above and implement + SetFullscreen() + + * browser-plugin/totemComplexPlugin.cpp: + * browser-plugin/totemComplexPlugin.h: + * browser-plugin/totemGMPSettings.cpp: + * browser-plugin/totemGMPSettings.h: + * browser-plugin/totemNarrowSpacePlugin.cpp: + * browser-plugin/totemNarrowSpacePlugin.h: + Fix for changes above + + * browser-plugin/totemConePlugin.cpp: + * browser-plugin/totemConePlugin.h: + Implement ToggleFullscreen/ToggleMute, state, mute, + volume and fullscreen properties + + (Closes: #462544) + 2008-02-15 Tim-Philipp Müller <tim at centricular dot net> * src/backend/bacon-video-widget-gst-0.10.c: (get_media_size): diff --git a/browser-plugin/org_gnome_totem_PluginViewer.xml b/browser-plugin/org_gnome_totem_PluginViewer.xml index 424864c4d..c7bc92a12 100644 --- a/browser-plugin/org_gnome_totem_PluginViewer.xml +++ b/browser-plugin/org_gnome_totem_PluginViewer.xml @@ -41,7 +41,7 @@ <arg type="s" name="HrefURI" direction="in" /> <arg type="s" name="Target" direction="in" /> </method> - <method name="SetErrorLogo"/> + <method name="SetErrorLogo" /> <method name="LaunchPlayer"> <arg type="s" name="URI" direction="in" /> <arg type="u" name="Time" direction="in" /> @@ -53,6 +53,9 @@ <method name="AddItem"> <arg type="s" name="URI" direction="in" /> </method> + <method name="SetFullscreen"> + <arg type="b" name="FullscreenEnabled" direction="in" /> + </method> <signal name="ButtonPress"> <arg type="u" name="Time" /> @@ -63,6 +66,10 @@ <arg type="u" name="Duration" /> <arg type="s" name="State" /> </signal> + <signal name="PropertyChange"> + <arg type="s" name="PropertyType" /> + <arg type="v" name="Value" /> + </signal> <signal name="StartStream" /> <signal name="StopStream" /> </interface> diff --git a/browser-plugin/totem-plugin-viewer-constants.h b/browser-plugin/totem-plugin-viewer-constants.h index 39b54e1ca..8a58e4ee6 100644 --- a/browser-plugin/totem-plugin-viewer-constants.h +++ b/browser-plugin/totem-plugin-viewer-constants.h @@ -40,4 +40,7 @@ static const char *totem_states[] = { "INVALID" }; +#define TOTEM_PROPERTY_VOLUME "volume" +#define TOTEM_PROPERTY_ISFULLSCREEN "is-fullscreen" + #endif /* !__TOTEM_PLUGIN_VIEWER_CONSTANTS__ */ diff --git a/browser-plugin/totem-plugin-viewer.c b/browser-plugin/totem-plugin-viewer.c index 240676df4..1cad4e629 100644 --- a/browser-plugin/totem-plugin-viewer.c +++ b/browser-plugin/totem-plugin-viewer.c @@ -189,6 +189,7 @@ enum { START_STREAM, STOP_STREAM, SIGNAL_TICK, + PROPERTY_CHANGE, LAST_SIGNAL }; @@ -257,6 +258,14 @@ static void totem_embedded_class_init (TotemEmbeddedClass *klass) NULL /* accu */, NULL /* accu data */, totempluginviewer_marshal_VOID__UINT_UINT_STRING, G_TYPE_NONE, 3, param_types); + signals[PROPERTY_CHANGE] = + g_signal_new ("property-change", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + 0 /* class offset */, + NULL /* accu */, NULL /* accu data */, + totempluginviewer_marshal_VOID__STRING_BOXED, + G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_VALUE); } static void @@ -279,10 +288,17 @@ static void totem_embedded_save_volume (TotemEmbedded *emb, double volume) { GConfClient *gc; + GValue value = { 0, }; gc = gconf_client_get_default (); gconf_client_set_int (gc, GCONF_PREFIX"/volume", (int) (volume * 100.0), NULL); g_object_unref (G_OBJECT (gc)); + + g_value_init (&value, G_TYPE_DOUBLE); + g_value_set_double (&value, volume); + g_signal_emit (emb, signals[PROPERTY_CHANGE], 0, + TOTEM_PROPERTY_VOLUME, + &value); } static void @@ -543,6 +559,11 @@ totem_embedded_stop (TotemEmbedded *emb, totem_embedded_set_state (emb, TOTEM_STATE_STOPPED); bacon_video_widget_stop (emb->bvw); + g_signal_emit (emb, signals[SIGNAL_TICK], 0, + (guint32) 0, + (guint32) 0, + totem_states[emb->state]); + return TRUE; } @@ -604,6 +625,7 @@ totem_embedded_set_volume (TotemEmbedded *embedded, { g_message ("totem_embedded_set_volume: %f", volume); bacon_video_widget_set_volume (embedded->bvw, volume); + totem_embedded_save_volume (embedded, volume); return TRUE; } @@ -997,6 +1019,62 @@ totem_embedded_add_item (TotemEmbedded *embedded, const char *uri, GError *error } static gboolean +totem_embedded_set_fullscreen (TotemEmbedded *emb, + gboolean fullscreen_enabled, + GError **error) +{ + GValue value = { 0, }; + GtkAction *fs_action; + + fs_action = GTK_ACTION (gtk_builder_get_object + (emb->menuxml, "fullscreen1")); + + if (totem_fullscreen_is_fullscreen (emb->fs) == fullscreen_enabled) + return TRUE; + + g_message ("totem_embedded_set_fullscreen: %d", fullscreen_enabled); + + if (fullscreen_enabled == FALSE) { + GtkWidget * container; + container = GTK_WIDGET (gtk_builder_get_object (emb->xml, + "video_box")); + + totem_fullscreen_set_fullscreen (emb->fs, FALSE); + gtk_widget_reparent (GTK_WIDGET (emb->bvw), container); + gtk_widget_hide_all (emb->fs_window); + + gtk_action_set_sensitive (fs_action, TRUE); + } else { + GdkRectangle rect; + int monitor; + + /* Move the fullscreen window to the screen where the + * video widget currently is */ + monitor = gdk_screen_get_monitor_at_window (gtk_widget_get_screen (GTK_WIDGET (emb->bvw)), + GTK_WIDGET (emb->bvw)->window); + gdk_screen_get_monitor_geometry (gtk_widget_get_screen (GTK_WIDGET (emb->bvw)), + monitor, &rect); + gtk_window_move (GTK_WINDOW (emb->fs_window), rect.x, rect.y); + + gtk_widget_reparent (GTK_WIDGET (emb->bvw), emb->fs_window); + bacon_video_widget_set_fullscreen (emb->bvw, TRUE); + gtk_window_fullscreen (GTK_WINDOW (emb->fs_window)); + totem_fullscreen_set_fullscreen (emb->fs, TRUE); + gtk_widget_show_all (emb->fs_window); + + gtk_action_set_sensitive (fs_action, FALSE); + } + + g_value_init (&value, G_TYPE_BOOLEAN); + g_value_set_boolean (&value, fullscreen_enabled); + g_signal_emit (emb, signals[PROPERTY_CHANGE], 0, + TOTEM_PROPERTY_ISFULLSCREEN, + &value); + + return TRUE; +} + +static gboolean totem_embedded_open_uri (TotemEmbedded *emb, const char *uri, const char *base_uri, @@ -1460,40 +1538,10 @@ on_got_redirect (GtkWidget *bvw, const char *mrl, TotemEmbedded *emb) static void totem_embedded_toggle_fullscreen (TotemEmbedded *emb) { - GtkAction * fs_action = GTK_ACTION (gtk_builder_get_object - (emb->menuxml, "fullscreen1")); - if (totem_fullscreen_is_fullscreen (emb->fs) != FALSE) - { - GtkWidget * container; - container = GTK_WIDGET (gtk_builder_get_object (emb->xml, - "video_box")); - - totem_fullscreen_set_fullscreen (emb->fs, FALSE); - gtk_widget_reparent (GTK_WIDGET (emb->bvw), container); - gtk_widget_hide_all (emb->fs_window); - - gtk_action_set_sensitive (fs_action, TRUE); - } else { - GdkRectangle rect; - int monitor; - - /* Move the fullscreen window to the screen where the - * video widget currently is */ - monitor = gdk_screen_get_monitor_at_window (gtk_widget_get_screen (GTK_WIDGET (emb->bvw)), - GTK_WIDGET (emb->bvw)->window); - gdk_screen_get_monitor_geometry (gtk_widget_get_screen (GTK_WIDGET (emb->bvw)), - monitor, &rect); - gtk_window_move (GTK_WINDOW (emb->fs_window), rect.x, rect.y); - - gtk_widget_reparent (GTK_WIDGET (emb->bvw), emb->fs_window); - bacon_video_widget_set_fullscreen (emb->bvw, TRUE); - gtk_window_fullscreen (GTK_WINDOW (emb->fs_window)); - totem_fullscreen_set_fullscreen (emb->fs, TRUE); - gtk_widget_show_all (emb->fs_window); - - gtk_action_set_sensitive (fs_action, FALSE); - } + totem_embedded_set_fullscreen (emb, FALSE, NULL); + else + totem_embedded_set_fullscreen (emb, TRUE, NULL); } static void @@ -1638,6 +1686,7 @@ static void cb_vol (GtkWidget *val, gdouble value, TotemEmbedded *emb) { bacon_video_widget_set_volume (emb->bvw, value); + totem_embedded_save_volume (emb, value); } static void @@ -1669,7 +1718,9 @@ on_tick (GtkWidget *bvw, } g_signal_emit (emb, signals[SIGNAL_TICK], 0, - (guint32) current_time, (guint32) stream_length, totem_states[emb->state]); + (guint32) current_time, + (guint32) stream_length, + totem_states[emb->state]); } static void @@ -1736,6 +1787,7 @@ totem_embedded_action_volume_relative (TotemEmbedded *emb, double off_pct) vol = bacon_video_widget_get_volume (emb->bvw); bacon_video_widget_set_volume (emb->bvw, vol + off_pct); + totem_embedded_save_volume (emb, vol + off_pct); } static gboolean @@ -1948,6 +2000,7 @@ totem_embedded_construct (TotemEmbedded *emb, g_signal_connect (G_OBJECT (emb->volume), "value-changed", G_CALLBACK (cb_vol), emb); bacon_video_widget_set_volume (emb->bvw, volume); + totem_embedded_save_volume (emb, volume); emb->statusbar = TOTEM_STATUSBAR (gtk_builder_get_object (emb->xml, "statusbar")); gtk_statusbar_set_has_resize_grip (GTK_STATUSBAR (emb->statusbar), FALSE); diff --git a/browser-plugin/totemComplexPlugin.cpp b/browser-plugin/totemComplexPlugin.cpp index 1296ed027..89690be45 100644 --- a/browser-plugin/totemComplexPlugin.cpp +++ b/browser-plugin/totemComplexPlugin.cpp @@ -68,7 +68,6 @@ totemScriptablePlugin::operator new (size_t aSize) CPP_THROW_NEW totemScriptablePlugin::totemScriptablePlugin (totemPlugin *aPlugin) : mPlugin(aPlugin), - mVolume(50), mPlayState(eState_Stopped) { D ("%s ctor [%p]", kClassDescription, (void*) this); @@ -2019,7 +2018,7 @@ totemScriptablePlugin::SetVolume (PRInt32 volume) nsresult rv = mPlugin->SetVolume ((double) volume / 100); /* Volume passed in is 0 through to 100 */ - mVolume = volume; + mPlugin->mVolume = volume; return NS_OK; } @@ -2030,7 +2029,7 @@ totemScriptablePlugin::GetVolume(PRInt32 *_retval) { TOTEM_SCRIPTABLE_LOG_ACCESS (); - *_retval = mVolume; + *_retval = mPlugin->mVolume; return NS_OK; } diff --git a/browser-plugin/totemComplexPlugin.h b/browser-plugin/totemComplexPlugin.h index 51b754b77..513f6e198 100644 --- a/browser-plugin/totemComplexPlugin.h +++ b/browser-plugin/totemComplexPlugin.h @@ -53,7 +53,6 @@ class totemScriptablePlugin : public totemIComplexPlayer, totemPlugin *mPlugin; PRInt32 mNumLoops; - PRInt32 mVolume; nsCString mAuthor; nsCString mBackgroundColour; diff --git a/browser-plugin/totemConePlugin.cpp b/browser-plugin/totemConePlugin.cpp index 4088921ed..5502e619e 100644 --- a/browser-plugin/totemConePlugin.cpp +++ b/browser-plugin/totemConePlugin.cpp @@ -57,7 +57,8 @@ static const totemPluginMimeEntry kMimeTypes[] = { }; totemScriptablePlugin::totemScriptablePlugin (totemPlugin *aPlugin) - : mPlugin(aPlugin) + : mPlugin(aPlugin), + mMute(PR_FALSE) { D ("%s ctor [%p]", kClassDescription, (void*) this); } @@ -345,9 +346,27 @@ totemScriptablePlugin::SetTime(PRInt32 aPosition) NS_IMETHODIMP totemScriptablePlugin::GetState(PRInt32 *aState) { - TOTEM_SCRIPTABLE_WARN_UNIMPLEMENTED (); + TOTEM_SCRIPTABLE_LOG_ACCESS (); - return NS_ERROR_NOT_IMPLEMENTED; + NS_ENSURE_STATE (IsValid()); + + /* IDLE/CLOSE=0, + * OPENING=1, + * BUFFERING=2, + * PLAYING=3, + * PAUSED=4, + * STOPPING=5, + * ERROR=6 + */ + if (mPlugin->mState == TOTEM_STATE_PLAYING) { + *aState = 3; + } else if (mPlugin->mState == TOTEM_STATE_PAUSED) { + *aState = 4; + } else { + *aState = 0; + } + + return NS_OK; } NS_IMETHODIMP @@ -383,38 +402,58 @@ totemScriptablePlugin::SetRate(double aRate) NS_IMETHODIMP totemScriptablePlugin::GetMute(PRBool *_retval) { - TOTEM_SCRIPTABLE_WARN_UNIMPLEMENTED(); + TOTEM_SCRIPTABLE_LOG_ACCESS (); -// *_retval = mMute; + *_retval = mMute; return NS_OK; } NS_IMETHODIMP totemScriptablePlugin::SetMute(PRBool enabled) { - TOTEM_SCRIPTABLE_WARN_UNIMPLEMENTED(); + nsresult rv; -// mMute = enabled != PR_FALSE; - return NS_OK; + TOTEM_SCRIPTABLE_LOG_ACCESS (); + + NS_ENSURE_STATE (IsValid ()); + + if (enabled == PR_FALSE) { + mMute = PR_FALSE; + rv = mPlugin->SetVolume (mSavedVolume); + } else { + mMute = PR_TRUE; + mSavedVolume = mPlugin->mVolume; + rv = mPlugin->SetVolume (0); + }; + + return rv; } /* attribute long volume */ NS_IMETHODIMP totemScriptablePlugin::GetVolume(PRInt32 *_retval) { - TOTEM_SCRIPTABLE_WARN_UNIMPLEMENTED(); + TOTEM_SCRIPTABLE_LOG_ACCESS (); -// *_retval = mVolume; + NS_ENSURE_STATE (IsValid ()); + + *_retval = mPlugin->mVolume * 200.0; return NS_OK; } NS_IMETHODIMP totemScriptablePlugin::SetVolume(PRInt32 aVolume) { - TOTEM_SCRIPTABLE_WARN_UNIMPLEMENTED(); + TOTEM_SCRIPTABLE_LOG_ACCESS (); -// mVolume = aVolume; - return NS_OK; + NS_ENSURE_STATE (IsValid ()); + + nsresult rv = mPlugin->SetVolume ((double) aVolume / 200.0); + + /* Volume passed in is 0 through to 200 */ + mPlugin->mVolume = (double) aVolume / 200.0; + + return rv; } /* attribute long track */ @@ -456,10 +495,7 @@ totemScriptablePlugin::ToggleMute() { TOTEM_SCRIPTABLE_LOG_ACCESS (); - NS_ENSURE_STATE (IsValid ()); - - return PR_TRUE; -// return mPlugin->ClearPlaylist (); + return SetMute (!mMute); } /* totemIConeAudio */ @@ -488,18 +524,26 @@ totemScriptablePlugin::GetHeight (PRInt32 *aHeight) NS_IMETHODIMP totemScriptablePlugin::GetFullscreen(PRBool *_retval) { - TOTEM_SCRIPTABLE_WARN_UNIMPLEMENTED(); + TOTEM_SCRIPTABLE_LOG_ACCESS (); + + NS_ENSURE_STATE (IsValid ()); + + *_retval = mPlugin->mIsFullscreen; -// *_retval = mMute; return NS_OK; } NS_IMETHODIMP totemScriptablePlugin::SetFullscreen(PRBool enabled) { - TOTEM_SCRIPTABLE_WARN_UNIMPLEMENTED(); + TOTEM_SCRIPTABLE_LOG_ACCESS (); + + NS_ENSURE_STATE (IsValid ()); + + nsresult rv = mPlugin->SetFullscreen (enabled); + + mPlugin->mIsFullscreen = enabled != PR_FALSE; -// mMute = enabled != PR_FALSE; return NS_OK; } @@ -563,8 +607,11 @@ totemScriptablePlugin::ToggleFullscreen() NS_ENSURE_STATE (IsValid ()); - return PR_TRUE; -// return mPlugin->ClearPlaylist (); + nsresult rv = mPlugin->SetFullscreen (!mPlugin->mIsFullscreen); + + mPlugin->mIsFullscreen = !mPlugin->mIsFullscreen; + + return NS_OK; } /* void toggleTeletext () */ diff --git a/browser-plugin/totemConePlugin.h b/browser-plugin/totemConePlugin.h index 4b1f2d434..d49882995 100644 --- a/browser-plugin/totemConePlugin.h +++ b/browser-plugin/totemConePlugin.h @@ -64,6 +64,9 @@ class totemScriptablePlugin : public totemICone, ~totemScriptablePlugin (); totemPlugin *mPlugin; + + PRUint32 mMute : 1; + double mSavedVolume; }; #endif /* __CONE_PLUGIN_H__ */ diff --git a/browser-plugin/totemGMPSettings.cpp b/browser-plugin/totemGMPSettings.cpp index f86f38b2b..794431f30 100644 --- a/browser-plugin/totemGMPSettings.cpp +++ b/browser-plugin/totemGMPSettings.cpp @@ -53,8 +53,7 @@ static const nsCID kClassID = static const char kClassDescription[] = "totemGMPSettings"; totemGMPSettings::totemGMPSettings (totemScriptablePlugin *aPlugin) - : mVolume(100), - mPlugin(aPlugin) + : mPlugin(aPlugin) { D ("%s ctor [%p]", kClassDescription, (void*) this); } @@ -256,7 +255,9 @@ totemGMPSettings::GetVolume(PRInt32 *_retval) { TOTEM_SCRIPTABLE_LOG_ACCESS (); - *_retval = mVolume; + NS_ENSURE_STATE (IsValid ()); + + *_retval = mPlugin->mPlugin->mVolume; return NS_OK; } NS_IMETHODIMP @@ -269,7 +270,7 @@ totemGMPSettings::SetVolume(PRInt32 volume) nsresult rv = mPlugin->mPlugin->SetVolume ((double) volume / 100); /* Volume passed in is 0 through to 100 */ - mVolume = volume; + mPlugin->mPlugin->mVolume = volume; return NS_OK; } diff --git a/browser-plugin/totemGMPSettings.h b/browser-plugin/totemGMPSettings.h index 197b220cc..d7f9acc36 100644 --- a/browser-plugin/totemGMPSettings.h +++ b/browser-plugin/totemGMPSettings.h @@ -44,7 +44,6 @@ class totemGMPSettings : public totemIGMPSettings, private: ~totemGMPSettings (); - PRInt32 mVolume; PRUint32 mMute : 1; totemScriptablePlugin *mPlugin; diff --git a/browser-plugin/totemNarrowSpacePlugin.cpp b/browser-plugin/totemNarrowSpacePlugin.cpp index 59f53eb13..1659dae34 100644 --- a/browser-plugin/totemNarrowSpacePlugin.cpp +++ b/browser-plugin/totemNarrowSpacePlugin.cpp @@ -71,8 +71,7 @@ totemScriptablePlugin::operator new (size_t aSize) CPP_THROW_NEW totemScriptablePlugin::totemScriptablePlugin (totemPlugin *aPlugin) : mPluginState(eState_Waiting), - mPlugin(aPlugin), - mVolume(100) + mPlugin(aPlugin) { D ("%s ctor [%p]", kClassDescription, (void*) this); } @@ -969,22 +968,25 @@ totemScriptablePlugin::GetVolume(PRUint32 *_retval) { TOTEM_SCRIPTABLE_LOG_ACCESS (); - *_retval = mVolume; + NS_ENSURE_STATE (IsValid ()); + + *_retval = mPlugin->mVolume * 100.0; return NS_OK; } /* void SetVolume (in unsigned long volume); */ NS_IMETHODIMP -totemScriptablePlugin::SetVolume(PRUint32 volume) +totemScriptablePlugin::SetVolume(PRUint32 aVolume) { TOTEM_SCRIPTABLE_LOG_ACCESS (); NS_ENSURE_STATE (IsValid ()); - nsresult rv = mPlugin->SetVolume ((double) volume / 100); + nsresult rv = mPlugin->SetVolume ((double) aVolume / 100); /* Volume passed in is 0 through to 100 */ - mVolume = volume; + mPlugin->mVolume = (double) aVolume / 100; - return NS_OK; + return rv; } + diff --git a/browser-plugin/totemNarrowSpacePlugin.h b/browser-plugin/totemNarrowSpacePlugin.h index 2b68527c1..cfed7225b 100644 --- a/browser-plugin/totemNarrowSpacePlugin.h +++ b/browser-plugin/totemNarrowSpacePlugin.h @@ -68,8 +68,6 @@ class totemScriptablePlugin : public totemINarrowSpacePlayer, nsCString mRectangle; nsCString mMovieName; - PRInt32 mVolume; - PRUint32 mAutoPlay : 1; PRUint32 mControllerVisible : 1; PRUint32 mIsLooping : 1; diff --git a/browser-plugin/totemPlugin.cpp b/browser-plugin/totemPlugin.cpp index 627bdae3f..4991f2aa3 100644 --- a/browser-plugin/totemPlugin.cpp +++ b/browser-plugin/totemPlugin.cpp @@ -247,6 +247,25 @@ totemPlugin::SetVolume (gdouble aVolume) } nsresult +totemPlugin::SetFullscreen (gboolean enabled) +{ + D ("SetFullscreen '%d'", enabled); + + /* FIXME: queue the action instead */ + if (!mViewerReady) + return NS_OK; + + NS_ASSERTION (mViewerProxy, "No viewer proxy"); + dbus_g_proxy_call_no_reply (mViewerProxy, + "SetFullscreen", + G_TYPE_BOOLEAN, enabled, + G_TYPE_INVALID, + G_TYPE_INVALID); + + return NS_OK; +} + +nsresult totemPlugin::ClearPlaylist (void) { D ("ClearPlaylist"); @@ -511,6 +530,20 @@ totemPlugin::ViewerSetup () reinterpret_cast<void*>(this), NULL); + dbus_g_object_register_marshaller + (totempluginviewer_marshal_VOID__STRING_BOXED, + G_TYPE_NONE, G_TYPE_STRING, G_TYPE_BOXED, G_TYPE_INVALID); + dbus_g_proxy_add_signal (mViewerProxy, + "PropertyChange", + G_TYPE_STRING, + G_TYPE_VALUE, + G_TYPE_INVALID); + dbus_g_proxy_connect_signal (mViewerProxy, + "PropertyChange", + G_CALLBACK (PropertyChangeCallback), + reinterpret_cast<void*>(this), + NULL); + if (mHidden) { ViewerReady (); } else { @@ -556,6 +589,10 @@ totemPlugin::ViewerCleanup () "Tick", G_CALLBACK (TickCallback), reinterpret_cast<void*>(this)); + dbus_g_proxy_disconnect_signal (mViewerProxy, + "PropertyChange", + G_CALLBACK (PropertyChangeCallback), + reinterpret_cast<void*>(this)); g_object_unref (mViewerProxy); mViewerProxy = NULL; @@ -982,6 +1019,25 @@ totemPlugin::TickCallback (DBusGProxy *proxy, } /* static */ void PR_CALLBACK +totemPlugin::PropertyChangeCallback (DBusGProxy *proxy, + const char *aType, + GValue *value, + void *aData) +{ + totemPlugin *plugin = reinterpret_cast<totemPlugin*>(aData); + + NS_ASSERTION (aType != NULL, "aType is NULL probably garbage"); + + DD ("PropertyChange signal received, aType %s", aType); + + if (strcmp (aType, TOTEM_PROPERTY_VOLUME) == 0) { + plugin->mVolume = g_value_get_double (value); + } else if (strcmp (aType, TOTEM_PROPERTY_ISFULLSCREEN) == 0) { + plugin->mIsFullscreen = g_value_get_boolean (value); + } +} + +/* static */ void PR_CALLBACK totemPlugin::ViewerSetWindowCallback (DBusGProxy *aProxy, DBusGProxyCall *aCall, void *aData) diff --git a/browser-plugin/totemPlugin.h b/browser-plugin/totemPlugin.h index 67c06b738..fb433a825 100644 --- a/browser-plugin/totemPlugin.h +++ b/browser-plugin/totemPlugin.h @@ -62,6 +62,7 @@ class totemPlugin { nsresult SetVolume (gdouble aVolume); nsresult ClearPlaylist (void); nsresult AddItem (const nsACString &aURI); + nsresult SetFullscreen (gboolean enabled); nsresult SetSrc (const nsACString &aURL); @@ -125,6 +126,10 @@ class totemPlugin { guint aDuration, char *aState, void *aData); + static void PR_CALLBACK PropertyChangeCallback (DBusGProxy *proxy, + const char *type, + GValue *value, + void *aData); static void PR_CALLBACK ViewerSetWindowCallback (DBusGProxy *aProxy, DBusGProxyCall *aCall, @@ -213,6 +218,8 @@ class totemPlugin { PRUint32 mTime; PRUint32 mDuration; TotemStates mState; + double mVolume; + PRBool mIsFullscreen; #ifdef TOTEM_GMP_PLUGIN public: diff --git a/browser-plugin/totempluginviewer-marshal.list b/browser-plugin/totempluginviewer-marshal.list index 68d7d495b..35b4fa7f6 100644 --- a/browser-plugin/totempluginviewer-marshal.list +++ b/browser-plugin/totempluginviewer-marshal.list @@ -1,2 +1,3 @@ VOID:UINT,UINT VOID:UINT,UINT,STRING +VOID:STRING,BOXED |