changeset 32753:9981c24b59bd

Use color type getter instead of direct access to private member. Using the getter is mandatory since recent libpng 1.5 release. Patch by Gianluigi Tiesi (mplayer - netfarm it)
author cboesch
date Tue, 01 Feb 2011 20:45:41 +0000
parents 5c39b0060c2c
children 08deb5816d9c
files libmpcodecs/vd_mpng.c
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vd_mpng.c	Tue Feb 01 19:22:43 2011 +0000
+++ b/libmpcodecs/vd_mpng.c	Tue Feb 01 20:45:41 2011 +0000
@@ -74,7 +74,7 @@
 
 static void pngReadFN( png_structp pngstr,png_bytep buffer,png_size_t size )
 {
- char * p = pngstr->io_ptr;
+ char * p = png_get_io_ptr(pngstr);
  if(size>pngLength-pngPointer && pngLength>=pngPointer) size=pngLength-pngPointer;
  fast_memcpy( buffer,(char *)&p[pngPointer],size );
  pngPointer+=size;
@@ -90,6 +90,7 @@
     png_uint_32     png_width=0,png_height=0;
     int             depth,color;
     png_uint_32     i;
+    png_byte        color_type;
     mp_image_t* mpi;
 
     int cols;
@@ -111,7 +112,9 @@
  png_get_IHDR( png,info,&png_width,&png_height,&depth,&color,NULL,NULL,NULL );
  png_set_bgr( png );
 
- switch( info->color_type ) {
+ color_type=png_get_color_type(png, info);
+
+ switch( color_type ) {
    case PNG_COLOR_TYPE_GRAY_ALPHA:
       mp_msg( MSGT_DECVIDEO,MSGL_INFO,"Sorry gray scaled png with alpha channel not supported at moment.\n" );
       break;
@@ -128,7 +131,7 @@
       out_fmt=IMGFMT_BGR24;
       break;
    default:
-      mp_msg( MSGT_DECVIDEO,MSGL_INFO,"Sorry, unsupported PNG colorspace: %d.\n" ,info->color_type);
+      mp_msg( MSGT_DECVIDEO,MSGL_INFO,"Sorry, unsupported PNG colorspace: %d.\n" ,color_type);
  }
 
  // (re)init libvo if image parameters changed (width/height/colorspace)