mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-07 10:00:55 +08:00
[buf_slot]: add get_decoding function
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@226 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
@@ -146,6 +146,9 @@ RK_U32 mpp_buf_slot_get_size(MppBufSlots slots);
|
||||
*
|
||||
* called by mpp
|
||||
*
|
||||
* mpp_buf_slot_get_decoding
|
||||
* - mpp_dec need to get the output slot index to check buffer status
|
||||
*
|
||||
* mpp_buf_slot_clr_display
|
||||
* - mark a slot has been send out to display
|
||||
*
|
||||
@@ -160,6 +163,7 @@ MPP_RET mpp_buf_slot_set_ref(MppBufSlots slots, RK_U32 index);
|
||||
MPP_RET mpp_buf_slot_clr_ref(MppBufSlots slots, RK_U32 index);
|
||||
MPP_RET mpp_buf_slot_set_decoding(MppBufSlots slots, RK_U32 index);
|
||||
MPP_RET mpp_buf_slot_clr_decoding(MppBufSlots slots, RK_U32 index);
|
||||
MPP_RET mpp_buf_slot_get_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);
|
||||
|
||||
|
@@ -33,6 +33,7 @@
|
||||
typedef struct MppBufSlotEntry_t {
|
||||
MppBuffer buffer;
|
||||
RK_U32 status;
|
||||
RK_S32 index;
|
||||
RK_S64 pts;
|
||||
} MppBufSlotEntry;
|
||||
|
||||
@@ -50,6 +51,9 @@ typedef struct MppBufSlotsImpl_t {
|
||||
RK_U32 new_count;
|
||||
RK_U32 new_size;
|
||||
|
||||
// to record current output slot index
|
||||
RK_S32 output;
|
||||
|
||||
MppBufSlotEntry *slots;
|
||||
} MppBufSlotsImpl;
|
||||
|
||||
@@ -61,6 +65,7 @@ static void check_entry_unused(MppBufSlotEntry *entry)
|
||||
if (entry->status == MPP_SLOT_USED) {
|
||||
entry->status = MPP_SLOT_UNUSED;
|
||||
mpp_buffer_put(entry->buffer);
|
||||
entry->buffer = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,6 +114,9 @@ MPP_RET mpp_buf_slot_setup(MppBufSlots slots, RK_U32 count, RK_U32 size, RK_U32
|
||||
impl->slots = mpp_calloc(MppBufSlotEntry, count);
|
||||
impl->count = count;
|
||||
impl->size = size;
|
||||
for (RK_U32 i = 0; i < count; i++) {
|
||||
impl->slots[i].index = i;
|
||||
}
|
||||
} else {
|
||||
// need to check info change or not
|
||||
if (!changed) {
|
||||
@@ -116,6 +124,9 @@ MPP_RET mpp_buf_slot_setup(MppBufSlots slots, RK_U32 count, RK_U32 size, RK_U32
|
||||
if (count > impl->count) {
|
||||
mpp_realloc(impl->slots, MppBufSlotEntry, count);
|
||||
memset(&impl->slots[impl->count], 0, sizeof(MppBufSlotEntry) * (count - impl->count));
|
||||
for (RK_U32 i = 0; i < count; i++) {
|
||||
impl->slots[i].index = i;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// info changed, even size is the same we still need to wait for new configuration
|
||||
@@ -159,6 +170,9 @@ MPP_RET mpp_buf_slot_ready(MppBufSlots slots)
|
||||
if (impl->new_count > impl->count) {
|
||||
memset(&impl->slots[impl->count], 0, sizeof(MppBufSlotEntry) * (impl->new_count - impl->count));
|
||||
}
|
||||
for (RK_U32 i = 0; i < impl->new_count; i++) {
|
||||
impl->slots[i].index = i;
|
||||
}
|
||||
}
|
||||
impl->count = impl->new_count;
|
||||
return MPP_OK;
|
||||
@@ -243,6 +257,7 @@ MPP_RET mpp_buf_slot_set_decoding(MppBufSlots slots, RK_U32 index)
|
||||
MppBufSlotEntry *slot = impl->slots;
|
||||
mpp_assert(index < impl->count);
|
||||
slot[index].status |= MPP_SLOT_USED_AS_DECODING;
|
||||
impl->output = index;
|
||||
return MPP_OK;
|
||||
}
|
||||
|
||||
@@ -263,6 +278,18 @@ MPP_RET mpp_buf_slot_clr_decoding(MppBufSlots slots, RK_U32 index)
|
||||
return MPP_OK;
|
||||
}
|
||||
|
||||
MPP_RET mpp_buf_slot_get_decoding(MppBufSlots slots, RK_U32 *index)
|
||||
{
|
||||
if (NULL == slots || NULL == index) {
|
||||
mpp_err_f("found NULL input\n");
|
||||
return MPP_ERR_NULL_PTR;
|
||||
}
|
||||
|
||||
MppBufSlotsImpl *impl = (MppBufSlotsImpl *)slots;
|
||||
*index = impl->output;
|
||||
return MPP_OK;
|
||||
}
|
||||
|
||||
MPP_RET mpp_buf_slot_set_display(MppBufSlots slots, RK_U32 index)
|
||||
{
|
||||
if (NULL == slots) {
|
||||
|
@@ -163,7 +163,8 @@ void *mpp_dec_parser_thread(void *data)
|
||||
* - need buffer in different side, need to send a info change
|
||||
* frame to hal loop.
|
||||
*/
|
||||
RK_S32 output = task_local.dec.output;
|
||||
RK_U32 output;
|
||||
mpp_buf_slot_get_decoding(slots, &output);
|
||||
if (NULL == mpp_buf_slot_get_buffer(slots, output)) {
|
||||
MppBuffer buffer = NULL;
|
||||
RK_U32 size = mpp_buf_slot_get_size(slots);
|
||||
@@ -257,7 +258,7 @@ void *mpp_dec_hal_thread(void *data)
|
||||
* 5. add frame to output list
|
||||
* 6. clear display flag
|
||||
*/
|
||||
RK_S32 output = task_dec->output;
|
||||
RK_U32 output = task_dec->output;
|
||||
|
||||
mpp_buf_slot_clr_decoding(slots, output);
|
||||
|
||||
@@ -270,11 +271,11 @@ void *mpp_dec_hal_thread(void *data)
|
||||
MppBuffer buffer = mpp_buf_slot_get_buffer(slots, output);
|
||||
mpp_frame_set_buffer(frame, buffer);
|
||||
|
||||
mpp_buf_slot_clr_display(slots, output);
|
||||
|
||||
frames->add_at_tail(&frame, sizeof(frame));
|
||||
mpp->mFramePutCount++;
|
||||
|
||||
mpp_buf_slot_clr_display(slots, output);
|
||||
|
||||
/*
|
||||
* mark previous buffer is complete
|
||||
*/
|
||||
|
@@ -71,6 +71,7 @@ typedef struct HalDecTask_t {
|
||||
// current tesk protocol syntax information
|
||||
MppSyntax syntax;
|
||||
|
||||
// for test purpose
|
||||
// current tesk output slot index
|
||||
RK_S32 output;
|
||||
// current task reference slot index, -1 for unused
|
||||
|
Reference in New Issue
Block a user