From 4be3e6fdbf067f75eed9ba59e2768890f6b317fa Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 27 Oct 2004 22:45:31 +0000 Subject: prepare next release git-svn-id: file:///home/lennart/svn/public/gst-pulse/trunk@6 bb39ca4e-bce3-0310-b5d4-eea78a553289 --- src/polypsink.c | 49 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 16 deletions(-) (limited to 'src/polypsink.c') diff --git a/src/polypsink.c b/src/polypsink.c index 70f5b41..6376662 100644 --- a/src/polypsink.c +++ b/src/polypsink.c @@ -29,25 +29,25 @@ static void gst_polypsink_base_init(gpointer g_class) { GST_PAD_ALWAYS, GST_STATIC_CAPS( "audio/x-raw-int, " - "endianness = (int) 1234, " /*{ LITTLE_ENDIAN , BIG_ENDIAN }, "*/ + "endianness = (int) { LITTLE_ENDIAN , BIG_ENDIAN }, " "signed = (boolean) TRUE, " "width = (int) 16, " "depth = (int) 16, " - "rate = (int) 44100, " /*[ 1000, 192000 ], "*/ - "channels = (int) [ 1, 16 ]" /*[ 1, 16 ];"*/ - -/* "audio/x-raw-float, " */ -/* "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " */ -/* "width = (int) 32, " */ -/* "rate = (int) [ 1000, 192000 ], " */ -/* "channels = (int) [ 1, 16 ];" */ + "rate = (int) [ 1, MAX ], " + "channels = (int) [ 1, 16 ];" + + "audio/x-raw-float, " + "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " + "width = (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) [ 1000, 192000 ], " */ - /* "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 ]") ); static const GstElementDetails details = { @@ -294,7 +294,7 @@ static void create_stream(GstPolypSink *polypsink) { pa_stream_set_state_callback(polypsink->stream, stream_state_callback, polypsink); pa_stream_set_write_callback(polypsink->stream, stream_write_callback, polypsink); - pa_stream_connect_playback(polypsink->stream, NULL, NULL, PA_VOLUME_NORM); + pa_stream_connect_playback(polypsink->stream, NULL, NULL, 0, PA_VOLUME_NORM); } static void create_context(GstPolypSink *polypsink) { @@ -506,6 +506,22 @@ static GstPadLinkReturn gst_polypsink_link(GstPad *pad, const GstCaps *caps) { return GST_PAD_LINK_OK; } +static GstCaps* gst_polypsink_sink_fixate(GstPad *pad, const GstCaps *caps) { + GstCaps *newcaps; + GstStructure *structure; + + newcaps = gst_caps_new_full(gst_structure_copy(gst_caps_get_structure(caps, 0)), NULL); + structure = gst_caps_get_structure(newcaps, 0); + + if (gst_caps_structure_fixate_field_nearest_int (structure, "rate", 44100) || + gst_caps_structure_fixate_field_nearest_int (structure, "depth", 16) || + gst_caps_structure_fixate_field_nearest_int (structure, "width", 16) || + gst_caps_structure_fixate_field_nearest_int (structure, "channels", 2)) + return newcaps; + + gst_caps_free (newcaps); + return NULL; +} static void gst_polypsink_init(GTypeInstance* instance, gpointer g_class) { GstPolypSink *polypsink = GST_POLYPSINK(instance); @@ -517,6 +533,7 @@ static void gst_polypsink_init(GTypeInstance* instance, gpointer g_class) { gst_element_add_pad(GST_ELEMENT(polypsink), polypsink->sinkpad); gst_pad_set_chain_function(polypsink->sinkpad, gst_polypsink_chain); gst_pad_set_link_function(polypsink->sinkpad, gst_polypsink_link); + gst_pad_set_fixate_function (polypsink->sinkpad, gst_polypsink_sink_fixate); /* GST_FLAG_SET(polypsink, GST_ELEMENT_THREAD_SUGGESTED); */ GST_FLAG_SET(polypsink, GST_ELEMENT_EVENT_AWARE); -- cgit