[Spice-devel] gstreamer0.10 still needed for building?
Christophe Fergeau
cfergeau at redhat.com
Wed Aug 27 04:43:02 PDT 2014
Hey,
On Wed, Aug 27, 2014 at 11:11:09AM +0000, Torben Andresen wrote:
> is gstreamer0.10 still needed? In configure.ac is
> [PKG_CHECK_MODULES(GST, gstreamer-0.10 gstreamer-base-0.10
> gstreamer-app-0.10 gstreamer-audio-0.10, [have_gst=yes], [have_gst=no])]
> stated. Is with "GST" gstreamer1.x meant?
0.10 is meant, it hasn't been ported to gstreamer 1.0 yet. Back in the
days, I came up with the attached patch to get it to compile with gst
1.0, but there was no longer any sound output with it, and I never
debugged it.
Christophe
-------------- next part --------------
From 363f5ac24c06069c782e82587c30e5a98a92a1f8 Mon Sep 17 00:00:00 2001
From: Christophe Fergeau <cfergeau at redhat.com>
Date: Tue, 9 Oct 2012 12:10:23 +0200
Subject: [spice-gtk] Add GStreamer 1.0 support
This commit adds GStreamer 1.0 support. As the changes compared to
GStreamer 0.10 are minor (only 2 functions to modify), I've kept support
for both versions. GStreamer 1.0 support can be enabled using
--with-audio=gstreamer1
---
configure.ac | 17 ++++++++++++++---
gtk/spice-audio.c | 4 ++--
gtk/spice-gstaudio.c | 43 ++++++++++++++++++++++++++++++++++++++++++-
3 files changed, 58 insertions(+), 6 deletions(-)
diff --git a/configure.ac b/configure.ac
index f47ee20..91633e4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -288,7 +288,7 @@ AS_IF([test "x$have_phodav" = "xyes"],
AC_DEFINE(USE_PHODAV, [1], [Define if supporting phodav]))
AC_ARG_WITH([audio],
- AS_HELP_STRING([--with-audio=@<:@gstreamer/pulse/auto/no@:>@], [Select audio backend @<:@default=auto@:>@]),
+ AS_HELP_STRING([--with-audio=@<:@gstreamer/gstreamer1/pulse/auto/no@:>@], [Select audio backend @<:@default=auto@:>@]),
[],
[with_audio="auto"])
@@ -297,7 +297,7 @@ AS_IF([test "x$with_audio" = "xauto"], [
])
case "$with_audio" in
- gstreamer|pulse|no*)
+ gstreamer|gstreamer1|pulse|no*)
;;
*) AC_MSG_ERROR(Unsupported audio backend)
esac
@@ -326,7 +326,18 @@ AS_IF([test "x$have_gst" = "xyes"],
[AC_MSG_ERROR([GStreamer requested but not found])
])
])
-AM_CONDITIONAL([WITH_GSTAUDIO], [test "x$have_gst" = "xyes"])
+
+AS_IF([test "x$with_audio" = "xgstreamer1"],
+ [PKG_CHECK_MODULES(GST, gstreamer-1.0 gstreamer-base-1.0 gstreamer-app-1.0 gstreamer-audio-1.0, [have_gst1=yes], [have_gst1=no])],
+ [have_gst1=no])
+
+AS_IF([test "x$have_gst1" = "xyes"],
+ [AC_DEFINE([WITH_GST1AUDIO], 1, [Have GStreamer 1.0?])],
+ [AS_IF([test "x$with_audio" = "xgstreamer1"],
+ [AC_MSG_ERROR([GStreamer 1.0 requested but not found])
+ ])
+])
+AM_CONDITIONAL([WITH_GSTAUDIO], [test "x$have_gst" = "xyes" -o "x$have_gst1" = "xyes"])
AC_SUBST(GST_CFLAGS)
AC_SUBST(GST_LIBS)
diff --git a/gtk/spice-audio.c b/gtk/spice-audio.c
index dbd3a8b..34c1b69 100644
--- a/gtk/spice-audio.c
+++ b/gtk/spice-audio.c
@@ -47,7 +47,7 @@
#ifdef WITH_PULSE
#include "spice-pulse.h"
#endif
-#ifdef WITH_GSTAUDIO
+#if defined(WITH_GSTAUDIO) || defined(WITH_GST1AUDIO)
#include "spice-gstaudio.h"
#endif
@@ -219,7 +219,7 @@ SpiceAudio *spice_audio_new(SpiceSession *session, GMainContext *context,
#ifdef WITH_PULSE
self = SPICE_AUDIO(spice_pulse_new(session, context, name));
#endif
-#ifdef WITH_GSTAUDIO
+#if defined(WITH_GSTAUDIO) || defined(WITH_GST1AUDIO)
self = SPICE_AUDIO(spice_gstaudio_new(session, context, name));
#endif
if (!self)
diff --git a/gtk/spice-gstaudio.c b/gtk/spice-gstaudio.c
index faa0c74..fb76dfb 100644
--- a/gtk/spice-gstaudio.c
+++ b/gtk/spice-gstaudio.c
@@ -21,9 +21,13 @@
#include <gst/gst.h>
#include <gst/app/gstappsrc.h>
-#include <gst/app/gstappbuffer.h>
#include <gst/app/gstappsink.h>
+#ifdef WITH_GST1AUDIO
+#include <gst/audio/streamvolume.h>
+#else
+#include <gst/app/gstappbuffer.h>
#include <gst/interfaces/streamvolume.h>
+#endif
#include "spice-gstaudio.h"
#include "spice-common.h"
@@ -155,6 +159,38 @@ static gboolean record_bus_cb(GstBus *bus, GstMessage *msg, gpointer data)
g_return_val_if_fail(p != NULL, FALSE);
switch (GST_MESSAGE_TYPE(msg)) {
+#ifdef WITH_GST1AUDIO
+ case GST_MESSAGE_APPLICATION: {
+ GstSample *s;
+ GstBuffer *buffer;
+ GstMapInfo mapping;
+
+ s = gst_app_sink_pull_sample(GST_APP_SINK(p->record.sink));
+ if (!s) {
+ if (!gst_app_sink_is_eos(GST_APP_SINK(p->record.sink)))
+ g_warning("eos not reached, but can't pull new sample");
+ return TRUE;
+ }
+
+ buffer = gst_sample_get_buffer(s);
+ if (!buffer) {
+ if (!gst_app_sink_is_eos(GST_APP_SINK(p->record.sink)))
+ g_warning("eos not reached, but can't pull new buffer");
+ return TRUE;
+ }
+ if (!gst_buffer_map(buffer, &mapping, GST_MAP_READ)) {
+ return TRUE;
+ }
+
+ spice_record_send_data(SPICE_RECORD_CHANNEL(p->rchannel),
+ /* FIXME: server side doesn't care about ts?
+ what is the unit? ms apparently */
+ mapping.data, mapping.size, 0);
+ gst_buffer_unmap(buffer, &mapping);
+ gst_sample_unref(s);
+ break;
+ }
+#else
case GST_MESSAGE_APPLICATION: {
GstBuffer *b;
@@ -171,6 +207,7 @@ static gboolean record_bus_cb(GstBus *bus, GstMessage *msg, gpointer data)
GST_BUFFER_DATA(b), GST_BUFFER_SIZE(b), 0);
break;
}
+#endif
default:
break;
}
@@ -356,7 +393,11 @@ static void playback_data(SpicePlaybackChannel *channel,
g_return_if_fail(p != NULL);
audio = g_memdup(audio, size); /* TODO: try to avoid memory copy */
+#ifdef WITH_GST1AUDIO
+ buf = gst_buffer_new_wrapped(audio, size);
+#else
buf = gst_app_buffer_new(audio, size, g_free, audio);
+#endif
gst_app_src_push_buffer(GST_APP_SRC(p->playback.src), buf);
}
--
1.9.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20140827/422064e3/attachment.sig>
More information about the Spice-devel
mailing list