Doxygen Source Code Documentation
video_out_pgm.c File Reference
#include "config.h"#include <stdio.h>#include <stdlib.h>#include <string.h>#include <inttypes.h>#include "video_out.h"Go to the source code of this file.
| Data Structures | |
| struct | pgm_instance_t | 
| Functions | |
| void | internal_draw_frame (pgm_instance_t *instance, FILE *file, uint8_t *const *buf) | 
| void | pgm_draw_frame (vo_instance_t *_instance, uint8_t *const *buf, void *id) | 
| int | pgm_setup (vo_instance_t *_instance, int width, int height, vo_setup_result_t *result) | 
| vo_instance_t * | internal_open (void draw(vo_instance_t *, uint8_t *const *, void *)) | 
| vo_instance_t * | vo_pgm_open (void) | 
| void | pgmpipe_draw_frame (vo_instance_t *_instance, uint8_t *const *buf, void *id) | 
| vo_instance_t * | vo_pgmpipe_open (void) | 
| void | md5_draw_frame (vo_instance_t *_instance, uint8_t *const *buf, void *id) | 
| vo_instance_t * | vo_md5_open (void) | 
Function Documentation
| 
 | ||||||||||||||||
| 
 Definition at line 42 of file video_out_pgm.c. References file, pgm_instance_t::header, pgm_instance_t::height, i, uint8_t, and pgm_instance_t::width. Referenced by pgm_draw_frame(), and pgmpipe_draw_frame(). 
 00044 {
00045     int i;
00046 
00047     fwrite (instance->header, strlen (instance->header), 1, file);
00048     fwrite (buf[0], instance->width, instance->height, file);
00049     for (i = 0; i < instance->height >> 1; i++) {
00050         fwrite (buf[1] + i * (instance->width >> 1), instance->width >> 1, 1,
00051                 file);
00052         fwrite (buf[2] + i * (instance->width >> 1), instance->width >> 1, 1,
00053                 file);
00054     }
00055 }
 | 
| 
 | 
| 
 Definition at line 86 of file video_out_pgm.c. References vo_instance_s::close, vo_instance_s::discard, vo_instance_s::draw, pgm_instance_t::framenum, malloc, pgm_setup(), vo_instance_s::set_fbuf, vo_instance_s::setup, vo_instance_s::setup_fbuf, vo_instance_s::start_fbuf, uint8_t, and pgm_instance_t::vo. Referenced by vo_md5_open(), vo_null_open(), vo_nullrgb16_open(), vo_nullrgb32_open(), vo_nullslice_open(), vo_pgm_open(), and vo_pgmpipe_open(). 
 00088 {
00089     pgm_instance_t * instance;
00090 
00091     instance = (pgm_instance_t *) malloc (sizeof (pgm_instance_t));
00092     if (instance == NULL)
00093         return NULL;
00094 
00095     instance->vo.setup = pgm_setup;
00096     instance->vo.setup_fbuf = NULL;
00097     instance->vo.set_fbuf = NULL;
00098     instance->vo.start_fbuf = NULL;
00099     instance->vo.draw = draw;
00100     instance->vo.discard = NULL;
00101     instance->vo.close = NULL;
00102     instance->framenum = 0;
00103 
00104     return (vo_instance_t *) instance;
00105 }
 | 
| 
 | ||||||||||||||||
| 
 Definition at line 126 of file video_out_pgm.c. References pgm_instance_t::filename, pgm_draw_frame(), and uint8_t. Referenced by vo_md5_open(). 
 00128 {
00129     pgm_instance_t * instance;
00130     char command[100];
00131 
00132     instance = (pgm_instance_t *) _instance;
00133     pgm_draw_frame (_instance, buf, id);
00134     sprintf (command, "md5sum -b %s", instance->filename);
00135     system (command);
00136     remove (instance->filename);
00137 }
 | 
| 
 | ||||||||||||||||
| 
 Definition at line 57 of file video_out_pgm.c. References file, pgm_instance_t::filename, pgm_instance_t::framenum, internal_draw_frame(), and uint8_t. Referenced by md5_draw_frame(), and vo_pgm_open(). 
 00059 {
00060     pgm_instance_t * instance;
00061     FILE * file;
00062 
00063     instance = (pgm_instance_t *) _instance;
00064     sprintf (instance->filename, "%d.pgm", instance->framenum++);
00065     file = fopen (instance->filename, "wb");
00066     if (!file)
00067         return;
00068     internal_draw_frame (instance, file, buf);
00069     fclose (file);
00070 }
 | 
| 
 | ||||||||||||||||||||
| 
 Definition at line 72 of file video_out_pgm.c. References vo_setup_result_t::convert, pgm_instance_t::header, pgm_instance_t::height, and pgm_instance_t::width. Referenced by internal_open(). 
 00074 {
00075     pgm_instance_t * instance;
00076 
00077     instance = (pgm_instance_t *) _instance;
00078 
00079     instance->width = width;
00080     instance->height = height;
00081     sprintf (instance->header, "P5\n%d %d\n255\n", width, height * 3 / 2);
00082     result->convert = NULL;
00083     return 0;
00084 }
 | 
| 
 | ||||||||||||||||
| 
 Definition at line 112 of file video_out_pgm.c. References internal_draw_frame(), and uint8_t. Referenced by vo_pgmpipe_open(). 
 00114 {
00115     pgm_instance_t * instance;
00116 
00117     instance = (pgm_instance_t *) _instance;
00118     internal_draw_frame (instance, stdout, buf);
00119 }
 | 
| 
 | 
| 
 Definition at line 139 of file video_out_pgm.c. References internal_open(), and md5_draw_frame(). 
 00140 {
00141     return internal_open (md5_draw_frame);
00142 }
 | 
| 
 | 
| 
 Definition at line 107 of file video_out_pgm.c. References internal_open(), and pgm_draw_frame(). 
 00108 {
00109     return internal_open (pgm_draw_frame);
00110 }
 | 
| 
 | 
| 
 Definition at line 121 of file video_out_pgm.c. References internal_open(), and pgmpipe_draw_frame(). 
 00122 {
00123     return internal_open (pgmpipe_draw_frame);
00124 }
 | 
 
                             
                             
                             
                             
                             
                             
                             
                             
                             
                             
                             
                             
 
 
 
 
       
	   
	   
	   
	  