--- FINISH PLAYBACK --- Called at the end of playback of a stream or file. If a stream is queued, play it, otherwise end playback.
| 437 | // Called at the end of playback of a stream or file. |
| 438 | // If a stream is queued, play it, otherwise end playback. |
| 439 | void finishPlayback() { |
| 440 | // Send message to client indicating that we're done. |
| 441 | uint32_t handle = DataBuffer::getSessionHandle(); |
| 442 | std::vector<NymphType*> values; |
| 443 | std::string result; |
| 444 | if (!NymphRemoteClient::callCallback(handle, "MediaStopCallback", values, result)) { |
| 445 | NYMPH_LOG_ERROR("Calling media stop callback failed: " + result); |
| 446 | return; |
| 447 | } |
| 448 | |
| 449 | // Update the LCDProc daemon if enabled. |
| 450 | if (lcdproc_enabled) { |
| 451 | // TODO: Clear the screen? |
| 452 | } |
| 453 | |
| 454 | // Start the Screensaver here for now. |
| 455 | if (!display_disable) { |
| 456 | if (gui_enable) { |
| 457 | // Return to GUI. Hide window. |
| 458 | SDL_Event event; |
| 459 | event.type = SDL_KEYDOWN; |
| 460 | event.key.keysym.sym = SDLK_UNDERSCORE; |
| 461 | SDL_PushEvent(&event); |
| 462 | |
| 463 | Gui::active = true; |
| 464 | Gui::resumeCv.notify_one(); |
| 465 | } |
| 466 | else if (screensaver_enable) { |
| 467 | // Start screensaver. |
| 468 | ScreenSaver::start(15); |
| 469 | } |
| 470 | else { |
| 471 | // Hide window. |
| 472 | SDL_Event event; |
| 473 | event.type = SDL_KEYDOWN; |
| 474 | event.key.keysym.sym = SDLK_UNDERSCORE; |
| 475 | SDL_PushEvent(&event); |
| 476 | } |
| 477 | } |
| 478 | } |
| 479 | |
| 480 | |
| 481 | // --- STREAM TRACK --- |