#include <NvV4l2Element.h>
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. |
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.
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.
[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.
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.
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.
[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 |
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
[in] | id | ID of the control to get |
[out] | value | Reference to the variable into which the control value will be read |
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
[in,out] | ctl | Contains controls to get |
Definition at line 183 of file NvV4l2Element.cpp.
int NvV4l2Element::isInError | ( | ) | [virtual] |
Indicates if the element encountered an error during its operation.
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
[in] | id | ID of the control to be set |
[in] | value | Value to be set on the control |
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
[in] | ctl | Contains controls to be set |
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
[in] | type | Type of the event |
[in] | id | ID of the event source |
[in] | flags | Event flags |
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.
[in] | max_wait_ms | Max time to wait in milliseconds |
Reimplemented in NvVideoConverter.
Definition at line 238 of file NvV4l2Element.cpp.
void* NvV4l2Element::app_data |
uint32_t NvV4l2Element::capture_plane_pixfmt [protected] |
int NvV4l2Element::fd [protected] |
uint32_t NvV4l2Element::output_plane_pixfmt [protected] |