NvV4l2Element Class Reference

Helper class for V4L2 based components. More...

#include <NvV4l2Element.h>

Inheritance diagram for NvV4l2Element:

NvElement NvVideoConverter NvVideoDecoder NvVideoEncoder

List of all members.

Public Member Functions

virtual ~NvV4l2Element ()
int subscribeEvent (uint32_t type, uint32_t id, uint32_t flags)
 Subscibe to an V4L2 Event.
int dqEvent (struct v4l2_event &event, uint32_t max_wait_ms)
 Dequeue a event from the element.
int setControl (uint32_t id, int32_t value)
 Set the value of a control.
int getControl (uint32_t id, int32_t &value)
 Get the value of a control.
int setExtControls (struct v4l2_ext_controls &ctl)
 Set the value of several controls.
int getExtControls (struct v4l2_ext_controls &ctl)
 Get the value of several controls.
virtual int isInError ()
 Indicates if the element encountered an error during its operation.
int abort ()
 Abort processing of queued buffers immediately.
virtual int waitForIdle (uint32_t max_wait_ms)
 Wait till the element has processed all the output plane buffers.
void enableProfiling ()
 Enable profiling for the V4l2Element.

Public Attributes

NvV4l2ElementPlane output_plane
 Output plane of the element.
NvV4l2ElementPlane capture_plane
 Capture plane of the element.
void * app_data
 Pointer to application specific data.

Protected Member Functions

 NvV4l2Element (const char *comp_name, const char *dev_node, int flags, NvElementProfiler::ProfilerField fields)
 Creates a new V4l2Element named name.

Protected Attributes

int fd
 FD of the device opened using .
uint32_t output_plane_pixfmt
 Pixel format of output plane buffers.
uint32_t capture_plane_pixfmt
 Pixel format of capture plane buffers.


Detailed Description

Helper class for V4L2 based components.

This class provides common functionality for V4L2 components. V4L2 based components like encoder/decoder extend from this class.

This class has been modelled on v4l2 M2M devices. It includes FD of the device opened using , two planes (NvV4l2ElementPlane) viz. Output plane, Capture plane and other helper functions such as setting/getting controls, subscribing/dequeueing events, etc.

Definition at line 53 of file NvV4l2Element.h.


Constructor & Destructor Documentation

NvV4l2Element::~NvV4l2Element (  )  [virtual]

Definition at line 79 of file NvV4l2Element.cpp.

NvV4l2Element::NvV4l2Element ( const char *  comp_name,
const char *  dev_node,
int  flags,
NvElementProfiler::ProfilerField  fields 
) [protected]

Creates a new V4l2Element named name.

This constructor calls v4l2_open on the dev_node. Sets an error if v4l2_open fails.

This function also checks if the device supports V4L2_CAP_VIDEO_M2M_MPLANE capability.

Parameters:
[in] comp_name Unique name to identity the element instance
[in] dev_node /dev/ * node of the device
[in] flags Flags to open the device with
[in] fields Profiler fields which are valid for the element.

Definition at line 41 of file NvV4l2Element.cpp.


Member Function Documentation

int NvV4l2Element::abort (  ) 

Abort processing of queued buffers immediately.

All the buffers are returned to the application.

Calls VIDIOC_STREAMOFF ioctl on the both the planes internally.

Returns:
0 for success, -1 for failure

Definition at line 227 of file NvV4l2Element.cpp.

int NvV4l2Element::dqEvent ( struct v4l2_event &  event,
uint32_t  max_wait_ms 
)

Dequeue a event from the element.

Calls VIDIOC_DQEVENT ioctl internally. User can specify the maximum time to wait for dequeuing the event. The call blocks till an event is dequeued successfully or timeout is reached.

Parameters:
[in,out] event Reference to v4l2_event structure to be filled
[in] max_wait_ms Max time to wait for dequeuing an event in in milliseconds
Returns:
0 for success, -1 for failure

Definition at line 92 of file NvV4l2Element.cpp.

void NvV4l2Element::enableProfiling (  )  [virtual]

Enable profiling for the V4l2Element.

Should be called before setting either plane formats.

Reimplemented from NvElement.

Definition at line 254 of file NvV4l2Element.cpp.

int NvV4l2Element::getControl ( uint32_t  id,
int32_t &  value 
)

Get the value of a control.

Calls VIDIOC_G_CTRL ioctl internally

Parameters:
[in] id ID of the control to get
[out] value Reference to the variable into which the control value will be read
Returns:
0 for success, -1 for failure

Definition at line 143 of file NvV4l2Element.cpp.

int NvV4l2Element::getExtControls ( struct v4l2_ext_controls &  ctl  ) 

Get the value of several controls.

Calls VIDIOC_G_EXT_CTRLS ioctl internally

Parameters:
[in,out] ctl Contains controls to get
Returns:
0 for success, -1 for failure

Definition at line 183 of file NvV4l2Element.cpp.

int NvV4l2Element::isInError (  )  [virtual]

Indicates if the element encountered an error during its operation.

Returns:
0 if no error was encountered, a non-zero value if an error was encountered.

Reimplemented from NvElement.

Definition at line 245 of file NvV4l2Element.cpp.

int NvV4l2Element::setControl ( uint32_t  id,
int32_t  value 
)

Set the value of a control.

Calls VIDIOC_S_CTRL ioctl internally

Parameters:
[in] id ID of the control to be set
[in] value Value to be set on the control
Returns:
0 for success, -1 for failure

Definition at line 120 of file NvV4l2Element.cpp.

int NvV4l2Element::setExtControls ( struct v4l2_ext_controls &  ctl  ) 

Set the value of several controls.

Calls VIDIOC_S_EXT_CTRLS ioctl internally

Parameters:
[in] ctl Contains controls to be set
Returns:
0 for success, -1 for failure

Definition at line 165 of file NvV4l2Element.cpp.

int NvV4l2Element::subscribeEvent ( uint32_t  type,
uint32_t  id,
uint32_t  flags 
)

Subscibe to an V4L2 Event.

Calls VIDIOC_SUBSCRIBE_EVENT ioctl internally

Parameters:
[in] type Type of the event
[in] id ID of the event source
[in] flags Event flags
Returns:
0 for success, -1 for failure

Definition at line 201 of file NvV4l2Element.cpp.

int NvV4l2Element::waitForIdle ( uint32_t  max_wait_ms  )  [virtual]

Wait till the element has processed all the output plane buffers.

Classes extending V4l2Element should implement this since the idle condition will be component specific.

Parameters:
[in] max_wait_ms Max time to wait in milliseconds
Returns:
0 for success, -1 for failure

Reimplemented in NvVideoConverter.

Definition at line 238 of file NvV4l2Element.cpp.


Member Data Documentation

Pointer to application specific data.

Definition at line 151 of file NvV4l2Element.h.

Capture plane of the element.

Definition at line 127 of file NvV4l2Element.h.

Pixel format of capture plane buffers.

Definition at line 164 of file NvV4l2Element.h.

int NvV4l2Element::fd [protected]

FD of the device opened using .

Definition at line 161 of file NvV4l2Element.h.

Output plane of the element.

Definition at line 126 of file NvV4l2Element.h.

uint32_t NvV4l2Element::output_plane_pixfmt [protected]

Pixel format of output plane buffers.

Definition at line 163 of file NvV4l2Element.h.


The documentation for this class was generated from the following files:

Generated on Wed Nov 9 19:52:25 2016 for NVIDIA Tegra Multimedia API Framework by  doxygen 1.5.8