2009-08-04 07:14:20 +00:00
|
|
|
/* GStreamer
|
|
|
|
*
|
|
|
|
* Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
|
|
|
* 2006 Edgard Lima <edgard.lima@indt.org.br>
|
|
|
|
* 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
|
|
|
|
|
|
|
GST_DEBUG_CATEGORY_EXTERN (v4l2buffer_debug);
|
|
|
|
|
|
|
|
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-04-15 17:20:12 +00:00
|
|
|
#define GST_V4L2_BUFFER_POOL_OPTION_CROP_META "GstV4l2BufferPoolOptionCropMeta"
|
|
|
|
|
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 */
|
2009-08-04 07:14:20 +00:00
|
|
|
|
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-04-05 02:46:40 +00:00
|
|
|
|
2011-07-27 11:41:28 +00:00
|
|
|
gboolean add_videometa;
|
2014-04-15 19:07:23 +00:00
|
|
|
gboolean add_cropmeta;
|
2011-07-15 09:27:18 +00:00
|
|
|
|
2012-04-23 16:01:31 +00:00
|
|
|
guint num_buffers; /* number of buffers we use */
|
2011-07-25 13:47:05 +00:00
|
|
|
guint num_allocated; /* number of buffers allocated by the driver */
|
|
|
|
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-04-05 02:46:40 +00:00
|
|
|
GstBuffer *buffers[VIDEO_MAX_FRAME];
|
|
|
|
|
|
|
|
/* signal handlers */
|
|
|
|
gulong group_released_handler;
|
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
|
|
|
|
2011-07-27 14:46:46 +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
|
|
|
gboolean gst_v4l2_buffer_pool_flush (GstV4l2BufferPool * pool);
|
|
|
|
|
|
|
|
void gst_v4l2_buffer_pool_set_other_pool (GstV4l2BufferPool * pool,
|
|
|
|
GstBufferPool * other_pool);
|
2013-12-18 18:37:23 +00:00
|
|
|
|
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__ */
|