[mpp_enc]: add basic mpp_enc function

git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@405 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
ChenHengming
2015-10-20 22:37:23 +00:00
parent f6caca5e61
commit 4dc165b0cb
4 changed files with 50 additions and 5 deletions

View File

@@ -17,7 +17,13 @@
#ifndef __MPP_ENC_H__
#define __MPP_ENC_H__
#include "rk_type.h"
#include "rk_mpi.h"
typedef struct MppEnc_t MppEnc;
struct MppEnc_t {
MppCodingType coding;
};
#ifdef __cplusplus
extern "C" {
@@ -29,6 +35,12 @@ extern "C" {
void *mpp_enc_control_thread(void *data);
void *mpp_enc_hal_thread(void *data);
MPP_RET mpp_enc_init(MppEnc **enc, MppCodingType coding);
MPP_RET mpp_enc_deinit(MppEnc *enc);
MPP_RET mpp_enc_reset(MppEnc *enc);
#ifdef __cplusplus
}
#endif

View File

@@ -114,3 +114,35 @@ void *mpp_enc_hal_thread(void *data)
return NULL;
}
MPP_RET mpp_enc_init(MppEnc **enc, MppCodingType coding)
{
MppEnc *p = mpp_calloc(MppEnc, 1);
if (NULL == p) {
mpp_err_f("failed to malloc context\n");
return MPP_ERR_NULL_PTR;
}
p->coding = coding;
*enc = p;
return MPP_OK;
}
MPP_RET mpp_enc_deinit(MppEnc *enc)
{
if (NULL == enc) {
mpp_err_f("found NULL input\n");
return MPP_ERR_NULL_PTR;
}
mpp_free(enc);
return MPP_OK;
}
MPP_RET mpp_enc_reset(MppEnc *enc)
{
(void)enc;
return MPP_OK;
}

View File

@@ -77,7 +77,7 @@ Mpp::Mpp(MppCtxType type, MppCodingType coding)
mPackets = new mpp_list((node_destructor)mpp_packet_deinit);
mTasks = new mpp_list((node_destructor)NULL);
mpp_dec_init(&mEnc, coding);
mpp_enc_init(&mEnc, coding);
mThreadCodec = new MppThread(mpp_enc_control_thread, this);
mThreadHal = new MppThread(mpp_enc_hal_thread, this);
@@ -130,7 +130,7 @@ void Mpp::clear()
mDec = NULL;
}
else {
mpp_dec_deinit(mEnc);
mpp_enc_deinit(mEnc);
mEnc = NULL;
}
}
@@ -286,7 +286,7 @@ MPP_RET Mpp::reset()
mThreadCodec->signal();
mThreadCodec->reset_wait();
} else {
mpp_dec_reset(mEnc);
mpp_enc_reset(mEnc);
}
mThreadCodec->reset_unlock();

View File

@@ -19,6 +19,7 @@
#include "mpp_list.h"
#include "mpp_dec.h"
#include "mpp_enc.h"
#define MPP_DBG_FUNCTION (0x00000001)
#define MPP_DBG_PACKET (0x00000002)
@@ -107,7 +108,7 @@ public:
RK_U32 mStatus;
MppDec *mDec;
MppDec *mEnc;
MppEnc *mEnc;
private:
void clear();