7855
|
1 /* vf_bmovl.c v0.9.1 - BitMap OVerLay videofilter for MPlayer
|
|
2 *
|
|
3 * (C) 2002 Per Wigren <wigren@home.se>
|
|
4 * Licenced under the GNU General Public License
|
|
5 *
|
|
6 * Use MPlayer as a framebuffer to read bitmaps and commands from a FIFO
|
|
7 * and display them in the window.
|
|
8 *
|
7895
|
9 * Commands are:
|
7855
|
10 *
|
7895
|
11 * RGBA32 width height xpos ypos alpha clear
|
|
12 * * Followed by width*height*4 bytes of raw RGBA32 data.
|
|
13 * ABGR32 width height xpos ypos alpha clear
|
|
14 * * Followed by width*height*4 bytes of raw ABGR32 data.
|
|
15 * RGB24 width height xpos ypos alpha clear
|
|
16 * * Followed by width*height*3 bytes of raw RGB32 data.
|
|
17 * BGR24 width height xpos ypos alpha clear
|
|
18 * * Followed by width*height*3 bytes of raw BGR32 data.
|
7855
|
19 *
|
7895
|
20 * ALPHA width height xpos ypos alpha
|
|
21 * * Change alpha for area
|
|
22 * CLEAR width height xpos ypos
|
|
23 * * Clear area
|
|
24 * OPAQUE
|
|
25 * * Disable all alpha transparency!
|
|
26 * Send "ALPHA 0 0 0 0 0" to enable again!
|
|
27 * HIDE
|
|
28 * * Hide bitmap
|
|
29 * SHOW
|
|
30 * * Show bitmap
|
7855
|
31 *
|
|
32 * Arguments are:
|
|
33 * width, height Size of image/area
|
|
34 * xpos, ypos Start blitting at X/Y position
|
|
35 * alpha Set alpha difference. 0 means same as original.
|
|
36 * 255 makes everything opaque
|
|
37 * -255 makes everything transparent
|
|
38 * If you set this to -255 you can then send a sequence of
|
|
39 * ALPHA-commands to set the area to -225, -200, -175 etc
|
|
40 * for a nice fade-in-effect! ;)
|
|
41 * clear Clear the framebuffer before blitting. 1 means clear.
|
|
42 * If 0, the image will just be blitted on top of the old
|
|
43 * one, so you don't need to send 1,8MB of RGBA32 data
|
|
44 * everytime a small part of the screen is updated.
|
|
45 *
|
|
46 * Arguments for the filter are hidden:opaque:fifo
|
|
47 * For example 1:0:/tmp/myfifo.fifo will start the filter hidden, transparent
|
|
48 * and use /tmp/myfifo.fifo as the fifo.
|
|
49 *
|
|
50 * If you find bugs, please send me patches! ;)
|
|
51 *
|
|
52 * This filter was developed for use in Freevo (http://freevo.sf.net), but
|
|
53 * anyone is free to use it! ;)
|
|
54 *
|
|
55 */
|
|
56
|
|
57 #include <stdio.h>
|
|
58 #include <stdlib.h>
|
|
59 #include <string.h>
|
|
60 #include <unistd.h>
|
|
61 #include <errno.h>
|
|
62 #include <sys/stat.h>
|
|
63 #include <sys/types.h>
|
7858
|
64 #include <sys/time.h>
|
7855
|
65 #include <fcntl.h>
|
|
66 #include "mp_image.h"
|
|
67 #include "vf.h"
|
|
68 #include "img_format.h"
|
|
69
|
|
70 #include "../libvo/fastmemcpy.h"
|
|
71
|
|
72 #define IS_RAWIMG 0x100
|
|
73 #define IS_IMG 0x200
|
|
74
|
|
75 #define NONE 0x000
|
|
76 #define IMG_RGBA32 0x101
|
|
77 #define IMG_ABGR32 0x102
|
|
78 #define IMG_RGB24 0x103
|
|
79 #define IMG_BGR24 0x104
|
|
80 #define IMG_PNG 0x201
|
|
81 #define CMD_CLEAR 0x001
|
|
82 #define CMD_ALPHA 0x002
|
|
83
|
|
84 #define TRUE 1
|
|
85 #define FALSE 0
|
|
86
|
|
87 #define MAX(a,b) ((a) > (b) ? (a) : (b))
|
|
88 #define MIN(a,b) ((a) < (b) ? (a) : (b))
|
|
89 #define INRANGE(a,b,c) ( ((a) < (b)) ? (b) : ( ((a) > (c)) ? (c) : (a) ) )
|
|
90
|
|
91 #define rgb2y(R,G,B) ( (0.257 * R) + (0.504 * G) + (0.098 * B) + 16 )
|
|
92 #define rgb2u(R,G,B) ( -(0.148 * R) - (0.291 * G) + (0.439 * B) + 128 )
|
|
93 #define rgb2v(R,G,B) ( (0.439 * R) - (0.368 * G) - (0.071 * B) + 128 )
|
|
94
|
|
95 #define DBG(a) (printf("DEBUG: %d\n", a))
|
|
96
|
|
97 struct vf_priv_s {
|
|
98 int w, h, x1, y1, x2, y2;
|
|
99 struct {
|
|
100 unsigned char *y, *u, *v, *a, *oa;
|
|
101 } bitmap;
|
|
102 int stream_fd;
|
|
103 fd_set stream_fdset;
|
|
104 int opaque, hidden;
|
|
105 };
|
|
106
|
|
107 static int
|
|
108 query_format(struct vf_instance_s* vf, unsigned int fmt){
|
|
109 if(fmt==IMGFMT_YV12) return VFCAP_CSP_SUPPORTED;
|
|
110 return 0;
|
|
111 }
|
|
112
|
|
113
|
|
114 static int
|
|
115 config(struct vf_instance_s* vf,
|
|
116 int width, int height, int d_width, int d_height,
|
|
117 unsigned int flags, unsigned int outfmt)
|
|
118 {
|
|
119 vf->priv->bitmap.y = malloc( width*height );
|
|
120 vf->priv->bitmap.u = malloc( width*height/4 );
|
|
121 vf->priv->bitmap.v = malloc( width*height/4 );
|
|
122 vf->priv->bitmap.a = malloc( width*height );
|
|
123 vf->priv->bitmap.oa = malloc( width*height );
|
|
124 if(!( vf->priv->bitmap.y &&
|
|
125 vf->priv->bitmap.u &&
|
|
126 vf->priv->bitmap.v &&
|
|
127 vf->priv->bitmap.a &&
|
|
128 vf->priv->bitmap.oa )) {
|
|
129 fprintf(stderr, "vf_bmovl: Could not allocate memory for bitmap buffer: %s\n", strerror(errno) );
|
|
130 exit(10);
|
|
131 }
|
|
132
|
|
133 // Set default to black...
|
|
134 memset( vf->priv->bitmap.u, 128, width*height/4 );
|
|
135 memset( vf->priv->bitmap.v, 128, width*height/4 );
|
|
136
|
|
137 vf->priv->w = vf->priv->x1 = width;
|
|
138 vf->priv->h = vf->priv->y1 = height;
|
|
139 vf->priv->y2 = vf->priv->x2 = 0;
|
|
140
|
|
141 return vf_next_config(vf, width, height, d_width, d_height, flags, outfmt);
|
|
142 }
|
|
143
|
|
144 static void
|
|
145 uninit(struct vf_instance_s *vf)
|
|
146 {
|
|
147 if(vf->priv) {
|
|
148 free(vf->priv->bitmap.y);
|
|
149 free(vf->priv->bitmap.u);
|
|
150 free(vf->priv->bitmap.v);
|
|
151 free(vf->priv->bitmap.a);
|
|
152 free(vf->priv->bitmap.oa);
|
|
153 free(vf->priv);
|
|
154 }
|
|
155 }
|
|
156
|
|
157 static int
|
|
158 _read_cmd(int fd, char *cmd, char *args) {
|
|
159 int done=FALSE, pos=0;
|
|
160 char tmp;
|
|
161
|
|
162 while(!done) {
|
|
163 if(! read( fd, &tmp, 1 ) ) return FALSE;
|
|
164 if( (tmp>='A' && tmp<='Z') || (tmp>='0' && tmp<='9') )
|
|
165 cmd[pos]=tmp;
|
|
166 else if(tmp == ' ') {
|
|
167 cmd[pos]='\0';
|
|
168 done=TRUE;
|
|
169 }
|
|
170 else if(tmp == '\n') {
|
|
171 cmd[pos]='\0';
|
|
172 args[0]='\0';
|
|
173 return TRUE;
|
|
174 }
|
|
175 if(pos++>20) {
|
|
176 cmd[0]='\0';
|
|
177 return TRUE;
|
|
178 }
|
|
179 }
|
|
180 done=FALSE; pos=0;
|
|
181 while(!done) {
|
|
182 if(! read( fd, &tmp, 1 ) ) return FALSE;
|
|
183 if( (tmp >= ' ') && (pos<100) ) args[pos]=tmp;
|
|
184 else {
|
|
185 args[pos]='\0';
|
|
186 done=TRUE;
|
|
187 }
|
|
188 pos++;
|
|
189 }
|
|
190 return TRUE;
|
|
191 }
|
|
192
|
|
193
|
|
194 static int
|
|
195 put_image(struct vf_instance_s* vf, mp_image_t* mpi){
|
|
196 int buf_x=0, buf_y=0, buf_pos=0;
|
|
197 int xpos=0, ypos=0, pos=0;
|
|
198 unsigned char red=0, green=0, blue=0;
|
|
199 int alpha;
|
|
200 mp_image_t* dmpi;
|
|
201
|
|
202 dmpi = vf_get_image(vf->next, mpi->imgfmt, MP_IMGTYPE_TEMP,
|
|
203 MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PREFER_ALIGNED_STRIDE,
|
|
204 mpi->w, mpi->h);
|
|
205
|
|
206 memcpy( dmpi->planes[0], mpi->planes[0], mpi->stride[0] * mpi->height);
|
|
207 memcpy( dmpi->planes[1], mpi->planes[1], mpi->stride[1] * mpi->chroma_height);
|
|
208 memcpy( dmpi->planes[2], mpi->planes[2], mpi->stride[2] * mpi->chroma_height);
|
|
209
|
|
210 if(vf->priv->stream_fd >= 0) {
|
|
211 struct timeval tv;
|
|
212
|
|
213 FD_SET( vf->priv->stream_fd, &vf->priv->stream_fdset );
|
|
214 tv.tv_sec=0; tv.tv_usec=0;
|
|
215
|
|
216 if( select( vf->priv->stream_fd+1, &vf->priv->stream_fdset, NULL, NULL, &tv ) > 0) {
|
|
217 // We've got new data from the FIFO
|
|
218
|
|
219 char cmd[20], args[100];
|
|
220 int imgw,imgh,imgx,imgy,clear,imgalpha,pxsz=1,command;
|
|
221 unsigned char *buffer = NULL;
|
|
222
|
|
223 if(! _read_cmd( vf->priv->stream_fd, cmd, args) ) {
|
|
224 fprintf(stderr, "\nvf_bmovl: Error reading commands: %s\n\n", strerror(errno));
|
|
225 exit(10);
|
|
226 }
|
|
227 printf("\nDEBUG: Got: %s+%s\n", cmd, args);
|
|
228
|
|
229 command=NONE;
|
|
230 if ( strncmp(cmd,"RGBA32",6)==0 ) { pxsz=4; command = IMG_RGBA32; }
|
|
231 else if( strncmp(cmd,"ABGR32",6)==0 ) { pxsz=4; command = IMG_ABGR32; }
|
|
232 else if( strncmp(cmd,"RGB24" ,5)==0 ) { pxsz=3; command = IMG_RGB24; }
|
|
233 else if( strncmp(cmd,"BGR24" ,5)==0 ) { pxsz=3; command = IMG_BGR24; }
|
|
234 else if( strncmp(cmd,"CLEAR" ,5)==0 ) { pxsz=1; command = CMD_CLEAR; }
|
|
235 else if( strncmp(cmd,"ALPHA" ,5)==0 ) { pxsz=1; command = CMD_ALPHA; }
|
|
236 else if( strncmp(cmd,"OPAQUE",6)==0 ) vf->priv->opaque=TRUE;
|
|
237 else if( strncmp(cmd,"SHOW", 4)==0 ) vf->priv->hidden=FALSE;
|
|
238 else if( strncmp(cmd,"HIDE", 4)==0 ) vf->priv->hidden=TRUE;
|
|
239 else if( strncmp(cmd,"FLUSH" ,5)==0 ) return vf_next_put_image(vf, dmpi);
|
|
240 else {
|
|
241 fprintf(stderr, "\nvf_bmovl: Unknown command: '%s'. Ignoring.\n", cmd);
|
|
242 return vf_next_put_image(vf, dmpi);
|
|
243 }
|
|
244
|
|
245 if(command == CMD_ALPHA) {
|
|
246 sscanf( args, "%d %d %d %d %d", &imgw, &imgh, &imgx, &imgy, &imgalpha);
|
|
247 printf("\nDEBUG: ALPHA: %d %d %d %d %d\n\n",
|
|
248 imgw, imgh, imgx, imgy, imgalpha);
|
|
249 if(imgw==0 && imgh==0) vf->priv->opaque=FALSE;
|
|
250 }
|
|
251
|
|
252 if(command & IS_RAWIMG) {
|
|
253 sscanf( args, "%d %d %d %d %d %d",
|
|
254 &imgw, &imgh, &imgx, &imgy, &imgalpha, &clear);
|
|
255 printf("\nDEBUG: RAWIMG: %d %d %d %d %d %d\n\n",
|
|
256 imgw, imgh, imgx, imgy, imgalpha, clear);
|
|
257
|
|
258 buffer = malloc(imgw*imgh*pxsz);
|
|
259 if(!buffer) {
|
|
260 fprintf(stderr, "\nvf_bmovl: Couldn't allocate temporary buffer! Skipping...\n\n");
|
|
261 return vf_next_put_image(vf, dmpi);
|
|
262 }
|
|
263 printf("Got %d bytes...\n", read( vf->priv->stream_fd, buffer, (imgw*imgh*pxsz) ) );
|
|
264
|
|
265 if(clear) {
|
|
266 memset( vf->priv->bitmap.y, 0, vf->priv->w*vf->priv->h );
|
|
267 memset( vf->priv->bitmap.u, 128, vf->priv->w*vf->priv->h/4 );
|
|
268 memset( vf->priv->bitmap.v, 128, vf->priv->w*vf->priv->h/4 );
|
|
269 memset( vf->priv->bitmap.a, 0, vf->priv->w*vf->priv->h );
|
|
270 memset( vf->priv->bitmap.oa, 0, vf->priv->w*vf->priv->h );
|
|
271 vf->priv->x1 = dmpi->width;
|
|
272 vf->priv->y1 = dmpi->height;
|
|
273 vf->priv->x2 = vf->priv->y2 = 0;
|
|
274 }
|
|
275 // Define how much of our bitmap that contains graphics!
|
|
276 vf->priv->x1 = MAX( 0, MIN(vf->priv->x1, imgx) );
|
|
277 vf->priv->y1 = MAX( 0, MIN(vf->priv->y1, imgy) );
|
|
278 vf->priv->x2 = MIN( vf->priv->w, MAX(vf->priv->x2, ( imgx + imgw)) );
|
|
279 vf->priv->y2 = MIN( vf->priv->h, MAX(vf->priv->y2, ( imgy + imgh)) );
|
|
280 }
|
|
281
|
|
282 if( command == CMD_CLEAR ) {
|
|
283 sscanf( args, "%d %d %d %d", &imgw, &imgh, &imgx, &imgy);
|
|
284 printf("\nDEBUG: CLEAR: %d %d %d %d\n\n", imgw, imgh, imgx, imgy);
|
|
285
|
|
286 for( ypos=imgy ; (ypos < (imgy+imgh)) && (ypos < vf->priv->y2) ; ypos++ ) {
|
|
287 memset( vf->priv->bitmap.y + (ypos*vf->priv->w) + imgx, 0, imgw );
|
|
288 memset( vf->priv->bitmap.a + (ypos*vf->priv->w) + imgx, 0, imgw );
|
|
289 memset( vf->priv->bitmap.oa + (ypos*vf->priv->w) + imgx, 0, imgw );
|
|
290 if(ypos%2) {
|
|
291 memset( vf->priv->bitmap.u + ((ypos/2)*dmpi->stride[1]) + (imgx/2), 128, imgw/2 );
|
|
292 memset( vf->priv->bitmap.v + ((ypos/2)*dmpi->stride[2]) + (imgx/2), 128, imgw/2 );
|
|
293 }
|
|
294 } // Recalculate area that contains graphics
|
|
295 if( (imgx <= vf->priv->x1) && ( (imgw+imgx) >= vf->priv->x2) ) {
|
|
296 if( (imgy <= vf->priv->y1) && ( (imgy+imgh) >= vf->priv->y1) )
|
|
297 vf->priv->y1 = imgy+imgh;
|
|
298 if( (imgy <= vf->priv->y2) && ( (imgy+imgh) >= vf->priv->y2) )
|
|
299 vf->priv->y2 = imgy;
|
|
300 }
|
|
301 if( (imgy <= vf->priv->y1) && ( (imgy+imgh) >= vf->priv->y2) ) {
|
|
302 if( (imgx <= vf->priv->x1) && ( (imgx+imgw) >= vf->priv->x1) )
|
|
303 vf->priv->x1 = imgx+imgw;
|
|
304 if( (imgx <= vf->priv->x2) && ( (imgx+imgw) >= vf->priv->x2) )
|
|
305 vf->priv->x2 = imgx;
|
|
306 }
|
|
307 return vf_next_put_image(vf, dmpi);
|
|
308 }
|
|
309
|
|
310 for( buf_y=0 ; (buf_y < imgh) && (buf_y < (vf->priv->h-imgy)) ; buf_y++ ) {
|
|
311 for( buf_x=0 ; (buf_x < (imgw*pxsz)) && (buf_x < ((vf->priv->w+imgx)*pxsz)) ; buf_x += pxsz ) {
|
|
312 if(command & IS_RAWIMG) buf_pos = (buf_y * imgw * pxsz) + buf_x;
|
|
313 pos = ((buf_y+imgy) * vf->priv->w) + ((buf_x/pxsz)+imgx);
|
|
314
|
|
315 switch(command) {
|
|
316 case IMG_RGBA32:
|
|
317 red = buffer[buf_pos+0];
|
|
318 green = buffer[buf_pos+1];
|
|
319 blue = buffer[buf_pos+2];
|
|
320 alpha = buffer[buf_pos+3];
|
|
321 break;
|
|
322 case IMG_ABGR32:
|
|
323 alpha = buffer[buf_pos+0];
|
|
324 blue = buffer[buf_pos+1];
|
|
325 green = buffer[buf_pos+2];
|
|
326 red = buffer[buf_pos+3];
|
|
327 break;
|
|
328 case IMG_RGB24:
|
|
329 red = buffer[buf_pos+0];
|
|
330 green = buffer[buf_pos+1];
|
|
331 blue = buffer[buf_pos+2];
|
|
332 alpha = 0xFF;
|
|
333 break;
|
|
334 case IMG_BGR24:
|
|
335 blue = buffer[buf_pos+0];
|
|
336 green = buffer[buf_pos+1];
|
|
337 red = buffer[buf_pos+2];
|
|
338 alpha = 0xFF;
|
|
339 break;
|
|
340 case CMD_ALPHA:
|
|
341 vf->priv->bitmap.a[pos] = INRANGE((vf->priv->bitmap.oa[pos]+imgalpha),0,255);
|
|
342 break;
|
|
343 default:
|
|
344 fprintf(stderr, "vf_bmovl: Internal error!\n");
|
|
345 exit( 10 );
|
|
346 }
|
|
347 if( command & IS_RAWIMG ) {
|
|
348 vf->priv->bitmap.y[pos] = rgb2y(red,green,blue);
|
|
349 vf->priv->bitmap.oa[pos] = alpha;
|
|
350 vf->priv->bitmap.a[pos] = INRANGE((alpha+imgalpha),0,255);
|
|
351 if((buf_y%2) && ((buf_x/pxsz)%2)) {
|
|
352 pos = ( ((buf_y+imgy)/2) * dmpi->stride[1] ) + (((buf_x/pxsz)+imgx)/2);
|
|
353 vf->priv->bitmap.u[pos] = rgb2u(red,green,blue);
|
|
354 vf->priv->bitmap.v[pos] = rgb2v(red,green,blue);
|
|
355 }
|
|
356 }
|
|
357 } // for buf_x
|
|
358 } // for buf_y
|
|
359 free (buffer);
|
|
360 } else if(errno) fprintf(stderr, "\nvf_bmovl: Error %d in fifo: %s\n\n", errno, strerror(errno));
|
|
361 }
|
|
362
|
|
363 if(vf->priv->hidden) return vf_next_put_image(vf, dmpi);
|
|
364
|
|
365 if(vf->priv->opaque) { // Just copy buffer memory to screen
|
|
366 for( ypos=vf->priv->y1 ; ypos < vf->priv->y2 ; ypos++ ) {
|
|
367 memcpy( dmpi->planes[0] + (ypos*dmpi->stride[0]) + vf->priv->x1,
|
|
368 vf->priv->bitmap.y + (ypos*vf->priv->w) + vf->priv->x1,
|
|
369 vf->priv->x2 - vf->priv->x1 );
|
|
370 if(ypos%2) {
|
|
371 memcpy( dmpi->planes[1] + ((ypos/2)*dmpi->stride[1]) + (vf->priv->x1/2),
|
|
372 vf->priv->bitmap.u + (((ypos/2)*(vf->priv->w)/2)) + (vf->priv->x1/2),
|
|
373 (vf->priv->x2 - vf->priv->x1)/2 );
|
|
374 memcpy( dmpi->planes[2] + ((ypos/2)*dmpi->stride[2]) + (vf->priv->x1/2),
|
|
375 vf->priv->bitmap.v + (((ypos/2)*(vf->priv->w)/2)) + (vf->priv->x1/2),
|
|
376 (vf->priv->x2 - vf->priv->x1)/2 );
|
|
377 }
|
|
378 }
|
|
379 } else { // Blit the bitmap to the videoscreen, pixel for pixel
|
|
380 for( ypos=vf->priv->y1 ; ypos < vf->priv->y2 ; ypos++ ) {
|
|
381 for ( xpos=vf->priv->x1 ; xpos < vf->priv->x2 ; xpos++ ) {
|
|
382 pos = (ypos * dmpi->stride[0]) + xpos;
|
|
383
|
|
384 alpha = vf->priv->bitmap.a[pos];
|
|
385
|
|
386 if (alpha == 0) continue; // Completly transparent pixel
|
|
387
|
|
388 if (alpha == 255) { // Opaque pixel
|
|
389 dmpi->planes[0][pos] = vf->priv->bitmap.y[pos];
|
|
390 if ((ypos%2) && (xpos%2)) {
|
|
391 pos = ( (ypos/2) * dmpi->stride[1] ) + (xpos/2);
|
|
392 dmpi->planes[1][pos] = vf->priv->bitmap.u[pos];
|
|
393 dmpi->planes[2][pos] = vf->priv->bitmap.v[pos];
|
|
394 }
|
|
395 } else { // Alphablended pixel
|
|
396 dmpi->planes[0][pos] = (dmpi->planes[0][pos]*(1.0-(alpha/255.0))) + (vf->priv->bitmap.y[pos]*(alpha/255.0));
|
|
397 if ((ypos%2) && (xpos%2)) {
|
|
398 pos = ( (ypos/2) * dmpi->stride[1] ) + (xpos/2);
|
|
399 dmpi->planes[1][pos] = (dmpi->planes[1][pos]*(1.0-(alpha/255.0))) + (vf->priv->bitmap.u[pos]*(alpha/255.0));
|
|
400 dmpi->planes[2][pos] = (dmpi->planes[2][pos]*(1.0-(alpha/255.0))) + (vf->priv->bitmap.v[pos]*(alpha/255.0));
|
|
401 }
|
|
402 }
|
|
403 } // for xpos
|
|
404 } // for ypos
|
|
405 } // if !opaque
|
|
406 return vf_next_put_image(vf, dmpi);
|
|
407 } // put_image
|
|
408
|
|
409 static int
|
|
410 vf_open(vf_instance_t* vf, char* args)
|
|
411 {
|
|
412 char filename[1000];
|
|
413
|
|
414 vf->config = config;
|
|
415 vf->put_image = put_image;
|
|
416 vf->query_format = query_format;
|
|
417 vf->uninit = uninit;
|
|
418
|
|
419 vf->priv = malloc(sizeof(struct vf_priv_s));
|
|
420
|
|
421 if( sscanf(args, "%d:%d:%s", &vf->priv->hidden, &vf->priv->opaque, filename) < 3 ) {
|
|
422 fprintf(stderr, "vf_bmovl: Bad arguments!\n");
|
|
423 fprintf(stderr, "vf_bmovl: Arguments are 'bool hidden:bool opaque:string fifo'\n");
|
|
424 exit(5);
|
|
425 }
|
|
426
|
|
427 vf->priv->stream_fd = open(filename, O_RDWR);
|
|
428 if(vf->priv->stream_fd >= 0) {
|
|
429 FD_ZERO( &vf->priv->stream_fdset );
|
|
430 printf("vf_bmovl: Opened fifo %s as FD %d\n", filename, vf->priv->stream_fd);
|
|
431 } else {
|
|
432 fprintf(stderr, "vf_bmovl: Error! Couldn't open FIFO %s: %s\n", filename, strerror(errno));
|
|
433 vf->priv->stream_fd = -1;
|
|
434 }
|
|
435
|
|
436 return TRUE;
|
|
437 }
|
|
438
|
|
439 vf_info_t vf_info_bmovl = {
|
|
440 "Read bitmaps from a FIFO and display them in window",
|
|
441 "bmovl",
|
|
442 "Per Wigren",
|
|
443 "",
|
|
444 vf_open
|
|
445 };
|