perfect replay
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6276 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -8,6 +8,12 @@ OggFrameInfo::OggFrameInfo(uint page, uint packetonpage, uint packet)
|
||||
this->packet = packet;
|
||||
}
|
||||
|
||||
void
|
||||
OggFrameInfo::SetNext(uint page, uint packetonpage, uint packet)
|
||||
{
|
||||
nextpage = page;
|
||||
nextpacketonpage = packetonpage;
|
||||
}
|
||||
|
||||
/* virtual */
|
||||
OggFrameInfo::~OggFrameInfo()
|
||||
@@ -31,3 +37,21 @@ OggFrameInfo::GetPacket() const
|
||||
{
|
||||
return packet;
|
||||
}
|
||||
|
||||
uint
|
||||
OggFrameInfo::GetNextPage() const
|
||||
{
|
||||
return nextpage;
|
||||
}
|
||||
|
||||
uint
|
||||
OggFrameInfo::GetNextPacketOnPage() const
|
||||
{
|
||||
return nextpacketonpage;
|
||||
}
|
||||
|
||||
uint
|
||||
OggFrameInfo::GetNextPacket() const
|
||||
{
|
||||
return packet+1;
|
||||
}
|
||||
|
||||
@@ -7,14 +7,21 @@ class OggFrameInfo {
|
||||
public:
|
||||
OggFrameInfo(uint page, uint packetonpage, uint packet);
|
||||
virtual ~OggFrameInfo();
|
||||
void SetNext(uint page, uint packetonpage, uint packet);
|
||||
|
||||
uint GetPage() const;
|
||||
uint GetPacketOnPage() const;
|
||||
uint GetPacket() const;
|
||||
uint GetNextPage() const;
|
||||
uint GetNextPacketOnPage() const;
|
||||
uint GetNextPacket() const;
|
||||
private:
|
||||
uint page; // the page the frame started on
|
||||
uint packetonpage; // of all the packets on that page which packet is this
|
||||
uint packet; // the packet the frame started on
|
||||
uint nextpage; // the next page after this page
|
||||
uint nextpacketonpage; // of all the packets on next page which packet is the next
|
||||
uint nextpacket; // the next packet after this packet
|
||||
};
|
||||
|
||||
#endif _OGG_FRAME_INFO_H
|
||||
|
||||
@@ -200,9 +200,9 @@ OggStream::Seek(uint32 seekTo, int64 *frame, bigtime_t *time)
|
||||
fSeekStreamState = seekStreamState;
|
||||
// we notably do not clear our temporary stream
|
||||
// instead we just let it go out of scope
|
||||
fCurrentPage = fOggFrameInfos[*frame].GetPage();
|
||||
fPacketOnCurrentPage = fOggFrameInfos[*frame].GetPacketOnPage();
|
||||
fCurrentPacket = fOggFrameInfos[*frame].GetPacket();
|
||||
fCurrentPage = fOggFrameInfos[*frame].GetNextPage();
|
||||
fPacketOnCurrentPage = fOggFrameInfos[*frame].GetNextPacketOnPage();
|
||||
fCurrentPacket = fOggFrameInfos[*frame].GetNextPacket();
|
||||
} else if (seekTo & B_MEDIA_SEEK_TO_TIME) {
|
||||
*frame = *time/50000;
|
||||
return Seek(B_MEDIA_SEEK_TO_FRAME,frame,time);
|
||||
@@ -221,6 +221,9 @@ OggStream::GetNextChunk(void **chunkBuffer, int32 *chunkSize,
|
||||
fOggFrameInfos.push_back(info);
|
||||
}
|
||||
status_t result = GetPacket(&packet);
|
||||
if (fCurrentPacket - fHeaderPackets.size() == fOggFrameInfos.size()) {
|
||||
fOggFrameInfos[fOggFrameInfos.size()-1].SetNext(fEndPage,fPacketOnEndPage,fEndPacket);
|
||||
}
|
||||
if (result != B_OK) {
|
||||
TRACE("OggStream::GetNextChunk failed: GetPacket = %s\n", strerror(result));
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user