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