⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 framedsource.cpp

📁 rtsp协议的主要实现代码.对开发流媒体
💻 CPP
字号:
// FramedSource.cpp: implementation of the FramedSource class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "FramedSource.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

FramedSource::FramedSource() :
	fIsCurrentlyAwaitingData(FALSE)
{

}

FramedSource::~FramedSource()
{

}
void FramedSource::getNextFrame(unsigned char* to, unsigned maxSize,afterGettingFunc* afterGettingFunc,
								void* afterGettingClientData)
{
	if(fIsCurrentlyAwaitingData)
	{
		cout << "FramedSource[" << this << "]::getNextFrame(): attempting to read more than once at the same time!\n";
		exit(1);		
	}
	fTo = to;
	fMaxSize = maxSize;
	fNumTruncatedBytes = 0; // by default; could be changed by doGetNextFrame()
	fDurationInMicroseconds = 0; // by default; could be changed by doGetNextFrame()
	fAfterGettingFunc = afterGettingFunc;
	fAfterGettingClientData = afterGettingClientData;
	
	fIsCurrentlyAwaitingData = TRUE;
	doGetNextFrame();
}

void FramedSource::afterGetting(FramedSource* source) {
	source->fIsCurrentlyAwaitingData = False;
	// indicates that we can be read again
	// Note that this needs to be done here, in case the "fAfterFunc"
	// called below tries to read another frame (which it usually will)
	
	if (source->fAfterGettingFunc != NULL) {
		(*(source->fAfterGettingFunc))(source->fAfterGettingClientData,
			source->fFrameSize, source->fNumTruncatedBytes,
			source->fPresentationTime,
			source->fDurationInMicroseconds);
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -