Blame sys/v4l2/gstv4l2bufferpool.h

Packit 1f69a5
/* GStreamer
Packit 1f69a5
 *
Packit 1f69a5
 * Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
Packit 1f69a5
 *               2006 Edgard Lima <edgard.lima@gmail.com>
Packit 1f69a5
 *               2009 Texas Instruments, Inc - http://www.ti.com/
Packit 1f69a5
 *
Packit 1f69a5
 * gstv4l2bufferpool.h V4L2 buffer pool class
Packit 1f69a5
 *
Packit 1f69a5
 * This library is free software; you can redistribute it and/or
Packit 1f69a5
 * modify it under the terms of the GNU Library General Public
Packit 1f69a5
 * License as published by the Free Software Foundation; either
Packit 1f69a5
 * version 2 of the License, or (at your option) any later version.
Packit 1f69a5
 *
Packit 1f69a5
 * This library is distributed in the hope that it will be useful,
Packit 1f69a5
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 1f69a5
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 1f69a5
 * Library General Public License for more details.
Packit 1f69a5
 *
Packit 1f69a5
 * You should have received a copy of the GNU Library General Public
Packit 1f69a5
 * License along with this library; if not, write to the
Packit 1f69a5
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Packit 1f69a5
 * Boston, MA 02110-1301, USA.
Packit 1f69a5
 */
Packit 1f69a5
Packit 1f69a5
#ifndef __GST_V4L2_BUFFER_POOL_H__
Packit 1f69a5
#define __GST_V4L2_BUFFER_POOL_H__
Packit 1f69a5
Packit 1f69a5
#include <gst/gst.h>
Packit 1f69a5
Packit 1f69a5
typedef struct _GstV4l2BufferPool GstV4l2BufferPool;
Packit 1f69a5
typedef struct _GstV4l2BufferPoolClass GstV4l2BufferPoolClass;
Packit 1f69a5
typedef struct _GstV4l2Meta GstV4l2Meta;
Packit 1f69a5
Packit 1f69a5
#include "gstv4l2object.h"
Packit 1f69a5
#include "gstv4l2allocator.h"
Packit 1f69a5
Packit 1f69a5
G_BEGIN_DECLS
Packit 1f69a5
Packit 1f69a5
#define GST_TYPE_V4L2_BUFFER_POOL      (gst_v4l2_buffer_pool_get_type())
Packit 1f69a5
#define GST_IS_V4L2_BUFFER_POOL(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_V4L2_BUFFER_POOL))
Packit 1f69a5
#define GST_V4L2_BUFFER_POOL(obj)      (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_V4L2_BUFFER_POOL, GstV4l2BufferPool))
Packit 1f69a5
#define GST_V4L2_BUFFER_POOL_CAST(obj) ((GstV4l2BufferPool*)(obj))
Packit 1f69a5
Packit 1f69a5
/* This flow return is used to indicated that the last buffer of a
Packit 1f69a5
 * drain or a resoltuion change has been found. This should normally
Packit 1f69a5
 * only occure for mem-2-mem devices. */
Packit 1f69a5
#define GST_V4L2_FLOW_LAST_BUFFER GST_FLOW_CUSTOM_SUCCESS
Packit 1f69a5
Packit 1f69a5
/* This flow return is used to indicated that the returned buffer was marked
Packit 1f69a5
 * with the error flag and had no payload. This error should be recovered by
Packit 1f69a5
 * simply waiting for next buffer. */
Packit 1f69a5
#define GST_V4L2_FLOW_CORRUPTED_BUFFER GST_FLOW_CUSTOM_SUCCESS_1
Packit 1f69a5
Packit 1f69a5
struct _GstV4l2BufferPool
Packit 1f69a5
{
Packit 1f69a5
  GstBufferPool parent;
Packit 1f69a5
Packit 1f69a5
  GstV4l2Object *obj;        /* the v4l2 object */
Packit 1f69a5
  gint video_fd;             /* a dup(2) of the v4l2object's video_fd */
Packit 1f69a5
  GstPoll *poll;             /* a poll for video_fd */
Packit 1f69a5
  GstPollFD pollfd;
Packit 1f69a5
  gboolean can_poll_device;
Packit 1f69a5
Packit 1f69a5
  gboolean empty;
Packit 1f69a5
  GCond empty_cond;
Packit 1f69a5
Packit 1f69a5
  GstV4l2Allocator *vallocator;
Packit 1f69a5
  GstAllocator *allocator;
Packit 1f69a5
  GstAllocationParams params;
Packit 1f69a5
  GstBufferPool *other_pool;
Packit 1f69a5
  guint size;
Packit 1f69a5
  GstVideoInfo caps_info;   /* Default video information */
Packit 1f69a5
Packit 1f69a5
  gboolean add_videometa;    /* set if video meta should be added */
Packit 1f69a5
  gboolean enable_copy_threshold; /* If copy_threshold should be set */
Packit 1f69a5
Packit 1f69a5
  guint min_latency;         /* number of buffers we will hold */
Packit 1f69a5
  guint max_latency;         /* number of buffers we can hold */
Packit 1f69a5
  guint num_queued;          /* number of buffers queued in the driver */
Packit 1f69a5
  guint copy_threshold;      /* when our pool runs lower, start handing out copies */
Packit 1f69a5
Packit 1f69a5
  gboolean streaming;
Packit 1f69a5
  gboolean flushing;
Packit 1f69a5
Packit 1f69a5
  GstBuffer *buffers[VIDEO_MAX_FRAME];
Packit 1f69a5
Packit 1f69a5
  /* signal handlers */
Packit 1f69a5
  gulong group_released_handler;
Packit 1f69a5
Packit 1f69a5
  /* Control to warn only once on buggy feild driver bug */
Packit 1f69a5
  gboolean has_warned_on_buggy_field;
Packit 1f69a5
};
Packit 1f69a5
Packit 1f69a5
struct _GstV4l2BufferPoolClass
Packit 1f69a5
{
Packit 1f69a5
  GstBufferPoolClass parent_class;
Packit 1f69a5
};
Packit 1f69a5
Packit 1f69a5
GType gst_v4l2_buffer_pool_get_type (void);
Packit 1f69a5
Packit 1f69a5
GstBufferPool *     gst_v4l2_buffer_pool_new     (GstV4l2Object *obj, GstCaps *caps);
Packit 1f69a5
Packit 1f69a5
GstFlowReturn       gst_v4l2_buffer_pool_process (GstV4l2BufferPool * bpool, GstBuffer ** buf);
Packit 1f69a5
Packit 1f69a5
void                gst_v4l2_buffer_pool_set_other_pool (GstV4l2BufferPool * pool,
Packit 1f69a5
                                                         GstBufferPool * other_pool);
Packit 1f69a5
void                gst_v4l2_buffer_pool_copy_at_threshold (GstV4l2BufferPool * pool,
Packit 1f69a5
                                                            gboolean copy);
Packit 1f69a5
Packit 1f69a5
gboolean            gst_v4l2_buffer_pool_flush   (GstBufferPool *pool);
Packit 1f69a5
Packit 1f69a5
G_END_DECLS
Packit 1f69a5
Packit 1f69a5
#endif /*__GST_V4L2_BUFFER_POOL_H__ */