gst_plugins_base/gst-libs/gst/audio/gstaudiofilter.c
branchRCL_3
changeset 29 567bb019e3e3
parent 0 0e761a78d257
child 30 7e817e7e631c
equal deleted inserted replaced
6:9b2c3c7a1a9c 29:567bb019e3e3
    30  * before calling your setup function. Also, elements deriving from
    30  * before calling your setup function. Also, elements deriving from
    31  * #GstAudioFilter may use gst_audio_filter_class_add_pad_templates() from
    31  * #GstAudioFilter may use gst_audio_filter_class_add_pad_templates() from
    32  * their base_init function to easily configure the set of caps/formats that
    32  * their base_init function to easily configure the set of caps/formats that
    33  * the element is able to handle.
    33  * the element is able to handle.
    34  *
    34  *
    35  * Derived classes should override the GstAudioFilter::setup() and
    35  * Derived classes should override the #GstAudioFilterClass.setup() and
    36  * GstBaseTransform::transform_ip() and/or GstBaseTransform::transform()
    36  * #GstBaseTransformClass.transform_ip() and/or
       
    37  * #GstBaseTransformClass.transform()
    37  * virtual functions in their class_init function.
    38  * virtual functions in their class_init function.
    38  *
    39  *
       
    40  * Last reviewed on 2007-02-03 (0.10.11.1)
       
    41  *
    39  * Since: 0.10.12
    42  * Since: 0.10.12
    40  *
       
    41  * Last reviewed on 2007-02-03 (0.10.11.1)
       
    42  */
    43  */
    43 
    44 
    44 #ifdef HAVE_CONFIG_H
    45 #ifdef HAVE_CONFIG_H
    45 #include "config.h"
    46 #include "config.h"
    46 #endif
    47 #endif
   166 {
   167 {
   167   GstAudioFilterClass *klass;
   168   GstAudioFilterClass *klass;
   168   GstAudioFilter *filter;
   169   GstAudioFilter *filter;
   169   gboolean ret = TRUE;
   170   gboolean ret = TRUE;
   170 
   171 
   171   g_assert (gst_caps_is_equal (incaps, outcaps));
       
   172 
       
   173   filter = GST_AUDIO_FILTER (btrans);
   172   filter = GST_AUDIO_FILTER (btrans);
   174 
   173 
   175   GST_LOG_OBJECT (filter, "caps: %" GST_PTR_FORMAT, incaps);
   174   GST_LOG_OBJECT (filter, "caps: %" GST_PTR_FORMAT, incaps);
   176 
   175 
   177   if (!gst_ring_buffer_parse_caps (&filter->format, incaps)) {
   176   if (!gst_ring_buffer_parse_caps (&filter->format, incaps)) {
   225 void
   224 void
   226 gst_audio_filter_class_add_pad_templates (GstAudioFilterClass * klass,
   225 gst_audio_filter_class_add_pad_templates (GstAudioFilterClass * klass,
   227     const GstCaps * allowed_caps)
   226     const GstCaps * allowed_caps)
   228 {
   227 {
   229   GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
   228   GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
       
   229   GstPadTemplate *pad_template;
   230 
   230 
   231   g_return_if_fail (GST_IS_AUDIO_FILTER_CLASS (klass));
   231   g_return_if_fail (GST_IS_AUDIO_FILTER_CLASS (klass));
   232   g_return_if_fail (allowed_caps != NULL);
   232   g_return_if_fail (allowed_caps != NULL);
   233   g_return_if_fail (GST_IS_CAPS (allowed_caps));
   233   g_return_if_fail (GST_IS_CAPS (allowed_caps));
   234 
   234 
   235   gst_element_class_add_pad_template (element_class,
   235   pad_template = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
   236       gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
   236       gst_caps_copy (allowed_caps));
   237           gst_caps_copy (allowed_caps)));
   237   gst_element_class_add_pad_template (element_class, pad_template);
   238 
   238   gst_object_unref (pad_template);
   239   gst_element_class_add_pad_template (element_class,
   239 
   240       gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
   240   pad_template = gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
   241           gst_caps_copy (allowed_caps)));
   241       gst_caps_copy (allowed_caps));
   242 }
   242   gst_element_class_add_pad_template (element_class, pad_template);
       
   243   gst_object_unref (pad_template);
       
   244 }