Jetson Linux Multimedia API Reference

32.4.2 Release

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
multimedia_api/ll_samples/docs/l4t_mm_00_video_decode.md
Go to the documentation of this file.
1 Copyright (c) 2014-2019, NVIDIA CORPORATION. All rights reserved.
2 
3 @page l4t_mm_00_video_decode_group 00_video_decode
4 @{
5 
6  - [Overview](#overview)
7  - [Building and Running](#build_and_run)
8  - [Flow](#flow)
9  - [Key Structure and Classes](#key)
10 
11 
12 - - - - - - - - - - - - - - -
13 <a name="overview">
14 ## Overview ##
15 
16 The video_decode sample application demonstrates how to use the buffer
17 allocated by the `libv4l2` component to decode H.264, H.265, VP8, VP9, MPEG4,
18 or MPEG2 video streams.
19 
20 The application reads an H.264, H.265, VP8, VP9, MPEG4, or MPEG2 elementary
21 video file, decodes it, and passes it to the EGL renderer to show
22 the decoded images without any extra memory copy.
23 
24 Supported video formats are:
25 * H.264
26 * H.265
27 * VP8
28 * VP9
29 * MPEG4
30 * MPEG2
31 
32 <a name="build_and_run">
33 - - - - - - - - - - - - - - -
34 ## Building and Running ##
35 
36 ### Prerequisites
37 * You have followed steps 1-3 in @ref mmapi_build.
38 * If you are building from your host Linux PC (x86), you have followed
39  step 4 in @ref mmapi_build.
40 
41 ### To build
42 * Enter:
43 
44  $ cd $HOME/multimedia_api/samples/00_video_decode
45  $ make
46 
47 ### To run
48 * Enter:
49 
50  $ ./video_decode <in-format> [options] <in-file>
51 
52 ### To view supported options
53 Enter:
54 
55  $ ./video_decode --help
56 
57 ### Example
58 
59  $ ./video_decode H264 ../../data/Video/sample_outdoor_car_1080p_10fps.h264
60 
61 
62 <a name="flow">
63 - - - - - - - - - - - - - - -
64 ## Flow
65 The following diagram shows the flow through this sample.
66 
67 ![ ](l4t_mm_00_video_decode.png)
68 
69 * The @b Output @b Plane receives input in bitstream format and delivers it
70  to the @b Decoder for decoding.
71 * The @b Capture @b Plane transfer decoded frames to the application
72  in YUV format.
73 * For the @b Output @b Plane the application supports MMAP and USRPTR
74  memory types. For the @b Capture @b Plane it supports MMAP and DMABUF memory types.
75 * The application can also dump files from the Capture Plane.
76 
77 
78 <a name="key">
79 - - - - - - - - - - - - - - -
80 ## Key Structure and Classes ##
81 
82 The sample uses the following key structures and classes.
83 
84 | Element | Description |
85 | ---------------- | ----------- |
86 | [NvVideoDecoder](classNvVideoDecoder.html) | Contains all video decoding-related elements and functions. |
87 | [NvEglRenderer](classNvEglRenderer.html) | Contains all EGL display rendering-related functions. |
88 | dec_capture_loop | A pointer to the thread handler for the decoding capture loop. |
89 
90 The [NvVideoDecoder](classNvVideoDecoder.html) class packages all video
91 decoding-related elements and functions. Key members used in the sample are:
92 
93 | Member | Description |
94 | ---------------- | ----------- |
95 | [output_plane](classNvV4l2Element.html#aaba251827cef1b23e7c42f776e95fee5) | Specifies the V4L2 output plane. |
96 | [capture_plane](classNvV4l2Element.html#a91806d7ed13b4b2c48758e8a02f46c6d) | Specifies the V4L2 capture plane. |
97 | [createVideoDecoder](classNvVideoDecoder.html#a7d4e17585bb745c9c3023173aeb1528a) | Static function to create video decode object. |
98 | [subscribeEvent](classNvV4l2Element.html#a7fd9f21268d5fdc979065b1b04b93220) | Subscribe event. |
99 | [setOutputPlaneFormat](l4t_mm_video_cuda_enc_group.html#NvVideoConverter::setOutputPlaneFormat) | Set output plane format. |
100 | [setCapturePlaneFormat](classNvElement.html#a3ecd42c9dda2cec9506cf2ea8fa021fe) | Set capture plane format. |
101 | [dqEvent](classNvV4l2Element.html#a9a8b5337356f82d04f5fbd7cce6e51e3) | Dqueue the event which reports by the V4L2 device. |
102 | [isInError](classNvElement.html#a3ecd42c9dda2cec9506cf2ea8fa021fe) | Checks if under error state. |
103 
104 Class %NvVideoDecoder contains two key elements: `output_plane`
105 and `capture_plane`. These objects are derived from class type
106 [NvV4l2ElementPlane](group__l4t_mm__nvv4lelementplane__group.html).
107 The sample uses the following key members:
108 
109 | Element | Description |
110 | ---------------- | ----------- |
111 | [setupPlane](classNvV4l2ElementPlane.html#a89959f455e5222f686187cc826b1b345) | Sets up the plane of V4L2 element. |
112 | [deinitPlane](classNvV4l2ElementPlane.html#af89cfe87d8f818beb0478bcf5b72574c) | Destroys the plane of the V4L2 element. |
113 | [setStreamStatus](classNvV4l2ElementPlane.html#a03164dde4d7ab41f3e92b41e13059316) | Starts/stops the stream. |
114 | [setDQThreadCallback](classNvV4l2ElementPlane.html#a37f213325e0e4857180f5b2319317d6a) | Sets the callback function of the dqueue buffer thread. |
115 | [startDQThread](classNvV4l2ElementPlane.html#a31f77f5e5ed1f320caa44a868a7cbedd) | Starts the thread of the dqueue buffer. |
116 | [stopDQThread](classNvV4l2ElementPlane.html#aa798d14493de321fa90aeab6d944ca87) | Stops the thread of the dqueue buffer. |
117 | [qBuffer](classNvV4l2ElementPlane.html#af4d52964fcfd37082f47682e457f5e95) | Queues the V4L2 buffer. |
118 | [dqBuffer](classNvV4l2ElementPlane.html#a8dfcbc666ee6f36a02abfb1170ae05cd) | Dequeues the V4L2 buffer. |
119 | [getNumBuffers](classNvV4l2ElementPlane.html#ac5cd394a7e0a4afd69395759aeac8787) | Gets the number of V4L2 buffers. |
120 | [getNumQueuedBuffers](classNvV4l2ElementPlane.html#abe813f1ac780689ea75207866fe12478) | Gets the number of buffers currently queued on the plane. |
121 
122 @}
Defines a helper class for V4L2 Video Decoder.
Defines a helper class for operations performed on a V4L2 Element plane.
NvEglRenderer is a helper class for rendering using EGL and OpenGL ES 2.0.
Definition: NvEglRenderer.h:74