예제 #1
0
bool ColorProducer::Initialize(FrameManagerPtr pFrameManager) {
	if(pFrameManager != 0) {
		FramePtr pFrame = pFrameManager->CreateFrame();
		if(pFrame != 0)	{
			memset_d(reinterpret_cast<unsigned long*>(pFrame->GetDataPtr()), colorValue_, pFrame->GetDataSize() / sizeof(unsigned long));
			frameBuffer_.push_back(pFrame);
			return true;
		}
	}
	return false;
}
예제 #2
0
		void DisplayFrame(Frame* pFrame)
		{
			if(pFrame != NULL && pFrame->HasValidDataPtr()) {
				if(GetFrameManager()->Owns(*pFrame)) {
					DoRender(pFrame);
				}
				else {
					FramePtr pTempFrame = GetReservedFrame();
					if(pTempFrame && pFrame->GetDataSize() == pTempFrame->GetDataSize()) {
						utils::image::Copy(pTempFrame->GetDataPtr(), pFrame->GetDataPtr(), pTempFrame->GetDataSize());
						DoRender(pTempFrame.get());
					}
					else
						LOG << TEXT("DECKLINK: Failed to get reserved frame");
				}
			}
			else {
				LOG << TEXT("DECKLINK: Tried to render frame with no data");
			}
		}
예제 #3
0
bool TargaProducer::Initialize(FrameManagerPtr pFrameManager) {
	if(pFrameManager != 0) {
		FramePtr pFrame = pFrameManager->CreateFrame();
		if(pFrame != 0 && pFrame->GetDataPtr() != 0) {
			PixmapDataPtr pResult = TargaManager::CropPadToFrameFormat(pImage_, pFrameManager->GetFrameFormatDescription());

			unsigned char* pFrameData = pFrame->GetDataPtr();
			unsigned char* pImageData = pResult->GetDataPtr();

			memcpy(pFrameData, pImageData, pFrame->GetDataSize());

			frameBuffer_.push_back(pFrame);
			return true;
		}
	}
	return false;
}
예제 #4
0
void FramePlaybackControl::DoRender(HANDLE& handle, bool bPureCG) 
{
	//Get next CG-frame if we have a CGProducer
	FramePtr pCGFrame;
	if(pCGProducer_) {
		pCGFrame = pCGProducer_->GetFrameBuffer().front();
		FrameBufferFetchResult fetchResult = pCGProducer_->GetFrameBuffer().pop_front();
		if(pCGFrame != 0) {
			pLastCGFrame_ = pCGFrame;
		}
		else if(fetchResult != FetchEOF) {
			pCGFrame = pLastCGFrame_;
		}
		else {
			pCGProducer_.reset();
			LOG << LogLevel::Debug << TEXT("Frameplayback: Cleared CGProducer");
			OnCGEmpty();
			pLastCGFrame_.reset();
		}
	}

	//Get next video frame unless we're in PureCG-mode
	FramePtr pVideoFrame;
	if(!bPureCG || activeClip_.bStopped_) {
		if(frameQueue_.size() > 0) {
			pVideoFrame = frameQueue_.front();
			frameQueue_.pop();

			if(pVideoFrame != 0) {
				pLastVideoFrame_ = pVideoFrame;
			}
		}
		else {
			pVideoFrame = pLastVideoFrame_;
		}

		if(activeClip_.bStopped_ && !frameQueue_.empty())
			eventRender_.Set();
	}
	else {
		pVideoFrame = pLastVideoFrame_;
	}

	//combine and send to consumer
	FramePtr pResultFrame;
	if(pCGFrame) {
		if(pVideoFrame && this->activeClip_.pFP_ != this->emptyProducer_) {
			pResultFrame = pStrategy_->GetReservedFrame();
			if(pResultFrame) {
				utils::image::PreOver(pResultFrame->GetDataPtr(), pVideoFrame->GetDataPtr(), pCGFrame->GetDataPtr(), pResultFrame->GetDataSize());
				pResultFrame->GetAudioData().insert(pResultFrame->GetAudioData().end(), pVideoFrame->GetAudioData().begin(), pVideoFrame->GetAudioData().end());
				pResultFrame->GetAudioData().insert(pResultFrame->GetAudioData().end(), pCGFrame->GetAudioData().begin(), pCGFrame->GetAudioData().end());
			}
		}
		else
			pResultFrame = pCGFrame;
	}
	else
		pResultFrame = pVideoFrame;

	if(pResultFrame)
		pStrategy_->DisplayFrame(pResultFrame.get());
	else if(bPureCG) {
		pResultFrame = pStrategy_->GetReservedFrame();
		if(pResultFrame) {
			utils::image::Clear(pResultFrame->GetDataPtr(), pResultFrame->GetDataSize());
			pStrategy_->DisplayFrame(pResultFrame.get());
		}
	}
}
예제 #5
0
	BitmapHolderAdapter(HWND hWnd, unsigned int width, unsigned int height, FramePtr pFrame) : BitmapHolder(hWnd, width, height, pFrame->GetDataPtr()), pFrame_(pFrame)
	{
		assert(pFrame->GetDataSize() == width*height*4);
	}