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 {
48 GstAtomicInt refcount; /* number of users: 1 for every buffer, 1 for element */
51 GstV4l2Buffer * buffers;
54 struct _GstV4l2Buffer {
55 struct v4l2_buffer buffer;
58 GstAtomicInt refcount; /* add 1 if in use by element, add 1 if in use by GstBuffer */
59 GstV4l2BufferPool * pool;
63 GstV4l2Element v4l2element;
69 GSList *formats; /* list of available capture formats */
72 GstV4l2BufferPool *pool;
74 struct v4l2_requestbuffers breq;
75 struct v4l2_format format;
77 /* True if we want to stop */
80 /* A/V sync... frame counter and internal cache */
83 GstBuffer *cached_buffer;
89 /* time to substract from clock time to get back to timestamp */
90 GstClockTime substract_time;
92 /* how are we going to push buffers? */
93 gboolean use_fixed_fps;
96 struct _GstV4l2SrcClass {
97 GstV4l2ElementClass parent_class;
99 void (*frame_capture) (GObject *object);
100 void (*frame_drop) (GObject *object);
101 void (*frame_insert) (GObject *object);
102 void (*frame_lost) (GObject *object,
107 GType gst_v4l2src_get_type(void);
109 #endif /* __GST_V4L2SRC_H__ */