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

Function decoder_run_stream

src/decoder/Thread.cxx:337–371  ·  view source on GitHub ↗

* Try decoding a stream. * * DecoderControl::mutex is not locked by caller. */

Source from the content-addressed store, hash-verified

335 * DecoderControl::mutex is not locked by caller.
336 */
337static DecodeResult
338decoder_run_stream(DecoderBridge &bridge, const char *uri)
339{
340 auto result = TryUriDecode(bridge, uri);
341 if (IsFinalDecodeResult(result))
342 return result;
343
344 DecoderControl &dc = bridge.dc;
345
346 auto input_stream = bridge.OpenUri(uri);
347 assert(input_stream);
348
349 MaybeLoadReplayGain(bridge, *input_stream);
350
351 std::unique_lock lock{dc.mutex};
352
353 if (dc.command == DecoderCommand::STOP)
354 return DecodeResult::STOP;
355
356 if (auto r = decoder_run_stream_locked(bridge, *input_stream, lock, uri);
357 r > result) {
358 result = r;
359 if (IsFinalDecodeResult(result))
360 return result;
361 }
362
363 /* fallback to mp3: this is needed for bastard streams that
364 don't have a suffix or set the mimeType */
365 if (auto r = decoder_run_stream_fallback(bridge, *input_stream, lock);
366 r > result) {
367 result = r;
368 }
369
370 return result;
371}
372
373/**
374 * Decode a file with the given decoder plugin.

Callers 1

DecoderUnlockedRunUriFunction · 0.85

Calls 6

TryUriDecodeFunction · 0.85
IsFinalDecodeResultFunction · 0.85
MaybeLoadReplayGainFunction · 0.85
OpenUriMethod · 0.45

Tested by

no test coverage detected