Fix a possible crash on 64 bit systems when the lumSrcPtr or chrSrcPtr
[mplayer/glamo.git] / stream / tvi_dummy.c
blobe3a922fadea38cf517e9e0e0fc3a61a14e75d0d9
1 /*
2 Only a sample!
3 */
5 #include "config.h"
7 #include <stdio.h>
8 #include "libmpcodecs/img_format.h"
9 #include "tv.h"
11 static tvi_handle_t *tvi_init_dummy(char *device,char *adevice);
12 /* information about this file */
13 tvi_info_t tvi_info_dummy = {
14 tvi_init_dummy,
15 "NULL-TV",
16 "dummy",
17 "alex",
18 NULL
21 /* private data's */
22 typedef struct {
23 int width;
24 int height;
25 } priv_t;
27 #include "tvi_def.h"
29 /* handler creator - entry point ! */
30 static tvi_handle_t *tvi_init_dummy(char *device,char *adevice)
32 return(new_handle());
35 /* initialisation */
36 static int init(priv_t *priv)
38 priv->width = 320;
39 priv->height = 200;
40 return(1);
43 /* that's the real start, we'got the format parameters (checked with control) */
44 static int start(priv_t *priv)
46 return(1);
49 static int uninit(priv_t *priv)
51 return(1);
54 static int control(priv_t *priv, int cmd, void *arg)
56 switch(cmd)
58 case TVI_CONTROL_IS_VIDEO:
59 return(TVI_CONTROL_TRUE);
60 case TVI_CONTROL_VID_GET_FORMAT:
61 // *(int *)arg = IMGFMT_YV12;
62 *(int *)arg = IMGFMT_YV12;
63 return(TVI_CONTROL_TRUE);
64 case TVI_CONTROL_VID_SET_FORMAT:
66 // int req_fmt = *(int *)arg;
67 int req_fmt = *(int *)arg;
68 if (req_fmt != IMGFMT_YV12)
69 return(TVI_CONTROL_FALSE);
70 return(TVI_CONTROL_TRUE);
72 case TVI_CONTROL_VID_SET_WIDTH:
73 priv->width = *(int *)arg;
74 return(TVI_CONTROL_TRUE);
75 case TVI_CONTROL_VID_GET_WIDTH:
76 *(int *)arg = priv->width;
77 return(TVI_CONTROL_TRUE);
78 case TVI_CONTROL_VID_SET_HEIGHT:
79 priv->height = *(int *)arg;
80 return(TVI_CONTROL_TRUE);
81 case TVI_CONTROL_VID_GET_HEIGHT:
82 *(int *)arg = priv->height;
83 return(TVI_CONTROL_TRUE);
84 case TVI_CONTROL_VID_CHK_WIDTH:
85 case TVI_CONTROL_VID_CHK_HEIGHT:
86 return(TVI_CONTROL_TRUE);
87 case TVI_CONTROL_TUN_SET_NORM:
88 return(TVI_CONTROL_TRUE);
90 return(TVI_CONTROL_UNKNOWN);
93 #ifdef HAVE_TV_BSDBT848
94 static double grabimmediate_video_frame(priv_t *priv, char *buffer, int len)
96 memset(buffer, 0xCC, len);
97 return(1);
99 #endif
101 static double grab_video_frame(priv_t *priv, char *buffer, int len)
103 memset(buffer, 0x42, len);
104 return(1);
107 static int get_video_framesize(priv_t *priv)
109 /* YV12 */
110 return(priv->width*priv->height*12/8);
113 static double grab_audio_frame(priv_t *priv, char *buffer, int len)
115 memset(buffer, 0x42, len);
116 return(1);
119 static int get_audio_framesize(priv_t *priv)
121 return(1);