7 #ifndef PACKAGER_FILE_THREADED_IO_FILE_H_
8 #define PACKAGER_FILE_THREADED_IO_FILE_H_
10 #include "packager/base/atomicops.h"
11 #include "packager/base/memory/scoped_ptr.h"
12 #include "packager/base/synchronization/waitable_event.h"
13 #include "packager/media/file/file.h"
14 #include "packager/media/file/file_closer.h"
15 #include "packager/media/file/io_cache.h"
17 namespace edash_packager {
30 uint64_t io_cache_size,
31 uint64_t io_block_size);
35 bool Close()
override;
36 int64_t
Read(
void* buffer, uint64_t length)
override;
37 int64_t
Write(
const void* buffer, uint64_t length)
override;
38 int64_t
Size()
override;
39 bool Flush()
override;
40 bool Seek(uint64_t position)
override;
41 bool Tell(uint64_t* position)
override;
53 void RunInInputMode();
54 void RunInOutputMode();
56 scoped_ptr<File, FileCloser> internal_file_;
59 std::vector<uint8_t> io_buffer_;
62 base::subtle::Atomic32 eof_;
64 base::WaitableEvent flush_complete_event_;
65 base::subtle::Atomic32 internal_file_error_;
67 base::WaitableEvent task_exit_event_;
75 #endif // PACKAGER_FILE_THREADED_IO_FILE_H