mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-05 17:16:50 +08:00
[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:
@@ -1920,6 +1920,7 @@ MPP_RET h265d_init(void *ctx, ParserCfg *parser_cfg)
|
|||||||
s->slots = parser_cfg->frame_slots;
|
s->slots = parser_cfg->frame_slots;
|
||||||
|
|
||||||
s->packet_slots = parser_cfg->packet_slots;
|
s->packet_slots = parser_cfg->packet_slots;
|
||||||
|
s->notify_cb = parser_cfg->notify_cb;
|
||||||
|
|
||||||
if (h265dctx->extradata_size > 0 && h265dctx->extradata) {
|
if (h265dctx->extradata_size > 0 && h265dctx->extradata) {
|
||||||
ret = hevc_parser_extradata(s);
|
ret = hevc_parser_extradata(s);
|
||||||
@@ -1955,8 +1956,13 @@ MPP_RET h265d_flush(void *ctx)
|
|||||||
ret = mpp_hevc_output_frame(ctx, 1);
|
ret = mpp_hevc_output_frame(ctx, 1);
|
||||||
} while (ret);
|
} while (ret);
|
||||||
frame = &s->DPB[s->output_frame_idx];
|
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);
|
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;
|
return MPP_OK;
|
||||||
}
|
}
|
||||||
|
@@ -697,6 +697,7 @@ typedef struct HEVCContext {
|
|||||||
RK_S64 pts;
|
RK_S64 pts;
|
||||||
RK_U8 has_get_eos;
|
RK_U8 has_get_eos;
|
||||||
RK_U8 miss_ref_flag;
|
RK_U8 miss_ref_flag;
|
||||||
|
IOInterruptCB notify_cb;
|
||||||
} HEVCContext;
|
} HEVCContext;
|
||||||
|
|
||||||
RK_S32 mpp_hevc_decode_short_term_rps(HEVCContext *s, ShortTermRPS *rps,
|
RK_S32 mpp_hevc_decode_short_term_rps(HEVCContext *s, ShortTermRPS *rps,
|
||||||
|
@@ -38,6 +38,7 @@ struct MppDec_t {
|
|||||||
// dec parser thread runtime resource context
|
// dec parser thread runtime resource context
|
||||||
MppPacket mpp_pkt_in;
|
MppPacket mpp_pkt_in;
|
||||||
RK_U32 fast_mode;
|
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_reset(MppDec *dec);
|
||||||
MPP_RET mpp_dec_flush(MppDec *dec);
|
MPP_RET mpp_dec_flush(MppDec *dec);
|
||||||
MPP_RET mpp_dec_control(MppDec *dec, MpiCmd cmd, void *param);
|
MPP_RET mpp_dec_control(MppDec *dec, MpiCmd cmd, void *param);
|
||||||
|
MPP_RET mpp_dec_notify(void *ctx, void *info);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@@ -37,6 +37,7 @@ typedef struct DecParserInitCfg_t {
|
|||||||
// output
|
// output
|
||||||
RK_S32 task_count;
|
RK_S32 task_count;
|
||||||
RK_S32 need_split;
|
RK_S32 need_split;
|
||||||
|
IOInterruptCB notify_cb;
|
||||||
} ParserCfg;
|
} ParserCfg;
|
||||||
|
|
||||||
|
|
||||||
|
@@ -704,7 +704,7 @@ MPP_RET mpp_dec_init(MppDec *dec, MppCodingType coding)
|
|||||||
MppHal hal = NULL;
|
MppHal hal = NULL;
|
||||||
MppDec *p = dec;
|
MppDec *p = dec;
|
||||||
RK_S32 task_count = 2;
|
RK_S32 task_count = 2;
|
||||||
HalIOInterruptCB cb = {NULL, NULL};
|
IOInterruptCB cb = {NULL, NULL};
|
||||||
if (dec->fast_mode) {
|
if (dec->fast_mode) {
|
||||||
task_count = 3;
|
task_count = 3;
|
||||||
}
|
}
|
||||||
@@ -727,13 +727,15 @@ MPP_RET mpp_dec_init(MppDec *dec, MppCodingType coding)
|
|||||||
}
|
}
|
||||||
|
|
||||||
mpp_buf_slot_setup(packet_slots, task_count);
|
mpp_buf_slot_setup(packet_slots, task_count);
|
||||||
|
cb.callBack = mpp_dec_notify;
|
||||||
|
cb.opaque = dec;
|
||||||
ParserCfg parser_cfg = {
|
ParserCfg parser_cfg = {
|
||||||
coding,
|
coding,
|
||||||
frame_slots,
|
frame_slots,
|
||||||
packet_slots,
|
packet_slots,
|
||||||
task_count,
|
task_count,
|
||||||
0,
|
0,
|
||||||
|
cb,
|
||||||
};
|
};
|
||||||
|
|
||||||
ret = parser_init(&parser, &parser_cfg);
|
ret = parser_init(&parser, &parser_cfg);
|
||||||
@@ -834,6 +836,18 @@ MPP_RET mpp_dec_flush(MppDec *dec)
|
|||||||
return MPP_OK;
|
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)
|
MPP_RET mpp_dec_control(MppDec *dec, MpiCmd cmd, void *param)
|
||||||
{
|
{
|
||||||
if (NULL == dec) {
|
if (NULL == dec) {
|
||||||
|
@@ -31,6 +31,12 @@ typedef enum MppTaskStatus_e {
|
|||||||
TASK_BUTT,
|
TASK_BUTT,
|
||||||
} MppTaskStatus;
|
} MppTaskStatus;
|
||||||
|
|
||||||
|
typedef struct IOInterruptCB {
|
||||||
|
MPP_RET (*callBack)(void*, void*);
|
||||||
|
void *opaque;
|
||||||
|
} IOInterruptCB;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* modified by parser
|
* modified by parser
|
||||||
*
|
*
|
||||||
|
@@ -37,10 +37,7 @@ typedef enum MppHalHardType_e {
|
|||||||
|
|
||||||
typedef void* MppHalCtx;
|
typedef void* MppHalCtx;
|
||||||
|
|
||||||
typedef struct HalIOInterruptCB {
|
|
||||||
MPP_RET (*callBack)(void*, void*);
|
|
||||||
void *opaque;
|
|
||||||
} HalIOInterruptCB;
|
|
||||||
typedef struct MppHalCfg_t {
|
typedef struct MppHalCfg_t {
|
||||||
// input
|
// input
|
||||||
MppCtxType type;
|
MppCtxType type;
|
||||||
@@ -54,7 +51,7 @@ typedef struct MppHalCfg_t {
|
|||||||
HalTaskGroup tasks;
|
HalTaskGroup tasks;
|
||||||
RK_S32 task_count;
|
RK_S32 task_count;
|
||||||
RK_U32 fast_mode;
|
RK_U32 fast_mode;
|
||||||
HalIOInterruptCB hal_int_cb;
|
IOInterruptCB hal_int_cb;
|
||||||
} MppHalCfg;
|
} MppHalCfg;
|
||||||
|
|
||||||
typedef struct MppHalApi_t {
|
typedef struct MppHalApi_t {
|
||||||
|
@@ -68,7 +68,7 @@ typedef struct h265d_reg_context {
|
|||||||
void* hw_regs;
|
void* hw_regs;
|
||||||
h265d_reg_buf_t g_buf[MAX_GEN_REG];
|
h265d_reg_buf_t g_buf[MAX_GEN_REG];
|
||||||
RK_U32 fast_mode;
|
RK_U32 fast_mode;
|
||||||
HalIOInterruptCB int_cb;
|
IOInterruptCB int_cb;
|
||||||
} h265d_reg_context_t;
|
} h265d_reg_context_t;
|
||||||
|
|
||||||
typedef struct ScalingList {
|
typedef struct ScalingList {
|
||||||
@@ -1392,10 +1392,10 @@ MPP_RET hal_h265d_gen_regs(void *hal, HalTaskInfo *syn)
|
|||||||
H265d_REGS_t *hw_regs;
|
H265d_REGS_t *hw_regs;
|
||||||
RK_S32 ret = MPP_SUCCESS;
|
RK_S32 ret = MPP_SUCCESS;
|
||||||
MppBuffer streambuf = NULL;
|
MppBuffer streambuf = NULL;
|
||||||
RK_S32 valid_ref = -1;
|
|
||||||
RK_S32 aglin_offset = 0;
|
RK_S32 aglin_offset = 0;
|
||||||
|
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
|
RK_S32 valid_ref = -1;
|
||||||
MppBuffer framebuf = NULL;
|
MppBuffer framebuf = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -80,7 +80,7 @@ MPP_RET Mpp::init(MppCtxType type, MppCodingType coding)
|
|||||||
if (MPP_VIDEO_CodingHEVC == coding) {
|
if (MPP_VIDEO_CodingHEVC == coding) {
|
||||||
mDec->fast_mode = mFastMode;
|
mDec->fast_mode = mFastMode;
|
||||||
}
|
}
|
||||||
|
mDec->mpp = this;
|
||||||
mpp_dec_init(mDec, coding);
|
mpp_dec_init(mDec, coding);
|
||||||
|
|
||||||
mThreadCodec = new MppThread(mpp_dec_parser_thread, this);
|
mThreadCodec = new MppThread(mpp_dec_parser_thread, this);
|
||||||
|
Reference in New Issue
Block a user