当前位置: 首页>>代码示例>>C++>>正文


C++ IOBuffer::ReadFromBuffer方法代码示例

本文整理汇总了C++中IOBuffer::ReadFromBuffer方法的典型用法代码示例。如果您正苦于以下问题:C++ IOBuffer::ReadFromBuffer方法的具体用法?C++ IOBuffer::ReadFromBuffer怎么用?C++ IOBuffer::ReadFromBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IOBuffer的用法示例。


在下文中一共展示了IOBuffer::ReadFromBuffer方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: sizeof

bool InFileRTMPStream::AVCBuilder::BuildFrame(MediaFile* pFile, MediaFrame& mediaFrame, IOBuffer& buffer) {
	if (mediaFrame.isBinaryHeader) {
		buffer.ReadFromBuffer(_videoCodecHeaderInit, sizeof (_videoCodecHeaderInit));
	} else {
		if (mediaFrame.isKeyFrame) {
			// video key frame
			buffer.ReadFromBuffer(_videoCodecHeaderKeyFrame, sizeof (_videoCodecHeaderKeyFrame));
		} else {
			//video normal frame
			buffer.ReadFromBuffer(_videoCodecHeader, sizeof (_videoCodecHeader));
		}
		uint32_t cts = (EHTONL(((uint32_t) mediaFrame.cts) & 0x00ffffff)) >> 8;
		buffer.ReadFromBuffer((uint8_t *) & cts, 3);
	}

	if (!pFile->SeekTo(mediaFrame.start)) {
		FATAL("Unable to seek to position %"PRIu64, mediaFrame.start);
		return false;
	}

	if (!buffer.ReadFromFs(*pFile, (uint32_t) mediaFrame.length)) {
		FATAL("Unable to read %"PRIu64" bytes from offset %"PRIu64, mediaFrame.length, mediaFrame.start);
		return false;
	}

	return true;
}
开发者ID:2php,项目名称:crtmpserver,代码行数:27,代码来源:infilertmpstream.cpp

示例2: Serialize

bool _AUDIO_AAC::Serialize(IOBuffer &dest) {
	uint8_t temp[sizeof (_aacLength)];
	EHTONLP(temp, _aacLength);
	dest.ReadFromBuffer(temp, sizeof (_aacLength));
	dest.ReadFromBuffer(_pAAC, _aacLength);
	return true;
}
开发者ID:OpenQCam,项目名称:qcam,代码行数:7,代码来源:streamcapabilities.cpp

示例3:

bool MP44HTTPStream::FeedData(uint8_t *pData, uint32_t dataLength, uint32_t processedLength,
      uint32_t totalLength, double absoluteTimestamp, bool isAudio) {

  IOBuffer *pBuffer = _pAVProtocol->GetProtocolOutputBuffer();
  pBuffer->ReadFromBuffer(pData, dataLength);
  return _pAVProtocol->EnqueueForOutbound();
}
开发者ID:OpenQCam,项目名称:qcam,代码行数:7,代码来源:mp44httpstream.cpp

示例4: DumpBuffer

string IOBuffer::DumpBuffer(MSGHDR &message, uint32_t limit) {
	IOBuffer temp;
	for (MSGHDR_MSG_IOVLEN_TYPE i = 0; i < message.MSGHDR_MSG_IOVLEN; i++) {
		temp.ReadFromBuffer((uint8_t *) message.MSGHDR_MSG_IOV[i].IOVEC_IOV_BASE,
				message.MSGHDR_MSG_IOV[i].IOVEC_IOV_LEN);
	}
	return temp.ToString(0, limit);
}
开发者ID:YSTV,项目名称:crtmpserver-YSTV,代码行数:8,代码来源:iobuffer.cpp

示例5:

bool AMF0Serializer::WriteDouble(IOBuffer &buffer, double value, bool writeType) {
	if (writeType)
		buffer.ReadFromRepeat(AMF0_NUMBER, 1);

	uint64_t temp = 0;
	EHTOND(value, temp);
	buffer.ReadFromBuffer((uint8_t *) & temp, 8);

	return true;
}
开发者ID:Undev,项目名称:crtmpserver,代码行数:10,代码来源:amf0serializer.cpp

示例6: EHTONS

bool AMF0Serializer::WriteShortString(IOBuffer &buffer, string &value, bool writeType) {
	if (writeType)
		buffer.ReadFromRepeat(AMF0_SHORT_STRING, 1);

	uint16_t length = EHTONS((uint16_t) value.length()); //----MARKED-SHORT----

	buffer.ReadFromBuffer((uint8_t *) & length, 2);
	buffer.ReadFromString(value);

	return true;
}
开发者ID:Undev,项目名称:crtmpserver,代码行数:11,代码来源:amf0serializer.cpp

示例7: EHTONL

bool AMF0Serializer::WriteLongString(IOBuffer &buffer, string &value, bool writeType) {
	if (writeType)
		buffer.ReadFromRepeat(AMF0_LONG_STRING, 1);

	uint32_t length = EHTONL((uint32_t) value.length());

	buffer.ReadFromBuffer((uint8_t *) & length, 4);
	buffer.ReadFromString(value);

	return true;
}
开发者ID:Undev,项目名称:crtmpserver,代码行数:11,代码来源:amf0serializer.cpp

示例8: Write

bool Header::Write(IOBuffer &buffer) {
	if (ci < 64) {
		buffer.ReadFromByte((ht << 6) | ((uint8_t) ci));
	} else if (ci < 319) {
		buffer.ReadFromByte(ht << 6);
		buffer.ReadFromByte((uint8_t) (ci - 64));
	} else if (ci < 65599) {
		uint16_t temp = EHTONS((uint16_t) (ci - 64));
		buffer.ReadFromByte((ht << 6) | 0x01);
		buffer.ReadFromBuffer((uint8_t *) & temp, 2);
	} else {
		FATAL("Invalid channel index");
		return false;
	}

	switch (ht) {
		case HT_FULL:
		{
			if (hf.s.ts < 0x00ffffff) {
				hf.s.ts = EHTONL(hf.s.ts); //----MARKED-LONG---
				hf.s.ml = EHTONL(hf.s.ml << 8); //----MARKED-LONG---
				buffer.ReadFromBuffer(&hf.datac[1], 11);
				hf.s.ts = ENTOHL(hf.s.ts); //----MARKED-LONG---
				hf.s.ml = ENTOHL(hf.s.ml) >> 8; //----MARKED-LONG---
				return true;
			} else {
				uint32_t temp = EHTONL(hf.s.ts); //----MARKED-LONG---
				hf.s.ts = EHTONL(0x00ffffff); //----MARKED-LONG---
				hf.s.ml = EHTONL(hf.s.ml << 8); //----MARKED-LONG---
				buffer.ReadFromBuffer(&hf.datac[1], 11);
				hf.s.ts = ENTOHL(temp); //----MARKED-LONG---
				hf.s.ml = ENTOHL(hf.s.ml) >> 8; //----MARKED-LONG---
				buffer.ReadFromBuffer((uint8_t *) & temp, 4);
				return true;
			}
		}
开发者ID:OpenQCam,项目名称:qcam,代码行数:36,代码来源:header_le_ba.cpp

示例9: SerializeToBuffer

void AtomMVHD::SerializeToBuffer(IOBuffer& data, uint32_t maxFrames) {
  uint32_t start=GETAVAILABLEBYTESCOUNT(data);
  VersionedAtom::SerializeToBuffer(data, maxFrames);
  data.ReadFromDataType<uint32_t>(endianSwap32(_creationTime));
  data.ReadFromDataType<uint32_t>(endianSwap32(_modificationTime));
  data.ReadFromDataType<uint32_t>(endianSwap32(_timeScale));
  _offset=GETAVAILABLEBYTESCOUNT(data);
  data.ReadFromDataType<uint32_t>(endianSwap32(_duration));
  data.ReadFromDataType<uint32_t>(endianSwap32(_preferredRate));
  data.ReadFromDataType<uint16_t>(endianSwap16(_preferredVolume));
  data.ReadFromBuffer(_reserved, sizeof(_reserved));
  for (uint32_t i=0; i<9; i++) 
    data.ReadFromDataType<uint32_t>(endianSwap32(_matrixStructure[i]));
  for (uint32_t i=0; i<6; i++) {
    data.ReadFromRepeat(0x00, 4);
  }
  data.ReadFromDataType<uint32_t>(endianSwap32(_nextTrakId));
  _size=GETAVAILABLEBYTESCOUNT(data)-start;

  *(uint32_t*)(GETIBPOINTER(data)+start) = endianSwap32(_size);
}
开发者ID:OpenQCam,项目名称:qcam,代码行数:21,代码来源:atommvhd.cpp

示例10: FeedData

bool OutNetRTMP4TSStream::FeedAudioData(uint8_t *pData, uint32_t dataLength,
		double absoluteTimestamp) {
	if (!_videoCodecSent)
		return true;
	//the payload here respects this format:
	//6.2  Audio Data Transport Stream, ADTS
	//iso13818-7 page 26/206

	//1. Send the audio codec setup if necessary
	if (!_audioCodecSent) {
		StreamCapabilities *pCapabilities = GetCapabilities();
		if ((pCapabilities != NULL)
				&& (pCapabilities->audioCodecId == CODEC_AUDIO_AAC)) {
			IOBuffer codecSetup;
			codecSetup.ReadFromRepeat(0xaf, 1);
			codecSetup.ReadFromRepeat(0x00, 1);
			codecSetup.ReadFromBuffer(pCapabilities->aac._pAAC,
					pCapabilities->aac._aacLength);

			if (!BaseOutNetRTMPStream::FeedData(
					GETIBPOINTER(codecSetup), //pData
					GETAVAILABLEBYTESCOUNT(codecSetup), //dataLength
					0, //processedLength
					GETAVAILABLEBYTESCOUNT(codecSetup), //totalLength
					absoluteTimestamp, //absoluteTimestamp
					true //isAudio
					)) {
				FATAL("Unable to send audio codec setup");
				return false;
			}
		}

		_audioCodecSent = true;
	}

	if (_inboundStreamIsRTP) {
		pData[0] = 0xaf;
		pData[1] = 0x01;

		return BaseOutNetRTMPStream::FeedData(
				pData, //pData
				dataLength, //dataLength
				0, //processedLength
				dataLength, //totalLength
				absoluteTimestamp, //absoluteTimestamp
				true //isAudio
				);
	} else {
		//2. Skip the ADTS headers and re-position the buffer
		uint32_t totalADTSHeaderLength = 0;
		if (((pData[1])&0x01) == 0)
			totalADTSHeaderLength = 9;
		else
			totalADTSHeaderLength = 7;
		pData += totalADTSHeaderLength - 2;

		//3. Setup the RTMP header
		pData[0] = 0xaf;
		pData[1] = 0x01;

		//4. Feed
		return BaseOutNetRTMPStream::FeedData(
				pData, //pData
				dataLength - totalADTSHeaderLength + 2, //dataLength
				0, //processedLength
				dataLength - totalADTSHeaderLength + 2, //totalLength
				absoluteTimestamp, //absoluteTimestamp
				true //isAudio
				);
	}
}
开发者ID:dista,项目名称:crtmpserver,代码行数:71,代码来源:outnetrtmp4tsstream.cpp


注:本文中的IOBuffer::ReadFromBuffer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。