summaryrefslogtreecommitdiffstats
path: root/ext/arts
diff options
context:
space:
mode:
Diffstat (limited to 'ext/arts')
-rw-r--r--ext/arts/gst_arts.c25
-rw-r--r--ext/arts/gst_artsio_impl.cc56
2 files changed, 41 insertions, 40 deletions
diff --git a/ext/arts/gst_arts.c b/ext/arts/gst_arts.c
index 16906e69..0eff0852 100644
--- a/ext/arts/gst_arts.c
+++ b/ext/arts/gst_arts.c
@@ -42,21 +42,21 @@ static GstStaticPadTemplate sink_temp = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-int, "
- "depth = (int) 16, "
- "width = (int) 16, "
- "signed = (boolean) true, "
- "channels = (int) 2, " "endianness = (int) byte_order")
+ "depth = (int) 16, "
+ "width = (int) 16, "
+ "signed = (boolean) true, "
+ "channels = (int) 2, " "endianness = (int) byte_order")
);
static GstStaticPadTemplate src_temp = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-int, "
- "depth = (int) 16, "
- "width = (int) 16, "
- "signed = (boolean) true, "
- "channels = (int) 2, "
- "rate = (int) 44100, " "endianness = (int) byte_order")
+ "depth = (int) 16, "
+ "width = (int) 16, "
+ "signed = (boolean) true, "
+ "channels = (int) 2, "
+ "rate = (int) 44100, " "endianness = (int) byte_order")
);
enum
@@ -93,8 +93,9 @@ gst_arts_get_type (void)
0,
(GInstanceInitFunc) gst_arts_init,
};
+
gst_arts_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstArts", &gst_arts_info, 0);
+ g_type_register_static (GST_TYPE_ELEMENT, "GstArts", &gst_arts_info, 0);
}
return gst_arts_type;
}
@@ -128,12 +129,12 @@ gst_arts_init (GstARTS * arts)
{
arts->sinkpad =
gst_pad_new_from_template (gst_element_get_pad_template (GST_ELEMENT
- (arts), "sink"), "sink");
+ (arts), "sink"), "sink");
gst_element_add_pad (GST_ELEMENT (arts), arts->sinkpad);
arts->srcpad =
gst_pad_new_from_template (gst_element_get_pad_template (GST_ELEMENT
- (arts), "src"), "src");
+ (arts), "src"), "src");
gst_element_add_pad (GST_ELEMENT (arts), arts->srcpad);
gst_element_set_loop_function (GST_ELEMENT (arts), gst_arts_loop);
diff --git a/ext/arts/gst_artsio_impl.cc b/ext/arts/gst_artsio_impl.cc
index b08aa93a..18d099ea 100644
--- a/ext/arts/gst_artsio_impl.cc
+++ b/ext/arts/gst_artsio_impl.cc
@@ -44,40 +44,40 @@ namespace Gst
while (fulfilled < samples)
{
- if (remainingsamples == 0) {
+ if (remainingsamples == 0) {
//fprintf(stderr,"need to get a buffer\n");
- if (inbuf) {
- gst_data_unref (inbuf);
- inbuf = NULL;
- }
- // start by pulling a buffer from GStreamer
- inbuf = gst_pad_pull (sinkpad);
-
- while (GST_IS_EVENT (inbuf)) {
- switch (GST_EVENT_TYPE (inbuf)) {
- case GST_EVENT_EOS:
- gst_element_set_eos (GST_PAD_PARENT (sinkpad));
- default:
- break;
- }
- gst_pad_event_default (srcpad, GST_EVENT (inbuf));
- inbuf = gst_pad_pull (sinkpad);
- }
-
- dataptr = GST_BUFFER_DATA (GST_BUFFER (inbuf));
- remainingsamples = GST_BUFFER_SIZE (GST_BUFFER (inbuf)) / 4;
+ if (inbuf) {
+ gst_data_unref (inbuf);
+ inbuf = NULL;
+ }
+ // start by pulling a buffer from GStreamer
+ inbuf = gst_pad_pull (sinkpad);
+
+ while (GST_IS_EVENT (inbuf)) {
+ switch (GST_EVENT_TYPE (inbuf)) {
+ case GST_EVENT_EOS:
+ gst_element_set_eos (GST_PAD_PARENT (sinkpad));
+ default:
+ break;
+ }
+ gst_pad_event_default (srcpad, GST_EVENT (inbuf));
+ inbuf = gst_pad_pull (sinkpad);
+ }
+
+ dataptr = GST_BUFFER_DATA (GST_BUFFER (inbuf));
+ remainingsamples = GST_BUFFER_SIZE (GST_BUFFER (inbuf)) / 4;
//fprintf(stderr,"got a buffer with %d samples\n",remainingsamples);
- }
+ }
- unsigned long count = MIN (remainingsamples, samples - fulfilled);
+ unsigned long count = MIN (remainingsamples, samples - fulfilled);
//fprintf(stderr,"have %d samples left, can fill %d\n",remainingsamples,count);
- convert_stereo_i16le_2float (count, dataptr, outleft, outright);
+ convert_stereo_i16le_2float (count, dataptr, outleft, outright);
//s = (gint16 *)dataptr;
//fprintf(stderr,"samples in are %d and %d, out are %f and %f\n",s[0],s[1],outleft[0],outright[0]);
- remainingsamples -= count;
- dataptr += 4 * count;
- fulfilled += count;
+ remainingsamples -= count;
+ dataptr += 4 * count;
+ fulfilled += count;
}
}
@@ -112,7 +112,7 @@ namespace Gst
GST_BUFFER_SIZE (outbuf) = samples * 4;
memset (GST_BUFFER_DATA (outbuf), 0, samples * 4);
convert_stereo_2float_i16le (samples, inleft, inright,
- GST_BUFFER_DATA (outbuf));
+ GST_BUFFER_DATA (outbuf));
//s = (gint16 *)GST_BUFFER_DATA(outbuf);
//fprintf(stderr,"samples in are %f and %f, out are %d and %d\n",inleft[0],inright[0],s[0],s[1]);
gst_pad_push (srcpad, GST_DATA (outbuf));