Update rocDecode dispatch table for bit stream reader APIs (#471)
这个提交包含在:
@@ -23,6 +23,7 @@ THE SOFTWARE.
|
||||
|
||||
#include "rocdecode.h"
|
||||
#include "rocparser.h"
|
||||
#include "roc_bitstream_reader.h"
|
||||
|
||||
// Define version macros for the rocDecode API dispatch table, specifying the MAJOR and STEP versions.
|
||||
//
|
||||
@@ -46,7 +47,7 @@ THE SOFTWARE.
|
||||
|
||||
// Increment the ROCDECODE_RUNTIME_API_TABLE_STEP_VERSION when new runtime API functions are added.
|
||||
// If the corresponding ROCDECODE_RUNTIME_API_TABLE_MAJOR_VERSION increases reset the ROCDECODE_RUNTIME_API_TABLE_STEP_VERSION to zero.
|
||||
#define ROCDECODE_RUNTIME_API_TABLE_STEP_VERSION 0
|
||||
#define ROCDECODE_RUNTIME_API_TABLE_STEP_VERSION 1
|
||||
|
||||
// rocDecode API interface
|
||||
typedef rocDecStatus (ROCDECAPI *PfnRocDecCreateVideoParser)(RocdecVideoParser *parser_handle, RocdecParserParams *params);
|
||||
@@ -60,6 +61,11 @@ typedef rocDecStatus (ROCDECAPI *PfnRocDecGetDecodeStatus)(rocDecDecoderHandle d
|
||||
typedef rocDecStatus (ROCDECAPI *PfnRocDecReconfigureDecoder)(rocDecDecoderHandle decoder_handle, RocdecReconfigureDecoderInfo *reconfig_params);
|
||||
typedef rocDecStatus (ROCDECAPI *PfnRocDecGetVideoFrame)(rocDecDecoderHandle decoder_handle, int pic_idx, void *dev_mem_ptr[3], uint32_t (&horizontal_pitch)[3], RocdecProcParams *vid_postproc_params);
|
||||
typedef const char* (ROCDECAPI *PfnRocDecGetErrorName)(rocDecStatus rocdec_status);
|
||||
typedef rocDecStatus (ROCDECAPI *PfnRocDecCreateBitstreamReader)(RocdecBitstreamReader *bs_reader_handle, const char *input_file_path);
|
||||
typedef rocDecStatus (ROCDECAPI *PfnRocDecGetBitstreamCodecType)(RocdecBitstreamReader bs_reader_handle, rocDecVideoCodec *codec_type);
|
||||
typedef rocDecStatus (ROCDECAPI *PfnRocDecGetBitstreamBitDepth)(RocdecBitstreamReader bs_reader_handle, int *bit_depth);
|
||||
typedef rocDecStatus (ROCDECAPI *PfnRocDecGetBitstreamPicData)(RocdecBitstreamReader bs_reader_handle, uint8_t **pic_data, int *pic_size, int64_t *pts);
|
||||
typedef rocDecStatus (ROCDECAPI *PfnRocDecDestroyBitstreamReader)(RocdecBitstreamReader bs_reader_handle);
|
||||
|
||||
// rocDecode API dispatch table
|
||||
struct RocDecodeDispatchTable {
|
||||
@@ -78,6 +84,13 @@ struct RocDecodeDispatchTable {
|
||||
PfnRocDecGetErrorName pfn_rocdec_get_error_name;
|
||||
// PLEASE DO NOT EDIT ABOVE!
|
||||
// ROCDECODE_RUNTIME_API_TABLE_STEP_VERSION == 1
|
||||
PfnRocDecCreateBitstreamReader pfn_rocdec_create_bitstream_reader;
|
||||
PfnRocDecGetBitstreamCodecType pfn_rocdec_get_bitstream_codec_type;
|
||||
PfnRocDecGetBitstreamBitDepth pfn_rocdec_get_bitstream_bit_depth;
|
||||
PfnRocDecGetBitstreamPicData pfn_rocdec_get_bitstream_pic_data;
|
||||
PfnRocDecDestroyBitstreamReader pfn_rocdec_destroy_bitstream_reader;
|
||||
// PLEASE DO NOT EDIT ABOVE!
|
||||
// ROCDECODE_RUNTIME_API_TABLE_STEP_VERSION == 2
|
||||
|
||||
// ******************************************************************************************* //
|
||||
// READ BELOW
|
||||
|
||||
@@ -57,4 +57,20 @@ rocDecStatus ROCDECAPI rocDecGetVideoFrame(rocDecDecoderHandle decoder_handle, i
|
||||
}
|
||||
const char *ROCDECAPI rocDecGetErrorName(rocDecStatus rocdec_status) {
|
||||
return rocdecode::GetRocDecodeDispatchTable()->pfn_rocdec_get_error_name(rocdec_status);
|
||||
}
|
||||
}
|
||||
rocDecStatus ROCDECAPI rocDecCreateBitstreamReader(RocdecBitstreamReader *bs_reader_handle, const char *input_file_path) {
|
||||
return rocdecode::GetRocDecodeDispatchTable()->pfn_rocdec_create_bitstream_reader(bs_reader_handle, input_file_path);
|
||||
}
|
||||
rocDecStatus ROCDECAPI rocDecGetBitstreamCodecType(RocdecBitstreamReader bs_reader_handle, rocDecVideoCodec *codec_type) {
|
||||
return rocdecode::GetRocDecodeDispatchTable()->pfn_rocdec_get_bitstream_codec_type(bs_reader_handle, codec_type);
|
||||
}
|
||||
rocDecStatus ROCDECAPI rocDecGetBitstreamBitDepth(RocdecBitstreamReader bs_reader_handle, int *bit_depth) {
|
||||
return rocdecode::GetRocDecodeDispatchTable()->pfn_rocdec_get_bitstream_bit_depth(bs_reader_handle, bit_depth);
|
||||
}
|
||||
rocDecStatus ROCDECAPI rocDecGetBitstreamPicData(RocdecBitstreamReader bs_reader_handle, uint8_t **pic_data, int *pic_size, int64_t *pts) {
|
||||
return rocdecode::GetRocDecodeDispatchTable()->pfn_rocdec_get_bitstream_pic_data(bs_reader_handle, pic_data, pic_size, pts);
|
||||
}
|
||||
rocDecStatus ROCDECAPI rocDecDestroyBitstreamReader(RocdecBitstreamReader bs_reader_handle) {
|
||||
return rocdecode::GetRocDecodeDispatchTable()->pfn_rocdec_destroy_bitstream_reader(bs_reader_handle);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,11 @@ rocDecStatus ROCDECAPI rocDecGetDecodeStatus(rocDecDecoderHandle decoder_handle,
|
||||
rocDecStatus ROCDECAPI rocDecReconfigureDecoder(rocDecDecoderHandle decoder_handle, RocdecReconfigureDecoderInfo *reconfig_params);
|
||||
rocDecStatus ROCDECAPI rocDecGetVideoFrame(rocDecDecoderHandle decoder_handle, int pic_idx, void *dev_mem_ptr[3], uint32_t (&horizontal_pitch)[3], RocdecProcParams *vid_postproc_params);
|
||||
const char *ROCDECAPI rocDecGetErrorName(rocDecStatus rocdec_status);
|
||||
rocDecStatus ROCDECAPI rocDecCreateBitstreamReader(RocdecBitstreamReader *bs_reader_handle, const char *input_file_path);
|
||||
rocDecStatus ROCDECAPI rocDecGetBitstreamCodecType(RocdecBitstreamReader bs_reader_handle, rocDecVideoCodec *codec_type);
|
||||
rocDecStatus ROCDECAPI rocDecGetBitstreamBitDepth(RocdecBitstreamReader bs_reader_handle, int *bit_depth);
|
||||
rocDecStatus ROCDECAPI rocDecGetBitstreamPicData(RocdecBitstreamReader bs_reader_handle, uint8_t **pic_data, int *pic_size, int64_t *pts);
|
||||
rocDecStatus ROCDECAPI rocDecDestroyBitstreamReader(RocdecBitstreamReader bs_reader_handle);
|
||||
}
|
||||
|
||||
namespace rocdecode {
|
||||
@@ -62,6 +67,11 @@ void UpdateDispatchTable(RocDecodeDispatchTable* ptr_dispatch_table) {
|
||||
ptr_dispatch_table->pfn_rocdec_reconfigure_decoder = rocdecode::rocDecReconfigureDecoder;
|
||||
ptr_dispatch_table->pfn_rocdec_get_video_frame = rocdecode::rocDecGetVideoFrame;
|
||||
ptr_dispatch_table->pfn_rocdec_get_error_name = rocdecode::rocDecGetErrorName;
|
||||
ptr_dispatch_table->pfn_rocdec_create_bitstream_reader = rocdecode::rocDecCreateBitstreamReader;
|
||||
ptr_dispatch_table->pfn_rocdec_get_bitstream_codec_type = rocdecode::rocDecGetBitstreamCodecType;
|
||||
ptr_dispatch_table->pfn_rocdec_get_bitstream_bit_depth = rocdecode::rocDecGetBitstreamBitDepth;
|
||||
ptr_dispatch_table->pfn_rocdec_get_bitstream_pic_data = rocdecode::rocDecGetBitstreamPicData;
|
||||
ptr_dispatch_table->pfn_rocdec_destroy_bitstream_reader = rocdecode::rocDecDestroyBitstreamReader;
|
||||
}
|
||||
|
||||
#if ROCDECODE_ROCPROFILER_REGISTER > 0
|
||||
@@ -155,14 +165,21 @@ ROCDECODE_ENFORCE_ABI(RocDecodeDispatchTable, pfn_rocdec_get_decode_status, 7)
|
||||
ROCDECODE_ENFORCE_ABI(RocDecodeDispatchTable, pfn_rocdec_reconfigure_decoder, 8)
|
||||
ROCDECODE_ENFORCE_ABI(RocDecodeDispatchTable, pfn_rocdec_get_video_frame, 9)
|
||||
ROCDECODE_ENFORCE_ABI(RocDecodeDispatchTable, pfn_rocdec_get_error_name, 10)
|
||||
// ROCDECODE_RUNTIME_API_TABLE_STEP_VERSION == 1
|
||||
ROCDECODE_ENFORCE_ABI(RocDecodeDispatchTable, pfn_rocdec_create_bitstream_reader, 11)
|
||||
ROCDECODE_ENFORCE_ABI(RocDecodeDispatchTable, pfn_rocdec_get_bitstream_codec_type, 12)
|
||||
ROCDECODE_ENFORCE_ABI(RocDecodeDispatchTable, pfn_rocdec_get_bitstream_bit_depth, 13)
|
||||
ROCDECODE_ENFORCE_ABI(RocDecodeDispatchTable, pfn_rocdec_get_bitstream_pic_data, 14)
|
||||
ROCDECODE_ENFORCE_ABI(RocDecodeDispatchTable, pfn_rocdec_destroy_bitstream_reader, 15)
|
||||
// ROCDECODE_RUNTIME_API_TABLE_STEP_VERSION == 2
|
||||
|
||||
// If ROCDECODE_ENFORCE_ABI entries are added for each new function pointer in the table,
|
||||
// the number below will be one greater than the number in the last ROCDECODE_ENFORCE_ABI line. For example:
|
||||
// ROCDECODE_ENFORCE_ABI(<table>, <functor>, 10)
|
||||
// ROCDECODE_ENFORCE_ABI_VERSIONING(<table>, 11) <- 10 + 1 = 11
|
||||
ROCDECODE_ENFORCE_ABI_VERSIONING(RocDecodeDispatchTable, 11)
|
||||
// ROCDECODE_ENFORCE_ABI(<table>, <functor>, 15)
|
||||
// ROCDECODE_ENFORCE_ABI_VERSIONING(<table>, 16) <- 15 + 1 = 16
|
||||
ROCDECODE_ENFORCE_ABI_VERSIONING(RocDecodeDispatchTable, 16)
|
||||
|
||||
static_assert(ROCDECODE_RUNTIME_API_TABLE_MAJOR_VERSION == 0 && ROCDECODE_RUNTIME_API_TABLE_STEP_VERSION == 0,
|
||||
static_assert(ROCDECODE_RUNTIME_API_TABLE_MAJOR_VERSION == 0 && ROCDECODE_RUNTIME_API_TABLE_STEP_VERSION == 1,
|
||||
"If you encounter this error, add the new ROCDECODE_ENFORCE_ABI(...) code for the updated function pointers, "
|
||||
"and then modify this check to ensure it evaluates to true.");
|
||||
#endif
|
||||
@@ -23,6 +23,7 @@ THE SOFTWARE.
|
||||
#include "../commons.h"
|
||||
#include "bs_reader_handle.h"
|
||||
|
||||
namespace rocdecode {
|
||||
rocDecStatus ROCDECAPI rocDecCreateBitstreamReader(RocdecBitstreamReader *bs_reader_handle, const char *input_file_path) {
|
||||
if (bs_reader_handle == nullptr || input_file_path == nullptr) {
|
||||
return ROCDEC_INVALID_PARAMETER;
|
||||
@@ -98,3 +99,4 @@ rocDecStatus ROCDECAPI rocDecDestroyBitstreamReader(RocdecBitstreamReader bs_rea
|
||||
delete roc_bs_reader_handle;
|
||||
return ROCDEC_SUCCESS;
|
||||
}
|
||||
} // namespace rocdecode
|
||||
在新工单中引用
屏蔽一个用户