12024
|
1 /*
|
|
2 The mediastreamer library aims at providing modular media processing and I/O
|
|
3 for linphone, but also for any telephony application.
|
|
4 Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
|
|
5
|
|
6 This library is free software; you can redistribute it and/or
|
|
7 modify it under the terms of the GNU Lesser General Public
|
|
8 License as published by the Free Software Foundation; either
|
|
9 version 2.1 of the License, or (at your option) any later version.
|
|
10
|
|
11 This library is distributed in the hope that it will be useful,
|
|
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
14 Lesser General Public License for more details.
|
|
15
|
|
16 You should have received a copy of the GNU Lesser General Public
|
|
17 License along with this library; if not, write to the Free Software
|
|
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
19 */
|
|
20
|
|
21 #ifndef MSV4L_H
|
|
22 #define MSV4L_H
|
|
23
|
|
24 #include <msvideosource.h>
|
|
25 #include <sys/types.h>
|
|
26 #include <linux/videodev.h>
|
|
27
|
|
28 struct _MSV4l
|
|
29 {
|
|
30 MSVideoSource parent;
|
|
31 int fd;
|
|
32 char *device;
|
|
33 struct video_capability cap;
|
|
34 struct video_channel channel;
|
|
35 struct video_window win;
|
|
36 struct video_picture pict;
|
|
37 struct video_mmap vmap;
|
|
38 struct video_mbuf vmbuf;
|
|
39 struct video_capture vcap;
|
|
40 gint bsize;
|
|
41 gint use_mmap;
|
|
42 gint frame;
|
|
43 guint query_frame;
|
|
44 gchar *mmapdbuf; /* the mmap'd buffer */
|
|
45 MSBuffer img[VIDEO_MAX_FRAME]; /* the buffer wrappers used for mmaps */
|
|
46 gint width; /* the capture image size - can be cropped to output size */
|
|
47 gint height;
|
|
48 MSBuffer *allocdbuf; /* the buffer allocated for read() and mire */
|
|
49 gint count;
|
|
50 MSBuffer *image_grabbed;
|
|
51 GCond *cond;
|
|
52 GCond *stopcond;
|
|
53 GThread *v4lthread;
|
|
54 gboolean grab_image;
|
|
55 gboolean thread_run;
|
|
56 gboolean thread_exited;
|
|
57 };
|
|
58
|
|
59 typedef struct _MSV4l MSV4l;
|
|
60
|
|
61
|
|
62 struct _MSV4lClass
|
|
63 {
|
|
64 MSVideoSourceClass parent_class;
|
|
65
|
|
66 };
|
|
67
|
|
68 typedef struct _MSV4lClass MSV4lClass;
|
|
69
|
|
70
|
|
71 /* PUBLIC API */
|
|
72 #define MS_V4L(v) ((MSV4l*)(v))
|
|
73 #define MS_V4L_CLASS(k) ((MSV4lClass*)(k))
|
|
74 MSFilter * ms_v4l_new();
|
|
75
|
|
76 void ms_v4l_start(MSV4l *obj);
|
|
77 void ms_v4l_stop(MSV4l *obj);
|
|
78 int ms_v4l_set_device(MSV4l *f, const gchar *device);
|
|
79 gint ms_v4l_get_width(MSV4l *v4l);
|
|
80 gint ms_v4l_get_height(MSV4l *v4l);
|
|
81 void ms_v4l_set_size(MSV4l *v4l, gint w, gint h);
|
|
82
|
|
83 /* PRIVATE API */
|
|
84 void ms_v4l_init(MSV4l *obj);
|
|
85 void ms_v4l_class_init(MSV4lClass *klass);
|
|
86 int v4l_configure(MSV4l *f);
|
|
87
|
|
88 void v4l_process(MSV4l *obj);
|
|
89
|
|
90 void ms_v4l_uninit(MSV4l *obj);
|
|
91
|
|
92 void ms_v4l_destroy(MSV4l *obj);
|
|
93
|
|
94 extern MSFilterInfo v4l_info;
|
|
95
|
|
96 #endif
|