3.1.Digital TV Common functions

3.1.1.DVB devices

Those functions are responsible for handling the DVB device nodes.

enumdvb_device_type

type of the Digital TV device

Constants

DVB_DEVICE_SEC

Digital TV standalone Common Interface (CI)

DVB_DEVICE_FRONTEND

Digital TV frontend.

DVB_DEVICE_DEMUX

Digital TV demux.

DVB_DEVICE_DVR

Digital TV digital video record (DVR).

DVB_DEVICE_CA

Digital TV Conditional Access (CA).

DVB_DEVICE_NET

Digital TV network.

DVB_DEVICE_VIDEO

Digital TV video decoder.Deprecated. Used only on av7110-av.

DVB_DEVICE_AUDIO

Digital TV audio decoder.Deprecated. Used only on av7110-av.

DVB_DEVICE_OSD

Digital TV On Screen Display (OSD).Deprecated. Used only on av7110.

structdvb_adapter

represents a Digital TV adapter using Linux DVB API

Definition:

struct dvb_adapter {    int num;    struct list_head list_head;    struct list_head device_list;    const char *name;    u8 proposed_mac [6];    void* priv;    struct device *device;    struct module *module;    int mfe_shared;    struct dvb_device *mfe_dvbdev;    struct mutex mfe_lock;#if defined(CONFIG_MEDIA_CONTROLLER_DVB);    struct mutex mdev_lock;    struct media_device *mdev;    struct media_entity *conn;    struct media_pad *conn_pads;#endif;};

Members

num

Number of the adapter

list_head

List with the DVB adapters

device_list

List with the DVB devices

name

Name of the adapter

proposed_mac

proposed MAC address for the adapter

priv

private data

device

pointer tostructdevice

module

pointer tostructmodule

mfe_shared

indicates mutually exclusive frontends.1 = legacy exclusion behavior: blocking any open() call2 = enhanced exclusion behavior, emulating the standardbehavior of busy frontends: allowing read-only sharingand otherwise returning immediately with -EBUSY when anyof the frontends is already opened with write access.

mfe_dvbdev

Frontend device in use, in the case of MFE

mfe_lock

Lock to prevent using the other frontends when MFE isused.

mdev_lock

Protect access to the mdev pointer.

mdev

pointer tostructmedia_device, used when the mediacontroller is used.

conn

RF connector. Used only if the device has no separatetuner.

conn_pads

pointer tostructmedia_pad associated withconn;

structdvb_device

represents a DVB device node

Definition:

struct dvb_device {    struct list_head list_head;    struct kref ref;    const struct file_operations *fops;    struct dvb_adapter *adapter;    enum dvb_device_type type;    int minor;    u32 id;    int readers;    int writers;    int users;    wait_queue_head_t wait_queue;    int (*kernel_ioctl)(struct file *file, unsigned int cmd, void *arg);#if defined(CONFIG_MEDIA_CONTROLLER_DVB);    const char *name;    struct media_intf_devnode *intf_devnode;    unsigned tsout_num_entities;    struct media_entity *entity, *tsout_entity;    struct media_pad *pads, *tsout_pads;#endif;    void *priv;};

Members

list_head

List head with all DVB devices

ref

reference count for this device

fops

pointer tostructfile_operations

adapter

pointer to the adapter that holds this device node

type

type of the device, as defined byenumdvb_device_type.

minor

devnode minor number. Major number is always DVB_MAJOR.

id

device ID number, inside the adapter

readers

Initialized by the caller. Each call to open() in Read Only modedecreases this counter by one.

writers

Initialized by the caller. Each call to open() in Read/Writemode decreases this counter by one.

users

Initialized by the caller. Each call to open() in any modedecreases this counter by one.

wait_queue

wait queue, used to wait for certain events inside one ofthe DVB API callers

kernel_ioctl

callback function used to handle ioctl calls from userspace.

name

Name to be used for the device at the Media Controller

intf_devnode

Pointer to media_intf_devnode. Used by the dvbdev core tostore the MC device node interface

tsout_num_entities

Number of Transport Stream output entities

entity

pointer tostructmedia_entity associated with the device node

tsout_entity

array with MC entities associated to each TS output node

pads

pointer tostructmedia_pad associated withentity;

tsout_pads

array with the source pads for eachtsout_entity

priv

private data

Description

This structure is used by the DVB core (frontend, CA, net, demux) inorder to create the device nodes. Usually, driver should not initializethisstructdiretly.

structdvbdevfops_node

fops nodes registered in dvbdevfops_list

Definition:

struct dvbdevfops_node {    struct file_operations *fops;    enum dvb_device_type type;    const struct dvb_device *template;    struct list_head list_head;};

Members

fops

Dynamically allocated fops for ->owner registration

type

type of dvb_device

template

dvb_device used for registration

list_head

list_head for dvbdevfops_list

structdvb_device*dvb_device_get(structdvb_device*dvbdev)

Increase dvb_device reference

Parameters

structdvb_device*dvbdev

pointer tostructdvb_device

voiddvb_device_put(structdvb_device*dvbdev)

Decrease dvb_device reference

Parameters

structdvb_device*dvbdev

pointer tostructdvb_device

intdvb_register_adapter(structdvb_adapter*adap,constchar*name,structmodule*module,structdevice*device,short*adapter_nums)

Registers a new DVB adapter

Parameters

structdvb_adapter*adap

pointer tostructdvb_adapter

constchar*name

Adapter’s name

structmodule*module

initialized with THIS_MODULE at the caller

structdevice*device

pointer tostructdevice that corresponds to the device driver

short*adapter_nums

Array with a list of the numbers fordvb_register_adapter;to select among them. Typically, initialized with:DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nums)

intdvb_unregister_adapter(structdvb_adapter*adap)

Unregisters a DVB adapter

Parameters

structdvb_adapter*adap

pointer tostructdvb_adapter

intdvb_register_device(structdvb_adapter*adap,structdvb_device**pdvbdev,conststructdvb_device*template,void*priv,enumdvb_device_typetype,intdemux_sink_pads)

Registers a new DVB device

Parameters

structdvb_adapter*adap

pointer tostructdvb_adapter

structdvb_device**pdvbdev

pointer to the place where the newstructdvb_device will bestored

conststructdvb_device*template

Template used to createpdvbdev;

void*priv

private data

enumdvb_device_typetype

type of the device, as defined byenumdvb_device_type.

intdemux_sink_pads

Number of demux outputs, to be used to create the TSoutputs via the Media Controller.

voiddvb_remove_device(structdvb_device*dvbdev)

Remove a registered DVB device

Parameters

structdvb_device*dvbdev

pointer tostructdvb_device

Description

This does not free memory.dvb_free_device() will do that whenreference counter is empty

voiddvb_unregister_device(structdvb_device*dvbdev)

Unregisters a DVB device

Parameters

structdvb_device*dvbdev

pointer tostructdvb_device

intdvb_create_media_graph(structdvb_adapter*adap,boolcreate_rf_connector)

Creates media graph for the Digital TV part of the device.

Parameters

structdvb_adapter*adap

pointer tostructdvb_adapter

boolcreate_rf_connector

if true, it creates the RF connector too

Description

This function checks all DVB-related functions at the media controllerentities and creates the needed links for the media graph. It iscapable of working with multiple tuners or multiple frontends, but itwon’t create links if the device has multiple tuners and multiple frontendsor if the device has multiple muxes. In such case, the caller driver shouldmanually create the remaining links.

voiddvb_register_media_controller(structdvb_adapter*adap,structmedia_device*mdev)

registers a media controller at DVB adapter

Parameters

structdvb_adapter*adap

pointer tostructdvb_adapter

structmedia_device*mdev

pointer tostructmedia_device

structmedia_device*dvb_get_media_controller(structdvb_adapter*adap)

gets the associated media controller

Parameters

structdvb_adapter*adap

pointer tostructdvb_adapter

intdvb_generic_open(structinode*inode,structfile*file)

Digital TV open function, used by DVB devices

Parameters

structinode*inode

pointer tostructinode.

structfile*file

pointer tostructfile.

Description

Checks if a DVB devnode is still valid, and if the permissions areOK and increment negative use count.

intdvb_generic_release(structinode*inode,structfile*file)

Digital TV close function, used by DVB devices

Parameters

structinode*inode

pointer tostructinode.

structfile*file

pointer tostructfile.

Description

Checks if a DVB devnode is still valid, and if the permissions areOK and decrement negative use count.

longdvb_generic_ioctl(structfile*file,unsignedintcmd,unsignedlongarg)

Digital TV close function, used by DVB devices

Parameters

structfile*file

pointer tostructfile.

unsignedintcmd

Ioctl name.

unsignedlongarg

Ioctl argument.

Description

Checks if a DVB devnode andstructdvbdev.kernel_ioctl is still valid.If so, callsdvb_usercopy().

intdvb_usercopy(structfile*file,unsignedintcmd,unsignedlongarg,int(*func)(structfile*file,unsignedintcmd,void*arg))

copies data from/to userspace memory when an ioctl is issued.

Parameters

structfile*file

Pointer to structfile.

unsignedintcmd

Ioctl name.

unsignedlongarg

Ioctl argument.

int(*func)(structfile*file,unsignedintcmd,void*arg)

function that will actually handle the ioctl

Description

Ancillary function that uses ioctl direction and size to copy fromuserspace. Then, it callsfunc, and, if needed, data is copied backto userspace.

structi2c_client*dvb_module_probe(constchar*module_name,constchar*name,structi2c_adapter*adap,unsignedcharaddr,void*platform_data)

helper routine to probe an I2C module

Parameters

constchar*module_name

Name of the I2C module to be probed

constchar*name

Optional name for the I2C module. Used for debug purposes.IfNULL, defaults tomodule_name.

structi2c_adapter*adap

pointer tostructi2c_adapter that describes the I2C adapter wherethe module will be bound.

unsignedcharaddr

I2C address of the adapter, in 7-bit notation.

void*platform_data

Platform data to be passed to the I2C module probed.

Description

This function binds an I2C device into the DVB core. Should be used byall drivers that use I2C bus to control the hardware. A module boundwithdvb_module_probe() should usedvb_module_release() to unbind.

Note

In the past, DVB modules (mainly, frontends) were bound viadvb_attach()macro, with does an ugly hack, using I2C low level functions. Suchusage is deprecated and will be removed soon. Instead, use this routine.

Return

On success, return anstructi2c_client, pointing to the boundI2C device.NULL otherwise.

voiddvb_module_release(structi2c_client*client)

releases an I2C device allocated withdvb_module_probe().

Parameters

structi2c_client*client

pointer tostructi2c_client with the I2C client to be released.can beNULL.

Description

This function should be used to free all resources reserved bydvb_module_probe() and unbinding the I2C hardware.

dvb_attach

dvb_attach(FUNCTION,ARGS...)

attaches a DVB frontend into the DVB core.

Parameters

FUNCTION

function on a frontend module to be called.

ARGS...

FUNCTION arguments.

Description

This ancillary function loads a frontend module in runtime and runstheFUNCTION function there, withARGS.As it increments symbol usage cont, at unregister,dvb_detach()should be called.

Note

In the past, DVB modules (mainly, frontends) were bound viadvb_attach()macro, with does an ugly hack, using I2C low level functions. Suchusage is deprecated and will be removed soon. Instead, you should usedvb_module_probe().

dvb_detach

dvb_detach(FUNC)

detaches a DVB frontend loaded viadvb_attach()

Parameters

FUNC

attach function

Description

Decrements usage count for a function previously called viadvb_attach().

3.1.2.Digital TV Ring buffer

Those routines implement ring buffers used to handle digital TV data andcopy it from/to userspace.

Note

  1. For performance reasons read and write routines don’t check buffer sizesand/or number of bytes free/available. This has to be done before theseroutines are called. For example:

/* write @buflen: bytes */free=dvb_ringbuffer_free(rbuf);if(free>=buflen)count=dvb_ringbuffer_write(rbuf,buffer,buflen);else/* do something *//* read min. 1000, max. @bufsize: bytes */avail=dvb_ringbuffer_avail(rbuf);if(avail>=1000)count=dvb_ringbuffer_read(rbuf,buffer,min(avail,bufsize));else/* do something */
  1. If there is exactly one reader and one writer, there is no needto lock read or write operations.Two or more readers must be locked against each other.Flushing the buffer counts as a read operation.Resetting the buffer counts as a read and write operation.Two or more writers must be locked against each other.

structdvb_ringbuffer

Describes a ring buffer used at DVB framework

Definition:

struct dvb_ringbuffer {    u8 *data;    ssize_t size;    ssize_t pread;    ssize_t pwrite;    int error;    wait_queue_head_t queue;    spinlock_t lock;};

Members

data

Area were the ringbuffer data is written

size

size of the ringbuffer

pread

next position to read

pwrite

next position to write

error

used by ringbuffer clients to indicate that an error happened.

queue

Wait queue used by ringbuffer clients to indicate when bufferwas filled

lock

Spinlock used to protect the ringbuffer

voiddvb_ringbuffer_init(structdvb_ringbuffer*rbuf,void*data,size_tlen)

initialize ring buffer, lock and queue

Parameters

structdvb_ringbuffer*rbuf

pointer tostructdvb_ringbuffer

void*data

pointer to the buffer where the data will be stored

size_tlen

bytes from ring buffer intobuf

intdvb_ringbuffer_empty(structdvb_ringbuffer*rbuf)

test whether buffer is empty

Parameters

structdvb_ringbuffer*rbuf

pointer tostructdvb_ringbuffer

ssize_tdvb_ringbuffer_free(structdvb_ringbuffer*rbuf)

returns the number of free bytes in the buffer

Parameters

structdvb_ringbuffer*rbuf

pointer tostructdvb_ringbuffer

Return

number of free bytes in the buffer

ssize_tdvb_ringbuffer_avail(structdvb_ringbuffer*rbuf)

returns the number of bytes waiting in the buffer

Parameters

structdvb_ringbuffer*rbuf

pointer tostructdvb_ringbuffer

Return

number of bytes waiting in the buffer

voiddvb_ringbuffer_reset(structdvb_ringbuffer*rbuf)

resets the ringbuffer to initial state

Parameters

structdvb_ringbuffer*rbuf

pointer tostructdvb_ringbuffer

Description

Resets the read and write pointers to zero and flush the buffer.

This counts as a read and write operation

voiddvb_ringbuffer_flush(structdvb_ringbuffer*rbuf)

flush buffer

Parameters

structdvb_ringbuffer*rbuf

pointer tostructdvb_ringbuffer

voiddvb_ringbuffer_flush_spinlock_wakeup(structdvb_ringbuffer*rbuf)

flush buffer protected by spinlock and wake-up waiting task(s)

Parameters

structdvb_ringbuffer*rbuf

pointer tostructdvb_ringbuffer

DVB_RINGBUFFER_PEEK

DVB_RINGBUFFER_PEEK(rbuf,offs)

peek at byteoffs in the buffer

Parameters

rbuf

pointer tostructdvb_ringbuffer

offs

offset inside the ringbuffer

DVB_RINGBUFFER_SKIP

DVB_RINGBUFFER_SKIP(rbuf,num)

advance read ptr bynum bytes

Parameters

rbuf

pointer tostructdvb_ringbuffer

num

number of bytes to advance

ssize_tdvb_ringbuffer_read_user(structdvb_ringbuffer*rbuf,u8__user*buf,size_tlen)

Reads a buffer into a user pointer

Parameters

structdvb_ringbuffer*rbuf

pointer tostructdvb_ringbuffer

u8__user*buf

pointer to the buffer where the data will be stored

size_tlen

bytes from ring buffer intobuf

Description

This variant assumes that the buffer is a memory at the userspace. So,it will internally callcopy_to_user().

Return

number of bytes transferred or -EFAULT

voiddvb_ringbuffer_read(structdvb_ringbuffer*rbuf,u8*buf,size_tlen)

Reads a buffer into a pointer

Parameters

structdvb_ringbuffer*rbuf

pointer tostructdvb_ringbuffer

u8*buf

pointer to the buffer where the data will be stored

size_tlen

bytes from ring buffer intobuf

Description

This variant assumes that the buffer is a memory at the Kernel space

Return

number of bytes transferred or -EFAULT

DVB_RINGBUFFER_WRITE_BYTE

DVB_RINGBUFFER_WRITE_BYTE(rbuf,byte)

write single byte to ring buffer

Parameters

rbuf

pointer tostructdvb_ringbuffer

byte

byte to write

ssize_tdvb_ringbuffer_write(structdvb_ringbuffer*rbuf,constu8*buf,size_tlen)

Writes a buffer into the ringbuffer

Parameters

structdvb_ringbuffer*rbuf

pointer tostructdvb_ringbuffer

constu8*buf

pointer to the buffer where the data will be read

size_tlen

bytes from ring buffer intobuf

Description

This variant assumes that the buffer is a memory at the Kernel space

Return

number of bytes transferred or -EFAULT

ssize_tdvb_ringbuffer_write_user(structdvb_ringbuffer*rbuf,constu8__user*buf,size_tlen)

Writes a buffer received via a user pointer

Parameters

structdvb_ringbuffer*rbuf

pointer tostructdvb_ringbuffer

constu8__user*buf

pointer to the buffer where the data will be read

size_tlen

bytes from ring buffer intobuf

Description

This variant assumes that the buffer is a memory at the userspace. So,it will internally callcopy_from_user().

Return

number of bytes transferred or -EFAULT

ssize_tdvb_ringbuffer_pkt_write(structdvb_ringbuffer*rbuf,u8*buf,size_tlen)

Write a packet into the ringbuffer.

Parameters

structdvb_ringbuffer*rbuf

Ringbuffer to write to.

u8*buf

Buffer to write.

size_tlen

Length of buffer (currently limited to 65535 bytes max).

Return

Number of bytes written, or -EFAULT, -ENOMEM, -EINVAL.

ssize_tdvb_ringbuffer_pkt_read_user(structdvb_ringbuffer*rbuf,size_tidx,intoffset,u8__user*buf,size_tlen)

Read from a packet in the ringbuffer.

Parameters

structdvb_ringbuffer*rbuf

Ringbuffer concerned.

size_tidx

Packet index as returned bydvb_ringbuffer_pkt_next().

intoffset

Offset into packet to read from.

u8__user*buf

Destination buffer for data.

size_tlen

Size of destination buffer.

Return

Number of bytes read, or -EFAULT.

Description

Note

unlikedvb_ringbuffer_read(), this doesNOT update the read pointerin the ringbuffer. You must usedvb_ringbuffer_pkt_dispose() to mark apacket as no longer required.

ssize_tdvb_ringbuffer_pkt_read(structdvb_ringbuffer*rbuf,size_tidx,intoffset,u8*buf,size_tlen)

Read from a packet in the ringbuffer.

Parameters

structdvb_ringbuffer*rbuf

Ringbuffer concerned.

size_tidx

Packet index as returned bydvb_ringbuffer_pkt_next().

intoffset

Offset into packet to read from.

u8*buf

Destination buffer for data.

size_tlen

Size of destination buffer.

Note

unlikedvb_ringbuffer_read_user(), this DOES update the read pointerin the ringbuffer.

Return

Number of bytes read, or -EFAULT.

voiddvb_ringbuffer_pkt_dispose(structdvb_ringbuffer*rbuf,size_tidx)

Dispose of a packet in the ring buffer.

Parameters

structdvb_ringbuffer*rbuf

Ring buffer concerned.

size_tidx

Packet index as returned bydvb_ringbuffer_pkt_next().

ssize_tdvb_ringbuffer_pkt_next(structdvb_ringbuffer*rbuf,size_tidx,size_t*pktlen)

Get the index of the next packet in a ringbuffer.

Parameters

structdvb_ringbuffer*rbuf

Ringbuffer concerned.

size_tidx

Previous packet index, or -1 to return the first packet index.

size_t*pktlen

On success, will be updated to contain the length of the packetin bytes.returns Packet index (if >=0), or -1 if no packets available.

3.1.3.Digital TV VB2 handler

enumdvb_buf_type

types of Digital TV memory-mapped buffers

Constants

DVB_BUF_TYPE_CAPTURE

buffer is filled by the Kernel,with a received Digital TV stream

enumdvb_vb2_states

states to control VB2 state machine

Constants

DVB_VB2_STATE_NONE

VB2 engine not initialized yet, init failed or VB2 was released.

DVB_VB2_STATE_INIT

VB2 engine initialized.

DVB_VB2_STATE_REQBUFS

Buffers were requested

DVB_VB2_STATE_STREAMON

VB2 is streaming. Callers should not check it directly. Instead,they should usedvb_vb2_is_streaming().

Note

Callers should not touch at the state machine directly. Thisis handled inside dvb_vb2.c.

structdvb_buffer

video buffer information for v4l2.

Definition:

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

Members

vb

embedded structvb2_buffer.

list

list ofstructdvb_buffer.

structdvb_vb2_ctx

control struct for VB2 handler

Definition:

struct dvb_vb2_ctx {    struct vb2_queue        vb_q;    struct mutex            mutex;    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];};

Members

vb_q

pointer tostructvb2_queue with videobuf2 queue.

mutex

mutex to serialize vb2 operations. Used byvb2 corewait_prepare andwait_finish operations.

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 thebuf to be filled.

remain

How many bytes are left to be filled atbuf.

state

bitmask of buffer states as defined byenumdvb_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-blockingmode.

flags

buffer flags as defined byenumdmx_buffer_flags.Filled only atDMX_DQBUF.DMX_QBUF should zero this field.

count

monotonic counter for filled buffers. Helps to identifydata stream loses. Filled only atDMX_DQBUF.DMX_QBUF shouldzero this field.

name

name of the device type. Currently, it can either be“dvr” or “demux_filter”.

intdvb_vb2_init(structdvb_vb2_ctx*ctx,constchar*name,intnon_blocking)

initializes VB2 handler

Parameters

structdvb_vb2_ctx*ctx

control struct for VB2 handler

constchar*name

name for the VB2 handler

intnon_blocking

if not zero, it means that the device is at non-blocking mode

intdvb_vb2_release(structdvb_vb2_ctx*ctx)

Releases the VB2 handler allocated resources and putctx at DVB_VB2_STATE_NONE state.

Parameters

structdvb_vb2_ctx*ctx

control struct for VB2 handler

intdvb_vb2_is_streaming(structdvb_vb2_ctx*ctx)

checks if the VB2 handler is streaming

Parameters

structdvb_vb2_ctx*ctx

control struct for VB2 handler

Return

0 if not streaming, 1 otherwise.

intdvb_vb2_fill_buffer(structdvb_vb2_ctx*ctx,constunsignedchar*src,intlen,enumdmx_buffer_flags*buffer_flags)

fills a VB2 buffer

Parameters

structdvb_vb2_ctx*ctx

control struct for VB2 handler

constunsignedchar*src

place where the data is stored

intlen

number of bytes to be copied fromsrc

enumdmx_buffer_flags*buffer_flags

pointer to buffer flags as defined byenumdmx_buffer_flags.can be NULL.

__poll_tdvb_vb2_poll(structdvb_vb2_ctx*ctx,structfile*file,poll_table*wait)

Wrapper tovb2_core_streamon() for Digital TV buffer handling.

Parameters

structdvb_vb2_ctx*ctx

control struct for VB2 handler

structfile*file

structfile argument passed to the pollfile operation handler.

poll_table*wait

poll_table wait argument passed to the pollfile operation handler.

Description

Implements pollsyscall() logic.

intdvb_vb2_stream_on(structdvb_vb2_ctx*ctx)

Wrapper tovb2_core_streamon() for Digital TV buffer handling.

Parameters

structdvb_vb2_ctx*ctx

control struct for VB2 handler

Description

Starts dvb streaming

intdvb_vb2_stream_off(structdvb_vb2_ctx*ctx)

Wrapper tovb2_core_streamoff() for Digital TV buffer handling.

Parameters

structdvb_vb2_ctx*ctx

control struct for VB2 handler

Description

Stops dvb streaming

intdvb_vb2_reqbufs(structdvb_vb2_ctx*ctx,structdmx_requestbuffers*req)

Wrapper tovb2_core_reqbufs() for Digital TV buffer handling.

Parameters

structdvb_vb2_ctx*ctx

control struct for VB2 handler

structdmx_requestbuffers*req

structdmx_requestbuffers passed from userspace inorder to handleDMX_REQBUFS.

Description

Initiate streaming by requesting a number of buffers. Also used tofree previously requested buffers, isreq->count is zero.

intdvb_vb2_querybuf(structdvb_vb2_ctx*ctx,structdmx_buffer*b)

Wrapper tovb2_core_querybuf() for Digital TV buffer handling.

Parameters

structdvb_vb2_ctx*ctx

control struct for VB2 handler

structdmx_buffer*b

structdmx_buffer passed from userspace inorder to handleDMX_QUERYBUF.

intdvb_vb2_expbuf(structdvb_vb2_ctx*ctx,structdmx_exportbuffer*exp)

Wrapper tovb2_core_expbuf() for Digital TV buffer handling.

Parameters

structdvb_vb2_ctx*ctx

control struct for VB2 handler

structdmx_exportbuffer*exp

structdmx_exportbuffer passed from userspace inorder to handleDMX_EXPBUF.

Description

Export a buffer as a file descriptor.

intdvb_vb2_qbuf(structdvb_vb2_ctx*ctx,structdmx_buffer*b)

Wrapper tovb2_core_qbuf() for Digital TV buffer handling.

Parameters

structdvb_vb2_ctx*ctx

control struct for VB2 handler

structdmx_buffer*b

structdmx_buffer passed from userspace inorder to handleDMX_QBUF.

Description

Queue a Digital TV buffer as requested by userspace

intdvb_vb2_dqbuf(structdvb_vb2_ctx*ctx,structdmx_buffer*b)

Wrapper tovb2_core_dqbuf() for Digital TV buffer handling.

Parameters

structdvb_vb2_ctx*ctx

control struct for VB2 handler

structdmx_buffer*b

structdmx_buffer passed from userspace inorder to handleDMX_DQBUF.

Description

Dequeue a Digital TV buffer to the userspace

intdvb_vb2_mmap(structdvb_vb2_ctx*ctx,structvm_area_struct*vma)

Wrapper tovb2_mmap() for Digital TV buffer handling.

Parameters

structdvb_vb2_ctx*ctx

control struct for VB2 handler

structvm_area_struct*vma

pointer tostructvm_area_struct with the vma passedto the mmap file operation handler in the driver.

Description

map Digital TV video buffers into application address space.