From c4cc7088e0ca5f8b8c4b9e0c822c0013866d965d Mon Sep 17 00:00:00 2001 From: David Schleef Date: Mon, 31 Jan 2005 01:55:03 +0000 Subject: 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. --- ChangeLog | 7 +++++++ ext/polyp/polypsink.c | 37 ++++++++++++++++++++++++++----------- 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 15e33aae..daa32c7b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-01-30 David Schleef + + * 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. + 2005-01-29 Ronald S. Bultje * gst/qtdemux/qtdemux.c: (qtdemux_video_caps): 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; -- cgit v1.2.1