From 21290602d80715938c55384401eb5ac84157599e Mon Sep 17 00:00:00 2001 From: shatty Date: Mon, 19 Jan 2004 19:13:29 +0000 Subject: [PATCH] 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 --- .../media/plugins/ogg/OggReaderPlugin.cpp | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/add-ons/media/plugins/ogg/OggReaderPlugin.cpp b/src/add-ons/media/plugins/ogg/OggReaderPlugin.cpp index 2057b1f6a2..e5d05dd539 100644 --- a/src/add-ons/media/plugins/ogg/OggReaderPlugin.cpp +++ b/src/add-ons/media/plugins/ogg/OggReaderPlugin.cpp @@ -125,7 +125,13 @@ oggReader::Sniff(int32 *streamCount) off_t current_position = 0; if (fSeekable) { 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; @@ -169,7 +175,13 @@ oggReader::Sniff(int32 *streamCount) *streamCount = fStreams.size(); if (fSeekable) { 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; } @@ -257,8 +269,9 @@ oggReader::GetStreamInfo(void *cookie, int64 *frameCount, bigtime_t *duration, *duration = INT64_MAX; } ogg_packet * packet = &fInitialHeaderPackets[stream->serialno]; - *infoBuffer = (void*)packet; - *infoSize = sizeof(ogg_packet); + format->SetMetaData((void*)packet,sizeof(ogg_packet)); + *infoBuffer = 0; + *infoSize = 0; return B_OK; }