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

📄 rpfilobj.cpp

📁 linux下的一款播放器
💻 CPP
📖 第 1 页 / 共 5 页
字号:
        }    }    if(bColonWasFound) //then get the "minutes" part:    {        bColonWasFound = FALSE;        // We've got the ":seconds.msecs" part, so lets get the hours part:        for(bufIndx--; 0L<=bufIndx; bufIndx--)        {            char ch = toupper(pTimeBuffer[bufIndx]);            if('0' > ch  ||  '9' < ch)            {                if(' ' == ch  ||  '.' == ch)                {                    break;                }                else if(':' == ch)                {                    bColonWasFound = TRUE;                    //previous found was seconds_, so translate into ULONG:                    // (Note: this will do atol("min:sec") which ignores                    // everything at & beyond the first non-num (":") char):                    minutes_           = atol(&pTimeBuffer[bufIndx+1L]);                    timeValInMillisec += minutes_*60000; //minutes to msec                    break; //done w/ "minutes_:seconds_[milliseconds_]" part.                }                else  //unexpected char found, so quit parsing:                {                    //Make sure pTimeBuffer is in original state:                    if(endCharWasChanged)                    {                        timeBufferLen++;                        pTimeBuffer[timeBufferLen-1] = savedEndChar;                    }                    if(indexOfDot >= 0)                    {                        pTimeBuffer[indexOfDot] = '.';                    }                    //this char is unexpected, so return FALSE with                    //  timeValInMillisec set to whatever was read so far:                    return FALSE;                }            }            else if(0L == bufIndx) //we're done with the buffer:            {                //previous found was seconds_, so translate into ULONG:                minutes_           = atol(pTimeBuffer);                timeValInMillisec += minutes_*60000; //minutes to msec                break; //done w/ "minutes_:seconds_[milliseconds_]" part.            }        }    }    if(bColonWasFound) //then get the "hours" part:    {        bColonWasFound = FALSE;        //We've got the ":minutes.seconds.msec" part, so lets get the hours:        for(bufIndx--; 0L <= bufIndx; bufIndx--)        {            char ch = toupper(pTimeBuffer[bufIndx]);            if('0' > ch  ||  '9' < ch)            {                if(' ' == ch  ||  '.' == ch)                {                    break;                }                else if(':' == ch)                {                    bColonWasFound = TRUE;                    //previous found was minutes_, so translate into ULONG:                    // (Note: this will do atol("hrs:min:sec") which ignores                    // everything at & beyond the first non-num (":") char):                    hours_             = atol(&pTimeBuffer[bufIndx + 1L]);                    timeValInMillisec += hours_ * 3600000; //hours to msec                    break;//done w/ "hours_:minutes_:seconds_[milliseconds_]"                }                else  //unexpected char found, so quit parsing:                {                    //Make sure pTimeBuffer is in original state:                    if(endCharWasChanged)                    {                        timeBufferLen++;                        pTimeBuffer[timeBufferLen-1] = savedEndChar;                    }                    if(indexOfDot >= 0)                    {                        pTimeBuffer[indexOfDot] = '.';                    }                    //this char is unexpected, so return FALSE with                    //  timeValInMillisec set to whatever was read so far:                    return FALSE;                }            }            else if(0L == bufIndx) //we're done with the buffer:            {                //previous found was seconds_, so translate into ULONG:                hours_             = atol(pTimeBuffer);                timeValInMillisec += hours_ * 3600000; //hours to msec                break; //done w/ "hours_:minutes_:seconds_[milliseconds_]".            }        }    }    if(bColonWasFound) //then get the "days" part:    {        bColonWasFound = FALSE;        //We've got the "hours:minutes.seconds.msec" part, so lets get the days:        for(bufIndx--; 0L <= bufIndx; bufIndx--)        {            char ch = toupper(pTimeBuffer[bufIndx]);            if('0' > ch  ||  '9' < ch)            {                if(' ' == ch  ||  '.' == ch)                {                    break;                }                else if(':' == ch)                {                    bColonWasFound = TRUE;                    //previous found was minutes_, so translate into ULONG:                    // (Note: this will do atol("hrs:min:sec") which ignores                    // everything at & beyond the first non-num (":") char):                    days_              = atol(&pTimeBuffer[bufIndx+1L]);                    timeValInMillisec += days_ * 86400000; //days to msec                    break;//done w/ "days_:hours_:minutes_:seconds_[msecs_]"                }                else  //unexpected char found, so quit parsing:                {                    //Make sure pTimeBuffer is in original state:                    if(endCharWasChanged)                    {                        timeBufferLen++;                        pTimeBuffer[timeBufferLen - 1] = savedEndChar;                    }                    if(indexOfDot >= 0)                    {                        pTimeBuffer[indexOfDot] = '.';                    }                    //this char is unexpected, so return FALSE with                    //  timeValInMillisec set to whatever was read so far:                    return FALSE;                }            }            else if(0L == bufIndx) //we're done with the buffer:            {                //previous found was seconds_, so translate into ULONG:                hours_             = atol(pTimeBuffer);                timeValInMillisec += hours_ * 86400000; //days to msec                break; //done w/ "days_:hours_:minutes_:seconds_[msec_]".            }        }    }    if(endCharWasChanged)    {        timeBufferLen++;        //Restore the orignial pTimeBuffer, in case end quote char was removed:        pTimeBuffer[timeBufferLen - 1] = savedEndChar;    }    if(indexOfDot >= 0)    {        pTimeBuffer[indexOfDot] = '.';    }    return TRUE;}HX_RESULT CIMFFileObject::ConvertToNewFileObject(PXRealPixFile* pFile){    HX_RESULT retVal = HXR_OK;    if (pFile)    {        // Copy head attributes        pFile->SetTitle(m_cTitle.c_str());        pFile->SetAuthor(m_cAuthor.c_str());        pFile->SetCopyright(m_cCopyright.c_str());        pFile->SetStart(m_ulStartTime);        pFile->SetDuration(m_ulDuration);        pFile->SetPreroll(m_ulPreroll);        pFile->SetBitrate(m_ulBitrate);        pFile->SetDisplayWidth(m_ulDisplayWidth);        pFile->SetDisplayHeight(m_ulDisplayHeight);        pFile->SetTimeFormat(m_ulTimeFormat);        pFile->SetDefaultAspectFlag(m_bAspectFlag);        pFile->SetDefaultURL(m_cURL.c_str());        pFile->SetDefaultMaxFps(m_ulMaxFps);        pFile->SetBackgroundColor(m_ulBackgroundColor);        pFile->SetBackgroundOpacity(m_ulOpacity);        pFile->SetContentVersion(m_ulContentVersion);        // Run through the image list adding images        GListIterator itr;        for (itr = m_cImageList.Begin(); itr != m_cImageList.End(); itr++)        {            CIMFImage* pImage = (CIMFImage*) *itr;            if (pImage)            {                pFile->AddImage(pImage->GetHandle(), pImage->GetName().c_str());                if (pImage->IsImageSizeSet())                {                    pFile->SetImageSize(pImage->GetHandle(), pImage->GetImageSize());                }            }        }        // Run through the list adding effects        for (itr = m_cEffectList.Begin(); itr != m_cEffectList.End(); itr++)        {            CIMFEffect* pEffect = (CIMFEffect*) *itr;            if (pEffect)            {                // Create a PXEffect object                PXEffect* pNewEffect = NULL;                retVal = PXEffect::CreateObject(&pNewEffect);                if (SUCCEEDED(retVal))                {                    // AddRef the object                    pNewEffect->AddRef();                    // Fill in values which all CIMFEffect's have                    pNewEffect->SetStart(pEffect->GetStart());                    pNewEffect->SetMaxFps(pEffect->GetMaxFps());                    pNewEffect->SetFirstUse(pEffect->GetFirstUse());                    pNewEffect->SetLastUse(pEffect->GetLastUse());                    pNewEffect->SetDstRect(pEffect->GetDstRect().GetX(),                                           pEffect->GetDstRect().GetY(),                                           pEffect->GetDstRect().GetWidth(),                                           pEffect->GetDstRect().GetHeight());                    pNewEffect->SetURL(pEffect->GetURL().c_str());                    // Fill in values based on type                    switch (pEffect->GetType())                    {                        case kTypeFill:                            {                                CIMFFillEffect* pFX = (CIMFFillEffect*) pEffect;                                pNewEffect->SetEffectType(PXEffect::kEffectTypeFill);                                pNewEffect->SetColor(pFX->GetColor().GetRed(),                                                     pFX->GetColor().GetGreen(),                                                     pFX->GetColor().GetBlue());                            }                            break;                        case kTypeFadeIn:                            {                                CIMFFadeinEffect* pFX = (CIMFFadeinEffect*) pEffect;                                pNewEffect->SetEffectType(PXEffect::kEffectTypeFadeIn);                                pNewEffect->SetDuration(pFX->GetDuration());                                pNewEffect->SetTarget(pFX->GetTargetImageHandle());                                pNewEffect->SetSrcRect(pFX->GetSrcRect().GetX(),                                                       pFX->GetSrcRect().GetY(),                                                       pFX->GetSrcRect().GetWidth(),                                                       pFX->GetSrcRect().GetHeight());                                pNewEffect->SetAspectFlag(pFX->GetAspectFlag());                            }                            break;                        case kTypeFadeOut:                            {                                CIMFFadeoutEffect* pFX = (CIMFFadeoutEffect*) pEffect;                                pNewEffect->SetEffectType(PXEffect::kEffectTypeFadeOut);                                pNewEffect->SetDuration(pFX->GetDuration());                                pNewEffect->SetColor(pFX->GetColor().GetRed(),                                                     pFX->GetColor().GetGreen(),                                                     pFX->GetColor().GetBlue());                            }                            break;                        case kTypeCrossFade:                            {                                CIMFCrossfadeEffect* pFX = (CIMFCrossfadeEffect*) pEffect;                                pNewEffect->SetEffectType(PXEffect::kEffectTypeCrossFade);                                pNewEffect->SetDuration(pFX->GetDuration());                                pNewEffect->SetTarget(pFX->GetTargetImageHandle());                                pNewEffect->SetSrcRect(pFX->GetSrcRect().GetX(),                                                       pFX->GetSrcRect().GetY(),                                                       pFX->GetSrcRect().GetWidth(),                                                       pFX->GetSrcRect().GetHeight());                                pNewEffect->SetAspectFlag(pFX->GetAspectFlag());                            }                            break;                        case kTypeWipe:                            {                                CIMFWipeEffect* pFX = (CIMFWipeEffect*) pEffect;                                pNewEffect->SetEffectType(PXEffect::kEffectTypeWipe);                                pNewEffect->SetDuration(pFX->GetDuration());                                pNewEffect->SetTarget(pFX->GetTargetImageHandle());                                pNewEffect->SetSrcRect(pFX->GetSrcRect().GetX(),                                                       pFX->GetSrcRect().GetY(),                                                       pFX->GetSrcRect().GetWidth(),                                                       pFX->GetSrcRect().GetHeight());                                pNewEffect->SetAspectFlag(pFX->GetAspectFlag());                                pNewEffect->SetWipeDirection(pFX->GetWipeDirection());                                pNewEffect->SetWipeType(pFX->GetWipeType());                            }                            break;                        case kTypeViewChange:                            {                                CIMFViewchangeEffect* pFX = (CIMFViewchangeEffect*) pEffect;                                pNewEffect->SetEffectType(PXEffect::kEffectTypeViewChange);                                pNewEffect->SetDuration(pFX->GetDuration());                                pNewEffect->SetTarget(pFX->GetTargetImageHandle());                                pNewEffect->SetSrcRect(pFX->GetSrcRect().GetX(),                                                       pFX->GetSrcRect().GetY(),                                                       pFX->GetSrcRect().GetWidth(),                                                       pFX->GetSrcRect().GetHeight());                                pNewEffect->SetAspectFlag(pFX->GetAspectFlag());                            }                            break;                        case kTypeExternal:                            {                                CIMFExternalEffect* pFX = (CIMFExternalEffect*) pEffect;                                pNewEffect->SetEffectType(PXEffect::kEffectTypeExternal);                                pNewEffect->SetDuration(pFX->GetDuration());                                pNewEffect->SetTarget(pFX->GetTargetImageHandle());                                pNewEffect->SetSrcRect(pFX->GetSrcRect().GetX(),                                                       pFX->GetSrcRect().GetY(),                                                       pFX->GetSrcRect().GetWidth(),                                                       pFX->GetSrcRect().GetHeight());                                pNewEffect->SetAspectFlag(pFX->GetAspectFlag());                                pNewEffect->SetExFxPackage(pFX->GetPackage().c_str());                                pNewEffect->SetExFxName(pFX->GetName().c_str());                                pNewEffect->SetExFxData(pFX->GetData().c_str());                                pNewEffect->SetExFxFile(pFX->GetFile().c_str());                            }                            break;                        case kTypeAnimate:                            {                                CIMFAnimateEffect* pFX = (CIMFAnimateEffect*) pEffect;                                pNewEffect->SetEffectType(PXEffect::kEffectTypeAnimate);                                pNewEffect->SetDuration(pFX->GetDuration());                                pNewEffect->SetTarget(pFX->GetTargetImageHandle());                                pNewEffect->SetSrcRect(pFX->GetSrcRect().GetX(),                                                       pFX->GetSrcRect().GetY(),                                                       pFX->GetSrcRect().GetWidth(),                                                       pFX->GetSrcRect().GetHeight());                                pNewEffect->SetAspectFlag(pFX->GetAspectFlag());                            }                            break;                    }                    // Add the effect to the PXRealPixFile object                    pFile->AddEffect(pNewEffect);                }                HX_RELEASE(pNewEffect);            }        }    }    else    {        retVal = HXR_INVALID_PARAMETER;    }    return retVal;}

⌨️ 快捷键说明

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