| 180 | }; |
| 181 | |
| 182 | static void process_client_msg(cicadaCont &cicada, unique_ptr<messageClient> &client, string &msg, bool &quite) |
| 183 | { |
| 184 | msg = client->readMessage(); |
| 185 | if (!msg.empty()) { |
| 186 | AF_LOGE("client msg %s\n", msg.c_str()); |
| 187 | if (msg == playerMessage::start) { |
| 188 | cicada.player->Start(); |
| 189 | cicada.masterClock.start(); |
| 190 | } else if (msg == playerMessage::pause) { |
| 191 | cicada.player->Pause(); |
| 192 | cicada.masterClock.pause(); |
| 193 | } else if (msg == playerMessage::exit) { |
| 194 | quite = true; |
| 195 | } else if (msg == playerMessage::prepare) { |
| 196 | cicada.player->Prepare(); |
| 197 | } else if (msg == playerMessage::clock) { |
| 198 | int64_t pts = atoll(client->readMessage().c_str()); |
| 199 | cicada.masterClock.set(pts); |
| 200 | if (llabs(pts - cicada.player->GetMasterClockPts()) > 40000) { |
| 201 | AF_LOGW("delta pts is %lld\n", pts - cicada.player->GetMasterClockPts()); |
| 202 | } |
| 203 | } else if (msg == playerMessage::fullScreen) { |
| 204 | #ifdef ENABLE_SDL |
| 205 | bool full = atoll(client->readMessage().c_str()) != 0; |
| 206 | SDL_SetWindowFullscreen(cicada.window, full ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0); |
| 207 | #endif |
| 208 | } else if (msg == playerMessage::seekAccurate) { |
| 209 | int64_t ms = atoll(client->readMessage().c_str()); |
| 210 | cicada.player->SeekTo(ms, SEEK_MODE_ACCURATE); |
| 211 | } else if (msg == playerMessage::seek) { |
| 212 | int64_t ms = atoll(client->readMessage().c_str()); |
| 213 | cicada.player->SeekTo(ms, SEEK_MODE_INACCURATE); |
| 214 | } |
| 215 | } |
| 216 | } |
| 217 | int main(int argc, const char **argv) |
| 218 | { |
| 219 | string url; |