diff --git a/inc/vpu_api.h b/inc/vpu_api.h index feacb4bc..3b4f159e 100644 --- a/inc/vpu_api.h +++ b/inc/vpu_api.h @@ -92,6 +92,7 @@ typedef enum VPU_API_CMD { VPU_API_GET_FRAME_INFO, VPU_API_SET_OUTPUT_BLOCK, VPU_API_GET_EOS_STATUS, + VPU_API_SET_OUTPUT_MODE, /* get sps/pps header */ VPU_API_GET_EXTRA_INFO = 0x200, diff --git a/mpp/legacy/vpu_api_legacy.cpp b/mpp/legacy/vpu_api_legacy.cpp index 30e1ef0c..4572924f 100644 --- a/mpp/legacy/vpu_api_legacy.cpp +++ b/mpp/legacy/vpu_api_legacy.cpp @@ -308,6 +308,10 @@ static RK_S32 init_frame_info(VpuCodecContext *ctx, { RK_S32 ret = -1; MppFrame frame = NULL; + RK_U32 fbcOutFmt = 0; + + if (ctx->private_data) + fbcOutFmt = *(RK_U32 *)ctx->private_data; if (ctx->extra_cfg.bit_depth || ctx->extra_cfg.yuv_format) { @@ -335,7 +339,7 @@ static RK_S32 init_frame_info(VpuCodecContext *ctx, mpp_frame_set_width(frame, p->ImgWidth); mpp_frame_set_height(frame, p->ImgHeight); - mpp_frame_set_fmt(frame, (MppFrameFormat)p->CodecType); + mpp_frame_set_fmt(frame, (MppFrameFormat)(p->CodecType | fbcOutFmt)); ret = mpi->control(mpp_ctx, MPP_DEC_SET_FRAME_INFO, (MppParam)frame); /* output the parameters used */ @@ -521,7 +525,7 @@ static void setup_VPU_FRAME_from_mpp_frame(VPU_FRAME *vframe, MppFrame mframe) vframe->ErrorInfo = mpp_frame_get_errinfo(mframe) | mpp_frame_get_discard(mframe); vframe->ShowTime.TimeHigh = (RK_U32)(pts >> 32); vframe->ShowTime.TimeLow = (RK_U32)pts; - switch (mpp_frame_get_fmt(mframe)) { + switch (mpp_frame_get_fmt(mframe) & MPP_FRAME_FMT_MASK) { case MPP_FMT_YUV420SP: { vframe->ColorType = VPU_OUTPUT_FORMAT_YUV420_SEMIPLANAR; vframe->OutputWidth = 0x20; @@ -1452,6 +1456,9 @@ RK_S32 VpuApiLegacy::control(VpuCodecContext *ctx, VPU_API_CMD cmd, void *param) *((VPU_GENERIC *)param) = vpug; mpicmd = MPI_CMD_BUTT; } break; + case VPU_API_SET_OUTPUT_MODE: { + mpicmd = MPP_DEC_SET_OUTPUT_FORMAT; + } break; case VPU_API_SET_IMMEDIATE_OUT: { mpicmd = MPP_DEC_SET_IMMEDIATE_OUT; } break;