[379/906] gloverlay: add support to use RGB png images

Previously restricted to RGBA, now gloverlay can also handle a RGB image.
This commit is contained in:
Anthony Violo 2009-09-21 10:51:47 +02:00 committed by Matthew Waters
parent 30631c4626
commit 5943045bf6

View file

@ -393,6 +393,7 @@ gst_gl_overlay_loader (GstGLFilter * filter)
png_FILE_p fp = NULL; png_FILE_p fp = NULL;
guint y = 0; guint y = 0;
guchar **rows = NULL; guchar **rows = NULL;
gint filler;
if (!filter->display) if (!filter->display)
return TRUE; return TRUE;
@ -425,6 +426,12 @@ gst_gl_overlay_loader (GstGLFilter * filter)
png_get_IHDR (png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, png_get_IHDR (png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
&interlace_type, int_p_NULL, int_p_NULL); &interlace_type, int_p_NULL, int_p_NULL);
if (color_type == PNG_COLOR_TYPE_RGB) {
filler = 0xff;
png_set_filler (png_ptr, filler, PNG_FILLER_AFTER);
color_type = PNG_COLOR_TYPE_RGB_ALPHA;
}
if (color_type != PNG_COLOR_TYPE_RGB_ALPHA) { if (color_type != PNG_COLOR_TYPE_RGB_ALPHA) {
fclose (fp); fclose (fp);
png_destroy_read_struct (&png_ptr, png_infopp_NULL, png_infopp_NULL); png_destroy_read_struct (&png_ptr, png_infopp_NULL, png_infopp_NULL);