Commit ad83c4a0 authored by David Schleef's avatar David Schleef
Browse files

ext/alsa/gstalsa.c: Add fixate function. (bug #135719)

Original commit message from CVS:
* ext/alsa/gstalsa.c: (gst_alsa_request_new_pad),
(gst_alsa_fixate): Add fixate function.  (bug #135719)
* ext/alsa/gstalsa.h:
* ext/alsa/gstalsasink.c: (gst_alsa_sink_init):
parent 002cd58c
2004-03-09 David Schleef <ds@schleef.org>
* ext/alsa/gstalsa.c: (gst_alsa_request_new_pad),
(gst_alsa_fixate): Add fixate function. (bug #135719)
* ext/alsa/gstalsa.h:
* ext/alsa/gstalsasink.c: (gst_alsa_sink_init):
2004-03-09 Benjamin Otte <otte@gnome.org>
* ext/mikmod/gstmikmod.c: (gst_mikmod_init), (gst_mikmod_loop),
......
......@@ -332,6 +332,7 @@ found_track:
gst_pad_set_link_function (this->pad[track], gst_alsa_link);
gst_pad_set_getcaps_function (this->pad[track], gst_alsa_get_caps);
gst_pad_set_fixate_function (this->pad[track], gst_alsa_fixate);
gst_element_add_pad (GST_ELEMENT (this), this->pad[track]);
......@@ -612,6 +613,33 @@ gst_alsa_get_caps (GstPad *pad)
}
}
GstCaps *
gst_alsa_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)) {
return newcaps;
}
if (gst_caps_structure_fixate_field_nearest_int (structure, "depth", 16)) {
return newcaps;
}
if (gst_caps_structure_fixate_field_nearest_int (structure, "width", 16)) {
return newcaps;
}
if (gst_caps_structure_fixate_field_nearest_int (structure, "channels", 2)) {
return newcaps;
}
gst_caps_free (newcaps);
return NULL;
}
/* Negotiates the caps */
GstPadLinkReturn
gst_alsa_link (GstPad *pad, const GstCaps *caps)
......
......@@ -175,6 +175,8 @@ void gst_alsa_set_eos (GstAlsa * this);
GstPadLinkReturn gst_alsa_link (GstPad * pad,
const GstCaps * caps);
GstCaps * gst_alsa_get_caps (GstPad * pad);
GstCaps * gst_alsa_fixate (GstPad * pad,
const GstCaps * caps);
GstCaps * gst_alsa_caps (snd_pcm_format_t format,
gint rate,
gint channels);
......
......@@ -145,6 +145,7 @@ gst_alsa_sink_init (GstAlsaSink *sink)
this->pad[0] = gst_pad_new_from_template (gst_alsa_sink_pad_factory (), "sink");
gst_pad_set_link_function (this->pad[0], gst_alsa_link);
gst_pad_set_getcaps_function (this->pad[0], gst_alsa_get_caps);
gst_pad_set_fixate_function (this->pad[0], gst_alsa_fixate);
gst_element_add_pad (GST_ELEMENT (this), this->pad[0]);
this->clock = gst_alsa_clock_new ("alsasinkclock", gst_alsa_sink_get_time, this);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment