From ab4aec04c6d89e9f86c59c06c038a4477d556c72 Mon Sep 17 00:00:00 2001 From: ChenHengming Date: Sun, 6 Sep 2015 16:28:42 +0000 Subject: [PATCH] [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 --- mpp/codec/inc/mpp_buf_slot.h | 20 +++++++++++++++++--- mpp/codec/mpp_buf_slot.cpp | 30 ++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 3 deletions(-) diff --git a/mpp/codec/inc/mpp_buf_slot.h b/mpp/codec/inc/mpp_buf_slot.h index 15cc77ef..1b5a155b 100644 --- a/mpp/codec/inc/mpp_buf_slot.h +++ b/mpp/codec/inc/mpp_buf_slot.h @@ -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_clr_display(MppBufSlots slots, RK_U32 index); - -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); +/* + * 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); +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 } diff --git a/mpp/codec/mpp_buf_slot.cpp b/mpp/codec/mpp_buf_slot.cpp index 7618c21f..3adbca54 100644 --- a/mpp/codec/mpp_buf_slot.cpp +++ b/mpp/codec/mpp_buf_slot.cpp @@ -33,6 +33,7 @@ typedef struct MppBufSlotEntry_t { MppBuffer buffer; RK_U32 status; + RK_S64 pts; } MppBufSlotEntry; typedef struct MppBufSlotsImpl_t { @@ -320,3 +321,32 @@ MppBuffer mpp_buf_slot_get_buffer(const MppBufSlots slots, RK_U32 index) 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; +} +