* Decode a URI with the given decoder plugin. * * Caller holds DecoderControl::mutex. */
| 72 | * Caller holds DecoderControl::mutex. |
| 73 | */ |
| 74 | static DecodeResult |
| 75 | DecoderUriDecode(const DecoderPlugin &plugin, |
| 76 | DecoderBridge &bridge, const char *uri) |
| 77 | { |
| 78 | assert(plugin.uri_decode != nullptr); |
| 79 | assert(bridge.stream_tag == nullptr); |
| 80 | assert(bridge.decoder_tag == nullptr); |
| 81 | assert(uri != nullptr); |
| 82 | assert(bridge.dc.state == DecoderState::START); |
| 83 | |
| 84 | FmtDebug(decoder_thread_domain, "probing plugin {}", plugin.name); |
| 85 | |
| 86 | if (bridge.dc.command == DecoderCommand::STOP) |
| 87 | return DecodeResult::STOP; |
| 88 | |
| 89 | { |
| 90 | const ScopeUnlock unlock(bridge.dc.mutex); |
| 91 | |
| 92 | FmtThreadName("decoder:{}", plugin.name); |
| 93 | |
| 94 | plugin.UriDecode(bridge, uri); |
| 95 | |
| 96 | SetThreadName("decoder"); |
| 97 | } |
| 98 | |
| 99 | assert(bridge.dc.state == DecoderState::START || |
| 100 | bridge.dc.state == DecoderState::DECODE); |
| 101 | |
| 102 | return bridge.dc.state == DecoderState::START |
| 103 | ? DecodeResult::UNRECOGNIZED_FILE |
| 104 | : DecodeResult::SUCCESS; |
| 105 | } |
| 106 | |
| 107 | /** |
| 108 | * Decode a stream with the given decoder plugin. |