mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-02 07:52:07 +08:00
[mpi]: Add start / stop / pause / resume ctrl cmd
1. Move mpp_start / mpp_stop function to control command. 2. Add pause / resume control command. Change-Id: I525668a2831eb8f23e12fbd7c1cb29c11fdcc868 Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
This commit is contained in:
27
inc/rk_mpi.h
27
inc/rk_mpi.h
@@ -240,33 +240,6 @@ MPP_RET mpp_create(MppCtx *ctx, MppApi **mpi);
|
|||||||
* error code. For details, please refer mpp_err.h.
|
* error code. For details, please refer mpp_err.h.
|
||||||
*/
|
*/
|
||||||
MPP_RET mpp_init(MppCtx ctx, MppCtxType type, MppCodingType coding);
|
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
|
* @ingroup rk_mpi
|
||||||
* @brief Destroy mpp context and free both context and mpi structure,
|
* @brief Destroy mpp context and free both context and mpi structure,
|
||||||
|
@@ -37,6 +37,9 @@
|
|||||||
/* separate encoder / decoder control command to different segment */
|
/* separate encoder / decoder control command to different segment */
|
||||||
#define CMD_CFG_ID_MASK (0x0000FF00)
|
#define CMD_CFG_ID_MASK (0x0000FF00)
|
||||||
|
|
||||||
|
/* mpp status control command */
|
||||||
|
#define CMD_STATE_OPS (0x00000100)
|
||||||
|
|
||||||
/* decoder control command */
|
/* decoder control command */
|
||||||
#define CMD_DEC_CFG_ALL (0x00000000)
|
#define CMD_DEC_CFG_ALL (0x00000000)
|
||||||
#define CMD_DEC_QUERY (0x00000100)
|
#define CMD_DEC_QUERY (0x00000100)
|
||||||
@@ -70,6 +73,13 @@ typedef enum {
|
|||||||
*/
|
*/
|
||||||
MPP_SET_INPUT_TIMEOUT, /* parameter type RK_S64 */
|
MPP_SET_INPUT_TIMEOUT, /* parameter type RK_S64 */
|
||||||
MPP_SET_OUTPUT_TIMEOUT, /* parameter type RK_S64 */
|
MPP_SET_OUTPUT_TIMEOUT, /* parameter type RK_S64 */
|
||||||
|
|
||||||
|
MPP_STATE_CMD_BASE = CMD_MODULE_MPP | CMD_STATE_OPS,
|
||||||
|
MPP_START,
|
||||||
|
MPP_STOP,
|
||||||
|
MPP_PAUSE,
|
||||||
|
MPP_RESUME,
|
||||||
|
|
||||||
MPP_CMD_END,
|
MPP_CMD_END,
|
||||||
|
|
||||||
MPP_CODEC_CMD_BASE = CMD_MODULE_CODEC,
|
MPP_CODEC_CMD_BASE = CMD_MODULE_CODEC,
|
||||||
|
@@ -103,6 +103,9 @@ public:
|
|||||||
MPP_RET start();
|
MPP_RET start();
|
||||||
MPP_RET stop();
|
MPP_RET stop();
|
||||||
|
|
||||||
|
MPP_RET pause();
|
||||||
|
MPP_RET resume();
|
||||||
|
|
||||||
MPP_RET put_packet(MppPacket packet);
|
MPP_RET put_packet(MppPacket packet);
|
||||||
MPP_RET get_frame(MppFrame *frame);
|
MPP_RET get_frame(MppFrame *frame);
|
||||||
|
|
||||||
|
28
mpp/mpi.cpp
28
mpp/mpi.cpp
@@ -519,34 +519,6 @@ MPP_RET mpp_destroy(MppCtx ctx)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
MPP_RET mpp_start(MppCtx ctx)
|
|
||||||
{
|
|
||||||
mpi_dbg_func("enter ctx %p\n", ctx);
|
|
||||||
|
|
||||||
MpiImpl *p = (MpiImpl*)ctx;
|
|
||||||
MPP_RET ret = check_mpp_ctx(p);
|
|
||||||
|
|
||||||
if (MPP_OK == ret)
|
|
||||||
ret = p->ctx->start();
|
|
||||||
|
|
||||||
mpi_dbg_func("leave ctx %p ret %d\n", ctx, ret);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
MPP_RET mpp_stop(MppCtx ctx)
|
|
||||||
{
|
|
||||||
mpi_dbg_func("enter ctx %p\n", ctx);
|
|
||||||
|
|
||||||
MpiImpl *p = (MpiImpl*)ctx;
|
|
||||||
MPP_RET ret = check_mpp_ctx(p);
|
|
||||||
|
|
||||||
if (MPP_OK == ret)
|
|
||||||
ret = p->ctx->stop();
|
|
||||||
|
|
||||||
mpi_dbg_func("leave ctx %p ret %d\n", ctx, ret);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
MPP_RET mpp_check_support_format(MppCtxType type, MppCodingType coding)
|
MPP_RET mpp_check_support_format(MppCtxType type, MppCodingType coding)
|
||||||
{
|
{
|
||||||
MPP_RET ret = MPP_NOK;
|
MPP_RET ret = MPP_NOK;
|
||||||
|
24
mpp/mpp.cpp
24
mpp/mpp.cpp
@@ -298,6 +298,16 @@ MPP_RET Mpp::stop()
|
|||||||
return MPP_OK;
|
return MPP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MPP_RET Mpp::pause()
|
||||||
|
{
|
||||||
|
return MPP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
MPP_RET Mpp::resume()
|
||||||
|
{
|
||||||
|
return MPP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
MPP_RET Mpp::put_packet(MppPacket packet)
|
MPP_RET Mpp::put_packet(MppPacket packet)
|
||||||
{
|
{
|
||||||
if (!mInitDone)
|
if (!mInitDone)
|
||||||
@@ -855,6 +865,20 @@ MPP_RET Mpp::control_mpp(MpiCmd cmd, MppParam param)
|
|||||||
mOutputTimeout = timeout;
|
mOutputTimeout = timeout;
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
case MPP_START : {
|
||||||
|
start();
|
||||||
|
} break;
|
||||||
|
case MPP_STOP : {
|
||||||
|
stop();
|
||||||
|
} break;
|
||||||
|
|
||||||
|
case MPP_PAUSE : {
|
||||||
|
pause();
|
||||||
|
} break;
|
||||||
|
case MPP_RESUME : {
|
||||||
|
resume();
|
||||||
|
} break;
|
||||||
|
|
||||||
default : {
|
default : {
|
||||||
ret = MPP_NOK;
|
ret = MPP_NOK;
|
||||||
} break;
|
} break;
|
||||||
|
Reference in New Issue
Block a user