L4T Multimedia API Reference

31.1 Release

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
09_camera_jpeg_capture

Overview

This sample shows how to use libargus to create camera objects and interface as frame producer so either EGL image renderer can display, preview, or perform image capture to a JPEG file.


Building and Running

Prerequisites

To build:

  • Enter:
     $ cd $HOME/multimedia_api/samples/09_camera_jpeg_capture
     $ make
    

To run

  • Enter:
     $ ./camera_jpeg_capture [OPTIONS]
    

The captured preview stream can display over HDMI. JPEG files are stored in the current directory.

To view supported options

   $ ./camera_jpeg_capture -h


Flow

The following diagram shows the flow of data through the sample.

The sample uses producer and consumer model to establish frame flow from camera object producing frame output to consumer connecting EGLstream buffer for rendering preview mode.

The programming model is quite straightforward and efficient once you are familiar with it.

The API is frame-based cross-platform user mode API. The design is to ensure zero buffer copy when it comes to consuming output frame.


Key Structure and Classes

Regarding libargus and EGLStream, please refer to libargus document.

ClassesDescription
class NvEGLRender The class contains elements and functions to render frames to EGL window.
class NvJpegEncoder The class contains elements and functions to encode JPEG images.

NvEGLRender is the class that packages all the functions for video rendering. Key members used in the sample are as follows:

NvEGLRender Description
NvEglRenderer::render Render the FD to an EGL window.

NvJpegEncoder is the class that packages all the functions for JPEG encoding. Key members used are:

NvV4l2ElementPlane Description
encodeFromFd Encode form FD of buffer exported by V4L2 element.