mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-04 16:52:40 +08:00
[mpp_hal]: add more hal api function
[misc]: remove anonymous struct name git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@208 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
@@ -170,7 +170,7 @@ typedef enum {
|
||||
*
|
||||
* TODO: to be implemented.
|
||||
*/
|
||||
typedef struct {
|
||||
typedef struct MppBufferInfo_t {
|
||||
MppBufferType type;
|
||||
size_t size;
|
||||
void *ptr;
|
||||
|
@@ -93,7 +93,7 @@ typedef void* MppParam;
|
||||
* send a stream header to mpi ctx using parameter data / size
|
||||
* and decoder will try to decode the
|
||||
*/
|
||||
typedef struct {
|
||||
typedef struct MppEncConfig_t {
|
||||
/*
|
||||
* input source data format
|
||||
*/
|
||||
@@ -136,7 +136,7 @@ typedef struct {
|
||||
RK_S32 trans8x8_en;
|
||||
} MppEncConfig;
|
||||
|
||||
typedef struct {
|
||||
typedef struct MppApi_t {
|
||||
RK_U32 size;
|
||||
RK_U32 version;
|
||||
|
||||
|
@@ -28,7 +28,7 @@
|
||||
*
|
||||
* the reset wait for extension
|
||||
*/
|
||||
typedef struct {
|
||||
typedef struct MppParserInitCfg_t {
|
||||
MppBufSlots slots;
|
||||
} MppParserInitCfg;
|
||||
|
||||
@@ -50,7 +50,7 @@ typedef struct MppDec_t MppDec;
|
||||
* flush - decoder output all frames
|
||||
* control - decoder configure function
|
||||
*/
|
||||
typedef struct {
|
||||
typedef struct MppDecParser_t {
|
||||
char *name;
|
||||
MppCodingType coding;
|
||||
RK_U32 ctx_size;
|
||||
|
@@ -30,12 +30,12 @@
|
||||
#define MPP_SLOT_USED_AS_DECODING (0x00000004)
|
||||
#define MPP_SLOT_USED_AS_DISPLAY (0x00000008)
|
||||
|
||||
typedef struct {
|
||||
typedef struct MppBufSlotEntry_t {
|
||||
MppBuffer buffer;
|
||||
RK_U32 status;
|
||||
} MppBufSlotEntry;
|
||||
|
||||
typedef struct {
|
||||
typedef struct MppBufSlotsImpl_t {
|
||||
Mutex *lock;
|
||||
RK_U32 count;
|
||||
RK_U32 size;
|
||||
|
@@ -16,15 +16,15 @@
|
||||
|
||||
#define MODULE_TAG "mpp_dec"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "mpp_mem.h"
|
||||
#include "mpp_log.h"
|
||||
#include "mpp_common.h"
|
||||
|
||||
#include "mpp.h"
|
||||
#include "mpp_dec.h"
|
||||
#include "mpp_packet.h"
|
||||
#include "mpp_packet_impl.h"
|
||||
#include "mpp_buf_slot.h"
|
||||
|
||||
#include "h264d_api.h"
|
||||
#include "h265d_api.h"
|
||||
@@ -51,13 +51,15 @@ void *mpp_dec_parser_thread(void *data)
|
||||
MppDec *dec = mpp->mDec;
|
||||
mpp_list *packets = mpp->mPackets;
|
||||
MppPacketImpl packet;
|
||||
HalTask task_local;
|
||||
HalTaskHnd task_hnd = NULL;
|
||||
RK_U32 packet_ready = 0;
|
||||
RK_U32 packet_parsed = 0;
|
||||
RK_U32 syntax_ready = 0;
|
||||
RK_U32 slot_ready = 0;
|
||||
|
||||
HalTask task_local;
|
||||
memset(&task_local, 0, sizeof(task_local));
|
||||
|
||||
while (MPP_THREAD_RUNNING == parser->get_status()) {
|
||||
/*
|
||||
* wait for stream input
|
||||
@@ -121,8 +123,9 @@ void *mpp_dec_parser_thread(void *data)
|
||||
* frame to hal loop.
|
||||
*/
|
||||
|
||||
//MppBuffer buffer;
|
||||
//mpp_buffer_get(mpp->mFrameGroup, &buffer, MPP_TEST_FRAME_SIZE);
|
||||
// RK_S32 output = task_local.dec.output;
|
||||
// MppBuffer buffer;
|
||||
// mpp_buffer_get(mpp->mFrameGroup, &buffer, MPP_TEST_FRAME_SIZE);
|
||||
|
||||
|
||||
/*
|
||||
@@ -153,7 +156,9 @@ void *mpp_dec_hal_thread(void *data)
|
||||
MppDec *dec = mpp->mDec;
|
||||
mpp_list *frames = mpp->mFrames;
|
||||
HalTaskHnd task_hnd = NULL;
|
||||
|
||||
HalTask task_local;
|
||||
memset(&task_local, 0, sizeof(task_local));
|
||||
|
||||
while (MPP_THREAD_RUNNING == hal->get_status()) {
|
||||
/*
|
||||
|
@@ -28,7 +28,7 @@
|
||||
* number : the number of the data pointer array element
|
||||
* data : the address of the pointer array, parser will add its data here
|
||||
*/
|
||||
typedef struct {
|
||||
typedef struct MppSyntax_t {
|
||||
RK_U32 number;
|
||||
void *data;
|
||||
} MppSyntax;
|
||||
@@ -64,7 +64,7 @@ typedef struct {
|
||||
* | | |
|
||||
* +----------------------+ +----v----+
|
||||
*/
|
||||
typedef struct {
|
||||
typedef struct HalDecTask_t {
|
||||
// current tesk protocol syntax information
|
||||
MppSyntax syntax;
|
||||
|
||||
@@ -74,7 +74,7 @@ typedef struct {
|
||||
RK_S32 refer[MAX_DEC_REF_NUM];
|
||||
} HalDecTask;
|
||||
|
||||
typedef struct {
|
||||
typedef struct HalEncTask_t {
|
||||
// current tesk protocol syntax information
|
||||
MppSyntax syntax;
|
||||
|
||||
@@ -89,7 +89,7 @@ typedef struct {
|
||||
RK_S32 recon;
|
||||
} HalEncTask;
|
||||
|
||||
typedef union {
|
||||
typedef union HalTask_u {
|
||||
HalDecTask dec;
|
||||
HalEncTask enc;
|
||||
} HalTask;
|
||||
|
@@ -32,7 +32,7 @@ typedef struct MppHalCfg_t {
|
||||
RK_U32 task_count;
|
||||
} MppHalCfg;
|
||||
|
||||
typedef struct {
|
||||
typedef struct MppHalApi_t {
|
||||
char *name;
|
||||
MppCodingType coding;
|
||||
RK_U32 ctx_size;
|
||||
@@ -62,9 +62,13 @@ extern "C" {
|
||||
MPP_RET mpp_hal_init(MppHal *ctx, MppHalCfg *cfg);
|
||||
MPP_RET mpp_hal_deinit(MppHal ctx);
|
||||
|
||||
MPP_RET mpp_hal_reg_gen(MppHal ctx, HalDecTask *task);
|
||||
MPP_RET mpp_hal_hw_start(MppHal ctx, HalDecTask *task);
|
||||
MPP_RET mpp_hal_hw_wait(MppHal ctx, HalDecTask *task);
|
||||
MPP_RET mpp_hal_reg_gen(MppHal ctx, HalTask *task);
|
||||
MPP_RET mpp_hal_hw_start(MppHal ctx, HalTask *task);
|
||||
MPP_RET mpp_hal_hw_wait(MppHal ctx, HalTask *task);
|
||||
|
||||
MPP_RET mpp_hal_reset(MppHal ctx);
|
||||
MPP_RET mpp_hal_flush(MppHal ctx);
|
||||
MPP_RET mpp_hal_control(MppHal ctx, RK_S32 cmd, void *param);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@@ -33,7 +33,7 @@ static const MppHalApi *hw_apis[] = {
|
||||
&api_h264d_hal,
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
typedef struct MppHalImpl_t {
|
||||
MppCtxType type;
|
||||
MppCodingType coding;
|
||||
|
||||
@@ -107,25 +107,69 @@ MPP_RET mpp_hal_deinit(MppHal ctx)
|
||||
return MPP_OK;
|
||||
}
|
||||
|
||||
MPP_RET mpp_hal_reg_gen(MppHal ctx, HalDecTask *task)
|
||||
MPP_RET mpp_hal_reg_gen(MppHal ctx, HalTask *task)
|
||||
{
|
||||
(void)ctx;
|
||||
(void)task;
|
||||
return MPP_OK;
|
||||
if (NULL == ctx || NULL == task) {
|
||||
mpp_err_f("found NULL input ctx %p task %p\n", ctx, task);
|
||||
return MPP_ERR_NULL_PTR;
|
||||
}
|
||||
|
||||
MppHalImpl *p = (MppHalImpl*)ctx;
|
||||
return p->api->reg_gen(p->ctx, task);
|
||||
}
|
||||
|
||||
MPP_RET mpp_hal_hw_start(MppHal ctx, HalDecTask *task)
|
||||
MPP_RET mpp_hal_hw_start(MppHal ctx, HalTask *task)
|
||||
{
|
||||
(void)ctx;
|
||||
(void)task;
|
||||
return MPP_OK;
|
||||
if (NULL == ctx || NULL == task) {
|
||||
mpp_err_f("found NULL input ctx %p task %p\n", ctx, task);
|
||||
return MPP_ERR_NULL_PTR;
|
||||
}
|
||||
|
||||
MppHalImpl *p = (MppHalImpl*)ctx;
|
||||
return p->api->start(p->ctx, task);
|
||||
}
|
||||
|
||||
MPP_RET mpp_hal_hw_wait(MppHal ctx, HalDecTask *task)
|
||||
MPP_RET mpp_hal_hw_wait(MppHal ctx, HalTask *task)
|
||||
{
|
||||
(void)ctx;
|
||||
(void)task;
|
||||
return MPP_OK;
|
||||
if (NULL == ctx || NULL == task) {
|
||||
mpp_err_f("found NULL input ctx %p task %p\n", ctx, task);
|
||||
return MPP_ERR_NULL_PTR;
|
||||
}
|
||||
|
||||
MppHalImpl *p = (MppHalImpl*)ctx;
|
||||
return p->api->wait(p->ctx, task);
|
||||
}
|
||||
|
||||
MPP_RET mpp_hal_reset(MppHal ctx)
|
||||
{
|
||||
if (NULL == ctx) {
|
||||
mpp_err_f("found NULL input\n");
|
||||
return MPP_ERR_NULL_PTR;
|
||||
}
|
||||
|
||||
MppHalImpl *p = (MppHalImpl*)ctx;
|
||||
return p->api->reset(p->ctx);
|
||||
}
|
||||
|
||||
MPP_RET mpp_hal_flush(MppHal ctx)
|
||||
{
|
||||
if (NULL == ctx) {
|
||||
mpp_err_f("found NULL input\n");
|
||||
return MPP_ERR_NULL_PTR;
|
||||
}
|
||||
|
||||
MppHalImpl *p = (MppHalImpl*)ctx;
|
||||
return p->api->flush(p->ctx);
|
||||
}
|
||||
|
||||
MPP_RET mpp_hal_control(MppHal ctx, RK_S32 cmd, void *param)
|
||||
{
|
||||
if (NULL == ctx) {
|
||||
mpp_err_f("found NULL input\n");
|
||||
return MPP_ERR_NULL_PTR;
|
||||
}
|
||||
|
||||
MppHalImpl *p = (MppHalImpl*)ctx;
|
||||
return p->api->control(p->ctx, cmd, param);
|
||||
}
|
||||
|
||||
|
@@ -32,7 +32,7 @@
|
||||
* pts : packet pts
|
||||
* dts : packet dts
|
||||
*/
|
||||
typedef struct {
|
||||
typedef struct MppPacketImpl_t {
|
||||
void *data;
|
||||
void *pos;
|
||||
size_t size;
|
||||
|
@@ -22,7 +22,7 @@
|
||||
|
||||
typedef void *MppAllocator;
|
||||
|
||||
typedef struct {
|
||||
typedef struct MppAllocatorApi_t {
|
||||
RK_U32 size;
|
||||
RK_U32 version;
|
||||
|
||||
|
@@ -20,7 +20,7 @@
|
||||
#include "mpp_thread.h"
|
||||
#include "os_allocator.h"
|
||||
|
||||
typedef struct {
|
||||
typedef struct MppAllocatorImpl_t {
|
||||
pthread_mutex_t lock;
|
||||
MppBufferType type;
|
||||
size_t alignment;
|
||||
|
@@ -19,7 +19,7 @@
|
||||
|
||||
#include "mpp_allocator.h"
|
||||
|
||||
typedef struct {
|
||||
typedef struct os_allocator_t {
|
||||
MPP_RET (*open)(void **ctx, size_t alignment);
|
||||
MPP_RET (*alloc)(void *ctx, MppBufferInfo *info);
|
||||
MPP_RET (*free)(void *ctx, MppBufferInfo *info);
|
||||
|
Reference in New Issue
Block a user