| 72 | } |
| 73 | |
| 74 | size_t FileHandle::Read(char *buffer, size_t size) { |
| 75 | int count = avio_read(avio, (unsigned char *)buffer, size); |
| 76 | if (count < 0) { |
| 77 | throw FFMS_Exception(error_source, FFMS_ERROR_FILE_READ, |
| 78 | "Failed to read from '" + filename + "': " + AVErrorToString(count)); |
| 79 | } else if (avio_feof(avio)) { |
| 80 | // "Similar to feof() but also returns nonzero on read errors" -- FFmpeg docs |
| 81 | if (avio->error != 0 && avio->error != AVERROR_EOF) { |
| 82 | throw FFMS_Exception(error_source, FFMS_ERROR_FILE_READ, |
| 83 | "Failed to read from '" + filename + "': " + AVErrorToString(avio->error)); |
| 84 | } |
| 85 | } |
| 86 | return (size_t)count; |
| 87 | } |
| 88 | |
| 89 | size_t FileHandle::Write(const char *buffer, size_t size) { |
| 90 | avio_write(avio, (const unsigned char *)buffer, size); |
nothing calls this directly
no test coverage detected