/src/vlc/contrib/x86_64-unknown-linux-gnu/include/ebml/MemReadIOCallback.h
Line | Count | Source |
1 | | /**************************************************************************** |
2 | | ** libebml : parse EBML files, see http://embl.sourceforge.net/ |
3 | | ** |
4 | | ** <file/class description> |
5 | | ** |
6 | | ** Copyright (C) 2014 Moritz Bunkus. All rights reserved. |
7 | | ** |
8 | | ** This library is free software; you can redistribute it and/or |
9 | | ** modify it under the terms of the GNU Lesser General Public |
10 | | ** License as published by the Free Software Foundation; either |
11 | | ** version 2.1 of the License, or (at your option) any later version. |
12 | | ** |
13 | | ** This library is distributed in the hope that it will be useful, |
14 | | ** but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 | | ** Lesser General Public License for more details. |
17 | | ** |
18 | | ** You should have received a copy of the GNU Lesser General Public |
19 | | ** License along with this library; if not, write to the Free Software |
20 | | ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
21 | | ** |
22 | | ** See http://www.matroska.org/license/lgpl/ for LGPL licensing information. |
23 | | ** |
24 | | ** Contact license@matroska.org if any conditions of this licensing are |
25 | | ** not clear to you. |
26 | | ** |
27 | | **********************************************************************/ |
28 | | |
29 | | /*! |
30 | | \file |
31 | | \author Moritz Bunkus <moritz@bunkus.org> |
32 | | */ |
33 | | #ifndef LIBEBML_MEMREADIOCALLBACK_H |
34 | | #define LIBEBML_MEMREADIOCALLBACK_H |
35 | | |
36 | | #include "EbmlBinary.h" |
37 | | #include "IOCallback.h" |
38 | | |
39 | | namespace libebml { |
40 | | |
41 | | class EBML_DLL_API MemReadIOCallback : public IOCallback { |
42 | | protected: |
43 | | uint8 const *mStart, *mEnd, *mPtr; |
44 | | |
45 | | public: |
46 | | MemReadIOCallback(void const *Ptr, size_t Size); |
47 | | MemReadIOCallback(EbmlBinary const &Binary); |
48 | | MemReadIOCallback(MemReadIOCallback const &Mem); |
49 | | ~MemReadIOCallback() override = default; |
50 | | |
51 | | uint32 read(void *Buffer, size_t Size) override; |
52 | | void setFilePointer(int64 Offset, seek_mode Mode = seek_beginning) override; |
53 | | size_t write(void const *, size_t) override { return 0; } |
54 | | uint64 getFilePointer() override { return mPtr - mStart; } |
55 | | void close() override {} |
56 | 0 | binary const *GetDataBuffer() const { return mPtr; } |
57 | 0 | uint64 GetDataBufferSize() const { return mEnd - mStart; } |
58 | | |
59 | | protected: |
60 | | void Init(void const *Ptr, size_t Size); |
61 | | }; |
62 | | |
63 | | } // namespace libebml |
64 | | |
65 | | #endif // LIBEBML_MEMREADIOCALLBACK_H |