* Decodes a stream. */
| 417 | * Decodes a stream. |
| 418 | */ |
| 419 | static void |
| 420 | wavpack_streamdecode(DecoderClient &client, InputStream &is) |
| 421 | { |
| 422 | int open_flags = OPEN_DSD_FLAG | OPEN_NORMALIZE; |
| 423 | bool can_seek = is.IsSeekable(); |
| 424 | |
| 425 | std::unique_ptr<WavpackInput> wvc; |
| 426 | auto is_wvc = wavpack_open_wvc(client, is.GetURI()); |
| 427 | if (is_wvc) { |
| 428 | open_flags |= OPEN_WVC; |
| 429 | can_seek &= is_wvc->IsSeekable(); |
| 430 | |
| 431 | wvc = std::make_unique<WavpackInput>(&client, *is_wvc); |
| 432 | } |
| 433 | |
| 434 | if (!can_seek) { |
| 435 | open_flags |= OPEN_STREAMING; |
| 436 | } |
| 437 | |
| 438 | WavpackInput isp(&client, is); |
| 439 | |
| 440 | auto *wpc = WavpackOpenInput(mpd_is_reader, &isp, wvc.get(), |
| 441 | open_flags, 0); |
| 442 | AtScopeExit(wpc) { |
| 443 | WavpackCloseFile(wpc); |
| 444 | }; |
| 445 | |
| 446 | wavpack_decode(client, wpc, can_seek); |
| 447 | } |
| 448 | |
| 449 | /* |
| 450 | * Decodes a file. |
nothing calls this directly
no test coverage detected