Merge branch 'master' into 0.11

Conflicts:
	libs/gst/base/gstbasetransform.c
	libs/gst/base/gstbasetransform.h
This commit is contained in:
Wim Taymans 2011-08-26 11:09:07 +02:00
commit 31b70ea701
3 changed files with 40 additions and 10 deletions

View file

@ -324,6 +324,8 @@ static gboolean gst_base_transform_acceptcaps_default (GstBaseTransform * trans,
static gboolean gst_base_transform_setcaps (GstBaseTransform * trans, static gboolean gst_base_transform_setcaps (GstBaseTransform * trans,
GstPad * pad, GstCaps * caps); GstPad * pad, GstCaps * caps);
static gboolean gst_base_transform_query (GstPad * pad, GstQuery * query); 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 const GstQueryType *gst_base_transform_query_type (GstPad * pad);
static GstFlowReturn default_prepare_output_buffer (GstBaseTransform * trans, static GstFlowReturn default_prepare_output_buffer (GstBaseTransform * trans,
@ -378,6 +380,7 @@ gst_base_transform_class_init (GstBaseTransformClass * klass)
klass->prepare_output_buffer = klass->prepare_output_buffer =
GST_DEBUG_FUNCPTR (default_prepare_output_buffer); GST_DEBUG_FUNCPTR (default_prepare_output_buffer);
klass->copy_metadata = GST_DEBUG_FUNCPTR (default_copy_metadata); klass->copy_metadata = GST_DEBUG_FUNCPTR (default_copy_metadata);
klass->query = GST_DEBUG_FUNCPTR (gst_base_transform_default_query);
} }
static void static void
@ -1299,15 +1302,12 @@ failed_configure:
} }
static gboolean static gboolean
gst_base_transform_query (GstPad * pad, GstQuery * query) gst_base_transform_default_query (GstBaseTransform * trans,
GstPad * pad, GstQuery * query)
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
GstBaseTransform *trans;
GstPad *otherpad; GstPad *otherpad;
trans = GST_BASE_TRANSFORM (gst_pad_get_parent (pad));
if (G_UNLIKELY (trans == NULL))
return FALSE;
otherpad = (pad == trans->srcpad) ? trans->sinkpad : trans->srcpad; otherpad = (pad == trans->srcpad) ? trans->sinkpad : trans->srcpad;
switch (GST_QUERY_TYPE (query)) { switch (GST_QUERY_TYPE (query)) {
@ -1361,7 +1361,29 @@ gst_base_transform_query (GstPad * pad, GstQuery * query)
} }
done: 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); gst_object_unref (trans);
return ret; return ret;
} }

View file

@ -156,6 +156,10 @@ struct _GstBaseTransform {
* handled by the element. The default implementation might not be * handled by the element. The default implementation might not be
* the most optimal way to check this in all cases. * the most optimal way to check this in all cases.
* @set_caps: allows the subclass to be notified of the actual caps set. * @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 * @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 * with the given caps, calculate the size in bytes of a buffer
* on the other pad with the given other caps. * on the other pad with the given other caps.
@ -221,6 +225,8 @@ struct _GstBaseTransformClass {
GstCaps *caps); GstCaps *caps);
gboolean (*set_caps) (GstBaseTransform *trans, GstCaps *incaps, gboolean (*set_caps) (GstBaseTransform *trans, GstCaps *incaps,
GstCaps *outcaps); GstCaps *outcaps);
gboolean (*query) (GstBaseTransform *trans, GstPad *pad,
GstQuery *query);
/* setup allocation query for output buffers */ /* setup allocation query for output buffers */
gboolean (*setup_allocation) (GstBaseTransform *trans, GstQuery *query); gboolean (*setup_allocation) (GstBaseTransform *trans, GstQuery *query);
@ -245,7 +251,8 @@ struct _GstBaseTransformClass {
GstFlowReturn (*prepare_output_buffer) (GstBaseTransform * trans, GstFlowReturn (*prepare_output_buffer) (GstBaseTransform * trans,
GstBuffer *input, GstBuffer **outbuf); GstBuffer *input, GstBuffer **outbuf);
gboolean (*copy_metadata) (GstBaseTransform * trans, GstBuffer *input, GstBuffer *outbuf); gboolean (*copy_metadata) (GstBaseTransform * trans, GstBuffer *input,
GstBuffer *outbuf);
void (*before_transform) (GstBaseTransform *trans, GstBuffer *buffer); void (*before_transform) (GstBaseTransform *trans, GstBuffer *buffer);

View file

@ -200,9 +200,10 @@ gst_capsfilter_set_property (GObject * object, guint prop_id,
gst_caps_unref (nego); gst_caps_unref (nego);
} else { } else {
GST_DEBUG_OBJECT (capsfilter, "no negotiated caps"); GST_DEBUG_OBJECT (capsfilter, "no negotiated caps");
/* no previous caps, the getcaps function will be used to find suitable /* Suggest the new caps, we can't just rely on _get_caps as this may
* caps */ * already be called at this point even though no buffer has been
suggest = NULL; * pushed yet */
suggest = gst_caps_copy (new_caps);
} }
GST_DEBUG_OBJECT (capsfilter, "suggesting new caps %" GST_PTR_FORMAT, GST_DEBUG_OBJECT (capsfilter, "suggesting new caps %" GST_PTR_FORMAT,