1 /* G-Streamer generic V4L2 element
2 * Copyright (C) 2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library 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 GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
20 #ifndef __GST_V4L2ELEMENT_H__
21 #define __GST_V4L2ELEMENT_H__
24 #include <gst/xwindowlistener/xwindowlistener.h>
26 /* Because of some really cool feature in video4linux1, also known as
27 * 'not including sys/types.h and sys/time.h', we had to include it
28 * ourselves. In all their intelligence, these people decided to fix
29 * this in the next version (video4linux2) in such a cool way that it
30 * breaks all compilations of old stuff...
31 * The real problem is actually that linux/time.h doesn't use proper
32 * macro checks before defining types like struct timeval. The proper
33 * fix here is to either fuck the kernel header (which is what we do
34 * by defining _LINUX_TIME_H, an innocent little hack) or by fixing it
35 * upstream, which I'll consider doing later on. If you get compiler
36 * errors here, check your linux/time.h && sys/time.h header setup.
38 #include <sys/types.h>
39 #include <linux/types.h>
41 #include <linux/videodev2.h>
44 #define GST_TYPE_V4L2ELEMENT \
45 (gst_v4l2element_get_type())
46 #define GST_V4L2ELEMENT(obj) \
47 (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_V4L2ELEMENT, GstV4l2Element))
48 #define GST_V4L2ELEMENT_CLASS(klass) \
49 (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_V4L2ELEMENT, GstV4l2ElementClass))
50 #define GST_IS_V4L2ELEMENT(obj) \
51 (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_V4L2ELEMENT))
52 #define GST_IS_V4L2ELEMENT_CLASS(obj) \
53 (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_V4L2ELEMENT))
54 #define GST_V4L2ELEMENT_GET_CLASS(obj) \
55 (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_V4L2ELEMENT, GstV4l2ElementClass))
58 typedef struct _GstV4l2Element GstV4l2Element;
59 typedef struct _GstV4l2ElementClass GstV4l2ElementClass;
61 struct _GstV4l2Element {
64 /* the video device */
67 /* the video-device's file descriptor */
70 /* the video buffer (mmap()'ed) */
73 /* the video-device's capabilities */
74 struct v4l2_capability vcap;
76 /* the toys available to us */
82 GstXWindowListener *overlay;
94 struct _GstV4l2ElementClass {
95 GstElementClass parent_class;
101 void (*open) (GstElement *element,
102 const gchar *device);
103 void (*close) (GstElement *element,
104 const gchar *device);
108 GType gst_v4l2element_get_type (void);
110 #endif /* __GST_V4L2ELEMENT_H__ */