static void stream(PSERVER_DATA server, PCONFIGURATION config, enum platform system) { int appId = get_app_id(server, config->app); if (appId<0) { fprintf(stderr, "Can't find app %s\n", config->app); exit(-1); } gs_start_app(server, &config->stream, appId, config->sops, config->localaudio); void *context = NULL; #ifdef HAVE_SDL if (system == SDL) context = sdl_window; #endif LiStartConnection(server->address, &config->stream, &connection_callbacks, platform_get_video(system), platform_get_audio(system), context, 0, server->serverMajorVersion); if (IS_EMBEDDED(system)) { evdev_start(); loop_main(); evdev_stop(); } #ifdef HAVE_SDL else if (system == SDL) sdl_loop(); #endif LiStopConnection(); }
void* MoonlightInstance::ConnectionThreadFunc(void* context) { MoonlightInstance* me = (MoonlightInstance*)context; int err; SERVER_INFORMATION serverInfo; // Post a status update before we begin pp::Var response("Starting connection to " + me->m_Host); me->PostMessage(response); LiInitializeServerInformation(&serverInfo); serverInfo.address = me->m_Host.c_str(); serverInfo.serverInfoAppVersion = me->m_AppVersion.c_str(); err = LiStartConnection(&serverInfo, &me->m_StreamConfig, &MoonlightInstance::s_ClCallbacks, &MoonlightInstance::s_DrCallbacks, &MoonlightInstance::s_ArCallbacks, NULL, 0); if (err != 0) { // Notify the JS code that the stream has ended pp::Var response(MSG_STREAM_TERMINATED); me->PostMessage(response); return NULL; } // Set running state before starting connection-specific threads me->m_Running = true; pthread_create(&me->m_GamepadThread, NULL, MoonlightInstance::GamepadThreadFunc, me); return NULL; }
void* MoonlightInstance::ConnectionThreadFunc(void* context) { MoonlightInstance* me = (MoonlightInstance*)context; int err; // Post a status update before we begin pp::Var response("Starting connection to " + me->m_Host); me->PostMessage(response); err = LiStartConnection(me->m_Host.c_str(), &me->m_StreamConfig, &MoonlightInstance::s_ClCallbacks, &MoonlightInstance::s_DrCallbacks, &MoonlightInstance::s_ArCallbacks, NULL, 0, me->m_ServerMajorVersion); if (err != 0) { // Notify the JS code that the stream has ended pp::Var response(MSG_STREAM_TERMINATED); me->PostMessage(response); return NULL; } // Set running state before starting connection-specific threads me->m_Running = true; pthread_create(&me->m_GamepadThread, NULL, MoonlightInstance::GamepadThreadFunc, me); return NULL; }
static void stream(PSERVER_DATA server, PCONFIGURATION config, enum platform system) { int appId = get_app_id(server, config->app); if (appId<0) { fprintf(stderr, "Can't find app %s\n", config->app); exit(-1); } int ret = gs_start_app(server, &config->stream, appId, config->sops, config->localaudio); if (ret < 0) { if (ret == GS_NOT_SUPPORTED_4K) fprintf(stderr, "Server doesn't support 4K\n"); else fprintf(stderr, "Errorcode starting app: %d\n", err); exit(-1); } int drFlags = 0; if (config->fullscreen) drFlags |= DISPLAY_FULLSCREEN; if (config->forcehw) drFlags |= FORCE_HARDWARE_ACCELERATION; printf("Stream %d x %d, %d fps, %d kbps\n", config->stream.width, config->stream.height, config->stream.fps, config->stream.bitrate); LiStartConnection(server->address, &config->stream, &connection_callbacks, platform_get_video(system), platform_get_audio(system), NULL, drFlags, server->serverMajorVersion); if (IS_EMBEDDED(system)) { evdev_start(); loop_main(); evdev_stop(); } #ifdef HAVE_SDL else if (system == SDL) sdl_loop(); #endif LiStopConnection(); }