[mpi]: rename mpi_flush to mpi_reset

[h264d]: fix warning on strupr

git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@535 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
ChenHengming
2016-01-20 07:36:48 +00:00
parent db7e4ff619
commit cb0d12ec49
5 changed files with 42 additions and 18 deletions

View File

@@ -139,12 +139,30 @@ typedef struct MppEncConfig_t {
RK_S32 trans8x8_en; RK_S32 trans8x8_en;
} MppEncConfig; } MppEncConfig;
/*
* mpp main work function set
* size : MppApi structure size
* version : Mpp svn revision
*
* decode : both send video stream packet to decoder and get video frame from
* decoder at the same time.
* decode_put_packet: send video stream packet to decoder only, async interface
* decode_get_frame : get video frame from decoder only, async interface
*
* encode : both send video frame to encoder and get encoded video stream from
* encoder at the same time.
* encode_put_frame : send video frame to encoder only, async interface
* encode_get_packet: get encoded video packet from encoder only, async interface
*
* reset : discard all packet and frame, reset all component,
* for both decoder and encoder
* control : control function for mpp property setting
* config : config function for encoder, not implement yet.
*/
typedef struct MppApi_t { typedef struct MppApi_t {
RK_U32 size; RK_U32 size;
RK_U32 version; RK_U32 version;
MPP_RET (*config)(MppCtx ctx, MppEncConfig cfg);
// sync interface // sync interface
MPP_RET (*decode)(MppCtx ctx, MppPacket packet, MppFrame *frame); MPP_RET (*decode)(MppCtx ctx, MppPacket packet, MppFrame *frame);
MPP_RET (*encode)(MppCtx ctx, MppFrame frame, MppPacket *packet); MPP_RET (*encode)(MppCtx ctx, MppFrame frame, MppPacket *packet);
@@ -156,8 +174,9 @@ typedef struct MppApi_t {
MPP_RET (*encode_put_frame)(MppCtx ctx, MppFrame frame); MPP_RET (*encode_put_frame)(MppCtx ctx, MppFrame frame);
MPP_RET (*encode_get_packet)(MppCtx ctx, MppPacket *packet); MPP_RET (*encode_get_packet)(MppCtx ctx, MppPacket *packet);
MPP_RET (*flush)(MppCtx ctx); MPP_RET (*reset)(MppCtx ctx);
MPP_RET (*control)(MppCtx ctx, MpiCmd cmd, MppParam param); MPP_RET (*control)(MppCtx ctx, MpiCmd cmd, MppParam param);
MPP_RET (*config)(MppCtx ctx, MppEncConfig cfg);
RK_U32 reserv[16]; RK_U32 reserv[16];
} MppApi; } MppApi;
@@ -168,7 +187,13 @@ extern "C" {
#endif #endif
/* /*
* mpp interface * mpp interface work flow
*
* 1. mpp_create : Create empty context structure and mpi function pointers.
* 2. mpp_init : Call after mpp_create to setup mpp type and video format.
* This function will call internal context init function.
* 3. Use functions in MppApi to access mpp services.
* 4. mpp_destory: Destroy mpp context and free both context and mpi structure
*/ */
MPP_RET mpp_create(MppCtx *ctx, MppApi **mpi); MPP_RET mpp_create(MppCtx *ctx, MppApi **mpi);
MPP_RET mpp_init(MppCtx ctx, MppCtxType type, MppCodingType coding); MPP_RET mpp_init(MppCtx ctx, MppCtxType type, MppCodingType coding);

View File

@@ -29,7 +29,7 @@
#ifndef _WIN32 #ifndef _WIN32
#include <ctype.h> #include <ctype.h>
char *strupr(char *str) char *_strupr(char *str)
{ {
char *orign=str; char *orign=str;
for (; *str != '\0'; str++) { for (; *str != '\0'; str++) {
@@ -86,7 +86,7 @@ static MPP_RET interpret_user_data_unregistered_info(RK_U8 *payload, RK_S32 size
} }
#endif #endif
sei_msg->user_data_DivX_flag = strstr(strupr((char *)&payload[16]), "DIVX") ? 1 : 0; sei_msg->user_data_DivX_flag = strstr(_strupr((char *)&payload[16]), "DIVX") ? 1 : 0;
if (sei_msg->user_data_DivX_flag) { if (sei_msg->user_data_DivX_flag) {
H264D_ERR("DivX is not supported. \n"); H264D_ERR("DivX is not supported. \n");
sei_msg->p_Dec->err_ctx.err_flag |= VPU_FRAME_ERR_UNSUPPORT; sei_msg->p_Dec->err_ctx.err_flag |= VPU_FRAME_ERR_UNSUPPORT;
@@ -217,7 +217,7 @@ static MPP_RET interpret_mvc_scalable_nesting_info(RK_U8 *payload, RK_S32 size,
READ_BITS(p_strm, 3, &sei_op_temporal_id, "sei_op_temporal_id"); READ_BITS(p_strm, 3, &sei_op_temporal_id, "sei_op_temporal_id");
} }
p_bitctx->used_bits = p_strm->used_bits; p_bitctx->used_bits = p_strm->used_bits;
return ret = MPP_OK; return ret = MPP_OK;
__BITREAD_ERR: __BITREAD_ERR:
ret = p_bitctx->ret; ret = p_bitctx->ret;
@@ -404,7 +404,7 @@ MPP_RET process_sei(H264_SLICE_t *currSlice)
sei_msg->payload_size += tmp_byte; // this is the last byte sei_msg->payload_size += tmp_byte; // this is the last byte
//--- read sei info //--- read sei info
FUN_CHECK(ret = parserSEI(currSlice, p_bitctx, sei_msg, p_bitctx->data_)); FUN_CHECK(ret = parserSEI(currSlice, p_bitctx, sei_msg, p_bitctx->data_));
//--- set offset to read next sei nal //--- set offset to read next sei nal
if (SEI_MVC_SCALABLE_NESTING == sei_msg->type) { if (SEI_MVC_SCALABLE_NESTING == sei_msg->type) {
sei_msg->payload_size = ((p_bitctx->used_bits + 0x07) >> 3); sei_msg->payload_size = ((p_bitctx->used_bits + 0x07) >> 3);

View File

@@ -85,8 +85,8 @@ RK_S32 VpuApi::flush(VpuCodecContext *ctx)
{ {
(void)ctx; (void)ctx;
mpp_log_f("in\n"); mpp_log_f("in\n");
if (mpi && mpi->flush) { if (mpi && mpi->reset) {
mpi->flush(mpp_ctx); mpi->reset(mpp_ctx);
} }
mpp_log_f("ok\n"); mpp_log_f("ok\n");
return 0; return 0;

View File

@@ -126,7 +126,7 @@ static MPP_RET mpi_encode_get_packet(MppCtx ctx, MppPacket *packet)
return ret; return ret;
} }
static MPP_RET mpi_flush(MppCtx ctx) static MPP_RET mpi_reset(MppCtx ctx)
{ {
MpiImpl *p = (MpiImpl *)ctx; MpiImpl *p = (MpiImpl *)ctx;
MPP_RET ret = MPP_OK; MPP_RET ret = MPP_OK;
@@ -150,15 +150,15 @@ static MPP_RET mpi_control(MppCtx ctx, MpiCmd cmd, MppParam param)
static MppApi mpp_api = { static MppApi mpp_api = {
sizeof(mpp_api), sizeof(mpp_api),
0, 0,
mpi_config,
mpi_decode, mpi_decode,
mpi_encode, mpi_encode,
mpi_decode_put_packet, mpi_decode_put_packet,
mpi_decode_get_frame, mpi_decode_get_frame,
mpi_encode_put_frame, mpi_encode_put_frame,
mpi_encode_get_packet, mpi_encode_get_packet,
mpi_flush, mpi_reset,
mpi_control, mpi_control,
mpi_config,
{0}, {0},
}; };
@@ -202,7 +202,6 @@ MPP_RET mpp_create(MppCtx *ctx, MppApi **mpi)
return MPP_OK; return MPP_OK;
} }
MPP_RET mpp_init(MppCtx ctx, MppCtxType type, MppCodingType coding) MPP_RET mpp_init(MppCtx ctx, MppCtxType type, MppCodingType coding)
{ {
MpiImpl *p = (MpiImpl*)ctx; MpiImpl *p = (MpiImpl*)ctx;

View File

@@ -166,9 +166,9 @@ int mpi_test()
} }
ret = mpi->flush(ctx); ret = mpi->reset(ctx);
if (MPP_OK != ret) { if (MPP_OK != ret) {
mpp_err("mpi->flush failed\n"); mpp_err("mpi->reset failed\n");
goto MPP_TEST_FAILED; goto MPP_TEST_FAILED;
} }
@@ -247,9 +247,9 @@ int mpi_test()
} }
ret = mpi->flush(ctx); ret = mpi->reset(ctx);
if (MPP_OK != ret) { if (MPP_OK != ret) {
mpp_err("mpi->flush failed\n"); mpp_err("mpi->reset failed\n");
goto MPP_TEST_FAILED; goto MPP_TEST_FAILED;
} }