2802
|
1 /*
|
|
2 Only a sample!
|
|
3 */
|
2790
|
4
|
|
5 #include "config.h"
|
|
6
|
|
7 #ifdef USE_TV
|
2802
|
8
|
|
9 #include <stdio.h>
|
2790
|
10 #include "tv.h"
|
|
11
|
2802
|
12 /* information about this file */
|
2790
|
13 static tvi_info_t info = {
|
|
14 "NULL-TV",
|
|
15 "dummy",
|
|
16 "alex",
|
2802
|
17 NULL
|
2790
|
18 };
|
|
19
|
2802
|
20 /* private data's */
|
2790
|
21 typedef struct {
|
2802
|
22 int width;
|
|
23 int height;
|
2790
|
24 } priv_t;
|
|
25
|
|
26 #include "tvi_def.h"
|
|
27
|
2802
|
28 /* handler creator - entry point ! */
|
2790
|
29 tvi_handle_t *tvi_init_dummy(char *device)
|
|
30 {
|
|
31 return new_handle();
|
|
32 }
|
|
33
|
2802
|
34 /* initialisation */
|
|
35 static int init(priv_t *priv, tvi_param_t *params)
|
|
36 {
|
|
37 return 1;
|
|
38 }
|
|
39
|
|
40 /* that's the real start, we'got the format parameters (checked with control) */
|
|
41 static int start(priv_t *priv)
|
2790
|
42 {
|
|
43 }
|
|
44
|
2802
|
45 static int uninit(priv_t *priv)
|
2790
|
46 {
|
|
47 }
|
|
48
|
|
49 static int control(priv_t *priv, int cmd, void *arg)
|
|
50 {
|
2802
|
51 switch(cmd)
|
|
52 {
|
|
53 case TVI_CONTROL_IS_VIDEO:
|
|
54 return(TVI_CONTROL_TRUE);
|
|
55 case TVI_CONTROL_VID_GET_FORMAT:
|
|
56 (int)*(void **)arg = IMGFMT_YV12;
|
|
57 return(TVI_CONTROL_TRUE);
|
2815
|
58 case TVI_CONTROL_VID_SET_FORMAT:
|
|
59 {
|
|
60 int req_fmt = (int)*(void **)arg;
|
|
61 if (req_fmt != IMGFMT_YV12)
|
|
62 return(TVI_CONTROL_FALSE);
|
|
63 return(TVI_CONTROL_TRUE);
|
|
64 }
|
2802
|
65 case TVI_CONTROL_VID_SET_WIDTH:
|
|
66 priv->width = (int)*(void **)arg;
|
|
67 return(TVI_CONTROL_TRUE);
|
|
68 case TVI_CONTROL_VID_SET_HEIGHT:
|
|
69 priv->height = (int)*(void **)arg;
|
|
70 return(TVI_CONTROL_TRUE);
|
|
71 case TVI_CONTROL_VID_CHK_WIDTH:
|
|
72 case TVI_CONTROL_VID_CHK_HEIGHT:
|
|
73 return(TVI_CONTROL_TRUE);
|
|
74 }
|
2790
|
75 return(TVI_CONTROL_UNKNOWN);
|
|
76 }
|
|
77
|
|
78 static int grab_video_frame(priv_t *priv, char *buffer, int len)
|
|
79 {
|
2802
|
80 memset(buffer, 0x42, len);
|
2790
|
81 }
|
|
82
|
|
83 static int get_video_framesize(priv_t *priv)
|
|
84 {
|
2802
|
85 /* YV12 */
|
|
86 return priv->width*priv->height*12/8;
|
2790
|
87 }
|
|
88
|
|
89 static int grab_audio_frame(priv_t *priv, char *buffer, int len)
|
|
90 {
|
2802
|
91 memset(buffer, 0x42, len);
|
2790
|
92 }
|
|
93
|
|
94 static int get_audio_framesize(priv_t *priv)
|
|
95 {
|
2802
|
96 return 1;
|
2790
|
97 }
|
|
98
|
|
99 #endif /* USE_TV */
|