Delete class PlatformFile.
Add seek methods to FileWrapper, and refactor WavReader to use that
class instead.
Bug: webrtc:6463
Change-Id: Ifbb1989a072da6280ea5fc04b4beff991614dd53
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/147265
Commit-Queue: Niels Moller <nisse@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28770}
diff --git a/rtc_base/system/file_wrapper.h b/rtc_base/system/file_wrapper.h
index 9062abd..63d1c17 100644
--- a/rtc_base/system/file_wrapper.h
+++ b/rtc_base/system/file_wrapper.h
@@ -72,11 +72,23 @@
// Seeks to the beginning of file. Returns true on success, false on failure,
// e.g., if the underlying file isn't seekable.
- bool Rewind();
+ bool Rewind() { return SeekTo(0); }
+ // TODO(nisse): The seek functions are used only by the WavReader. If that
+ // code is demoted to test code, seek functions can be deleted from this
+ // utility.
+ // Seek relative to current file position.
+ bool SeekRelative(int64_t offset);
+ // Seek to given position.
+ bool SeekTo(int64_t position);
// Returns number of bytes read. Short count indicates EOF or error.
size_t Read(void* buf, size_t length);
+ // If the most recent Read() returned a short count, this methods returns true
+ // if the short count was due to EOF, and false it it was due to some i/o
+ // error.
+ bool ReadEof() const;
+
// Returns true if all data was successfully written (or buffered), or false
// if there was an error. Writing buffered data can fail later, and is
// reported with return value from Flush or Close.