L4T Multimedia API Reference

32.3.1 Release

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
multimedia_api/ll_samples/docs/l4t_mm_decoder_unit_sample.md
Go to the documentation of this file.
1 Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
2 
3 @page l4t_mm_decoder_unit_sample_group decoder_unit_sample
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 decode_sample application is a unit level implementation that
17 demonstrates how to use the buffer
18 allocated by the `libv4l2` component to decode H.264 video streams.
19 
20 The application reads an H.264 elementary
21 video file, decodes it, and writes the raw YUV buffer into a file
22 without any extra memory copy.
23 
24 Supported video formats are:
25 * H.264
26 
27 <a name="build_and_run">
28 - - - - - - - - - - - - - - -
29 ## Building and Running ##
30 
31 ### Prerequisites
32 * You have followed steps 1-3 in @ref mmapi_build.
33 * If you are building from your host Linux PC (x86), you have followed
34  step 4 in @ref mmapi_build.
35 
36 ### To build
37 * Enter:
38 
39  $ cd $HOME/multimedia_api/samples/unittest_samples/decoder_unit_sample
40  $ make
41 
42 ### To run
43 * Enter:
44 
45  $ ./decode_sample <in-file> <out-file>
46 
47 ### Example
48 
49  $ ./decode_sample ../../data/Video/sample_outdoor_car_1080p_10fps.h264 out_sample_outdoor_car_1080p_10fps.yuv
50 
51 
52 <a name="flow">
53 - - - - - - - - - - - - - - -
54 ## Flow
55 The following steps show the flow through this sample.
56 
57 -# The decoder instance is created.
58 -# V4L2_EVENT_RESOLUTION_CHANGE is subscribed.
59 -# @b Output @b Plane and @b Capture @b Plane are set up.
60 -# External controls are set.
61 -# The @b Output @b Plane receives input in bitstream format and delivers it
62  to the @b Decoder for decoding.
63 -# The @b Capture @b Plane transfers decoded frames to the application
64  in YUV format.
65 -# For the @b Output @b Plane the application supports MMAP
66  memory type. For the @b Capture @b Plane it supports DMABUF memory type.
67 -# The application takes decoded buffers from @b Capture @b Plane and dumps into a file.
68 
69 
70 <a name="key">
71 - - - - - - - - - - - - - - -
72 ## Key Structure and Classes ##
73 
74 The sample uses the following key class:
75 
76 | Element | Description |
77 | ---------------- | ----------- |
78 | Buffer | Class modeled on v4l2_buffer structure. |
79 
80 The key structures and functions used in the sample are:
81 
82 | Function | Description |
83 | ---------------- | ----------- |
84 | decode_process | Function loop to DQ and EnQ buffers on output plane till eos is signalled. |
85 | capture_thread | A pointer to the thread handler for the decoding capture loop. |
86 | dq_event | Function to dequeue an event. |
87 | dq_buffer | Function to dequeue a buffer from the plane. |
88 | q_buffer | Function to queue a buffer on the plane. |
89 | req_buffers_on_capture_plane | Function to request for buffers on the decoder capture plane. |
90 | req_buffers_on_output_plane | Function to request for buffers on the decoder output plane. |
91 | set_capture_plane_format | Function to set the format on the decoder capture plane. |
92 | set_output_plane_format | Function to set the format on the decoder output plane. |
93 | set_ext_controls | Function to set the value of controls. |
94 | subscribe_event | Function to subscribes to a V4L2 event. |
95 
96 @}
#define V4L2_EVENT_RESOLUTION_CHANGE
Defines the V4L2 event type for decoder resolution event change.