better Seek failure handling, use MetaData to pass information to decoder, do not use infoBuffer

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6149 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
shatty 2004-01-19 19:13:29 +00:00
parent e065a2e0e7
commit 21290602d8

View File

@ -125,7 +125,13 @@ oggReader::Sniff(int32 *streamCount)
off_t current_position = 0; off_t current_position = 0;
if (fSeekable) { if (fSeekable) {
current_position = fSeekable->Seek(0,SEEK_CUR); current_position = fSeekable->Seek(0,SEEK_CUR);
fSeekable->Seek(0,SEEK_SET); if (current_position < 0) {
fSeekable = 0;
} else {
if (fSeekable->Seek(0,SEEK_SET) < 0) {
fSeekable = 0;
}
}
} }
ogg_page page; ogg_page page;
@ -169,7 +175,13 @@ oggReader::Sniff(int32 *streamCount)
*streamCount = fStreams.size(); *streamCount = fStreams.size();
if (fSeekable) { if (fSeekable) {
fPostSniffPosition = fSeekable->Seek(0,SEEK_CUR); fPostSniffPosition = fSeekable->Seek(0,SEEK_CUR);
fSeekable->Seek(current_position,SEEK_SET); if (fPostSniffPosition < 0) {
fSeekable = 0;
} else {
if (fSeekable->Seek(current_position,SEEK_SET) < 0) {
fSeekable = 0;
}
}
} }
return B_OK; return B_OK;
} }
@ -257,8 +269,9 @@ oggReader::GetStreamInfo(void *cookie, int64 *frameCount, bigtime_t *duration,
*duration = INT64_MAX; *duration = INT64_MAX;
} }
ogg_packet * packet = &fInitialHeaderPackets[stream->serialno]; ogg_packet * packet = &fInitialHeaderPackets[stream->serialno];
*infoBuffer = (void*)packet; format->SetMetaData((void*)packet,sizeof(ogg_packet));
*infoSize = sizeof(ogg_packet); *infoBuffer = 0;
*infoSize = 0;
return B_OK; return B_OK;
} }