1 /* fswebcam - FireStorm.cx's webcam generator */
2 /*===========================================================*/
3 /* Copyright (C)2005-2006 Philip Heron <phil@firestorm.cx> */
5 /* This program is distributed under the terms of the GNU */
6 /* General Public License, version 2. You may use, modify, */
7 /* and redistribute it under the terms of this license. A */
8 /* copy should be included with this source. */
18 #define PUT_RGB(d, r, g, b) { d[0] = r; d[1] = g; d[2] = b; }
20 int src_test_open(src_t
*src
)
25 if(src
->list
& SRC_LIST_INPUTS
) HEAD("--- No inputs.");
26 if(src
->list
& SRC_LIST_TUNERS
) HEAD("--- No tuners.");
27 if(src
->list
& SRC_LIST_FORMATS
) HEAD("--- Test only supports RGB24.");
28 if(src
->list
& SRC_LIST_CONTROLS
) HEAD("--- No controls.");
30 /* Allocate memory for the test image. */
31 src
->length
= src
->width
* src
->height
* 3;
32 src
->img
= (uint8_t *) malloc(src
->length
);
33 if(!src
->img
) return(-1);
35 /* Set the palette type. */
36 src
->palette
= SRC_PAL_RGB24
;
38 /* Draw the test image. */
40 for(y
= 0; y
< src
->height
; y
++)
42 for(x
= 0; x
< src
->width
; x
++)
44 int i
= x
/ (src
->width
/ 8);
51 PUT_RGB(p
, 0x00, 0x00, 0x00); break;
53 PUT_RGB(p
, 0x00, 0x00, 0xFF); break;
55 PUT_RGB(p
, 0xFF, 0x00, 0x00); break;
57 PUT_RGB(p
, 0xFF, 0x00, 0xFF); break;
59 PUT_RGB(p
, 0x00, 0xFF, 0x00); break;
61 PUT_RGB(p
, 0x00, 0xFF, 0xFF); break;
63 PUT_RGB(p
, 0xFF, 0xFF, 0x00); break;
65 PUT_RGB(p
, 0xFF, 0xFF, 0xFF); break;
75 int src_test_close(src_t
*src
)
81 int src_test_grab(src_t
*src
)
86 src_mod_t src_test
= {
87 "test", SRC_TYPE_NONE
,