mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-24 09:33:07 +08:00
[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:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user