mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-06 09:36:49 +08:00
[mpi]: add more mpi log
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@1041 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
@@ -25,6 +25,7 @@
|
|||||||
#define MPP_BUF_DBG_OPS_RUNTIME (0x00000002)
|
#define MPP_BUF_DBG_OPS_RUNTIME (0x00000002)
|
||||||
#define MPP_BUF_DBG_OPS_HISTORY (0x00000004)
|
#define MPP_BUF_DBG_OPS_HISTORY (0x00000004)
|
||||||
#define MPP_BUF_DBG_CLR_ON_EXIT (0x00000008)
|
#define MPP_BUF_DBG_CLR_ON_EXIT (0x00000008)
|
||||||
|
#define MPP_BUF_DBG_CHECK_SIZE (0x00000010)
|
||||||
|
|
||||||
#define mpp_buf_dbg(flag, fmt, ...) _mpp_dbg(mpp_buffer_debug, flag, fmt, ## __VA_ARGS__)
|
#define mpp_buf_dbg(flag, fmt, ...) _mpp_dbg(mpp_buffer_debug, flag, fmt, ## __VA_ARGS__)
|
||||||
#define mpp_buf_dbg_f(flag, fmt, ...) _mpp_dbg_f(mpp_buffer_debug, flag, fmt, ## __VA_ARGS__)
|
#define mpp_buf_dbg_f(flag, fmt, ...) _mpp_dbg_f(mpp_buffer_debug, flag, fmt, ## __VA_ARGS__)
|
||||||
|
@@ -370,7 +370,8 @@ MppBufferImpl *mpp_buffer_get_unused(MppBufferGroupImpl *p, size_t size)
|
|||||||
if (!list_empty(&p->list_unused)) {
|
if (!list_empty(&p->list_unused)) {
|
||||||
MppBufferImpl *pos, *n;
|
MppBufferImpl *pos, *n;
|
||||||
list_for_each_entry_safe(pos, n, &p->list_unused, MppBufferImpl, list_status) {
|
list_for_each_entry_safe(pos, n, &p->list_unused, MppBufferImpl, list_status) {
|
||||||
//mpp_log("[RKV_DEBUG]pos->info.size=%d, size=%d \n", pos->info.size, size);
|
mpp_buf_dbg(MPP_BUF_DBG_CHECK_SIZE, "request size %d on buf idx %d size %d\n",
|
||||||
|
size, pos->buffer_id, pos->info.size);
|
||||||
if (pos->info.size >= size) {
|
if (pos->info.size >= size) {
|
||||||
buffer = pos;
|
buffer = pos;
|
||||||
inc_buffer_ref_no_lock(buffer);
|
inc_buffer_ref_no_lock(buffer);
|
||||||
|
399
mpp/mpi.cpp
399
mpp/mpi.cpp
@@ -59,223 +59,279 @@ static MPP_RET _check_mpp_ctx(MpiImpl *p, const char *caller)
|
|||||||
|
|
||||||
static MPP_RET mpi_config(MppCtx ctx, MppEncConfig cfg)
|
static MPP_RET mpi_config(MppCtx ctx, MppEncConfig cfg)
|
||||||
{
|
{
|
||||||
(void)cfg;
|
MPP_RET ret = MPP_NOK;
|
||||||
|
|
||||||
MPI_FUNCTION_ENTER();
|
|
||||||
MpiImpl *p = (MpiImpl *)ctx;
|
MpiImpl *p = (MpiImpl *)ctx;
|
||||||
MPP_RET ret = check_mpp_ctx(p);
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
MPI_FUNCTION_LEAVE();
|
mpi_dbg_func("enter ctx %p cfg %p\n", ctx, cfg);
|
||||||
return MPP_OK;
|
do {
|
||||||
|
ret = check_mpp_ctx(p);
|
||||||
|
if (ret)
|
||||||
|
break;
|
||||||
|
|
||||||
|
// TODO: do config here
|
||||||
|
} while (0);
|
||||||
|
|
||||||
|
mpi_dbg_func("leave ret %d\n", ret);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static MPP_RET mpi_decode(MppCtx ctx, MppPacket packet, MppFrame *frame)
|
static MPP_RET mpi_decode(MppCtx ctx, MppPacket packet, MppFrame *frame)
|
||||||
{
|
{
|
||||||
(void)packet;
|
MPP_RET ret = MPP_NOK;
|
||||||
(void)frame;
|
|
||||||
|
|
||||||
MPI_FUNCTION_ENTER();
|
|
||||||
MpiImpl *p = (MpiImpl *)ctx;
|
MpiImpl *p = (MpiImpl *)ctx;
|
||||||
MPP_RET ret = check_mpp_ctx(p);
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
MPI_FUNCTION_LEAVE();
|
mpi_dbg_func("enter ctx %p packet %p frame %p\n", ctx, packet, frame);
|
||||||
return MPP_OK;
|
do {
|
||||||
|
ret = check_mpp_ctx(p);
|
||||||
|
if (ret)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (NULL == frame || NULL == packet) {
|
||||||
|
mpp_err_f("found NULL input packet %p frame %p\n", packet, frame);
|
||||||
|
ret = MPP_ERR_NULL_PTR;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// TODO: do decode here
|
||||||
|
} while (0);
|
||||||
|
|
||||||
|
mpi_dbg_func("leave ret %d\n", ret);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static MPP_RET mpi_decode_put_packet(MppCtx ctx, MppPacket packet)
|
static MPP_RET mpi_decode_put_packet(MppCtx ctx, MppPacket packet)
|
||||||
{
|
{
|
||||||
MPI_FUNCTION_ENTER();
|
MPP_RET ret = MPP_NOK;
|
||||||
|
|
||||||
MpiImpl *p = (MpiImpl *)ctx;
|
MpiImpl *p = (MpiImpl *)ctx;
|
||||||
MPP_RET ret = check_mpp_ctx(p);
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
if (NULL == packet) {
|
mpi_dbg_func("enter ctx %p packet %p\n", ctx, packet);
|
||||||
mpp_err_f("found NULL input packet\n", packet);
|
do {
|
||||||
return MPP_ERR_NULL_PTR;
|
ret = check_mpp_ctx(p);
|
||||||
}
|
if (ret)
|
||||||
|
break;
|
||||||
|
|
||||||
ret = p->ctx->put_packet(packet);
|
if (NULL == packet) {
|
||||||
|
mpp_err_f("found NULL input packet\n");
|
||||||
|
ret = MPP_ERR_NULL_PTR;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
MPI_FUNCTION_LEAVE();
|
ret = p->ctx->put_packet(packet);
|
||||||
|
} while (0);
|
||||||
|
|
||||||
|
mpi_dbg_func("leave ret %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static MPP_RET mpi_decode_get_frame(MppCtx ctx, MppFrame *frame)
|
static MPP_RET mpi_decode_get_frame(MppCtx ctx, MppFrame *frame)
|
||||||
{
|
{
|
||||||
MPI_FUNCTION_ENTER();
|
MPP_RET ret = MPP_NOK;
|
||||||
|
|
||||||
MpiImpl *p = (MpiImpl *)ctx;
|
MpiImpl *p = (MpiImpl *)ctx;
|
||||||
MPP_RET ret = check_mpp_ctx(p);
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
if (NULL == frame) {
|
mpi_dbg_func("enter ctx %p frame %p\n", ctx, frame);
|
||||||
mpp_err_f("found NULL input frame\n", frame);
|
do {
|
||||||
return MPP_ERR_NULL_PTR;
|
ret = check_mpp_ctx(p);
|
||||||
}
|
if (ret)
|
||||||
|
break;
|
||||||
|
|
||||||
ret = p->ctx->get_frame(frame);
|
if (NULL == frame) {
|
||||||
|
mpp_err_f("found NULL input frame\n");
|
||||||
|
ret = MPP_ERR_NULL_PTR;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
MPI_FUNCTION_LEAVE();
|
ret = p->ctx->get_frame(frame);
|
||||||
|
} while (0);
|
||||||
|
|
||||||
|
mpi_dbg_func("leave ret %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static MPP_RET mpi_encode(MppCtx ctx, MppFrame frame, MppPacket *packet)
|
static MPP_RET mpi_encode(MppCtx ctx, MppFrame frame, MppPacket *packet)
|
||||||
{
|
{
|
||||||
(void)packet;
|
MPP_RET ret = MPP_NOK;
|
||||||
(void)frame;
|
|
||||||
|
|
||||||
MPI_FUNCTION_ENTER();
|
|
||||||
MpiImpl *p = (MpiImpl *)ctx;
|
MpiImpl *p = (MpiImpl *)ctx;
|
||||||
MPP_RET ret = check_mpp_ctx(p);
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
MPI_FUNCTION_LEAVE();
|
mpi_dbg_func("enter ctx %p frame %p packet %p\n", ctx, frame, packet);
|
||||||
return MPP_OK;
|
do {
|
||||||
|
ret = check_mpp_ctx(p);
|
||||||
|
if (ret)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (NULL == frame || NULL == packet) {
|
||||||
|
mpp_err_f("found NULL input frame %p packet %p\n", frame, packet);
|
||||||
|
ret = MPP_ERR_NULL_PTR;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: do encode here
|
||||||
|
} while (0);
|
||||||
|
|
||||||
|
mpi_dbg_func("leave ret %d\n", ret);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static MPP_RET mpi_encode_put_frame(MppCtx ctx, MppFrame frame)
|
static MPP_RET mpi_encode_put_frame(MppCtx ctx, MppFrame frame)
|
||||||
{
|
{
|
||||||
MPI_FUNCTION_ENTER();
|
MPP_RET ret = MPP_NOK;
|
||||||
|
|
||||||
MpiImpl *p = (MpiImpl *)ctx;
|
MpiImpl *p = (MpiImpl *)ctx;
|
||||||
MPP_RET ret = check_mpp_ctx(p);
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
if (NULL == frame) {
|
mpi_dbg_func("enter ctx %p frame %p\n", ctx, frame);
|
||||||
mpp_err_f("found NULL input frame\n", frame);
|
do {
|
||||||
return MPP_ERR_NULL_PTR;
|
ret = check_mpp_ctx(p);
|
||||||
}
|
if (ret)
|
||||||
|
break;
|
||||||
|
|
||||||
ret = p->ctx->put_frame(frame);
|
if (NULL == frame) {
|
||||||
|
mpp_err_f("found NULL input frame\n");
|
||||||
|
ret = MPP_ERR_NULL_PTR;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
MPI_FUNCTION_LEAVE();
|
ret = p->ctx->put_frame(frame);
|
||||||
|
} while (0);
|
||||||
|
|
||||||
|
mpi_dbg_func("leave ret %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static MPP_RET mpi_encode_get_packet(MppCtx ctx, MppPacket *packet)
|
static MPP_RET mpi_encode_get_packet(MppCtx ctx, MppPacket *packet)
|
||||||
{
|
{
|
||||||
MPI_FUNCTION_ENTER();
|
MPP_RET ret = MPP_NOK;
|
||||||
|
|
||||||
MpiImpl *p = (MpiImpl *)ctx;
|
MpiImpl *p = (MpiImpl *)ctx;
|
||||||
MPP_RET ret = check_mpp_ctx(p);
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
if (NULL == packet) {
|
mpi_dbg_func("enter ctx %p packet %p\n", ctx, packet);
|
||||||
mpp_err_f("found NULL input packet\n", packet);
|
do {
|
||||||
return MPP_ERR_NULL_PTR;
|
ret = check_mpp_ctx(p);
|
||||||
}
|
if (ret)
|
||||||
|
break;
|
||||||
|
|
||||||
ret = p->ctx->get_packet(packet);
|
if (NULL == packet) {
|
||||||
|
mpp_err_f("found NULL input packet\n");
|
||||||
|
ret = MPP_ERR_NULL_PTR;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
MPI_FUNCTION_LEAVE();
|
ret = p->ctx->get_packet(packet);
|
||||||
|
} while (0);
|
||||||
|
|
||||||
|
mpi_dbg_func("leave ret %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static MPP_RET mpi_isp(MppCtx ctx, MppFrame dst, MppFrame src)
|
static MPP_RET mpi_isp(MppCtx ctx, MppFrame dst, MppFrame src)
|
||||||
{
|
{
|
||||||
MPI_FUNCTION_ENTER();
|
MPP_RET ret = MPP_OK;
|
||||||
(void)ctx;
|
mpi_dbg_func("enter ctx %p dst %p src %p\n", ctx, dst, src);
|
||||||
(void)dst;
|
|
||||||
(void)src;
|
// TODO: do isp process here
|
||||||
MPI_FUNCTION_LEAVE();
|
|
||||||
|
mpi_dbg_func("leave ret %d\n", ret);
|
||||||
return MPP_OK;
|
return MPP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static MPP_RET mpi_isp_put_frame(MppCtx ctx, MppFrame frame)
|
static MPP_RET mpi_isp_put_frame(MppCtx ctx, MppFrame frame)
|
||||||
{
|
{
|
||||||
MPI_FUNCTION_ENTER();
|
MPP_RET ret = MPP_OK;
|
||||||
(void)ctx;
|
mpi_dbg_func("enter ctx %p frame %p\n", ctx, frame);
|
||||||
(void)frame;
|
|
||||||
MPI_FUNCTION_LEAVE();
|
// TODO: do isp put frame process here
|
||||||
return MPP_OK;
|
|
||||||
|
mpi_dbg_func("leave ret %d\n", ret);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static MPP_RET mpi_isp_get_frame(MppCtx ctx, MppFrame *frame)
|
static MPP_RET mpi_isp_get_frame(MppCtx ctx, MppFrame *frame)
|
||||||
{
|
{
|
||||||
MPI_FUNCTION_ENTER();
|
MPP_RET ret = MPP_OK;
|
||||||
(void)ctx;
|
mpi_dbg_func("enter ctx %p frame %p\n", ctx, frame);
|
||||||
(void)frame;
|
|
||||||
MPI_FUNCTION_LEAVE();
|
// TODO: do isp get frame process here
|
||||||
return MPP_OK;
|
|
||||||
|
mpi_dbg_func("leave ret %d\n", ret);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static MPP_RET mpi_dequeue(MppCtx ctx, MppPortType type, MppTask *task)
|
static MPP_RET mpi_dequeue(MppCtx ctx, MppPortType type, MppTask *task)
|
||||||
{
|
{
|
||||||
MPI_FUNCTION_ENTER();
|
MPP_RET ret = MPP_NOK;
|
||||||
|
|
||||||
MpiImpl *p = (MpiImpl *)ctx;
|
MpiImpl *p = (MpiImpl *)ctx;
|
||||||
MPP_RET ret = check_mpp_ctx(p);
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
if (type >= MPP_PORT_BUTT || NULL == task) {
|
mpi_dbg_func("enter ctx %p type task %p\n", ctx, type, task);
|
||||||
mpp_err_f("invalid input type %d task %p\n", type, task);
|
do {
|
||||||
return MPP_ERR_UNKNOW;
|
ret = check_mpp_ctx(p);
|
||||||
}
|
if (ret)
|
||||||
|
break;;
|
||||||
|
|
||||||
ret = p->ctx->dequeue(type, task);
|
if (type >= MPP_PORT_BUTT || NULL == task) {
|
||||||
|
mpp_err_f("invalid input type %d task %p\n", type, task);
|
||||||
|
ret = MPP_ERR_UNKNOW;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
MPI_FUNCTION_LEAVE();
|
ret = p->ctx->dequeue(type, task);
|
||||||
|
} while (0);
|
||||||
|
|
||||||
|
mpi_dbg_func("leave ret %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static MPP_RET mpi_enqueue(MppCtx ctx, MppPortType type, MppTask task)
|
static MPP_RET mpi_enqueue(MppCtx ctx, MppPortType type, MppTask task)
|
||||||
{
|
{
|
||||||
MPI_FUNCTION_ENTER();
|
MPP_RET ret = MPP_NOK;
|
||||||
|
|
||||||
MpiImpl *p = (MpiImpl *)ctx;
|
MpiImpl *p = (MpiImpl *)ctx;
|
||||||
MPP_RET ret = check_mpp_ctx(p);
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
if (type >= MPP_PORT_BUTT || NULL == task) {
|
mpi_dbg_func("enter ctx %p type task %p\n", ctx, type, task);
|
||||||
mpp_err_f("invalid input type %d task %p\n", type, task);
|
do {
|
||||||
return MPP_ERR_UNKNOW;
|
ret = check_mpp_ctx(p);
|
||||||
}
|
if (ret)
|
||||||
|
break;;
|
||||||
|
|
||||||
ret = p->ctx->enqueue(type, task);
|
if (type >= MPP_PORT_BUTT || NULL == task) {
|
||||||
|
mpp_err_f("invalid input type %d task %p\n", type, task);
|
||||||
|
ret = MPP_ERR_UNKNOW;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
MPI_FUNCTION_LEAVE();
|
ret = p->ctx->enqueue(type, task);
|
||||||
|
} while (0);
|
||||||
|
|
||||||
|
mpi_dbg_func("leave ret %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static MPP_RET mpi_reset(MppCtx ctx)
|
static MPP_RET mpi_reset(MppCtx ctx)
|
||||||
{
|
{
|
||||||
MPI_FUNCTION_ENTER();
|
MPP_RET ret = MPP_NOK;
|
||||||
|
|
||||||
MpiImpl *p = (MpiImpl *)ctx;
|
MpiImpl *p = (MpiImpl *)ctx;
|
||||||
MPP_RET ret = check_mpp_ctx(p);
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
ret = p->ctx->reset();
|
mpi_dbg_func("enter ctx %p\n", ctx);
|
||||||
|
do {
|
||||||
|
ret = check_mpp_ctx(p);
|
||||||
|
if (ret)
|
||||||
|
break;;
|
||||||
|
|
||||||
MPI_FUNCTION_LEAVE();
|
ret = p->ctx->reset();
|
||||||
|
} while (0);
|
||||||
|
|
||||||
|
mpi_dbg_func("leave ret %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static MPP_RET mpi_control(MppCtx ctx, MpiCmd cmd, MppParam param)
|
static MPP_RET mpi_control(MppCtx ctx, MpiCmd cmd, MppParam param)
|
||||||
{
|
{
|
||||||
MPI_FUNCTION_ENTER();
|
MPP_RET ret = MPP_NOK;
|
||||||
|
|
||||||
MpiImpl *p = (MpiImpl *)ctx;
|
MpiImpl *p = (MpiImpl *)ctx;
|
||||||
MPP_RET ret = check_mpp_ctx(p);
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
ret = p->ctx->control(cmd, param);
|
mpi_dbg_func("enter ctx %p cmd %x parm %p\n", ctx, cmd, param);
|
||||||
|
do {
|
||||||
|
ret = check_mpp_ctx(p);
|
||||||
|
if (ret)
|
||||||
|
break;;
|
||||||
|
|
||||||
MPI_FUNCTION_LEAVE();
|
ret = p->ctx->control(cmd, param);
|
||||||
|
} while (0);
|
||||||
|
|
||||||
|
mpi_dbg_func("leave ret %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -301,82 +357,95 @@ static MppApi mpp_api = {
|
|||||||
|
|
||||||
MPP_RET mpp_create(MppCtx *ctx, MppApi **mpi)
|
MPP_RET mpp_create(MppCtx *ctx, MppApi **mpi)
|
||||||
{
|
{
|
||||||
MPI_FUNCTION_ENTER();
|
|
||||||
|
|
||||||
if (NULL == ctx || NULL == mpi) {
|
if (NULL == ctx || NULL == mpi) {
|
||||||
mpp_err_f("invalid input ctx %p mpi %p\n", ctx, mpi);
|
mpp_err_f("invalid input ctx %p mpi %p\n", ctx, mpi);
|
||||||
return MPP_ERR_NULL_PTR;
|
return MPP_ERR_NULL_PTR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
*ctx = NULL;
|
*ctx = NULL;
|
||||||
*mpi = NULL;
|
*mpi = NULL;
|
||||||
|
|
||||||
MpiImpl *p = mpp_malloc(MpiImpl, 1);
|
MPP_RET ret = MPP_OK;
|
||||||
if (NULL == p) {
|
mpi_dbg_func("enter ctx %p mpi %p\n", ctx, mpi);
|
||||||
mpp_err_f("failed to allocate context\n");
|
do {
|
||||||
return MPP_ERR_MALLOC;
|
MpiImpl *p = mpp_malloc(MpiImpl, 1);
|
||||||
}
|
if (NULL == p) {
|
||||||
|
mpp_err_f("failed to allocate context\n");
|
||||||
|
ret = MPP_ERR_MALLOC;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
memset(p, 0, sizeof(*p));
|
memset(p, 0, sizeof(*p));
|
||||||
p->ctx = new Mpp();
|
p->ctx = new Mpp();
|
||||||
if (NULL == p->ctx) {
|
if (NULL == p->ctx) {
|
||||||
mpp_free(p);
|
mpp_free(p);
|
||||||
mpp_err_f("failed to new Mpp\n");
|
mpp_err_f("failed to new Mpp\n");
|
||||||
return MPP_ERR_MALLOC;
|
ret = MPP_ERR_MALLOC;
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
mpp_api.version = mpp_info_get_revision();
|
mpp_api.version = mpp_info_get_revision();
|
||||||
p->api = &mpp_api;
|
p->api = &mpp_api;
|
||||||
p->check = p;
|
p->check = p;
|
||||||
*ctx = p;
|
*ctx = p;
|
||||||
*mpi = p->api;
|
*mpi = p->api;
|
||||||
|
} while (0);
|
||||||
|
|
||||||
mpp_log("mpp version: %d\n", mpp_api.version);
|
mpp_log("mpp version: %d\n", mpp_api.version);
|
||||||
|
|
||||||
MPI_FUNCTION_LEAVE_OK();
|
mpi_dbg_func("leave ret %d ctx %p mpi %p\n", ret, *ctx, *mpi);
|
||||||
return MPP_OK;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
MPP_RET mpp_init(MppCtx ctx, MppCtxType type, MppCodingType coding)
|
MPP_RET mpp_init(MppCtx ctx, MppCtxType type, MppCodingType coding)
|
||||||
{
|
{
|
||||||
MPI_FUNCTION_ENTER();
|
MPP_RET ret = MPP_OK;
|
||||||
|
|
||||||
MpiImpl *p = (MpiImpl*)ctx;
|
MpiImpl *p = (MpiImpl*)ctx;
|
||||||
MPP_RET ret = check_mpp_ctx(p);
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
if (type >= MPP_CTX_BUTT ||
|
mpi_dbg_func("enter ctx %p type %d coding %d\n", ctx, type, coding);
|
||||||
coding >= MPP_VIDEO_CodingMax) {
|
do {
|
||||||
mpp_err_f("invalid input type %d coding %d\n", type, coding);
|
ret = check_mpp_ctx(p);
|
||||||
return MPP_ERR_UNKNOW;
|
if (ret)
|
||||||
}
|
break;
|
||||||
|
|
||||||
ret = p->ctx->init(type, coding);
|
if (type >= MPP_CTX_BUTT ||
|
||||||
p->type = type;
|
coding >= MPP_VIDEO_CodingMax) {
|
||||||
p->coding = coding;
|
mpp_err_f("invalid input type %d coding %d\n", type, coding);
|
||||||
|
ret = MPP_ERR_UNKNOW;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = p->ctx->init(type, coding);
|
||||||
|
p->type = type;
|
||||||
|
p->coding = coding;
|
||||||
|
} while (0);
|
||||||
|
|
||||||
get_mpi_debug();
|
get_mpi_debug();
|
||||||
MPI_FUNCTION_LEAVE_OK();
|
mpi_dbg_func("leave ret %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
MPP_RET mpp_destroy(MppCtx ctx)
|
MPP_RET mpp_destroy(MppCtx ctx)
|
||||||
{
|
{
|
||||||
MPI_FUNCTION_ENTER();
|
mpi_dbg_func("enter ctx %p\n", ctx);
|
||||||
|
|
||||||
|
MPP_RET ret = MPP_OK;
|
||||||
MpiImpl *p = (MpiImpl*)ctx;
|
MpiImpl *p = (MpiImpl*)ctx;
|
||||||
MPP_RET ret = check_mpp_ctx(p);
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
if (p->ctx)
|
do {
|
||||||
delete p->ctx;
|
ret = check_mpp_ctx(p);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
mpp_free(p);
|
if (p->ctx)
|
||||||
|
delete p->ctx;
|
||||||
|
|
||||||
MPI_FUNCTION_LEAVE();
|
mpp_free(p);
|
||||||
return MPP_OK;
|
} while (0);
|
||||||
|
|
||||||
|
mpi_dbg_func("leave ret %d\n", ret);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
MPP_RET mpp_check_support_format(MppCtxType type, MppCodingType coding)
|
MPP_RET mpp_check_support_format(MppCtxType type, MppCodingType coding)
|
||||||
|
@@ -27,10 +27,7 @@
|
|||||||
#define mpi_dbg(flag, fmt, ...) _mpp_dbg(mpi_debug, flag, fmt, ## __VA_ARGS__)
|
#define mpi_dbg(flag, fmt, ...) _mpp_dbg(mpi_debug, flag, fmt, ## __VA_ARGS__)
|
||||||
#define mpi_dbg_f(flag, fmt, ...) _mpp_dbg_f(mpi_debug, flag, fmt, ## __VA_ARGS__)
|
#define mpi_dbg_f(flag, fmt, ...) _mpp_dbg_f(mpi_debug, flag, fmt, ## __VA_ARGS__)
|
||||||
|
|
||||||
#define MPI_FUNCTION_ENTER() mpi_dbg_f(MPI_DBG_FUNCTION, "enter\n")
|
#define mpi_dbg_func(fmt, ...) mpi_dbg_f(MPI_DBG_FUNCTION, fmt, ## __VA_ARGS__)
|
||||||
#define MPI_FUNCTION_LEAVE() mpi_dbg_f(MPI_DBG_FUNCTION, "leave\n")
|
|
||||||
#define MPI_FUNCTION_LEAVE_OK() mpi_dbg_f(MPI_DBG_FUNCTION, "success\n")
|
|
||||||
#define MPI_FUNCTION_LEAVE_FAIL() mpi_dbg_f(MPI_DBG_FUNCTION, "failed\n")
|
|
||||||
|
|
||||||
typedef struct MpiImpl_t MpiImpl;
|
typedef struct MpiImpl_t MpiImpl;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user