Merge branch 'master' into 0.11
authorWim Taymans <wim.taymans@collabora.co.uk>
Fri, 26 Aug 2011 09:09:07 +0000 (11:09 +0200)
committerWim Taymans <wim.taymans@collabora.co.uk>
Fri, 26 Aug 2011 09:09:07 +0000 (11:09 +0200)
Conflicts:
libs/gst/base/gstbasetransform.c
libs/gst/base/gstbasetransform.h

1  2 
libs/gst/base/gstbasetransform.c
libs/gst/base/gstbasetransform.h
plugins/elements/gstcapsfilter.c

@@@ -321,16 -346,14 +321,18 @@@ static GstCaps *gst_base_transform_getc
  static gboolean gst_base_transform_acceptcaps (GstPad * pad, GstCaps * caps);
  static gboolean gst_base_transform_acceptcaps_default (GstBaseTransform * trans,
      GstPadDirection direction, GstCaps * caps);
 -static gboolean gst_base_transform_setcaps (GstPad * pad, GstCaps * caps);
 -static GstFlowReturn gst_base_transform_buffer_alloc (GstPad * pad,
 -    guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf);
 +static gboolean gst_base_transform_setcaps (GstBaseTransform * trans,
 +    GstPad * pad, GstCaps * caps);
  static gboolean gst_base_transform_query (GstPad * pad, GstQuery * query);
+ static gboolean gst_base_transform_default_query (GstBaseTransform * trans,
+     GstPad * pad, GstQuery * query);
  static const GstQueryType *gst_base_transform_query_type (GstPad * pad);
  
 +static GstFlowReturn default_prepare_output_buffer (GstBaseTransform * trans,
 +    GstBuffer * inbuf, GstBuffer ** outbuf);
 +static gboolean default_copy_metadata (GstBaseTransform * trans,
 +    GstBuffer * inbuf, GstBuffer * outbuf);
 +
  /* static guint gst_base_transform_signals[LAST_SIGNAL] = { 0 }; */
  
  static void
@@@ -375,9 -399,7 +377,10 @@@ gst_base_transform_class_init (GstBaseT
    klass->src_event = GST_DEBUG_FUNCPTR (gst_base_transform_src_eventfunc);
    klass->accept_caps =
        GST_DEBUG_FUNCPTR (gst_base_transform_acceptcaps_default);
 +  klass->prepare_output_buffer =
 +      GST_DEBUG_FUNCPTR (default_prepare_output_buffer);
 +  klass->copy_metadata = GST_DEBUG_FUNCPTR (default_copy_metadata);
+   klass->query = GST_DEBUG_FUNCPTR (gst_base_transform_default_query);
  }
  
  static void
@@@ -1360,8 -1274,29 +1360,30 @@@ gst_base_transform_default_query (GstBa
        break;
    }
  
 +done:
+   return ret;
+ }
+ static gboolean
+ gst_base_transform_query (GstPad * pad, GstQuery * query)
+ {
+   GstBaseTransform *trans;
+   GstBaseTransformClass *bclass;
+   gboolean ret;
+   trans = GST_BASE_TRANSFORM (gst_pad_get_parent (pad));
+   if (G_UNLIKELY (trans == NULL))
+     return FALSE;
+   bclass = GST_BASE_TRANSFORM_GET_CLASS (trans);
+   if (bclass->query)
+     ret = bclass->query (trans, pad, query);
+   else
+     ret = gst_pad_query_default (pad, query);
    gst_object_unref (trans);
    return ret;
  }
  
@@@ -151,11 -149,6 +151,15 @@@ struct _GstBaseTransform 
   *                  element ?
   * @fixate_caps:    Optional. Given the pad in this direction and the given
   *                  caps, fixate the caps on the other pad.
 + * @accept_caps:    Optional. Since 0.10.30
 + *                  Subclasses can override this method to check if @caps can be
 + *                  handled by the element. The default implementation might not be
 + *                  the most optimal way to check this in all cases.
 + * @set_caps:       allows the subclass to be notified of the actual caps set.
++ * @query:          Optional Since 0.10.36
++ *                  Handle a requested query. Subclasses that implement this
++ *                  should must chain up to the parent if they didn't handle the
++ *                  query
   * @transform_size: Optional. Given the size of a buffer in the given direction
   *                  with the given caps, calculate the size in bytes of a buffer
   *                  on the other pad with the given other caps.
@@@ -217,35 -213,35 +221,38 @@@ struct _GstBaseTransformClass 
    void                (*fixate_caps)    (GstBaseTransform *trans,
                                     GstPadDirection direction, GstCaps *caps,
                                     GstCaps *othercaps);
 +  gboolean      (*accept_caps)    (GstBaseTransform *trans, GstPadDirection direction,
 +                                   GstCaps *caps);
 +  gboolean      (*set_caps)       (GstBaseTransform *trans, GstCaps *incaps,
 +                                   GstCaps *outcaps);
++  gboolean      (*query)          (GstBaseTransform *trans, GstPad *pad,
++                                   GstQuery *query);
  
 +  /* setup allocation query for output buffers */
 +  gboolean      (*setup_allocation) (GstBaseTransform *trans, GstQuery *query);
 +
 +  /* transform size */
    gboolean      (*transform_size) (GstBaseTransform *trans,
                                     GstPadDirection direction,
 -                                   GstCaps *caps, guint size,
 -                                   GstCaps *othercaps, guint *othersize);
 +                                   GstCaps *caps, gsize size,
 +                                   GstCaps *othercaps, gsize *othersize);
  
    gboolean      (*get_unit_size)  (GstBaseTransform *trans, GstCaps *caps,
 -                                   guint *size);
 -
 -  gboolean      (*set_caps)     (GstBaseTransform *trans, GstCaps *incaps,
 -                                 GstCaps *outcaps);
 +                                   gsize *size);
  
 +  /* states */
    gboolean      (*start)        (GstBaseTransform *trans);
    gboolean      (*stop)         (GstBaseTransform *trans);
  
 -  gboolean      (*event)        (GstBaseTransform *trans, GstEvent *event);
 -
 -  GstFlowReturn (*transform)    (GstBaseTransform *trans, GstBuffer *inbuf,
 -                                 GstBuffer *outbuf);
 -  GstFlowReturn (*transform_ip) (GstBaseTransform *trans, GstBuffer *buf);
 -
 -  /* FIXME: When adjusting the padding, move these to nicer places in the class */
 -  gboolean       passthrough_on_same_caps;
 +  /* sink and src pad event handlers */
 +  gboolean      (*sink_event)   (GstBaseTransform *trans, GstEvent *event);
 +  gboolean      (*src_event)    (GstBaseTransform *trans, GstEvent *event);
  
    GstFlowReturn (*prepare_output_buffer) (GstBaseTransform * trans,
-      GstBuffer *input, GstBuffer **outbuf);
 -     GstBuffer *input, gint size, GstCaps *caps, GstBuffer **buf);
++                                          GstBuffer *input, GstBuffer **outbuf);
  
-   gboolean      (*copy_metadata) (GstBaseTransform * trans, GstBuffer *input, GstBuffer *outbuf);
 -  /* src event */
 -  gboolean      (*src_event)      (GstBaseTransform *trans, GstEvent *event);
++  gboolean      (*copy_metadata)     (GstBaseTransform * trans, GstBuffer *input,
++                                      GstBuffer *outbuf);
  
    void          (*before_transform)  (GstBaseTransform *trans, GstBuffer *buffer);
  
@@@ -197,13 -202,14 +197,14 @@@ gst_capsfilter_set_property (GObject * 
              suggest = gst_caps_copy (new_caps);
            }
          }
 +        gst_caps_unref (nego);
        } else {
          GST_DEBUG_OBJECT (capsfilter, "no negotiated caps");
-         /* no previous caps, the getcaps function will be used to find suitable
-          * caps */
-         suggest = NULL;
+         /* Suggest the new caps, we can't just rely on _get_caps as this may
+          * already be called at this point even though no buffer has been
+          * pushed yet */
+         suggest = gst_caps_copy (new_caps);
        }
 -      GST_OBJECT_UNLOCK (GST_BASE_TRANSFORM_SINK_PAD (object));
  
        GST_DEBUG_OBJECT (capsfilter, "suggesting new caps %" GST_PTR_FORMAT,
            suggest);