Add seeking support (my first commit from haiku)
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30143 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
73677f785a
commit
c1ee694618
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
/*============================================================================*/
|
/*============================================================================*/
|
||||||
const char* gAppName = "APE (Monkey's Audio) reader";
|
const char* gAppName = "APE (Monkey's Audio) reader";
|
||||||
const char* gAppVer = "Ver 1.12";
|
const char* gAppVer = "Ver 1.13";
|
||||||
const char* gCright = "Copyright "B_UTF8_COPYRIGHT" 2005-2008 by SHINTA";
|
const char* gCright = "Copyright "B_UTF8_COPYRIGHT" 2005-2009 by SHINTA";
|
||||||
const char* gAppSignature = "application/x-vnd.SHINTA-MediaKitAPEReader";
|
const char* gAppSignature = "application/x-vnd.SHINTA-MediaKitAPEReader";
|
||||||
/*============================================================================*/
|
/*============================================================================*/
|
||||||
|
|
||||||
|
@ -137,27 +137,39 @@ status_t TAPEReader::ReadBlocks()
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
status_t TAPEReader::Seek(void* oCookie, uint32 oFlags, int64* oFrame, bigtime_t* oTime)
|
|
||||||
|
status_t TAPEReader::FindKeyFrame(void* cookie, uint32 flags,
|
||||||
|
int64* frame, bigtime_t* time)
|
||||||
{
|
{
|
||||||
|
printf("FindKeyFrame for time %Ld or frame %Ld\n",*time,*frame);
|
||||||
|
if ( flags & B_MEDIA_SEEK_TO_FRAME ) {
|
||||||
|
*time = *frame * 1000 / mDecomp->GetInfo(APE_DECOMPRESS_TOTAL_BLOCKS) * mDecomp->GetInfo(APE_DECOMPRESS_LENGTH_MS);
|
||||||
|
} else if ( flags & B_MEDIA_SEEK_TO_TIME ) {
|
||||||
|
*frame = (*time)/1000*mDecomp->GetInfo(APE_DECOMPRESS_TOTAL_BLOCKS)/mDecomp->GetInfo(APE_DECOMPRESS_LENGTH_MS);
|
||||||
|
} else {
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
#if 0 // not work in Haiku
|
}
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
status_t TAPEReader::Seek(void *cookie, uint32 flags,
|
||||||
|
int64 *frame, bigtime_t *time)
|
||||||
|
{
|
||||||
int32 aNewBlock;
|
int32 aNewBlock;
|
||||||
|
|
||||||
if ( oFlags&B_MEDIA_SEEK_TO_FRAME ) {
|
printf("Seek for time %Ld or frame %Ld\n",*time,*frame);
|
||||||
DBEXP("TAPEReader::Seek()", "Seek by frame not supported yet");
|
if ( flags & B_MEDIA_SEEK_TO_FRAME ) {
|
||||||
return B_ERROR;
|
aNewBlock = *frame;
|
||||||
} else if ( oFlags&B_MEDIA_SEEK_TO_TIME ) {
|
} else if ( flags & B_MEDIA_SEEK_TO_TIME ) {
|
||||||
DBEXP("TAPEReader::Seek() - B_MEDIA_SEEK_TO_TIME", *oTime);
|
aNewBlock = (*time)/1000*mDecomp->GetInfo(APE_DECOMPRESS_TOTAL_BLOCKS)/mDecomp->GetInfo(APE_DECOMPRESS_LENGTH_MS);
|
||||||
aNewBlock = (*oTime)/1000*mDecomp->GetInfo(APE_DECOMPRESS_TOTAL_BLOCKS)/mDecomp->GetInfo(APE_DECOMPRESS_LENGTH_MS);
|
|
||||||
DBEXP("TAPEReader::Seek() - aNewBlock", aNewBlock);
|
|
||||||
} else {
|
} else {
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
mReadPosTotal = aNewBlock*mDecomp->GetInfo(APE_INFO_BLOCK_ALIGN);
|
mReadPosTotal = aNewBlock*mDecomp->GetInfo(APE_INFO_BLOCK_ALIGN);
|
||||||
int a = mDecomp->Seek(aNewBlock);
|
mDecomp->Seek(aNewBlock);
|
||||||
ReadBlocks();
|
ReadBlocks();
|
||||||
return B_OK;
|
return B_OK;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
status_t TAPEReader::Sniff(int32* oStreamCount)
|
status_t TAPEReader::Sniff(int32* oStreamCount)
|
||||||
|
|
|
@ -31,7 +31,11 @@ public:
|
||||||
virtual status_t GetStreamInfo(void* oCookie, int64* oFrameCount, bigtime_t* oDuration, media_format* oFormat,
|
virtual status_t GetStreamInfo(void* oCookie, int64* oFrameCount, bigtime_t* oDuration, media_format* oFormat,
|
||||||
const void** oInfoBuffer, size_t* oInfoSize);
|
const void** oInfoBuffer, size_t* oInfoSize);
|
||||||
|
|
||||||
virtual status_t Seek(void* oCookie, uint32 oFlags, int64* oFrame, bigtime_t* oTime);
|
virtual status_t Seek(void *cookie, uint32 flags,
|
||||||
|
int64 *frame, bigtime_t *time);
|
||||||
|
|
||||||
|
virtual status_t FindKeyFrame(void* cookie, uint32 flags,
|
||||||
|
int64* frame, bigtime_t* time);
|
||||||
|
|
||||||
virtual status_t GetNextChunk(void* oCookie, const void** oChunkBuffer, size_t* oChunkSize, media_header* oMediaHeader);
|
virtual status_t GetNextChunk(void* oCookie, const void** oChunkBuffer, size_t* oChunkSize, media_header* oMediaHeader);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue