2009-08-04 07:14:20 +00:00
|
|
|
/* GStreamer
|
|
|
|
*
|
|
|
|
* Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
2017-02-26 00:47:03 +00:00
|
|
|
* 2006 Edgard Lima <edgard.lima@gmail.com>
|
2009-08-04 07:14:20 +00:00
|
|
|
* 2009 Texas Instruments, Inc - http://www.ti.com/
|
|
|
|
*
|
2010-01-18 12:55:38 +00:00
|
|
|
* gstv4l2bufferpool.h V4L2 buffer pool class
|
2009-08-04 07:14:20 +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
|
2012-11-04 00:07:18 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2009-08-04 07:14:20 +00:00
|
|
|
*/
|
|
|
|
|
2011-07-13 14:33:58 +00:00
|
|
|
#ifndef __GST_V4L2_BUFFER_POOL_H__
|
|
|
|
#define __GST_V4L2_BUFFER_POOL_H__
|
2009-08-04 07:14:20 +00:00
|
|
|
|
|
|
|
#include <gst/gst.h>
|
2011-07-13 14:33:58 +00:00
|
|
|
|
|
|
|
typedef struct _GstV4l2BufferPool GstV4l2BufferPool;
|
|
|
|
typedef struct _GstV4l2BufferPoolClass GstV4l2BufferPoolClass;
|
2011-10-31 01:24:04 +00:00
|
|
|
typedef struct _GstV4l2Meta GstV4l2Meta;
|
2011-07-13 14:33:58 +00:00
|
|
|
|
|
|
|
#include "gstv4l2object.h"
|
2014-04-05 02:46:40 +00:00
|
|
|
#include "gstv4l2allocator.h"
|
2009-08-04 07:14:20 +00:00
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2011-08-04 11:50:01 +00:00
|
|
|
#define GST_TYPE_V4L2_BUFFER_POOL (gst_v4l2_buffer_pool_get_type())
|
|
|
|
#define GST_IS_V4L2_BUFFER_POOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_V4L2_BUFFER_POOL))
|
|
|
|
#define GST_V4L2_BUFFER_POOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_V4L2_BUFFER_POOL, GstV4l2BufferPool))
|
|
|
|
#define GST_V4L2_BUFFER_POOL_CAST(obj) ((GstV4l2BufferPool*)(obj))
|
2009-08-04 07:14:20 +00:00
|
|
|
|
2014-11-16 17:34:17 +00:00
|
|
|
/* This flow return is used to indicated that the last buffer of a
|
|
|
|
* drain or a resoltuion change has been found. This should normally
|
|
|
|
* only occure for mem-2-mem devices. */
|
|
|
|
#define GST_V4L2_FLOW_LAST_BUFFER GST_FLOW_CUSTOM_SUCCESS
|
|
|
|
|
|
|
|
/* This flow return is used to indicated that the returned buffer was marked
|
|
|
|
* with the error flag and had no payload. This error should be recovered by
|
|
|
|
* simply waiting for next buffer. */
|
|
|
|
#define GST_V4L2_FLOW_CORRUPTED_BUFFER GST_FLOW_CUSTOM_SUCCESS_1
|
|
|
|
|
2009-08-04 07:14:20 +00:00
|
|
|
struct _GstV4l2BufferPool
|
|
|
|
{
|
2011-07-15 09:27:18 +00:00
|
|
|
GstBufferPool parent;
|
2009-08-04 07:14:20 +00:00
|
|
|
|
2011-07-15 12:07:11 +00:00
|
|
|
GstV4l2Object *obj; /* the v4l2 object */
|
2011-07-15 09:27:18 +00:00
|
|
|
gint video_fd; /* a dup(2) of the v4l2object's video_fd */
|
2014-05-25 00:20:07 +00:00
|
|
|
GstPoll *poll; /* a poll for video_fd */
|
2014-07-03 19:29:54 +00:00
|
|
|
GstPollFD pollfd;
|
2014-05-25 00:20:07 +00:00
|
|
|
gboolean can_poll_device;
|
2009-08-04 07:14:20 +00:00
|
|
|
|
2014-07-03 19:28:45 +00:00
|
|
|
gboolean empty;
|
|
|
|
GCond empty_cond;
|
|
|
|
|
2019-01-24 15:12:13 +00:00
|
|
|
gboolean orphaned;
|
|
|
|
|
2014-04-05 02:46:40 +00:00
|
|
|
GstV4l2Allocator *vallocator;
|
2011-07-18 16:54:49 +00:00
|
|
|
GstAllocator *allocator;
|
2012-03-15 12:36:17 +00:00
|
|
|
GstAllocationParams params;
|
2014-04-11 21:10:11 +00:00
|
|
|
GstBufferPool *other_pool;
|
2011-07-18 16:54:49 +00:00
|
|
|
guint size;
|
2014-05-12 22:03:18 +00:00
|
|
|
GstVideoInfo caps_info; /* Default video information */
|
2014-04-05 02:46:40 +00:00
|
|
|
|
2014-05-06 16:58:59 +00:00
|
|
|
gboolean add_videometa; /* set if video meta should be added */
|
2015-02-20 04:12:31 +00:00
|
|
|
gboolean enable_copy_threshold; /* If copy_threshold should be set */
|
2011-07-15 09:27:18 +00:00
|
|
|
|
2014-05-25 03:31:24 +00:00
|
|
|
guint min_latency; /* number of buffers we will hold */
|
|
|
|
guint max_latency; /* number of buffers we can hold */
|
2011-07-25 13:47:05 +00:00
|
|
|
guint num_queued; /* number of buffers queued in the driver */
|
2012-04-23 16:01:31 +00:00
|
|
|
guint copy_threshold; /* when our pool runs lower, start handing out copies */
|
2011-07-15 09:27:18 +00:00
|
|
|
|
2011-07-18 16:54:49 +00:00
|
|
|
gboolean streaming;
|
2014-05-04 23:51:48 +00:00
|
|
|
gboolean flushing;
|
2011-07-18 16:54:49 +00:00
|
|
|
|
2014-04-05 02:46:40 +00:00
|
|
|
GstBuffer *buffers[VIDEO_MAX_FRAME];
|
|
|
|
|
|
|
|
/* signal handlers */
|
|
|
|
gulong group_released_handler;
|
2015-03-01 18:46:18 +00:00
|
|
|
|
|
|
|
/* Control to warn only once on buggy feild driver bug */
|
|
|
|
gboolean has_warned_on_buggy_field;
|
2009-08-04 07:14:20 +00:00
|
|
|
};
|
|
|
|
|
2011-07-11 10:04:57 +00:00
|
|
|
struct _GstV4l2BufferPoolClass
|
|
|
|
{
|
2011-07-15 09:27:18 +00:00
|
|
|
GstBufferPoolClass parent_class;
|
2011-07-11 10:04:57 +00:00
|
|
|
};
|
|
|
|
|
2011-07-15 09:27:18 +00:00
|
|
|
GType gst_v4l2_buffer_pool_get_type (void);
|
2011-07-14 14:12:15 +00:00
|
|
|
|
2011-08-04 11:50:01 +00:00
|
|
|
GstBufferPool * gst_v4l2_buffer_pool_new (GstV4l2Object *obj, GstCaps *caps);
|
2011-07-14 14:12:15 +00:00
|
|
|
|
2014-04-29 17:05:41 +00:00
|
|
|
GstFlowReturn gst_v4l2_buffer_pool_process (GstV4l2BufferPool * bpool, GstBuffer ** buf);
|
2009-08-04 07:14:20 +00:00
|
|
|
|
2014-04-11 21:10:11 +00:00
|
|
|
void gst_v4l2_buffer_pool_set_other_pool (GstV4l2BufferPool * pool,
|
|
|
|
GstBufferPool * other_pool);
|
2015-02-20 04:12:31 +00:00
|
|
|
void gst_v4l2_buffer_pool_copy_at_threshold (GstV4l2BufferPool * pool,
|
|
|
|
gboolean copy);
|
2013-12-18 18:37:23 +00:00
|
|
|
|
2017-08-05 16:23:30 +00:00
|
|
|
gboolean gst_v4l2_buffer_pool_flush (GstBufferPool *pool);
|
|
|
|
|
2019-01-24 15:12:13 +00:00
|
|
|
gboolean gst_v4l2_buffer_pool_orphan (GstBufferPool ** pool);
|
|
|
|
|
2010-01-18 12:57:42 +00:00
|
|
|
G_END_DECLS
|
|
|
|
|
2011-07-13 14:33:58 +00:00
|
|
|
#endif /*__GST_V4L2_BUFFER_POOL_H__ */
|