Memory

Functions for internal memory allocation and management.

API

MFXMemory_GetSurfaceForVPP

mfxStatus MFXMemory_GetSurfaceForVPP(mfxSession session, mfxFrameSurface1 **surface)

Returns surface which can be used as input for VPP.

VPP should be initialized before this call. Surface should be released with mfxFrameSurface1::FrameInterface.Release(…) after usage. The value of mfxFrameSurface1::Data.Locked for the returned surface is 0.

Since

This function is available since API version 2.0.

Parameters
  • session[in] Session handle.

  • surface[out] Pointer is set to valid mfxFrameSurface1 object.

Returns

MFX_ERR_NONE The function completed successfully.

MFX_ERR_NULL_PTR If double-pointer to the

surface

is NULL.

MFX_ERR_INVALID_HANDLE If

session

was not initialized.

MFX_ERR_NOT_INITIALIZED If VPP was not initialized (allocator needs to know surface size from somewhere).

MFX_ERR_MEMORY_ALLOC In case of any other internal allocation error.

MFX_WRN_ALLOC_TIMEOUT_EXPIRED In case of waiting timeout expired (if set with

mfxExtAllocationHints).

Alias below, can be used as well:

MFXMemory_GetSurfaceForVPPIn

Alias for MFXMemory_GetSurfaceForVPP function.

MFXMemory_GetSurfaceForVPPOut

mfxStatus MFXMemory_GetSurfaceForVPPOut(mfxSession session, mfxFrameSurface1 **surface)

Returns surface which can be used as output of VPP.

VPP should be initialized before this call. Surface should be released with mfxFrameSurface1::FrameInterface.Release(…) after usage. The value of mfxFrameSurface1::Data.Locked for the returned surface is 0.

Since

This function is available since API version 2.1.

Parameters
  • session[in] Session handle.

  • surface[out] Pointer is set to valid mfxFrameSurface1 object.

Returns

MFX_ERR_NONE The function completed successfully.

MFX_ERR_NULL_PTR If double-pointer to the

surface

is NULL.

MFX_ERR_INVALID_HANDLE If

session

was not initialized.

MFX_ERR_NOT_INITIALIZED If VPP was not initialized (allocator needs to know surface size from somewhere).

MFX_ERR_MEMORY_ALLOC In case of any other internal allocation error.

MFX_WRN_ALLOC_TIMEOUT_EXPIRED In case of waiting timeout expired (if set with

mfxExtAllocationHints).

MFXMemory_GetSurfaceForEncode

mfxStatus MFXMemory_GetSurfaceForEncode(mfxSession session, mfxFrameSurface1 **surface)

Returns a surface which can be used as input for the encoder.

Encoder should be initialized before this call. Surface should be released with mfxFrameSurface1::FrameInterface.Release(…) after usage. The value of mfxFrameSurface1::Data.Locked for the returned surface is 0.

Since

This function is available since API version 2.0.

Parameters
  • session[in] Session handle.

  • surface[out] Pointer is set to valid mfxFrameSurface1 object.

Returns

MFX_ERR_NONE The function completed successfully.

MFX_ERR_NULL_PTR If surface is NULL.

MFX_ERR_INVALID_HANDLE If session was not initialized.

MFX_ERR_NOT_INITIALIZED If the encoder was not initialized (allocator needs to know surface size from somewhere).

MFX_ERR_MEMORY_ALLOC In case of any other internal allocation error.

MFX_WRN_ALLOC_TIMEOUT_EXPIRED In case of waiting timeout expired (if set with

mfxExtAllocationHints).

MFXMemory_GetSurfaceForDecode

mfxStatus MFXMemory_GetSurfaceForDecode(mfxSession session, mfxFrameSurface1 **surface)

Returns a surface which can be used as output of the decoder.

Decoder should be initialized before this call. Surface should be released with mfxFrameSurface1::FrameInterface.Release(…) after usage. The value of mfxFrameSurface1::Data.Locked for the returned surface is 0.’

Since

This function is available since API version 2.0.

Note

This function was added to simplify transition from legacy surface management to the proposed internal allocation approach. Previously, the user allocated surfaces for the working pool and fed them to the decoder using DecodeFrameAsync calls. With MFXMemory_GetSurfaceForDecode it is possible to change the existing pipeline by just changing the source of work surfaces. Newly developed applications should prefer direct usage of DecodeFrameAsync with internal allocation.

Parameters
  • session[in] Session handle.

  • surface[out] Pointer is set to valid mfxFrameSurface1 object.

Returns

MFX_ERR_NONE The function completed successfully.

MFX_ERR_NULL_PTR If surface is NULL.

MFX_ERR_INVALID_HANDLE If session was not initialized.

MFX_ERR_NOT_INITIALIZED If the decoder was not initialized (allocator needs to know surface size from somewhere).

MFX_ERR_MEMORY_ALLOC Other internal allocation error.

MFX_WRN_ALLOC_TIMEOUT_EXPIRED In case of waiting timeout expired (if set with

mfxExtAllocationHints).