Add support for the rocDecUnMapVideoFrame API (#58)

Αυτή η υποβολή περιλαμβάνεται σε:
Aryan Salmanpour
2023-11-13 12:54:32 -05:00
υποβλήθηκε από GitHub
γονέας ddded3a6d2
υποβολή eb5614d250
5 αρχεία άλλαξαν με 18 προσθήκες και 15 διαγραφές
@@ -123,10 +123,14 @@ rocDecStatus RocDecoder::mapVideoFrame(int pic_idx, void *dev_mem_ptr[3],
return rocdec_status;
}
rocDecStatus RocDecoder::unMapVideoFrame(void *pMappedDevPtr) {
// todo:: return appropriate decStatus
// Unmap a previously mapped video frame with the associated mapped raw pointer (pMappedDevPtr)
return ROCDEC_NOT_IMPLEMENTED;
rocDecStatus RocDecoder::unMapVideoFrame(int pic_idx) {
if (pic_idx >= hip_ext_mem_.size()) {
return ROCDEC_INVALID_PARAMETER;
}
CHECK_HIP(hipDestroyExternalMemory(hip_ext_mem_[pic_idx]));
return ROCDEC_SUCCESS;
}
@@ -51,7 +51,7 @@ public:
rocDecStatus getDecodeStatus(int nPicIdx, RocdecDecodeStatus* pDecodeStatus);
rocDecStatus reconfigureDecoder(RocdecReconfigureDecoderInfo *pDecReconfigParams);
rocDecStatus mapVideoFrame(int pic_idx, void *dev_mem_ptr[3], unsigned int horizontal_pitch[3], RocdecProcParams *vid_postproc_params);
rocDecStatus unMapVideoFrame(void *pMappedDevPtr);
rocDecStatus unMapVideoFrame(int pic_idx);
private:
rocDecStatus InitHIP(int device_id);
@@ -180,15 +180,15 @@ rocDecMapVideoFrame(rocDecDecoderHandle hDecoder, int nPicIdx,
}
/*****************************************************************************************************/
//! \fn rocDecStatus ROCDECAPI rocDecUnMapVideoFrame(rocDecDecoderHandle hDecoder, void *pMappedDevPtr)
//! Unmap a previously mapped video frame with the associated mapped raw pointer (pMappedDevPtr)
//! \fn rocDecStatus ROCDECAPI rocDecUnMapVideoFrame(rocDecDecoderHandle hDecoder, int nPicIdx)
//! Unmap a previously mapped video frame with the associated nPicIdx
/*****************************************************************************************************/
rocDecStatus ROCDECAPI
rocDecUnMapVideoFrame(rocDecDecoderHandle hDecoder, void *pMappedDevPtr) {
rocDecUnMapVideoFrame(rocDecDecoderHandle hDecoder, int pic_idx) {
auto handle = static_cast<DecHandle *> (hDecoder);
rocDecStatus ret;
try {
ret = handle->roc_decoder->unMapVideoFrame(pMappedDevPtr);
ret = handle->roc_decoder->unMapVideoFrame(pic_idx);
}
catch(const std::exception& e) {
handle->capture_error(e.what());