mkvreader.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. #ifndef MKVPARSER_MKVREADER_H_
  9. #define MKVPARSER_MKVREADER_H_
  10. #include <cstdio>
  11. #include "mkvparser/mkvparser.h"
  12. namespace mkvparser {
  13. class MkvReader : public IMkvReader {
  14. public:
  15. MkvReader();
  16. explicit MkvReader(FILE* fp);
  17. virtual ~MkvReader();
  18. int Open(const char*);
  19. void Close();
  20. virtual int Read(long long position, long length, unsigned char* buffer);
  21. virtual int Length(long long* total, long long* available);
  22. private:
  23. MkvReader(const MkvReader&);
  24. MkvReader& operator=(const MkvReader&);
  25. // Determines the size of the file. This is called either by the constructor
  26. // or by the Open function depending on file ownership. Returns true on
  27. // success.
  28. bool GetFileSize();
  29. long long m_length;
  30. FILE* m_file;
  31. bool reader_owns_file_;
  32. };
  33. } // namespace mkvparser
  34. #endif // MKVPARSER_MKVREADER_H_