MCPcopy Create free account
hub / github.com/MusicPlayerDaemon/MPD / OpenFileInputStream

Function OpenFileInputStream

src/input/plugins/FileInputPlugin.cxx:42–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40};
41
42InputStreamPtr
43OpenFileInputStream(Path path, Mutex &mutex)
44{
45 FileReader reader(path);
46
47 const FileInfo info = reader.GetFileInfo();
48
49 if (!info.IsRegular())
50 throw FmtRuntimeError("Not a regular file: {}", path);
51
52#ifdef POSIX_FADV_SEQUENTIAL
53 posix_fadvise(reader.GetFD().Get(), (off_t)0, info.GetSize(),
54 POSIX_FADV_SEQUENTIAL);
55#endif
56
57 return std::make_unique<FileInputStream>(path.ToUTF8Throw().c_str(),
58 std::move(reader), info.GetSize(),
59 mutex);
60}
61
62void
63FileInputStream::Seek(std::unique_lock<Mutex> &lock,

Callers 1

OpenLocalInputStreamFunction · 0.85

Calls 4

GetFileInfoMethod · 0.80
ToUTF8ThrowMethod · 0.80
GetMethod · 0.45
GetSizeMethod · 0.45

Tested by

no test coverage detected