summaryrefslogtreecommitdiffstats
path: root/ext
diff options
context:
space:
mode:
authorDavid Schleef <ds@schleef.org>2005-01-31 01:55:03 +0000
committerDavid Schleef <ds@schleef.org>2005-01-31 01:55:03 +0000
commitc4cc7088e0ca5f8b8c4b9e0c822c0013866d965d (patch)
treec168bf6190b9b98da9b2332412877678ef2b1dec /ext
parent2ec0f8b91a4ad93524a1e6d9366a2a2eff15cbe7 (diff)
downloadgst-plugins-bad-c4cc7088e0ca5f8b8c4b9e0c822c0013866d965d.tar.gz
gst-plugins-bad-c4cc7088e0ca5f8b8c4b9e0c822c0013866d965d.tar.bz2
gst-plugins-bad-c4cc7088e0ca5f8b8c4b9e0c822c0013866d965d.zip
ext/polyp/polypsink.c: Fix silly endianness bug. Add some debugging. Remove float from caps; it doesn't work. Atte...
Original commit message from CVS: * ext/polyp/polypsink.c: (gst_polypsink_base_init), (create_context), (gst_polypsink_link): Fix silly endianness bug. Add some debugging. Remove float from caps; it doesn't work. Attempt to get remote audio working.
Diffstat (limited to 'ext')
-rw-r--r--ext/polyp/polypsink.c37
1 files changed, 26 insertions, 11 deletions
diff --git a/ext/polyp/polypsink.c b/ext/polyp/polypsink.c
index 37f5d5f4..b9e86901 100644
--- a/ext/polyp/polypsink.c
+++ b/ext/polyp/polypsink.c
@@ -17,6 +17,9 @@
#include "polypsink.h"
+GST_DEBUG_CATEGORY_EXTERN (polyp_debug);
+#define GST_CAT_DEFAULT polyp_debug
+
enum
{
ARG_0,
@@ -44,9 +47,9 @@ gst_polypsink_base_init (gpointer g_class)
"signed = (boolean) TRUE, "
"width = (int) 16, "
"depth = (int) 16, "
- "rate = (int) [ 1, MAX ], "
- "channels = (int) [ 1, 16 ];"
- "audio/x-raw-float, "
+ "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, 16 ]"
+#if 0
+ ";audio/x-raw-float, "
"endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, "
"width = (int) 32, "
"rate = (int) [ 1, MAX ], "
@@ -55,7 +58,9 @@ gst_polypsink_base_init (gpointer g_class)
"signed = (boolean) FALSE, "
"width = (int) 8, "
"depth = (int) 8, "
- "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, 16 ]")
+ "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, 16 ]"
+#endif
+ )
);
static const GstElementDetails details = {
@@ -334,7 +339,11 @@ create_context (GstPolypSink * polypsink)
pa_context_set_state_callback (polypsink->context, context_state_callback,
polypsink);
- pa_context_connect (polypsink->context, NULL, 1, NULL);
+ if (polypsink->server && polypsink->server[0]) {
+ pa_context_connect (polypsink->context, polypsink->server, 1, NULL);
+ } else {
+ pa_context_connect (polypsink->context, NULL, 1, NULL);
+ }
}
static void
@@ -492,6 +501,7 @@ gst_polypsink_link (GstPad * pad, const GstCaps * caps)
const char *n;
char t[256];
GstElementState state;
+ int n_channels;
polypsink = GST_POLYPSINK (gst_pad_get_parent (pad));
@@ -519,24 +529,29 @@ gst_polypsink_link (GstPad * pad, const GstCaps * caps)
else if (depth == 32 && endianness == 4321
&& !strcmp (n, "audio/x-raw-float"))
polypsink->sample_spec.format = PA_SAMPLE_FLOAT32LE;
- else
+ else {
+ GST_DEBUG ("unrecognized format, refusing link");
return GST_PAD_LINK_REFUSED;
+ }
+
+ GST_DEBUG ("using format %d", polypsink->sample_spec.format);
polypsink->sample_spec.rate = 44100;
polypsink->sample_spec.channels = 2;
pa_sample_spec_snprint (t, sizeof (t), &polypsink->sample_spec);
- gst_structure_get_int (structure, "channels",
- (int *) &polypsink->sample_spec.channels);
+ gst_structure_get_int (structure, "channels", &n_channels);
+ polypsink->sample_spec.channels = n_channels;
gst_structure_get_int (structure, "rate", &polypsink->sample_spec.rate);
pa_sample_spec_snprint (t, sizeof (t), &polypsink->sample_spec);
+ GST_DEBUG ("using format %s", t);
- if (!pa_sample_spec_valid (&polypsink->sample_spec))
+ if (!pa_sample_spec_valid (&polypsink->sample_spec)) {
+ GST_DEBUG ("invalid format, refusing link");
return GST_PAD_LINK_REFUSED;
-
-
+ }
polypsink->negotiated = 1;