示例#1
0
文件: TsStream.cpp 项目: logue/TvCas
const bool CPsiSection::operator == (const CPsiSection &Operand) const
{
	// セクションの内容を比較する
	if (GetPayloadSize() != Operand.GetPayloadSize()) {
		// サイズが異なる
		return false;
	}

	const BYTE *pSrcData = GetPayloadData();
	const BYTE *pDstData = Operand.GetPayloadData();

	if (!pSrcData && !pDstData) {
		// いずれもNULL
		return true;
	}

	if (!pSrcData || !pDstData) {
		// 一方だけNULL
		return false;
	}

#if 0
	// バイナリ比較
	for (DWORD dwPos = 0 ; dwPos < GetPayloadSize() ; dwPos++) {
		if (pSrcData[dwPos] != pDstData[dwPos])
			return false;
	}

	// 一致する
	return true;
#else
	return memcmp(pSrcData, pDstData, GetPayloadSize()) == 0;
#endif
}
示例#2
0
nsresult
DaemonSocketPDU::UpdateHeader()
{
  size_t len = GetPayloadSize();
  if (len >= MAX_PAYLOAD_LENGTH) {
    return NS_ERROR_ILLEGAL_VALUE;
  }
  uint16_t len16 = static_cast<uint16_t>(len);

  memcpy(GetData(OFF_LENGTH), &len16, sizeof(len16));

  return NS_OK;
}
示例#3
0
PvResult Source::StartAcquisition()
{
	PvGenStateStack lState( mDevice->GetGenParameters() );
	if ( mMultiSource )
	{
		// Push change on stack, will be reset when lState goes out of scope
		lState.SetEnumValue( "SourceSelector", mSourceIndex );
	}

	// Get payload size
	PvUInt32 lPayloadSize = GetPayloadSize();
	if ( lPayloadSize > 0 )
	{
		// Propagate to pipeline to make sure buffers are big enough
		mPipeline->SetBufferSize( lPayloadSize );
	}

	// Reset pipeline
	mPipeline->Reset();
	mBuffersReallocated = false;

	// Reset stream statistics
	PvGenCommand *lResetStats = mStream->GetParameters()->GetCommand( "Reset" );
	lResetStats->Execute();

	// Reset dislay thread stats (mostly frames displayed per seconds)
	mDisplayThread->ResetStatistics();

	// Use acquisition manager to send the acquisition start command to the device
	PvResult lResult = mAcquisitionManager->Start();
	if ( !lResult.IsOK() )
	{
		return lResult;
	}

	return PvResult::Code::OK;
}