include/media/dvb_vb2.h

Source file repositories/reference/linux-study-clean/include/media/dvb_vb2.h

File Facts

System
Linux kernel
Corpus path
include/media/dvb_vb2.h
Extension
.h
Size
7884 bytes
Lines
282
Domain
Repository Root And Misc
Bucket
include
Inferred role
Repository Root And Misc: implementation source
Status
source implementation candidate

Why This File Exists

Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.

Dependency Surface

Detected Declarations

Annotated Snippet

struct dvb_buffer {
	struct vb2_buffer	vb;
	struct list_head	list;
};

/**
 * struct dvb_vb2_ctx - control struct for VB2 handler
 * @vb_q:	pointer to &struct vb2_queue with videobuf2 queue.
 * @slock:	spin lock used to protect buffer filling at dvb_vb2.c.
 * @dvb_q:	List of buffers that are not filled yet.
 * @buf:	Pointer to the buffer that are currently being filled.
 * @offset:	index to the next position at the @buf to be filled.
 * @remain:	How many bytes are left to be filled at @buf.
 * @state:	bitmask of buffer states as defined by &enum dvb_vb2_states.
 * @buf_siz:	size of each VB2 buffer.
 * @buf_cnt:	number of VB2 buffers.
 * @nonblocking:
 *		If different than zero, device is operating on non-blocking
 *		mode.
 * @flags:	buffer flags as defined by &enum dmx_buffer_flags.
 *		Filled only at &DMX_DQBUF. &DMX_QBUF should zero this field.
 * @count:	monotonic counter for filled buffers. Helps to identify
 *		data stream loses. Filled only at &DMX_DQBUF. &DMX_QBUF should
 *		zero this field.
 *
 * @name:	name of the device type. Currently, it can either be
 *		"dvr" or "demux_filter".
 */
struct dvb_vb2_ctx {
	struct vb2_queue	vb_q;
	spinlock_t		slock;
	struct list_head	dvb_q;
	struct dvb_buffer	*buf;
	int	offset;
	int	remain;
	int	state;
	int	buf_siz;
	int	buf_cnt;
	int	nonblocking;

	enum dmx_buffer_flags flags;
	u32	count;

	char	name[DVB_VB2_NAME_MAX + 1];
};

#ifndef CONFIG_DVB_MMAP
static inline int dvb_vb2_init(struct dvb_vb2_ctx *ctx, const char *name,
			       struct mutex *mutex, int non_blocking)
{
	return 0;
};
static inline int dvb_vb2_release(struct dvb_vb2_ctx *ctx)
{
	return 0;
};
#define dvb_vb2_is_streaming(ctx) (0)
#define dvb_vb2_fill_buffer(ctx, file, wait, flags, flush) (0)

static inline __poll_t dvb_vb2_poll(struct dvb_vb2_ctx *ctx,
				    struct file *file,
				    poll_table *wait)
{
	return 0;
}
#else
/**
 * dvb_vb2_init - initializes VB2 handler
 *
 * @ctx:	control struct for VB2 handler
 * @name:	name for the VB2 handler
 * @mutex:	pointer to the mutex that serializes vb2 ioctls
 * @non_blocking:
 *		if not zero, it means that the device is at non-blocking mode
 */
int dvb_vb2_init(struct dvb_vb2_ctx *ctx, const char *name,
		 struct mutex *mutex, int non_blocking);

/**
 * dvb_vb2_release - Releases the VB2 handler allocated resources and
 *	put @ctx at DVB_VB2_STATE_NONE state.
 * @ctx:	control struct for VB2 handler
 */
int dvb_vb2_release(struct dvb_vb2_ctx *ctx);

/**
 * dvb_vb2_is_streaming - checks if the VB2 handler is streaming
 * @ctx:	control struct for VB2 handler
 *
 * Return: 0 if not streaming, 1 otherwise.

Annotation

Implementation Notes