MCPcopy Create free account
hub / github.com/SFML/SFML / createReaderFromStream

Method createReaderFromStream

src/SFML/Audio/SoundFileFactory.cpp:103–121  ·  view source on GitHub ↗

///////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

101
102////////////////////////////////////////////////////////////
103std::unique_ptr<SoundFileReader> SoundFileFactory::createReaderFromStream(InputStream& stream)
104{
105 // Test the stream for all the registered factories
106 for (const auto& [fpCreate, fpCheck] : getReaderFactoryMap())
107 {
108 if (!stream.seek(0).has_value())
109 {
110 err() << "Failed to seek sound stream" << std::endl;
111 return nullptr;
112 }
113
114 if (fpCheck(stream))
115 return fpCreate();
116 }
117
118 // No suitable reader found
119 err() << "Failed to open sound file from stream (format not supported)" << std::endl;
120 return nullptr;
121}
122
123
124////////////////////////////////////////////////////////////

Callers

nothing calls this directly

Calls 1

seekMethod · 0.45

Tested by

no test coverage detected