示例#1
0
void OutputBuffers(UINT16 ulStreamID, IHXValues* pHdr)
{
    const char* pName = 0;
    IHXBuffer* pValue = 0;
    HX_RESULT res = pHdr->GetFirstPropertyBuffer(pName, pValue);
    
    while (HXR_OK == res)
    {
	printf("GetBuffer %u \"%s\" \"", ulStreamID, pName);

	UCHAR* pCur = pValue->GetBuffer();
	UCHAR* pEnd = pCur + pValue->GetSize();

	static const char z_hexChars[] = "0123456789abcdef";

	for (;pCur < pEnd; pCur++)
	{
	    printf("%c%c", z_hexChars[*pCur >> 4], z_hexChars[*pCur & 0xf]);
	}

	printf("\"\n");
	
	HX_RELEASE(pValue);
	
	res = pHdr->GetNextPropertyBuffer(pName, pValue);
    }
    
    HX_RELEASE(pValue);
}
示例#2
0
/// Work horse for reading. As long as we are initilized once 
/// to read, we always try to read something of the socket.
HX_RESULT
HXOpwaveTCPSocket::DoRead()
{
    /// Create a new IHXBuffer for every read
    HX_RESULT res = HXR_FAIL;
    IHXBuffer* pReadBuffer = NULL;
    res = m_pCCF->CreateInstance(IID_IHXBuffer, (void**)&pReadBuffer);
    if (SUCCEEDED(res))
    {
        res = pReadBuffer->SetSize(m_ulReadSize);
    
        UCHAR* pData = pReadBuffer->GetBuffer();
        int nRead = read(pData, m_ulReadSize);
 
        //OpDPRINTF("DoRead: this=%p, read=%d, askfor=%d\n\n", this, nRead, m_ulReadSize);
        if (nRead > 0)
        {
            pReadBuffer->SetSize(nRead);
            m_pReadBuffer = pReadBuffer;
            // Don't ADDREF, m_pReadBuffer will be released in the callback OnReadDone
        
            OnReadDone(res, m_pReadBuffer);
        }
    }
    HX_RELEASE(m_pReadBuffer);
    return res;
}
示例#3
0
HX_RESULT CMP4ADecoder::OpenNext(IHXValues* pHeader,
                                 IMP4APayloadFormat* pRssm, 
			         IHXAudioDecoder** pOutAudioDecoder,
			         IUnknown* pContext)
{
    HX_RESULT retVal = HXR_FAIL;

    if (pHeader && pOutAudioDecoder)
    {
        // Close the decoder
        Close();
        // Get the mime type
        IHXBuffer* pMimeType = NULL;
        pHeader->GetPropertyCString("MimeType", pMimeType);
        if (pMimeType)
        {
            m_pDecoderInfo = m_decInfoStore.GetInfoNext((const char*) pMimeType->GetBuffer(), pRssm);
            if (m_pDecoderInfo)
            {
                HX_RELEASE(*pOutAudioDecoder);
                retVal = BuildDLLAccessBridge(pOutAudioDecoder, pMimeType, pRssm, pContext);
            }
        }
        HX_RELEASE(pMimeType);
    }

    return retVal;
}
示例#4
0
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);
}
示例#5
0
STDMETHODIMP HXCloakedV2TCPSocket::Read(IHXBuffer** ppBuf)
{
    HX_RESULT  res     = HXR_WOULD_BLOCK;
    ULONG32    ulBytes = 0;
    IHXBuffer* pNew    = NULL;
    
//    HX_ASSERT( csReady == m_CloakingState );

    *ppBuf = NULL;
    ulBytes = m_RTSPQueue.GetQueuedItemCount();
    
    if( ulBytes > 0 )
    {
        res = HXR_OUTOFMEMORY;
	CreateBufferCCF(pNew, m_pContext);
        if( pNew )
        {
            res = pNew->SetSize(ulBytes);
            HX_ASSERT(SUCCEEDED(res));
            if( SUCCEEDED(res) )
            {
                m_RTSPQueue.DeQueue(pNew->GetBuffer(), ulBytes );
                *ppBuf = pNew;
            }
        }

        if( !SUCCEEDED(res) )
        {
            HX_RELEASE(pNew);
        }
    }
    
    return res;
}
示例#6
0
STDMETHODIMP ConfigWatcher::Manage(UINT32 regID)
{
    ConfigWatcherEntry* pEntry;

    if (!m_pRegistry || !m_pActiveRegistry)
	return HXR_NOT_INITIALIZED;

    void* pVoid;
    if (!m_regIDMap.Lookup(regID, pVoid))
    {
	ULONG32 parentID = m_pRegistry->FindParentIdById(regID);
	pEntry = new ConfigWatcherEntry(m_pResponse, regID, parentID);
	pEntry->AddRef();
	IHXBuffer* pBuf = NULL;
	if (pEntry && HXR_OK == m_pRegistry->GetPropName(regID, pBuf)) 
	{ 
	    pEntry->m_pName = new_string((const char*)pBuf->GetBuffer());

	    if (PT_COMPOSITE == m_pRegistry->GetTypeById(regID))
	    {
		//m_pPropWatch->SetWatchById(regID);
	    }

	    m_pActiveRegistry->SetAsActive(pEntry->m_pName, 
		    (IHXActivePropUser*) pEntry);

	    m_regIDMap[regID] = pEntry;
	    HX_RELEASE(pBuf);
	    DPRINTF(D_INFO, ("Watching %s%s(0x%d)\n", 
		    pEntry->m_type == PT_COMPOSITE ? "C" : "A",
		    pEntry->m_pName, regID  ));
	}
    }
    return HXR_OK;
}
示例#7
0
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;
}
示例#8
0
HX_RESULT CHXFMTPParser::CollectToken(const char*& pBuf, const char* pDelims,
                                      IHXBuffer** ppTokDest, HXBOOL& bAddValue)
{
    HX_RESULT res = HXR_OK;

    CHXCharStack tok(m_pCCF);
    
    // Collect value
    while((HXR_OK == res) && *pBuf && !strchr(pDelims, *pBuf))
    {
        res = tok.AddChar(*pBuf++);
    }
    
    
    IHXBuffer* pTok = 0;
    
    if ((HXR_OK == res) && 
        (HXR_OK == (res = tok.Finish(pTok))))
    {
        // Make sure we dont have an empty string
        if (pTok->GetSize() > 1)
        {
            *ppTokDest = pTok;
        }
        else
        {
            bAddValue = TRUE;
            HX_RELEASE(pTok);
        }
    }

    return res;
}
示例#9
0
HX_RESULT HXSymbianTCPReader::Read(RSocket& socket, UINT16 uSize)
{
    HX_RESULT res = HXR_FAILED;

    if (m_pParent)
    {
        res = HXSymbianSocketHelper::ResizeOrCreate(m_pCCF, uSize, m_pBuffer);
        
        if (HXR_OK == res)
        {
            IHXTimeStampedBuffer* pTSBuffer = 0;
	      if(HXR_OK == m_pBuffer->QueryInterface(IID_IHXTimeStampedBuffer, (void **)&pTSBuffer))
	      {
	      		pTSBuffer->SetTimeStamp(HX_GET_TICKCOUNT());
			HX_RELEASE(pTSBuffer);
		}		 
            m_bufDes.Set(m_pBuffer->GetBuffer(), 0, m_pBuffer->GetSize());

            iStatus = KRequestPending;
            socket.RecvOneOrMore(m_bufDes, 0, iStatus, m_amountRead);
            SetActive();
        }
    }

    return res;
}
示例#10
0
IHXBuffer*
CBaseArchiver2::CreateTrimmedBuffer(IHXBuffer* pBuffer, IUnknown* pContext)
{
    IHXBuffer* pRetBuffer = NULL;

    if (pBuffer)
    {
	ULONG32 ulSize = BufferStringLength(pBuffer);

	if (ulSize > 0)
	{
	    IHXBuffer* pNewBuffer = NULL;
	    HX_RESULT retVal = HXR_OK;

	    retVal = CreateBufferCCF(pNewBuffer, pContext);
	    if (SUCCEEDED(retVal))
	    {	
		retVal = pNewBuffer->SetSize(ulSize);
	    }

	    if (SUCCEEDED(retVal))
	    {	
		memcpy(pNewBuffer->GetBuffer(), pBuffer->GetBuffer(), ulSize); /* Flawfinder: ignore */
		pRetBuffer = (IHXBuffer*) pNewBuffer;
		pRetBuffer->AddRef();
	    }

	    HX_RELEASE(pNewBuffer);
	}
    }

    return pRetBuffer;
}
示例#11
0
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;
}
示例#12
0
HX_RESULT ReadUnsetPathsFromPrefs(IUnknown* pContext)
{
#ifndef _VXWORKS
    if(!GetDLLAccessPath())
	return HXR_FAILED;

    CPref* pPreferences = CPref::open_shared_pref(HXVER_COMMUNITY, pContext);
    if(pPreferences)
    {
	for(UINT16 nIndex = 0; nIndex < DLLTYPE_NUMBER; nIndex++)
	{
	    IHXBuffer* pBuffer = NULL;

	    if (GetDLLAccessPath()->GetPath(nIndex))
	    {
		continue;
	    }

	    if(pPreferences->read_pref(GetDLLAccessPath()->GetLibTypeName(nIndex), pBuffer) == HXR_OK)
	    {
		GetDLLAccessPath()->SetPath(nIndex, (const char*)pBuffer->GetBuffer());
		HX_RELEASE(pBuffer);
	    }
	}

	delete pPreferences;
    }
#endif
    return HXR_OK;
}
示例#13
0
void
HSPErrorSink::ConvertErrorToString(const ULONG32 ulHXCode, char* pszBuffer, UINT32 ulBufLen)
{
    IHXErrorMessages* pErrMsg = NULL;

    if( !pszBuffer)
        return;
    
    pszBuffer[0]='\0';


    HX_ASSERT(m_pPlayer);
    if( m_pPlayer)
    {
        m_pPlayer->QueryInterface(IID_IHXErrorMessages, (void**)&pErrMsg);
        if( pErrMsg )
        {
            IHXBuffer* pMessage = pErrMsg->GetErrorText(ulHXCode);
            if( pMessage )
            {
                SafeStrCpy( pszBuffer, (const char*)pMessage->GetBuffer(), (int)ulBufLen);
                pMessage->Release();
            }
        }
    }
 
    HX_RELEASE(pErrMsg);
 
    if( strlen(pszBuffer)==0 )
    {
        SafeSprintf( pszBuffer, (int) ulBufLen, "Can't convert error code %p - please find corresponding HXR code in common/include/hxresult.h", ulHXCode );
    }

}
示例#14
0
HX_RESULT CBaseArchiver2::MakeNuggetFileObject(IHXFileObject* pFileObject,
					       const char* pFileMimeType,
					       IHXFileObject* &pNuggetFileObject)
{
    HX_RESULT retVal = HXR_OUTOFMEMORY;
    CNGTFileObject* pNewNuggetFileObject = new CNGTFileObject();

    if (pNewNuggetFileObject)
    {
	pNewNuggetFileObject->AddRef();
	retVal = pNewNuggetFileObject->InitNugget(m_pContext,
					          pFileObject,
						  HX_FILE_READ | HX_FILE_WRITE | HX_FILE_BINARY,
						  NULL,	    // IHXMetaFileFormatResponse
						  TRUE);    // bForceNew

	if (SUCCEEDED(retVal))
	{
	    UINT32 ulExpiration = 0;
	    UINT32 ulConnectTime = 0;
	    IHXBuffer* pRemoteSourceURLBuffer = NULL;

	    m_pAdviser->GetPropertyULONG32("NuggetExpiration", 
					   ulExpiration);

	    m_pAdviser->GetPropertyCString("NuggetRemoteSourceURL", 
					   pRemoteSourceURLBuffer);

	    m_pAdviser->GetPropertyULONG32("NuggetConnectTime", 
					   ulConnectTime);

	    retVal = pNewNuggetFileObject->ConfigureNugget(
			   ulExpiration,
			   ulConnectTime,
			   m_ulNuggetMinLocalDuration,
			   m_ulMaxDuration,
			   pFileMimeType,
			   pRemoteSourceURLBuffer ? ((const char*) pRemoteSourceURLBuffer->GetBuffer()) : NULL);

	    HX_RELEASE(pRemoteSourceURLBuffer);
	}

	if (SUCCEEDED(retVal))
	{
	    retVal = pNewNuggetFileObject->QueryInterface(IID_IHXFileObject, 
							  (void**) &pNuggetFileObject);
	}

	if (SUCCEEDED(retVal))
	{
	    m_pNuggetFileObject = pNewNuggetFileObject;
	    HX_ADDREF(m_pNuggetFileObject);
	}
    }

    HX_RELEASE(pNewNuggetFileObject);

    return retVal;
}
示例#15
0
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;
}
示例#16
0
/*  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;
}
示例#17
0
CHXString HXCloakedV2TCPSocket::_GetHTTPHost()
{
    CHXString  tmp  = "";
    IHXBuffer* pBuf = NULL;
    
    m_pDestAddr->GetAddr(&pBuf);
    tmp = pBuf->GetBuffer();
    HX_RELEASE(pBuf);
    return tmp;
}
示例#18
0
void
DataRevertController::CleanControlBuffers()
{
    IHXBuffer* pBuffer;
    if (m_pControlBufferList)
    {
	while (!m_pControlBufferList->IsEmpty())
	{
	    pBuffer = (IHXBuffer*)m_pControlBufferList->RemoveHead();
	    pBuffer->Release();
	}
	delete m_pControlBufferList;
    }
}
示例#19
0
int main(int argc, char* argv[])
{
    if (argc != 3)
    {
	fprintf(stderr, "Usage : %s <sdp version> <sdp file>\n", argv[0]);
    }
    else
    {
	IUnknown* pContext = new CHXMiniCCF();
	
	if (pContext)
	{
	    pContext->AddRef();
	    
	    IHXCommonClassFactory* pCCF = 0;

	    if (HXR_OK == pContext->QueryInterface(IID_IHXCommonClassFactory,
						   (void**)&pCCF))
	    {
		IHXBuffer* pSDP = ReadSDPFile(pCCF, argv[2]);

		if (pSDP)
		{
		    if (HXR_OK != Parse(pContext, strtoul(argv[1], 0, 10), 
					pSDP))
		    {
			fprintf(stderr, "Failed to parse SDP\n", argv[1]);
		    }

		    pSDP->Release();
		    pSDP = 0;
		}
		else
		{
		    fprintf(stderr, "Failed to read SDP file '%s'\n", argv[2]);
		}

		pCCF->Release();
		pCCF = 0;
	    }
	    	    
	    pContext->Release();
	    pContext = 0;
	}
	
    }

    return 0;
}
示例#20
0
STDMETHODIMP
CHTTPDemux::SendMessage(HTTPMessage* pMsg)
{
    HX_RESULT hxr = HXR_OK;
    UINT32 uBufLen = MAX_HTTP_MSG + pMsg->contentLength(); //XXXTDM
    IHXBuffer* pBuf = new CHXBuffer();
    pBuf->AddRef();
    pBuf->SetSize(uBufLen);
    int msgLen = 0;
    pMsg->asString((char*)pBuf->GetBuffer(), msgLen, uBufLen);
    pBuf->SetSize(msgLen);
    hxr = SendData(pBuf);
    HX_RELEASE(pBuf);
    return hxr;
}
示例#21
0
void HXSymbianTCPWriter::Write(RSocket& socket, IHXBuffer* pBuffer)
{
    HX_RELEASE(m_pBuffer);
    m_pBuffer = pBuffer;

    if (m_pBuffer)
    {
	m_pBuffer->AddRef();

	m_bufDes.Set(m_pBuffer->GetBuffer(), m_pBuffer->GetSize());

	iStatus = KRequestPending;
	socket.Write(m_bufDes, iStatus);
	SetActive();
    }
}
示例#22
0
QVariant HelixPlayer::value(QString const& name) const
{
    IHXPreferences *preferences;

    m_player->QueryInterface( IID_IHXPreferences, (void**)&preferences );

    IHXBuffer *buffer;
    preferences->ReadPref(name.toLatin1().constData(), buffer );

    QString s = (const char*)buffer->GetBuffer();

    HX_RELEASE( buffer );
    HX_RELEASE( preferences );

    return s;
}
示例#23
0
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);

}
示例#24
0
HX_RESULT HXCloakedV2TCPSocket::_ReadFromSocket()
{
    HX_RESULT  res  = HXR_FAIL;
    IHXBuffer* pBuf = NULL;

    res = m_pTCPSocket->Read(&pBuf);
    if( pBuf && SUCCEEDED(res) )
    {
        //XXXgfw performance problem here. All data is in IHXBuffers
        //up until this point. Now we are doing a memcpy for each
        //packet received. Bad bad bad.
        res = m_ReadQueue.EnQueue(pBuf->GetBuffer(), pBuf->GetSize());
        HX_RELEASE(pBuf);
    }
     
    return res;
}
示例#25
0
// Don't protect anything in this method with mutexes. It has 
// already been done from where it is called from. But mostly
// because we aren't using recursive mutexes yet.
ULONG32 CAudioOutOpenwave::_PushBits()
{
    if (!m_bWriteDone)
    {
    	//OpDPRINTF("_PushBits : ERROR Both buffers are writing?\n");
	return 0;
    }
    if (m_pWriteList == NULL || m_pWriteList->GetCount() <= 0)  
    {
    	//OpDPRINTF("_PushBits : ERROR Nothing to write\n");
    	//OpDPRINTF("_PushBits : m_pWriteList(%d) %d\n", m_pWriteList->GetCount(), m_nCurBuf);
	return 0;
    }
    if (m_SndBuf[m_nCurBuf].fState == OP_SNDBUF_STATE_NOWPLAYING ||
    	m_SndBuf[m_nCurBuf].fState == OP_SNDBUF_STATE_QUEUED)
    {
    	//OpDPRINTF("_PushBits : buf playing %d\n", m_nCurBuf);
	return 0;
    }
    //OpDPRINTF("_PushBits : m_pWriteList(%d)\n", m_pWriteList->GetCount());

    IHXBuffer* pBuffer  = NULL;
    UCHAR*      pData    = 0;
    ULONG32     nSize = 0;
    op_sound_buffer* sndbuf;

    sndbuf = &m_SndBuf[m_nCurBuf];
    m_nCurBuf = !m_nCurBuf;
    //m_nCurBuf = (m_nCurBuf + 1) % 10;  // use all ten buffers

    //We are going to try and write. Grab the head and do it.
    pBuffer = (IHXBuffer*)m_pWriteList->RemoveHead();
    pData   = pBuffer->GetBuffer();
    nSize   = pBuffer->GetSize();

    memcpy( (unsigned char*)sndbuf->fSampleBuffer, pData, nSize );
    HX_RELEASE( pBuffer );

    sndbuf->fNSamples = (nSize) / (m_unNumChannels * (m_unBitsPerSample/8));
    m_ulTotalWritten += nSize; //Keep track of how much we have written to the device.
    op_sound_write (m_pSndDev, sndbuf);

    m_bWriteDone = false;

    return nSize;
}
示例#26
0
STDMETHODIMP
HXExternalResourceManager::Init()
{
    HX_RESULT rc = GetHXXResPlugin();

    if(HXR_OK == rc)
    {
	// get language and res directory preferences/reg entries
	if (HXR_OK == m_pContext->QueryInterface(IID_IHXPreferences,
						(void**)&m_pPrefs) &&
	    HXR_OK == m_pContext->QueryInterface(IID_IHXRegistry, 
						(void**)&m_pRegistry))
	{
	    IHXBuffer* pBuffer = NULL;
	    CHXString strTemp;
	    strTemp.Format("%s.%s",HXREGISTRY_PREFPROPNAME, "LangID");
	    if(HXR_OK == m_pRegistry->GetStrByName(strTemp, pBuffer))
	    {
		const char* pActualLangID = (const char*)pBuffer->GetBuffer();
		m_ulLanguageID = strtol(pActualLangID, NULL, 10);
		HX_RELEASE(pBuffer);
	    }

            const char* pPath = NULL;
            // Get the plugin directory from the Dll Access Paths
            if (GetDLLAccessPath() &&
                (pPath = GetDLLAccessPath()->GetPath(DLLTYPE_PLUGIN)) &&
                *pPath)
            {
                UINT32 ulBufLen = strlen(pPath) + 1 + strlen(EXT_RES_DIR) + 1;
                m_pExternalResDir = new char[ulBufLen];
                SafeStrCpy(m_pExternalResDir, pPath, ulBufLen);
                if (m_pExternalResDir[strlen(m_pExternalResDir)-1] != OS_SEPARATOR_CHAR)
                {
                    SafeStrCat(m_pExternalResDir, OS_SEPARATOR_STRING, ulBufLen);
                }

                SafeStrCat(m_pExternalResDir, EXT_RES_DIR, ulBufLen);
                rc = LoadResourceFiles();
            }

	}
    }

    return rc;
}
示例#27
0
/************************************************************************
 *  IHXDataRevertResponse
 */
STDMETHODIMP
DataRevertController::DataRevertInitDone(HX_RESULT status)
{
    m_bInited = TRUE;
    if (m_pControlBufferList)
    {
	IHXBuffer* pBuffer;
	while (!m_pControlBufferList->IsEmpty())
	{
	    pBuffer = (IHXBuffer*)m_pControlBufferList->RemoveHead();
	    m_pDataRevert->ControlBufferReady(pBuffer);
	    pBuffer->Release();
	}
    }
    m_pDataRevert->RevertFileHeader(m_pFileHeaders);
    return HXR_OK;
}
示例#28
0
void HXOverlayManager::Initialize()
{
    m_pContext->QueryInterface(IID_IHXScheduler, (void**)&m_pScheduler);

    IHXPreferences*    pPreferences    = NULL;
    IHXBuffer*         pBuffer         = NULL;

    if (HXR_OK == m_pContext->QueryInterface(IID_IHXPreferences,(void**)&pPreferences))
    {   
        if (pPreferences->ReadPref("ThermoStatFactor", pBuffer) == HXR_OK)
        {
            m_fThemoStatFactor = atof((char*)pBuffer->GetBuffer());  /* is this ANSI? if not use the next line */
            //sscanf((char*)pBuffer->GetBuffer(), "%f", &m_fThemoStatFactor); 
        }
        HX_RELEASE(pBuffer);
    }
    HX_RELEASE(pPreferences);
}
示例#29
0
// helper
static bool IsRealNetworksPlugin(HXPlugin* pPlugin)
{
    bool isRNPlugin = false;

    HX_ASSERT(pPlugin);
    IHXValues* pval = 0;
    if (SUCCEEDED(pPlugin->GetPluginInfo(pval)))
    {
        IHXBuffer* pbuff = 0;
	if (SUCCEEDED(pval->GetPropertyCString(PLUGIN_DESCRIPTION2, pbuff)))
	{
	    isRNPlugin =  (0 != strstr((const char*)pbuff->GetBuffer(), "RealNetworks"));
            HX_RELEASE(pbuff);
        }
        HX_RELEASE(pval);
    }

    return isRNPlugin;
}
示例#30
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 );
}