2004-06-15 09:11:06 +00:00
|
|
|
/* GStreamer
|
|
|
|
*
|
|
|
|
* v4l_calls.h: header for generic V4L calls
|
|
|
|
*
|
2002-01-31 22:22:42 +00:00
|
|
|
* Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
2001-12-23 15:31:15 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __V4L_CALLS_H__
|
|
|
|
#define __V4L_CALLS_H__
|
|
|
|
|
|
|
|
#include "gstv4lelement.h"
|
2004-01-19 13:50:39 +00:00
|
|
|
#include "gst/gst-i18n-plugin.h"
|
2001-12-23 15:31:15 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
2004-03-15 16:32:55 +00:00
|
|
|
extern "C" {
|
|
|
|
#endif /* __cplusplus */
|
2001-12-23 15:31:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* simple check whether the device is open */
|
2004-01-19 17:11:27 +00:00
|
|
|
#define GST_V4L_IS_OPEN(element) \
|
|
|
|
(element->video_fd > 0)
|
2001-12-23 15:31:15 +00:00
|
|
|
|
|
|
|
/* check whether the device is 'active' */
|
2004-01-19 17:11:27 +00:00
|
|
|
#define GST_V4L_IS_ACTIVE(element) \
|
|
|
|
(element->buffer != NULL)
|
2001-12-23 15:31:15 +00:00
|
|
|
|
2004-01-19 17:11:27 +00:00
|
|
|
#define GST_V4L_IS_OVERLAY(element) \
|
|
|
|
(element->vcap.type & VID_TYPE_OVERLAY)
|
2002-02-23 14:05:33 +00:00
|
|
|
|
2001-12-23 15:31:15 +00:00
|
|
|
/* checks whether the current v4lelement has already been open()'ed or not */
|
2004-01-19 17:11:27 +00:00
|
|
|
#define GST_V4L_CHECK_OPEN(element) \
|
|
|
|
if (element->video_fd <= 0) \
|
2004-01-18 21:46:58 +00:00
|
|
|
{ \
|
2004-01-29 23:20:45 +00:00
|
|
|
GST_ELEMENT_ERROR (element, RESOURCE, TOO_LAZY, \
|
2004-02-02 17:23:33 +00:00
|
|
|
(_("Device is not open.")), (NULL)); \
|
2004-01-18 21:46:58 +00:00
|
|
|
return FALSE; \
|
2001-12-23 15:31:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* checks whether the current v4lelement is close()'ed or whether it is still open */
|
2004-01-19 17:11:27 +00:00
|
|
|
#define GST_V4L_CHECK_NOT_OPEN(element) \
|
|
|
|
if (element->video_fd != -1) \
|
|
|
|
{ \
|
2004-01-29 23:20:45 +00:00
|
|
|
GST_ELEMENT_ERROR (element, RESOURCE, TOO_LAZY, \
|
2004-02-02 17:23:33 +00:00
|
|
|
(_("Device is open.")), (NULL)); \
|
2004-01-18 21:46:58 +00:00
|
|
|
return FALSE; \
|
2001-12-23 15:31:15 +00:00
|
|
|
}
|
|
|
|
|
2002-02-23 14:05:33 +00:00
|
|
|
/* checks whether the current v4lelement does video overlay */
|
2004-01-19 17:11:27 +00:00
|
|
|
#define GST_V4L_CHECK_OVERLAY(element) \
|
|
|
|
if (!(element->vcap.type & VID_TYPE_OVERLAY)) \
|
|
|
|
{ \
|
2004-01-29 23:20:45 +00:00
|
|
|
GST_ELEMENT_ERROR (element, RESOURCE, TOO_LAZY, \
|
2004-02-02 17:23:33 +00:00
|
|
|
(NULL), ("Device cannot handle overlay")); \
|
2004-01-18 21:46:58 +00:00
|
|
|
return FALSE; \
|
2002-02-23 14:05:33 +00:00
|
|
|
}
|
|
|
|
|
2001-12-23 15:31:15 +00:00
|
|
|
/* checks whether we're in capture mode or not */
|
2004-01-19 17:11:27 +00:00
|
|
|
#define GST_V4L_CHECK_ACTIVE(element) \
|
|
|
|
if (element->buffer == NULL) \
|
|
|
|
{ \
|
2004-01-29 23:20:45 +00:00
|
|
|
GST_ELEMENT_ERROR (element, RESOURCE, SETTINGS, \
|
2004-02-02 17:23:33 +00:00
|
|
|
(NULL), ("Device is not in streaming mode")); \
|
2004-01-19 17:11:27 +00:00
|
|
|
return FALSE; \
|
2001-12-23 15:31:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* checks whether we're out of capture mode or not */
|
2004-01-19 17:11:27 +00:00
|
|
|
#define GST_V4L_CHECK_NOT_ACTIVE(element) \
|
|
|
|
if (element->buffer != NULL) \
|
|
|
|
{ \
|
2004-01-29 23:20:45 +00:00
|
|
|
GST_ELEMENT_ERROR (element, RESOURCE, SETTINGS, \
|
2004-02-02 17:23:33 +00:00
|
|
|
(NULL), ("Device is in streaming mode")); \
|
2004-01-19 17:11:27 +00:00
|
|
|
return FALSE; \
|
2001-12-23 15:31:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-03-15 16:32:55 +00:00
|
|
|
typedef enum {
|
|
|
|
V4L_PICTURE_HUE = 0,
|
|
|
|
V4L_PICTURE_BRIGHTNESS,
|
|
|
|
V4L_PICTURE_CONTRAST,
|
|
|
|
V4L_PICTURE_SATURATION,
|
|
|
|
} GstV4lPictureType;
|
2001-12-23 15:31:15 +00:00
|
|
|
|
2004-03-15 16:32:55 +00:00
|
|
|
typedef enum {
|
|
|
|
V4L_AUDIO_VOLUME = 0,
|
|
|
|
V4L_AUDIO_MUTE,
|
|
|
|
V4L_AUDIO_MODE, /* stereo, mono, ... (see videodev.h) */
|
|
|
|
} GstV4lAudioType;
|
2001-12-23 15:31:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* open/close the device */
|
2004-03-15 16:32:55 +00:00
|
|
|
gboolean gst_v4l_open (GstV4lElement *v4lelement);
|
|
|
|
gboolean gst_v4l_close (GstV4lElement *v4lelement);
|
2001-12-23 15:31:15 +00:00
|
|
|
|
|
|
|
/* norm control (norm = VIDEO_MODE_{PAL|NTSC|SECAM|AUTO}) */
|
2004-03-15 16:32:55 +00:00
|
|
|
gboolean gst_v4l_get_chan_norm (GstV4lElement *v4lelement,
|
|
|
|
gint *channel,
|
|
|
|
gint *norm);
|
|
|
|
gboolean gst_v4l_set_chan_norm (GstV4lElement *v4lelement,
|
|
|
|
gint channel,
|
|
|
|
gint norm);
|
|
|
|
GList *gst_v4l_get_chan_names (GstV4lElement *v4lelement);
|
2001-12-23 15:31:15 +00:00
|
|
|
|
|
|
|
/* frequency control */
|
2004-03-15 16:32:55 +00:00
|
|
|
gboolean gst_v4l_get_signal (GstV4lElement *v4lelement,
|
|
|
|
gint tunernum,
|
|
|
|
guint *signal);
|
|
|
|
gboolean gst_v4l_get_frequency (GstV4lElement *v4lelement,
|
|
|
|
gint tunernum,
|
|
|
|
gulong *frequency);
|
|
|
|
gboolean gst_v4l_set_frequency (GstV4lElement *v4lelement,
|
|
|
|
gint tunernum,
|
|
|
|
gulong frequency);
|
2001-12-23 15:31:15 +00:00
|
|
|
|
|
|
|
/* picture control */
|
2004-03-15 16:32:55 +00:00
|
|
|
gboolean gst_v4l_get_picture (GstV4lElement *v4lelement,
|
|
|
|
GstV4lPictureType type,
|
|
|
|
gint *value);
|
2004-06-15 09:11:06 +00:00
|
|
|
gboolean gst_v4l_set_picture (GstV4lElement *v4lelement,
|
2004-03-15 16:32:55 +00:00
|
|
|
GstV4lPictureType type,
|
|
|
|
gint value);
|
2001-12-23 15:31:15 +00:00
|
|
|
|
|
|
|
/* audio control */
|
2004-03-15 16:32:55 +00:00
|
|
|
gboolean gst_v4l_get_audio (GstV4lElement *v4lelement,
|
|
|
|
gint audionum,
|
|
|
|
GstV4lAudioType type,
|
|
|
|
gint *value);
|
|
|
|
gboolean gst_v4l_set_audio (GstV4lElement *v4lelement,
|
|
|
|
gint audionum,
|
|
|
|
GstV4lAudioType type,
|
|
|
|
gint value);
|
2002-02-23 14:05:33 +00:00
|
|
|
|
|
|
|
/* overlay */
|
2004-03-15 16:32:55 +00:00
|
|
|
gboolean gst_v4l_set_overlay (GstV4lElement *v4lelement);
|
|
|
|
gboolean gst_v4l_set_window (GstElement *element,
|
|
|
|
gint x, gint y,
|
|
|
|
gint w, gint h,
|
|
|
|
struct video_clip *clips,
|
|
|
|
gint num_clips);
|
|
|
|
gboolean gst_v4l_enable_overlay (GstV4lElement *v4lelement,
|
|
|
|
gboolean enable);
|
2001-12-23 15:31:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
2004-03-15 16:32:55 +00:00
|
|
|
#endif /* __cplusplus */
|
2001-12-23 15:31:15 +00:00
|
|
|
|
2004-03-15 16:32:55 +00:00
|
|
|
#endif /* __V4L_CALLS_H__ */
|