Added logging control (#667)

* * rocDecode: Added logging control
 - Message output from the core components is now controlled by the logging level, which can be set by an environment variable or other methods.

* * rocDecode/Logging control: Fixed a typo.

* * rocDecode/Logging control: Removed reference to the logger class from RocVideoDecoder utility, which results in build error on non-source install environment.

* * rocDecode/Logging control: Improved some wording in the docs.

[ROCm/rocdecode commit: 60e6c585ff]
This commit is contained in:
Jeff Jiang
2025-10-31 20:50:33 -04:00
committed by GitHub
parent 7f6938c7d1
commit 9f857d54f0
24 changed files with 307 additions and 214 deletions
@@ -30,12 +30,12 @@ RocDecoderHost::~RocDecoderHost() {}
rocDecStatus RocDecoderHost::InitializeDecoder() {
rocDecStatus rocdec_status = ROCDEC_SUCCESS;
if (!decoder_create_info_.user_data) {
ERR("Invalid function callback pointer passed");
logger_.CriticalLog(MakeMsg("Invalid function callback pointer passed"));
return ROCDEC_NOT_INITIALIZED;
}
rocdec_status = avcodec_video_decoder_.InitializeDecoder();
if (rocdec_status != ROCDEC_SUCCESS) {
ERR("Failed to initialize the FFMpeg Video decoder.");
logger_.CriticalLog(MakeMsg("Failed to initialize the FFMpeg Video decoder."));
return rocdec_status;
}
return rocdec_status;
@@ -45,7 +45,7 @@ rocDecStatus RocDecoderHost::DecodeFrame(RocdecPicParamsHost *pic_params) {
rocDecStatus rocdec_status = ROCDEC_SUCCESS;
rocdec_status = avcodec_video_decoder_.SubmitDecode(pic_params);
if (rocdec_status != ROCDEC_SUCCESS) {
ERR("Decode submission is not successful.");
logger_.ErrorLog(MakeMsg("Decode submission is not successful."));
}
return rocdec_status;
@@ -55,7 +55,7 @@ rocDecStatus RocDecoderHost::GetDecodeStatus(int pic_idx, RocdecDecodeStatus* de
rocDecStatus rocdec_status = ROCDEC_SUCCESS;
rocdec_status = avcodec_video_decoder_.GetDecodeStatus(pic_idx, decode_status);
if (rocdec_status != ROCDEC_SUCCESS) {
ERR("Failed to query the decode status.");
logger_.ErrorLog(MakeMsg("Failed to query the decode status."));
}
return rocdec_status;
}
@@ -66,7 +66,7 @@ rocDecStatus RocDecoderHost::ReconfigureDecoder(RocdecReconfigureDecoderInfo *re
}
rocDecStatus rocdec_status = avcodec_video_decoder_.ReconfigureDecoder(reconfig_params);
if (rocdec_status != ROCDEC_SUCCESS) {
ERR("Reconfiguration of the decoder failed.");
logger_.CriticalLog(MakeMsg("Reconfiguration of the decoder failed."));
return rocdec_status;
}
return rocdec_status;
@@ -78,7 +78,7 @@ rocDecStatus RocDecoderHost::GetVideoFrame(int pic_idx, void **frame_ptr, uint32
}
rocDecStatus rocdec_status = avcodec_video_decoder_.GetVideoFrame(pic_idx, frame_ptr, line_size, vid_postproc_params);
if (rocdec_status != ROCDEC_SUCCESS) {
ERR("GetVideoFrame failed.");
logger_.ErrorLog(MakeMsg("GetVideoFrame failed."));
return rocdec_status;
}
return rocdec_status;