mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-19 11:03:01 +00:00
Use an NvApp in the StreamConfiguration so it can be directly used by NvConnection
This commit is contained in:
parent
fb8fc54bb1
commit
fcfcce88dd
@ -140,26 +140,25 @@ public class NvConnection {
|
||||
return false;
|
||||
}
|
||||
|
||||
NvApp app;
|
||||
NvApp app = context.streamConfig.getApp();
|
||||
|
||||
// If the client provided an exact app ID, use that to find the app object
|
||||
if (context.streamConfig.getAppId() != StreamConfiguration.INVALID_APP_ID) {
|
||||
app = h.getAppById(context.streamConfig.getAppId());
|
||||
}
|
||||
else {
|
||||
// If the client did not provide an exact app ID, do a lookup with the applist
|
||||
if (!context.streamConfig.getApp().isInitialized()) {
|
||||
LimeLog.info("Using deprecated app lookup method - Please specify an app ID in your StreamConfiguration instead");
|
||||
app = h.getAppByName(context.streamConfig.getAppName());
|
||||
app = h.getAppByName(context.streamConfig.getApp().getAppName());
|
||||
if (app == null) {
|
||||
context.connListener.displayMessage("The app " + context.streamConfig.getApp().getAppName() + " is not in GFE app list");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (app == null) {
|
||||
context.connListener.displayMessage("The app " + context.streamConfig.getAppName() + " is not in GFE app list");
|
||||
return false;
|
||||
}
|
||||
// Update the running status of the app
|
||||
app.setIsRunning(h.getCurrentGame(serverInfo) == app.getAppId());
|
||||
|
||||
// If there's a game running, resume it
|
||||
if (h.getCurrentGame(serverInfo) != 0) {
|
||||
try {
|
||||
if (h.getCurrentGame(serverInfo) == app.getAppId()) {
|
||||
if (app.getIsRunning()) {
|
||||
if (!h.resumeApp(context)) {
|
||||
context.connListener.displayMessage("Failed to resume existing session");
|
||||
return false;
|
||||
@ -276,7 +275,7 @@ public class NvConnection {
|
||||
|
||||
if (currentStage == NvConnectionListener.Stage.LAUNCH_APP) {
|
||||
// Display the app name instead of the stage name
|
||||
currentStage.setName(context.streamConfig.getAppName());
|
||||
currentStage.setName(context.streamConfig.getApp().getAppName());
|
||||
}
|
||||
|
||||
context.connListener.stageStarting(currentStage);
|
||||
|
@ -1,10 +1,11 @@
|
||||
package com.limelight.nvstream;
|
||||
|
||||
import com.limelight.nvstream.http.NvApp;
|
||||
|
||||
public class StreamConfiguration {
|
||||
public static final int INVALID_APP_ID = 0;
|
||||
|
||||
private String appName;
|
||||
private int appId = INVALID_APP_ID;
|
||||
private NvApp app;
|
||||
private int width, height;
|
||||
private int refreshRate;
|
||||
private int bitrate;
|
||||
@ -17,13 +18,8 @@ public class StreamConfiguration {
|
||||
public static class Builder {
|
||||
private StreamConfiguration config = new StreamConfiguration();
|
||||
|
||||
public StreamConfiguration.Builder setApp(String app) {
|
||||
config.appName = app;
|
||||
return this;
|
||||
}
|
||||
|
||||
public StreamConfiguration.Builder setAppId(int appId) {
|
||||
config.appId = appId;
|
||||
public StreamConfiguration.Builder setApp(NvApp app) {
|
||||
config.app = app;
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -75,7 +71,7 @@ public class StreamConfiguration {
|
||||
|
||||
private StreamConfiguration() {
|
||||
// Set default attributes
|
||||
this.appName = "Steam";
|
||||
this.app = new NvApp("Steam");
|
||||
this.width = 1280;
|
||||
this.height = 720;
|
||||
this.refreshRate = 60;
|
||||
@ -105,12 +101,8 @@ public class StreamConfiguration {
|
||||
return maxPacketSize;
|
||||
}
|
||||
|
||||
public String getAppName() {
|
||||
return appName;
|
||||
}
|
||||
|
||||
public int getAppId() {
|
||||
return appId;
|
||||
public NvApp getApp() {
|
||||
return app;
|
||||
}
|
||||
|
||||
public boolean getSops() {
|
||||
|
@ -8,6 +8,19 @@ public class NvApp {
|
||||
private boolean isRunning;
|
||||
private boolean initialized;
|
||||
|
||||
public NvApp() {
|
||||
|
||||
}
|
||||
|
||||
public NvApp(String appName) {
|
||||
this.appName = appName;
|
||||
}
|
||||
|
||||
public NvApp(String appName, int appId) {
|
||||
this.appName = appName;
|
||||
this.appId = appId;
|
||||
}
|
||||
|
||||
public void setAppName(String appName) {
|
||||
this.appName = appName;
|
||||
}
|
||||
@ -21,11 +34,16 @@ public class NvApp {
|
||||
}
|
||||
}
|
||||
|
||||
public void setAppId(int appId) {
|
||||
this.appId = appId;
|
||||
this.initialized = true;
|
||||
}
|
||||
|
||||
public void setIsRunning(String isRunning) {
|
||||
this.isRunning = isRunning.equals("1");
|
||||
}
|
||||
|
||||
public void setIsRunningBoolean(boolean isRunning) {
|
||||
public void setIsRunning(boolean isRunning) {
|
||||
this.isRunning = isRunning;
|
||||
}
|
||||
|
||||
|
@ -321,7 +321,7 @@ public class NvHTTP {
|
||||
public NvApp getAppByName(String appName) throws IOException, XmlPullParserException {
|
||||
LinkedList<NvApp> appList = getAppList();
|
||||
for (NvApp appFromList : appList) {
|
||||
if (appFromList.getAppName().equals(appName)) {
|
||||
if (appFromList.getAppName().equalsIgnoreCase(appName)) {
|
||||
return appFromList;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user