diff --git a/src/add-ons/media/plugins/matroska/libMatroskaParser/StreamIO.cpp b/src/add-ons/media/plugins/matroska/libMatroskaParser/StreamIO.cpp index 693bbb1e0f..feb5175f56 100644 --- a/src/add-ons/media/plugins/matroska/libMatroskaParser/StreamIO.cpp +++ b/src/add-ons/media/plugins/matroska/libMatroskaParser/StreamIO.cpp @@ -1,8 +1,36 @@ +/* + * Copyright (c) 2004, Marcus Overhagen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ #include #include #include "StreamIO.h" +struct StreamIO { + FileCache filecache; + BPositionIO *source; +}; static int stream_read(struct FileCache *cc, ulonglong pos, void *buffer, int count) @@ -12,9 +40,9 @@ stream_read(struct FileCache *cc, ulonglong pos, void *buffer, int count) static longlong -stream_scan(struct FileCache *cc,ulonglong start,unsigned signature) +stream_scan(struct FileCache *cc, ulonglong start, unsigned signature) { - return 0; + return -1; } @@ -27,7 +55,7 @@ stream_close(struct FileCache *cc) static unsigned stream_getsize(struct FileCache *cc) { - return reinterpret_cast(cc)->source->Seek(0, SEEK_END); + return 524288; } @@ -51,12 +79,12 @@ CreateFileCache(BDataIO *dataio) if (!io) return NULL; - io->source = posio; io->filecache.read = &stream_read; io->filecache.scan = &stream_scan; io->filecache.close = &stream_close; io->filecache.getsize = &stream_getsize; io->filecache.geterror = &stream_geterror; + io->source = posio; return reinterpret_cast(io); } diff --git a/src/add-ons/media/plugins/matroska/libMatroskaParser/StreamIO.h b/src/add-ons/media/plugins/matroska/libMatroskaParser/StreamIO.h index 447800d52e..8301e36b9a 100644 --- a/src/add-ons/media/plugins/matroska/libMatroskaParser/StreamIO.h +++ b/src/add-ons/media/plugins/matroska/libMatroskaParser/StreamIO.h @@ -1,11 +1,33 @@ +/* + * Copyright (c) 2004, Marcus Overhagen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _STREAM_IO_H +#define _STREAM_IO_H #include - #include "MatroskaParser.h" -struct StreamIO { - FileCache filecache; - BPositionIO *source; -}; - FileCache *CreateFileCache(BDataIO *dataio); + +#endif