[mppdec] add a notify call back interface for parser

[h265d]: notify eos to mpp_dec when no slot frame can used

git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@520 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
ChenSiyong
2015-12-22 02:00:33 +00:00
parent c69969c90a
commit 9287e78131
9 changed files with 39 additions and 12 deletions

View File

@@ -1920,6 +1920,7 @@ MPP_RET h265d_init(void *ctx, ParserCfg *parser_cfg)
s->slots = parser_cfg->frame_slots;
s->packet_slots = parser_cfg->packet_slots;
s->notify_cb = parser_cfg->notify_cb;
if (h265dctx->extradata_size > 0 && h265dctx->extradata) {
ret = hevc_parser_extradata(s);
@@ -1955,8 +1956,13 @@ MPP_RET h265d_flush(void *ctx)
ret = mpp_hevc_output_frame(ctx, 1);
} while (ret);
frame = &s->DPB[s->output_frame_idx];
if(frame->slot_index < 0xff){
mpp_buf_slot_set_prop(s->slots, frame->slot_index, SLOT_EOS, &eos);
}else{
if(s->notify_cb.callBack != NULL){
s->notify_cb.callBack(s->notify_cb.opaque,NULL);
}
}
return MPP_OK;
}

View File

@@ -697,6 +697,7 @@ typedef struct HEVCContext {
RK_S64 pts;
RK_U8 has_get_eos;
RK_U8 miss_ref_flag;
IOInterruptCB notify_cb;
} HEVCContext;
RK_S32 mpp_hevc_decode_short_term_rps(HEVCContext *s, ShortTermRPS *rps,

View File

@@ -38,6 +38,7 @@ struct MppDec_t {
// dec parser thread runtime resource context
MppPacket mpp_pkt_in;
RK_U32 fast_mode;
void *mpp;
};
@@ -60,6 +61,7 @@ MPP_RET mpp_dec_deinit(MppDec *dec);
MPP_RET mpp_dec_reset(MppDec *dec);
MPP_RET mpp_dec_flush(MppDec *dec);
MPP_RET mpp_dec_control(MppDec *dec, MpiCmd cmd, void *param);
MPP_RET mpp_dec_notify(void *ctx, void *info);
#ifdef __cplusplus
}

View File

@@ -37,6 +37,7 @@ typedef struct DecParserInitCfg_t {
// output
RK_S32 task_count;
RK_S32 need_split;
IOInterruptCB notify_cb;
} ParserCfg;

View File

@@ -704,7 +704,7 @@ MPP_RET mpp_dec_init(MppDec *dec, MppCodingType coding)
MppHal hal = NULL;
MppDec *p = dec;
RK_S32 task_count = 2;
HalIOInterruptCB cb = {NULL, NULL};
IOInterruptCB cb = {NULL, NULL};
if (dec->fast_mode) {
task_count = 3;
}
@@ -727,13 +727,15 @@ MPP_RET mpp_dec_init(MppDec *dec, MppCodingType coding)
}
mpp_buf_slot_setup(packet_slots, task_count);
cb.callBack = mpp_dec_notify;
cb.opaque = dec;
ParserCfg parser_cfg = {
coding,
frame_slots,
packet_slots,
task_count,
0,
cb,
};
ret = parser_init(&parser, &parser_cfg);
@@ -834,6 +836,18 @@ MPP_RET mpp_dec_flush(MppDec *dec)
return MPP_OK;
}
MPP_RET mpp_dec_notify(void *ctx, void *info)
{
MppDec *dec = (MppDec *)ctx;
MppFrame info_frame = NULL;
mpp_frame_init(&info_frame);
mpp_assert(NULL == mpp_frame_get_buffer(info_frame));
mpp_frame_set_eos(info_frame, 1);
mpp_put_frame((Mpp*)dec->mpp, info_frame);
(void)info;
return MPP_OK;
}
MPP_RET mpp_dec_control(MppDec *dec, MpiCmd cmd, void *param)
{
if (NULL == dec) {

View File

@@ -31,6 +31,12 @@ typedef enum MppTaskStatus_e {
TASK_BUTT,
} MppTaskStatus;
typedef struct IOInterruptCB {
MPP_RET (*callBack)(void*, void*);
void *opaque;
} IOInterruptCB;
/*
* modified by parser
*

View File

@@ -37,10 +37,7 @@ typedef enum MppHalHardType_e {
typedef void* MppHalCtx;
typedef struct HalIOInterruptCB {
MPP_RET (*callBack)(void*, void*);
void *opaque;
} HalIOInterruptCB;
typedef struct MppHalCfg_t {
// input
MppCtxType type;
@@ -54,7 +51,7 @@ typedef struct MppHalCfg_t {
HalTaskGroup tasks;
RK_S32 task_count;
RK_U32 fast_mode;
HalIOInterruptCB hal_int_cb;
IOInterruptCB hal_int_cb;
} MppHalCfg;
typedef struct MppHalApi_t {

View File

@@ -68,7 +68,7 @@ typedef struct h265d_reg_context {
void* hw_regs;
h265d_reg_buf_t g_buf[MAX_GEN_REG];
RK_U32 fast_mode;
HalIOInterruptCB int_cb;
IOInterruptCB int_cb;
} h265d_reg_context_t;
typedef struct ScalingList {
@@ -1392,10 +1392,10 @@ MPP_RET hal_h265d_gen_regs(void *hal, HalTaskInfo *syn)
H265d_REGS_t *hw_regs;
RK_S32 ret = MPP_SUCCESS;
MppBuffer streambuf = NULL;
RK_S32 valid_ref = -1;
RK_S32 aglin_offset = 0;
#ifdef ANDROID
RK_S32 valid_ref = -1;
MppBuffer framebuf = NULL;
#endif

View File

@@ -80,7 +80,7 @@ MPP_RET Mpp::init(MppCtxType type, MppCodingType coding)
if (MPP_VIDEO_CodingHEVC == coding) {
mDec->fast_mode = mFastMode;
}
mDec->mpp = this;
mpp_dec_init(mDec, coding);
mThreadCodec = new MppThread(mpp_dec_parser_thread, this);