diff --git a/ChangeLog b/ChangeLog index 83c04b67af..9b40a9db14 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-10-25 Julien MOUTTE + + * 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 * ext/dv/gstdvdemux.c: (gst_dvdemux_add_pads): diff --git a/ext/libpng/gstpngdec.c b/ext/libpng/gstpngdec.c index aa537a3ffa..35515723d7 100644 --- a/ext/libpng/gstpngdec.c +++ b/ext/libpng/gstpngdec.c @@ -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);