Ticket #2665: APE_reader.diff

File APE_reader.diff, 1.7 KB (added by shinta, 16 years ago)

Patch for seek

  • APE_reader/APEReader.cpp

     
    22
    33/*============================================================================*/
    44const char* gAppName = "APE (Monkey's Audio) reader";
    5 const char* gAppVer = "Ver 1.12";
    6 const char* gCright = "Copyright "B_UTF8_COPYRIGHT" 2005-2008 by SHINTA";
     5const char* gAppVer = "Ver 1.13";
     6const char* gCright = "Copyright "B_UTF8_COPYRIGHT" 2005-2009 by SHINTA";
    77const char* gAppSignature = "application/x-vnd.SHINTA-MediaKitAPEReader";
    88/*============================================================================*/
    99
     
    139139//------------------------------------------------------------------------------
    140140status_t    TAPEReader::Seek(void* oCookie, uint32 oFlags, int64* oFrame, bigtime_t* oTime)
    141141{
    142     return B_ERROR;
    143 #if 0   // not work in Haiku
    144142    int32       aNewBlock;
    145143
    146144    if ( oFlags&B_MEDIA_SEEK_TO_FRAME ) {
    147         DBEXP("TAPEReader::Seek()", "Seek by frame not supported yet");
    148         return B_ERROR;
     145        aNewBlock = *oFrame;
    149146    } else if ( oFlags&B_MEDIA_SEEK_TO_TIME ) {
    150         DBEXP("TAPEReader::Seek() - B_MEDIA_SEEK_TO_TIME", *oTime);
    151147        aNewBlock = (*oTime)/1000*mDecomp->GetInfo(APE_DECOMPRESS_TOTAL_BLOCKS)/mDecomp->GetInfo(APE_DECOMPRESS_LENGTH_MS);
    152         DBEXP("TAPEReader::Seek() - aNewBlock", aNewBlock);
    153148    } else {
    154149        return B_ERROR;
    155150    }
    156151    mReadPosTotal = aNewBlock*mDecomp->GetInfo(APE_INFO_BLOCK_ALIGN);
    157     int a = mDecomp->Seek(aNewBlock);
     152    mDecomp->Seek(aNewBlock);
    158153    ReadBlocks();
    159154    return B_OK;
    160 #endif
    161155}
    162156//------------------------------------------------------------------------------
    163157status_t    TAPEReader::Sniff(int32* oStreamCount)