basetransform: Add a method to let subclasses cleanly update srcpad caps

API:
    gst_base_transform_update_src

https://bugzilla.gnome.org/show_bug.cgi?id=734424
This commit is contained in:
Thibault Saunier 2015-02-20 17:50:48 +01:00 committed by Nicolas Dufresne
parent 5bed94924a
commit 506afa54df
3 changed files with 33 additions and 0 deletions

View file

@ -361,6 +361,7 @@ gst_base_transform_get_allocator
gst_base_transform_get_buffer_pool
gst_base_transform_reconfigure_sink
gst_base_transform_reconfigure_src
gst_base_transform_update_src
GST_BASE_TRANSFORM_SINK_NAME
GST_BASE_TRANSFORM_SRC_NAME

View file

@ -2786,3 +2786,33 @@ gst_base_transform_get_allocator (GstBaseTransform * trans,
if (params)
*params = trans->priv->params;
}
/**
* gst_base_transform_update_src_caps:
* @trans: a #GstBaseTransform
* @updated_caps: An updated version of the srcpad caps to be pushed
* downstream
*
* Updates the srcpad caps and send the caps downstream. This function
* can be used by subclasses when they have already negotiated their caps
* but found a change in them (or computed new informations). This way,
* they can notify downstream about that change without loosing any
* buffer.
*
* Returns: %TRUE if the caps could be send downstream %FALSE otherwise
*/
gboolean
gst_base_transform_update_src_caps (GstBaseTransform * trans,
GstCaps * updated_caps)
{
g_return_val_if_fail (GST_IS_BASE_TRANSFORM (trans), FALSE);
if (gst_pad_push_event (GST_BASE_TRANSFORM_SRC_PAD (trans),
gst_event_new_caps (updated_caps))) {
gst_pad_mark_reconfigure (trans->srcpad);
return TRUE;
}
return FALSE;
}

View file

@ -293,6 +293,8 @@ void gst_base_transform_get_allocator (GstBaseTransform *trans,
void gst_base_transform_reconfigure_sink (GstBaseTransform *trans);
void gst_base_transform_reconfigure_src (GstBaseTransform *trans);
gboolean gst_base_transform_update_src_caps (GstBaseTransform *trans,
GstCaps *updated_caps);
G_END_DECLS
#endif /* __GST_BASE_TRANSFORM_H__ */