[mpp_buf_slot]: add pts to buffer slot implement

git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@214 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
ChenHengming
2015-09-06 16:28:42 +00:00
parent a46c542696
commit ab4aec04c6
2 changed files with 47 additions and 3 deletions

View File

@@ -162,9 +162,23 @@ MPP_RET mpp_buf_slot_clr_decoding(MppBufSlots slots, RK_U32 index);
MPP_RET mpp_buf_slot_set_display(MppBufSlots slots, RK_U32 index); MPP_RET mpp_buf_slot_set_display(MppBufSlots slots, RK_U32 index);
MPP_RET mpp_buf_slot_clr_display(MppBufSlots slots, RK_U32 index); MPP_RET mpp_buf_slot_clr_display(MppBufSlots slots, RK_U32 index);
/*
* mpp_buf_slot_set_buffer
* - called by dec thread when find a output index has not buffer
*
* mpp_buf_slot_get_buffer
* - called by hal module on register generation
*
* mpp_buf_slot_set_pts
* - called by parser when decoding a new frame
*
* mpp_buf_slot_get_pts
* - called by hal thread when output a frame
*/
MPP_RET mpp_buf_slot_set_buffer(MppBufSlots slots, RK_U32 index, MppBuffer buffer); MPP_RET mpp_buf_slot_set_buffer(MppBufSlots slots, RK_U32 index, MppBuffer buffer);
MppBuffer mpp_buf_slot_get_buffer(const MppBufSlots slots, RK_U32 index); MppBuffer mpp_buf_slot_get_buffer(const MppBufSlots slots, RK_U32 index);
MPP_RET mpp_buf_slot_set_pts(MppBufSlots slots, RK_U32 index, RK_S64 pts);
RK_S64 mpp_buf_slot_get_pts(const MppBufSlots slots, RK_U32 index);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@@ -33,6 +33,7 @@
typedef struct MppBufSlotEntry_t { typedef struct MppBufSlotEntry_t {
MppBuffer buffer; MppBuffer buffer;
RK_U32 status; RK_U32 status;
RK_S64 pts;
} MppBufSlotEntry; } MppBufSlotEntry;
typedef struct MppBufSlotsImpl_t { typedef struct MppBufSlotsImpl_t {
@@ -320,3 +321,32 @@ MppBuffer mpp_buf_slot_get_buffer(const MppBufSlots slots, RK_U32 index)
return slot[index].buffer; return slot[index].buffer;
} }
MPP_RET mpp_buf_slot_set_pts(MppBufSlots slots, RK_U32 index, RK_S64 pts)
{
if (NULL == slots) {
mpp_err_f("found NULL input\n");
return MPP_ERR_NULL_PTR;
}
MppBufSlotsImpl *impl = (MppBufSlotsImpl *)slots;
Mutex::Autolock auto_lock(impl->lock);
MppBufSlotEntry *slot = impl->slots;
mpp_assert(index < impl->count);
slot[index].pts = pts;
return MPP_OK;
}
RK_S64 mpp_buf_slot_get_pts(const MppBufSlots slots, RK_U32 index)
{
if (NULL == slots) {
mpp_err_f("found NULL input\n");
return NULL;
}
MppBufSlotsImpl *impl = (MppBufSlotsImpl *)slots;
Mutex::Autolock auto_lock(impl->lock);
MppBufSlotEntry *slot = impl->slots;
mpp_assert(index < impl->count);
return slot[index].pts;
}