NvVideoConverter Class Reference

Helper class for V4L2 Video Converter. More...

#include <NvVideoConverter.h>

Inheritance diagram for NvVideoConverter:

NvV4l2Element NvElement

List of all members.

Public Member Functions

 ~NvVideoConverter ()
int setCapturePlaneFormat (uint32_t pixfmt, uint32_t width, uint32_t height, enum v4l2_nv_buffer_layout type)
 Sets the format on the converter output plane.
int setOutputPlaneFormat (uint32_t pixfmt, uint32_t width, uint32_t height, enum v4l2_nv_buffer_layout type)
 Sets the format on the converter output plane.
int setOutputPlaneBufferLayout (enum v4l2_nv_buffer_layout type)
 Set the buffer layout of the output plane buffers.
int setCapturePlaneBufferLayout (enum v4l2_nv_buffer_layout type)
 Set the buffer layout of the capture plane buffers.
int setInterpolationMethod (enum v4l2_interpolation_method method)
 Set the interpolation(filter) method used for scaling.
int setFlipMethod (enum v4l2_flip_method method)
 Set the flip method.
int setTnrAlgorithm (enum v4l2_tnr_algorithm algorithm)
 Set the TNR(Temporal Noise Reduction) algorithm to use.
int setCropRect (uint32_t left, uint32_t top, uint32_t width, uint32_t height)
 Set the cropping rectangle for the converter.
int waitForIdle (uint32_t max_wait_ms)
 Wait till all the buffers queued on the output plane are converted and dequeued from the capture plane.

Static Public Member Functions

static NvVideoConvertercreateVideoConverter (const char *name, int flags=0)
 Create a new V4L2 Video Converter named name.

Private Member Functions

 NvVideoConverter (const char *name, int flags)
 Contructor used by createVideoConverter.

Static Private Attributes

static const
NvElementProfiler::ProfilerField 
valid_fields


Detailed Description

Helper class for V4L2 Video Converter.

Video converter can be used for color space conversion, scaling and conversion between hardware buffer memory (V4L2_MEMORY_MMAP/ V4L2_MEMORY_DMABUF) and software buffer memory (V4L2_MEMORY_USERPTR).

The video converter device node is "/dev/nvhost-vic". The category name for encoder is "NVVIDCONV"

Refer to V4L2 Video Converter for more information on the converter.

Definition at line 53 of file NvVideoConverter.h.


Constructor & Destructor Documentation

NvVideoConverter::~NvVideoConverter (  ) 

Definition at line 84 of file NvVideoConverter.cpp.

NvVideoConverter::NvVideoConverter ( const char *  name,
int  flags 
) [private]

Contructor used by createVideoConverter.

Definition at line 67 of file NvVideoConverter.cpp.


Member Function Documentation

NvVideoConverter * NvVideoConverter::createVideoConverter ( const char *  name,
int  flags = 0 
) [static]

Create a new V4L2 Video Converter named name.

This function internally calls v4l2_open on the converter dev node "/dev/nvhost-vic" and checks for V4L2_CAP_VIDEO_M2M_MPLANE capability on the device. This method allows the caller to specify additional flags with which the device should be opened.

The device is opened in blocking mode which can be modified by passing the O_NONBLOCK flag to this method.

Returns:
Reference to the newly created converter object else NULL in case of failure during initialization.

Definition at line 73 of file NvVideoConverter.cpp.

int NvVideoConverter::setCapturePlaneBufferLayout ( enum v4l2_nv_buffer_layout  type  ) 

Set the buffer layout of the capture plane buffers.

Calls the VIDIOC_S_EXT_CTRLS ioctl internally with Control id V4L2_CID_VIDEO_CONVERT_CAPTURE_PLANE_LAYOUT. Must be called before setFormat on any of the planes.

Parameters:
[in] type Type of layout, one of enum v4l2_nv_buffer_layout
Returns:
0 for success, -1 for failure

Definition at line 204 of file NvVideoConverter.cpp.

int NvVideoConverter::setCapturePlaneFormat ( uint32_t  pixfmt,
uint32_t  width,
uint32_t  height,
enum v4l2_nv_buffer_layout  type 
)

Sets the format on the converter output plane.

Calls VIDIOC_S_FMT ioctl internally on the capture plane.

Parameters:
[in] pixfmt One of the raw V4L2 pixel formats
[in] width Width of the output buffers in pixels
[in] height Height of the output buffers in pixels
[in] layout Layout of the buffers in plane, one of enum v4l2_nv_buffer_layout
Returns:
0 for success, -1 for failure

Definition at line 89 of file NvVideoConverter.cpp.

int NvVideoConverter::setCropRect ( uint32_t  left,
uint32_t  top,
uint32_t  width,
uint32_t  height 
)

Set the cropping rectangle for the converter.

Calls the VIDIOC_S_SELECTION internally on capture plane. Must be called before setFormat on any of the planes.

Parameters:
[in] left Horizontal offset of the rectangle, in pixels
[in] top Verticaal offset of the rectangle, in pixels
[in] width Width of the rectangle, in pixels
[in] height Height of the rectangle, in pixels
Returns:
0 for success, -1 for failure

Definition at line 284 of file NvVideoConverter.cpp.

int NvVideoConverter::setFlipMethod ( enum v4l2_flip_method  method  ) 

Set the flip method.

Calls the VIDIOC_S_EXT_CTRLS ioctl internally with Control id V4L2_CID_VIDEO_CONVERT_FLIP_METHOD. Must be called before setFormat on any of the planes.

Parameters:
[in] method Type of flip method, one of enum v4l2_flip_method
Returns:
0 for success, -1 for failure

Definition at line 244 of file NvVideoConverter.cpp.

int NvVideoConverter::setInterpolationMethod ( enum v4l2_interpolation_method  method  ) 

Set the interpolation(filter) method used for scaling.

Calls the VIDIOC_S_EXT_CTRLS ioctl internally with Control id V4L2_CID_VIDEO_CONVERT_INTERPOLATION_METHOD. Must be called before setFormat on any of the planes.

Parameters:
[in] method Type of interpolation method, one of enum v4l2_interpolation_method
Returns:
0 for success, -1 for failure

Definition at line 224 of file NvVideoConverter.cpp.

int NvVideoConverter::setOutputPlaneBufferLayout ( enum v4l2_nv_buffer_layout  type  ) 

Set the buffer layout of the output plane buffers.

Calls the VIDIOC_S_EXT_CTRLS ioctl internally with Control id V4L2_CID_VIDEO_CONVERT_OUTPUT_PLANE_LAYOUT. Must be called before setFormat on any of the planes.

Parameters:
[in] type Type of layout, one of enum v4l2_nv_buffer_layout
Returns:
0 for success, -1 for failure

Definition at line 184 of file NvVideoConverter.cpp.

int NvVideoConverter::setOutputPlaneFormat ( uint32_t  pixfmt,
uint32_t  width,
uint32_t  height,
enum v4l2_nv_buffer_layout  type 
)

Sets the format on the converter output plane.

Calls VIDIOC_S_FMT ioctl internally on the output plane.

Parameters:
[in] pixfmt One of the raw V4L2 pixel formats
[in] width Width of the output buffers in pixels
[in] height Height of the output buffers in pixels
[in] layout Layout of the buffers in plane, one of enum v4l2_nv_buffer_layout
Returns:
0 for success, -1 for failure

Definition at line 118 of file NvVideoConverter.cpp.

int NvVideoConverter::setTnrAlgorithm ( enum v4l2_tnr_algorithm  algorithm  ) 

Set the TNR(Temporal Noise Reduction) algorithm to use.

Calls the VIDIOC_S_EXT_CTRLS ioctl internally with Control id V4L2_CID_VIDEO_CONVERT_TNR_ALGORITHM. Must be called before setFormat on any of the planes.

Parameters:
[in] algorithm Type of TNR algorithm to use, one of enum v4l2_tnr_algorithm
Returns:
0 for success, -1 for failure

Definition at line 264 of file NvVideoConverter.cpp.

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

Wait till all the buffers queued on the output plane are converted and dequeued from the capture plane.

This is a blocking call.

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

Reimplemented from NvV4l2Element.

Definition at line 147 of file NvVideoConverter.cpp.


Member Data Documentation


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