3 * v4l_calls.h: header for generic V4L calls
5 * Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
23 #ifndef __V4L_CALLS_H__
24 #define __V4L_CALLS_H__
26 #include "gstv4lelement.h"
27 #include "gst/gst-i18n-plugin.h"
33 /* simple check whether the device is open */
34 #define GST_V4L_IS_OPEN(element) \
35 (GST_V4LELEMENT (element)->video_fd > 0)
37 /* check whether the device is 'active' */
38 #define GST_V4L_IS_ACTIVE(element) \
39 (GST_V4LELEMENT (element)->buffer != NULL)
41 #define GST_V4L_IS_OVERLAY(element) \
42 (GST_V4LELEMENT (element)->vcap.type & VID_TYPE_OVERLAY)
44 /* checks whether the current v4lelement has already been open()'ed or not */
45 #define GST_V4L_CHECK_OPEN(element) \
46 if (!GST_V4L_IS_OPEN (element)) \
48 GST_ELEMENT_ERROR (element, RESOURCE, TOO_LAZY, \
49 (_("Device is not open.")), (NULL)); \
53 /* checks whether the current v4lelement is close()'ed or whether it is still open */
54 #define GST_V4L_CHECK_NOT_OPEN(element) \
55 if (GST_V4L_IS_OPEN (element)) \
57 GST_ELEMENT_ERROR (element, RESOURCE, TOO_LAZY, \
58 (_("Device is open.")), (NULL)); \
62 /* checks whether the current v4lelement does video overlay */
63 #define GST_V4L_CHECK_OVERLAY(element) \
64 if (!(element->vcap.type & VID_TYPE_OVERLAY)) \
66 GST_ELEMENT_ERROR (element, RESOURCE, TOO_LAZY, \
67 (NULL), ("Device cannot handle overlay")); \
71 /* checks whether we're in capture mode or not */
72 #define GST_V4L_CHECK_ACTIVE(element) \
73 if (!GST_V4L_IS_ACTIVE (element)) \
75 GST_ELEMENT_ERROR (element, RESOURCE, SETTINGS, \
76 (NULL), ("Device is not in streaming mode")); \
80 /* checks whether we're out of capture mode or not */
81 #define GST_V4L_CHECK_NOT_ACTIVE(element) \
82 if (GST_V4L_IS_ACTIVE (element)) \
84 GST_ELEMENT_ERROR (element, RESOURCE, SETTINGS, \
85 (NULL), ("Device is in streaming mode")); \
92 V4L_PICTURE_BRIGHTNESS,
94 V4L_PICTURE_SATURATION,
100 V4L_AUDIO_MODE, /* stereo, mono, ... (see videodev.h) */
104 /* open/close the device */
105 gboolean gst_v4l_open (GstV4lElement *v4lelement);
106 gboolean gst_v4l_close (GstV4lElement *v4lelement);
108 /* norm control (norm = VIDEO_MODE_{PAL|NTSC|SECAM|AUTO}) */
109 gboolean gst_v4l_get_chan_norm (GstV4lElement *v4lelement,
112 gboolean gst_v4l_set_chan_norm (GstV4lElement *v4lelement,
115 GList *gst_v4l_get_chan_names (GstV4lElement *v4lelement);
117 /* frequency control */
118 gboolean gst_v4l_get_signal (GstV4lElement *v4lelement,
121 gboolean gst_v4l_get_frequency (GstV4lElement *v4lelement,
124 gboolean gst_v4l_set_frequency (GstV4lElement *v4lelement,
128 /* picture control */
129 gboolean gst_v4l_get_picture (GstV4lElement *v4lelement,
130 GstV4lPictureType type,
132 gboolean gst_v4l_set_picture (GstV4lElement *v4lelement,
133 GstV4lPictureType type,
137 gboolean gst_v4l_get_audio (GstV4lElement *v4lelement,
139 GstV4lAudioType type,
141 gboolean gst_v4l_set_audio (GstV4lElement *v4lelement,
143 GstV4lAudioType type,
146 /* functions that v4lsrc needs */
147 gboolean gst_v4l_set_window_properties (GstV4lElement * v4lelement);
148 gboolean gst_v4l_get_capabilities (GstV4lElement * v4lelement);
154 #endif /* __V4L_CALLS_H__ */