# HG changeset patch # User arpi # Date 1035648347 0 # Node ID 7d2542838d2403b5aee4d0db4da62dd29b6c2290 # Parent 6e937de686838686e314a8a79ab6746f633e22b8 - removed YV12 support (builtin yv12->rgb conversion) - removed built-in OSD rendering diff -r 6e937de68683 -r 7d2542838d24 libvo/vo_png.c --- a/libvo/vo_png.c Sat Oct 26 15:06:50 2002 +0000 +++ b/libvo/vo_png.c Sat Oct 26 16:05:47 2002 +0000 @@ -1,5 +1,3 @@ -#define DISP - /* * vo_png.c, Portable Network Graphics Renderer for Mplayer * @@ -15,15 +13,10 @@ #include #include -//#include "/usr/include/png.h" - #include "config.h" #include "video_out.h" #include "video_out_internal.h" -#include "sub.h" - -#include "../postproc/rgb2rgb.h" LIBVO_EXTERN (png) @@ -35,18 +28,8 @@ "" }; -#define RGB 0 -#define BGR 1 - extern int verbose; int z_compression = Z_NO_COMPRESSION; -static int image_width; -static int image_height; -static int image_format; -static uint8_t *image_data=NULL; - -static int bpp = 24; -static int cspace = RGB; static int framenum = 0; struct pngdata { @@ -55,39 +38,10 @@ png_infop info_ptr; enum {OK,ERROR} status; }; - -static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){ - vo_draw_alpha_rgb24(w, h, src, srca, stride, image_data + 3 * (y0 * image_width + x0), 3 * image_width); -} static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format) { - image_height = height; - image_width = width; - image_format = format; - //printf("Verbose level is %i\n", verbose); - - switch(format) { - case IMGFMT_BGR24: - bpp = 24; - cspace = BGR; - break; - case IMGFMT_RGB24: - bpp = 24; - cspace = RGB; - break; - case IMGFMT_IYUV: - case IMGFMT_I420: - case IMGFMT_YV12: - bpp = 24; - cspace = BGR; - yuv2rgb_init(bpp,MODE_RGB); - image_data = malloc(image_width*image_height*3); - break; - default: - return 1; - } if((z_compression >= 0) && (z_compression <= 9)) { if(z_compression == 0) { @@ -115,10 +69,10 @@ } -struct pngdata create_png (char * fname) +struct pngdata create_png (char * fname, int image_width, int image_height, int swapped) { struct pngdata png; - + /*png_structp png_ptr = png_create_write_struct (PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr, user_error_fn, user_warning_fn);*/ @@ -174,14 +128,13 @@ if(verbose > 1) printf("PNG Write Info\n"); png_write_info(png.png_ptr, png.info_ptr); - if(cspace) { + if(swapped) { if(verbose > 1) printf("PNG Set BGR Conversion\n"); png_set_bgr(png.png_ptr); } png.status = OK; return png; - } static uint8_t destroy_png(struct pngdata png) { @@ -197,23 +150,18 @@ return 0; } -static uint32_t draw_frame(uint8_t * src[]) -{ - return -1; -} - static uint32_t draw_image(mp_image_t* mpi){ char buf[100]; - int k, bppmul = bpp/8; + int k; struct pngdata png; - png_byte *row_pointers[image_height]; + png_byte *row_pointers[mpi->h]; // if -dr or -slices then do nothing: if(mpi->flags&(MP_IMGFLAG_DIRECT|MP_IMGFLAG_DRAW_CALLBACK)) return VO_TRUE; snprintf (buf, 100, "%08d.png", ++framenum); - png = create_png(buf); + png = create_png(buf, mpi->w, mpi->h, mpi->flags&MP_IMGFLAG_SWAPPED); if(png.status){ printf("PNG Error in create_png\n"); @@ -221,7 +169,7 @@ } if(verbose > 1) printf("PNG Creating Row Pointers\n"); - for ( k = 0; k < image_height; k++ ) + for ( k = 0; k < mpi->h; k++ ) row_pointers[k] = mpi->planes[0]+mpi->stride[0]*k; //png_write_flush(png.png_ptr); @@ -235,56 +183,24 @@ return VO_TRUE; } -static void draw_osd(void) -{ - if(image_data) vo_draw_text(image_width, image_height, draw_alpha); -} +static void draw_osd(void){} -static void flip_page (void) -{ - char buf[100]; - int k, bppmul = bpp/8; - struct pngdata png; - png_byte *row_pointers[image_height]; - - if((image_format == IMGFMT_YV12) || (image_format == IMGFMT_IYUV) || (image_format == IMGFMT_I420)) { - - snprintf (buf, 100, "%08d.png", ++framenum); +static void flip_page (void){} - png = create_png(buf); - - if(png.status){ - printf("PNG Error in create_png\n"); - } - - if(verbose > 1) printf("PNG Creating Row Pointers\n"); - for ( k = 0; k < image_height; k++ ) row_pointers[k] = &image_data[image_width*k*bppmul]; - - //png_write_flush(png.png_ptr); - //png_set_flush(png.png_ptr, nrows); - - if(verbose > 1) printf("PNG Writing Image Data\n"); - png_write_image(png.png_ptr, row_pointers); - - destroy_png(png); - } +static uint32_t draw_frame(uint8_t * src[]) +{ + return -1; } static uint32_t draw_slice( uint8_t *src[],int stride[],int w,int h,int x,int y ) { - uint8_t *dst = image_data + (image_width * y + x) * (bpp/8); - yuv2rgb(dst,src[0],src[1],src[2],w,h,image_width*(bpp/8),stride[0],stride[1]); - return 0; + return -1; } static uint32_t query_format(uint32_t format) { switch(format){ - case IMGFMT_IYUV: - case IMGFMT_I420: - case IMGFMT_YV12: - return VFCAP_CSP_SUPPORTED|VFCAP_OSD|VFCAP_ACCEPT_STRIDE; case IMGFMT_RGB|24: case IMGFMT_BGR|24: return VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW|VFCAP_ACCEPT_STRIDE; @@ -292,16 +208,9 @@ return 0; } -static void -uninit(void) -{ - if(image_data){ free(image_data);image_data=NULL;} -} +static void uninit(void){} - -static void check_events(void) -{ -} +static void check_events(void){} static uint32_t preinit(const char *arg) {