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

Function TryDecoderFile

src/decoder/Thread.cxx:378–399  ·  view source on GitHub ↗

* Decode a file with the given decoder plugin. * * DecoderControl::mutex is not locked by caller. */

Source from the content-addressed store, hash-verified

376 * DecoderControl::mutex is not locked by caller.
377 */
378static DecodeResult
379TryDecoderFile(DecoderBridge &bridge, Path path_fs, std::string_view suffix,
380 InputStream &input_stream,
381 const DecoderPlugin &plugin)
382{
383 if (!plugin.SupportsSuffix(suffix))
384 return DecodeResult::NO_PLUGIN;
385
386 bridge.Reset();
387
388 DecoderControl &dc = bridge.dc;
389
390 if (plugin.file_decode != nullptr) {
391 const std::lock_guard protect{dc.mutex};
392 return decoder_file_decode(plugin, bridge, path_fs);
393 } else if (plugin.stream_decode != nullptr) {
394 std::unique_lock lock{dc.mutex};
395 return decoder_stream_decode(plugin, bridge, input_stream,
396 lock);
397 } else
398 return DecodeResult::NO_STREAM_PLUGIN;
399}
400
401/**
402 * Decode a container file with the given decoder plugin.

Callers 1

decoder_run_fileFunction · 0.85

Calls 4

decoder_file_decodeFunction · 0.85
decoder_stream_decodeFunction · 0.85
SupportsSuffixMethod · 0.45
ResetMethod · 0.45

Tested by

no test coverage detected