[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:
ChenHengming
2008-01-29 23:03:13 +00:00
parent 34779b7d74
commit 3adfc995bd
12 changed files with 90 additions and 37 deletions

View File

@@ -170,7 +170,7 @@ typedef enum {
* *
* TODO: to be implemented. * TODO: to be implemented.
*/ */
typedef struct { typedef struct MppBufferInfo_t {
MppBufferType type; MppBufferType type;
size_t size; size_t size;
void *ptr; void *ptr;

View File

@@ -93,7 +93,7 @@ typedef void* MppParam;
* send a stream header to mpi ctx using parameter data / size * send a stream header to mpi ctx using parameter data / size
* and decoder will try to decode the * and decoder will try to decode the
*/ */
typedef struct { typedef struct MppEncConfig_t {
/* /*
* input source data format * input source data format
*/ */
@@ -136,7 +136,7 @@ typedef struct {
RK_S32 trans8x8_en; RK_S32 trans8x8_en;
} MppEncConfig; } MppEncConfig;
typedef struct { typedef struct MppApi_t {
RK_U32 size; RK_U32 size;
RK_U32 version; RK_U32 version;

View File

@@ -28,7 +28,7 @@
* *
* the reset wait for extension * the reset wait for extension
*/ */
typedef struct { typedef struct MppParserInitCfg_t {
MppBufSlots slots; MppBufSlots slots;
} MppParserInitCfg; } MppParserInitCfg;
@@ -50,7 +50,7 @@ typedef struct MppDec_t MppDec;
* flush - decoder output all frames * flush - decoder output all frames
* control - decoder configure function * control - decoder configure function
*/ */
typedef struct { typedef struct MppDecParser_t {
char *name; char *name;
MppCodingType coding; MppCodingType coding;
RK_U32 ctx_size; RK_U32 ctx_size;

View File

@@ -30,12 +30,12 @@
#define MPP_SLOT_USED_AS_DECODING (0x00000004) #define MPP_SLOT_USED_AS_DECODING (0x00000004)
#define MPP_SLOT_USED_AS_DISPLAY (0x00000008) #define MPP_SLOT_USED_AS_DISPLAY (0x00000008)
typedef struct { typedef struct MppBufSlotEntry_t {
MppBuffer buffer; MppBuffer buffer;
RK_U32 status; RK_U32 status;
} MppBufSlotEntry; } MppBufSlotEntry;
typedef struct { typedef struct MppBufSlotsImpl_t {
Mutex *lock; Mutex *lock;
RK_U32 count; RK_U32 count;
RK_U32 size; RK_U32 size;

View File

@@ -16,15 +16,15 @@
#define MODULE_TAG "mpp_dec" #define MODULE_TAG "mpp_dec"
#include <string.h>
#include "mpp_mem.h" #include "mpp_mem.h"
#include "mpp_log.h" #include "mpp_log.h"
#include "mpp_common.h" #include "mpp_common.h"
#include "mpp.h" #include "mpp.h"
#include "mpp_dec.h" #include "mpp_dec.h"
#include "mpp_packet.h"
#include "mpp_packet_impl.h" #include "mpp_packet_impl.h"
#include "mpp_buf_slot.h"
#include "h264d_api.h" #include "h264d_api.h"
#include "h265d_api.h" #include "h265d_api.h"
@@ -51,13 +51,15 @@ void *mpp_dec_parser_thread(void *data)
MppDec *dec = mpp->mDec; MppDec *dec = mpp->mDec;
mpp_list *packets = mpp->mPackets; mpp_list *packets = mpp->mPackets;
MppPacketImpl packet; MppPacketImpl packet;
HalTask task_local;
HalTaskHnd task_hnd = NULL; HalTaskHnd task_hnd = NULL;
RK_U32 packet_ready = 0; RK_U32 packet_ready = 0;
RK_U32 packet_parsed = 0; RK_U32 packet_parsed = 0;
RK_U32 syntax_ready = 0; RK_U32 syntax_ready = 0;
RK_U32 slot_ready = 0; RK_U32 slot_ready = 0;
HalTask task_local;
memset(&task_local, 0, sizeof(task_local));
while (MPP_THREAD_RUNNING == parser->get_status()) { while (MPP_THREAD_RUNNING == parser->get_status()) {
/* /*
* wait for stream input * wait for stream input
@@ -121,8 +123,9 @@ void *mpp_dec_parser_thread(void *data)
* frame to hal loop. * frame to hal loop.
*/ */
//MppBuffer buffer; // RK_S32 output = task_local.dec.output;
//mpp_buffer_get(mpp->mFrameGroup, &buffer, MPP_TEST_FRAME_SIZE); // 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; MppDec *dec = mpp->mDec;
mpp_list *frames = mpp->mFrames; mpp_list *frames = mpp->mFrames;
HalTaskHnd task_hnd = NULL; HalTaskHnd task_hnd = NULL;
HalTask task_local; HalTask task_local;
memset(&task_local, 0, sizeof(task_local));
while (MPP_THREAD_RUNNING == hal->get_status()) { while (MPP_THREAD_RUNNING == hal->get_status()) {
/* /*

View File

@@ -28,7 +28,7 @@
* number : the number of the data pointer array element * number : the number of the data pointer array element
* data : the address of the pointer array, parser will add its data here * data : the address of the pointer array, parser will add its data here
*/ */
typedef struct { typedef struct MppSyntax_t {
RK_U32 number; RK_U32 number;
void *data; void *data;
} MppSyntax; } MppSyntax;
@@ -64,7 +64,7 @@ typedef struct {
* | | | * | | |
* +----------------------+ +----v----+ * +----------------------+ +----v----+
*/ */
typedef struct { typedef struct HalDecTask_t {
// current tesk protocol syntax information // current tesk protocol syntax information
MppSyntax syntax; MppSyntax syntax;
@@ -74,7 +74,7 @@ typedef struct {
RK_S32 refer[MAX_DEC_REF_NUM]; RK_S32 refer[MAX_DEC_REF_NUM];
} HalDecTask; } HalDecTask;
typedef struct { typedef struct HalEncTask_t {
// current tesk protocol syntax information // current tesk protocol syntax information
MppSyntax syntax; MppSyntax syntax;
@@ -89,7 +89,7 @@ typedef struct {
RK_S32 recon; RK_S32 recon;
} HalEncTask; } HalEncTask;
typedef union { typedef union HalTask_u {
HalDecTask dec; HalDecTask dec;
HalEncTask enc; HalEncTask enc;
} HalTask; } HalTask;

View File

@@ -32,7 +32,7 @@ typedef struct MppHalCfg_t {
RK_U32 task_count; RK_U32 task_count;
} MppHalCfg; } MppHalCfg;
typedef struct { typedef struct MppHalApi_t {
char *name; char *name;
MppCodingType coding; MppCodingType coding;
RK_U32 ctx_size; RK_U32 ctx_size;
@@ -62,9 +62,13 @@ extern "C" {
MPP_RET mpp_hal_init(MppHal *ctx, MppHalCfg *cfg); MPP_RET mpp_hal_init(MppHal *ctx, MppHalCfg *cfg);
MPP_RET mpp_hal_deinit(MppHal ctx); MPP_RET mpp_hal_deinit(MppHal ctx);
MPP_RET mpp_hal_reg_gen(MppHal ctx, HalDecTask *task); MPP_RET mpp_hal_reg_gen(MppHal ctx, HalTask *task);
MPP_RET mpp_hal_hw_start(MppHal ctx, HalDecTask *task); MPP_RET mpp_hal_hw_start(MppHal ctx, HalTask *task);
MPP_RET mpp_hal_hw_wait(MppHal ctx, HalDecTask *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 #ifdef __cplusplus
} }

View File

@@ -33,7 +33,7 @@ static const MppHalApi *hw_apis[] = {
&api_h264d_hal, &api_h264d_hal,
}; };
typedef struct { typedef struct MppHalImpl_t {
MppCtxType type; MppCtxType type;
MppCodingType coding; MppCodingType coding;
@@ -107,25 +107,69 @@ MPP_RET mpp_hal_deinit(MppHal ctx)
return MPP_OK; 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; if (NULL == ctx || NULL == task) {
(void)task; mpp_err_f("found NULL input ctx %p task %p\n", ctx, task);
return MPP_OK; 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; if (NULL == ctx || NULL == task) {
(void)task; mpp_err_f("found NULL input ctx %p task %p\n", ctx, task);
return MPP_OK; 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; if (NULL == ctx || NULL == task) {
(void)task; mpp_err_f("found NULL input ctx %p task %p\n", ctx, task);
return MPP_OK; 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);
}

View File

@@ -32,7 +32,7 @@
* pts : packet pts * pts : packet pts
* dts : packet dts * dts : packet dts
*/ */
typedef struct { typedef struct MppPacketImpl_t {
void *data; void *data;
void *pos; void *pos;
size_t size; size_t size;

View File

@@ -22,7 +22,7 @@
typedef void *MppAllocator; typedef void *MppAllocator;
typedef struct { typedef struct MppAllocatorApi_t {
RK_U32 size; RK_U32 size;
RK_U32 version; RK_U32 version;

View File

@@ -20,7 +20,7 @@
#include "mpp_thread.h" #include "mpp_thread.h"
#include "os_allocator.h" #include "os_allocator.h"
typedef struct { typedef struct MppAllocatorImpl_t {
pthread_mutex_t lock; pthread_mutex_t lock;
MppBufferType type; MppBufferType type;
size_t alignment; size_t alignment;

View File

@@ -19,7 +19,7 @@
#include "mpp_allocator.h" #include "mpp_allocator.h"
typedef struct { typedef struct os_allocator_t {
MPP_RET (*open)(void **ctx, size_t alignment); MPP_RET (*open)(void **ctx, size_t alignment);
MPP_RET (*alloc)(void *ctx, MppBufferInfo *info); MPP_RET (*alloc)(void *ctx, MppBufferInfo *info);
MPP_RET (*free)(void *ctx, MppBufferInfo *info); MPP_RET (*free)(void *ctx, MppBufferInfo *info);