diff options
author | Max Kellermann <max@duempel.org> | 2013-10-24 20:40:23 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-10-24 20:40:23 +0200 |
commit | dc328e0c4ad0dc6b8c53f6da2e0e85bfcefd02c9 (patch) | |
tree | caac6005330fb71551917889f6f9402a4c06de1f /src | |
parent | 92c85bd20dc4f55b53cc18887d4a6b9b165447ca (diff) | |
download | mpd-dc328e0c4ad0dc6b8c53f6da2e0e85bfcefd02c9.tar.gz mpd-dc328e0c4ad0dc6b8c53f6da2e0e85bfcefd02c9.tar.xz mpd-dc328e0c4ad0dc6b8c53f6da2e0e85bfcefd02c9.zip |
decoder/opus: move code to OggSeekPageAtOffset()
Diffstat (limited to 'src')
-rw-r--r-- | src/decoder/OggFind.cxx | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/decoder/OggFind.cxx b/src/decoder/OggFind.cxx index 297d925e7..e737a3ffe 100644 --- a/src/decoder/OggFind.cxx +++ b/src/decoder/OggFind.cxx @@ -38,6 +38,16 @@ OggFindEOS(OggSyncState &oy, ogg_stream_state &os, ogg_packet &packet) } } +static bool +OggSeekPageAtOffset(OggSyncState &oy, ogg_stream_state &os, InputStream &is, + InputStream::offset_type offset, int whence) +{ + oy.Reset(); + + return is.LockSeek(offset, whence, IgnoreError()) && + oy.ExpectPageSeekIn(os); +} + bool OggSeekFindEOS(OggSyncState &oy, ogg_stream_state &os, ogg_packet &packet, InputStream &is) @@ -48,9 +58,6 @@ OggSeekFindEOS(OggSyncState &oy, ogg_stream_state &os, ogg_packet &packet, if (!is.CheapSeeking()) return false; - oy.Reset(); - - return is.LockSeek(-65536, SEEK_END, IgnoreError()) && - oy.ExpectPageSeekIn(os) && + return OggSeekPageAtOffset(oy, os, is, -65536, SEEK_END) && OggFindEOS(oy, os, packet); } |