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 11 #include <cstdio> 12 13 #include "mkvparser/mkvparser.h" 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 } // namespace mkvparser 44 45 #endif // MKVPARSER_MKVREADER_H_ 46