basetransform: fix reconfigure methods

Rename gst_base_transform_suggest to gst_base_transform_reconfigure_sink because
that is what it does. Also remove the caps and size because that is not needed.
Rename gst_base_transform_reconfigure to gst_base_transform_reconfigure_src.
Remove some old unused code in capsfilter.
This commit is contained in:
Wim Taymans 2012-02-24 11:00:21 +01:00
parent 6b22a63f1b
commit beea57dca7
4 changed files with 13 additions and 70 deletions

View file

@ -2415,19 +2415,15 @@ gst_base_transform_set_gap_aware (GstBaseTransform * trans, gboolean gap_aware)
}
/**
* gst_base_transform_suggest:
* gst_base_transform_reconfigure_sink:
* @trans: a #GstBaseTransform
* @caps: (transfer none): caps to suggest
* @size: buffer size to suggest
*
* Instructs @trans to suggest new @caps upstream. A copy of @caps will be
* taken.
*
* Since: 0.10.21
* Instructs @trans to request renegotiation upstream. This function is
* typically called after properties on the transform were set that
* influence the input format.
*/
void
gst_base_transform_suggest (GstBaseTransform * trans, GstCaps * caps,
gsize size)
gst_base_transform_reconfigure_sink (GstBaseTransform * trans)
{
g_return_if_fail (GST_IS_BASE_TRANSFORM (trans));
@ -2438,7 +2434,7 @@ gst_base_transform_suggest (GstBaseTransform * trans, GstCaps * caps,
}
/**
* gst_base_transform_reconfigure:
* gst_base_transform_reconfigure_src:
* @trans: a #GstBaseTransform
*
* Instructs @trans to renegotiate a new downstream transform on the next
@ -2448,7 +2444,7 @@ gst_base_transform_suggest (GstBaseTransform * trans, GstCaps * caps,
* Since: 0.10.21
*/
void
gst_base_transform_reconfigure (GstBaseTransform * trans)
gst_base_transform_reconfigure_src (GstBaseTransform * trans)
{
g_return_if_fail (GST_IS_BASE_TRANSFORM (trans));

View file

@ -277,9 +277,8 @@ gboolean gst_base_transform_is_qos_enabled (GstBaseTransform *trans);
void gst_base_transform_set_gap_aware (GstBaseTransform *trans,
gboolean gap_aware);
void gst_base_transform_suggest (GstBaseTransform *trans,
GstCaps *caps, gsize size);
void gst_base_transform_reconfigure (GstBaseTransform *trans);
void gst_base_transform_reconfigure_sink (GstBaseTransform *trans);
void gst_base_transform_reconfigure_src (GstBaseTransform *trans);
G_END_DECLS
#endif /* __GST_BASE_TRANSFORM_H__ */

View file

@ -131,14 +131,6 @@ gst_capsfilter_init (GstCapsFilter * filter)
filter->filter_caps = gst_caps_new_any ();
}
static gboolean
copy_func (GQuark field_id, const GValue * value, GstStructure * dest)
{
gst_structure_id_set_value (dest, field_id, value);
return TRUE;
}
static void
gst_capsfilter_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
@ -148,7 +140,7 @@ gst_capsfilter_set_property (GObject * object, guint prop_id,
switch (prop_id) {
case PROP_FILTER_CAPS:{
GstCaps *new_caps;
GstCaps *old_caps, *suggest, *nego;
GstCaps *old_caps;
const GstCaps *new_caps_val = gst_value_get_caps (value);
if (new_caps_val == NULL) {
@ -167,51 +159,7 @@ gst_capsfilter_set_property (GObject * object, guint prop_id,
GST_DEBUG_OBJECT (capsfilter, "set new caps %" GST_PTR_FORMAT, new_caps);
/* filter the currently negotiated format against the new caps */
nego = gst_pad_get_current_caps (GST_BASE_TRANSFORM_SINK_PAD (object));
if (nego) {
GST_DEBUG_OBJECT (capsfilter, "we had negotiated caps %" GST_PTR_FORMAT,
nego);
if (G_UNLIKELY (gst_caps_is_any (new_caps))) {
GST_DEBUG_OBJECT (capsfilter, "not settings any suggestion");
suggest = NULL;
} else {
GstStructure *s1, *s2;
/* first check if the name is the same */
s1 = gst_caps_get_structure (nego, 0);
s2 = gst_caps_get_structure (new_caps, 0);
if (gst_structure_get_name_id (s1) == gst_structure_get_name_id (s2)) {
/* same name, copy all fields from the new caps into the previously
* negotiated caps */
suggest = gst_caps_copy (nego);
s1 = gst_caps_get_structure (suggest, 0);
gst_structure_foreach (s2, (GstStructureForeachFunc) copy_func, s1);
GST_DEBUG_OBJECT (capsfilter, "copied structure fields");
} else {
GST_DEBUG_OBJECT (capsfilter, "different structure names");
/* different names, we can only suggest the complete caps */
suggest = gst_caps_copy (new_caps);
}
}
gst_caps_unref (nego);
} else {
GST_DEBUG_OBJECT (capsfilter, "no negotiated caps");
/* 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_DEBUG_OBJECT (capsfilter, "suggesting new caps %" GST_PTR_FORMAT,
suggest);
gst_base_transform_suggest (GST_BASE_TRANSFORM (object), suggest, 0);
if (suggest)
gst_caps_unref (suggest);
gst_base_transform_reconfigure_sink (GST_BASE_TRANSFORM (object));
break;
}
default:

View file

@ -80,12 +80,12 @@ EXPORTS
gst_base_transform_is_in_place
gst_base_transform_is_passthrough
gst_base_transform_is_qos_enabled
gst_base_transform_reconfigure
gst_base_transform_reconfigure_sink
gst_base_transform_reconfigure_src
gst_base_transform_set_gap_aware
gst_base_transform_set_in_place
gst_base_transform_set_passthrough
gst_base_transform_set_qos_enabled
gst_base_transform_suggest
gst_base_transform_update_qos
gst_bit_reader_free
gst_bit_reader_get_bits_uint16