1 /* G-Streamer generic V4L2 element - generic V4L2 calls handling
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 __V4L2_CALLS_H__
21 #define __V4L2_CALLS_H__
23 #include "gstv4l2element.h"
24 #include "gst/gst-i18n-plugin.h"
27 /* simple check whether the device is open */
28 #define GST_V4L2_IS_OPEN(element) \
29 (element->video_fd > 0)
31 /* check whether the device is 'active' */
32 #define GST_V4L2_IS_ACTIVE(element) \
33 (element->buffer != NULL)
35 #define GST_V4L2_IS_OVERLAY(element) \
36 (element->vcap.capabilities & V4L2_CAP_VIDEO_OVERLAY)
38 /* checks whether the current v4lelement has already been open()'ed or not */
39 #define GST_V4L2_CHECK_OPEN(element) \
40 if (!GST_V4L2_IS_OPEN(element)) \
42 GST_ELEMENT_ERROR (element, RESOURCE, TOO_LAZY, \
43 (_("Device is not open")), NULL); \
47 /* checks whether the current v4lelement is close()'ed or whether it is still open */
48 #define GST_V4L2_CHECK_NOT_OPEN(element) \
49 if (GST_V4L2_IS_OPEN(element)) \
51 GST_ELEMENT_ERROR (element, RESOURCE, TOO_LAZY, \
52 (_("Device is open")), NULL); \
56 /* checks whether the current v4lelement does video overlay */
57 #define GST_V4L2_CHECK_OVERLAY(element) \
58 if (!GST_V4L2_IS_OVERLAY(element)) \
60 GST_ELEMENT_ERROR (element, RESOURCE, TOO_LAZY, \
61 NULL, ("Device cannot handle overlay")); \
65 /* checks whether we're in capture mode or not */
66 #define GST_V4L2_CHECK_ACTIVE(element) \
67 if (!GST_V4L2_IS_ACTIVE(element)) \
69 GST_ELEMENT_ERROR (element, RESOURCE, SETTINGS, \
70 NULL, ("Device is not in streaming mode")); \
74 /* checks whether we're out of capture mode or not */
75 #define GST_V4L2_CHECK_NOT_ACTIVE(element) \
76 if (GST_V4L2_IS_ACTIVE(element)) \
78 GST_ELEMENT_ERROR (element, RESOURCE, SETTINGS, \
79 NULL, ("Device is in streaming mode")); \
84 /* open/close the device */
85 gboolean gst_v4l2_open (GstV4l2Element *v4l2element);
86 gboolean gst_v4l2_close (GstV4l2Element *v4l2element);
88 /* norm/input/output */
89 gboolean gst_v4l2_get_norm (GstV4l2Element *v4l2element,
91 gboolean gst_v4l2_set_norm (GstV4l2Element *v4l2element,
93 gboolean gst_v4l2_get_input (GstV4l2Element *v4l2element,
95 gboolean gst_v4l2_set_input (GstV4l2Element *v4l2element,
97 gboolean gst_v4l2_get_output (GstV4l2Element *v4l2element,
99 gboolean gst_v4l2_set_output (GstV4l2Element *v4l2element,
102 /* frequency control */
103 gboolean gst_v4l2_get_frequency (GstV4l2Element *v4l2element,
106 gboolean gst_v4l2_set_frequency (GstV4l2Element *v4l2element,
109 gboolean gst_v4l2_signal_strength (GstV4l2Element *v4l2element,
113 /* attribute control */
114 gboolean gst_v4l2_get_attribute (GstV4l2Element *v4l2element,
117 gboolean gst_v4l2_set_attribute (GstV4l2Element *v4l2element,
122 gboolean gst_v4l2_set_display (GstV4l2Element *v4l2element);
123 gboolean gst_v4l2_set_window (GstElement *element,
126 struct v4l2_clip *clips,
128 gboolean gst_v4l2_enable_overlay (GstV4l2Element *v4l2element,
131 #endif /* __V4L2_CALLS_H__ */