⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pxff2.cpp

📁 linux下的一款播放器
💻 CPP
📖 第 1 页 / 共 5 页
字号:
            // Get the AcceptMetaInfo string, if one exists            IHXValues* pRequestHeaders = NULL;            pRequest->GetRequestHeaders(pRequestHeaders);            if (pRequestHeaders)            {                HX_RELEASE(m_pAcceptMetaInfoStr);                pRequestHeaders->GetPropertyCString("AcceptMetaInfo", m_pAcceptMetaInfoStr);            }            HX_RELEASE(pRequestHeaders);            // Determine whether this file object is coming from a	    // pool filesytem which wants to adjust absolute local paths.            m_pRPFileObject->QueryInterface (IID_IHXPoolPathAdjustment,			                     (void**) &m_pPoolPathAdjustment);            // Create a codec manager            retVal = PXFileFormatCodecManager::CreateObject(&m_pCodecManager);            if (SUCCEEDED(retVal))            {                // AddRef the object                m_pCodecManager->AddRef();                // Init the codec manager                retVal = m_pCodecManager->Init(m_pContext, IID_IHXRealPixFileFormatCodec);                if (SUCCEEDED(retVal))                {                    // Create a wire format manager                    retVal = PXWireFormatManager::CreateObject(&m_pWireFormatManager);                    if (SUCCEEDED(retVal))                    {                        // Addref the manager                        m_pWireFormatManager->AddRef();                        // Initialize the wire format manager                        retVal = m_pWireFormatManager->Init(m_pContext, m_ulStreamVersion);                        if (SUCCEEDED(retVal))                        {                            // Get the registry settings                            retVal = GetRegistrySettings(m_bRealPixLicensed, m_ulStrictnessLevel);                            if (SUCCEEDED(retVal))                            {                                // Create a pointer array                                HX_DELETE(m_pFileHandlerArray);                                m_pFileHandlerArray = new CHXPtrArray();                                if (m_pFileHandlerArray)                                {                                    // Create a file handler for the .rp file                                    HX_RELEASE(m_pRPFileHandler);                                    m_pRPFileHandler = new PXFileHandler();                                    if (m_pRPFileHandler)                                    {                                        // Addref the object                                        m_pRPFileHandler->AddRef();                                        // Init the file handler                                        retVal = m_pRPFileHandler->Init(m_pContext, m_pRPFileObject, this);                                        if (SUCCEEDED(retVal))                                        {                                            // Set the state                                            m_ulState = kStateReadingRPFile;                                            // Read the .rp file                                            retVal    = m_pRPFileHandler->ReadRPFile();                                        }                                    }                                    else                                    {                                        retVal = HXR_OUTOFMEMORY;                                    }                                }                                else                                {                                    retVal = HXR_OUTOFMEMORY;                                }                            }                        }                    }                }            }        }    }    if (FAILED(retVal))    {        if (pFormatResponse)        {            pFormatResponse->InitDone(retVal);        }    }    return retVal;}STDMETHODIMP CRealPixFileFormat::Close(){#ifdef XXXMEH_DEBUG_LOG    DEBUG_OUTF("c:\\pxff.log", (s, "CRealPixFileFormat::Close(0x%08X)\n", this));#endif    HX_RESULT retVal = HXR_OK;    // If we currently had a parsed image held in memory by    // a codec, then we need to tell the codec to drop it.    if (m_bImageParseActive && m_pCodec)    {        // Tell the codec to release this image        m_pCodec->ReleaseImage(m_ulSessionHandle);        // Clear the flag        m_bImageParseActive = FALSE;        // Clear the handle        m_ulSessionHandle   = 0;        // Release the codec        HX_RELEASE(m_pCodec);    }    // Set the state    m_ulState = kStateShutdown;    // Shutdown all file handlers - this is asynch - will    // finish up in ShutdownDone().    ShutdownAllFileHandlers(TRUE);    return retVal;}STDMETHODIMP CRealPixFileFormat::GetFileHeader(){#ifdef XXXMEH_DEBUG_LOG    DEBUG_OUTF("c:\\pxff.log", (s, "CRealPixFileFormat::GetFileHeader(0x%08X)\n", this));#endif    HX_RESULT retVal = HXR_OK;    if (m_ulState == kStateFileFormatInitialized)    {        // Set the state        m_ulState = kStateGetFileHeaderShutdown;        // Shutdown all the file handlers        ShutdownAllFileHandlers(FALSE);    }    else    {        retVal = HXR_UNEXPECTED;    }    return retVal;}STDMETHODIMP CRealPixFileFormat::GetStreamHeader(UINT16 usStreamNumber){#ifdef XXXMEH_DEBUG_LOG    DEBUG_OUTF("c:\\pxff.log", (s, "CRealPixFileFormat::GetStreamHeader(0x%08X)\n", this));#endif    HX_RESULT retVal = HXR_OK;    /* If RealPix is not licensed, log an error and return */    if (!m_bRealPixLicensed)    {        ReportError(IDS_ERR_PIX_NOTLICENSED,                    NULL,                    NULL,                    HXLOG_ALERT,                    HXR_NOT_LICENSED);        m_pFileFormatResponse->StreamHeaderReady(HXR_NOT_LICENSED, NULL);        return HXR_OK;    }    if (m_ulState == kStateFileHeaderSent)    {        if (m_bRealPixLicensed)	{            IHXValues* pStreamHeader = NULL;            retVal                    = m_pWireFormatManager->GetStreamHeader(pStreamHeader);            if (SUCCEEDED(retVal))	    {                // Set the state                m_ulState = kStateAwaitingGetPacket;                // Send the stream header                m_pFileFormatResponse->StreamHeaderReady(HXR_OK, pStreamHeader);	    }            HX_RELEASE(pStreamHeader);	}	else	{	    retVal = HXR_NOT_LICENSED;            ReportError(IDS_ERR_PIX_NOTLICENSED, NULL, NULL, HXLOG_ALERT, retVal);	}        if (FAILED(retVal))        {            m_pFileFormatResponse->StreamHeaderReady(retVal, NULL);        }    }    else    {        retVal = HXR_UNEXPECTED;    }    return retVal;}STDMETHODIMP CRealPixFileFormat::GetPacket(UINT16 usStreamNumber){#ifdef XXXMEH_DEBUG_LOG    DEBUG_OUTF("c:\\pxff.log", (s, "CRealPixFileFormat::GetPacket(0x%08X,%u)\n", this, usStreamNumber));#endif    HX_RESULT retVal = HXR_OK;    if (m_ulState == kStateAwaitingGetPacket)    {        if (usStreamNumber == 0)        {            // First check to see if the stream is done            if (!m_pPacketScheduler->IsStreamDone())            {                // We still have packets to send - what is the next                // type of packet to send                UINT32 ulPacketType = 0;                retVal              = m_pPacketScheduler->GetNextPacketInfo(ulPacketType);                if (SUCCEEDED(retVal))                {                    if (ulPacketType == PXWireFormatManager::kPacketTypeImageHeader)                    {                        UINT32      ulHandle       = 0;                        UINT32      ulSize         = 0;                        IHXBuffer* pFileMimeStr   = NULL;                        IHXBuffer* pStreamMimeStr = NULL;                        IHXBuffer* pNameStr       = NULL;                        UINT32      ulTime         = 0;                        retVal = m_pPacketScheduler->GetImageHeaderInfo(ulHandle, ulSize, pFileMimeStr,                                                                        pNameStr, pStreamMimeStr, ulTime);                        if (SUCCEEDED(retVal))                        {                            AllowPoolPathAdjustment (pNameStr);                            // Create an file handler object                            HX_RELEASE(m_pImageFileHandler);                            m_pImageFileHandler = new PXFileHandler();                            if (m_pImageFileHandler)                            {                                // AddRef the object                                m_pImageFileHandler->AddRef();                                // Init the handler                                retVal = m_pImageFileHandler->Init(m_pContext, m_pRPFileObject, this, ulSize + 1);                                if (SUCCEEDED(retVal))                                {                                    // Set the state                                    m_ulState = kStateReadingImageFile;                                    // Read the image file                                    retVal = m_pImageFileHandler->ReadImageFile(ulHandle, pNameStr);                                }                            }                            else                            {                                retVal = HXR_OUTOFMEMORY;                            }                        }                        HX_RELEASE(pFileMimeStr);                        HX_RELEASE(pStreamMimeStr);                        HX_RELEASE(pNameStr);                    }                    else if (ulPacketType == PXWireFormatManager::kPacketTypeImageData)                    {                        UINT32      ulHandle        = 0;                        IHXBuffer* pStreamMimeStr  = NULL;                        UINT32      ulSessionHandle = 0;                        UINT32      ulPacketIndex   = 0;                        UINT32      ulNumPackets    = 0;                        UINT32      ulTimeStamp     = 0;                        retVal = m_pPacketScheduler->GetImageDataInfo(ulHandle, pStreamMimeStr, ulSessionHandle,                                                                      ulPacketIndex, ulNumPackets, ulTimeStamp);                        if (SUCCEEDED(retVal))                        {                            // Make sure we have a codec                            if (m_bImageParseActive && m_pCodec && ulSessionHandle == m_ulSessionHandle)                            {                                // Get the buffers from the codec                                IHXBuffer* pImageData  = NULL;                                IHXBuffer* pOpaqueData = NULL;                                BOOL        bRequired   = FALSE;                                retVal                  = m_pCodec->GetImagePacket(m_ulSessionHandle,                                                                                   ulPacketIndex,                                                                                   pImageData,                                                                                   pOpaqueData,                                                                                   bRequired);                                if (SUCCEEDED(retVal))                                {                                    // If we've just gotten the last packet from the codec,                                    // then we can release the session handle with the codec                                    // and then release the codec interface                                    if (ulPacketIndex == ulNumPackets - 1)                                    {                                        retVal = m_pCodec->ReleaseImage(m_ulSessionHandle);                                        if (SUCCEEDED(retVal))                                        {                                            // Clear the active parse flag                                            m_bImageParseActive = FALSE;                                            // Clear the session handle                                            m_ulSessionHandle   = 0;                                            // Release the codec interface                                            HX_RELEASE(m_pCodec);                                        }                                    }                                    if (SUCCEEDED(retVal))                                    {                                        IHXPacket* pPacket = NULL;                                        retVal              = m_pWireFormatManager->SetImageDataInfo(ulHandle,                                                                                                     pImageData,                                                                                                     pOpaqueData,                                                                                                     ulPacketIndex,                                                                                                     ulTimeStamp,                                                                                                     bRequired,                                                                                                     pPacket);                                        if (SUCCEEDED(retVal))                                        {#ifdef XXXMEH_OUTPUT_DEBUG_STRING                                            char szDbgStr[128]; /* Flawfinder: ignore */                                            sprintf(szDbgStr, "Sending Image Data Packet %lu of %lu (handle=%lu)\n", /* Flawfinder: ignore */                                                    ulPacketIndex, ulNumPackets, ulHandle);                                            OutputDebugString(szDbgStr);#endif                                            // Tell the scheduler we've sent the packet                                            m_pPacketScheduler->PacketSent(m_pWireFormatManager->GetPacketSize(pPacket));                                            // Set the state (actually keep it the same)                                            m_ulState = kStateAwaitingGetPacket;                                            // Send the packet                                            m_pFileFormatResponse->PacketReady(HXR_OK, pPacket);                                        }                                        HX_RELEASE(pPacket);                                    }                                }                                HX_RELEASE(pImageData);                                HX_RELEASE(pOpaqueData);                            }                            else                            {                                retVal = HXR_FAIL;                            }                        }                        HX_RELEASE(pStreamMimeStr);                    }                    else if (ulPacketType == PXWireFormatManager::kPacketTypeEffect)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -