diff options
author | Julien Moutte <julien@moutte.net> | 2005-10-18 22:44:11 +0000 |
---|---|---|
committer | Julien Moutte <julien@moutte.net> | 2005-10-18 22:44:11 +0000 |
commit | 1d531d5b24320126d6167dfc5830490e460431a7 (patch) | |
tree | 708a04b73a80118679ebfeef55cd70252d1eb73e /gst/alpha/gstalphacolor.c | |
parent | 66413b5f00cdac64f6b7de66e085e2523b5a36c0 (diff) |
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
Diffstat (limited to 'gst/alpha/gstalphacolor.c')
-rw-r--r-- | gst/alpha/gstalphacolor.c | 60 |
1 files changed, 39 insertions, 21 deletions
diff --git a/gst/alpha/gstalphacolor.c b/gst/alpha/gstalphacolor.c index 96c0b433..54456291 100644 --- a/gst/alpha/gstalphacolor.c +++ b/gst/alpha/gstalphacolor.c @@ -139,32 +139,50 @@ gst_alpha_color_transform_caps (GstBaseTransform * btrans, GstPadDirection direction, GstCaps * caps) { GstAlphaColor *alpha = NULL; - GstCaps *result = NULL; + GstCaps *result = NULL, *local_caps = NULL; + GstPadTemplate *tmpl = NULL; + guint i; alpha = GST_ALPHA_COLOR (btrans); - 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); + local_caps = gst_caps_copy (caps); + + for (i = 0; i < gst_caps_get_size (local_caps); i++) { + GstStructure *structure = gst_caps_get_structure (local_caps, i); + + /* Throw away the structure name and set it to transformed format */ + if (direction == GST_PAD_SINK) { + gst_structure_set_name (structure, "video/x-raw-yuv"); + } else if (direction == GST_PAD_SRC) { + gst_structure_set_name (structure, "video/x-raw-rgb"); + } + /* Remove any specific parameter from the structure */ + gst_structure_remove_field (structure, "format"); + gst_structure_remove_field (structure, "endianness"); + gst_structure_remove_field (structure, "depth"); + gst_structure_remove_field (structure, "bpp"); + gst_structure_remove_field (structure, "red_mask"); + gst_structure_remove_field (structure, "green_mask"); + gst_structure_remove_field (structure, "blue_mask"); + gst_structure_remove_field (structure, "alpha_mask"); } + /* Get the appropriate template */ + if (direction == GST_PAD_SINK) { + tmpl = gst_static_pad_template_get (&gst_alpha_color_src_template); + } else if (direction == GST_PAD_SRC) { + tmpl = gst_static_pad_template_get (&gst_alpha_color_sink_template); + } + + /* Intersect with our template caps */ + result = gst_caps_intersect (local_caps, gst_pad_template_get_caps (tmpl)); + + gst_caps_unref (local_caps); + gst_caps_do_simplify (result); + + GST_LOG ("transformed %s to %s", gst_caps_to_string (caps), + gst_caps_to_string (result)); + return result; } |