live555 RTSP 服务器 是怎么获取视频帧的

_山有木兮 2014-07-11 11:48:12
我刚接触live555不久 看源码有很多疑惑的地方。比如获取视频帧是怎么获取的,我没有看到像fopen fread这样的函数。
我就找BufferedPacket的成员变量fBuf 。
enqueue(&fBuf[fPacketStart + fOverflowDataOffset], fOverflowDataSize);[
是往fBuf 存数据吧?

void OutPacketBuffer::enqueue(unsigned char const* from, unsigned numBytes) {
if (numBytes > totalBytesAvailable()) {
#ifdef DEBUG
fprintf(stderr, "OutPacketBuffer::enqueue() warning: %d > %d\n", numBytes, totalBytesAvailable());
#endif
numBytes = totalBytesAvailable();
}

if (curPtr() != from) memmove(curPtr(), from, numBytes);
increment(numBytes);
}
...全文
249 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
_山有木兮 2014-07-11
  • 打赏
  • 举报
回复
_山有木兮 2014-07-11
  • 打赏
  • 举报
回复
void FramedSource::getNextFrame(unsigned char* to, unsigned maxSize,//to就是doGetNextFrame();读取的视频数据
				afterGettingFunc* afterGettingFunc,
				void* afterGettingClientData,
				onCloseFunc* onCloseFunc,
				void* onCloseClientData) {
  // Make sure we're not already being read:
  if (fIsCurrentlyAwaitingData) {
    envir() << "FramedSource[" << this << "]::getNextFrame(): attempting to read more than once at the same time!\n";
    envir().internalError();
  }

  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;
  fOnCloseFunc = onCloseFunc;
  fOnCloseClientData = onCloseClientData;
  fIsCurrentlyAwaitingData = True;

  doGetNextFrame();//读数据就在这里面
}
_山有木兮 2014-07-11
  • 打赏
  • 举报
回复
我直接搜fread 还真有点效果。
FramedSource::getNextFrame ()
--》
****::doGetNextFrame()
--》
envir().taskScheduler().turnOnBackgroundReadHandling(fileno(fFid),
	       (TaskScheduler::BackgroundHandlerProc*)&fileReadableHandler, this);//原来添加到任务队列了
--》
source->doReadFromFile();
--》
fFrameSize = fread(fTo, 1, fMaxSize, fFid);//打开文件的句柄fFid
最终找到了doGetNextFrame, virtual void doGetNextFrame() = 0;是Framesource的虚函数被他的派生类继承了
rightorwrong 2014-07-11
  • 打赏
  • 举报
回复
是在取数据 跟程序看看
_山有木兮 2014-07-11
  • 打赏
  • 举报
回复
nobody nobody but you !

2,543

社区成员

发帖
与我相关
我的任务
社区描述
专题开发/技术/项目 多媒体/流媒体开发
社区管理员
  • 多媒体/流媒体开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧