1 Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved.
3 @page l4t_mm_08_video_decode_drm 08_video_dec_drm
6 - [Overview](#overview)
7 - [Building and Running](#build_and_run)
9 - [Key Structure and Classes](#key)
11 - - - - - - - - - - - - - - -
15 This sample demonstrates how to render video stream or UI with the
16 NVIDIA<sup>®</sup> Tegra<sup>®</sup> Direct Rendering Manager (DRM).
17 This sample provides rendering support on non-X11 and lightweight display
18 systems. The DRM is implemented in user-space and is compatible with DRM 2.0.
20 A DRM is a subsystem of the Linux kernel that interfaces with GPUs.
22 The sample supports two running modes, depending on the `--disable-video` option:
23 - If specified, the sample draws only the UI on the screen.
24 The UI is a
static JPEG image and a moving color block.
25 - Otherwise, it displays both the decoded video stream and the UI.
27 The sample demonstrates the supported DRM buffer allocation policies:
28 - Allocated by user. UI stream uses
this policy.
29 - Allocated by other V4L2 components (decoder or converter), where memory is
30 shared with DRM. Video stream uses
this policy.
32 The sample supports these video formats:
37 <a name=
"build_and_run">
38 - - - - - - - - - - - - - - -
39 ## Building and Running ##
41 #### Prerequisites ####
42 * You have followed Steps 1-3 in @ref mmapi_build.
43 * If you are building from your host Linux PC (x86), you have
44 followed Step 4 in @ref mmapi_build.
49 $ cd $HOME/tegra_multimedia_api/samples/08_video_dec_drm
55 $ ./video_dec_drm <in-file> <in-format> [options]
57 ### To view supported options
59 $ ./video_dec_drm --help
61 ### Example: To render only the UI stream
63 ./video_decode_drm --disable-video
65 ### Example: To render only the video stream
67 ./video_decode_drm ../../data/Video/sample_outdoor_car_1080p_10fps.h264 H264 --disable-ui
69 ### Example: To render the UI and video streams
71 ./video_decode_drm ../../data/Video/sample_outdoor_car_1080p_10fps.h264 H264
75 - - - - - - - - - - - - - - -
77 The following diagram shows the flow of data through the sample.
79 
81 The following diagram shows the interactions between the separate threads
84 
87 If the options include `--disable-video`, the sample does the following:
89 1. Creates DRM renderer
for drawing UI.
93 1. Creates the decoder and converter
for conversion from YUV422/BL to NV12/PL.
94 2. Sets up the decoder output plane.
95 3. Feeds data into the decoder output plane, until the EOS is reached.
99 1. Sets up decoder capture plane and converter output/capture plane based on the
100 modes user requested.
101 2. Creates DRM renderer.
102 3. Decodes and converts.
103 4. Dequeues the buffer into the DRM
for display.
105 #### ui_renderer_loop
107 1. Draws a
static Image on the second plane (the first plane is used
for video
109 2. Draws a moving color block on the third plane.
111 #### render_dequeue_loop:
113 1. Dequeues the buffer from DRM and returns it to the converter capture plane.
114 @note Because the DRM dequeue operation is a blocking call, you must make the
115 call in separate thread from the enqueue operation.
116 2. Detects whether EOS has been reached.
121 - - - - - - - - - - - - - - -
123 ## Key Structure and Classes ##
125 The following tables shows the key classes and functions that
this sample uses.
128 |-------|-----------|
129 |
class @ref
NvDrmRenderer | Contains elements and functions to render frames with tegra DRM.|
130 |class @ref
NvVideoDecoder | Contains all video decoding-related elements and functions.|
131 |class @ref
NvVideoConverter | Contains elements and functions for video format conversion.|
135 |Function|Description|
136 |--------|-----------|
137 |ui_render_loop_fcn | Thread function to render the UI image.|
138 |renderer_dequeue_loop_fcn | Thread function to dequeue the flipped frame from
NvDrmRenderer().|
139 |conv0_capture_dqbuf_thread_callback | Callback function to enqueue a new frame into
NvDrmRenderer. |
140 |conv0_output_dqbuf_thread_callback | Callback function to receive a frame from decoder and process format conversion.|
Helper class for rendering using LibDRM.
Defines a helper class for V4L2 Video Decoder.
Defines a helper class for V4L2 Video Converter.