193a74791c8e808ea76001ee07693aa2a5fdd3500johannkoenig@chromium.org// Copyright (c) 2010 The WebM project authors. All Rights Reserved. 293a74791c8e808ea76001ee07693aa2a5fdd3500johannkoenig@chromium.org// 393a74791c8e808ea76001ee07693aa2a5fdd3500johannkoenig@chromium.org// Use of this source code is governed by a BSD-style license 493a74791c8e808ea76001ee07693aa2a5fdd3500johannkoenig@chromium.org// that can be found in the LICENSE file in the root of the source 593a74791c8e808ea76001ee07693aa2a5fdd3500johannkoenig@chromium.org// tree. An additional intellectual property rights grant can be found 693a74791c8e808ea76001ee07693aa2a5fdd3500johannkoenig@chromium.org// in the file PATENTS. All contributing project authors may 793a74791c8e808ea76001ee07693aa2a5fdd3500johannkoenig@chromium.org// be found in the AUTHORS file in the root of the source tree. 893a74791c8e808ea76001ee07693aa2a5fdd3500johannkoenig@chromium.org 993a74791c8e808ea76001ee07693aa2a5fdd3500johannkoenig@chromium.org#ifndef MKVREADER_HPP 1093a74791c8e808ea76001ee07693aa2a5fdd3500johannkoenig@chromium.org#define MKVREADER_HPP 1193a74791c8e808ea76001ee07693aa2a5fdd3500johannkoenig@chromium.org 1293a74791c8e808ea76001ee07693aa2a5fdd3500johannkoenig@chromium.org#include "mkvparser.hpp" 1393a74791c8e808ea76001ee07693aa2a5fdd3500johannkoenig@chromium.org#include <cstdio> 1493a74791c8e808ea76001ee07693aa2a5fdd3500johannkoenig@chromium.org 15810cf1767dc8df4783e02ba8a712072f50ddc99efgalligan@chromium.orgnamespace mkvparser { 16810cf1767dc8df4783e02ba8a712072f50ddc99efgalligan@chromium.org 17810cf1767dc8df4783e02ba8a712072f50ddc99efgalligan@chromium.orgclass MkvReader : public IMkvReader { 18810cf1767dc8df4783e02ba8a712072f50ddc99efgalligan@chromium.org public: 19810cf1767dc8df4783e02ba8a712072f50ddc99efgalligan@chromium.org MkvReader(); 20810cf1767dc8df4783e02ba8a712072f50ddc99efgalligan@chromium.org explicit MkvReader(FILE* fp); 21810cf1767dc8df4783e02ba8a712072f50ddc99efgalligan@chromium.org virtual ~MkvReader(); 22810cf1767dc8df4783e02ba8a712072f50ddc99efgalligan@chromium.org 23810cf1767dc8df4783e02ba8a712072f50ddc99efgalligan@chromium.org int Open(const char*); 24810cf1767dc8df4783e02ba8a712072f50ddc99efgalligan@chromium.org void Close(); 25810cf1767dc8df4783e02ba8a712072f50ddc99efgalligan@chromium.org 26810cf1767dc8df4783e02ba8a712072f50ddc99efgalligan@chromium.org virtual int Read(long long position, long length, unsigned char* buffer); 27810cf1767dc8df4783e02ba8a712072f50ddc99efgalligan@chromium.org virtual int Length(long long* total, long long* available); 28810cf1767dc8df4783e02ba8a712072f50ddc99efgalligan@chromium.org 29810cf1767dc8df4783e02ba8a712072f50ddc99efgalligan@chromium.org private: 30810cf1767dc8df4783e02ba8a712072f50ddc99efgalligan@chromium.org MkvReader(const MkvReader&); 31810cf1767dc8df4783e02ba8a712072f50ddc99efgalligan@chromium.org MkvReader& operator=(const MkvReader&); 32810cf1767dc8df4783e02ba8a712072f50ddc99efgalligan@chromium.org 33810cf1767dc8df4783e02ba8a712072f50ddc99efgalligan@chromium.org // Determines the size of the file. This is called either by the constructor 34810cf1767dc8df4783e02ba8a712072f50ddc99efgalligan@chromium.org // or by the Open function depending on file ownership. Returns true on 35810cf1767dc8df4783e02ba8a712072f50ddc99efgalligan@chromium.org // success. 36810cf1767dc8df4783e02ba8a712072f50ddc99efgalligan@chromium.org bool GetFileSize(); 37810cf1767dc8df4783e02ba8a712072f50ddc99efgalligan@chromium.org 38810cf1767dc8df4783e02ba8a712072f50ddc99efgalligan@chromium.org long long m_length; 39810cf1767dc8df4783e02ba8a712072f50ddc99efgalligan@chromium.org FILE* m_file; 40810cf1767dc8df4783e02ba8a712072f50ddc99efgalligan@chromium.org bool reader_owns_file_; 4193a74791c8e808ea76001ee07693aa2a5fdd3500johannkoenig@chromium.org}; 4293a74791c8e808ea76001ee07693aa2a5fdd3500johannkoenig@chromium.org 43810cf1767dc8df4783e02ba8a712072f50ddc99efgalligan@chromium.org} // end namespace mkvparser 4493a74791c8e808ea76001ee07693aa2a5fdd3500johannkoenig@chromium.org 45810cf1767dc8df4783e02ba8a712072f50ddc99efgalligan@chromium.org#endif // MKVREADER_HPP 46