[Spice-devel] [PATCH 1/3] audio: drop gst-0.10 in favour of gst-1.0
Fabiano FidĂȘncio
fidencio at redhat.com
Mon Jan 5 16:54:23 PST 2015
As gstreamer-1,0 support was introduced by commit d4d60c97 and
it works pretty much as gstreamer-0,10 used to work (tests were
made both on Linux and Windows clients), let's drop the old
gstreamer-0.10 support in favour of gstreamer-1.0.
---
configure.ac | 19 ++++---------------
gtk/spice-audio.c | 4 ++--
gtk/spice-gstaudio.c | 48 ------------------------------------------------
3 files changed, 6 insertions(+), 65 deletions(-)
diff --git a/configure.ac b/configure.ac
index b55f3a0..a4e304d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -294,7 +294,7 @@ AS_IF([test "x$with_audio" = "xauto"], [
])
case "$with_audio" in
- gstreamer|gstreamer1|pulse|no*)
+ gstreamer|pulse|no*)
;;
*) AC_MSG_ERROR(Unsupported audio backend)
esac
@@ -314,27 +314,16 @@ AC_SUBST(PULSE_CFLAGS)
AC_SUBST(PULSE_LIBS)
AS_IF([test "x$with_audio" = "xgstreamer"],
- [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])],
+ [PKG_CHECK_MODULES(GST, gstreamer-1.0 gstreamer-base-1.0 gstreamer-app-1.0 gstreamer-audio-1.0, [have_gst=yes], [have_gst=no])],
[have_gst=no])
AS_IF([test "x$have_gst" = "xyes"],
- [AC_DEFINE([WITH_GSTAUDIO], 1, [Have GStreamer?])],
+ [AC_DEFINE([WITH_GSTAUDIO], 1, [Have GStreamer 1.0?])],
[AS_IF([test "x$with_audio" = "xgstreamer"],
- [AC_MSG_ERROR([GStreamer requested but not found])
- ])
-])
-
-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"])
+AM_CONDITIONAL([WITH_GSTAUDIO], [test "x$have_gst" = "xyes"])
AC_SUBST(GST_CFLAGS)
AC_SUBST(GST_LIBS)
diff --git a/gtk/spice-audio.c b/gtk/spice-audio.c
index 7754736..329ab6a 100644
--- a/gtk/spice-audio.c
+++ b/gtk/spice-audio.c
@@ -45,7 +45,7 @@
#ifdef WITH_PULSE
#include "spice-pulse.h"
#endif
-#if defined(WITH_GSTAUDIO) || defined(WITH_GST1AUDIO)
+#if defined(WITH_GSTAUDIO)
#include "spice-gstaudio.h"
#endif
@@ -218,7 +218,7 @@ SpiceAudio *spice_audio_new(SpiceSession *session, GMainContext *context,
#ifdef WITH_PULSE
self = SPICE_AUDIO(spice_pulse_new(session, context, name));
#endif
-#if defined(WITH_GSTAUDIO) || defined(WITH_GST1AUDIO)
+#if defined(WITH_GSTAUDIO)
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 1b82f24..892028c 100644
--- a/gtk/spice-gstaudio.c
+++ b/gtk/spice-gstaudio.c
@@ -20,12 +20,7 @@
#include <gst/gst.h>
#include <gst/app/gstappsrc.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"
@@ -128,12 +123,8 @@ static GstFlowReturn record_new_buffer(GstAppSink *appsink, gpointer data)
g_return_val_if_fail(p != NULL, GST_FLOW_ERROR);
-#ifdef WITH_GST1AUDIO
msg = gst_message_new_application(GST_OBJECT(p->record.pipe),
gst_structure_new_empty ("new-sample"));
-#else
- msg = gst_message_new_application(GST_OBJECT(p->record.pipe), NULL);
-#endif
gst_element_post_message(p->record.pipe, msg);
return GST_FLOW_OK;
}
@@ -155,7 +146,6 @@ 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;
@@ -186,24 +176,6 @@ static gboolean record_bus_cb(GstBus *bus, GstMessage *msg, gpointer data)
gst_sample_unref(s);
break;
}
-#else
- case GST_MESSAGE_APPLICATION: {
- GstBuffer *b;
-
- b = gst_app_sink_pull_buffer(GST_APP_SINK(p->record.sink));
- if (!b) {
- 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;
- }
-
- spice_record_send_data(SPICE_RECORD_CHANNEL(p->rchannel),
- /* FIXME: server side doesn't care about ts?
- what is the unit? ms apparently */
- GST_BUFFER_DATA(b), GST_BUFFER_SIZE(b), 0);
- break;
- }
-#endif
default:
break;
}
@@ -231,15 +203,9 @@ static void record_start(SpiceRecordChannel *channel, gint format, gint channels
if (!p->record.pipe) {
GError *error = NULL;
GstBus *bus;
-#ifdef WITH_GST1AUDIO
gchar *audio_caps =
g_strdup_printf("audio/x-raw,format=\"S16LE\",channels=%d,rate=%d,"
"layout=interleaved", channels, frequency);
-#else
- gchar *audio_caps =
- g_strdup_printf("audio/x-raw-int,channels=%d,rate=%d,signed=(boolean)true,"
- "width=16,depth=16,endianness=1234", channels, frequency);
-#endif
gchar *pipeline =
g_strdup_printf("autoaudiosrc name=audiosrc ! queue ! audioconvert ! audioresample ! "
"appsink caps=\"%s\" name=appsink", audio_caps);
@@ -260,13 +226,8 @@ static void record_start(SpiceRecordChannel *channel, gint format, gint channels
p->record.channels = channels;
gst_app_sink_set_emit_signals(GST_APP_SINK(p->record.sink), TRUE);
-#ifdef WITH_GST1AUDIO
spice_g_signal_connect_object(p->record.sink, "new-sample",
G_CALLBACK(record_new_buffer), gstaudio, 0);
-#else
- spice_g_signal_connect_object(p->record.sink, "new-buffer",
- G_CALLBACK(record_new_buffer), gstaudio, 0);
-#endif
cleanup:
if (error != NULL && p->record.pipe != NULL) {
@@ -336,13 +297,8 @@ static void playback_start(SpicePlaybackChannel *channel, gint format, gint chan
if (!p->playback.pipe) {
GError *error = NULL;
gchar *audio_caps =
-#ifdef WITH_GST1AUDIO
g_strdup_printf("audio/x-raw,format=\"S16LE\",channels=%d,rate=%d,"
"layout=interleaved", channels, frequency);
-#else
- g_strdup_printf("audio/x-raw-int,channels=%d,rate=%d,signed=(boolean)true,"
- "width=16,depth=16,endianness=1234", channels, frequency);
-#endif
gchar *pipeline = g_strdup (g_getenv("SPICE_GST_AUDIOSINK"));
if (pipeline == NULL)
pipeline = g_strdup_printf("appsrc is-live=1 do-timestamp=0 caps=\"%s\" name=\"appsrc\" ! queue ! "
@@ -388,11 +344,7 @@ 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);
}
--
2.1.0
More information about the Spice-devel
mailing list