Ejemplo n.º 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);
}
Ejemplo n.º 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;
}
Ejemplo n.º 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;
}
Ejemplo n.º 4
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;
}
Ejemplo n.º 5
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;
}
Ejemplo n.º 6
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;
}
Ejemplo n.º 7
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;
}
Ejemplo n.º 8
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;
}
Ejemplo n.º 9
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 );
    }

}
Ejemplo n.º 10
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;
}
Ejemplo n.º 11
0
void 
CHXSiteManager::HookupHelper(CHXMapPtrToPtr* pMap, char* pActualString, HXBOOL bIsPersistent, 
                             PTR_TYPE ptr_type, HOOK_TYPE hook_type)
{
    if (pMap)
    {
        CHXMapPtrToPtr::Iterator ndx = pMap->Begin();
        for (; ndx != pMap->End(); ++ndx)
        {
	    IHXBuffer* ptempValues = (IHXBuffer*)ndx.get_key(); 
            if (HOOKUP_BY_LSGNAMEWITHSTRING == hook_type)
            {
                HookupByLSGNameWithString((IHXSiteUserSupplier*) *ndx, 
                                          (char*)(ptempValues->GetBuffer()), 
                                          bIsPersistent);
            }
            else if ( !strcasecmp((char*)(ptempValues->GetBuffer()), pActualString ) ) 
	    {
                switch (hook_type)
                {
                case HOOKUP_BY_PLAYTOFROMWITHSTRING:
                    HookupByPlayToFromWithString((IHXSiteUserSupplier*) *ndx,
                                                 (char*)(ptempValues->GetBuffer()), 
                                                 bIsPersistent);
                    break;
                case HOOKUP_SINGLESITE_BY_LSGNAMEWITHSTRING:
		    HookupSingleSiteByLSGNameWithString((IHXSiteUser*) *ndx, 
                                                        (char*)(ptempValues->GetBuffer()), 
                                                        bIsPersistent);
                    break;
                case HOOKUP_SINGLESITE_BY_PLAYTOFROMWITHSTRING:
                    HookupSingleSiteByPlayToFromWithString((IHXSiteUser*) *ndx,
                                                           (char*)(ptempValues->GetBuffer()), 
                                                           bIsPersistent);

                    break;
                default:
                    HX_ASSERT(FALSE);
                    break;
                }
	    }
        }
    }
}
Ejemplo n.º 12
0
CHXString HXCloakedV2TCPSocket::_GetHTTPHost()
{
    CHXString  tmp  = "";
    IHXBuffer* pBuf = NULL;
    
    m_pDestAddr->GetAddr(&pBuf);
    tmp = pBuf->GetBuffer();
    HX_RELEASE(pBuf);
    return tmp;
}
Ejemplo n.º 13
0
HX_RESULT HXCloakedV2TCPSocket::_ReadChunk(ULONG32& ulSizeRead )
{
    HX_RESULT  res         = HXR_FAIL;
    IHXBuffer* pBuf        = NULL;
    IHXBuffer* pNew        = NULL;
    ULONG32    ulBytesUsed = 0;
    
    HX_ASSERT( csReady    == m_CloakingState ||
               csPostWait == m_CloakingState ||
               csGetWait  == m_CloakingState );

    res = _GetReadQueue(pBuf);
    if( pBuf && SUCCEEDED(res) )
    {
        res = _UnChunkBuffer(pBuf, pNew, ulBytesUsed );
        if( SUCCEEDED(res)  )
        {
            ulSizeRead = pNew->GetSize();
            //Enque the data onto the RTSP queue.
            res = m_RTSPQueue.EnQueue(pNew->GetBuffer(), ulSizeRead);

            //Put back any unused data
            if( ulBytesUsed < pBuf->GetSize() )
            {
                m_ReadQueue.EnQueue(pBuf->GetBuffer()+ulBytesUsed,
                                     pBuf->GetSize()-ulBytesUsed);
            }
            res = HXR_OK;
        }
        else
        {
            //We do not have a full chunk yet. Put our data back on
            //the read queue and wait for the full chunk to come in.
            m_ReadQueue.EnQueue(pBuf->GetBuffer(), pBuf->GetSize());
        }
        HX_RELEASE(pNew);
        HX_RELEASE(pBuf);
    }

    return res;
}
Ejemplo n.º 14
0
CHXString HXCloakedV2TCPSocket::_GetProxyAuthString()
{
    IHXBuffer*   pBuffer       = NULL;
    CHXString    retStr        = "";
    CHXString    key           = "proxy-authentication.http:";
    IHXBuffer*   pHeaderBuffer = NULL;
    HX_RESULT    res           = HXR_OK;
    IHXRegistry* pRegistry     = NULL;
    CHXString    recentProxyAuth;
    
    res = m_pContext->QueryInterface(IID_IHXRegistry, (void**)&pRegistry);
    if( SUCCEEDED(res) )
    {
        res = pRegistry->GetStrByName("proxy-authentication.http.realm.recent", pHeaderBuffer);
        if (SUCCEEDED(res))
        {
            recentProxyAuth = CHXString((const char*)pHeaderBuffer->GetBuffer(),
                                        pHeaderBuffer->GetSize());
        }
        HX_RELEASE(pHeaderBuffer);

        key += m_pszProxyName;
        key += ":";
        key += recentProxyAuth;

        res = pRegistry->GetStrByName((const char*)key, pBuffer);
        if( SUCCEEDED(res) && pBuffer )
        {
            CHXString authString((const char*)pBuffer->GetBuffer(), pBuffer->GetSize());
            retStr = "Proxy-Authorization: ";
            retStr += authString;
        }
        HX_RELEASE(pBuffer);
    }
    HX_RELEASE(pRegistry);

    return retStr;
}
Ejemplo n.º 15
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;
}
Ejemplo n.º 16
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;
}
Ejemplo n.º 17
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();
    }
}
Ejemplo n.º 18
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;
}
Ejemplo n.º 19
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;
}
Ejemplo n.º 20
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;
}
Ejemplo n.º 21
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);
}
Ejemplo n.º 22
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;
}
Ejemplo n.º 23
0
HX_RESULT CHXFMTPParser::AddParam(IHXBuffer* pFieldName, 
                                  IHXBuffer* pFieldValue,
                                  IHXValues* pHeaders)
{
    HX_RESULT res = HXR_OK;

    if (pFieldName)
    {
        IHXBuffer* pParamName = 0;
        
        res = ContructParamName(pFieldName, pParamName);

        if (HXR_OK == res)
        {
            char* pNameStr = (char*)pParamName->GetBuffer();
            if (pFieldValue)
            {
                ULONG32 ulValue;

                if (HXR_OK == ConvertToULONG32(pFieldValue, ulValue))
                {
                    // Insert as a numeric field
                    res = pHeaders->SetPropertyULONG32(pNameStr, ulValue);
                }
                else
                {
                    res = pHeaders->SetPropertyCString(pNameStr, pFieldValue);
                }
            }
            else
            {
                // Assume this is a flag field
                res = pHeaders->SetPropertyULONG32(pNameStr, 1);
            }
        }

	HX_RELEASE(pParamName);
    }

    return res;
}
Ejemplo n.º 24
0
bool
CHTTPDemux::IsASXGen(const char* pUrl)
{
    IHXBuffer* pBuffer = NULL;
    bool isASXGen = false;

    HX_RESULT status = m_proc->pc->registry->GetStr("config.FSMount.ASX File Generator.MountPoint",
        pBuffer, m_proc);

    if (HXR_OK == status && pBuffer)
    {
        const char* asxgen = (const char*)pBuffer->GetBuffer();
        if (StrNStr(pUrl, asxgen, strlen(pUrl), strlen(asxgen)))
        {
            isASXGen = true;
        }
    }

    HX_RELEASE(pBuffer);
    return isASXGen;
}
Ejemplo n.º 25
0
HX_RESULT
CBaseArchiver2::DumpValues(IHXValues* pValues)
{
    HX_RESULT	hResult = HXR_OK;
    const char* pName	= NULL;
    IHXBuffer* pValue	= NULL;
    ULONG32	ulValue = 0;

    // Dump all CStrings
    hResult = pValues->GetFirstPropertyCString(pName, pValue);
    while (hResult == HXR_OK)
    {
	printf("CString %s: %s\n", pName, (const char*)pValue->GetBuffer());
	HX_RELEASE(pValue);

	hResult = pValues->GetNextPropertyCString(pName, pValue);
    }

    // Dump all ULONG32s
    hResult = pValues->GetFirstPropertyULONG32(pName, ulValue);
    while (hResult == HXR_OK)
    {
	printf("ULONG32 %s: %ld\n", pName, ulValue);

	hResult = pValues->GetNextPropertyULONG32(pName, ulValue);
    }

    // Dump all Buffers
    hResult = pValues->GetFirstPropertyBuffer(pName, pValue);
    while (hResult == HXR_OK)
    {
	printf("Buffer %s: Contents...\n", pName);
	HX_RELEASE(pValue);

	hResult = pValues->GetNextPropertyBuffer(pName, pValue);
    }

    return HXR_OK;
}
Ejemplo n.º 26
0
void
GetHTTPPaths(HXRegistry* hxreg, char* pCharListName, char**& pHTTPablePaths)
{
    IHXValues* pHTTPPath = 0;
    HX_RESULT res = HXR_OK;

    if (HXR_OK == hxreg->GetPropListByName(pCharListName, pHTTPPath))
    {
        const char* name;
        UINT32      id;
        UINT32      ulCount = 0;

        res = pHTTPPath->GetFirstPropertyULONG32(name, id);
        while(res == HXR_OK)
        {
            ulCount++;
            res = pHTTPPath->GetNextPropertyULONG32(name, id);
        }

        pHTTPablePaths = new char*[ulCount + 1];
        UINT32 i = 0;

        res = pHTTPPath->GetFirstPropertyULONG32(name, id);
        while(res == HXR_OK)
        {
            IHXBuffer* pBuf = 0;
            if(HXR_OK == hxreg->GetStrById(id, pBuf))
            {
                pHTTPablePaths[i] = new_string((const char *)pBuf->GetBuffer());
                i++;

                HX_RELEASE(pBuf);
            }
            res = pHTTPPath->GetNextPropertyULONG32(name, id);
        }
        pHTTPablePaths[i] = 0;
        pHTTPPath->Release();
    }
}
Ejemplo n.º 27
0
///////////////////////////////////
//
//  DoProcess
//
//  *** Called by Process and ProcessOutput ***
//
//  The DoProcess method processes the sound data.
//
//  Parameters
//
//      pbData
//          Pointer to the output buffer
//
//      pbInputData
//          Pointer to the input buffer
//
//      dwQuanta
//          Number of quanta to process
//
//  Return Value
//      S_OK Success
//
HRESULT CHXAudioDeviceHookBase::DoProcess(BYTE *pbData, const BYTE *pbInputData, DWORD dwQuanta)
{
    if( m_pHook )
    {
	DWORD dwInputBufSize = dwQuanta * WaveFormat()->nBlockAlign;
	IHXBuffer* pBuffer = NULL;
	if (HXR_OK == CreateAndSetBufferWithoutAllocCCF(pBuffer,
							(UCHAR*) pbInputData,
							dwInputBufSize,
							m_pContext))
	{
	    HXBOOL bChanged = FALSE;
	    if( SUCCEEDED( m_pHook->ProcessAudioDeviceHooks( pBuffer, bChanged )) && bChanged )
	    {
		memcpy( pbData, pBuffer->GetBuffer(), HX_MIN( dwInputBufSize, pBuffer->GetSize()) );
	    }

	    HX_RELEASE( pBuffer );
	}
    }

    return S_OK;
}
Ejemplo n.º 28
0
CMediaPacket* CPCMAudioFormat::CreateAssembledPacket(IHXPacket* pPacket)
{
    CMediaPacket* pRet = NULL;

    if (pPacket)
    {
        IHXBuffer* pBuffer = pPacket->GetBuffer();
        if (pBuffer)
        {
            UINT32 ulFlags = MDPCKT_USES_IHXBUFFER_FLAG;
            pRet = new CMediaPacket(pBuffer,
                                    (UINT8*) pBuffer->GetBuffer(),
                                    pBuffer->GetSize(),
                                    pBuffer->GetSize(),
                                    pPacket->GetTime(),
                                    ulFlags,
                                    NULL);
            pBuffer->Release();
        }
    }

    return pRet;
}
Ejemplo n.º 29
0
IHXBuffer* ReadSDPFile(IHXCommonClassFactory* pCCF, const char* pFilename)
{
    IHXBuffer* pBuf = 0;

    FILE* pFile = ::fopen(pFilename, "rb");

    if (pFile)
    {
	if (!fseek(pFile, 0, SEEK_END))
	{
	    long fileSize = ftell(pFile);
	    
	    if (HXR_OK == pCCF->CreateInstance(CLSID_IHXBuffer,(void**)&pBuf))
	    {
		HXBOOL bFailed = TRUE;

		if ((HXR_OK == pBuf->SetSize(fileSize)) &&
		    (!fseek(pFile, 0, SEEK_SET)) &&
		    (fread(pBuf->GetBuffer(), fileSize, 1, pFile) == 1))
		{
		    bFailed = FALSE;
		}

		if (bFailed)
		{
		    pBuf->Release();
		    pBuf = 0;
		}

	    }
	}
	::fclose(pFile);
    }

    return pBuf;
}
Ejemplo n.º 30
0
HX_RESULT
CHXAltGroupIterator::GetAltIDSet(CHXAltIDSet& altIDSet) const
{
    HX_RESULT res = HXR_UNEXPECTED;

    if (m_pItr)
    {
        altIDSet.Clear();

        IUnknown* pUnk = m_pItr->GetItem();
        IHXBuffer* pBuf = NULL;

        if (pUnk &&
            (HXR_OK == pUnk->QueryInterface(IID_IHXBuffer,
                                            (void**)&pBuf)))
        {
            // AltIDs are stored in network byte order in the
            // IHXBuffer
            UINT32 uIDCount = pBuf->GetSize() / 4;
            UINT32* pIDs = (UINT32*)pBuf->GetBuffer();

            // Add the AltIDs to altIDSet
            res = HXR_OK;
            for (UINT32 i = 0; (HXR_OK == res) && (i < uIDCount); i++)
            {
                UINT32 uAltID = DwToHost(pIDs[i]);

                res = altIDSet.AddID(uAltID);
            }
        }
        HX_RELEASE(pBuf);
        HX_RELEASE(pUnk);
    }

    return res;
}