NVIDIA DRIVE OS Linux API Reference

5.1.3.0 Release

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

Detailed Description

Provides parsing for decoder frame handling.

Data Structures

struct  NvMediaBitStreamPkt
 Holds the bitstream packet input for parsing. More...
 
struct  NvMediaDecRefFrame
 Holds decoded reference frame information. More...
 
struct  NvMediaDecCurrFrame
 Holds decoded current frame information. More...
 
struct  NvMediaDPBInfo
 Holds decoded Picture Buffer information. More...
 
struct  NvMediaParserSeqInfo
 Holds video sequence information. More...
 
struct  NvMediaParserPictureData
 Holds picture information for the current frame decode operation. More...
 
struct  NvMediaParserClientCb
 
struct  NvMediaParserParams
 Holds initialization parameters for the decoder class. More...
 

Modules

 Abstraction of OS-Specific Client Callbacks
 

Macros

#define MAX_SEQ_HDR_LEN
 Defines the maximum size of the sequence header. More...
 

Typedefs

typedef void NvMediaParser
 An opaque handle representing an NvMediaParser object. More...
 

Enumerations

enum  NvMediaVideoFormatType {
  NvMVideoFormat_Component = 0,
  NvMVideoFormat_PAL,
  NvMVideoFormat_NTSC,
  NvMVideoFormat_SECAM,
  NvMVideoFormat_MAC,
  NvMVideoFormat_Unspecified,
  NvMVideoFormat_Reserved6,
  NvMVideoFormat_Reserved7
}
 Defines video format types. More...
 
enum  NvMediaColorRangeType {
  NvMColorRange_Reduced = 0,
  NvMColorRange_Full
}
 Defines Color Range types. More...
 
enum  NvMediaColorPrimariesType {
  NvMColorPrimaries_Forbidden = 0,
  NvMColorPrimaries_BT709,
  NvMColorPrimaries_Unspecified,
  NvMColorPrimaries_Reserved,
  NvMColorPrimaries_BT470M,
  NvMColorPrimaries_BT470BG,
  NvMColorPrimaries_SMPTE170M,
  NvMColorPrimaries_SMPTE240M,
  NvMColorPrimaries_GenericFilm,
  NvMColorPrimaries_BT2020
}
 Defines color_primaries types. More...
 
enum  NvMediaMatrixCoeffsType {
  NvMMatrixCoeffs_Forbidden =0,
  NvMMatrixCoeffs_BT709,
  NvMMatrixCoeffs_Unspecified,
  NvMMatrixCoeffs_Reserved,
  NvMMatrixCoeffs_FCC,
  NvMMatrixCoeffs_BT470BG,
  NvMMatrixCoeffs_SMPTE170M,
  NvMMatrixCoeffs_SMPTE240M,
  NvMMatrixCoeffs_YCgCo,
  NvMMatrixCoeffs_BT2020_nc,
  NvMMatrixCoeffs_BT2020_c
}
 Defines matrix_coefficients types. More...
 
enum  NvMediaTransferCharacteristicsType {
  NvMTransferCharacteristics_Forbidden =0,
  NvMTransferCharacteristics_BT709,
  NvMTransferCharacteristics_Unspecified,
  NvMTransferCharacteristics_Reserved,
  NvMTransferCharacteristics_BT470M,
  NvMTransferCharacteristics_BT470BG,
  NvMTransferCharacteristics_SMPTE170M,
  NvMTransferCharacteristics_SMPTE240M,
  NvMTransferCharacteristics_Linear,
  NvMTransferCharacteristics_Log100,
  NvMTransferCharacteristics_Log316,
  NvMTransferCharacteristics_IEC61966_2_4,
  NvMTransferCharacteristics_BT1361,
  NvMTransferCharacteristics_IEC61966_2_1,
  NvMTransferCharacteristics_BT2020_1,
  NvMTransferCharacteristics_BT2020_2,
  NvMTransferCharacteristics_SMPTE2084,
  NvMTransferCharacteristics_ST418_1,
  NvMTransferCharacteristics_HLG
}
 Defines transfer characteristics types. More...
 
enum  NvMediaParserDecodeMode {
  NvMParserDecodeMode_Normal = 0,
  NvMParserDecodeMode_SyncToKeyFrame
}
 Defines the parser decode modes. More...
 
enum  NvMediaParserChromaFormat {
  NvMediaParserChromaFormat_400 = 0,
  NvMediaParserChromaFormat_420,
  NvMediaParserChromaFormat_422,
  NvMediaParserChromaFormat_444
}
 Defines the chroma formats of video content. More...
 
enum  NvMediaParserAttr {
  NvMParseAttr_h264DisableDpb = 100,
  NvMParseAttr_DecodeIDRFrameOnly,
  NvMParseAttr_DecodeMode,
  NvMParseAttr_DropMPEG2BFrames,
  NvMParseAttr_MaxDecFrameBuffering,
  NvMParseAttr_AbortDecodeOnParserError,
  NvMParseAttr_h265DisableDpb,
  NvMParseAttr_DpbSize_SetTo_MaxRefFrames,
  NvMParseAttr_FilterTimestamps = 200,
  NvMParseAttr_UseFrameTimingInfo,
  NvMParseAttr_SetFramerate,
  NvMParseAttr_SetDefaultFramerate,
  NvMParseAttr_SecureDecode = 300,
  NvMParseAttr_EnableVC1APInterlaced = 400,
  NvMParseAttr_SetMaxRes,
  NvMParseAttr_GenerateSliceOffsets,
  NvMParseAttr_ErrorStatusReporting,
  NvMParseAttr_GetBitstreamError,
  NvMParseAttr_PrevFrameLostFlag,
  NvMParseAttr_SliceLevelDecode
}
 Defines parser attributes, which sets/gets decoder properties to parse as per the client/app requirement. More...
 

Functions

NvMediaParserNvMediaParserCreate (NvMediaParserParams *pParserParams)
 Creates a video decoder parser object. More...
 
void NvMediaParserDestroy (NvMediaParser *pParser)
 Destroys a video decoder parser object. More...
 
NvMediaStatus NvMediaParserParse (NvMediaParser *pParser, NvMediaBitStreamPkt *pStreamPacket)
 Parses or decodes bitstream data. More...
 
NvMediaStatus NvMediaParserScan (NvMediaParser *pParser, NvMediaBitStreamPkt *pStreamPacket)
 Performs the first pass handling for encrypted content data. More...
 
NvMediaStatus NvMediaParserSetEncryption (NvMediaParser *pParser, NvMediaAESParams *pAesParams)
 Provides the parser object with encryption metadata for the current buffer. More...
 
void NvMediaParserFlush (NvMediaParser *pParser)
 Flushes the parser decode session. More...
 
NvMediaStatus NvMediaParserSetAttribute (NvMediaParser *pParser, NvMediaParserAttr eAttributeType, uint32_t uAttributeSize, void *pAttribute)
 Sets attributes for the decode parser object. More...
 
NvMediaStatus NvMediaParserGetAttribute (NvMediaParser *pParser, NvMediaParserAttr eAttributeType, uint32_t uAttributeSize, void *pAttribute)
 Gets attributes for the decode parser object. More...
 

Macro Definition Documentation

#define MAX_SEQ_HDR_LEN

Defines the maximum size of the sequence header.

Definition at line 320 of file nvmedia_parser.h.

Typedef Documentation

typedef void NvMediaParser

An opaque handle representing an NvMediaParser object.

Definition at line 598 of file nvmedia_parser.h.

Enumeration Type Documentation

Defines color_primaries types.

Enumerator
NvMColorPrimaries_Forbidden 

color primaries: Forbidden

NvMColorPrimaries_BT709 

color primaries: BT_709

NvMColorPrimaries_Unspecified 

color primaries: Unspecified

NvMColorPrimaries_Reserved 

color primaries: Reserved

NvMColorPrimaries_BT470M 

color primaries: BT470M

NvMColorPrimaries_BT470BG 

color primaries: BT470BG

NvMColorPrimaries_SMPTE170M 

color primaries: SMPTE170M

NvMColorPrimaries_SMPTE240M 

color primaries: SMPTE240M

NvMColorPrimaries_GenericFilm 

color primaries: GenericFilm

NvMColorPrimaries_BT2020 

color primaries: BT2020

Definition at line 68 of file nvmedia_parser.h.

Defines Color Range types.

Enumerator
NvMColorRange_Reduced 

color range: limited

NvMColorRange_Full 

color range: full

Definition at line 60 of file nvmedia_parser.h.

Defines matrix_coefficients types.

Enumerator
NvMMatrixCoeffs_Forbidden 

matrix coefficients: Forbidden

NvMMatrixCoeffs_BT709 

matrix coefficients: BT709

NvMMatrixCoeffs_Unspecified 

matrix coefficients: Unspecified

NvMMatrixCoeffs_Reserved 

matrix coefficients: Reserved

NvMMatrixCoeffs_FCC 

matrix coefficients: FCC

NvMMatrixCoeffs_BT470BG 

matrix coefficients: BT470BG

NvMMatrixCoeffs_SMPTE170M 

matrix coefficients: SMPTE170M

NvMMatrixCoeffs_SMPTE240M 

matrix coefficients: SMPTE240

NvMMatrixCoeffs_YCgCo 

matrix coefficients: YCgCo

NvMMatrixCoeffs_BT2020_nc 

matrix coefficients: BT2020 non-constant luminance system

NvMMatrixCoeffs_BT2020_c 

matrix coefficients: BT2020 constant luminance system

Definition at line 92 of file nvmedia_parser.h.

Defines parser attributes, which sets/gets decoder properties to parse as per the client/app requirement.

Enumerator
NvMParseAttr_h264DisableDpb 

Frame management: Disable DPB logic for low latency H264 playback.

NvMParseAttr_DecodeIDRFrameOnly 

Frame management: Decode IDR Frames only.

NvMParseAttr_DecodeMode 

Frame management: 0: Normal decode, 1: KeyFrameDecode.

NvMParseAttr_DropMPEG2BFrames 

Frame management: Drop MPEG2 B-Frames.

NvMParseAttr_MaxDecFrameBuffering 

Frame management: Set default H.264 max_dec_frame_buffering.

NvMParseAttr_AbortDecodeOnParserError 

Frame management: Abort decoding when unsupported features or erroneous bitstream.

NvMParseAttr_h265DisableDpb 

Frame management: Disable DPB logic for low latency H265 playback.

NvMParseAttr_DpbSize_SetTo_MaxRefFrames 

Frame management: DPB size is set to max number of reference frames.

NvMParseAttr_FilterTimestamps 

Frame timing: Output timestamp in increasing order after filtering.

NvMParseAttr_UseFrameTimingInfo 

Frame timing: Use frame timing info for PTS calculation.

NvMParseAttr_SetFramerate 

Frame timing: Set frame rate for PTS calculation (float type)

NvMParseAttr_SetDefaultFramerate 

Frame timing: Set default frame rate for PTS calculation (float type)

NvMParseAttr_SecureDecode 

Security: Enable m_pSlhData allocation for encrypted streams in parser.

NvMParseAttr_EnableVC1APInterlaced 

Other: Enable VC-1 advanced profile interlaced.

NvMParseAttr_SetMaxRes 

Other: For setting max resolution for creating decoder.

NvMParseAttr_GenerateSliceOffsets 
NvMParseAttr_ErrorStatusReporting 

Other: Enable error status reporting.

NvMParseAttr_GetBitstreamError 

Other: Get bitstream error for current input buffer.

NvMParseAttr_PrevFrameLostFlag 

Other: Indicate whether the previous frame was lost.

NvMParseAttr_SliceLevelDecode 

Other: Enable slice-level decode for the current session.

Applies only if slice-level decode is supported.

Definition at line 184 of file nvmedia_parser.h.

Defines the chroma formats of video content.

Enumerator
NvMediaParserChromaFormat_400 

chroma format YUV400 (Only Y component)

NvMediaParserChromaFormat_420 

chroma format YUV420

NvMediaParserChromaFormat_422 

chroma format YUV422

NvMediaParserChromaFormat_444 

chroma format YUV444

Definition at line 169 of file nvmedia_parser.h.

Defines the parser decode modes.

Enumerator
NvMParserDecodeMode_Normal 

normal decode mode

NvMParserDecodeMode_SyncToKeyFrame 

only decode key frames

Definition at line 160 of file nvmedia_parser.h.

Defines transfer characteristics types.

Enumerator
NvMTransferCharacteristics_Forbidden 

transfer characteristics: Forbidden

NvMTransferCharacteristics_BT709 

transfer characteristics: BT709

NvMTransferCharacteristics_Unspecified 

transfer characteristics: Unspecified

NvMTransferCharacteristics_Reserved 

transfer characteristics: Reserved

NvMTransferCharacteristics_BT470M 

transfer characteristics: BT470M

NvMTransferCharacteristics_BT470BG 

transfer characteristics: BT470BG

NvMTransferCharacteristics_SMPTE170M 

transfer characteristics: SMPTE170M

NvMTransferCharacteristics_SMPTE240M 

transfer characteristics: SMPTE240M

NvMTransferCharacteristics_Linear 

transfer characteristics: Linear

NvMTransferCharacteristics_Log100 

transfer characteristics: Log100

NvMTransferCharacteristics_Log316 

transfer characteristics: Log316

NvMTransferCharacteristics_IEC61966_2_4 

transfer characteristics: IEC61966_2_4

NvMTransferCharacteristics_BT1361 

transfer characteristics: BT1361

NvMTransferCharacteristics_IEC61966_2_1 

transfer characteristics: IEC61966_2_1

NvMTransferCharacteristics_BT2020_1 

transfer characteristics: BT2020_1

NvMTransferCharacteristics_BT2020_2 

transfer characteristics: BT2020_2

NvMTransferCharacteristics_SMPTE2084 

transfer characteristics: SMPTE2084

NvMTransferCharacteristics_ST418_1 

transfer characteristics: ST418_1

NvMTransferCharacteristics_HLG 

transfer characteristics: HLG

Definition at line 118 of file nvmedia_parser.h.

Defines video format types.

Enumerator
NvMVideoFormat_Component 

video format: Component

NvMVideoFormat_PAL 

video format: PAL

NvMVideoFormat_NTSC 

video format: NTSC

NvMVideoFormat_SECAM 

video format: SECAM

NvMVideoFormat_MAC 

video format: MAC

NvMVideoFormat_Unspecified 

video format: Unspecified

NvMVideoFormat_Reserved6 

video format: Reserved

NvMVideoFormat_Reserved7 

video format: Reserved

Definition at line 40 of file nvmedia_parser.h.

Function Documentation

NvMediaParser* NvMediaParserCreate ( NvMediaParserParams pParserParams)

Creates a video decoder parser object.

Creates a NvMediaParser object for the specified codec NvMediaVideoCodec. This video parser object is to be destroyed with NvMediaParserDestroy().

Parameters
[in]pParserParamspoiter to a NvMediaParserParams structure All the client callbacks are registerd inside this function. These callbacks are used for different steps in decoding process.
Returns
NvMediaParser The new video decoder parser's handle or NULL if unsuccessful.
void NvMediaParserDestroy ( NvMediaParser pParser)

Destroys a video decoder parser object.

Parameters
[in]pParserThe decoder parser to be destroyed.
void NvMediaParserFlush ( NvMediaParser pParser)

Flushes the parser decode session.

This function is called to flush the decoding session. This is used before destroying parsing session to release all the buffers. This is also used to handle discontinuity.

Parameters
[in]pParserThe decoder parser object that will perform the decode parsing operation.
Returns
NvMediaStatus The completion status of the operation. Possible values are:
NVMEDIA_STATUS_OK
NVMEDIA_STATUS_ERROR
NvMediaStatus NvMediaParserGetAttribute ( NvMediaParser pParser,
NvMediaParserAttr  eAttributeType,
uint32_t  uAttributeSize,
void *  pAttribute 
)

Gets attributes for the decode parser object.

This function is called to get attribute set in parser component.

Parameters
[in]pParserThe decoder parser object that will perform the decode parsing operation.
[in]eAttributeTypeattribute type defined in NvMediaParserAttr
[in]uAttributeSizesize of the data type
[in]pAttributeis the pointer to attribute.
Returns
NvMediaStatus The completion status of the operation. Possible values are:
NVMEDIA_STATUS_OK
NVMEDIA_STATUS_ERROR
NvMediaStatus NvMediaParserParse ( NvMediaParser pParser,
NvMediaBitStreamPkt pStreamPacket 
)

Parses or decodes bitstream data.

This function is called with bitstream packet NvMediaBitStreamPkt to do the decoding of current frame. If total bitstream data is not sufficient for current frame decode then it returns after copying that data in some internal buffer. Once one frame data is accumulated then it calls different callback for different puspose. NvMediaParserClientCb::BeginSequence callback will be called when it detect new sequence data and it will pass sequence information as defined in NvMediaParserSeqInfo. NvMediaParserClientCb::AllocPictureBuffer callback will be called to get frame buffer for current frame. NvMediaParserClientCb::DecodePicture callback will be called when it has complete frame data. It passes NvMediaParserPictureData to its client. NvMediaParserClientCb::DisplayPicture callback will be called when frame is ready for display. This passes the frame buffer and its timestamp. NvMediaParserClientCb::AddRef callback called to increase ref counting of frame buffer. NvMediaParserClientCb::Release callback called to decrease ref counting. NvMediaParserClientCb::GetBackwardUpdates callback called to get probability update for VP9 codec. NvMediaParserClientCb::GetDpbInfoForMetadata callback is called if error status reporting is enabled. This is pass DPB information to client. The function calls the NvMediaParserClientCb::SliceDecode callback to pass slice-level data decoding. This is used for specific hardware/codecs.

Parameters
[in]pParserThe decoder parser object that will perform the decode parsing operation.
[in]pStreamPacketA (pointer to a) NvMediaBitStreamPkt structure containing bitstream data.
Returns
NvMediaStatus The completion status of the operation. Possible values are:
NVMEDIA_STATUS_OK
NVMEDIA_STATUS_ERROR
NvMediaStatus NvMediaParserScan ( NvMediaParser pParser,
NvMediaBitStreamPkt pStreamPacket 
)

Performs the first pass handling for encrypted content data.

This function is called with a bitstream packet NvMediaBitStreamPkt to do the first pass handling of encrypted frame data. This function is called after NvMediaParserSetEncryption(), which passes the all encryption metadata to the parser. It calls different callbacks for different purposes. The NvMediaParserClientCb::CreateDecrypter callback is called only once for a given session to create an NvMedia video decrypter component. The NvMediaParserClientCb::DecryptHdr callback is called for pass1 handling of encrypted data. After this callback, it calls different callbacks based on hardware/codecs. NvMediaParserClientCb::GetClearHdr callback is called to get the clear header data after the NvMediaParserClientCb::DecryptHdr callback. Here it gets only frame header data to create picture info data and to do buffer management.

Parameters
[in]pParserThe decoder parser object that will perform the decode parsing operation.
[in]pStreamPacketA pointer to the bitstream data.
Returns
NvMediaStatus The completion status of the operation. Possible values are:
NVMEDIA_STATUS_OK
NVMEDIA_STATUS_ERROR
NvMediaStatus NvMediaParserSetAttribute ( NvMediaParser pParser,
NvMediaParserAttr  eAttributeType,
uint32_t  uAttributeSize,
void *  pAttribute 
)

Sets attributes for the decode parser object.

This function is called to set specific attributes.

Parameters
[in]pParserThe decoder parser object that will perform the decode parsing operation.
[in]eAttributeTypeattribute type defined in NvMediaParserAttr
[in]uAttributeSizesize of the data type
[in]pAttributeis the pointer to attribute.
Returns
NvMediaStatus The completion status of the operation. Possible values are:
NVMEDIA_STATUS_OK
NVMEDIA_STATUS_ERROR
NvMediaStatus NvMediaParserSetEncryption ( NvMediaParser pParser,
NvMediaAESParams pAesParams 
)

Provides the parser object with encryption metadata for the current buffer.

Parameters
[in]pParserThe decoder parser object that will perform the decode parsing operation.
[in]pAesParamsA (pointer to a) encryption metadata structure as defined in NvMediaAESParams
Returns
NvMediaStatus The completion status of the operation. Possible values are:
NVMEDIA_STATUS_OK
NVMEDIA_STATUS_ERROR