mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-21 03:52:48 +00:00
Use App IDs for app lookups and deprecate the old name-based lookup function
This commit is contained in:
parent
a4ec619e5a
commit
fb8fc54bb1
@ -140,9 +140,19 @@ public class NvConnection {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvApp app = h.getApp(context.streamConfig.getApp());
|
NvApp app;
|
||||||
|
|
||||||
|
// 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 {
|
||||||
|
LimeLog.info("Using deprecated app lookup method - Please specify an app ID in your StreamConfiguration instead");
|
||||||
|
app = h.getAppByName(context.streamConfig.getAppName());
|
||||||
|
}
|
||||||
|
|
||||||
if (app == null) {
|
if (app == null) {
|
||||||
context.connListener.displayMessage("The app " + context.streamConfig.getApp() + " is not in GFE app list");
|
context.connListener.displayMessage("The app " + context.streamConfig.getAppName() + " is not in GFE app list");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -266,7 +276,7 @@ public class NvConnection {
|
|||||||
|
|
||||||
if (currentStage == NvConnectionListener.Stage.LAUNCH_APP) {
|
if (currentStage == NvConnectionListener.Stage.LAUNCH_APP) {
|
||||||
// Display the app name instead of the stage name
|
// Display the app name instead of the stage name
|
||||||
currentStage.setName(context.streamConfig.getApp());
|
currentStage.setName(context.streamConfig.getAppName());
|
||||||
}
|
}
|
||||||
|
|
||||||
context.connListener.stageStarting(currentStage);
|
context.connListener.stageStarting(currentStage);
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
package com.limelight.nvstream;
|
package com.limelight.nvstream;
|
||||||
|
|
||||||
public class StreamConfiguration {
|
public class StreamConfiguration {
|
||||||
private String app;
|
public static final int INVALID_APP_ID = 0;
|
||||||
|
|
||||||
|
private String appName;
|
||||||
|
private int appId = INVALID_APP_ID;
|
||||||
private int width, height;
|
private int width, height;
|
||||||
private int refreshRate;
|
private int refreshRate;
|
||||||
private int bitrate;
|
private int bitrate;
|
||||||
@ -15,7 +18,12 @@ public class StreamConfiguration {
|
|||||||
private StreamConfiguration config = new StreamConfiguration();
|
private StreamConfiguration config = new StreamConfiguration();
|
||||||
|
|
||||||
public StreamConfiguration.Builder setApp(String app) {
|
public StreamConfiguration.Builder setApp(String app) {
|
||||||
config.app = app;
|
config.appName = app;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public StreamConfiguration.Builder setAppId(int appId) {
|
||||||
|
config.appId = appId;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +75,7 @@ public class StreamConfiguration {
|
|||||||
|
|
||||||
private StreamConfiguration() {
|
private StreamConfiguration() {
|
||||||
// Set default attributes
|
// Set default attributes
|
||||||
this.app = "Steam";
|
this.appName = "Steam";
|
||||||
this.width = 1280;
|
this.width = 1280;
|
||||||
this.height = 720;
|
this.height = 720;
|
||||||
this.refreshRate = 60;
|
this.refreshRate = 60;
|
||||||
@ -97,8 +105,12 @@ public class StreamConfiguration {
|
|||||||
return maxPacketSize;
|
return maxPacketSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getApp() {
|
public String getAppName() {
|
||||||
return app;
|
return appName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAppId() {
|
||||||
|
return appId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getSops() {
|
public boolean getSops() {
|
||||||
|
@ -304,11 +304,24 @@ public class NvHTTP {
|
|||||||
return Integer.parseInt(game);
|
return Integer.parseInt(game);
|
||||||
}
|
}
|
||||||
|
|
||||||
public NvApp getApp(String app) throws IOException,
|
public NvApp getAppById(int appId) throws IOException, XmlPullParserException {
|
||||||
XmlPullParserException {
|
|
||||||
LinkedList<NvApp> appList = getAppList();
|
LinkedList<NvApp> appList = getAppList();
|
||||||
for (NvApp appFromList : appList) {
|
for (NvApp appFromList : appList) {
|
||||||
if (appFromList.getAppName().equals(app)) {
|
if (appFromList.getAppId() == appId) {
|
||||||
|
return appFromList;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* NOTE: Only use this function if you know what you're doing.
|
||||||
|
* It's totally valid to have two apps named the same thing,
|
||||||
|
* or even nothing at all! Look apps up by ID if at all possible
|
||||||
|
* using the above function */
|
||||||
|
public NvApp getAppByName(String appName) throws IOException, XmlPullParserException {
|
||||||
|
LinkedList<NvApp> appList = getAppList();
|
||||||
|
for (NvApp appFromList : appList) {
|
||||||
|
if (appFromList.getAppName().equals(appName)) {
|
||||||
return appFromList;
|
return appFromList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user