NVIDIA DRIVE 5.0 Linux SDK API Reference

5.0.5.0 Release

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

Detailed Description

Defines and manages objects for defining video RAM surfaces.

NvMediaVideoSurfaces are video RAM surfaces storing YUV or RGBA data. They may be used as sources for the video mixer and they may be used as rendering targets/references by the video decoder. NvMediaVideoSurfaces are created with NvMediaVideoSurfaceCreateNew() and destroyed with NvMediaVideoSurfaceDestroy().

Data Structures

struct  NvMediaVideoSurface
 A handle representing a video surface object. More...
 
struct  NvMediaVideoSurfaceMap
 A handle representing a video surface map. More...
 

Functions

NvMediaVideoSurfaceNvMediaVideoSurfaceCreateNew (NvMediaDevice *device, NvMediaSurfaceType type, NvMediaSurfAllocAttr *attrs, uint32_t numAllocAttrs, uint32_t flags)
 Allocates a video surface object. More...
 
void NvMediaVideoSurfaceDestroy (NvMediaVideoSurface *surface)
 Destroys a video surface object. More...
 
NvMediaStatus NvMediaVideoSurfaceLock (NvMediaVideoSurface *surface, NvMediaVideoSurfaceMap *surfaceMap)
 Locks a video surface and returns the associated mapped pointers pointing to the Y, U and V surfaces that a software video decoder can fill up. More...
 
void NvMediaVideoSurfaceUnlock (NvMediaVideoSurface *surface)
 Unlocks a video surface. More...
 
NvMediaStatus NvMediaVideoSurfacePutBits (NvMediaVideoSurface *videoSurface, NvMediaRect *dstRect, void **srcPntrs, uint32_t *srcPitches)
 NvMediaVideoSurfacePutBits reads a client memory buffer and writes the content into an NvMedia video surface. More...
 
NvMediaStatus NvMediaVideoSurfaceGetBits (NvMediaVideoSurface *videoSurface, NvMediaRect *srcRect, void **dstPntrs, uint32_t *dstPitches)
 Reads an NvMedia video surface and writes the content into a client memory buffer. More...
 

Function Documentation

NvMediaVideoSurface* NvMediaVideoSurfaceCreateNew ( NvMediaDevice device,
NvMediaSurfaceType  type,
NvMediaSurfAllocAttr attrs,
uint32_t  numAllocAttrs,
uint32_t  flags 
)

Allocates a video surface object.

Upon creation, the contents are in an undefined state.

Parameters
[in]deviceA pointer to the device's resource manager connection, which is used for the allocation.
[in]typeSurface format type obtained from NvMediaSurfaceFormatGetType API.
[in]attrsAn array of surface allocation attributes for surface creation.
[in]numAllocAttrsNumber of attributes in the array.
[in]flagsFlags for module hint (used in future).
Returns
NvMediaVideoSurface The new surfaces's handle or NULL if unsuccessful.
void NvMediaVideoSurfaceDestroy ( NvMediaVideoSurface surface)

Destroys a video surface object.

Parameters
[in]surfaceThe video surface to destroy.
NvMediaStatus NvMediaVideoSurfaceGetBits ( NvMediaVideoSurface videoSurface,
NvMediaRect srcRect,
void **  dstPntrs,
uint32_t *  dstPitches 
)

Reads an NvMedia video surface and writes the content into a client memory buffer.

Parameters
[in]videoSurfaceSource NvMediaVideoSurface type surface. The surface must be locked using NvMediaVideoSurfaceLock prior to calling this function.
[in]srcRectStructure containing co-ordinates of the rectangle in the source surface from which the client surface is to be copied. Setting srcRect to NULL implies rectangle of full surface size.
[out]dstPntrsArray of pointers to the destination surface planes
[in]dstPitchesArray of pitch values for the destination surface planes
Returns
NvMediaStatus The completion status of the operation. Possible values are:
NVMEDIA_STATUS_OK
NVMEDIA_STATUS_BAD_PARAMETER if any of the input parameters is invalid.
NVMEDIA_STATUS_ERROR if videoSurface is not locked.
NvMediaStatus NvMediaVideoSurfaceLock ( NvMediaVideoSurface surface,
NvMediaVideoSurfaceMap surfaceMap 
)

Locks a video surface and returns the associated mapped pointers pointing to the Y, U and V surfaces that a software video decoder can fill up.

Parameters
[in]surfaceVideo surface object
[out]surfaceMapSurface pointers and pitches
Returns
NvMediaStatus The completion status of the operation. Possible values are:
NVMEDIA_STATUS_OK
NVMEDIA_STATUS_ERROR
NvMediaStatus NvMediaVideoSurfacePutBits ( NvMediaVideoSurface videoSurface,
NvMediaRect dstRect,
void **  srcPntrs,
uint32_t *  srcPitches 
)

NvMediaVideoSurfacePutBits reads a client memory buffer and writes the content into an NvMedia video surface.

Parameters
[out]videoSurfaceDestination NvMediaVideoSurface type surface. The surface must be locked using NvMediaVideoSurfaceLock prior to calling this function.
[in]dstRectStructure containing co-ordinates of the rectangle in the destination surface to which the client surface is to be copied. Setting dstRect to NULL implies rectangle of full surface size.
[in]srcPntrsArray of pointers to the client surface planes
[in]srcPitchesArray of pitch values for the client surface planes
Returns
NvMediaStatus The completion status of the operation. Possible values are:
NVMEDIA_STATUS_OK
NVMEDIA_STATUS_BAD_PARAMETER if any of the input parameters is invalid.
NVMEDIA_STATUS_ERROR if videoSurface is not locked.
void NvMediaVideoSurfaceUnlock ( NvMediaVideoSurface surface)

Unlocks a video surface.

Internal engines cannot use a surface until it is locked.

Parameters
[in]surfaceVideo surface object