1
/* $Id: videodev_imp.h 4016 2012-04-04 05:05:50Z bennylp $ */
3
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
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.
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.
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
19
#ifndef __VIDEODEV_IMP_H__
20
#define __VIDEODEV_IMP_H__
22
#include <pjmedia-videodev/videodev.h>
25
* @defgroup s8_video_device_implementors_api Video Device Implementors API
26
* @ingroup video_device_api
27
* @brief API for video device implementors
32
* Video device factory operations.
34
typedef struct pjmedia_vid_dev_factory_op
37
* Initialize the video device factory.
39
* @param f The video device factory.
41
pj_status_t (*init)(pjmedia_vid_dev_factory *f);
44
* Close this video device factory and release all resources back to the
47
* @param f The video device factory.
49
pj_status_t (*destroy)(pjmedia_vid_dev_factory *f);
52
* Get the number of video devices installed in the system.
54
* @param f The video device factory.
56
unsigned (*get_dev_count)(pjmedia_vid_dev_factory *f);
59
* Get the video device information and capabilities.
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
67
pj_status_t (*get_dev_info)(pjmedia_vid_dev_factory *f,
69
pjmedia_vid_dev_info *info);
72
* Initialize the specified video device parameter with the default
73
* values for the specified device.
75
* @param f The video device factory.
76
* @param index Device index.
77
* @param param The video device parameter.
79
pj_status_t (*default_param)(pj_pool_t *pool,
80
pjmedia_vid_dev_factory *f,
82
pjmedia_vid_dev_param *param);
85
* Open the video device and create video stream. See
86
* #pjmedia_vid_dev_stream_create()
88
pj_status_t (*create_stream)(pjmedia_vid_dev_factory *f,
89
pjmedia_vid_dev_param *param,
90
const pjmedia_vid_dev_cb *cb,
92
pjmedia_vid_dev_stream **p_vid_strm);
95
* Refresh the list of video devices installed in the system.
97
* @param f The video device factory.
99
pj_status_t (*refresh)(pjmedia_vid_dev_factory *f);
101
} pjmedia_vid_dev_factory_op;
105
* This structure describes a video device factory.
107
struct pjmedia_vid_dev_factory
109
/** Internal data to be initialized by video subsystem. */
116
pjmedia_vid_dev_factory_op *op;
121
* Video stream operations.
123
typedef struct pjmedia_vid_dev_stream_op
126
* See #pjmedia_vid_dev_stream_get_param()
128
pj_status_t (*get_param)(pjmedia_vid_dev_stream *strm,
129
pjmedia_vid_dev_param *param);
132
* See #pjmedia_vid_dev_stream_get_cap()
134
pj_status_t (*get_cap)(pjmedia_vid_dev_stream *strm,
135
pjmedia_vid_dev_cap cap,
139
* See #pjmedia_vid_dev_stream_set_cap()
141
pj_status_t (*set_cap)(pjmedia_vid_dev_stream *strm,
142
pjmedia_vid_dev_cap cap,
146
* See #pjmedia_vid_dev_stream_start()
148
pj_status_t (*start)(pjmedia_vid_dev_stream *strm);
151
* See #pjmedia_vid_dev_stream_get_frame()
153
pj_status_t (*get_frame)(pjmedia_vid_dev_stream *strm,
154
pjmedia_frame *frame);
157
* See #pjmedia_vid_dev_stream_put_frame()
159
pj_status_t (*put_frame)(pjmedia_vid_dev_stream *strm,
160
const pjmedia_frame *frame);
163
* See #pjmedia_vid_dev_stream_stop().
165
pj_status_t (*stop)(pjmedia_vid_dev_stream *strm);
168
* See #pjmedia_vid_dev_stream_destroy().
170
pj_status_t (*destroy)(pjmedia_vid_dev_stream *strm);
172
} pjmedia_vid_dev_stream_op;
176
* This structure describes the video device stream.
178
struct pjmedia_vid_dev_stream
180
/** Internal data to be initialized by video subsystem */
185
/** Has it been started? */
186
pj_bool_t is_running;
190
pjmedia_vid_dev_stream_op *op;
195
* Internal API: return the factory instance and device index that's local
196
* to the factory for a given device ID.
198
* @param id Device id.
199
* @param p_f Out: factory instance
200
* @param p_local_index Out: device index within the factory
202
* @return PJ_SUCCESS on success.
205
pjmedia_vid_dev_get_local_index(pjmedia_vid_dev_index id,
206
pjmedia_vid_dev_factory **p_f,
207
unsigned *p_local_index);
210
* Internal API: return the global device index given a factory instance and
211
* a local device index.
214
* @param local_idx Local index.
215
* @param pid Returned global index.
217
* @return PJ_SUCCESS on success.
220
pjmedia_vid_dev_get_global_index(const pjmedia_vid_dev_factory *f,
222
pjmedia_vid_dev_index *pid);
230
#endif /* __VIDEODEV_IMP_H__ */