Mercurial > mplayer.hg
annotate libvo/vo_pgm.c @ 4692:f78d2b53aa48
a few quick fixes to the FLI decoder
author | melanson |
---|---|
date | Thu, 14 Feb 2002 03:26:50 +0000 |
parents | c35d7ce151b3 |
children | 32e1f5042f65 |
rev | line source |
---|---|
1 | 1 /* |
2 * video_out_pgm.c, pgm interface | |
3 * | |
4 * | |
5 * Copyright (C) 1996, MPEG Software Simulation Group. All Rights Reserved. | |
6 * | |
7 * Hacked into mpeg2dec by | |
8 * | |
9 * Aaron Holtzman <aholtzma@ess.engr.uvic.ca> | |
10 * | |
11 * 15 & 16 bpp support added by Franck Sicard <Franck.Sicard@solsoft.fr> | |
12 * | |
13 * Xv image suuport by Gerd Knorr <kraxel@goldbach.in-berlin.de> | |
14 */ | |
15 | |
16 #include <stdio.h> | |
17 #include <stdlib.h> | |
18 #include <string.h> | |
19 | |
20 #include "config.h" | |
21 #include "video_out.h" | |
22 #include "video_out_internal.h" | |
23 | |
24 LIBVO_EXTERN (pgm) | |
25 | |
26 static vo_info_t vo_info = | |
27 { | |
28 "PGM file", | |
29 "pgm", | |
30 "walken", | |
31 "" | |
32 }; | |
33 | |
34 static int image_width; | |
35 static int image_height; | |
36 static char header[1024]; | |
491 | 37 static int framenum = 0; |
38 | |
39 static uint8_t *image=NULL; | |
40 | |
41 char vo_pgm_filename[24]; | |
1 | 42 |
43 static uint32_t | |
4433 | 44 config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format,const vo_tune_info_t *info) |
1 | 45 { |
46 image_height = height; | |
47 image_width = width; | |
491 | 48 image=malloc(width*height*3/2); |
1 | 49 |
1094 | 50 snprintf (header, 1024, "P5\n\n%d %d\n255\n", width, height*3/2); |
1 | 51 |
52 return 0; | |
53 } | |
54 | |
55 static const vo_info_t* | |
56 get_info(void) | |
57 { | |
58 return &vo_info; | |
59 } | |
60 | |
1502 | 61 static void draw_osd(void) |
62 { | |
63 } | |
64 | |
1 | 65 static void flip_page (void) |
66 { | |
67 FILE * f; | |
68 | |
1094 | 69 snprintf (vo_pgm_filename, 24, "%08d.pgm", framenum++); |
491 | 70 |
71 f = fopen (vo_pgm_filename, "wb"); if (f == NULL) return; | |
1 | 72 fwrite (header, strlen (header), 1, f); |
491 | 73 fwrite (image, image_width, image_height*3/2, f); |
1 | 74 fclose (f); |
75 | |
491 | 76 return; |
77 } | |
78 | |
79 static uint32_t draw_slice(uint8_t *srcimg[], int stride[], int w,int h,int x,int y) | |
80 { | |
81 int i; | |
82 // copy Y: | |
83 uint8_t *dst=image+image_width*y+x; | |
84 uint8_t *src=srcimg[0]; | |
85 for(i=0;i<h;i++){ | |
86 memcpy(dst,src,w); | |
87 src+=stride[0]; | |
88 dst+=image_width; | |
89 } | |
90 { | |
91 // copy U+V: | |
92 uint8_t *src1=srcimg[1]; | |
93 uint8_t *src2=srcimg[2]; | |
94 uint8_t *dst=image+image_width*image_height+image_width*(y/2)+(x/2); | |
95 for(i=0;i<h/2;i++){ | |
96 memcpy(dst,src1,w/2); | |
97 memcpy(dst+image_width/2,src2,w/2); | |
98 src1+=stride[1]; | |
99 src2+=stride[2]; | |
100 dst+=image_width; | |
101 } | |
102 | |
103 } | |
104 | |
1 | 105 return 0; |
106 } | |
107 | |
491 | 108 |
1 | 109 static uint32_t draw_frame(uint8_t * src[]) |
110 { | |
491 | 111 return 0; |
1 | 112 } |
113 | |
114 static uint32_t | |
115 query_format(uint32_t format) | |
116 { | |
491 | 117 if(format==IMGFMT_YV12) return 1; |
15 | 118 // switch(format){ |
119 // case IMGFMT_YV12: | |
1 | 120 // case IMGFMT_RGB|24: |
121 // case IMGFMT_BGR|24: | |
15 | 122 // return 1; |
123 // } | |
1 | 124 return 0; |
125 } | |
126 | |
127 static void | |
128 uninit(void) | |
129 { | |
491 | 130 if(image){ free(image);image=NULL;} |
1 | 131 } |
132 | |
133 | |
31 | 134 static void check_events(void) |
135 { | |
136 } | |
1 | 137 |
4352 | 138 static uint32_t preinit(const char *arg) |
139 { | |
140 return 0; | |
141 } | |
31 | 142 |
4596 | 143 static uint32_t control(uint32_t request, void *data, ...) |
4352 | 144 { |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4433
diff
changeset
|
145 switch (request) { |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4433
diff
changeset
|
146 case VOCTRL_QUERY_FORMAT: |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4433
diff
changeset
|
147 return query_format(*((uint32_t*)data)); |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4433
diff
changeset
|
148 } |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4433
diff
changeset
|
149 return VO_NOTIMPL; |
4352 | 150 } |