summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2007-11-21 22:40:04 +0000
committerLennart Poettering <lennart@poettering.net>2007-11-21 22:40:04 +0000
commitf0da7da42149c438033abd5e53c790d2acbba9a2 (patch)
tree7266db26fd0068ea1947ba84a6b2d347ce05bfbf
parentaac3f2e8a121df5590ee9d067f790bc7aed5ae17 (diff)
support S32 samples, prefer FLOAT32 samples over U8, add channel map support to the source
git-svn-id: file:///home/lennart/svn/public/gst-pulse/trunk@75 bb39ca4e-bce3-0310-b5d4-eea78a553289
-rw-r--r--src/pulsesink.c26
-rw-r--r--src/pulsesrc.c21
-rw-r--r--src/pulseutil.c4
3 files changed, 39 insertions, 12 deletions
diff --git a/src/pulsesink.c b/src/pulsesink.c
index 295811e..d7039a7 100644
--- a/src/pulsesink.c
+++ b/src/pulsesink.c
@@ -83,16 +83,24 @@ static void gst_pulsesink_base_init(gpointer g_class) {
"rate = (int) [ 1, MAX ], "
"channels = (int) [ 1, 16 ];"
- "audio/x-raw-int, "
- "signed = (boolean) FALSE, "
- "width = (int) 8, "
- "depth = (int) 8, "
+ "audio/x-raw-float, "
+ "endianness = (int) { " ENDIANNESS " }, "
+ "width = (int) 32, "
"rate = (int) [ 1, MAX ], "
"channels = (int) [ 1, 16 ];"
- "audio/x-raw-float, "
+ "audio/x-raw-int, "
"endianness = (int) { " ENDIANNESS " }, "
+ "signed = (boolean) TRUE, "
"width = (int) 32, "
+ "depth = (int) 32, "
+ "rate = (int) [ 1, MAX ], "
+ "channels = (int) [ 1, 16 ];"
+
+ "audio/x-raw-int, "
+ "signed = (boolean) FALSE, "
+ "width = (int) 8, "
+ "depth = (int) 8, "
"rate = (int) [ 1, MAX ], "
"channels = (int) [ 1, 16 ];"
@@ -355,11 +363,9 @@ static gboolean gst_pulsesink_close(GstAudioSink *asink) {
return TRUE;
}
-
static gboolean gst_pulsesink_prepare(GstAudioSink *asink, GstRingBufferSpec *spec) {
pa_buffer_attr buf_attr;
pa_channel_map channel_map;
-
GstPulseSink *pulsesink = GST_PULSESINK(asink);
if (!gst_pulse_fill_sample_spec(spec, &pulsesink->sample_spec)) {
@@ -374,7 +380,11 @@ static gboolean gst_pulsesink_prepare(GstAudioSink *asink, GstRingBufferSpec *sp
goto unlock_and_fail;
}
- if (!(pulsesink->stream = pa_stream_new(pulsesink->context, pulsesink->stream_name ? pulsesink->stream_name : "Playback Stream", &pulsesink->sample_spec, gst_pulse_gst_to_channel_map(&channel_map,spec)))) {
+ if (!(pulsesink->stream = pa_stream_new(
+ pulsesink->context,
+ pulsesink->stream_name ? pulsesink->stream_name : "Playback Stream",
+ &pulsesink->sample_spec,
+ gst_pulse_gst_to_channel_map(&channel_map, spec)))) {
GST_ELEMENT_ERROR(pulsesink, RESOURCE, FAILED, ("Failed to create stream: %s", pa_strerror(pa_context_errno(pulsesink->context))), (NULL));
goto unlock_and_fail;
}
diff --git a/src/pulsesrc.c b/src/pulsesrc.c
index faf6def..5a3e918 100644
--- a/src/pulsesrc.c
+++ b/src/pulsesrc.c
@@ -115,9 +115,10 @@ static void gst_pulsesrc_base_init(gpointer g_class) {
"channels = (int) [ 1, 16 ];"
"audio/x-raw-int, "
- "signed = (boolean) FALSE, "
- "width = (int) 8, "
- "depth = (int) 8, "
+ "endianness = (int) { " ENDIANNESS " }, "
+ "signed = (boolean) TRUE, "
+ "width = (int) 32, "
+ "depth = (int) 32, "
"rate = (int) [ 1, MAX ], "
"channels = (int) [ 1, 16 ];"
@@ -127,6 +128,13 @@ static void gst_pulsesrc_base_init(gpointer g_class) {
"rate = (int) [ 1, MAX ], "
"channels = (int) [ 1, 16 ];"
+ "audio/x-raw-int, "
+ "signed = (boolean) FALSE, "
+ "width = (int) 8, "
+ "depth = (int) 8, "
+ "rate = (int) [ 1, MAX ], "
+ "channels = (int) [ 1, 16 ];"
+
"audio/x-alaw, "
"rate = (int) [ 1, MAX], "
"channels = (int) [ 1, 16 ];"
@@ -388,6 +396,7 @@ static gboolean gst_pulsesrc_close(GstAudioSrc *asrc) {
}
static gboolean gst_pulsesrc_prepare(GstAudioSrc *asrc, GstRingBufferSpec *spec) {
pa_buffer_attr buf_attr;
+ pa_channel_map channel_map;
GstPulseSrc *pulsesrc = GST_PULSESRC(asrc);
@@ -403,7 +412,11 @@ static gboolean gst_pulsesrc_prepare(GstAudioSrc *asrc, GstRingBufferSpec *spec)
goto unlock_and_fail;
}
- if (!(pulsesrc->stream = pa_stream_new(pulsesrc->context, "Record Stream", &pulsesrc->sample_spec, NULL))) {
+ if (!(pulsesrc->stream = pa_stream_new(
+ pulsesrc->context,
+ "Record Stream",
+ &pulsesrc->sample_spec,
+ gst_pulse_gst_to_channel_map(&channel_map, spec)))) {
GST_ELEMENT_ERROR(pulsesrc, RESOURCE, FAILED, ("Failed to create stream: %s", pa_strerror(pa_context_errno(pulsesrc->context))), (NULL));
goto unlock_and_fail;
}
diff --git a/src/pulseutil.c b/src/pulseutil.c
index 36a2168..61aed61 100644
--- a/src/pulseutil.c
+++ b/src/pulseutil.c
@@ -58,6 +58,10 @@ gboolean gst_pulse_fill_sample_spec(GstRingBufferSpec *spec, pa_sample_spec *ss)
ss->format = PA_SAMPLE_FLOAT32LE;
else if (spec->format == GST_FLOAT32_BE && spec->width == 32)
ss->format = PA_SAMPLE_FLOAT32BE;
+ else if (spec->format == GST_S32_LE && spec->width == 32)
+ ss->format = PA_SAMPLE_S32LE;
+ else if (spec->format == GST_S32_BE && spec->width == 32)
+ ss->format = PA_SAMPLE_S32NE;
else
return FALSE;