[PATCHv2 02/22] audio: move spice_audio_get() to session

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 gtk/spice-audio.c   | 31 -------------------------------
 gtk/spice-session.c | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+), 31 deletions(-)

diff --git a/gtk/spice-audio.c b/gtk/spice-audio.c
index ce303f1..7754736 100644
--- a/gtk/spice-audio.c
+++ b/gtk/spice-audio.c
@@ -230,34 +230,3 @@ SpiceAudio *spice_audio_new(SpiceSession *session, GMainContext *context,
 
     return self;
 }
-
-/**
- * spice_audio_get:
- * @session: the #SpiceSession to connect to
- * @context: (allow-none): a #GMainContext to attach to (or %NULL for default).
- *
- * Gets the #SpiceAudio associated with the passed in #SpiceSession.
- * A new #SpiceAudio instance will be created the first time this
- * function is called for a certain #SpiceSession.
- *
- * Note that this function returns a weak reference, which should not be used
- * after the #SpiceSession itself has been unref-ed by the caller.
- *
- * Returns: (transfer none): a weak reference to a #SpiceAudio
- * instance or %NULL if failed.
- **/
-SpiceAudio *spice_audio_get(SpiceSession *session, GMainContext *context)
-{
-    static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
-    SpiceAudio *self;
-
-    g_static_mutex_lock(&mutex);
-    self = session->priv->audio_manager;
-    if (self == NULL) {
-        self = spice_audio_new(session, context, NULL);
-        session->priv->audio_manager = self;
-    }
-    g_static_mutex_unlock(&mutex);
-
-    return self;
-}
diff --git a/gtk/spice-session.c b/gtk/spice-session.c
index f729ae0..948c238 100644
--- a/gtk/spice-session.c
+++ b/gtk/spice-session.c
@@ -32,6 +32,7 @@
 #include "wocky-http-proxy.h"
 #include "spice-uri-priv.h"
 #include "channel-playback-priv.h"
+#include "spice-audio.h"
 
 struct channel {
     SpiceChannel      *channel;
@@ -2280,6 +2281,39 @@ SpiceURI *spice_session_get_proxy_uri(SpiceSession *session)
     return s->proxy;
 }
 
+/**
+ * spice_audio_get:
+ * @session: the #SpiceSession to connect to
+ * @context: (allow-none): a #GMainContext to attach to (or %NULL for default).
+ *
+ * Gets the #SpiceAudio associated with the passed in #SpiceSession.
+ * A new #SpiceAudio instance will be created the first time this
+ * function is called for a certain #SpiceSession.
+ *
+ * Note that this function returns a weak reference, which should not be used
+ * after the #SpiceSession itself has been unref-ed by the caller.
+ *
+ * Returns: (transfer none): a weak reference to a #SpiceAudio
+ * instance or %NULL if failed.
+ **/
+SpiceAudio *spice_audio_get(SpiceSession *session, GMainContext *context)
+{
+    static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
+    SpiceAudio *self;
+
+    g_return_val_if_fail(SPICE_IS_SESSION(session), NULL);
+
+    g_static_mutex_lock(&mutex);
+    self = session->priv->audio_manager;
+    if (self == NULL) {
+        self = spice_audio_new(session, context, NULL);
+        session->priv->audio_manager = self;
+    }
+    g_static_mutex_unlock(&mutex);
+
+    return self;
+}
+
 G_GNUC_INTERNAL
 gboolean spice_session_get_audio_enabled(SpiceSession *session)
 {
-- 
2.1.0

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]