/* * video_out_pgm.c, pgm interface * * * Copyright (C) 1996, MPEG Software Simulation Group. All Rights Reserved. * * Hacked into mpeg2dec by * * Aaron Holtzman * * 15 & 16 bpp support added by Franck Sicard * * Xv image suuport by Gerd Knorr */ #include #include #include #include #include "config.h" #include "video_out.h" #include "video_out_internal.h" static vo_info_t info = { "PGM file", "pgm", "walken", "" }; LIBVO_EXTERN (pgm) static int image_width; static int image_height; static char header[1024]; static int framenum = 0; static uint8_t *image=NULL; char vo_pgm_filename[24]; 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=malloc(width*height*3/2); snprintf (header, 1024, "P5\n\n%d %d\n255\n", width, height*3/2); return 0; } static void draw_osd(void) { } static void flip_page (void) { FILE * f; snprintf (vo_pgm_filename, 24, "%08d.pgm", framenum++); f = fopen (vo_pgm_filename, "wb"); if (f == NULL) return; fwrite (header, strlen (header), 1, f); fwrite (image, image_width, image_height*3/2, f); fclose (f); return; } static uint32_t draw_slice(uint8_t *srcimg[], int stride[], int w,int h,int x,int y) { int i; // copy Y: uint8_t *dst=image+image_width*y+x; uint8_t *src=srcimg[0]; for(i=0;i