7 #ifndef PACKAGER_FILE_THREADED_IO_FILE_H_
8 #define PACKAGER_FILE_THREADED_IO_FILE_H_
10 #include "packager/base/memory/scoped_ptr.h"
11 #include "packager/base/synchronization/lock.h"
12 #include "packager/media/file/file.h"
13 #include "packager/media/file/file_closer.h"
14 #include "packager/media/file/io_cache.h"
16 namespace edash_packager {
31 uint64_t io_cache_size,
32 uint64_t io_block_size);
36 virtual bool Close() OVERRIDE;
37 virtual int64_t
Read(
void* buffer, uint64_t length) OVERRIDE;
38 virtual int64_t
Write(
const void* buffer, uint64_t length) OVERRIDE;
39 virtual int64_t
Size() OVERRIDE;
40 virtual bool Flush() OVERRIDE;
41 virtual bool Seek(uint64_t position) OVERRIDE;
42 virtual bool Tell(uint64_t* position) OVERRIDE;
48 virtual bool Open() OVERRIDE;
50 void RunInInputMode();
51 void RunInOutputMode();
54 scoped_ptr<File, FileCloser> internal_file_;
57 std::vector<uint8_t> io_buffer_;
58 scoped_ptr<ClosureThread> thread_;
61 int64_t internal_file_error_;
69 #endif // PACKAGER_FILE_THREADED_IO_FILE_H