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 15namespace mkvparser 16{ 17 18class MkvReader : public IMkvReader 19{ 20 MkvReader(const MkvReader&); 21 MkvReader& operator=(const MkvReader&); 22public: 23 MkvReader(); 24 MkvReader(FILE* fp); 25 virtual ~MkvReader(); 26 27 int Open(const char*); 28 void Close(); 29 30 virtual int Read(long long position, long length, unsigned char* buffer); 31 virtual int Length(long long* total, long long* available); 32private: 33 34 // Determines the size of the file. This is called either by the constructor 35 // or by the Open function depending on file ownership. Returns true on 36 // success. 37 bool GetFileSize(); 38 39 long long m_length; 40 FILE* m_file; 41 bool reader_owns_file_; 42}; 43 44} //end namespace mkvparser 45 46#endif //MKVREADER_HPP 47