static gboolean gst_freeverb_set_caps (GstBaseTransform * base, GstCaps * incaps, GstCaps * outcaps) { GstFreeverb *filter = GST_FREEVERB (base); GstAudioInfo info; /*GST_INFO ("incaps are %" GST_PTR_FORMAT, incaps); */ if (!gst_audio_info_from_caps (&info, incaps)) goto no_format; GST_DEBUG ("try to process %d input with %d channels", GST_AUDIO_INFO_FORMAT (&info), GST_AUDIO_INFO_CHANNELS (&info)); if (!gst_freeverb_set_process_function (filter, &info)) goto no_format; filter->info = info; gst_freeverb_init_rev_model (filter); filter->drained = FALSE; GST_INFO_OBJECT (base, "model configured"); return TRUE; no_format: { GST_DEBUG ("invalid caps"); return FALSE; } }
static gboolean gst_freeverb_set_caps (GstBaseTransform * base, GstCaps * incaps, GstCaps * outcaps) { GstFreeverb *filter = GST_FREEVERB (base); const GstStructure *structure; gboolean ret; gint width, rate; const gchar *fmt; /*GST_INFO ("incaps are %" GST_PTR_FORMAT, incaps); */ structure = gst_caps_get_structure (incaps, 0); ret = gst_structure_get_int (structure, "channels", &filter->channels); if (!ret) goto no_channels; ret = gst_structure_get_int (structure, "width", &width); if (!ret) goto no_width; filter->width = width / 8; ret = gst_structure_get_int (structure, "rate", &rate); if (!ret) goto no_rate; filter->rate = rate; fmt = gst_structure_get_name (structure); if (!strcmp (fmt, "audio/x-raw-int")) filter->format_float = FALSE; else filter->format_float = TRUE; GST_DEBUG_OBJECT (filter, "try to process %s input_1 with %d channels", fmt, filter->channels); ret = gst_freeverb_set_process_function (filter); if (!ret) GST_WARNING_OBJECT (filter, "can't process input_1 with %d channels", filter->channels); gst_freeverb_init_rev_model (filter); filter->drained = FALSE; GST_INFO_OBJECT (base, "model configured"); return ret; no_channels: GST_DEBUG_OBJECT (filter, "no channels in caps"); return ret; no_width: GST_DEBUG_OBJECT (filter, "no width in caps"); return ret; no_rate: GST_DEBUG_OBJECT (filter, "no rate in caps"); return ret; }