| 121 | } |
| 122 | |
| 123 | static MediaPlayer *createPlayer(cicadaCont &cicada, const string &url) |
| 124 | { |
| 125 | cicada.player = unique_ptr<MediaPlayer>(new MediaPlayer()); |
| 126 | playerListener pListener{nullptr}; |
| 127 | pListener.userData = &cicada; |
| 128 | pListener.Completion = onEOS; |
| 129 | pListener.EventCallback = onEvent; |
| 130 | pListener.ErrorCallback = onError; |
| 131 | pListener.StatusChanged = onStatusChanged; |
| 132 | pListener.LoadingStart = onLoadingStart; |
| 133 | pListener.LoadingEnd = onLoadingEnd; |
| 134 | pListener.PositionUpdate = onPositionUpdate; |
| 135 | cicada.player->SetListener(pListener); |
| 136 | cicada.player->SetDefaultBandWidth(1000 * 1000); |
| 137 | cicada.player->SetDataSource(url.c_str()); |
| 138 | #ifdef ENABLE_SDL |
| 139 | Uint32 flags = 0; |
| 140 | flags |= SDL_WINDOW_ALLOW_HIGHDPI; |
| 141 | flags |= SDL_WINDOW_RESIZABLE; |
| 142 | SDL_CreateWindowAndRenderer(640, 360, flags, &(cicada.window), &(cicada.rendere)); |
| 143 | SDL_SetWindowTitle(cicada.window, cicada.bMaster ? "master" : "slave"); |
| 144 | cicada.player->SetView(cicada.window); |
| 145 | #else |
| 146 | int view = 0; |
| 147 | cicada.player->SetView(&view); |
| 148 | #endif |
| 149 | return cicada.player.get(); |
| 150 | } |
| 151 | static int64_t getMasterClock(void *arg) |
| 152 | { |
| 153 | auto *cont = static_cast<cicadaCont *>(arg); |
no test coverage detected