diff options
author | Julien Moutte <julien@moutte.net> | 2005-10-17 17:18:56 +0000 |
---|---|---|
committer | Julien Moutte <julien@moutte.net> | 2005-10-17 17:18:56 +0000 |
commit | 1adfcec29861808c9cfd21ecdc8f33efddafbf6e (patch) | |
tree | 1f5e2a4232d057099df42ad495aca0ad7f41034d /gst/alpha | |
parent | 22060a915c7403238946667852514ada1f80a123 (diff) |
gst/alpha/gstalphacolor.c: Handle caps negotiation in a better way.
Original commit message from CVS:
2005-10-17 Julien MOUTTE <julien@moutte.net>
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Handle caps negotiation in a
better
way.
Diffstat (limited to 'gst/alpha')
-rw-r--r-- | gst/alpha/gstalphacolor.c | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/gst/alpha/gstalphacolor.c b/gst/alpha/gstalphacolor.c index 0267c824..96c0b433 100644 --- a/gst/alpha/gstalphacolor.c +++ b/gst/alpha/gstalphacolor.c @@ -138,18 +138,32 @@ static GstCaps * gst_alpha_color_transform_caps (GstBaseTransform * btrans, GstPadDirection direction, GstCaps * caps) { - GstAlphaColor *alpha; - GstCaps *result; + GstAlphaColor *alpha = NULL; + GstCaps *result = NULL; alpha = GST_ALPHA_COLOR (btrans); - GST_DEBUG ("transforming direction %d caps %s", direction, - gst_caps_to_string (caps)); - result = gst_caps_new_simple ("video/x-raw-yuv", - "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('A', 'Y', 'U', 'V'), - "width", GST_TYPE_INT_RANGE, 16, 4096, - "height", GST_TYPE_INT_RANGE, 16, 4096, - "framerate", GST_TYPE_DOUBLE_RANGE, 0.0, G_MAXDOUBLE, NULL); + if (gst_caps_is_fixed (caps)) { + GstStructure *structure = NULL; + gint width, height; + gdouble fps; + + structure = gst_caps_get_structure (caps, 0); + gst_structure_get_int (structure, "width", &width); + gst_structure_get_int (structure, "height", &height); + gst_structure_get_double (structure, "framerate", &fps); + + result = gst_caps_new_simple ("video/x-raw-yuv", + "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('A', 'Y', 'U', 'V'), + "width", G_TYPE_INT, width, + "height", G_TYPE_INT, height, "framerate", G_TYPE_DOUBLE, fps, NULL); + } else { + result = gst_caps_new_simple ("video/x-raw-yuv", + "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('A', 'Y', 'U', 'V'), + "width", GST_TYPE_INT_RANGE, 1, G_MAXINT, + "height", GST_TYPE_INT_RANGE, 1, G_MAXINT, + "framerate", GST_TYPE_DOUBLE_RANGE, 0.0, G_MAXDOUBLE, NULL); + } return result; } |