1 /* G-Streamer Video4linux2 video-capture plugin
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_V4L2SRC_H__
21 #define __GST_V4L2SRC_H__
23 #include <gstv4l2element.h>
25 GST_DEBUG_CATEGORY_EXTERN (v4l2src_debug);
27 #define GST_V4L2_MAX_BUFFERS 16
28 #define GST_V4L2_MIN_BUFFERS 2
30 #define GST_TYPE_V4L2SRC \
31 (gst_v4l2src_get_type())
32 #define GST_V4L2SRC(obj) \
33 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_V4L2SRC,GstV4l2Src))
34 #define GST_V4L2SRC_CLASS(klass) \
35 (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_V4L2SRC,GstV4l2SrcClass))
36 #define GST_IS_V4L2SRC(obj) \
37 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_V4L2SRC))
38 #define GST_IS_V4L2SRC_CLASS(obj) \
39 (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_V4L2SRC))
41 typedef struct _GstV4l2BufferPool GstV4l2BufferPool;
42 typedef struct _GstV4l2Buffer GstV4l2Buffer;
43 typedef struct _GstV4l2Src GstV4l2Src;
44 typedef struct _GstV4l2SrcClass GstV4l2SrcClass;
47 struct _GstV4l2BufferPool
49 GstAtomicInt refcount; /* number of users: 1 for every buffer, 1 for element */
52 GstV4l2Buffer *buffers;
57 struct v4l2_buffer buffer;
60 GstAtomicInt refcount; /* add 1 if in use by element, add 1 if in use by GstBuffer */
61 GstV4l2BufferPool *pool;
66 GstV4l2Element v4l2element;
72 GSList *formats; /* list of available capture formats */
75 GstV4l2BufferPool *pool;
77 struct v4l2_requestbuffers breq;
78 struct v4l2_format format;
80 /* True if we want to stop */
83 /* A/V sync... frame counter and internal cache */
86 GstBuffer *cached_buffer;
92 /* time to substract from clock time to get back to timestamp */
93 GstClockTime substract_time;
95 /* how are we going to push buffers? */
96 gboolean use_fixed_fps;
99 struct _GstV4l2SrcClass
101 GstV4l2ElementClass parent_class;
103 void (*frame_capture) (GObject * object);
104 void (*frame_drop) (GObject * object);
105 void (*frame_insert) (GObject * object);
106 void (*frame_lost) (GObject * object, gint num_lost);
110 GType gst_v4l2src_get_type (void);
112 #endif /* __GST_V4L2SRC_H__ */