--- TRIGGER READ ---
| 219 | |
| 220 | // --- TRIGGER READ --- |
| 221 | void FfplayDummy::triggerRead(int) { |
| 222 | // TODO: if first read, seek to end - N bytes. |
| 223 | // If second read, seek to beginning. |
| 224 | if (count == 0) { |
| 225 | // Seek to end - 10 kB. |
| 226 | media_seek(0, DataBuffer::getFileSize() - (10 * 1024), SEEK_SET); |
| 227 | count++; |
| 228 | return; |
| 229 | } |
| 230 | else if (count == 1) { |
| 231 | // Seek to beginning. |
| 232 | media_seek(0, 0, SEEK_SET); |
| 233 | count++; |
| 234 | return; |
| 235 | } |
| 236 | |
| 237 | // Call read() with a data request. This data is then discarded. |
| 238 | std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now(); |
| 239 | read_size += step_size; |
| 240 | if (read_size > buf_size) { |
| 241 | read_size = start_size; |
| 242 | } |
| 243 | |
| 244 | if (media_read(0, buf, read_size) == -1) { |
| 245 | // Signal the player thread that the playback has ended. |
| 246 | dummyCon.signal(); |
| 247 | } |
| 248 | |
| 249 | // Call the verify handler, if any. |
| 250 | if (verifycb) { |
| 251 | verifycb(buf, read_size); |
| 252 | } |
| 253 | |
| 254 | // Report time for the media_read call. |
| 255 | std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now(); |
| 256 | #ifndef NO_NYMPH_LOGGER |
| 257 | NYMPH_LOG_INFORMATION("Read duration: " + Poco::NumberFormatter::format(std::chrono::duration_cast<std::chrono::microseconds>(end - begin).count()) + "µs."); |
| 258 | #else |
| 259 | std::cout << "\rRead duration: " << std::chrono::duration_cast<std::chrono::microseconds>(end - begin).count() << "µs.";// << std::endl; |
| 260 | #endif |
| 261 | |
| 262 | } |
| 263 | |
| 264 | |
| 265 | void FfplayDummy::cleanUp() { |
nothing calls this directly
no test coverage detected