MCPcopy Create free account
hub / github.com/MayaPosch/NymphCast / playback_seek

Function playback_seek

src/server/NymphCastServer.cpp:1432–1469  ·  view source on GitHub ↗

--- PLAYBACK SEEK --- uint8 playback_seek(uint64)

Source from the content-addressed store, hash-verified

1430// --- PLAYBACK SEEK ---
1431// uint8 playback_seek(uint64)
1432NymphMessage* playback_seek(int session, NymphMessage* msg, void* data) {
1433 NymphMessage* returnMsg = msg->getReplyMessage();
1434
1435 std::vector<NymphType*>* valArray = msg->parameters()[0]->getArray();
1436 NymphSeekType type = static_cast<NymphSeekType>((*valArray)[0]->getUint8());
1437 if (type == NYMPH_SEEK_TYPE_PERCENTAGE) {
1438 uint8_t percentage = (*valArray)[1]->getUint8();
1439
1440 // Sanity check.
1441 // We accept a value from 0 - 100.
1442 if (percentage > 100) { percentage = 100; }
1443
1444 // Create mouse event structure.
1445 SDL_Event event;
1446 event.type = nymph_seek_event;
1447 event.user.code = NYMPH_SEEK_EVENT;
1448 event.user.code = percentage;
1449 SDL_PushEvent(&event);
1450 }
1451 else if (type == NYMPH_SEEK_TYPE_BYTES) {
1452 NYMPH_LOG_FATAL("Error: Seeking by byte offset is not implemented.");
1453 returnMsg->setResultValue(new NymphType((uint8_t) 1));
1454 msg->discard();
1455 return returnMsg;
1456 }
1457 else {
1458 NYMPH_LOG_FATAL("Error: Unknown seeking type requested: " +
1459 Poco::NumberFormatter::format(type));
1460 returnMsg->setResultValue(new NymphType((uint8_t) 1));
1461 msg->discard();
1462 return returnMsg;
1463 }
1464
1465 returnMsg->setResultValue(new NymphType((uint8_t) 0));
1466 msg->discard();
1467
1468 return returnMsg;
1469}
1470
1471
1472// --- SUBTITLES SET --

Callers

nothing calls this directly

Calls 1

formatFunction · 0.85

Tested by

no test coverage detected