diff options
Diffstat (limited to 'libvo/vo_png.c')
-rw-r--r-- | libvo/vo_png.c | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/libvo/vo_png.c b/libvo/vo_png.c index 41dcdc3290..7b2fe72540 100644 --- a/libvo/vo_png.c +++ b/libvo/vo_png.c @@ -14,6 +14,7 @@ #include <png.h> +#include "mp_msg.h" #include "config.h" #include "video_out.h" #include "video_out_internal.h" @@ -29,7 +30,6 @@ static vo_info_t info = LIBVO_EXTERN (png) -extern int verbose; int z_compression = Z_NO_COMPRESSION; static int framenum = 0; @@ -50,7 +50,8 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin printf("PNG Info: (0 = no compression, 1 = fastest, lowest - 9 best, slowest compression)\n"); } - if(verbose) printf("PNG Compression level %i\n", z_compression); + if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) { + printf("PNG Compression level %i\n", z_compression); } return 0; } @@ -70,13 +71,15 @@ struct pngdata create_png (char * fname, int image_width, int image_height, int png.info_ptr = png_create_info_struct(png.png_ptr); if (!png.png_ptr) { - if(verbose > 1) printf("PNG Failed to init png pointer\n"); + if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) { + printf("PNG Failed to init png pointer\n"); } png.status = ERROR; return png; } if (!png.info_ptr) { - if(verbose > 1) printf("PNG Failed to init png infopointer\n"); + if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) { + printf("PNG Failed to init png infopointer\n"); } png_destroy_write_struct(&png.png_ptr, (png_infopp)NULL); png.status = ERROR; @@ -84,7 +87,8 @@ struct pngdata create_png (char * fname, int image_width, int image_height, int } if (setjmp(png.png_ptr->jmpbuf)) { - if(verbose > 1) printf("PNG Internal error!\n"); + if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) { + printf("PNG Internal error!\n");} png_destroy_write_struct(&png.png_ptr, &png.info_ptr); fclose(png.fp); png.status = ERROR; @@ -98,7 +102,8 @@ struct pngdata create_png (char * fname, int image_width, int image_height, int return png; } - if(verbose > 1) printf("PNG Init IO\n"); + if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) { + printf("PNG Init IO\n"); } png_init_io(png.png_ptr, png.fp); /* set the zlib compression level */ @@ -112,11 +117,13 @@ struct pngdata create_png (char * fname, int image_width, int image_height, int 8, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); - if(verbose > 1) printf("PNG Write Info\n"); + if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) { + printf("PNG Write Info\n"); } png_write_info(png.png_ptr, png.info_ptr); if(swapped) { - if(verbose > 1) printf("PNG Set BGR Conversion\n"); + if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) { + printf("PNG Set BGR Conversion\n"); } png_set_bgr(png.png_ptr); } @@ -126,10 +133,12 @@ struct pngdata create_png (char * fname, int image_width, int image_height, int static uint8_t destroy_png(struct pngdata png) { - if(verbose > 1) printf("PNG Write End\n"); + if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) { + printf("PNG Write End\n"); } png_write_end(png.png_ptr, png.info_ptr); - if(verbose > 1) printf("PNG Destroy Write Struct\n"); + if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) { + printf("PNG Destroy Write Struct\n"); } png_destroy_write_struct(&png.png_ptr, &png.info_ptr); fclose (png.fp); @@ -155,14 +164,16 @@ static uint32_t draw_image(mp_image_t* mpi){ return 1; } - if(verbose > 1) printf("PNG Creating Row Pointers\n"); + if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) { + printf("PNG Creating Row Pointers\n"); } for ( k = 0; k < mpi->h; k++ ) row_pointers[k] = mpi->planes[0]+mpi->stride[0]*k; //png_write_flush(png.png_ptr); //png_set_flush(png.png_ptr, nrows); - if(verbose > 1) printf("PNG Writing Image Data\n"); + if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) { + printf("PNG Writing Image Data\n"); } png_write_image(png.png_ptr, row_pointers); destroy_png(png); |