NVIDIA DRIVE 5.0 Linux SDK API Reference

5.0.10.3 Release

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
nvmedia_parser.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. All
3  * information contained herein is proprietary and confidential to NVIDIA
4  * Corporation. Any use, reproduction, or disclosure without the written
5  * permission of NVIDIA Corporation is prohibited.
6  */
7 
8 
9 #ifndef _NVMEDIA_PARSER_H
10 #define _NVMEDIA_PARSER_H
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 #include "nvcommon.h"
17 #include "nvmedia_common.h"
18 #include "nvmedia_drm.h"
19 
35 // RVCT compiler doesn't allow anonymous structures or unions by default.
36 #if defined(__CC_ARM)
37 #pragma anon_unions
38 #endif
39 
41 typedef enum {
59 
61 typedef enum {
67 
69 typedef enum {
91 
93 typedef enum {
117 
119 typedef enum {
157 
159 typedef enum
160 {
166 
168 typedef enum
169 {
179 
183 typedef enum
184 {
201 
210 
211  /* Security group */
212 
215 
220  /* Other: Generate slice offsets with CompletePicture mode. */
232 
234 typedef struct
235 {
237  const uint8_t *pByteStream;
239  uint32_t uDataLength;
241  int64_t llPts;
257 
259 typedef struct
260 {
262  uint8_t uPresentFlag;
264  uint8_t uIDRFrame;
266  uint8_t uLTRefFrame;
270  uint8_t uPredicted;
274  uint32_t uFrameNum;
276  uint32_t uLTRFrameIdx;
278 
280 typedef struct
281 {
283  uint8_t uRefFrame;
285  uint8_t uIDRFrame;
287  uint8_t uLTRefFrame;
289  uint8_t uReserve0;
293  uint32_t uFrameNum;
295  uint32_t uLTRFrameIdx;
297 
299 typedef struct
300 {
302  uint32_t poc_fn_bits;
311  NvMediaDecRefFrame RPSList[16];
313 
319 #define MAX_SEQ_HDR_LEN 512
320 
326 typedef struct
327 {
328  /* Codec information */
329 
332 
333  /* Frame information */
334 
336  double fFrameRate;
338  uint32_t uDecodeBuffers;
340  uint8_t bProgSeq;
342  uint32_t uBitrate;
343 
344  /* Sequence information */
345 
351  uint8_t SequenceHeaderData[MAX_SEQ_HDR_LEN];
352 
353  /* Frame size information */
354 
356  uint16_t uCodedWidth;
358  uint16_t uCodedHeight;
360  uint16_t uDisplayWidth;
362  uint16_t uDisplayHeight;
364  uint16_t uActualWidth;
366  uint16_t uActualHeight;
371 
372  /* Aspect ratio information */
373 
375  uint16_t uDARWidth;
377  uint16_t uDARHeight;
379  uint16_t uSARWidth;
381  uint16_t uSARHeight;
382 
383  /* Color information */
384 
406 
407 
415 typedef struct
416 {
418  uint16_t uDARWidth;
420  uint16_t uDARHeight;
421 
426 
428  uint16_t uDisplayWidth;
430  uint16_t uDisplayHeight;
431 
433  int64_t llFrameTime;
435  int64_t llTimeBase;
436 
439 
441  int32_t field_pic_flag;
445  int32_t second_field;
453  int32_t ref_pic_flag;
455  int32_t intra_pic_flag;
457  int32_t chroma_format;
460 
465  uint8_t *pBitstreamData;
467  uint32_t uNumSlices;
469  uint32_t *pSliceDataOffsets;
471  uint32_t nal_ref_idc;
474 
476  union {
491  } CodecSpecificInfo;
492 
495 
502 
506 typedef int32_t (*pfnCbNvMediaBeginSequence)(void *, const NvMediaParserSeqInfo *);
509 typedef void (*pfnCbNvMediaUnhandledNALU)(void *, const uint8_t *, int32_t);
510 typedef NvMediaStatus (*pfnCbNvMediaAllocPictureBuffer)(void *, NvMediaRefSurface **);
511 typedef void (*pfnCbNvMediaRelease)(void *, NvMediaRefSurface *);
512 typedef void (*pfnCbNvMediaAddRef)(void *, NvMediaRefSurface *);
513 typedef NvMediaStatus (*pfnCbNvMediaCreateDecrypter)(void *, uint16_t width, uint16_t height);
518 typedef void (*pfnCbNvMediaGetDpbInfoForMetadata)(void *, NvMediaRefSurface *, NvMediaDPBInfo *);
521 typedef struct
522 {
576 
578 typedef struct
579 {
583  void *pClientCtx;
587  uint16_t uErrorThreshold;
593 
597 typedef void NvMediaParser;
598 
610 NvMediaParser *
612  NvMediaParserParams *pParserParams
613 );
614 
618 void
620  NvMediaParser *pParser
621 );
622 
660  NvMediaParser *pParser,
661  NvMediaBitStreamPkt *pStreamPacket
662 );
663 
690  NvMediaParser *pParser,
691  NvMediaBitStreamPkt *pStreamPacket
692 );
693 
709  NvMediaParser *pParser,
710  NvMediaAESParams *pAesParams
711 );
712 
726 void
728  NvMediaParser *pParser
729 );
730 
747  NvMediaParser *pParser,
748  NvMediaParserAttr eAttributeType,
749  uint32_t uAttributeSize,
750  void *pAttribute
751 );
752 
769  NvMediaParser *pParser,
770  NvMediaParserAttr eAttributeType,
771  uint32_t uAttributeSize,
772  void *pAttribute
773 );
774 
777 #ifdef __cplusplus
778 }; /* extern "C" */
779 #endif
780 
781 #endif /* _NVMEDIA_PARSER_H */
uint32_t nal_ref_idc
Required only for encrypted h264 bitstreams.
NvMediaStatus NvMediaParserSetAttribute(NvMediaParser *pParser, NvMediaParserAttr eAttributeType, uint32_t uAttributeSize, void *pAttribute)
Sets attributes for the decode parser object.
transfer characteristics: BT470M
int32_t repeat_first_field
For 3:2 pulldown (number of additional fields, 2=frame doubling, 4=frame tripling) ...
#define MAX_SEQ_HDR_LEN
Defines the maximum size of the sequence header.
pfnCbNvMediaRelease Release
Callback to tell client to decrement the buffer reference count by 1.
uint32_t uLTRFrameIdx
LongTermFrameIdx of a picture.
Mastering display data for an H.265 picture.
NvMediaStatus(* pfnCbNvMediaSliceDecode)(void *, NvMediaSliceDecodeData *)
pfnCbNvMediaGetDpbInfoForMetadata GetDpbInfoForMetadata
callback to pass internal DPB information to the client.
pfnCbNvMediaCreateDecrypter CreateDecrypter
Callback to create NvMediaVideoDecrypter component to handle encrypted contents.
Holds picture parameter information for a VP9 picture.
NvMediaColorRangeType eVideoFullRangeFlag
Color info: Specifies the Video Range (0-255) vs (16-235)
int uint32_t width
uint32_t uSequenceHeaderSize
Sequence info: Specifies the number of bytes in SequenceHeaderData.
int32_t chroma_format
Chroma Format (should match sequence info)
NvMediaVideoCodec eCodec
Codec type.
uint32_t uFrameNum
frame number
NvMediaBool bPTSValid
NVMEDIA_TRUE if llPTS is valid (also used to detect frame boundaries for VC1 SP/MP) ...
NvMediaEncryptParams encryptParams
contains encrypted metadata for pass1
uint16_t uDisplayTopOffset
Top offset for display.
Frame timing: Set frame rate for PTS calculation (float type)
transfer characteristics: BT2020_1
transfer characteristics: Log100
uint32_t NvMediaBool
A boolean value, holding NVMEDIA_TRUE or NVMEDIA_FALSE.
Definition: nvmedia_core.h:79
Holds decoded reference frame information.
NvMediaPictureInfoVC1 vc1
picture parameter information for vc1 NvMediaPictureInfoVC1
Holds encrypted metadata information that the parser passes to the video decoder component.
Definition: nvmedia_drm.h:71
transfer characteristics: IEC61966_2_4
int32_t intra_pic_flag
Frame is entirely intra coded (no temporal dependencies)
transfer characteristics: BT709
video format: PAL
NvMediaPictureInfoVP8 vp8
picture parameter information for VP8 NvMediaPictureInfoVP8
uint8_t * pBitstreamData
Pointer to the bitstream data for this picture (slice-layer)
pfnCbNvMediaGetBackwardUpdates GetBackwardUpdates
callback to get backward prabability data for VP9 codec.
int64_t llFrameTime
Frame time in time_base units if NvMParseAttr_UseFrameTimingInfo is enabled.
NvMediaStatus(* pfnCbNvMediaGetBackwardUpdates)(void *, NvMediaVP9BackwardUpdates *)
uint32_t uLTRFrameIdx
LongTermFrameIdx of the frame.
uint8_t bProgSeq
Frame info: Specifies whether the bitstream is progressive or not.
NvMediaStatus NvMediaParserSetEncryption(NvMediaParser *pParser, NvMediaAESParams *pAesParams)
Provides the parser object with encryption metadata for the current buffer.
NvMediaPictureInfoH264 h264
picture parameter information for h264 NvMediaPictureInfoH264
uint16_t uCodedWidth
Frame size info: Specifies the coded Picture Width.
Holds re-encrypted data information that the video decoder returns to the parser. ...
Definition: nvmedia_drm.h:106
Security: Enable m_pSlhData allocation for encrypted streams in parser.
uint32_t uReferenceClockRate
Ticks per second of PTS clock (0=default=10000000=10Mhz)
uint16_t uDisplayWidth
Display Width.
NvMediaParser * NvMediaParserCreate(NvMediaParserParams *pParserParams)
Creates a video decoder parser object.
uint16_t uDisplayWidth
Frame size info: Specifies the displayed Horizontal Size.
uint16_t uDARWidth
Display Aspect Ratio = uDARWidth.
uint8_t uPredicted
value 0 or 1 : whether the frame is motion predicted for the current frame as specified in slice head...
uint32_t uPictureOrderCnt
picture order counter
uint32_t uBitrate
Frame info: Specifies the Video bitrate (bps)
Frame management: DPB size is set to max number of reference frames.
video format: NTSC
int32_t top_field_first
Frame pictures only.
matrix coefficients: SMPTE170M
NvMediaColorPrimariesType
Defines color_primaries types.
Frame management: Disable DPB logic for low latency H264 playback.
uint32_t poc_fn_bits
Specify the max number of bits used to derive frame number.
Holds picture parameter information for an MPEG-4 Part 2 picture.
color range: full
NvMediaStatus(* pfnCbNvMediaCreateDecrypter)(void *, uint16_t width, uint16_t height)
pfnCbNvMediaAllocPictureBuffer AllocPictureBuffer
callback to get one free frame-buffer to do current frame decoding.
matrix coefficients: FCC
NvMediaBool bEOS
NVMEDIA_TRUE if this is an End-Of-Stream packet (flush everything)
color primaries: BT2020
NvMediaVideoCodec eCodec
Codec info: Specifies the compression standard.
transfer characteristics: ST418_1
NvMediaPictureInfoH265 hevc
picture parameter information for h265 NvMediaPictureInfoH265
Holds decoded Picture Buffer information.
NvMediaBool bDiscontinuity
NVMEDIA_TRUE if DecMFT is signalling a discontinuity.
Holds decoded current frame information.
normal decode mode
matrix coefficients: BT709
uint8_t uLTRefFrame
value 0 or 1 : whether the frame is long term ref
matrix coefficients: YCgCo
Holds picture parameter information for an H.265 picture.
Frame timing: Set default frame rate for PTS calculation (float type)
uint16_t uSARWidth
Aspect ratio info: Specifies the sample Aspect Ratio = uSARWidth.
NVIDIA Media Interface: Common Types for Video/Image Encode/Decode
NVIDIA Media Interface: Video Decryptor (DRM) API
uint16_t uSARHeight
Aspect ratio info: Specifies the sample Aspect Ratio = uSARHeight.
NvMediaStatus(* pfnCbNvMediaDecryptHdr)(void *, NvMediaParserPictureData *)
matrix coefficients: SMPTE240
int64_t llPts
Presentation Time Stamp for this packet (clock rate specified at initialization)
Other: Enable VC-1 advanced profile interlaced.
uint32_t uPictureOrderCnt
Picture order counter.
uint8_t uReserve0
reserved for 4-byte alignment
NvMediaBool bCompletePicture
NVMEDIA_TRUE if this packet contains complete picture.
pfnCbNvMediaSliceDecode SliceDecode
Callback to pass slice level data for the slice level decoding use case.
matrix coefficients: Forbidden
transfer characteristics: Unspecified
uint32_t uMaxBitstreamSize
Sequence info: Specifies the maximum size of bitstream buffer.
uint8_t uIDRFrame
value 0 or 1 : whether the frame is an IDR
int32_t(* pfnCbNvMediaBeginSequence)(void *, const NvMediaParserSeqInfo *)
int32_t progressive_frame
Frame is progressive or not.
transfer characteristics: Log316
NvMediaBool bMasteringDispDataPresent
Color info: Specifies that mastering display data is present.
void(* pfnCbNvMediaRelease)(void *, NvMediaRefSurface *)
int32_t second_field
Second field of a complementary field pair.
uint8_t uIDRFrame
value 0 or 1 : indicating current frame IDR or not
transfer characteristics: BT2020_2
video format: MAC
transfer characteristics: Linear
transfer characteristics: IEC61966_2_1
NvMediaAESMetaData AesMetaData
Encrypted content decoding specific parameters.
NvMediaStatus(* pfnCbNvMediaDisplayPicture)(void *, NvMediaRefSurface *, int64_t)
chroma format YUV422
NvMediaStatus
The set of all possible error codes.
Definition: nvmedia_core.h:189
uint16_t uDisplayTopOffset
Frame size info: Specifies the top offset for display.
uint8_t uBitDepthLumaMinus8
Color info: Specifies the Luma bit depth (0=8bit)
Holds picture information for the current frame decode operation.
NvMediaDecCurrFrame currentFrame
Specify the property of current decoded frame.
Other: Get bitstream error for current input buffer.
NvMediaPictureInfoMPEG4Part2 mpeg4
picture parameter information for mpeg4 NvMediaPictureInfoMPEG4Part2
uint16_t uDARHeight
Aspect ratio info: Displays Aspect Ratio = uDARHeight.
uint16_t uDisplayLeftOffset
Left offset for display.
matrix coefficients: Reserved
Holds initialization parameters for the decoder class.
uint32_t uActiveRefFrames
number of valid entries in RPS
color primaries: Forbidden
pfnCbNvMediaBeginSequence BeginSequence
callback to provide sequence level information to client Client will use this to create NvMediaVideoD...
NvMediaBool bDecodeNextSlice
NVMEDIA_TRUE if this packet belongs to the same frame currently being decoded.
Frame management: Decode IDR Frames only.
transfer characteristics: BT470BG
NvMediaBool bCompleteSlice
NVMEDIA_TRUE if this packet contains complete Slice.
transfer characteristics: BT1361
NvMediaParserDecodeMode
Defines the parser decode modes.
Frame management: 0: Normal decode, 1: KeyFrameDecode.
int uint32_t uint32_t height
uint32_t uNumSlices
Number of slices in this picture.
uint16_t uDisplayLeftOffset
Frame size info: Specifies the left offset for display.
pfnCbNvMediaDecodePicture DecodePicture
callback to provide one frame/field worth of data required to achieve decoding using NvMediaVideoDeco...
uint32_t uDataLength
Data length for this packet.
uint32_t uDecodeBuffers
Frame info: Specifies the number of decode buffers required.
chroma format YUV420
void NvMediaParserFlush(NvMediaParser *pParser)
Flushes the parser decode session.
uint32_t uBitstreamDataLen
Bitstream data.
pfnCbNvMediaGetClearHdr GetClearHdr
callback to get clear header data from NvMediaVideoDecrypter.
slice level data used with slice level decoding
NvMediaVideoFormatType
Defines video format types.
uint16_t uDARHeight
Display Aspect Ratio = uDARHeight.
Frame timing: Use frame timing info for PTS calculation.
uint8_t uRefFrame
value 0 or 1 : indicating current frame is referenced or not
NvMediaParserAttr
Defines parser attributes, which sets/gets decoder properties to parse as per the client/app requirem...
NvMediaMasteringDisplayData MasteringDispData
Color info: Specifies Only: Mastering display data if present.
NvMediaStatus(* pfnCbNvMediaGetClearHdr)(void *, NvMediaParserPictureData *)
NvMediaSliceDecodeData SliceData
Pass slice level data if slice level decoding enabled.
uint32_t uRTP_NALUSizeFieldWidthInBytes
if it is 0 then it is non-RTP
NvMediaBool bSliceDecode
Flag to indicate that slice level decoding is enabled.
pfnCbNvMediaDecryptHdr DecryptHdr
Callback to pass encrypted data for decryption of frame-headers.
Frame management: Drop MPEG2 B-Frames.
Other: Enable slice-level decode for the current session.
const uint8_t * pByteStream
Pointer to byte stream data.
int32_t bottom_field_flag
0=top field, 1=bottom field (ignored if field_pic_flag=0)
uint8_t uBitDepthChromaMinus8
Color info: Specifies the Chroma bit depth (0=8bit)
matrix coefficients: BT2020 non-constant luminance system
NvMediaColorRangeType
Defines Color Range types.
NvMediaMatrixCoeffsType eMatrixCoefficients
Color info: Specifies the Matrix Coefficients.
color primaries: BT470M
NvMediaStatus(* pfnCbNvMediaAllocPictureBuffer)(void *, NvMediaRefSurface **)
Picture parameter information for an H.264 picture.
NvMediaMatrixCoeffsType
Defines matrix_coefficients types.
Holds picture parameter information for an MPEG 1 or MPEG 2 picture.
Other: Enable error status reporting.
color primaries: GenericFilm
NvMediaPictureInfoMPEG1Or2 mpeg2
picture parameter information for mpeg1/2 NvMediaPictureInfoMPEG1Or2
video format: Reserved
NvMediaColorPrimariesType eColorPrimaries
Color info: Specifies the Color Primaries.
uint16_t uDisplayHeight
Frame size info: Specifies the displayed Vertical Size.
uint16_t uDARWidth
Aspect ratio info: Displays Aspect Ratio = uDARWidth.
void NvMediaRefSurface
A generic "reference surface" pointer type.
int32_t ref_pic_flag
Frame is a reference frame.
Holds picture parameter information for a VC1 picture.
matrix coefficients: BT2020 constant luminance system
NvMediaStatus NvMediaParserParse(NvMediaParser *pParser, NvMediaBitStreamPkt *pStreamPacket)
Parses or decodes bitstream data.
NvMediaParserSeqInfo * pExternalSeqInfo
Optional external sequence header data.
matrix coefficients: Unspecified
NvMediaStatus(* pfnCbNvMediaDecodePicture)(void *, NvMediaParserPictureData *)
NvMediaStatus NvMediaParserGetAttribute(NvMediaParser *pParser, NvMediaParserAttr eAttributeType, uint32_t uAttributeSize, void *pAttribute)
Gets attributes for the decode parser object.
NvMediaVideoCodec
Video codec type.
Frame timing: Output timestamp in increasing order after filtering.
NvMediaParserChromaFormat
Defines the chroma formats of video content.
pfnCbNvMediaDisplayPicture DisplayPicture
Callback to pass frame-buffer with its timestamp in display order for display.
NvMediaTransferCharacteristicsType eTransferCharacteristics
Color info: Specifies the Transfer Characteristics.
transfer characteristics: Forbidden
uint16_t uCodedHeight
Frame size info: Specifies the coded Picture Height.
video format: Unspecified
NvMediaParserChromaFormat eChromaFormat
Color info: Specifies the chroma format (0=4:0:0, 1=4:2:0, 2=4:2:2, 3=4:4:4)
transfer characteristics: SMPTE170M
pfnCbNvMediaUnhandledNALU UnhandledNALU
Callback to report unhandled NALU.
Other: Indicate whether the previous frame was lost.
Holds encrypted metadata information that the client sends to the parser.
Definition: nvmedia_drm.h:127
chroma format YUV400 (Only Y component)
uint8_t uPresentFlag
value 0 or 1 : whether the frame is present in DPB
NvMediaStatus NvMediaParserScan(NvMediaParser *pParser, NvMediaBitStreamPkt *pStreamPacket)
Performs the first pass handling for encrypted content data.
uint16_t uActualHeight
Frame size info: Specifies the actual Height.
uint16_t uErrorThreshold
Threshold for deciding to bypass of picture (0=do not decode, 100=always decode)
uint32_t * pSliceDataOffsets
nNumSlices entries, contains offset of each slice within the bitstream data buffer ...
matrix coefficients: BT470BG
NvMediaRefSurface * pCurrPic
Current picture (output)
color primaries: SMPTE170M
video format: SECAM
int64_t llTimeBase
Base time units per second if NvMParseAttr_UseFrameTimingInfo is enabled.
Holds video sequence information.
color primaries: Reserved
Picture parameter information for a VP8 picture.
Holds VP9 counters for adaptive entropy contexts.
Frame management: Disable DPB logic for low latency H265 playback.
Frame management: Abort decoding when unsupported features or erroneous bitstream.
color primaries: BT470BG
color range: limited
int32_t picture_order_count
picture order count (if known)
uint8_t uLTRefFrame
value 0 or 1 : indicating long term reference
chroma format YUV444
void NvMediaParserDestroy(NvMediaParser *pParser)
Destroys a video decoder parser object.
video format: Component
void * pClientCtx
Client context.
void(* pfnCbNvMediaUnhandledNALU)(void *, const uint8_t *, int32_t)
NvMediaPictureInfoVP9 vp9
picture parameter information for vp9 NvMediaPictureInfoVP9
color primaries: BT_709
int32_t field_pic_flag
0=frame picture, 1=field picture
NvMediaVideoFormatType eVideoFormat
Color info: Specifies the Video Format.
pfnCbNvMediaAddRef AddRef
Callback to increase ref counting of buffer by 1 when surface is used as reference.
uint16_t uDisplayHeight
Display Height.
uint32_t uFrameNum
Frame Num.
NvMediaParserClientCb * pClient
Should always be present if using parsing functionality.
Holds the bitstream packet input for parsing.
Other: For setting max resolution for creating decoder.
void(* pfnCbNvMediaAddRef)(void *, NvMediaRefSurface *)
transfer characteristics: SMPTE240M
Frame management: Set default H.264 max_dec_frame_buffering.
color primaries: Unspecified
uint16_t uActualWidth
Frame size info: Specifies the actual Width.
transfer characteristics: Reserved
transfer characteristics: SMPTE2084
color primaries: SMPTE240M
video format: Reserved
void(* pfnCbNvMediaGetDpbInfoForMetadata)(void *, NvMediaRefSurface *, NvMediaDPBInfo *)
NvMediaTransferCharacteristicsType
Defines transfer characteristics types.
void NvMediaParser
An opaque handle representing an NvMediaParser object.
double fFrameRate
Frame info: Specifies the frame rate of the bitstream.