diff options
author | David Schleef <ds@schleef.org> | 2004-03-25 02:43:48 +0000 |
---|---|---|
committer | David Schleef <ds@schleef.org> | 2004-03-25 02:43:48 +0000 |
commit | d21f04ca6fb0e4d3f912834542aa13d0d79fdf94 (patch) | |
tree | 38abf7a4db2596ba473f8d2faa5a5bf99dd63e5a /sys/oss/gstosssrc.c | |
parent | f2ad493ba4ed1fc096c5ebf35545f3e5f2549e8b (diff) |
sys/oss/gstosselement.c: Add code to handle rate probing (bug #120883)
Original commit message from CVS:
* sys/oss/gstosselement.c: (gst_osselement_sync_parms),
(gst_osselement_close_audio), (gst_osselement_probe_caps),
(gst_osselement_get_format_structure),
(gst_osselement_rate_probe_check), (gst_osselement_rate_add_range),
(gst_osselement_rate_check_rate), (gst_osselement_rate_add_rate),
(gst_osselement_rate_int_compare): Add code to handle rate probing
(bug #120883)
* sys/oss/gstosselement.h: same
* sys/oss/gstosssink.c: (gst_osssink_init), (gst_osssink_getcaps):
Use rate probing provided by osselement.
* sys/oss/gstosssrc.c: (gst_osssrc_init), (gst_osssrc_getcaps): same
Diffstat (limited to 'sys/oss/gstosssrc.c')
-rw-r--r-- | sys/oss/gstosssrc.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/sys/oss/gstosssrc.c b/sys/oss/gstosssrc.c index b35dbfc2..1ff3ee48 100644 --- a/sys/oss/gstosssrc.c +++ b/sys/oss/gstosssrc.c @@ -66,7 +66,7 @@ static GstStaticPadTemplate osssrc_src_factory = GST_STATIC_PAD_TEMPLATE ("src", "signed = (boolean) { TRUE, FALSE }, " "width = (int) { 8, 16 }, " "depth = (int) { 8, 16 }, " - "rate = (int) [ 1000, 48000 ], " "channels = (int) [ 1, 2 ]") + "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, 2 ]") ); static void gst_osssrc_base_init (gpointer g_class); @@ -76,6 +76,7 @@ static void gst_osssrc_dispose (GObject * object); static GstPadLinkReturn gst_osssrc_srcconnect (GstPad * pad, const GstCaps * caps); +static GstCaps *gst_osssrc_getcaps (GstPad * pad); static const GstFormat *gst_osssrc_get_formats (GstPad * pad); static gboolean gst_osssrc_convert (GstPad * pad, GstFormat src_format, gint64 src_value, @@ -176,6 +177,7 @@ gst_osssrc_init (GstOssSrc * osssrc) gst_pad_new_from_template (gst_static_pad_template_get (&osssrc_src_factory), "src"); gst_pad_set_get_function (osssrc->srcpad, gst_osssrc_get); + gst_pad_set_getcaps_function (osssrc->srcpad, gst_osssrc_getcaps); gst_pad_set_link_function (osssrc->srcpad, gst_osssrc_srcconnect); gst_pad_set_convert_function (osssrc->srcpad, gst_osssrc_convert); gst_pad_set_formats_function (osssrc->srcpad, gst_osssrc_get_formats); @@ -184,7 +186,6 @@ gst_osssrc_init (GstOssSrc * osssrc) gst_pad_set_query_function (osssrc->srcpad, gst_osssrc_src_query); gst_pad_set_query_type_function (osssrc->srcpad, gst_osssrc_get_query_types); - gst_element_add_pad (GST_ELEMENT (osssrc), osssrc->srcpad); osssrc->buffersize = 4096; @@ -208,6 +209,25 @@ gst_osssrc_dispose (GObject * object) G_OBJECT_CLASS (parent_class)->dispose (object); } +static GstCaps * +gst_osssrc_getcaps (GstPad * pad) +{ + GstOssSrc *src; + GstCaps *caps; + + src = GST_OSSSRC (gst_pad_get_parent (pad)); + + gst_osselement_probe_caps (GST_OSSELEMENT (src)); + + if (GST_OSSELEMENT (src)->probed_caps == NULL) { + caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad)); + } else { + caps = gst_caps_copy (GST_OSSELEMENT (src)->probed_caps); + } + + return caps; +} + static GstPadLinkReturn gst_osssrc_srcconnect (GstPad * pad, const GstCaps * caps) { |