[mpi/mpp]: add format check function and modify mpp_dec_test for format check

git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@925 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
ChenHengming
2016-06-16 09:12:30 +00:00
parent f65e805680
commit 4c06405e3d
6 changed files with 97 additions and 46 deletions

View File

@@ -25,6 +25,22 @@
#include "mpi_impl.h"
#include "mpp.h"
#include "mpp_info.h"
#include "mpp_common.h"
typedef struct {
MppCtxType type;
MppCodingType coding;
const char *type_name;
const char *coding_name;
} MppCodingTypeInfo;
static MppCodingTypeInfo support_list[] = {
{ MPP_CTX_DEC, MPP_VIDEO_CodingMPEG2, "dec", "mpeg2", },
{ MPP_CTX_DEC, MPP_VIDEO_CodingAVC, "dec", "h.264/AVC", },
{ MPP_CTX_DEC, MPP_VIDEO_CodingHEVC, "dec", "h.265/HEVC", },
{ MPP_CTX_DEC, MPP_VIDEO_CodingVP9, "dec", "VP9", },
{ MPP_CTX_DEC, MPP_VIDEO_CodingAVS, "dec", "avs+", },
};
#define check_mpp_ctx(ctx) _check_mpp_ctx(ctx, __FUNCTION__)
@@ -328,13 +344,13 @@ MPP_RET mpp_init(MppCtx ctx, MppCtxType type, MppCodingType coding)
return MPP_ERR_UNKNOW;
}
p->ctx->init(type, coding);
ret = p->ctx->init(type, coding);
p->type = type;
p->coding = coding;
get_mpi_debug();
MPI_FUNCTION_LEAVE_OK();
return MPP_OK;
return ret;
}
MPP_RET mpp_destroy(MppCtx ctx)
@@ -355,3 +371,33 @@ MPP_RET mpp_destroy(MppCtx ctx)
return MPP_OK;
}
MPP_RET mpp_check_support_format(MppCtxType type, MppCodingType coding)
{
MPP_RET ret = MPP_NOK;
RK_U32 i = 0;
for (i = 0; i < MPP_ARRAY_ELEMS(support_list); i++) {
MppCodingTypeInfo *info = &support_list[i];
if (type == info->type &&
coding == info->coding) {
ret = MPP_OK;
break;
}
}
return ret;
}
void mpp_show_support_format()
{
RK_U32 i = 0;
mpp_log("mpp coding type support list:");
for (i = 0; i < MPP_ARRAY_ELEMS(support_list); i++) {
MppCodingTypeInfo *info = &support_list[i];
mpp_log("type: %s id %d coding: %-16s id %d\n",
info->type_name, info->type,
info->coding_name, info->coding);
}
}