void P2PConnection::AttachTo(P2PConnection* connection) { ENTER_METHOD; if(m_closing) { // we are closing, do nothing return; } OP_ASSERT(m_socket_address == 0); OP_ASSERT(connection != NULL); m_socket.Attach(connection->m_socket.Detach()); m_socket_address = connection->m_socket_address; m_useragent.Set(connection->m_useragent); m_host.Set(connection->m_host); m_address.Set(connection->m_address); m_input = connection->m_input; // m_output = connection->m_output; m_observer = &connection->Observer(); m_upload = connection->m_upload; SHAStruct guid; connection->GetGUID(&guid); SetGUID(&guid); connection->m_socket_address = NULL; connection->m_input = NULL; // connection->m_output = NULL; LEAVE_METHOD; }
void sQuestAccept(Player* player, Quest const* quest) override { if (quest->GetQuestId() == QUEST_ENDING_THEIR_WORLD) { SetGUID(player->GetGUID(), DATA_EVENT_STARTER_GUID); Start(true, true, player->GetGUID(), quest); } }
/* ============ sdGUIDInfo::SetMatch ============ */ void sdGUIDInfo::SetMatch( const clientGUIDLookup_t& lookup ) { SetUserName( lookup.name.c_str() ); if ( lookup.clientId.IsValid() ) { SetGUID( lookup.clientId ); return; } if ( lookup.pbid != 0 ) { SetPBID( lookup.pbid ); return; } SetIP( lookup.ip ); }
void QuestReward(Player* player, Quest const* quest, uint32 /*opt*/) override { if (quest->GetQuestId() == QUEST_JOURNEY_TO_UNDERCITY) SetGUID(player->GetGUID(), GUID_EVENT_INVOKER); }
// TODO: test setting MF_LOW_LATENCY attribute void SourceFileMediaFoundation::initReader() { CI_ASSERT( mDataSource ); mFramesRemainingInReadBuffer = 0; ::IMFAttributes *attributes; HRESULT hr = ::MFCreateAttributes( &attributes, 1 ); CI_ASSERT( hr == S_OK ); auto attributesPtr = ci::msw::makeComUnique( attributes ); ::IMFSourceReader *sourceReader; if( mDataSource->isFilePath() ) { hr = ::MFCreateSourceReaderFromURL( mDataSource->getFilePath().wstring().c_str(), attributesPtr.get(), &sourceReader ); if( hr != S_OK ) { string errorString = string( "SourceFileMediaFoundation: Failed to create SourceReader from URL: " ) + mDataSource->getFilePath().string(); if( hr == HRESULT_FROM_WIN32( ERROR_FILE_NOT_FOUND ) ) errorString += ", file not found."; throw AudioFileExc( errorString ); } } else { mComIStream = ci::msw::makeComUnique( new ci::msw::ComIStream( mDataSource->createStream() ) ); ::IMFByteStream *byteStream; hr = ::MFCreateMFByteStreamOnStream( mComIStream.get(), &byteStream ); CI_ASSERT( hr == S_OK ); mByteStream = ci::msw::makeComUnique( byteStream ); hr = ::MFCreateSourceReaderFromByteStream( byteStream, attributesPtr.get(), &sourceReader ); if( hr != S_OK ) throw AudioFileExc( "SourceFileMediaFoundation: Failed to create SourceReader from resource." ); } mSourceReader = ci::msw::makeComUnique( sourceReader ); // get files native format ::IMFMediaType *nativeType; ::WAVEFORMATEX *nativeFormat; UINT32 formatSize; hr = mSourceReader->GetNativeMediaType( MF_SOURCE_READER_FIRST_AUDIO_STREAM, 0, &nativeType ); CI_ASSERT( hr == S_OK ); auto nativeTypeUnique = ci::msw::makeComUnique( nativeType ); hr = ::MFCreateWaveFormatExFromMFMediaType( nativeType, &nativeFormat, &formatSize ); CI_ASSERT( hr == S_OK ); mNumChannels = nativeFormat->nChannels; mSampleRate = nativeFormat->nSamplesPerSec; GUID outputSubType = MFAudioFormat_PCM; // default to PCM 16-bit int, upgrade if we can. mSampleType = SampleType::INT_16; if( nativeFormat->wBitsPerSample == 32 ) { mSampleType = SampleType::FLOAT_32; outputSubType = MFAudioFormat_Float; } else if( nativeFormat->wBitsPerSample == 24 ) { mSampleType = SampleType::INT_24; if( mNumChannels > 1 ) mBitConverterBuffer.setSize( getMaxFramesPerRead(), mNumChannels ); } ::CoTaskMemFree( nativeFormat ); mBytesPerSample = getBytesPerSample( mSampleType ); mReadBuffer.setSize( getMaxFramesPerRead(), mNumChannels ); // set output type, which loads the proper decoder: ::IMFMediaType *outputType; hr = ::MFCreateMediaType( &outputType ); auto outputTypeRef = ci::msw::makeComUnique( outputType ); hr = outputTypeRef->SetGUID( MF_MT_MAJOR_TYPE, MFMediaType_Audio ); CI_ASSERT( hr == S_OK ); hr = outputTypeRef->SetGUID( MF_MT_SUBTYPE, outputSubType ); CI_ASSERT( hr == S_OK ); hr = mSourceReader->SetCurrentMediaType( MF_SOURCE_READER_FIRST_AUDIO_STREAM, 0, outputTypeRef.get() ); CI_ASSERT( hr == S_OK ); // after the decoder is loaded, we have to now get the 'complete' output type before retrieving its format ::IMFMediaType *completeOutputType; hr = mSourceReader->GetCurrentMediaType( MF_SOURCE_READER_FIRST_AUDIO_STREAM, &completeOutputType ); CI_ASSERT( hr == S_OK ); ::WAVEFORMATEX *format; hr = ::MFCreateWaveFormatExFromMFMediaType( completeOutputType, &format, &formatSize ); CI_ASSERT( hr == S_OK ); ::CoTaskMemFree( format ); // get seconds: ::PROPVARIANT durationProp; hr = mSourceReader->GetPresentationAttribute( MF_SOURCE_READER_MEDIASOURCE, MF_PD_DURATION, &durationProp ); CI_ASSERT( hr == S_OK ); LONGLONG duration = durationProp.uhVal.QuadPart; mSeconds = nanoSecondsToSeconds( duration ); mNumFrames = mFileNumFrames = size_t( mSeconds * (double)mSampleRate ); ::PROPVARIANT seekProp; hr = mSourceReader->GetPresentationAttribute( MF_SOURCE_READER_MEDIASOURCE, MF_SOURCE_READER_MEDIASOURCE_CHARACTERISTICS, &seekProp ); CI_ASSERT( hr == S_OK ); ULONG flags = seekProp.ulVal; mCanSeek = ( ( flags & MFMEDIASOURCE_CAN_SEEK ) == MFMEDIASOURCE_CAN_SEEK ); }
void SetData(uint32 field, uint32 data) { if (field == 1 && data == 1) if (Player* player = me->SelectNearestPlayer(50.0f)) SetGUID(player->GetGUID(), player->getFaction()); }