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/lock.h"
13 #include "packager/base/synchronization/waitable_event.h"
14 #include "packager/media/file/file.h"
15 #include "packager/media/file/file_closer.h"
16 #include "packager/media/file/io_cache.h"
18 namespace edash_packager {
33 uint64_t io_cache_size,
34 uint64_t io_block_size);
38 bool Close()
override;
39 int64_t
Read(
void* buffer, uint64_t length)
override;
40 int64_t
Write(
const void* buffer, uint64_t length)
override;
41 int64_t
Size()
override;
42 bool Flush()
override;
43 bool Seek(uint64_t position)
override;
44 bool Tell(uint64_t* position)
override;
52 void RunInInputMode();
53 void RunInOutputMode();
56 scoped_ptr<File, FileCloser> internal_file_;
59 std::vector<uint8_t> io_buffer_;
60 scoped_ptr<ClosureThread> thread_;
62 base::subtle::Atomic32 eof_;
64 base::WaitableEvent flush_complete_event_;
65 base::subtle::Atomic32 internal_file_error_;
73 #endif // PACKAGER_FILE_THREADED_IO_FILE_H