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

Function decoder_file_decode

src/decoder/Thread.cxx:158–190  ·  view source on GitHub ↗

* Decode a file with the given decoder plugin. * * Caller holds DecoderControl::mutex. */

Source from the content-addressed store, hash-verified

156 * Caller holds DecoderControl::mutex.
157 */
158static DecodeResult
159decoder_file_decode(const DecoderPlugin &plugin,
160 DecoderBridge &bridge, Path path)
161{
162 assert(plugin.file_decode != nullptr);
163 assert(bridge.stream_tag == nullptr);
164 assert(bridge.decoder_tag == nullptr);
165 assert(!path.IsNull());
166 assert(path.IsAbsolute());
167 assert(bridge.dc.state == DecoderState::START);
168
169 FmtDebug(decoder_thread_domain, "probing plugin {}", plugin.name);
170
171 if (bridge.dc.command == DecoderCommand::STOP)
172 return DecodeResult::STOP;
173
174 {
175 const ScopeUnlock unlock(bridge.dc.mutex);
176
177 FmtThreadName("decoder:{}", plugin.name);
178
179 plugin.FileDecode(bridge, path);
180
181 SetThreadName("decoder");
182 }
183
184 assert(bridge.dc.state == DecoderState::START ||
185 bridge.dc.state == DecoderState::DECODE);
186
187 return bridge.dc.state == DecoderState::START
188 ? DecodeResult::UNRECOGNIZED_FILE
189 : DecodeResult::SUCCESS;
190}
191
192[[gnu::pure]]
193static bool

Callers 2

TryDecoderFileFunction · 0.85
TryContainerDecoderFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected