Add support for rocDecGetErrorName for getting the rocDecStatus error string (#185)
* Add support for rocDecGetErrorName for getting the rocDecStatus error string
* Add description of the API
[ROCm/rocdecode commit: f7997b716d]
This commit is contained in:
@@ -908,6 +908,13 @@ extern rocDecStatus ROCDECAPI rocDecMapVideoFrame(rocDecDecoderHandle decoder_ha
|
||||
/*****************************************************************************************************/
|
||||
extern rocDecStatus ROCDECAPI rocDecUnMapVideoFrame(rocDecDecoderHandle decoder_handle, int pic_idx);
|
||||
|
||||
/*****************************************************************************************************/
|
||||
//! \fn const char* ROCDECAPI rocDecGetErrorName(rocDecStatus rocdec_status)
|
||||
//! \ingroup group_amd_rocdecode
|
||||
//! Return name of the specified error code in text form.
|
||||
/*****************************************************************************************************/
|
||||
extern const char* ROCDECAPI rocDecGetErrorName(rocDecStatus rocdec_status);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -214,3 +214,31 @@ rocDecUnMapVideoFrame(rocDecDecoderHandle decoder_handle, int pic_idx) {
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*****************************************************************************************************/
|
||||
//! \fn const char* ROCDECAPI rocDecGetErrorName(rocDecStatus rocdec_status)
|
||||
//! \ingroup group_amd_rocdecode
|
||||
//! Return name of the specified error code in text form.
|
||||
/*****************************************************************************************************/
|
||||
const char* ROCDECAPI rocDecGetErrorName(rocDecStatus rocdec_status) {
|
||||
switch (rocdec_status) {
|
||||
case ROCDEC_DEVICE_INVALID:
|
||||
return "ROCDEC_DEVICE_INVALID";
|
||||
case ROCDEC_CONTEXT_INVALID:
|
||||
return "ROCDEC_CONTEXT_INVALID";
|
||||
case ROCDEC_RUNTIME_ERROR:
|
||||
return "ROCDEC_RUNTIME_ERROR";
|
||||
case ROCDEC_OUTOF_MEMORY:
|
||||
return "ROCDEC_OUTOF_MEMORY";
|
||||
case ROCDEC_INVALID_PARAMETER:
|
||||
return "ROCDEC_INVALID_PARAMETER";
|
||||
case ROCDEC_NOT_IMPLEMENTED:
|
||||
return "ROCDEC_NOT_IMPLEMENTED";
|
||||
case ROCDEC_NOT_INITIALIZED:
|
||||
return "ROCDEC_NOT_INITIALIZED";
|
||||
case ROCDEC_NOT_SUPPORTED:
|
||||
return "ROCDEC_NOT_SUPPORTED";
|
||||
default:
|
||||
return "UNKNOWN_ERROR";
|
||||
}
|
||||
}
|
||||
@@ -96,7 +96,7 @@ private:
|
||||
rocDecStatus error_code = rocDecAPI; \
|
||||
if( error_code != ROCDEC_SUCCESS) { \
|
||||
std::ostringstream error_log; \
|
||||
error_log << #rocDecAPI << " returned err " << error_code << " at " <<__FILE__ <<":" << __LINE__;\
|
||||
error_log << #rocDecAPI << " returned err " << rocDecGetErrorName(error_code) << " at " <<__FILE__ <<":" << __LINE__;\
|
||||
ROCDEC_THROW(error_log.str(), error_code); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
Reference in New Issue
Block a user