mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-06 01:26:49 +08:00
[mpeg4d]: fix bug on eos and reset
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@975 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
@@ -144,7 +144,8 @@ MPP_RET mpg4d_reset(void *dec)
|
||||
return MPP_ERR_NULL_PTR;
|
||||
}
|
||||
|
||||
return mpp_mpg4_parser_reset(dec);
|
||||
Mpg4dCtx *p = (Mpg4dCtx *)dec;
|
||||
return mpp_mpg4_parser_reset(p->parser);
|
||||
}
|
||||
|
||||
|
||||
@@ -155,7 +156,8 @@ MPP_RET mpg4d_flush(void *dec)
|
||||
return MPP_ERR_NULL_PTR;
|
||||
}
|
||||
|
||||
return mpp_mpg4_parser_flush(dec);
|
||||
Mpg4dCtx *p = (Mpg4dCtx *)dec;
|
||||
return mpp_mpg4_parser_flush(p->parser);
|
||||
}
|
||||
|
||||
|
||||
@@ -171,7 +173,7 @@ MPP_RET mpg4d_control(void *dec, RK_S32 cmd_type, void *param)
|
||||
p = (Mpg4dCtx *)dec;
|
||||
switch (cmd_type) {
|
||||
case MPP_DEC_SET_INTERNAL_PTS_ENABLE : {
|
||||
mpp_mpg4_parser_set_pts_mode(p, 1);
|
||||
mpp_mpg4_parser_set_pts_mode(p->parser, 0);
|
||||
} break;
|
||||
}
|
||||
(void)param;
|
||||
@@ -183,6 +185,7 @@ MPP_RET mpg4d_prepare(void *dec, MppPacket pkt, HalDecTask *task)
|
||||
Mpg4dCtx *p;
|
||||
RK_U8 *pos;
|
||||
size_t length;
|
||||
RK_U32 eos;
|
||||
|
||||
if (NULL == dec || NULL == pkt || NULL == task) {
|
||||
mpp_err_f("found NULL intput dec %p pkt %p task %p\n", dec, pkt, task);
|
||||
@@ -192,6 +195,15 @@ MPP_RET mpg4d_prepare(void *dec, MppPacket pkt, HalDecTask *task)
|
||||
p = (Mpg4dCtx *)dec;
|
||||
pos = mpp_packet_get_pos(pkt);
|
||||
length = mpp_packet_get_length(pkt);
|
||||
eos = mpp_packet_get_eos(pkt);
|
||||
|
||||
if (eos && !length) {
|
||||
task->valid = 0;
|
||||
task->flags.eos = 1;
|
||||
mpp_log_f("mpeg4d flush eos");
|
||||
mpg4d_flush(dec);
|
||||
return MPP_OK;
|
||||
}
|
||||
|
||||
if (NULL == p->stream) {
|
||||
mpp_err("failed to malloc task buffer for hardware with size %d\n", length);
|
||||
|
@@ -1093,13 +1093,44 @@ MPP_RET mpp_mpg4_parser_deinit(Mpg4dParser ctx)
|
||||
|
||||
MPP_RET mpp_mpg4_parser_flush(Mpg4dParser ctx)
|
||||
{
|
||||
(void)ctx;
|
||||
Mpg4dParserImpl *p = (Mpg4dParserImpl *)ctx;
|
||||
MppBufSlots slots = p->frame_slots;
|
||||
Mpg4Hdr *hdr_ref0 = &p->hdr_ref0;
|
||||
Mpg4Hdr *hdr_ref1 = &p->hdr_ref1;
|
||||
RK_S32 index = hdr_ref0->slot_idx;
|
||||
if (index >= 0) {
|
||||
mpp_buf_slot_set_flag(slots, index, SLOT_QUEUE_USE);
|
||||
mpp_buf_slot_enqueue(slots, index, QUEUE_DISPLAY);
|
||||
mpp_buf_slot_clr_flag(slots, index, SLOT_CODEC_USE);
|
||||
hdr_ref0->slot_idx = -1;
|
||||
}
|
||||
|
||||
index = hdr_ref1->slot_idx;
|
||||
if (index >= 0) {
|
||||
mpp_buf_slot_clr_flag(slots, index, SLOT_CODEC_USE);
|
||||
hdr_ref1->slot_idx = -1;
|
||||
}
|
||||
|
||||
return MPP_OK;
|
||||
}
|
||||
|
||||
MPP_RET mpp_mpg4_parser_reset(Mpg4dParser ctx)
|
||||
{
|
||||
(void)ctx;
|
||||
Mpg4dParserImpl *p = (Mpg4dParserImpl *)ctx;
|
||||
MppBufSlots slots = p->frame_slots;
|
||||
Mpg4Hdr *hdr_ref0 = &p->hdr_ref0;
|
||||
Mpg4Hdr *hdr_ref1 = &p->hdr_ref1;
|
||||
|
||||
if (hdr_ref0->slot_idx >= 0) {
|
||||
mpp_buf_slot_clr_flag(slots, hdr_ref0->slot_idx, SLOT_CODEC_USE);
|
||||
hdr_ref0->slot_idx = -1;
|
||||
}
|
||||
|
||||
if (hdr_ref1->slot_idx >= 0) {
|
||||
mpp_buf_slot_clr_flag(slots, hdr_ref1->slot_idx, SLOT_CODEC_USE);
|
||||
hdr_ref1->slot_idx = -1;
|
||||
}
|
||||
|
||||
return MPP_OK;
|
||||
}
|
||||
|
||||
@@ -1360,7 +1391,6 @@ MPP_RET mpp_mpg4_parser_setup_hal_output(Mpg4dParser ctx, RK_S32 *output)
|
||||
mpp_buf_slot_get_unused(slots, &index);
|
||||
mpp_buf_slot_set_flag(slots, index, SLOT_HAL_OUTPUT);
|
||||
mpp_frame_set_pts(frame, p->pts);
|
||||
mpp_frame_set_eos(frame, p->eos);
|
||||
|
||||
if (hdr_curr->vol.interlacing) {
|
||||
frame_mode = (hdr_curr->vop.top_field_first) ?
|
||||
@@ -1460,19 +1490,6 @@ MPP_RET mpp_mpg4_parser_update_dpb(Mpg4dParser ctx)
|
||||
hdr_curr->pts = 0;
|
||||
}
|
||||
|
||||
if (p->eos) {
|
||||
index = hdr_ref0->slot_idx;
|
||||
if (index >= 0) {
|
||||
mpp_buf_slot_set_flag(slots, index, SLOT_QUEUE_USE);
|
||||
mpp_buf_slot_enqueue(slots, index, QUEUE_DISPLAY);
|
||||
mpp_buf_slot_clr_flag(slots, index, SLOT_CODEC_USE);
|
||||
}
|
||||
|
||||
index = hdr_ref1->slot_idx;
|
||||
if (index >= 0)
|
||||
mpp_buf_slot_clr_flag(slots, index, SLOT_CODEC_USE);
|
||||
}
|
||||
|
||||
p->last_pts = p->pts;
|
||||
|
||||
return MPP_OK;
|
||||
|
Reference in New Issue
Block a user