+
+static GstCaps *
+gst_speex_enc_sink_getcaps (GstPad * pad)
+{
+ GstCaps *caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
+ GstCaps *peercaps = NULL;
+ GstSpeexEnc *enc = GST_SPEEX_ENC (gst_pad_get_parent_element (pad));
+
+ peercaps = gst_pad_peer_get_caps (enc->srcpad);
+
+ if (peercaps) {
+ if (!gst_caps_is_empty (peercaps) && !gst_caps_is_any (peercaps)) {
+ GstStructure *ps = gst_caps_get_structure (peercaps, 0);
+ GstStructure *s = gst_caps_get_structure (caps, 0);;
+ gint rate, channels;
+
+ if (gst_structure_get_int (ps, "rate", &rate)) {
+ gst_structure_fixate_field_nearest_int (s, "rate", rate);
+ }
+
+ if (gst_structure_get_int (ps, "channels", &channels)) {
+ gst_structure_fixate_field_nearest_int (s, "channels", channels);
+ }
+ }
+ gst_caps_unref (peercaps);
+ }
+
+ gst_object_unref (enc);
+
+ return caps;
+}
+
+