xref: /aosp_15_r20/external/libaom/third_party/libwebm/mkvparser/mkvreader.h (revision 77c1e3ccc04c968bd2bc212e87364f250e820521)
1*77c1e3ccSAndroid Build Coastguard Worker // Copyright (c) 2010 The WebM project authors. All Rights Reserved.
2*77c1e3ccSAndroid Build Coastguard Worker //
3*77c1e3ccSAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license
4*77c1e3ccSAndroid Build Coastguard Worker // that can be found in the LICENSE file in the root of the source
5*77c1e3ccSAndroid Build Coastguard Worker // tree. An additional intellectual property rights grant can be found
6*77c1e3ccSAndroid Build Coastguard Worker // in the file PATENTS.  All contributing project authors may
7*77c1e3ccSAndroid Build Coastguard Worker // be found in the AUTHORS file in the root of the source tree.
8*77c1e3ccSAndroid Build Coastguard Worker #ifndef MKVPARSER_MKVREADER_H_
9*77c1e3ccSAndroid Build Coastguard Worker #define MKVPARSER_MKVREADER_H_
10*77c1e3ccSAndroid Build Coastguard Worker 
11*77c1e3ccSAndroid Build Coastguard Worker #include <cstdio>
12*77c1e3ccSAndroid Build Coastguard Worker 
13*77c1e3ccSAndroid Build Coastguard Worker #include "mkvparser/mkvparser.h"
14*77c1e3ccSAndroid Build Coastguard Worker 
15*77c1e3ccSAndroid Build Coastguard Worker namespace mkvparser {
16*77c1e3ccSAndroid Build Coastguard Worker 
17*77c1e3ccSAndroid Build Coastguard Worker class MkvReader : public IMkvReader {
18*77c1e3ccSAndroid Build Coastguard Worker  public:
19*77c1e3ccSAndroid Build Coastguard Worker   MkvReader();
20*77c1e3ccSAndroid Build Coastguard Worker   explicit MkvReader(FILE* fp);
21*77c1e3ccSAndroid Build Coastguard Worker   virtual ~MkvReader();
22*77c1e3ccSAndroid Build Coastguard Worker 
23*77c1e3ccSAndroid Build Coastguard Worker   int Open(const char*);
24*77c1e3ccSAndroid Build Coastguard Worker   void Close();
25*77c1e3ccSAndroid Build Coastguard Worker 
26*77c1e3ccSAndroid Build Coastguard Worker   virtual int Read(long long position, long length, unsigned char* buffer);
27*77c1e3ccSAndroid Build Coastguard Worker   virtual int Length(long long* total, long long* available);
28*77c1e3ccSAndroid Build Coastguard Worker 
29*77c1e3ccSAndroid Build Coastguard Worker  private:
30*77c1e3ccSAndroid Build Coastguard Worker   MkvReader(const MkvReader&);
31*77c1e3ccSAndroid Build Coastguard Worker   MkvReader& operator=(const MkvReader&);
32*77c1e3ccSAndroid Build Coastguard Worker 
33*77c1e3ccSAndroid Build Coastguard Worker   // Determines the size of the file. This is called either by the constructor
34*77c1e3ccSAndroid Build Coastguard Worker   // or by the Open function depending on file ownership. Returns true on
35*77c1e3ccSAndroid Build Coastguard Worker   // success.
36*77c1e3ccSAndroid Build Coastguard Worker   bool GetFileSize();
37*77c1e3ccSAndroid Build Coastguard Worker 
38*77c1e3ccSAndroid Build Coastguard Worker   long long m_length;
39*77c1e3ccSAndroid Build Coastguard Worker   FILE* m_file;
40*77c1e3ccSAndroid Build Coastguard Worker   bool reader_owns_file_;
41*77c1e3ccSAndroid Build Coastguard Worker };
42*77c1e3ccSAndroid Build Coastguard Worker 
43*77c1e3ccSAndroid Build Coastguard Worker }  // namespace mkvparser
44*77c1e3ccSAndroid Build Coastguard Worker 
45*77c1e3ccSAndroid Build Coastguard Worker #endif  // MKVPARSER_MKVREADER_H_
46