コード例 #1
0
void TheoraWorkerThread::executeThread()
{
	mThreadRunning = true;
	while (mThreadRunning)
	{
		mClip=TheoraVideoManager::getSingleton().requestWork(this);
		if (!mClip)
		{
			_psleep(250);
			continue;
		}


		// if user requested seeking, do that then.
		if (mClip->mSeekPos >= 0) mClip->doSeek();

		mClip->decodeNextFrame();

		mClip->mAssignedWorkerThread=0;
		mClip=0;
		_psleep(1);
	}
}
コード例 #2
0
ファイル: TheoraWorkerThread.cpp プロジェクト: 3miu/godot
void TheoraWorkerThread::execute()
{
	while (isRunning())
	{
		mClip = TheoraVideoManager::getSingleton().requestWork(this);
		if (!mClip)
		{
			_psleep(100);
			continue;
		}

		mClip->mThreadAccessMutex->lock();
		// if user requested seeking, do that then.
		if (mClip->mSeekFrame >= 0) mClip->doSeek();

		if (!mClip->decodeNextFrame())
			_psleep(1); // this happens when the video frame queue is full.

		mClip->mAssignedWorkerThread = NULL;
		mClip->mThreadAccessMutex->unlock();
		mClip = NULL;
	}
}
コード例 #3
0
ファイル: TheoraVideoManager.cpp プロジェクト: aurodev/godot
void TheoraVideoManager::destroyVideoClip(TheoraVideoClip* clip)
{
    if (clip)
    {
        th_writelog("Destroying video clip: " + clip->getName());
        mWorkMutex->lock();
        bool reported = 0;
        while (clip->mAssignedWorkerThread)
        {
            if (!reported)
            {
                th_writelog(" - Waiting for WorkerThread to finish decoding in order to destroy");
                reported = 1;
            }
            _psleep(1);
        }
        if (reported) th_writelog(" - WorkerThread done, destroying...");

        // erase the clip from the clip list
        foreach (TheoraVideoClip*, mClips)
        {
            if ((*it) == clip)
            {
                mClips.erase(it);
                break;
            }
        }
        // remove all it's references from the work log
        mWorkLog.remove(clip);

        // delete the actual clip
        delete clip;
#ifdef _DEBUG
        th_writelog("Destroyed video.");
#endif
        mWorkMutex->unlock();
    }
}
コード例 #4
0
ファイル: TheoraVideoManager.cpp プロジェクト: tecan/LunaLibs
void TheoraVideoManager::destroyVideoClip(TheoraVideoClip* clip)
{
	if (clip)
	{
		th_writelog("Destroying video clip: "+clip->getName());
		mWorkMutex->lock();
		bool reported=0;
		while (clip->mAssignedWorkerThread)
		{
			if (!reported) { th_writelog("Waiting for WorkerThread to finish decoding in order to destroy"); reported=1; }
			_psleep(1);
		}
		if (reported) th_writelog("WorkerThread done, destroying..");
		foreach(TheoraVideoClip*,mClips)
			if ((*it) == clip)
			{
				mClips.erase(it);
				break;
			}
		delete clip;
		th_writelog("Destroyed video.");
		mWorkMutex->unlock();
	}
}