comparison stream/tvi_dummy.c @ 19271:64d82a45a05d

introduce new 'stream' directory for all stream layer related components and split them from libmpdemux
author ben
date Mon, 31 Jul 2006 17:39:17 +0000
parents libmpdemux/tvi_dummy.c@d2d9d011203f
children ac69ba536915
comparison
equal deleted inserted replaced
19270:7d39b911f0bd 19271:64d82a45a05d
1 /*
2 Only a sample!
3 */
4
5 #include "config.h"
6
7 #include <stdio.h>
8 #include "libvo/img_format.h"
9 #include "tv.h"
10
11 /* information about this file */
12 static tvi_info_t info = {
13 "NULL-TV",
14 "dummy",
15 "alex",
16 NULL
17 };
18
19 /* private data's */
20 typedef struct {
21 int width;
22 int height;
23 } priv_t;
24
25 #include "tvi_def.h"
26
27 /* handler creator - entry point ! */
28 tvi_handle_t *tvi_init_dummy(char *device)
29 {
30 return(new_handle());
31 }
32
33 /* initialisation */
34 static int init(priv_t *priv)
35 {
36 priv->width = 320;
37 priv->height = 200;
38 return(1);
39 }
40
41 /* that's the real start, we'got the format parameters (checked with control) */
42 static int start(priv_t *priv)
43 {
44 return(1);
45 }
46
47 static int uninit(priv_t *priv)
48 {
49 return(1);
50 }
51
52 static int control(priv_t *priv, int cmd, void *arg)
53 {
54 switch(cmd)
55 {
56 case TVI_CONTROL_IS_VIDEO:
57 return(TVI_CONTROL_TRUE);
58 case TVI_CONTROL_VID_GET_FORMAT:
59 // *(int *)arg = IMGFMT_YV12;
60 *(int *)arg = IMGFMT_YV12;
61 return(TVI_CONTROL_TRUE);
62 case TVI_CONTROL_VID_SET_FORMAT:
63 {
64 // int req_fmt = *(int *)arg;
65 int req_fmt = *(int *)arg;
66 if (req_fmt != IMGFMT_YV12)
67 return(TVI_CONTROL_FALSE);
68 return(TVI_CONTROL_TRUE);
69 }
70 case TVI_CONTROL_VID_SET_WIDTH:
71 priv->width = *(int *)arg;
72 return(TVI_CONTROL_TRUE);
73 case TVI_CONTROL_VID_GET_WIDTH:
74 *(int *)arg = priv->width;
75 return(TVI_CONTROL_TRUE);
76 case TVI_CONTROL_VID_SET_HEIGHT:
77 priv->height = *(int *)arg;
78 return(TVI_CONTROL_TRUE);
79 case TVI_CONTROL_VID_GET_HEIGHT:
80 *(int *)arg = priv->height;
81 return(TVI_CONTROL_TRUE);
82 case TVI_CONTROL_VID_CHK_WIDTH:
83 case TVI_CONTROL_VID_CHK_HEIGHT:
84 return(TVI_CONTROL_TRUE);
85 case TVI_CONTROL_TUN_SET_NORM:
86 return(TVI_CONTROL_TRUE);
87 }
88 return(TVI_CONTROL_UNKNOWN);
89 }
90
91 #ifdef HAVE_TV_BSDBT848
92 static double grabimmediate_video_frame(priv_t *priv, char *buffer, int len)
93 {
94 memset(buffer, 0xCC, len);
95 return(1);
96 }
97 #endif
98
99 static double grab_video_frame(priv_t *priv, char *buffer, int len)
100 {
101 memset(buffer, 0x42, len);
102 return(1);
103 }
104
105 static int get_video_framesize(priv_t *priv)
106 {
107 /* YV12 */
108 return(priv->width*priv->height*12/8);
109 }
110
111 static double grab_audio_frame(priv_t *priv, char *buffer, int len)
112 {
113 memset(buffer, 0x42, len);
114 return(1);
115 }
116
117 static int get_audio_framesize(priv_t *priv)
118 {
119 return(1);
120 }