Add support for rocDecGetDecodeStatus API (#46)
[ROCm/rocdecode commit: 6ab31ce40e]
This commit is contained in:
@@ -138,6 +138,7 @@ typedef enum rocDecodeStatus_enum {
|
||||
// 3 to 7 enums are reserved for future use
|
||||
rocDecodeStatus_Error = 8, // Decode is completed with an error (error is not concealed)
|
||||
rocDecodeStatus_Error_Concealed = 9, // Decode is completed with an error and error is concealed
|
||||
rocDecodeStatus_Displaying = 10, // Decode is completed, displaying in progress
|
||||
} rocDecDecodeStatus;
|
||||
|
||||
/**************************************************************************************************************/
|
||||
|
||||
@@ -64,10 +64,12 @@ rocDecStatus RocDecoder::decodeFrame(RocdecPicParams *pPicParams) {
|
||||
}
|
||||
|
||||
rocDecStatus RocDecoder::getDecodeStatus(int nPicIdx, RocdecDecodeStatus* pDecodeStatus) {
|
||||
// todo:: return appropriate decStatus
|
||||
// init vaapi decoder to get the decoding status of the picture specified by nPicIndex
|
||||
// return status
|
||||
return ROCDEC_NOT_IMPLEMENTED;
|
||||
rocDecStatus rocdec_status = ROCDEC_SUCCESS;
|
||||
rocdec_status = va_video_decoder_.GetDecodeStatus(nPicIdx, pDecodeStatus);
|
||||
if (rocdec_status != ROCDEC_SUCCESS) {
|
||||
ERR("ERROR: Failed to query the decode status!" + TOSTR(rocdec_status));
|
||||
}
|
||||
return rocdec_status;
|
||||
}
|
||||
|
||||
rocDecStatus RocDecoder::reconfigureDecoder(RocdecReconfigureDecoderInfo *pDecReconfigParams) {
|
||||
|
||||
@@ -120,6 +120,9 @@ rocDecDecodeFrame(rocDecDecoderHandle hDecoder, RocdecPicParams *pPicParams) {
|
||||
/************************************************************************************************************/
|
||||
rocDecStatus ROCDECAPI
|
||||
rocDecGetDecodeStatus(rocDecDecoderHandle hDecoder, int nPicIdx, RocdecDecodeStatus* pDecodeStatus) {
|
||||
if (hDecoder == nullptr || pDecodeStatus == nullptr) {
|
||||
return ROCDEC_INVALID_PARAMETER;
|
||||
}
|
||||
auto handle = static_cast<DecHandle *> (hDecoder);
|
||||
rocDecStatus ret;
|
||||
try {
|
||||
|
||||
@@ -151,4 +151,26 @@ rocDecStatus VaapiVideoDecoder::CreateContext() {
|
||||
rocDecStatus VaapiVideoDecoder::SubmitDecode(RocdecPicParams *pPicParams) {
|
||||
// Todo copy pic param, slice param, IQ matrix and slice data from RocdecPicParams to VAAPI struct buffers, then submit to VAAPI driver.
|
||||
return ROCDEC_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
rocDecStatus VaapiVideoDecoder::GetDecodeStatus(int pic_idx, RocdecDecodeStatus *decode_status) {
|
||||
VASurfaceStatus va_surface_status;
|
||||
if (pic_idx >= va_surface_ids_.size() || decode_status == nullptr) {
|
||||
return ROCDEC_INVALID_PARAMETER;
|
||||
}
|
||||
CHECK_VAAPI(vaQuerySurfaceStatus(va_display_, va_surface_ids_[pic_idx], &va_surface_status));
|
||||
switch (va_surface_status) {
|
||||
case VASurfaceRendering:
|
||||
decode_status->decodeStatus = rocDecodeStatus_InProgress;
|
||||
break;
|
||||
case VASurfaceReady:
|
||||
decode_status->decodeStatus = rocDecodeStatus_Success;
|
||||
break;
|
||||
case VASurfaceDisplaying:
|
||||
decode_status->decodeStatus = rocDecodeStatus_Displaying;
|
||||
break;
|
||||
default:
|
||||
decode_status->decodeStatus = rocDecodeStatus_Invalid;
|
||||
}
|
||||
return ROCDEC_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ public:
|
||||
~VaapiVideoDecoder();
|
||||
rocDecStatus InitializeDecoder(std::string gcn_arch_name);
|
||||
rocDecStatus SubmitDecode(RocdecPicParams *pPicParams);
|
||||
rocDecStatus GetDecodeStatus(int pic_idx, RocdecDecodeStatus* decode_status);
|
||||
private:
|
||||
RocDecoderCreateInfo decoder_create_info_;
|
||||
int drm_fd_;
|
||||
|
||||
Reference in New Issue
Block a user