mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-06 01:26:49 +08:00
[mpp/osal]: add codec thread and hal thread
1. add MppThread / Mutex / Condition class 2. add internal flag to MppBuffer 3. change MppBufferService from structure to class 4. add mpp_buffer_put on mpp_frame_put 5. add coding type to Mpp initial function 6. mpp codec / hal thread basic flow done, but reset is not added git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@168 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
@@ -30,19 +30,6 @@ MppThread::MppThread(MppThreadFunc func, void *ctx)
|
||||
mFunction(func),
|
||||
mContext(ctx)
|
||||
{
|
||||
pthread_mutexattr_t attr;
|
||||
pthread_mutexattr_init(&attr);
|
||||
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
|
||||
pthread_mutex_init(&mLock, &attr);
|
||||
pthread_mutexattr_destroy(&attr);
|
||||
|
||||
pthread_cond_init(&mCondition, NULL);
|
||||
}
|
||||
|
||||
MppThread::~MppThread()
|
||||
{
|
||||
pthread_cond_destroy(&mCondition);
|
||||
pthread_mutex_destroy(&mLock);
|
||||
}
|
||||
|
||||
MppThreadStatus MppThread::get_status()
|
||||
@@ -75,6 +62,8 @@ void MppThread::start()
|
||||
void MppThread::stop()
|
||||
{
|
||||
mStatus = MPP_THREAD_STOPPING;
|
||||
signal();
|
||||
|
||||
void *dummy;
|
||||
pthread_join(mThread, &dummy);
|
||||
thread_dbg(MPP_THREAD_DBG_FUNCTION, "mThread %p mContext %p destroy success\n",
|
||||
@@ -83,23 +72,3 @@ void MppThread::stop()
|
||||
mStatus = MPP_THREAD_UNINITED;
|
||||
}
|
||||
|
||||
void MppThread::lock()
|
||||
{
|
||||
pthread_mutex_lock(&mLock);
|
||||
}
|
||||
|
||||
void MppThread::unlock()
|
||||
{
|
||||
pthread_mutex_unlock(&mLock);
|
||||
}
|
||||
|
||||
void MppThread::wait()
|
||||
{
|
||||
pthread_cond_wait(&mCondition, &mLock);
|
||||
}
|
||||
|
||||
void MppThread::signal()
|
||||
{
|
||||
pthread_cond_signal(&mCondition);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user