| 147 | } |
| 148 | |
| 149 | static DecoderCommand |
| 150 | FlacSubmitToClient(DecoderClient &client, FlacDecoder &d) noexcept |
| 151 | { |
| 152 | if (d.tag.IsEmpty() && d.chunk.empty()) |
| 153 | return client.GetCommand(); |
| 154 | |
| 155 | if (!d.tag.IsEmpty()) { |
| 156 | auto cmd = client.SubmitTag(d.GetInputStream(), |
| 157 | std::move(d.tag)); |
| 158 | d.tag.Clear(); |
| 159 | if (cmd != DecoderCommand::NONE) |
| 160 | return cmd; |
| 161 | } |
| 162 | |
| 163 | if (!d.chunk.empty()) { |
| 164 | auto cmd = client.SubmitAudio(d.GetInputStream(), d.chunk, |
| 165 | d.kbit_rate); |
| 166 | d.chunk = {}; |
| 167 | if (cmd != DecoderCommand::NONE) |
| 168 | return cmd; |
| 169 | } |
| 170 | |
| 171 | return DecoderCommand::NONE; |
| 172 | } |
| 173 | |
| 174 | static void |
| 175 | flac_decoder_loop(FlacDecoder *data, FLAC__StreamDecoder *flac_dec) |
no test coverage detected