2006-03-11 22:50:03 +00:00
|
|
|
/* GStreamer
|
|
|
|
*
|
|
|
|
* Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
2006-09-02 14:28:55 +00:00
|
|
|
* 2006 Edgard Lima <edgard.lima@indt.org.br>
|
|
|
|
*
|
|
|
|
* gstv4l2src.h: BT8x8/V4L2 source element
|
2002-09-09 07:14:35 +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 __GST_V4L2SRC_H__
|
|
|
|
#define __GST_V4L2SRC_H__
|
|
|
|
|
2006-05-11 17:59:59 +00:00
|
|
|
#include <gstv4l2object.h>
|
2009-08-04 07:14:20 +00:00
|
|
|
#include <gstv4l2bufferpool.h>
|
2002-09-09 07:14:35 +00:00
|
|
|
|
2004-01-12 02:19:57 +00:00
|
|
|
GST_DEBUG_CATEGORY_EXTERN (v4l2src_debug);
|
|
|
|
|
2006-03-11 22:50:03 +00:00
|
|
|
G_BEGIN_DECLS
|
2006-05-18 19:34:47 +00:00
|
|
|
|
2006-09-02 14:45:04 +00:00
|
|
|
#define GST_TYPE_V4L2SRC \
|
2006-03-11 22:50:03 +00:00
|
|
|
(gst_v4l2src_get_type())
|
2006-09-02 14:45:04 +00:00
|
|
|
#define GST_V4L2SRC(obj) \
|
2006-03-11 22:50:03 +00:00
|
|
|
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_V4L2SRC,GstV4l2Src))
|
2006-09-02 14:45:04 +00:00
|
|
|
#define GST_V4L2SRC_CLASS(klass) \
|
2006-03-11 22:50:03 +00:00
|
|
|
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_V4L2SRC,GstV4l2SrcClass))
|
2006-09-02 14:45:04 +00:00
|
|
|
#define GST_IS_V4L2SRC(obj) \
|
2006-03-11 22:50:03 +00:00
|
|
|
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_V4L2SRC))
|
2006-09-02 14:45:04 +00:00
|
|
|
#define GST_IS_V4L2SRC_CLASS(klass) \
|
2006-03-11 22:50:03 +00:00
|
|
|
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_V4L2SRC))
|
2006-05-18 19:34:47 +00:00
|
|
|
|
2006-03-11 22:50:03 +00:00
|
|
|
typedef struct _GstV4l2Src GstV4l2Src;
|
|
|
|
typedef struct _GstV4l2SrcClass GstV4l2SrcClass;
|
|
|
|
|
2009-09-11 19:24:47 +00:00
|
|
|
typedef GstFlowReturn (*GstV4l2SrcGetFunc)(GstV4l2Src * v4l2src, GstBuffer ** buf);
|
2002-09-09 07:14:35 +00:00
|
|
|
|
2006-09-26 14:17:54 +00:00
|
|
|
/**
|
|
|
|
* GstV4l2Src:
|
|
|
|
* @pushsrc: parent #GstPushSrc.
|
|
|
|
*
|
|
|
|
* Opaque object.
|
|
|
|
*/
|
2006-03-11 22:50:03 +00:00
|
|
|
struct _GstV4l2Src
|
|
|
|
{
|
2006-05-11 17:59:59 +00:00
|
|
|
GstPushSrc pushsrc;
|
|
|
|
|
2006-09-26 14:17:54 +00:00
|
|
|
/*< private >*/
|
2006-05-11 17:59:59 +00:00
|
|
|
GstV4l2Object * v4l2object;
|
2004-01-12 02:19:57 +00:00
|
|
|
|
2006-03-11 22:50:03 +00:00
|
|
|
/* pads */
|
sys/v4l2/v4l2src_calls.*: Store the format list in the order that the driver gives it to us.
Original commit message from CVS:
2007-05-30 Andy Wingo <wingo@pobox.com>
* sys/v4l2/v4l2src_calls.h:
* sys/v4l2/v4l2src_calls.c (gst_v4l2src_fill_format_list): Store
the format list in the order that the driver gives it to us.
(gst_v4l2src_probe_caps_for_format_and_size)
(gst_v4l2src_probe_caps_for_format): New functions, fill GstCaps
based on the capabilities of the device.
(gst_v4l2src_grab_frame): Update for object variable renaming.
(gst_v4l2src_set_capture): Update to be strict in its parameters,
as in the set_caps below.
(gst_v4l2src_capture_init): Update for object variable renaming,
and reflow.
(gst_v4l2src_capture_start, gst_v4l2src_capture_stop)
(gst_v4l2src_capture_deinit): Update for object variable renaming.
(gst_v4l2src_update_fps, gst_v4l2src_set_fps)
(gst_v4l2src_get_fps): Remove; these functions don't have much
meaning outside of an atomic set_caps method.
(gst_v4l2src_buffer_new): Don't set buffer duration, it is not
known.
* sys/v4l2/gstv4l2tuner.c (gst_v4l2_tuner_set_channel): Remove
call to update_fps; not sure about this change.
(gst_v4l2_tuner_set_norm): Work around the fact that for the
moment we don't have an update_fps_func.
* sys/v4l2/gstv4l2src.h (struct _GstV4l2Src): Don't put v4l2
structures in the object, just store what we need. Do store the
probed caps of the device. Don't store the current frame rate.
* sys/v4l2/gstv4l2src.c (gst_v4l2src_init): Remove the
update_fps_function, for now. Update for new object variable
naming.
(gst_v4l2src_set_property, gst_v4l2src_get_property): Update for
new object variable naming.
(gst_v4l2src_v4l2fourcc_to_structure): Rename from ..._to_caps.
(gst_v4l2_structure_to_v4l2fourcc): Rename from ...caps_to_....
(gst_v4l2src_get_caps): Rework to probe the device for supported
frame sizes and frame rates.
(gst_v4l2src_set_caps): Rework to be strict in the given
parameters: if someone asks us to have a certain size and rate,
that is what we configure.
(gst_v4l2src_get_read): Update for object variable naming. Don't
leak buffers on short reads.
(gst_v4l2src_get_mmap): Update for object variable naming, and add
comments.
(gst_v4l2src_create): Update for object variable naming.
2007-05-30 14:40:53 +00:00
|
|
|
GstCaps *probed_caps;
|
|
|
|
|
2009-05-26 13:20:35 +00:00
|
|
|
/* buffer handling */
|
2006-03-11 22:50:03 +00:00
|
|
|
GstV4l2BufferPool *pool;
|
2003-05-21 06:33:18 +00:00
|
|
|
|
sys/v4l2/v4l2src_calls.*: Store the format list in the order that the driver gives it to us.
Original commit message from CVS:
2007-05-30 Andy Wingo <wingo@pobox.com>
* sys/v4l2/v4l2src_calls.h:
* sys/v4l2/v4l2src_calls.c (gst_v4l2src_fill_format_list): Store
the format list in the order that the driver gives it to us.
(gst_v4l2src_probe_caps_for_format_and_size)
(gst_v4l2src_probe_caps_for_format): New functions, fill GstCaps
based on the capabilities of the device.
(gst_v4l2src_grab_frame): Update for object variable renaming.
(gst_v4l2src_set_capture): Update to be strict in its parameters,
as in the set_caps below.
(gst_v4l2src_capture_init): Update for object variable renaming,
and reflow.
(gst_v4l2src_capture_start, gst_v4l2src_capture_stop)
(gst_v4l2src_capture_deinit): Update for object variable renaming.
(gst_v4l2src_update_fps, gst_v4l2src_set_fps)
(gst_v4l2src_get_fps): Remove; these functions don't have much
meaning outside of an atomic set_caps method.
(gst_v4l2src_buffer_new): Don't set buffer duration, it is not
known.
* sys/v4l2/gstv4l2tuner.c (gst_v4l2_tuner_set_channel): Remove
call to update_fps; not sure about this change.
(gst_v4l2_tuner_set_norm): Work around the fact that for the
moment we don't have an update_fps_func.
* sys/v4l2/gstv4l2src.h (struct _GstV4l2Src): Don't put v4l2
structures in the object, just store what we need. Do store the
probed caps of the device. Don't store the current frame rate.
* sys/v4l2/gstv4l2src.c (gst_v4l2src_init): Remove the
update_fps_function, for now. Update for new object variable
naming.
(gst_v4l2src_set_property, gst_v4l2src_get_property): Update for
new object variable naming.
(gst_v4l2src_v4l2fourcc_to_structure): Rename from ..._to_caps.
(gst_v4l2_structure_to_v4l2fourcc): Rename from ...caps_to_....
(gst_v4l2src_get_caps): Rework to probe the device for supported
frame sizes and frame rates.
(gst_v4l2src_set_caps): Rework to be strict in the given
parameters: if someone asks us to have a certain size and rate,
that is what we configure.
(gst_v4l2src_get_read): Update for object variable naming. Don't
leak buffers on short reads.
(gst_v4l2src_get_mmap): Update for object variable naming, and add
comments.
(gst_v4l2src_create): Update for object variable naming.
2007-05-30 14:40:53 +00:00
|
|
|
guint32 num_buffers;
|
|
|
|
gboolean use_mmap;
|
|
|
|
guint32 frame_byte_size;
|
2003-05-02 21:16:56 +00:00
|
|
|
|
2007-11-15 12:22:10 +00:00
|
|
|
/* if the buffer will be or not used from directly mmap */
|
|
|
|
gboolean always_copy;
|
|
|
|
|
2006-03-11 22:50:03 +00:00
|
|
|
/* True if we want to stop */
|
sys/v4l2/v4l2src_calls.*: Store the format list in the order that the driver gives it to us.
Original commit message from CVS:
2007-05-30 Andy Wingo <wingo@pobox.com>
* sys/v4l2/v4l2src_calls.h:
* sys/v4l2/v4l2src_calls.c (gst_v4l2src_fill_format_list): Store
the format list in the order that the driver gives it to us.
(gst_v4l2src_probe_caps_for_format_and_size)
(gst_v4l2src_probe_caps_for_format): New functions, fill GstCaps
based on the capabilities of the device.
(gst_v4l2src_grab_frame): Update for object variable renaming.
(gst_v4l2src_set_capture): Update to be strict in its parameters,
as in the set_caps below.
(gst_v4l2src_capture_init): Update for object variable renaming,
and reflow.
(gst_v4l2src_capture_start, gst_v4l2src_capture_stop)
(gst_v4l2src_capture_deinit): Update for object variable renaming.
(gst_v4l2src_update_fps, gst_v4l2src_set_fps)
(gst_v4l2src_get_fps): Remove; these functions don't have much
meaning outside of an atomic set_caps method.
(gst_v4l2src_buffer_new): Don't set buffer duration, it is not
known.
* sys/v4l2/gstv4l2tuner.c (gst_v4l2_tuner_set_channel): Remove
call to update_fps; not sure about this change.
(gst_v4l2_tuner_set_norm): Work around the fact that for the
moment we don't have an update_fps_func.
* sys/v4l2/gstv4l2src.h (struct _GstV4l2Src): Don't put v4l2
structures in the object, just store what we need. Do store the
probed caps of the device. Don't store the current frame rate.
* sys/v4l2/gstv4l2src.c (gst_v4l2src_init): Remove the
update_fps_function, for now. Update for new object variable
naming.
(gst_v4l2src_set_property, gst_v4l2src_get_property): Update for
new object variable naming.
(gst_v4l2src_v4l2fourcc_to_structure): Rename from ..._to_caps.
(gst_v4l2_structure_to_v4l2fourcc): Rename from ...caps_to_....
(gst_v4l2src_get_caps): Rework to probe the device for supported
frame sizes and frame rates.
(gst_v4l2src_set_caps): Rework to be strict in the given
parameters: if someone asks us to have a certain size and rate,
that is what we configure.
(gst_v4l2src_get_read): Update for object variable naming. Don't
leak buffers on short reads.
(gst_v4l2src_get_mmap): Update for object variable naming, and add
comments.
(gst_v4l2src_create): Update for object variable naming.
2007-05-30 14:40:53 +00:00
|
|
|
gboolean quit;
|
|
|
|
gboolean is_capturing;
|
2003-05-02 21:16:56 +00:00
|
|
|
|
2006-09-15 19:11:00 +00:00
|
|
|
guint64 offset;
|
2007-09-05 14:43:16 +00:00
|
|
|
|
|
|
|
gint fps_d, fps_n; /* framerate if device is open */
|
2009-09-11 19:24:47 +00:00
|
|
|
|
|
|
|
GstV4l2SrcGetFunc get_frame;
|
2006-03-11 22:50:03 +00:00
|
|
|
};
|
2003-05-02 21:16:56 +00:00
|
|
|
|
2006-03-11 22:50:03 +00:00
|
|
|
struct _GstV4l2SrcClass
|
|
|
|
{
|
2006-05-11 17:59:59 +00:00
|
|
|
GstPushSrcClass parent_class;
|
|
|
|
|
|
|
|
GList *v4l2_class_devices;
|
2002-09-09 07:14:35 +00:00
|
|
|
};
|
|
|
|
|
2006-03-11 22:50:03 +00:00
|
|
|
GType gst_v4l2src_get_type (void);
|
|
|
|
|
|
|
|
G_END_DECLS
|
2006-09-26 13:18:06 +00:00
|
|
|
|
2002-09-09 07:14:35 +00:00
|
|
|
#endif /* __GST_V4L2SRC_H__ */
|