Debian Codegraph @

Xpjproject/pjmedia/include/pjmedia-videodev/videodev_imp.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18 #ifndef __VIDEODEV_IMP_H__
19 #define __VIDEODEV_IMP_H__
20
21 #include <pjmedia-videodev/videodev.h>
22
23 /**
24 * @defgroup s8_video_device_implementors_api Video Device Implementors API
25 * @ingroup video_device_api
26 * @brief API for video device implementors
27 * @{
28 */
29
30 /**
31 * Video device factory operations.
32 */
33 typedef struct pjmedia_vid_dev_factory_op
34 {
35 /**
36 * Initialize the video device factory.
37 *
38 * @param f The video device factory.
39 */
40 pj_status_t (*init)(pjmedia_vid_dev_factory *f);
41
42 /**
43 * Close this video device factory and release all resources back to the
44 * operating system.
45 *
46 * @param f The video device factory.
47 */
48 pj_status_t (*destroy)(pjmedia_vid_dev_factory *f);
49
50 /**
51 * Get the number of video devices installed in the system.
52 *
53 * @param f The video device factory.
54 */
55 unsigned (*get_dev_count)(pjmedia_vid_dev_factory *f);
56
57 /**
58 * Get the video device information and capabilities.
59 *
60 * @param f The video device factory.
61 * @param index Device index.
62 * @param info The video device information structure which will be
63 * initialized by this function once it returns
64 * successfully.
65 */
66 pj_status_t (*get_dev_info)(pjmedia_vid_dev_factory *f,
67 unsigned index,
68 pjmedia_vid_dev_info *info);
69
70 /**
71 * Initialize the specified video device parameter with the default
72 * values for the specified device.
73 *
74 * @param f The video device factory.
75 * @param index Device index.
76 * @param param The video device parameter.
77 */
78 pj_status_t (*default_param)(pj_pool_t *pool,
79 pjmedia_vid_dev_factory *f,
80 unsigned index,
81 pjmedia_vid_dev_param *param);
82
83 /**
84 * Open the video device and create video stream. See
85 * #pjmedia_vid_dev_stream_create()
86 */
87 pj_status_t (*create_stream)(pjmedia_vid_dev_factory *f,
88 pjmedia_vid_dev_param *param,
89 const pjmedia_vid_dev_cb *cb,
90 void *user_data,
91 pjmedia_vid_dev_stream **p_vid_strm);
92
93 /**
94 * Refresh the list of video devices installed in the system.
95 *
96 * @param f The video device factory.
97 */
98 pj_status_t (*refresh)(pjmedia_vid_dev_factory *f);
99
100 } pjmedia_vid_dev_factory_op;
101
102
103 /**
104 * This structure describes a video device factory.
105 */
106 struct pjmedia_vid_dev_factory
107 {
108 /** Internal data to be initialized by video subsystem. */
109 struct {
110 /** Driver index */
111 unsigned drv_idx;
112 } sys;
113
114 /** Operations */
115 pjmedia_vid_dev_factory_op *op;
116 };
117
118
119 /**
120 * Video stream operations.
121 */
122 typedef struct pjmedia_vid_dev_stream_op
123 {
124 /**
125 * See #pjmedia_vid_dev_stream_get_param()
126 */
127 pj_status_t (*get_param)(pjmedia_vid_dev_stream *strm,
128 pjmedia_vid_dev_param *param);
129
130 /**
131 * See #pjmedia_vid_dev_stream_get_cap()
132 */
133 pj_status_t (*get_cap)(pjmedia_vid_dev_stream *strm,
134 pjmedia_vid_dev_cap cap,
135 void *value);
136
137 /**
138 * See #pjmedia_vid_dev_stream_set_cap()
139 */
140 pj_status_t (*set_cap)(pjmedia_vid_dev_stream *strm,
141 pjmedia_vid_dev_cap cap,
142 const void *value);
143
144 /**
145 * See #pjmedia_vid_dev_stream_start()
146 */
147 pj_status_t (*start)(pjmedia_vid_dev_stream *strm);
148
149 /**
150 * See #pjmedia_vid_dev_stream_get_frame()
151 */
152 pj_status_t (*get_frame)(pjmedia_vid_dev_stream *strm,
153 pjmedia_frame *frame);
154
155 /**
156 * See #pjmedia_vid_dev_stream_put_frame()
157 */
158 pj_status_t (*put_frame)(pjmedia_vid_dev_stream *strm,
159 const pjmedia_frame *frame);
160
161 /**
162 * See #pjmedia_vid_dev_stream_stop().
163 */
164 pj_status_t (*stop)(pjmedia_vid_dev_stream *strm);
165
166 /**
167 * See #pjmedia_vid_dev_stream_destroy().
168 */
169 pj_status_t (*destroy)(pjmedia_vid_dev_stream *strm);
170
171 } pjmedia_vid_dev_stream_op;
172
173
174 /**
175 * This structure describes the video device stream.
176 */
177 struct pjmedia_vid_dev_stream
178 {
179 /** Internal data to be initialized by video subsystem */
180 struct {
181 /** Driver index */
182 unsigned drv_idx;
183
184 /** Has it been started? */
185 pj_bool_t is_running;
186 } sys;
187
188 /** Operations */
189 pjmedia_vid_dev_stream_op *op;
190 };
191
192
193 /**
194 * Internal API: return the factory instance and device index that's local
195 * to the factory for a given device ID.
196 *
197 * @param id Device id.
198 * @param p_f Out: factory instance
199 * @param p_local_index Out: device index within the factory
200 *
201 * @return PJ_SUCCESS on success.
202 */
203 PJ_DECL(pj_status_t)
204 pjmedia_vid_dev_get_local_index(pjmedia_vid_dev_index id,
205 pjmedia_vid_dev_factory **p_f,
206 unsigned *p_local_index);
207
208 /**
209 * Internal API: return the global device index given a factory instance and
210 * a local device index.
211 *
212 * @param f Factory.
213 * @param local_idx Local index.
214 * @param pid Returned global index.
215 *
216 * @return PJ_SUCCESS on success.
217 */
218 PJ_DEF(pj_status_t)
219 pjmedia_vid_dev_get_global_index(const pjmedia_vid_dev_factory *f,
220 unsigned local_idx,
221 pjmedia_vid_dev_index *pid);
222
223 /**
224 * @}
225 */
226
227
228
229 #endif /* __VIDEODEV_IMP_H__ */