mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 00:36:51 +00:00
element-templates: Add helper code to transform_caps
This commit is contained in:
parent
8552396c36
commit
12a4ff1100
1 changed files with 23 additions and 1 deletions
|
@ -79,10 +79,32 @@ gst_replace_transform_caps (GstBaseTransform * trans, GstPadDirection direction,
|
|||
GstCaps * caps, GstCaps * filter)
|
||||
{
|
||||
GstReplace *replace = GST_REPLACE (trans);
|
||||
GstCaps *othercaps;
|
||||
|
||||
GST_DEBUG_OBJECT (replace, "transform_caps");
|
||||
|
||||
return NULL;
|
||||
othercaps = gst_caps_copy (caps);
|
||||
|
||||
/* Copy other caps and modify as appropriate */
|
||||
/* This works for the simplest cases, where the transform modifies one
|
||||
* or more fields in the caps structure. It does not work correctly
|
||||
* if passthrough caps are preferred. */
|
||||
if (direction == GST_PAD_SRC) {
|
||||
/* transform caps going upstream */
|
||||
} else {
|
||||
/* transform caps going downstream */
|
||||
}
|
||||
|
||||
if (filter) {
|
||||
GstCaps *intersect;
|
||||
|
||||
intersect = gst_caps_intersect (othercaps, filter);
|
||||
gst_caps_unref (othercaps);
|
||||
|
||||
return intersect;
|
||||
} else {
|
||||
return othercaps;
|
||||
}
|
||||
}
|
||||
|
||||
static GstCaps *
|
||||
|
|
Loading…
Reference in a new issue