mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 22:36:33 +00:00
ext/libpng/gstpngdec.c: Temporary hack to get correct colors order when we have a png image with alpha channel.
Original commit message from CVS: 2005-10-25 Julien MOUTTE <julien@moutte.net> * ext/libpng/gstpngdec.c: (user_info_callback), (gst_pngdec_caps_create_and_set), (gst_pngdec_task): Temporary hack to get correct colors order when we have a png image with alpha channel.
This commit is contained in:
parent
ecc3125b27
commit
cc0c33355e
2 changed files with 24 additions and 3 deletions
|
@ -1,3 +1,10 @@
|
|||
2005-10-25 Julien MOUTTE <julien@moutte.net>
|
||||
|
||||
* ext/libpng/gstpngdec.c: (user_info_callback),
|
||||
(gst_pngdec_caps_create_and_set), (gst_pngdec_task): Temporary
|
||||
hack to get correct colors order when we have a png image with
|
||||
alpha channel.
|
||||
|
||||
2005-10-24 Edward Hervey <edward@fluendo.com>
|
||||
|
||||
* ext/dv/gstdvdemux.c: (gst_dvdemux_add_pads):
|
||||
|
|
|
@ -175,7 +175,7 @@ user_info_callback (png_structp png_ptr, png_infop info)
|
|||
{
|
||||
GstPngDec *pngdec = NULL;
|
||||
GstFlowReturn ret = GST_FLOW_OK;
|
||||
gint bpc = 0;
|
||||
gint bpc = 0, color_type;
|
||||
png_uint_32 width, height;
|
||||
size_t buffer_size;
|
||||
GstBuffer *buffer = NULL;
|
||||
|
@ -193,6 +193,13 @@ user_info_callback (png_structp png_ptr, png_infop info)
|
|||
png_set_strip_16 (pngdec->png);
|
||||
}
|
||||
|
||||
/* Get Color type */
|
||||
color_type = png_get_color_type (pngdec->png, pngdec->info);
|
||||
|
||||
/* HACK: The doc states that it's RGBA but apparently it's not... */
|
||||
if (color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||
png_set_bgr (pngdec->png);
|
||||
|
||||
/* Update the info structure */
|
||||
png_read_update_info (pngdec->png, pngdec->info);
|
||||
|
||||
|
@ -340,7 +347,7 @@ gst_pngdec_caps_create_and_set (GstPngDec * pngdec)
|
|||
ret = GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
GST_LOG ("our caps %s", gst_caps_to_string (res));
|
||||
GST_DEBUG_OBJECT (pngdec, "our caps %" GST_PTR_FORMAT, res);
|
||||
|
||||
gst_caps_unref (res);
|
||||
|
||||
|
@ -354,7 +361,7 @@ gst_pngdec_task (GstPad * pad)
|
|||
GstPngDec *pngdec;
|
||||
GstBuffer *buffer = NULL;
|
||||
size_t buffer_size = 0;
|
||||
gint i = 0, bpc = 0;
|
||||
gint i = 0, bpc = 0, color_type;
|
||||
png_bytep *rows, inp;
|
||||
png_uint_32 width, height, rowbytes;
|
||||
GstFlowReturn ret = GST_FLOW_OK;
|
||||
|
@ -382,6 +389,13 @@ gst_pngdec_task (GstPad * pad)
|
|||
png_set_strip_16 (pngdec->png);
|
||||
}
|
||||
|
||||
/* Get Color type */
|
||||
color_type = png_get_color_type (pngdec->png, pngdec->info);
|
||||
|
||||
/* HACK: The doc states that it's RGBA but apparently it's not... */
|
||||
if (color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||
png_set_bgr (pngdec->png);
|
||||
|
||||
/* Update the info structure */
|
||||
png_read_update_info (pngdec->png, pngdec->info);
|
||||
|
||||
|
|
Loading…
Reference in a new issue