blob: e16b90a4c085a893538a4297eceb3e0fccee1c00 [file] [log] [blame]
Benny Prijonoc45d9512010-12-10 11:04:30 +00001/* $Id$ */
2/*
3 * Copyright (C) 2008-2010 Teluu Inc. (http://www.teluu.com)
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19#ifndef __VIDEODEV_IMP_H__
20#define __VIDEODEV_IMP_H__
21
22#include <pjmedia-videodev/videodev.h>
23
24/**
25 * @defgroup s8_video_device_implementors_api Video Device Implementors API
26 * @ingroup video_device_api
27 * @brief API for video device implementors
28 * @{
29 */
30
31/**
32 * Video device factory operations.
33 */
34typedef struct pjmedia_vid_dev_factory_op
35{
36 /**
37 * Initialize the video device factory.
38 *
39 * @param f The video device factory.
40 */
41 pj_status_t (*init)(pjmedia_vid_dev_factory *f);
42
43 /**
44 * Close this video device factory and release all resources back to the
45 * operating system.
46 *
47 * @param f The video device factory.
48 */
49 pj_status_t (*destroy)(pjmedia_vid_dev_factory *f);
50
51 /**
52 * Get the number of video devices installed in the system.
53 *
54 * @param f The video device factory.
55 */
56 unsigned (*get_dev_count)(pjmedia_vid_dev_factory *f);
57
58 /**
59 * Get the video device information and capabilities.
60 *
61 * @param f The video device factory.
62 * @param index Device index.
63 * @param info The video device information structure which will be
64 * initialized by this function once it returns
65 * successfully.
66 */
67 pj_status_t (*get_dev_info)(pjmedia_vid_dev_factory *f,
68 unsigned index,
69 pjmedia_vid_dev_info *info);
70
71 /**
72 * Initialize the specified video device parameter with the default
73 * values for the specified device.
74 *
75 * @param f The video device factory.
76 * @param index Device index.
77 * @param param The video device parameter.
78 */
79 pj_status_t (*default_param)(pj_pool_t *pool,
80 pjmedia_vid_dev_factory *f,
81 unsigned index,
82 pjmedia_vid_param *param);
83
84 /**
85 * Open the video device and create video stream. See
86 * #pjmedia_vid_stream_create()
87 */
88 pj_status_t (*create_stream)(pjmedia_vid_dev_factory *f,
89 const pjmedia_vid_param *param,
90 const pjmedia_vid_cb *cb,
91 void *user_data,
92 pjmedia_vid_stream **p_vid_strm);
93
94} pjmedia_vid_dev_factory_op;
95
96
97/**
98 * This structure describes a video device factory.
99 */
100struct pjmedia_vid_dev_factory
101{
102 /** Internal data to be initialized by video subsystem. */
103 struct {
104 /** Driver index */
105 unsigned drv_idx;
106 } sys;
107
108 /** Operations */
109 pjmedia_vid_dev_factory_op *op;
110};
111
112
113/**
114 * Video stream operations.
115 */
116typedef struct pjmedia_vid_stream_op
117{
118 /**
119 * See #pjmedia_vid_stream_get_param()
120 */
121 pj_status_t (*get_param)(pjmedia_vid_stream *strm,
122 pjmedia_vid_param *param);
123
124 /**
125 * See #pjmedia_vid_stream_get_cap()
126 */
127 pj_status_t (*get_cap)(pjmedia_vid_stream *strm,
128 pjmedia_vid_dev_cap cap,
129 void *value);
130
131 /**
132 * See #pjmedia_vid_stream_set_cap()
133 */
134 pj_status_t (*set_cap)(pjmedia_vid_stream *strm,
135 pjmedia_vid_dev_cap cap,
136 const void *value);
137
138 /**
139 * See #pjmedia_vid_stream_start()
140 */
141 pj_status_t (*start)(pjmedia_vid_stream *strm);
142
143 /**
144 * See #pjmedia_vid_stream_get_frame()
145 */
146 pj_status_t (*get_frame)(pjmedia_vid_stream *strm,
147 pjmedia_frame *frame);
148
149 /**
150 * See #pjmedia_vid_stream_put_frame()
151 */
152 pj_status_t (*put_frame)(pjmedia_vid_stream *strm,
153 const pjmedia_frame *frame);
154
155 /**
156 * See #pjmedia_vid_stream_stop().
157 */
158 pj_status_t (*stop)(pjmedia_vid_stream *strm);
159
160 /**
161 * See #pjmedia_vid_stream_destroy().
162 */
163 pj_status_t (*destroy)(pjmedia_vid_stream *strm);
164
165} pjmedia_vid_stream_op;
166
167
168/**
169 * This structure describes the video device stream.
170 */
171struct pjmedia_vid_stream
172{
173 /** Internal data to be initialized by video subsystem */
174 struct {
175 /** Driver index */
176 unsigned drv_idx;
177 } sys;
178
179 /** Operations */
180 pjmedia_vid_stream_op *op;
181};
182
183
184
185
186/**
187 * @}
188 */
189
190
191
192#endif /* __VIDEODEV_IMP_H__ */