|
|
Multimedia API ReferenceNovember 16, 2016 | 24.2.1 Release |
This sample demonstrates how to use libargus to set up the camera class components for a capture operation. An EGLStream is also created to connect to the V4L2 video encoder to allow for capturing encoded video streams to a file.
Before running the sample, you must have the following:
This sample demonstrates the camera producer and consumer programming model. The image output is performed using the EGLStream. This is an efficient and zero-copy output to various EGLStream consumers. Possible consumers include:
The following classes are used. For more information on libargus and the EGLStream, refer to the libargus documentation.
| Classes | Description |
|---|---|
| class NvVideoEncoder | The class contains all the video encode related elements and functions. |
The NvVideoEncoder class packages all the video encoding related elements and functions. The key members used in the sample are as follows:
| NvVideoEncoder | Description |
|---|---|
| output_plane | V4L2 output plane. |
| capture_plane | V4L2 capture plane. |
| createVideoEncoder | Static function to create video encode object. |
| setExtControls | Sets the external control to the V4L2 device. |
| setOutputPlaneFormat | Sets the output plane format. |
| setCapturePlaneFormat | Sets the capture plane format. |
| isInError | Checks if under an error state. |
The NvVideoEncoder class contains two key elements:
output_planecapture_planeThe NvVideoEncoder object is derived from the following class type:
The key members used in the sample are as follows:
| NvV4l2ElementPlane | Description |
|---|---|
| setupPlane | Sets up the plane of the V4L2 element. |
| deinitPlane | Destroys the plane of the V4L2 element. |
| setStreamStatus | Starts/stops the stream. |
| setDQThreadCallback | Sets the callback function of the dqueue buffer thread. |
| startDQThread | Starts the thread of the dqueue buffer. |
| stopDQThread | Stops the thread of the dqueue buffer. |
| qBuffer | Queues the V4L2 buffer. |
| dqBuffer | Dqueue the V4L2 buffer. |
| getNumberBuffers | Gets the number of V4L2 buffers. |
| getNthBuffer | Gets the nth number V4L2 buffer. |