diff options
author | David Schleef <ds@schleef.org> | 2013-04-12 14:07:31 -0700 |
---|---|---|
committer | David Schleef <ds@schleef.org> | 2013-04-12 14:11:09 -0700 |
commit | 12a4ff1100db8e8e27a7890b0791e930c05684bb (patch) | |
tree | ba47e7aabce69fc9ceeb432f3243752c06917be1 /tools | |
parent | 8552396c362c20adb6aa9129a453ff81ecdcf656 (diff) | |
download | gstreamer-plugins-bad-12a4ff1100db8e8e27a7890b0791e930c05684bb.tar.gz |
element-templates: Add helper code to transform_caps
Diffstat (limited to 'tools')
-rw-r--r-- | tools/element-templates/basetransform | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/tools/element-templates/basetransform b/tools/element-templates/basetransform index 24217964d..0be449ca2 100644 --- a/tools/element-templates/basetransform +++ b/tools/element-templates/basetransform @@ -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 * |