MCPcopy Create free account
hub / github.com/FFMS/ffms2 / Read

Method Read

src/core/filehandle.cpp:74–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72}
73
74size_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
89size_t FileHandle::Write(const char *buffer, size_t size) {
90 avio_write(avio, (const unsigned char *)buffer, size);

Callers

nothing calls this directly

Calls 2

FFMS_ExceptionClass · 0.85
AVErrorToStringFunction · 0.85

Tested by

no test coverage detected