From dbd2e2a77b22cb116f347c09abde177b88ab1e84 Mon Sep 17 00:00:00 2001 From: Herman Chen Date: Thu, 20 May 2021 09:29:10 +0800 Subject: [PATCH] [mpi]: Add mpp_start and mpp_stop The purpose of mpp_start and mpp_stop is to break mpp_init_into two stage. Original mpp_init conbine the init and start for example mpp_dec_init and mpp_dec_start then the global (or static) config which dominate the fundamental working way can be only be set before mpp_init. That is unreasonable. Another example is the encode memory prealloc flow. The mpp_start is added to end global param receiving and do real preparation of current operation in mpp_init. The mpp_stop is the opposite of mpp_start. Change-Id: I2bdcc29a9ff75777acc5c39c7e7f01477e597bb0 Signed-off-by: Herman Chen --- inc/rk_mpi.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/inc/rk_mpi.h b/inc/rk_mpi.h index 2cce8973..88863f22 100644 --- a/inc/rk_mpi.h +++ b/inc/rk_mpi.h @@ -240,6 +240,33 @@ MPP_RET mpp_create(MppCtx *ctx, MppApi **mpi); * error code. For details, please refer mpp_err.h. */ MPP_RET mpp_init(MppCtx ctx, MppCtxType type, MppCodingType coding); +/** + * @ingroup rk_mpi + * @brief Call after mpp_init to start mpp working. + * Control SET_CFG can be called both before and after mpp_start. + * Before mpp_start is called both global param and dynamic param can be set. + * After mpp_start is called only dynamic param can be set. + * This funciton purpose is to stop recieving global param and do + * preparation for processing data flow. + * This function will call internal context start function. + * @param[in] ctx The context of mpp, created by mpp_create(). + * @return 0 for success, others for failure. The return value is an + * error code. For details, please refer mpp_err.h. + */ +MPP_RET mpp_start(MppCtx ctx); +/** + * @ingroup rk_mpi + * @brief Call before mpp_destroy to stop mpp working. + * Control SET_CFG can be called after starting. + * Before mpp_stop is called only dynamic param can be set. + * After mpp_stop is called both global param and dynamic param can be set. + * This funciton purpose is to stop processing data and do preparation + * to receive global param. + * @param[in] ctx The context of mpp, created by mpp_create(). + * @return 0 for success, others for failure. The return value is an + * error code. For details, please refer mpp_err.h. + */ +MPP_RET mpp_stop(MppCtx ctx); /** * @ingroup rk_mpi * @brief Destroy mpp context and free both context and mpi structure,