MCPcopy Create free account
hub / github.com/alibaba/CicadaPlayer / createPlayer

Function createPlayer

cmdline/example/syncPlayer.cpp:123–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121}
122
123static 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}
151static int64_t getMasterClock(void *arg)
152{
153 auto *cont = static_cast<cicadaCont *>(arg);

Callers 1

mainFunction · 0.85

Calls 5

SetDefaultBandWidthMethod · 0.80
SetListenerMethod · 0.45
SetDataSourceMethod · 0.45
SetViewMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected