[mpp_dec_cfg]: Add external notification callback

Add callback on two events:
1. packet ready and wait for new packet input.
2. frame ready and wait for output frame poll.e

NOTE:
Add callback command param for version compatible sync between user
and mpp library.

Change-Id: Ic41d495a06cf653acb6b5100699f1b7f5f735f2e
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
This commit is contained in:
Herman Chen 2021-10-13 10:51:07 +08:00
parent 2cf866c7dc
commit 0589fb5bd3
4 changed files with 57 additions and 2 deletions

View File

@ -18,6 +18,7 @@
#define __RK_VDEC_CMD_H__
#include "rk_type.h"
#include "mpp_err.h"
/*
* decoder query interface is only for debug usage
@ -62,4 +63,7 @@ typedef struct MppDecQueryCfg_t {
RK_U32 dec_out_frm_cnt;
} MppDecQueryCfg;
typedef void* MppExtCbCtx;
typedef MPP_RET (*MppExtCbFunc)(MppExtCbCtx cb_ctx, MppCtx mpp, RK_S32 cmd, void *arg);
#endif /*__RK_VDEC_CMD_H__*/

View File

@ -161,7 +161,13 @@ static const char *dec_cfg_func_names[] = {
ENTRY(base, internal_pts, U32, RK_U32, MPP_DEC_CFG_CHANGE_INTERNAL_PTS, base, internal_pts) \
ENTRY(base, sort_pts, U32, RK_U32, MPP_DEC_CFG_CHANGE_SORT_PTS, base, sort_pts) \
ENTRY(base, disable_error, U32, RK_U32, MPP_DEC_CFG_CHANGE_DISABLE_ERROR, base, disable_error) \
ENTRY(base, enable_vproc, U32, RK_U32, MPP_DEC_CFG_CHANGE_ENABLE_VPROC, base, enable_vproc)
ENTRY(base, enable_vproc, U32, RK_U32, MPP_DEC_CFG_CHANGE_ENABLE_VPROC, base, enable_vproc) \
ENTRY(cb, pkt_rdy_cb, PTR, MppExtCbFunc, MPP_DEC_CB_CFG_CHANGE_PKT_RDY, cb, pkt_rdy_cb) \
ENTRY(cb, pkt_rdy_ctx, PTR, MppExtCbCtx, MPP_DEC_CB_CFG_CHANGE_PKT_RDY, cb, pkt_rdy_ctx) \
ENTRY(cb, pkt_rdy_cmd, S32, RK_S32, MPP_DEC_CB_CFG_CHANGE_PKT_RDY, cb, pkt_rdy_cmd) \
ENTRY(cb, frm_rdy_cb, PTR, MppExtCbFunc, MPP_DEC_CB_CFG_CHANGE_FRM_RDY, cb, frm_rdy_cb) \
ENTRY(cb, frm_rdy_ctx, PTR, MppExtCbCtx, MPP_DEC_CB_CFG_CHANGE_FRM_RDY, cb, frm_rdy_ctx) \
ENTRY(cb, frm_rdy_cmd, S32, RK_S32, MPP_DEC_CB_CFG_CHANGE_FRM_RDY, cb, frm_rdy_cmd)
ENTRY_TABLE(EXPAND_AS_FUNC)
ENTRY_TABLE(EXPAND_AS_API)
@ -175,7 +181,7 @@ RK_S32 dec_const_strlen(const char* str)
return *str ? 1 + dec_const_strlen(str + 1) : 0;
}
static RK_S32 dec_node_len = ENTRY_TABLE(EXPAND_AS_STRLEN) + 39;
static RK_S32 dec_node_len = ENTRY_TABLE(EXPAND_AS_STRLEN) + 16;
class MppDecCfgService
{

View File

@ -1515,6 +1515,7 @@ static const char *timing_str[DEC_TIMING_BUTT] = {
MPP_RET mpp_dec_set_cfg(MppDecCfgSet *dst, MppDecCfgSet *src)
{
MppDecBaseCfg *src_base = &src->base;
MppDecCbCfg *src_cb = &src->cb;
if (src_base->change) {
MppDecBaseCfg *dst_base = &dst->base;
@ -1560,6 +1561,26 @@ MPP_RET mpp_dec_set_cfg(MppDecCfgSet *dst, MppDecCfgSet *src)
src_base->change = 0;
}
if (src_cb->change) {
MppDecCbCfg *dst_cb = &dst->cb;
RK_U32 change = src_cb->change;
if (change & MPP_DEC_CB_CFG_CHANGE_PKT_RDY) {
dst_cb->pkt_rdy_cb = src_cb->pkt_rdy_cb;
dst_cb->pkt_rdy_ctx = src_cb->pkt_rdy_ctx;
dst_cb->pkt_rdy_cmd = src_cb->pkt_rdy_cmd;
}
if (change & MPP_DEC_CB_CFG_CHANGE_FRM_RDY) {
dst_cb->frm_rdy_cb = src_cb->frm_rdy_cb;
dst_cb->frm_rdy_ctx = src_cb->frm_rdy_ctx;
dst_cb->frm_rdy_cmd = src_cb->frm_rdy_cmd;
}
dst_cb->change = change;
src_cb->change = 0;
}
return MPP_OK;
}

View File

@ -18,6 +18,7 @@
#define __MPP_DEC_CFG_H__
#include "mpp_frame.h"
#include "rk_vdec_cmd.h"
typedef enum MppDecCfgChange_e {
MPP_DEC_CFG_CHANGE_TYPE = (1 << 0),
@ -33,6 +34,7 @@ typedef enum MppDecCfgChange_e {
MPP_DEC_CFG_CHANGE_SORT_PTS = (1 << 13),
MPP_DEC_CFG_CHANGE_DISABLE_ERROR = (1 << 14),
MPP_DEC_CFG_CHANGE_ENABLE_VPROC = (1 << 15),
MPP_DEC_CFG_CHANGE_ALL = (0xFFFFFFFF),
} MppDecCfgChange;
@ -54,6 +56,27 @@ typedef struct MppDecBaseCfg_t {
RK_U32 enable_vproc;
} MppDecBaseCfg;
typedef enum MppDecCbCfgChange_e {
MPP_DEC_CB_CFG_CHANGE_PKT_RDY = (1 << 0),
MPP_DEC_CB_CFG_CHANGE_FRM_RDY = (1 << 1),
MPP_DEC_CB_CFG_CHANGE_ALL = (0xFFFFFFFF),
} MppDecCbCfgChange;
typedef struct MppDecCbCfg_t {
RK_U64 change;
/* notify packet process done and can accept new packet */
MppExtCbFunc pkt_rdy_cb;
MppExtCbCtx pkt_rdy_ctx;
RK_S32 pkt_rdy_cmd;
/* notify frame ready for output */
MppExtCbFunc frm_rdy_cb;
MppExtCbCtx frm_rdy_ctx;
RK_S32 frm_rdy_cmd;
} MppDecCbCfg;
typedef struct MppDecStatusCfg_t {
RK_U32 hal_task_count;
RK_U32 vproc_task_count;
@ -62,6 +85,7 @@ typedef struct MppDecStatusCfg_t {
typedef struct MppDecCfgSet_t {
MppDecBaseCfg base;
MppDecStatusCfg status;
MppDecCbCfg cb;
} MppDecCfgSet;
/*