Mercurial > mplayer.hg
comparison libvo/vo_pgm.c @ 1:3b5f5d1c5041
Initial revision
author | arpi_esp |
---|---|
date | Sat, 24 Feb 2001 20:28:24 +0000 |
parents | |
children | 2184c8945d42 |
comparison
equal
deleted
inserted
replaced
0:c1bb2c071d63 | 1:3b5f5d1c5041 |
---|---|
1 #define DISP | |
2 | |
3 /* | |
4 * video_out_pgm.c, pgm interface | |
5 * | |
6 * | |
7 * Copyright (C) 1996, MPEG Software Simulation Group. All Rights Reserved. | |
8 * | |
9 * Hacked into mpeg2dec by | |
10 * | |
11 * Aaron Holtzman <aholtzma@ess.engr.uvic.ca> | |
12 * | |
13 * 15 & 16 bpp support added by Franck Sicard <Franck.Sicard@solsoft.fr> | |
14 * | |
15 * Xv image suuport by Gerd Knorr <kraxel@goldbach.in-berlin.de> | |
16 */ | |
17 | |
18 #include <stdio.h> | |
19 #include <stdlib.h> | |
20 #include <string.h> | |
21 | |
22 #include "config.h" | |
23 #include "video_out.h" | |
24 #include "video_out_internal.h" | |
25 | |
26 LIBVO_EXTERN (pgm) | |
27 | |
28 static vo_info_t vo_info = | |
29 { | |
30 "PGM file", | |
31 "pgm", | |
32 "walken", | |
33 "" | |
34 }; | |
35 | |
36 static int image_width; | |
37 static int image_height; | |
38 static char header[1024]; | |
39 static int framenum = -2; | |
40 | |
41 static uint32_t | |
42 init(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format) | |
43 { | |
44 image_height = height; | |
45 image_width = width; | |
46 | |
47 sprintf (header, "P5\n\n%d %d\n255\n", width, height*3/2); | |
48 | |
49 return 0; | |
50 } | |
51 | |
52 static const vo_info_t* | |
53 get_info(void) | |
54 { | |
55 return &vo_info; | |
56 } | |
57 | |
58 static void flip_page (void) | |
59 { | |
60 } | |
61 | |
62 static uint32_t draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y) | |
63 //static uint32_t draw_slice(uint8_t * src[], uint32_t slice_num) | |
64 { | |
65 return 0; | |
66 } | |
67 | |
68 uint32_t output_pgm_frame (char * fname, uint8_t * src[]) | |
69 { | |
70 FILE * f; | |
71 int i; | |
72 | |
73 f = fopen (fname, "wb"); | |
74 if (f == NULL) return 1; | |
75 fwrite (header, strlen (header), 1, f); | |
76 fwrite (src[0], image_width, image_height, f); | |
77 for (i = 0; i < image_height/2; i++) { | |
78 fwrite (src[1]+i*image_width/2, image_width/2, 1, f); | |
79 fwrite (src[2]+i*image_width/2, image_width/2, 1, f); | |
80 } | |
81 fclose (f); | |
82 | |
83 return 0; | |
84 } | |
85 | |
86 static uint32_t draw_frame(uint8_t * src[]) | |
87 { | |
88 char buf[100]; | |
89 | |
90 if (++framenum < 0) | |
91 return 0; | |
92 | |
93 sprintf (buf, "%d.pgm", framenum); | |
94 return output_pgm_frame (buf, src); | |
95 } | |
96 | |
97 static uint32_t | |
98 query_format(uint32_t format) | |
99 { | |
100 switch(format){ | |
101 case IMGFMT_YV12: | |
102 // case IMGFMT_RGB|24: | |
103 // case IMGFMT_BGR|24: | |
104 return 1; | |
105 } | |
106 return 0; | |
107 } | |
108 | |
109 static void | |
110 uninit(void) | |
111 { | |
112 } | |
113 | |
114 | |
115 |