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

Function OpenArchiveInputStream

src/input/plugins/ArchiveInputPlugin.cxx:18–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16static constexpr Domain input_domain("input");
17
18InputStreamPtr
19OpenArchiveInputStream(Path path, Mutex &mutex)
20{
21 const ArchivePlugin *arplug;
22
23 ArchiveLookupResult l;
24 try {
25 l = LookupFile(path);
26 if (l.archive.IsNull()) {
27 return nullptr;
28 }
29 } catch (...) {
30 FmtDebug(input_domain,
31 "not an archive, lookup {:?} failed: {}",
32 path, std::current_exception());
33 return nullptr;
34 }
35
36 const char *suffix = l.archive.GetExtension();
37 if (suffix == nullptr)
38 return nullptr;
39
40 //check which archive plugin to use (by ext)
41 arplug = archive_plugin_from_suffix(suffix);
42 if (!arplug) {
43 return nullptr;
44 }
45
46 return archive_file_open(arplug, l.archive)
47 ->OpenStream(l.inside.c_str(), mutex);
48}

Callers 1

OpenLocalInputStreamFunction · 0.85

Calls 5

LookupFileFunction · 0.85
archive_file_openFunction · 0.85
GetExtensionMethod · 0.80
OpenStreamMethod · 0.45

Tested by

no test coverage detected