mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-04 16:52:40 +08:00
[test]: fix error on no input file to open
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@1144 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
@@ -98,6 +98,7 @@ int mpi_enc_test(MpiEncTestCmd *cmd)
|
|||||||
fp_input = fopen(cmd->file_input, "rb");
|
fp_input = fopen(cmd->file_input, "rb");
|
||||||
if (NULL == fp_input) {
|
if (NULL == fp_input) {
|
||||||
mpp_err("failed to open input file %s\n", cmd->file_input);
|
mpp_err("failed to open input file %s\n", cmd->file_input);
|
||||||
|
ret = MPP_ERR_OPEN_FILE;
|
||||||
goto MPP_TEST_OUT;
|
goto MPP_TEST_OUT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -106,6 +107,7 @@ int mpi_enc_test(MpiEncTestCmd *cmd)
|
|||||||
fp_output = fopen(cmd->file_output, "w+b");
|
fp_output = fopen(cmd->file_output, "w+b");
|
||||||
if (NULL == fp_output) {
|
if (NULL == fp_output) {
|
||||||
mpp_err("failed to open output file %s\n", cmd->file_output);
|
mpp_err("failed to open output file %s\n", cmd->file_output);
|
||||||
|
ret = MPP_ERR_OPEN_FILE;
|
||||||
goto MPP_TEST_OUT;
|
goto MPP_TEST_OUT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -153,6 +155,7 @@ int mpi_enc_test(MpiEncTestCmd *cmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
memset(&mpp_cfg, 0, sizeof(mpp_cfg));
|
memset(&mpp_cfg, 0, sizeof(mpp_cfg));
|
||||||
|
mpp_cfg.size = sizeof(mpp_cfg);
|
||||||
mpp_cfg.width = width;
|
mpp_cfg.width = width;
|
||||||
mpp_cfg.height = height;
|
mpp_cfg.height = height;
|
||||||
mpp_cfg.format = ENC_INPUT_YUV420_PLANAR;
|
mpp_cfg.format = ENC_INPUT_YUV420_PLANAR;
|
||||||
|
@@ -254,15 +254,6 @@ static RK_S32 vpu_encode_demo(VpuApiDemoCmdContext_t *cmd)
|
|||||||
RK_U32 w_align = 0;
|
RK_U32 w_align = 0;
|
||||||
RK_U32 h_align = 0;
|
RK_U32 h_align = 0;
|
||||||
|
|
||||||
#ifdef FOR_TEST_ENCODE
|
|
||||||
ctx = (struct VpuCodecContext*)malloc(sizeof(struct VpuCodecContext));
|
|
||||||
if (!ctx) {
|
|
||||||
mpp_err("Input context has not been properly allocated");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
memset(ctx, 0, sizeof(struct VpuCodecContext));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int Format = ENC_INPUT_YUV420_PLANAR;
|
int Format = ENC_INPUT_YUV420_PLANAR;
|
||||||
|
|
||||||
if (cmd == NULL) {
|
if (cmd == NULL) {
|
||||||
@@ -301,6 +292,13 @@ static RK_S32 vpu_encode_demo(VpuApiDemoCmdContext_t *cmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FOR_TEST_ENCODE
|
#ifdef FOR_TEST_ENCODE
|
||||||
|
ctx = (struct VpuCodecContext*)malloc(sizeof(struct VpuCodecContext));
|
||||||
|
if (!ctx) {
|
||||||
|
mpp_err("Input context has not been properly allocated");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
memset(ctx, 0, sizeof(struct VpuCodecContext));
|
||||||
|
|
||||||
ctx->videoCoding = OMX_RK_VIDEO_CodingAVC;
|
ctx->videoCoding = OMX_RK_VIDEO_CodingAVC;
|
||||||
ctx->codecType = CODEC_ENCODER;
|
ctx->codecType = CODEC_ENCODER;
|
||||||
ctx->width = cmd->width;
|
ctx->width = cmd->width;
|
||||||
@@ -370,11 +368,20 @@ static RK_S32 vpu_encode_demo(VpuApiDemoCmdContext_t *cmd)
|
|||||||
fflush(pOutFile);
|
fflush(pOutFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx->control(ctx, VPU_API_ENC_SETFORMAT, &Format);
|
ret = ctx->control(ctx, VPU_API_ENC_SETFORMAT, &Format);
|
||||||
|
if (ret)
|
||||||
|
mpp_err("VPU_API_ENC_SETFORMAT ret %d\n", ret);
|
||||||
|
|
||||||
|
ret = ctx->control(ctx, VPU_API_ENC_GETCFG, enc_param);
|
||||||
|
if (ret)
|
||||||
|
mpp_log("VPU_API_ENC_GETCFG ret %d\n", ret);
|
||||||
|
|
||||||
ctx->control(ctx, VPU_API_ENC_GETCFG, enc_param);
|
|
||||||
enc_param->rc_mode = 1;
|
enc_param->rc_mode = 1;
|
||||||
ctx->control(ctx, VPU_API_ENC_SETCFG, enc_param);
|
|
||||||
|
ret = ctx->control(ctx, VPU_API_ENC_SETCFG, enc_param);
|
||||||
|
if (ret)
|
||||||
|
mpp_log("VPU_API_ENC_SETCFG ret %d\n", ret);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** vpu api encode process.
|
** vpu api encode process.
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user