* Decode a file with the given decoder plugin. * * Caller holds DecoderControl::mutex. */
| 156 | * Caller holds DecoderControl::mutex. |
| 157 | */ |
| 158 | static DecodeResult |
| 159 | decoder_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]] |
| 193 | static bool |
no outgoing calls
no test coverage detected