HX_RESULT HXCloakedV2TCPSocket::_WriteString(const CHXString& str) { HX_RESULT res = HXR_FAIL; int nCount = str.GetLength(); IHXBuffer* pBuf = NULL; const char* pStr = (const char*)str; //inv CreateBufferCCF(pBuf, m_pContext); HX_ASSERT(pBuf); HX_ASSERT(!str.IsEmpty()); if( pBuf && !str.IsEmpty() ) { res = pBuf->Set( (const unsigned char*)pStr, nCount); HX_ASSERT(SUCCEEDED(res)); if( SUCCEEDED(res) ) { res = m_pTCPSocket->Write(pBuf); HX_ASSERT(SUCCEEDED(res)); } HX_RELEASE(pBuf); } return res; }
bool HLXIHXFileTest::HandleWriteCmd(const UTVector<UTString>& info) { bool bRetVal = false; if (m_pIHXDataFile) { IHXBuffer* pHXBuffer = new CHXBuffer(); if (pHXBuffer) { pHXBuffer->AddRef(); if (pHXBuffer->Set((const UINT8*) ((const char*) info[1]), strlen(info[1])) == HXR_OK) { ULONG32 ulRetSize; ULONG32 ulInSize; ulInSize = pHXBuffer->GetSize(); ulRetSize = m_pIHXDataFile->Write(pHXBuffer); bRetVal = (ulRetSize == ulInSize); bRetVal = (bRetVal == CFileTestUtil::ParseResultString(info[2])); } pHXBuffer->Release(); } } return bRetVal; }
void CHXPrefList::SetPreferences(IUnknown* pContext) { IHXPreferences* pPrefs = NULL; IHXCommonClassFactory* pCCF = NULL; if (pContext && (HXR_OK == pContext->QueryInterface(IID_IHXPreferences, (void**)&pPrefs)) && (HXR_OK == pContext->QueryInterface(IID_IHXCommonClassFactory, (void**)&pCCF))) { CHXSimpleList::Iterator itr = m_prefInfo.Begin(); for(; itr != m_prefInfo.End(); ++itr) { CHXPrefInfo* pInfo = (CHXPrefInfo*)(*itr); IHXBuffer* pBuf = NULL; if ((HXR_OK == pCCF->CreateInstance(CLSID_IHXBuffer, (void**)&pBuf)) && (HXR_OK == pBuf->Set((const unsigned char*)pInfo->Value(), strlen(pInfo->Value())))) { pPrefs->WritePref(pInfo->Key(), pBuf); } HX_RELEASE(pBuf); } } HX_RELEASE(pPrefs); HX_RELEASE(pCCF); }
HX_RESULT CBaseArchiver2::NotifyTempFileCreated(const char* pszTempFileName) { // Need to notify clients of the writer of the name of the temp file // This is a feature for the player team that enables them to play // back the temp files while encoding/writing the files. HX_RESULT res = HXR_OK; if(pszTempFileName) { IHXValues* pStatusInfo = NULL; CreateValuesCCF(pStatusInfo, m_pClassFactory); HX_ASSERT(pStatusInfo); if(pStatusInfo) { IHXBuffer* pBufTempFile = NULL; CreateBufferCCF(pBufTempFile, m_pContext); HX_ASSERT(pBufTempFile); if(pBufTempFile) { res = pBufTempFile->Set((UCHAR*)pszTempFileName, strlen(pszTempFileName) + 1); HX_ASSERT(SUCCEEDED(res)); if(SUCCEEDED(res)) { res = pStatusInfo->SetPropertyCString("TempFileName", pBufTempFile); HX_ASSERT(SUCCEEDED(res)); if(SUCCEEDED(res)) { // Send back the name of the temp file created m_pMonitor->OnStatus(HXR_OK, pStatusInfo); } } HX_RELEASE(pBufTempFile); } else { res = HXR_OUTOFMEMORY; } HX_RELEASE(pStatusInfo); } else { res = HXR_OUTOFMEMORY; } } else { res = HXR_POINTER; } return res; }
/* add "any" at pName */ HX_RESULT MulticastRuleChain::_addDefaultRule(const char* pName) { IHXBuffer* pBuf = new ServerBuffer(TRUE); pBuf->Set((const UCHAR*)"any", sizeof("any")); m_registry->AddStr(pName, pBuf, m_proc); pBuf->Release(); return HXR_OK; }
void ClientRegTree::InitRegistry(IHXBuffer* pStartTime) { IHXBuffer* pValue; char str[128]; sprintf(str, "client.%ld", m_ulRegistryConnId); m_ulRegId[CLIENT] = m_pRegistry->AddComp(str); sprintf(str, "client.%ld.ConnID", m_ulRegistryConnId); // should this be conn_id from client obj?? m_ulRegId[CONN_ID] = m_pRegistry->AddInt(str, m_ulRegistryConnId); if (pStartTime) { m_ulRegId[TIME] = m_pRegistry->AddStr(str, pStartTime); } else // Proxy. { time_t start_time; char start_time_string[MAX_TIME_STRING_LEN]; //ok struct tm start_time_struct; time(&start_time); hx_localtime_r(&start_time, &start_time_struct); strftime(start_time_string, MAX_TIME_STRING_LEN, "%d/%b/%Y:%H:%M:%S", &start_time_struct); sprintf(str, "client.%ld.StartTime", m_ulRegistryConnId); m_pClassFactory->CreateInstance(CLSID_IHXBuffer, (void**)&pValue); pValue->Set((const BYTE*)start_time_string, strlen(start_time_string)+1); m_ulRegId[TIME] = m_pRegistry->AddStr(str, pValue); pValue->Release(); } sprintf(str, "client.%ld.Session", m_ulRegistryConnId); m_ulRegId[SESSION] = m_pRegistry->AddComp(str); sprintf(str, "client.%ld.SessionCount", m_ulRegistryConnId); m_ulRegId[SESSION_COUNT] = m_pRegistry->AddInt(str, 0); sprintf(str, "client.%ld.ControlBytesSent", m_ulRegistryConnId); m_ulRegId[CTRL_BYTES_SENT] = m_pRegistry->AddInt(str, 0); }
void HelixPlayer::setValue(QString const& name, QVariant const& value) { IHXPreferences *preferences; IHXCommonClassFactory *factory; m_player->QueryInterface( IID_IHXPreferences, (void**)&preferences ); m_player->QueryInterface( IID_IHXCommonClassFactory, (void**)&factory ); IHXBuffer *buffer; factory->CreateInstance( CLSID_IHXBuffer, (void**)&buffer ); QString s = value.toString(); buffer->Set( (const UCHAR*)s.toLatin1().data(), s.length() ); preferences->WritePref(name.toLatin1().constData(), buffer ); HX_RELEASE( buffer ); HX_RELEASE( factory ); HX_RELEASE( preferences ); }
/************************************************************************ * Method: * IHXPacketHookManager::StartHook * Purpose: * called by the top level client to start recording */ STDMETHODIMP PacketHookManager::StartHook () { HX_RESULT hr = HXR_OK; UINT16 i = 0; UINT16 j = 0; UINT16 k = 0; UINT16 ulSources = 0; UINT16 ulStreams = 0; UINT16 ulStreamIndex = 0; IHXBuffer* pTitle = NULL; IHXBuffer* pAuthor = NULL; IHXBuffer* pCopyright = NULL; IHXValues* pFileHeader = NULL; IHXValues* pStreamHeader = NULL; IUnknown* pUnknown = NULL; IHXPrivateStreamSource *pPrivateSource = NULL; // for IsSaveAllowed, take this out; XXXCP IHXStreamSource* pSource = NULL; IHXInfoLogger* pInfoLogger = NULL; // make sure everything has been initialized if (!m_pPlayer || !m_pPacketHook) { hr = HXR_FAILED; goto cleanup; } // caculate the total number of streams + TAC info. if (!(ulSources = m_pPlayer->GetSourceCount())) { hr = HXR_FAILED; goto cleanup; } m_ulTotalStreams = 0; for (i = 0; i < ulSources; i++) { if (HXR_OK != m_pPlayer->GetSource(i, pUnknown)) { continue; } if (HXR_OK != pUnknown->QueryInterface(IID_IHXStreamSource, (void**)&pSource)) { HX_RELEASE(pUnknown); continue; } if (HXR_OK == pUnknown->QueryInterface(IID_IHXPrivateStreamSource, (void**)&pPrivateSource)) { if (!(pPrivateSource->IsSaveAllowed())) { pPrivateSource->Release(); continue; } pPrivateSource->Release(); } m_ulTotalStreams += pSource->GetStreamCount(); HX_RELEASE(pSource); HX_RELEASE(pUnknown); } if (!m_ulTotalStreams) { hr = HXR_FAILED; goto cleanup; } // prepare the file header CreateBufferCCF(pTitle, m_pPlayer); CreateBufferCCF(pAuthor, m_pPlayer); CreateBufferCCF(pCopyright, m_pPlayer); // XXX HP: find better way to collect TAC info #define szTitle "title" #define szAuthor "author" #define szCopyright "copyright" pTitle->Set((const unsigned char*)szTitle, strlen(szTitle)+1); pAuthor->Set((const unsigned char*)szAuthor, strlen(szAuthor)+1); pCopyright->Set((const unsigned char*)szCopyright, strlen(szCopyright)+1); if (HXR_OK == CreateValuesCCF(pFileHeader, m_pPlayer)) { // set attributes(i.e. num. of streams + TAC) pFileHeader->SetPropertyBuffer("Title", pTitle); pFileHeader->SetPropertyBuffer("Author", pAuthor); pFileHeader->SetPropertyBuffer("Copyright", pCopyright); pFileHeader->SetPropertyULONG32("StreamCount", m_ulTotalStreams); } // signal the top level client of upcoming content m_pPacketHook->OnStart(); // send file header to its top level client hr = m_pPacketHook->OnFileHeader(pFileHeader); if (hr != HXR_OK) { HX_RELEASE(m_pPacketHook); goto cleanup; } // prepare the stream headers m_ulRecordableStreams = 0; ulStreamIndex = 0; for (i = 0; i < ulSources; i++) { if (HXR_OK != m_pPlayer->GetSource(i, pUnknown)) { HX_RELEASE(pUnknown); continue; } if (HXR_OK != pUnknown->QueryInterface(IID_IHXStreamSource, (void**)&pSource)) { HX_RELEASE(pSource); continue; } if (HXR_OK == pUnknown->QueryInterface(IID_IHXPrivateStreamSource, (void**)&pPrivateSource)) { if (!(pPrivateSource->IsSaveAllowed())) { pPrivateSource->Release(); continue; } pPrivateSource->Release(); } if (HXR_OK == pUnknown->QueryInterface(IID_IHXInfoLogger, (void**)&pInfoLogger)) { pInfoLogger->LogInformation("RECSTART", NULL); } HX_RELEASE(pInfoLogger); ulStreams = pSource->GetStreamCount(); for (j = 0; j < ulStreams; j++) { const char* pszPropName = NULL; UINT16 ulRenderers = 0; ULONG32 ulPropValue = 0; HXBOOL bRecordable = FALSE; IHXValues* pHeader = NULL; IHXBuffer* pPropValueSource = NULL; IHXBuffer* pPropValueTarget = NULL; IHXStream* pStream = NULL; // retrieve the stream info pSource->GetStream(j, (IUnknown*&)pStream); pHeader = pStream->GetHeader(); // make a copy of this stream header // XXX HP: this could be wrapped up into one method in CHXHeader CreateValuesCCF(pStreamHeader, m_pPlayer); // copy all the ULONG32 attributes if (HXR_OK == pHeader->GetFirstPropertyULONG32(pszPropName, ulPropValue)) { pStreamHeader->SetPropertyULONG32(pszPropName, ulPropValue); while (HXR_OK == pHeader->GetNextPropertyULONG32(pszPropName, ulPropValue)) { pStreamHeader->SetPropertyULONG32(pszPropName, ulPropValue); } } // copy all the buffer attributes if (HXR_OK == pHeader->GetFirstPropertyBuffer(pszPropName, (IHXBuffer*&)pPropValueSource)) { if (HXR_OK == CreateAndSetBufferCCF(pPropValueTarget, pPropValueSource->GetBuffer(), pPropValueSource->GetSize(), m_pPlayer)) { pStreamHeader->SetPropertyBuffer(pszPropName, pPropValueTarget); HX_RELEASE(pPropValueTarget); } HX_RELEASE(pPropValueSource); while (HXR_OK == pHeader->GetNextPropertyBuffer(pszPropName, (IHXBuffer*&)pPropValueSource)) { if (HXR_OK == CreateAndSetBufferCCF(pPropValueTarget, pPropValueSource->GetBuffer(), pPropValueSource->GetSize(), m_pPlayer)) { pStreamHeader->SetPropertyBuffer(pszPropName, pPropValueTarget); HX_RELEASE(pPropValueTarget); } HX_RELEASE(pPropValueSource); } } // copy all the CString attributes if (HXR_OK == pHeader->GetFirstPropertyCString(pszPropName, (IHXBuffer*&)pPropValueSource)) { if (HXR_OK == CreateAndSetBufferCCF(pPropValueTarget, pPropValueSource->GetBuffer(), pPropValueSource->GetSize(), m_pPlayer)) { pStreamHeader->SetPropertyCString(pszPropName, pPropValueTarget); HX_RELEASE(pPropValueTarget); } HX_RELEASE(pPropValueSource); while (HXR_OK == pHeader->GetNextPropertyCString(pszPropName, (IHXBuffer*&)pPropValueSource)) { if (HXR_OK == CreateAndSetBufferCCF(pPropValueTarget, pPropValueSource->GetBuffer(), pPropValueSource->GetSize(), m_pPlayer)) { pStreamHeader->SetPropertyCString(pszPropName, pPropValueTarget); HX_RELEASE(pPropValueTarget); } HX_RELEASE(pPropValueSource); } } HX_RELEASE(pHeader); // modify some values pStreamHeader->SetPropertyULONG32("StreamNumber", ulStreamIndex); // the stream is recordable as long as there is one renderer supports // IHXPacketHookHelper. Multiple renderers can serve the packets with // the same stream number on it, One solution for this is to choose the // first renderer which supports IHXPacketHookHelper as the only source ulRenderers = pStream->GetRendererCount(); for (k = 0; k < ulRenderers; k++) { IUnknown* pUnknown = NULL; IHXPacketHookHelper* pPacketHookHelper = NULL; pStream->GetRenderer(k, pUnknown); if (HXR_OK == pUnknown->QueryInterface(IID_IHXPacketHookHelper, (void**)&pPacketHookHelper)) { bRecordable = TRUE; pPacketHookHelper->StartHook(ulStreamIndex, 0, new PacketHookHelperResponse(this, ulStreamIndex)); } HX_RELEASE(pPacketHookHelper); HX_RELEASE(pUnknown); } if (bRecordable) { m_ulRecordableStreams++; } pStreamHeader->SetPropertyULONG32("Recordable", (ULONG32)bRecordable); /* * It's possible that StartHook will cause the m_pPacketHook to * be released */ if (!m_pPacketHook) { hr = HXR_UNEXPECTED; goto cleanup; } // send stream header to its top level client hr = m_pPacketHook->OnStreamHeader(pStreamHeader); if (hr != HXR_OK) { HX_RELEASE(m_pPacketHook); goto cleanup; } ulStreamIndex++; HX_RELEASE(pStreamHeader); HX_RELEASE(pStream); } HX_RELEASE(pSource); HX_RELEASE(pUnknown); } cleanup: HX_RELEASE(pTitle); HX_RELEASE(pAuthor); HX_RELEASE(pCopyright); HX_RELEASE(pFileHeader); return hr; }
STDMETHODIMP HXCloakedV2TCPSocket::ResponseReady( HX_RESULT res, IHXRequest* pRequestResponse) { IHXCommonClassFactory* pCCF = NULL; IHXRegistry* pRegistry = NULL; IHXValues* pHeaders = NULL; const char* pName = NULL; IHXBuffer* pBuf = NULL; CHXString key = ""; IHXBuffer* pTmpBuffer = NULL; if( SUCCEEDED(res) ) { //Extract the authentication info, again, this is a real waste to just //get a username password. See comment in _DoProxyAuthentication. res = m_pContext->QueryInterface(IID_IHXCommonClassFactory, (void**)&pCCF); if( SUCCEEDED(res) ) { res = m_pContext->QueryInterface(IID_IHXRegistry, (void**)&pRegistry); if( SUCCEEDED(res) ) { res = pRequestResponse->GetRequestHeaders(pHeaders); if( SUCCEEDED(res) ) { res = pHeaders->GetFirstPropertyCString(pName, pBuf); while( SUCCEEDED(res) && pBuf ) { if( !strcasecmp(pName, "Proxy-Authorization") ) { CHXString key = "proxy-authentication.http:"; key += m_pszProxyName; key += ":"; res = pRegistry->GetStrByName( "proxy-authentication.http.realm.recent", pTmpBuffer); if( SUCCEEDED(res) ) { key += CHXString((const char*)pTmpBuffer->GetBuffer(), pTmpBuffer->GetSize()); } HX_RELEASE(pTmpBuffer); res = pCCF->CreateInstance(CLSID_IHXBuffer, (void**)&pTmpBuffer); if( SUCCEEDED(res) ) { pTmpBuffer->Set(pBuf->GetBuffer(), pBuf->GetSize()); UINT32 regid = pRegistry->GetId((const char*)key); if (!regid) { pRegistry->AddStr((const char*)key, pTmpBuffer); } else { pRegistry->SetStrByName((const char*)key, pTmpBuffer); } } HX_RELEASE(pTmpBuffer); break; } // get next header name value line HX_RELEASE(pBuf); res = pHeaders->GetNextPropertyCString(pName, pBuf); } HX_RELEASE(pBuf); HX_RELEASE(pHeaders); } } HX_RELEASE(pRegistry); } HX_RELEASE(pCCF); } HX_RELEASE(pRequestResponse); //We need to start over connting again.... m_CloakingState = csDisconnected; if( m_pTCPSocket) { m_pTCPSocket->Close(); HX_RELEASE(m_pTCPSocket); } res = m_pNetworkServices->CreateSocket(&m_pTCPSocket); if(m_pTCPSocket && SUCCEEDED(res) ) { res = m_pTCPSocket->SetResponse(this); if( SUCCEEDED(res) ) { res = m_pTCPSocket->Init(m_family, m_type, m_protocol); m_pTCPSocket->SetOption( HX_SOCKOPT_APP_BUFFER_TYPE, HX_SOCKBUF_DEFAULT); m_pTCPSocket->SelectEvents(HX_SOCK_EVENT_READ| HX_SOCK_EVENT_CONNECT| HX_SOCK_EVENT_CLOSE); res = m_pTCPSocket->ConnectToOne(m_pDestAddr); } } return res; }
HX_RESULT HXCloakedV2TCPSocket::_DoProxyAuthentication(HTTPResponseMessage* pMess) { HX_RESULT res = HXR_FAIL; IHXCommonClassFactory* pCCF = NULL; CHXString getStr = ""; IHXKeyValueList* pRespHeaders = NULL; MIMEHeaderValue* pHeaderValue = NULL; MIMEHeader* pHeader = NULL; CHXString strHeader = ""; CHXString strTemp = ""; IHXBuffer* pBuffer = NULL; IHXRequest* pRequest = NULL; IHXValues* pValues = NULL; IHXClientAuthConversation* pClientAuth = NULL; IUnknown* pUnkConfig = NULL; IHXObjectConfiguration* pConfig = NULL; ////////////////////// // // XXXgfw I really don't think we need all this authentication // garbage. It really seems we only need to TLC to just give us a // dialog to do a user/pass request. It sure seems like this code // below is way overkill. Just check out ResponseReady(), the only // thing is needs from all this is just that one string. Oh well, // until I have time to figure out exactly how this all works (all // the calls through the core and into the TLC from here) I will // just leave it like the original cloaking. // ////////////////////// res = m_pContext->QueryInterface(IID_IHXCommonClassFactory, (void**)&pCCF); if( SUCCEEDED(res) ) { //pRequest will be freed in the ResponseReady() method. res = pCCF->CreateInstance(CLSID_IHXRequest, (void**)&pRequest); if( SUCCEEDED(res) ) { getStr = _GenerateGetRequest(); pRequest->SetURL((const char*)getStr); //Always returns HXR_OK; res = pCCF->CreateInstance(CLSID_IHXKeyValueList, (void**)&pRespHeaders); if( SUCCEEDED(res) ) { pHeader = pMess->getFirstHeader(); while (pHeader) { pHeaderValue = pHeader->getFirstHeaderValue(); strHeader = ""; while( pHeaderValue ) { pHeaderValue->asString(strTemp); strHeader += strTemp; pHeaderValue = pHeader->getNextHeaderValue(); if (pHeaderValue) { strHeader += ", "; } } pBuffer = NULL; CHXBuffer::FromCharArray((const char*)strHeader, &pBuffer); if( pBuffer ) { pRespHeaders->AddKeyValue(pHeader->name(), pBuffer); } HX_RELEASE(pBuffer); pHeader = pMess->getNextHeader(); } pValues = NULL; if (HXR_OK == pRespHeaders->QueryInterface(IID_IHXValues, (void**)&pValues)) { pRequest->SetResponseHeaders(pValues); } HX_RELEASE(pValues); } HX_RELEASE(pRespHeaders); if (HXR_OK == pRequest->GetResponseHeaders(pValues)) { res = pCCF->CreateInstance(CLSID_IHXBuffer, (void**)&pBuffer); if (SUCCEEDED(res)) { pBuffer->Set((UCHAR*)m_pszProxyName, strlen(m_pszProxyName)+1); pValues->SetPropertyCString("_server", pBuffer); HX_RELEASE(pBuffer); } // Add the protocol to the response headers because TLC needs it if (SUCCEEDED(pCCF->CreateInstance(CLSID_IHXBuffer, (void**)&pBuffer))) { pBuffer->Set((UCHAR*)"http", strlen("http") + 1); pValues->SetPropertyCString("_protocol", pBuffer); HX_RELEASE(pBuffer); } HX_RELEASE(pValues); } //We now need a CCF from the cloaking context, not our core's context. HX_RELEASE(pCCF); res = m_pCloakContext->QueryInterface(IID_IHXCommonClassFactory, (void**)&pCCF); if(SUCCEEDED(res)) { res = pCCF->CreateInstance( CLSID_CHXClientAuthenticator, (void**)&pUnkConfig ); if(SUCCEEDED(res)) { res = pUnkConfig->QueryInterface(IID_IHXClientAuthConversation, (void**)&pClientAuth); if (SUCCEEDED(res)) { res = pUnkConfig->QueryInterface(IID_IHXObjectConfiguration, (void**)&pConfig); if (SUCCEEDED(res)) { pConfig->SetContext(m_pCloakContext); HX_RELEASE(pConfig); } if ( pClientAuth && !pClientAuth->IsDone() ) { HX_ASSERT(pRequest); //After this if/else, we continue in ResponseReady() after //the TLC calls us back. if (pRequest) { res = pClientAuth->MakeResponse(this, pRequest); } else { // Auth Failed! pClientAuth->Authenticated(FALSE); res = HXR_NOT_AUTHORIZED; res = ResponseReady(res, pRequest); } } } HX_RELEASE(pUnkConfig); } HX_RELEASE(pCCF); } } } //We return this in all cases. the connection will be started over in //the ResponseReady() method. res = HXR_NOT_AUTHORIZED; return res; }
HX_RESULT CPCMAudioFormat::DecodeAudioData(HXAudioData& audioData, HXBOOL bFlushCodec, CMediaPacket *pPacket) { HX_RESULT retVal = HXR_FAIL; if (pPacket && m_pCommonClassFactory) { // Create an IHXBuffer IHXBuffer* pBuffer = NULL; m_pCommonClassFactory->CreateInstance(CLSID_IHXBuffer, (void**) &pBuffer); if (pBuffer) { switch(m_ucMimeType) { case kMimeTypeAudioL8: case kMimeTypeAudioL16: case kMimeTypeAudioXPNWav: // Copy the media packet into this buffer retVal = pBuffer->Set(pPacket->m_pData, pPacket->m_ulDataSize); if(SUCCEEDED(retVal)) { // Byteswap the samples if necessary if (m_bSwapSampleBytes) { SwapWordBytes((UINT16*) pBuffer->GetBuffer(), pBuffer->GetSize() / 2); } // Offset 8-bit samples if necessary if (m_bZeroOffsetPCM) { UCHAR* pTmp = (UCHAR*) pBuffer->GetBuffer(); for (UINT32 i = 0; i < pBuffer->GetSize(); i++) { pTmp[i] -= 128; } } } break; case kMimeTypeAudioPCMA: case kMimeTypeAudioPCMU: { UCHAR* pbCurSrc = (UCHAR*)(pPacket->m_pData); UINT16* pwCurDes = NULL; ULONG32 ulSampleNum = pPacket->m_ulDataSize; retVal = pBuffer->SetSize(ulSampleNum<<1); if(SUCCEEDED(retVal)) { pwCurDes = (UINT16*)(pBuffer->GetBuffer()); if(m_ucMimeType == kMimeTypeAudioPCMA) PCM_CONVERTER_ALaw2Linear(pbCurSrc,pwCurDes,ulSampleNum); else PCM_CONVERTER_ULaw2Linear(pbCurSrc,pwCurDes,ulSampleNum); } break; } default: retVal = HXR_FAIL; } if (SUCCEEDED(retVal)) { audioData.pData = pBuffer; audioData.ulAudioTime = pPacket->m_ulTime; audioData.uAudioStreamType = STREAMING_AUDIO; audioData.pData->AddRef(); } } HX_RELEASE(pBuffer); // Delete the packet CMediaPacket::DeletePacket(pPacket); } return retVal; }