Status Codes

The SDK functions organize into classes for easy reference. The classes include ENCODE (encoding functions), DECODE (decoding functions), and VPP (video processing functions).

Init, Reset and Close are member functions within the ENCODE, DECODE and VPP classes that initialize, restart and de-initialize specific operations defined for the class. Call all other member functions within a given class (except Query and QueryIOSurf) within the InitReset (optional) … Close sequence.

The Init and Reset member functions both set up necessary internal structures for media processing. The difference between the two is that the Init functions allocate memory while the Reset functions only reuse allocated internal memory. Therefore, Reset can fail if the SDK needs to allocate additional memory. Reset functions can also fine-tune ENCODE and VPP parameters during those processes or reposition a bitstream during DECODE.

All SDK functions return status codes to indicate whether an operation succeeded or failed. See the mfxStatus enumerator for all defined status codes. The status code MFX_ERR_NONE indicates that the function successfully completed its operation. Status codes are less than MFX_ERR_NONE for all errors and greater than MFX_ERR_NONE for all warnings.

If an SDK function returns a warning, it has sufficiently completed its operation, although the output of the function might not be strictly reliable. The application must check the validity of the output generated by the function.

If an SDK function returns an error (except MFX_ERR_MORE_DATA or MFX_ERR_MORE_SURFACE or MFX_ERR_MORE_BITSTREAM), the function aborts the operation. The application must call either the Reset function to put the class back to a clean state, or the Close function to terminate the operation. The behavior is undefined if the application continues to call any class member functions without a Reset or Close. To avoid memory leaks, always call the Close function after Init.

For more complete information about compiler optimizations, see our Optimization Notice.