Compare commits
117 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 69c7b5a0d5 | |||
| d1ad3115fa | |||
| 770af402a4 | |||
| 3236c0b93a | |||
| 51aacc3f38 | |||
| 397c6f46f9 | |||
| d00f78f859 | |||
| 29fec2e0de | |||
| 88d28665ef | |||
| de1f4da258 | |||
| 7985be57ab | |||
| a835e7aaa2 | |||
| c4dc5eb9e1 | |||
| db758f386e | |||
| 3fb3eefa94 | |||
| 2d6c756e70 | |||
| 03e965d449 | |||
| 34f72544d8 | |||
| d839ea9781 | |||
| 2b7f13fdbb | |||
| 7557a3a4ae | |||
| fcecba484f | |||
| fa85a0a0bd | |||
| dc64bfeba2 | |||
| 871b73c48d | |||
| 5dcff91d27 | |||
| 0041fc1dab | |||
| 314242ab08 | |||
| 09e8ddfd74 | |||
| 4cea483a87 | |||
| 444c4602c1 | |||
| 5b6eac7140 | |||
| 7cdd184197 | |||
| be153b84cb | |||
| 06c53e2251 | |||
| 695519bdf5 | |||
| bf7d033ab2 | |||
| df67795c4a | |||
| 72c1696f43 | |||
| 8eca3683c9 | |||
| 80c17b4913 | |||
| e5050f10bb | |||
| e912e4de57 | |||
| 8dee1f0d80 | |||
| 53594ada66 | |||
| 848ed1ad72 | |||
| 307e807c8f | |||
| 6a27780d56 | |||
| 57f98dbb4a | |||
| 5af7d83ec1 | |||
| 4a6f77f43a | |||
| c96f9fb635 | |||
| e3a477a243 | |||
| 9fcd641143 | |||
| 6d1cbc5a64 | |||
| ec71060d98 | |||
| 03f706fb85 | |||
| 7ad87bd3ee | |||
| 4e088f6183 | |||
| 1b16ea6f53 | |||
| f262503bc8 | |||
| b2ba216cd1 | |||
| 94ba7f8e45 | |||
| a267cf59c7 | |||
| 79e8bef289 | |||
| 99e3b5f33b | |||
| afbe64f3ff | |||
| 43b1a73ae0 | |||
| d08eeb8a2d | |||
| 7c39e5c974 | |||
| cd49334199 | |||
| dd59f0bc6d | |||
| cf2d83a1ea | |||
| d5b6130936 | |||
| 4ae29b0075 | |||
| 34e35cd493 | |||
| a17af070c5 | |||
| fbe0a26800 | |||
| 25ad99df94 | |||
| 6338e7b8eb | |||
| 1b9846d519 | |||
| a4ece13a1d | |||
| 066b8430a0 | |||
| 2b54a91f3d | |||
| 2d01633372 | |||
| 5dc01069fc | |||
| d450008833 | |||
| a37fff6eb5 | |||
| 6604675bf9 | |||
| 1965cc2347 | |||
| 312ca27906 | |||
| 0bceadbd9a | |||
| dfc3daabcd | |||
| b9ba9adc1f | |||
| f112d45e1a | |||
| 88f139873c | |||
| d317c5bf03 | |||
| 9d72314b9c | |||
| 2cc7243573 | |||
| 269d9a6bc6 | |||
| 244130fc1b | |||
| a67791b8aa | |||
| 21e46a5c3b | |||
| 2df2f850d5 | |||
| 406d26ec1c | |||
| 68c1aaf433 | |||
| 9ef577dbdd | |||
| 982ecbc015 | |||
| 7e44b5abd5 | |||
| 6dbb1a0c1f | |||
| 94b1c04fa6 | |||
| 9758276f1c | |||
| 971263c52d | |||
| 9b58e7bb4d | |||
| 69ecf0251d | |||
| 350a4d8825 | |||
| 44f447df7b |
+7
-1
@@ -102,11 +102,17 @@
|
|||||||
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
|
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
<orderEntry type="library" exported="" name="bcprov-jdk15on-1.51" level="project" />
|
<orderEntry type="library" exported="" name="bcprov-jdk15on-1.51" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="gson-2.3.1" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="support-v4-r7" level="project" />
|
||||||
<orderEntry type="library" exported="" name="jmdns-fixed" level="project" />
|
<orderEntry type="library" exported="" name="jmdns-fixed" level="project" />
|
||||||
<orderEntry type="library" exported="" name="jcodec-0.1.6-3" level="project" />
|
|
||||||
<orderEntry type="library" exported="" name="bcpkix-jdk15on-1.51" level="project" />
|
<orderEntry type="library" exported="" name="bcpkix-jdk15on-1.51" level="project" />
|
||||||
<orderEntry type="library" exported="" name="tinyrtsp" level="project" />
|
<orderEntry type="library" exported="" name="tinyrtsp" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="okhttp-2.1.0" level="project" />
|
||||||
<orderEntry type="library" exported="" name="limelight-common" level="project" />
|
<orderEntry type="library" exported="" name="limelight-common" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="okio-1.0.1" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="androidasync-e1dfb4" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="jcodec-0.1.9" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="ion-2f46fa" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
||||||
|
|
||||||
|
|||||||
+16
-6
@@ -5,14 +5,14 @@ apply plugin: 'com.android.application'
|
|||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 21
|
compileSdkVersion 21
|
||||||
buildToolsVersion "21.0.2"
|
buildToolsVersion "21.1.1"
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 16
|
minSdkVersion 16
|
||||||
targetSdkVersion 21
|
targetSdkVersion 21
|
||||||
|
|
||||||
versionName "2.9"
|
versionName "3.0.2"
|
||||||
versionCode = 38
|
versionCode = 48
|
||||||
}
|
}
|
||||||
|
|
||||||
productFlavors {
|
productFlavors {
|
||||||
@@ -62,9 +62,19 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile group: 'org.jcodec', name: 'jcodec', version: '0.1.6-3'
|
compile group: 'org.jcodec', name: 'jcodec', version: '+'
|
||||||
compile group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: '1.51'
|
compile group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: '+'
|
||||||
compile group: 'org.bouncycastle', name: 'bcpkix-jdk15on', version: '1.51'
|
compile group: 'org.bouncycastle', name: 'bcpkix-jdk15on', version: '+'
|
||||||
|
compile group: 'com.google.android', name: 'support-v4', version:'+'
|
||||||
|
|
||||||
|
// FIXME: Pending resolution of issue #346 using custom build
|
||||||
|
//compile group: 'com.koushikdutta.ion', name: 'ion', version:'+'
|
||||||
|
compile group: 'com.google.code.gson', name: 'gson', version:'+'
|
||||||
|
compile files('libs/androidasync-e1dfb4.jar')
|
||||||
|
compile files('libs/ion-2f46fa.jar')
|
||||||
|
|
||||||
|
compile group: 'com.squareup.okhttp', name: 'okhttp', version:'+'
|
||||||
|
compile group: 'com.squareup.okio', name:'okio', version:'+'
|
||||||
compile files('libs/jmdns-fixed.jar')
|
compile files('libs/jmdns-fixed.jar')
|
||||||
compile files('libs/limelight-common.jar')
|
compile files('libs/limelight-common.jar')
|
||||||
compile files('libs/tinyrtsp.jar')
|
compile files('libs/tinyrtsp.jar')
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -64,6 +64,7 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".Game"
|
android:name=".Game"
|
||||||
android:screenOrientation="sensorLandscape"
|
android:screenOrientation="sensorLandscape"
|
||||||
|
android:theme="@style/StreamTheme"
|
||||||
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|screenLayout|fontScale|uiMode|orientation|screenSize|smallestScreenSize|layoutDirection" >
|
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|screenLayout|fontScale|uiMode|orientation|screenSize|smallestScreenSize|layoutDirection" >
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.support.PARENT_ACTIVITY"
|
android:name="android.support.PARENT_ACTIVITY"
|
||||||
|
|||||||
@@ -9,12 +9,13 @@ import java.util.List;
|
|||||||
import org.xmlpull.v1.XmlPullParserException;
|
import org.xmlpull.v1.XmlPullParserException;
|
||||||
|
|
||||||
import com.limelight.binding.PlatformBinding;
|
import com.limelight.binding.PlatformBinding;
|
||||||
|
import com.limelight.grid.AppGridAdapter;
|
||||||
import com.limelight.nvstream.http.GfeHttpResponseException;
|
import com.limelight.nvstream.http.GfeHttpResponseException;
|
||||||
import com.limelight.nvstream.http.NvApp;
|
import com.limelight.nvstream.http.NvApp;
|
||||||
import com.limelight.nvstream.http.NvHTTP;
|
import com.limelight.nvstream.http.NvHTTP;
|
||||||
import com.limelight.R;
|
|
||||||
import com.limelight.utils.Dialog;
|
import com.limelight.utils.Dialog;
|
||||||
import com.limelight.utils.SpinnerDialog;
|
import com.limelight.utils.SpinnerDialog;
|
||||||
|
import com.limelight.utils.UiHelper;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@@ -26,18 +27,17 @@ import android.view.View;
|
|||||||
import android.view.ContextMenu.ContextMenuInfo;
|
import android.view.ContextMenu.ContextMenuInfo;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.AdapterView.OnItemClickListener;
|
import android.widget.AdapterView.OnItemClickListener;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.GridView;
|
||||||
import android.widget.ListView;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import android.widget.AdapterView.AdapterContextMenuInfo;
|
import android.widget.AdapterView.AdapterContextMenuInfo;
|
||||||
|
|
||||||
public class AppView extends Activity {
|
public class AppView extends Activity {
|
||||||
private ListView appList;
|
private AppGridAdapter appGridAdapter;
|
||||||
private ArrayAdapter<AppObject> appListAdapter;
|
|
||||||
private InetAddress ipAddress;
|
private InetAddress ipAddress;
|
||||||
private String uniqueId;
|
private String uniqueId;
|
||||||
private boolean remote;
|
private boolean remote;
|
||||||
|
private boolean firstLoad = true;
|
||||||
|
|
||||||
private final static int RESUME_ID = 1;
|
private final static int RESUME_ID = 1;
|
||||||
private final static int QUIT_ID = 2;
|
private final static int QUIT_ID = 2;
|
||||||
@@ -53,14 +53,17 @@ public class AppView extends Activity {
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_app_view);
|
setContentView(R.layout.activity_app_view);
|
||||||
|
|
||||||
|
UiHelper.notifyNewRootView(this);
|
||||||
|
|
||||||
byte[] address = getIntent().getByteArrayExtra(ADDRESS_EXTRA);
|
byte[] address = getIntent().getByteArrayExtra(ADDRESS_EXTRA);
|
||||||
uniqueId = getIntent().getStringExtra(UNIQUEID_EXTRA);
|
uniqueId = getIntent().getStringExtra(UNIQUEID_EXTRA);
|
||||||
remote = getIntent().getBooleanExtra(REMOTE_EXTRA, false);
|
remote = getIntent().getBooleanExtra(REMOTE_EXTRA, false);
|
||||||
if (address == null || uniqueId == null) {
|
if (address == null || uniqueId == null) {
|
||||||
|
finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String labelText = "App List for "+getIntent().getStringExtra(NAME_EXTRA);
|
String labelText = getResources().getString(R.string.title_applist)+" "+getIntent().getStringExtra(NAME_EXTRA);
|
||||||
TextView label = (TextView) findViewById(R.id.appListText);
|
TextView label = (TextView) findViewById(R.id.appListText);
|
||||||
setTitle(labelText);
|
setTitle(labelText);
|
||||||
label.setText(labelText);
|
label.setText(labelText);
|
||||||
@@ -68,34 +71,39 @@ public class AppView extends Activity {
|
|||||||
try {
|
try {
|
||||||
ipAddress = InetAddress.getByAddress(address);
|
ipAddress = InetAddress.getByAddress(address);
|
||||||
} catch (UnknownHostException e) {
|
} catch (UnknownHostException e) {
|
||||||
return;
|
e.printStackTrace();
|
||||||
|
finish();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup the list view
|
// Setup the list view
|
||||||
appList = (ListView)findViewById(R.id.pcListView);
|
GridView appGrid = (GridView) findViewById(R.id.appGridView);
|
||||||
appListAdapter = new ArrayAdapter<AppObject>(this, R.layout.simplerow, R.id.rowTextView);
|
try {
|
||||||
appListAdapter.setNotifyOnChange(false);
|
appGridAdapter = new AppGridAdapter(this, ipAddress, uniqueId);
|
||||||
appList.setAdapter(appListAdapter);
|
} catch (Exception e) {
|
||||||
appList.setItemsCanFocus(true);
|
e.printStackTrace();
|
||||||
appList.setOnItemClickListener(new OnItemClickListener() {
|
finish();
|
||||||
@Override
|
return;
|
||||||
public void onItemClick(AdapterView<?> arg0, View arg1, int pos,
|
}
|
||||||
long id) {
|
appGrid.setAdapter(appGridAdapter);
|
||||||
AppObject app = appListAdapter.getItem(pos);
|
appGrid.setOnItemClickListener(new OnItemClickListener() {
|
||||||
if (app == null || app.app == null) {
|
@Override
|
||||||
return;
|
public void onItemClick(AdapterView<?> arg0, View arg1, int pos,
|
||||||
}
|
long id) {
|
||||||
|
AppObject app = (AppObject) appGridAdapter.getItem(pos);
|
||||||
|
if (app == null || app.app == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Only open the context menu if something is running, otherwise start it
|
// Only open the context menu if something is running, otherwise start it
|
||||||
if (getRunningAppId() != -1) {
|
if (getRunningAppId() != -1) {
|
||||||
openContextMenu(arg1);
|
openContextMenu(arg1);
|
||||||
}
|
} else {
|
||||||
else {
|
doStart(app.app);
|
||||||
doStart(app.app);
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
registerForContextMenu(appGrid);
|
||||||
registerForContextMenu(appList);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -110,13 +118,17 @@ public class AppView extends Activity {
|
|||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
updateAppList();
|
// Display the error message if it was the
|
||||||
|
// first load, but just kill the activity
|
||||||
|
// on subsequent errors
|
||||||
|
updateAppList(firstLoad);
|
||||||
|
firstLoad = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getRunningAppId() {
|
private int getRunningAppId() {
|
||||||
int runningAppId = -1;
|
int runningAppId = -1;
|
||||||
for (int i = 0; i < appListAdapter.getCount(); i++) {
|
for (int i = 0; i < appGridAdapter.getCount(); i++) {
|
||||||
AppObject app = appListAdapter.getItem(i);
|
AppObject app = (AppObject) appGridAdapter.getItem(i);
|
||||||
if (app.app == null) {
|
if (app.app == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -130,11 +142,11 @@ public class AppView extends Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
|
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
|
||||||
super.onCreateContextMenu(menu, v, menuInfo);
|
super.onCreateContextMenu(menu, v, menuInfo);
|
||||||
|
|
||||||
AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
|
AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
|
||||||
AppObject selectedApp = appListAdapter.getItem(info.position);
|
AppObject selectedApp = (AppObject) appGridAdapter.getItem(info.position);
|
||||||
if (selectedApp == null || selectedApp.app == null) {
|
if (selectedApp == null || selectedApp.app == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -142,12 +154,12 @@ public class AppView extends Activity {
|
|||||||
int runningAppId = getRunningAppId();
|
int runningAppId = getRunningAppId();
|
||||||
if (runningAppId != -1) {
|
if (runningAppId != -1) {
|
||||||
if (runningAppId == selectedApp.app.getAppId()) {
|
if (runningAppId == selectedApp.app.getAppId()) {
|
||||||
menu.add(Menu.NONE, RESUME_ID, 1, "Resume Session");
|
menu.add(Menu.NONE, RESUME_ID, 1, getResources().getString(R.string.applist_menu_resume));
|
||||||
menu.add(Menu.NONE, QUIT_ID, 2, "Quit Session");
|
menu.add(Menu.NONE, QUIT_ID, 2, getResources().getString(R.string.applist_menu_quit));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
menu.add(Menu.NONE, RESUME_ID, 1, "Quit Current Game and Start");
|
menu.add(Menu.NONE, RESUME_ID, 1, getResources().getString(R.string.applist_menu_quit_and_start));
|
||||||
menu.add(Menu.NONE, CANCEL_ID, 2, "Cancel");
|
menu.add(Menu.NONE, CANCEL_ID, 2, getResources().getString(R.string.applist_menu_cancel));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -159,41 +171,28 @@ public class AppView extends Activity {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onContextItemSelected(MenuItem item) {
|
public boolean onContextItemSelected(MenuItem item) {
|
||||||
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
|
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
|
||||||
AppObject app = appListAdapter.getItem(info.position);
|
AppObject app = (AppObject) appGridAdapter.getItem(info.position);
|
||||||
switch (item.getItemId())
|
switch (item.getItemId()) {
|
||||||
{
|
case RESUME_ID:
|
||||||
case RESUME_ID:
|
// Resume is the same as start for us
|
||||||
// Resume is the same as start for us
|
doStart(app.app);
|
||||||
doStart(app.app);
|
return true;
|
||||||
return true;
|
|
||||||
|
|
||||||
case QUIT_ID:
|
case QUIT_ID:
|
||||||
doQuit(app.app);
|
doQuit(app.app);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case CANCEL_ID:
|
case CANCEL_ID:
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return super.onContextItemSelected(item);
|
return super.onContextItemSelected(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String generateString(NvApp app) {
|
private void updateAppList(final boolean displayError) {
|
||||||
StringBuilder str = new StringBuilder();
|
final SpinnerDialog spinner = SpinnerDialog.displayDialog(this, getResources().getString(R.string.applist_refresh_title),
|
||||||
str.append(app.getAppName());
|
getResources().getString(R.string.applist_refresh_msg), true);
|
||||||
if (app.getIsRunning()) {
|
|
||||||
str.append(" - Running");
|
|
||||||
}
|
|
||||||
return str.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addListPlaceholder() {
|
|
||||||
appListAdapter.add(new AppObject("No apps found. Try rescanning for games in GeForce Experience.", null));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateAppList() {
|
|
||||||
final SpinnerDialog spinner = SpinnerDialog.displayDialog(this, "App List", "Refreshing app list...", true);
|
|
||||||
new Thread() {
|
new Thread() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@@ -205,17 +204,12 @@ public class AppView extends Activity {
|
|||||||
AppView.this.runOnUiThread(new Runnable() {
|
AppView.this.runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
appListAdapter.clear();
|
appGridAdapter.clear();
|
||||||
if (appList.isEmpty()) {
|
for (NvApp app : appList) {
|
||||||
addListPlaceholder();
|
appGridAdapter.addApp(new AppObject(app));
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
for (NvApp app : appList) {
|
|
||||||
appListAdapter.add(new AppObject(generateString(app), app));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
appListAdapter.notifyDataSetChanged();
|
appGridAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -228,7 +222,19 @@ public class AppView extends Activity {
|
|||||||
spinner.dismiss();
|
spinner.dismiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
Dialog.displayDialog(AppView.this, "Error", "Failed to get app list", true);
|
if (displayError) {
|
||||||
|
Dialog.displayDialog(AppView.this, getResources().getString(R.string.applist_refresh_error_title),
|
||||||
|
getResources().getString(R.string.applist_refresh_error_msg), true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Just finish the activity immediately
|
||||||
|
AppView.this.runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}.start();
|
}.start();
|
||||||
}
|
}
|
||||||
@@ -243,7 +249,7 @@ public class AppView extends Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void doQuit(final NvApp app) {
|
private void doQuit(final NvApp app) {
|
||||||
Toast.makeText(AppView.this, "Quitting "+app.getAppName()+"...", Toast.LENGTH_SHORT).show();
|
Toast.makeText(AppView.this, getResources().getString(R.string.applist_quit_app)+" "+app.getAppName()+"...", Toast.LENGTH_SHORT).show();
|
||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@@ -252,17 +258,16 @@ public class AppView extends Activity {
|
|||||||
try {
|
try {
|
||||||
httpConn = new NvHTTP(ipAddress, uniqueId, null, PlatformBinding.getCryptoProvider(AppView.this));
|
httpConn = new NvHTTP(ipAddress, uniqueId, null, PlatformBinding.getCryptoProvider(AppView.this));
|
||||||
if (httpConn.quitApp()) {
|
if (httpConn.quitApp()) {
|
||||||
message = "Successfully quit "+app.getAppName();
|
message = getResources().getString(R.string.applist_quit_success)+" "+app.getAppName();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
message = "Failed to quit "+app.getAppName();
|
message = getResources().getString(R.string.applist_quit_fail)+" "+app.getAppName();
|
||||||
}
|
}
|
||||||
updateAppList();
|
updateAppList(true);
|
||||||
} catch (UnknownHostException e) {
|
} catch (UnknownHostException e) {
|
||||||
message = "Failed to resolve host";
|
message = getResources().getString(R.string.error_unknown_host);
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
message = "GFE returned an HTTP 404 error. Make sure your PC is running a supported GPU. Using remote desktop software can also cause this error. "
|
message = getResources().getString(R.string.error_404);
|
||||||
+ "Try rebooting your machine or reinstalling GFE.";
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
message = e.getMessage();
|
message = e.getMessage();
|
||||||
}
|
}
|
||||||
@@ -279,17 +284,15 @@ public class AppView extends Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class AppObject {
|
public class AppObject {
|
||||||
public String text;
|
|
||||||
public NvApp app;
|
public NvApp app;
|
||||||
|
|
||||||
public AppObject(String text, NvApp app) {
|
public AppObject(NvApp app) {
|
||||||
this.text = text;
|
|
||||||
this.app = app;
|
this.app = app;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return text;
|
return app.getAppName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.limelight;
|
package com.limelight;
|
||||||
|
|
||||||
|
|
||||||
|
import com.limelight.LimelightBuildProps;
|
||||||
import com.limelight.binding.PlatformBinding;
|
import com.limelight.binding.PlatformBinding;
|
||||||
import com.limelight.binding.input.ControllerHandler;
|
import com.limelight.binding.input.ControllerHandler;
|
||||||
import com.limelight.binding.input.KeyboardTranslator;
|
import com.limelight.binding.input.KeyboardTranslator;
|
||||||
@@ -115,10 +116,11 @@ public class Game extends Activity implements SurfaceHolder.Callback,
|
|||||||
setContentView(R.layout.activity_game);
|
setContentView(R.layout.activity_game);
|
||||||
|
|
||||||
// Start the spinner
|
// Start the spinner
|
||||||
spinner = SpinnerDialog.displayDialog(this, "Establishing Connection", "Starting connection", true);
|
spinner = SpinnerDialog.displayDialog(this, getResources().getString(R.string.conn_establishing_title),
|
||||||
|
getResources().getString(R.string.conn_establishing_msg), true);
|
||||||
|
|
||||||
// Read the stream preferences
|
// Read the stream preferences
|
||||||
prefConfig = PreferenceConfiguration.readPreferences(this);
|
prefConfig = PreferenceConfiguration.readPreferences(this);
|
||||||
switch (prefConfig.decoder) {
|
switch (prefConfig.decoder) {
|
||||||
case PreferenceConfiguration.FORCE_SOFTWARE_DECODER:
|
case PreferenceConfiguration.FORCE_SOFTWARE_DECODER:
|
||||||
drFlags |= VideoDecoderRenderer.FLAG_FORCE_SOFTWARE_DECODING;
|
drFlags |= VideoDecoderRenderer.FLAG_FORCE_SOFTWARE_DECODING;
|
||||||
@@ -143,17 +145,18 @@ public class Game extends Activity implements SurfaceHolder.Callback,
|
|||||||
sv.setOnTouchListener(this);
|
sv.setOnTouchListener(this);
|
||||||
|
|
||||||
// Warn the user if they're on a metered connection
|
// Warn the user if they're on a metered connection
|
||||||
checkDataConnection();
|
checkDataConnection();
|
||||||
|
|
||||||
// Make sure Wi-Fi is fully powered up
|
// Make sure Wi-Fi is fully powered up
|
||||||
WifiManager wifiMgr = (WifiManager) getSystemService(Context.WIFI_SERVICE);
|
WifiManager wifiMgr = (WifiManager) getSystemService(Context.WIFI_SERVICE);
|
||||||
wifiLock = wifiMgr.createWifiLock(WifiManager.WIFI_MODE_FULL_HIGH_PERF, "Limelight");
|
wifiLock = wifiMgr.createWifiLock(WifiManager.WIFI_MODE_FULL_HIGH_PERF, "Limelight");
|
||||||
wifiLock.setReferenceCounted(false);
|
wifiLock.setReferenceCounted(false);
|
||||||
wifiLock.acquire();
|
wifiLock.acquire();
|
||||||
|
|
||||||
String host = Game.this.getIntent().getStringExtra(EXTRA_HOST);
|
String host = Game.this.getIntent().getStringExtra(EXTRA_HOST);
|
||||||
String app = Game.this.getIntent().getStringExtra(EXTRA_APP);
|
String app = Game.this.getIntent().getStringExtra(EXTRA_APP);
|
||||||
String uniqueId = Game.this.getIntent().getStringExtra(EXTRA_UNIQUEID);
|
String uniqueId = Game.this.getIntent().getStringExtra(EXTRA_UNIQUEID);
|
||||||
|
boolean remote = Game.this.getIntent().getBooleanExtra(EXTRA_STREAMING_REMOTE, false);
|
||||||
|
|
||||||
decoderRenderer = new ConfigurableDecoderRenderer();
|
decoderRenderer = new ConfigurableDecoderRenderer();
|
||||||
decoderRenderer.initializeWithFlags(drFlags);
|
decoderRenderer.initializeWithFlags(drFlags);
|
||||||
@@ -167,12 +170,14 @@ public class Game extends Activity implements SurfaceHolder.Callback,
|
|||||||
.enableAdaptiveResolution((decoderRenderer.getCapabilities() &
|
.enableAdaptiveResolution((decoderRenderer.getCapabilities() &
|
||||||
VideoDecoderRenderer.CAPABILITY_ADAPTIVE_RESOLUTION) != 0)
|
VideoDecoderRenderer.CAPABILITY_ADAPTIVE_RESOLUTION) != 0)
|
||||||
.enableLocalAudioPlayback(prefConfig.playHostAudio)
|
.enableLocalAudioPlayback(prefConfig.playHostAudio)
|
||||||
|
.setMaxPacketSize(remote ? 1024 : 1292)
|
||||||
|
.setRemote(remote)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// Initialize the connection
|
// Initialize the connection
|
||||||
conn = new NvConnection(host, uniqueId, Game.this, config, PlatformBinding.getCryptoProvider(this));
|
conn = new NvConnection(host, uniqueId, Game.this, config, PlatformBinding.getCryptoProvider(this));
|
||||||
keybTranslator = new KeyboardTranslator(conn);
|
keybTranslator = new KeyboardTranslator(conn);
|
||||||
controllerHandler = new ControllerHandler(conn);
|
controllerHandler = new ControllerHandler(conn, prefConfig.deadzonePercentage);
|
||||||
|
|
||||||
SurfaceHolder sh = sv.getHolder();
|
SurfaceHolder sh = sv.getHolder();
|
||||||
if (prefConfig.stretchVideo || !decoderRenderer.isHardwareAccelerated()) {
|
if (prefConfig.stretchVideo || !decoderRenderer.isHardwareAccelerated()) {
|
||||||
@@ -182,7 +187,9 @@ public class Game extends Activity implements SurfaceHolder.Callback,
|
|||||||
|
|
||||||
// Initialize touch contexts
|
// Initialize touch contexts
|
||||||
for (int i = 0; i < touchContextMap.length; i++) {
|
for (int i = 0; i < touchContextMap.length; i++) {
|
||||||
touchContextMap[i] = new TouchContext(conn, i);
|
touchContextMap[i] = new TouchContext(conn, i,
|
||||||
|
((double)prefConfig.width / (double)screenSize.x),
|
||||||
|
((double)prefConfig.height / (double)screenSize.y));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LimelightBuildProps.ROOT_BUILD) {
|
if (LimelightBuildProps.ROOT_BUILD) {
|
||||||
@@ -214,7 +221,7 @@ public class Game extends Activity implements SurfaceHolder.Callback,
|
|||||||
{
|
{
|
||||||
ConnectivityManager mgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
|
ConnectivityManager mgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||||
if (mgr.isActiveNetworkMetered()) {
|
if (mgr.isActiveNetworkMetered()) {
|
||||||
displayTransientMessage("Warning: Your active network connection is metered!");
|
displayTransientMessage(getResources().getString(R.string.conn_metered));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -262,13 +269,13 @@ public class Game extends Activity implements SurfaceHolder.Callback,
|
|||||||
int averageDecoderLat = decoderRenderer.getAverageDecoderLatency();
|
int averageDecoderLat = decoderRenderer.getAverageDecoderLatency();
|
||||||
String message = null;
|
String message = null;
|
||||||
if (averageEndToEndLat > 0) {
|
if (averageEndToEndLat > 0) {
|
||||||
message = "Average client-side frame latency: "+averageEndToEndLat+" ms";
|
message = getResources().getString(R.string.conn_client_latency)+" "+averageEndToEndLat+" ms";
|
||||||
if (averageDecoderLat > 0) {
|
if (averageDecoderLat > 0) {
|
||||||
message += " (hardware decoder latency: "+averageDecoderLat+" ms)";
|
message += " ("+getResources().getString(R.string.conn_client_latency_hw)+" "+averageDecoderLat+" ms)";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (averageDecoderLat > 0) {
|
else if (averageDecoderLat > 0) {
|
||||||
message = "Average hardware decoder latency: "+averageDecoderLat+" ms";
|
message = getResources().getString(R.string.conn_hardware_latency)+" "+averageDecoderLat+" ms";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message != null) {
|
if (message != null) {
|
||||||
@@ -383,18 +390,13 @@ public class Game extends Activity implements SurfaceHolder.Callback,
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||||
InputDevice dev = event.getDevice();
|
|
||||||
if (dev == null) {
|
|
||||||
return super.onKeyDown(keyCode, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pass-through virtual navigation keys
|
// Pass-through virtual navigation keys
|
||||||
if ((event.getFlags() & KeyEvent.FLAG_VIRTUAL_HARD_KEY) != 0) {
|
if ((event.getFlags() & KeyEvent.FLAG_VIRTUAL_HARD_KEY) != 0) {
|
||||||
return super.onKeyDown(keyCode, event);
|
return super.onKeyDown(keyCode, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try the controller handler first
|
// Try the controller handler first
|
||||||
boolean handled = controllerHandler.handleButtonDown(keyCode, event);
|
boolean handled = controllerHandler.handleButtonDown(event);
|
||||||
if (!handled) {
|
if (!handled) {
|
||||||
// Try the keyboard handler
|
// Try the keyboard handler
|
||||||
short translated = keybTranslator.translate(event.getKeyCode());
|
short translated = keybTranslator.translate(event.getKeyCode());
|
||||||
@@ -426,18 +428,13 @@ public class Game extends Activity implements SurfaceHolder.Callback,
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
||||||
InputDevice dev = event.getDevice();
|
|
||||||
if (dev == null) {
|
|
||||||
return super.onKeyUp(keyCode, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pass-through virtual navigation keys
|
// Pass-through virtual navigation keys
|
||||||
if ((event.getFlags() & KeyEvent.FLAG_VIRTUAL_HARD_KEY) != 0) {
|
if ((event.getFlags() & KeyEvent.FLAG_VIRTUAL_HARD_KEY) != 0) {
|
||||||
return super.onKeyUp(keyCode, event);
|
return super.onKeyUp(keyCode, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try the controller handler first
|
// Try the controller handler first
|
||||||
boolean handled = controllerHandler.handleButtonUp(keyCode, event);
|
boolean handled = controllerHandler.handleButtonUp(event);
|
||||||
if (!handled) {
|
if (!handled) {
|
||||||
// Try the keyboard handler
|
// Try the keyboard handler
|
||||||
short translated = keybTranslator.translate(event.getKeyCode());
|
short translated = keybTranslator.translate(event.getKeyCode());
|
||||||
@@ -516,8 +513,27 @@ public class Game extends Activity implements SurfaceHolder.Callback,
|
|||||||
case MotionEvent.ACTION_MOVE:
|
case MotionEvent.ACTION_MOVE:
|
||||||
// ACTION_MOVE is special because it always has actionIndex == 0
|
// ACTION_MOVE is special because it always has actionIndex == 0
|
||||||
// We'll call the move handlers for all indexes manually
|
// We'll call the move handlers for all indexes manually
|
||||||
|
|
||||||
|
// First process the historical events
|
||||||
|
for (int i = 0; i < event.getHistorySize(); i++) {
|
||||||
|
for (TouchContext aTouchContextMap : touchContextMap) {
|
||||||
|
if (aTouchContextMap.getActionIndex() < event.getPointerCount())
|
||||||
|
{
|
||||||
|
aTouchContextMap.touchMoveEvent(
|
||||||
|
(int)event.getHistoricalX(aTouchContextMap.getActionIndex(), i),
|
||||||
|
(int)event.getHistoricalY(aTouchContextMap.getActionIndex(), i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now process the current values
|
||||||
for (TouchContext aTouchContextMap : touchContextMap) {
|
for (TouchContext aTouchContextMap : touchContextMap) {
|
||||||
aTouchContextMap.touchMoveEvent(eventX, eventY);
|
if (aTouchContextMap.getActionIndex() < event.getPointerCount())
|
||||||
|
{
|
||||||
|
aTouchContextMap.touchMoveEvent(
|
||||||
|
(int)event.getX(aTouchContextMap.getActionIndex()),
|
||||||
|
(int)event.getY(aTouchContextMap.getActionIndex()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -562,9 +578,15 @@ public class Game extends Activity implements SurfaceHolder.Callback,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateMousePosition((int)event.getX(), (int)event.getY());
|
// First process the history
|
||||||
|
for (int i = 0; i < event.getHistorySize(); i++) {
|
||||||
|
updateMousePosition((int)event.getHistoricalX(i), (int)event.getHistoricalY(i));
|
||||||
|
}
|
||||||
|
|
||||||
lastButtonState = event.getButtonState();
|
// Now process the current values
|
||||||
|
updateMousePosition((int)event.getX(), (int)event.getY());
|
||||||
|
|
||||||
|
lastButtonState = event.getButtonState();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -629,7 +651,7 @@ public class Game extends Activity implements SurfaceHolder.Callback,
|
|||||||
@Override
|
@Override
|
||||||
public void stageStarting(Stage stage) {
|
public void stageStarting(Stage stage) {
|
||||||
if (spinner != null) {
|
if (spinner != null) {
|
||||||
spinner.setMessage("Starting "+stage.getName());
|
spinner.setMessage(getResources().getString(R.string.conn_starting)+" "+stage.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -660,7 +682,8 @@ public class Game extends Activity implements SurfaceHolder.Callback,
|
|||||||
if (!displayedFailureDialog) {
|
if (!displayedFailureDialog) {
|
||||||
displayedFailureDialog = true;
|
displayedFailureDialog = true;
|
||||||
stopConnection();
|
stopConnection();
|
||||||
Dialog.displayDialog(this, "Connection Error", "Starting "+stage.getName()+" failed", true);
|
Dialog.displayDialog(this, getResources().getString(R.string.conn_error_title),
|
||||||
|
getResources().getString(R.string.conn_error_msg)+" "+stage.getName(), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -671,7 +694,8 @@ public class Game extends Activity implements SurfaceHolder.Callback,
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
||||||
stopConnection();
|
stopConnection();
|
||||||
Dialog.displayDialog(this, "Connection Terminated", "The connection failed unexpectedly", true);
|
Dialog.displayDialog(this, getResources().getString(R.string.conn_terminated_title),
|
||||||
|
getResources().getString(R.string.conn_terminated_msg), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import com.limelight.binding.PlatformBinding;
|
|||||||
import com.limelight.binding.crypto.AndroidCryptoProvider;
|
import com.limelight.binding.crypto.AndroidCryptoProvider;
|
||||||
import com.limelight.computers.ComputerManagerListener;
|
import com.limelight.computers.ComputerManagerListener;
|
||||||
import com.limelight.computers.ComputerManagerService;
|
import com.limelight.computers.ComputerManagerService;
|
||||||
|
import com.limelight.grid.PcGridAdapter;
|
||||||
import com.limelight.nvstream.http.ComputerDetails;
|
import com.limelight.nvstream.http.ComputerDetails;
|
||||||
import com.limelight.nvstream.http.NvHTTP;
|
import com.limelight.nvstream.http.NvHTTP;
|
||||||
import com.limelight.nvstream.http.PairingManager;
|
import com.limelight.nvstream.http.PairingManager;
|
||||||
@@ -17,6 +18,7 @@ import com.limelight.nvstream.wol.WakeOnLanSender;
|
|||||||
import com.limelight.preferences.AddComputerManually;
|
import com.limelight.preferences.AddComputerManually;
|
||||||
import com.limelight.preferences.StreamSettings;
|
import com.limelight.preferences.StreamSettings;
|
||||||
import com.limelight.utils.Dialog;
|
import com.limelight.utils.Dialog;
|
||||||
|
import com.limelight.utils.UiHelper;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.Service;
|
import android.app.Service;
|
||||||
@@ -35,16 +37,15 @@ import android.view.ContextMenu.ContextMenuInfo;
|
|||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.AdapterView.OnItemClickListener;
|
import android.widget.AdapterView.OnItemClickListener;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.GridView;
|
||||||
import android.widget.Button;
|
import android.widget.ImageButton;
|
||||||
import android.widget.ListView;
|
import android.widget.RelativeLayout;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import android.widget.AdapterView.AdapterContextMenuInfo;
|
import android.widget.AdapterView.AdapterContextMenuInfo;
|
||||||
|
|
||||||
public class PcView extends Activity {
|
public class PcView extends Activity {
|
||||||
private Button settingsButton, addComputerButton;
|
private RelativeLayout noPcFoundLayout;
|
||||||
private ListView pcList;
|
private PcGridAdapter pcGridAdapter;
|
||||||
private ArrayAdapter<ComputerObject> pcListAdapter;
|
|
||||||
private ComputerManagerService.ComputerManagerBinder managerBinder;
|
private ComputerManagerService.ComputerManagerBinder managerBinder;
|
||||||
private boolean freezeUpdates, runningPolling;
|
private boolean freezeUpdates, runningPolling;
|
||||||
private ServiceConnection serviceConnection = new ServiceConnection() {
|
private ServiceConnection serviceConnection = new ServiceConnection() {
|
||||||
@@ -92,60 +93,59 @@ public class PcView extends Activity {
|
|||||||
private void initializeViews() {
|
private void initializeViews() {
|
||||||
setContentView(R.layout.activity_pc_view);
|
setContentView(R.layout.activity_pc_view);
|
||||||
|
|
||||||
|
UiHelper.notifyNewRootView(this);
|
||||||
|
|
||||||
// Set default preferences if we've never been run
|
// Set default preferences if we've never been run
|
||||||
PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
|
PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
|
||||||
|
|
||||||
// Setup the list view
|
// Setup the list view
|
||||||
settingsButton = (Button)findViewById(R.id.settingsButton);
|
ImageButton settingsButton = (ImageButton) findViewById(R.id.settingsButton);
|
||||||
addComputerButton = (Button)findViewById(R.id.manuallyAddPc);
|
ImageButton addComputerButton = (ImageButton) findViewById(R.id.manuallyAddPc);
|
||||||
|
|
||||||
pcList = (ListView)findViewById(R.id.pcListView);
|
GridView pcGrid = (GridView) findViewById(R.id.pcGridView);
|
||||||
pcList.setAdapter(pcListAdapter);
|
pcGrid.setAdapter(pcGridAdapter);
|
||||||
pcList.setItemsCanFocus(true);
|
pcGrid.setOnItemClickListener(new OnItemClickListener() {
|
||||||
pcList.setOnItemClickListener(new OnItemClickListener() {
|
@Override
|
||||||
@Override
|
public void onItemClick(AdapterView<?> arg0, View arg1, int pos,
|
||||||
public void onItemClick(AdapterView<?> arg0, View arg1, int pos,
|
long id) {
|
||||||
long id) {
|
ComputerObject computer = (ComputerObject) pcGridAdapter.getItem(pos);
|
||||||
ComputerObject computer = pcListAdapter.getItem(pos);
|
if (computer.details.reachability == ComputerDetails.Reachability.UNKNOWN) {
|
||||||
if (computer.details == null) {
|
// Do nothing
|
||||||
// Placeholder item; no context menu for it
|
} else if (computer.details.reachability == ComputerDetails.Reachability.OFFLINE) {
|
||||||
return;
|
// Open the context menu if a PC is offline
|
||||||
}
|
openContextMenu(arg1);
|
||||||
else if (computer.details.reachability == ComputerDetails.Reachability.OFFLINE) {
|
} else if (computer.details.pairState != PairState.PAIRED) {
|
||||||
// Open the context menu if a PC is offline
|
// Pair an unpaired machine by default
|
||||||
openContextMenu(arg1);
|
doPair(computer.details);
|
||||||
}
|
} else {
|
||||||
else if (computer.details.pairState != PairState.PAIRED) {
|
doAppList(computer.details);
|
||||||
// Pair an unpaired machine by default
|
}
|
||||||
doPair(computer.details);
|
}
|
||||||
}
|
});
|
||||||
else {
|
registerForContextMenu(pcGrid);
|
||||||
doAppList(computer.details);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
registerForContextMenu(pcList);
|
|
||||||
settingsButton.setOnClickListener(new OnClickListener() {
|
settingsButton.setOnClickListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
startActivity(new Intent(PcView.this, StreamSettings.class));
|
startActivity(new Intent(PcView.this, StreamSettings.class));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
addComputerButton.setOnClickListener(new OnClickListener() {
|
addComputerButton.setOnClickListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Intent i = new Intent(PcView.this, AddComputerManually.class);
|
Intent i = new Intent(PcView.this, AddComputerManually.class);
|
||||||
startActivity(i);
|
startActivity(i);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (pcListAdapter.isEmpty()) {
|
noPcFoundLayout = (RelativeLayout) findViewById(R.id.no_pc_found_layout);
|
||||||
addListPlaceholder();
|
if (pcGridAdapter.getCount() == 0) {
|
||||||
}
|
noPcFoundLayout.setVisibility(View.VISIBLE);
|
||||||
else {
|
}
|
||||||
pcListAdapter.notifyDataSetChanged();
|
else {
|
||||||
}
|
noPcFoundLayout.setVisibility(View.INVISIBLE);
|
||||||
}
|
}
|
||||||
|
pcGridAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -155,8 +155,7 @@ public class PcView extends Activity {
|
|||||||
bindService(new Intent(PcView.this, ComputerManagerService.class), serviceConnection,
|
bindService(new Intent(PcView.this, ComputerManagerService.class), serviceConnection,
|
||||||
Service.BIND_AUTO_CREATE);
|
Service.BIND_AUTO_CREATE);
|
||||||
|
|
||||||
pcListAdapter = new ArrayAdapter<ComputerObject>(this, R.layout.simplerow, R.id.rowTextView);
|
pcGridAdapter = new PcGridAdapter(this);
|
||||||
pcListAdapter.setNotifyOnChange(false);
|
|
||||||
|
|
||||||
initializeViews();
|
initializeViews();
|
||||||
}
|
}
|
||||||
@@ -175,7 +174,7 @@ public class PcView extends Activity {
|
|||||||
PcView.this.runOnUiThread(new Runnable() {
|
PcView.this.runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
updateListView(details);
|
updateComputer(details);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -234,33 +233,32 @@ public class PcView extends Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
|
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
|
||||||
stopComputerUpdates(false);
|
stopComputerUpdates(false);
|
||||||
|
|
||||||
// Call superclass
|
// Call superclass
|
||||||
super.onCreateContextMenu(menu, v, menuInfo);
|
super.onCreateContextMenu(menu, v, menuInfo);
|
||||||
|
|
||||||
AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
|
AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
|
||||||
ComputerObject computer = pcListAdapter.getItem(info.position);
|
ComputerObject computer = (ComputerObject) pcGridAdapter.getItem(info.position);
|
||||||
if (computer == null || computer.details == null) {
|
if (computer == null || computer.details == null ||
|
||||||
|
computer.details.reachability == ComputerDetails.Reachability.UNKNOWN) {
|
||||||
startComputerUpdates();
|
startComputerUpdates();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inflate the context menu
|
// Inflate the context menu
|
||||||
if (computer.details.reachability == ComputerDetails.Reachability.OFFLINE) {
|
if (computer.details.reachability == ComputerDetails.Reachability.OFFLINE) {
|
||||||
menu.add(Menu.NONE, WOL_ID, 1, "Send Wake-On-LAN request");
|
menu.add(Menu.NONE, WOL_ID, 1, getResources().getString(R.string.pcview_menu_send_wol));
|
||||||
menu.add(Menu.NONE, DELETE_ID, 2, "Delete PC");
|
menu.add(Menu.NONE, DELETE_ID, 2, getResources().getString(R.string.pcview_menu_delete_pc));
|
||||||
}
|
}
|
||||||
else if (computer.details.pairState != PairState.PAIRED) {
|
else if (computer.details.pairState != PairState.PAIRED) {
|
||||||
menu.add(Menu.NONE, PAIR_ID, 1, "Pair with PC");
|
menu.add(Menu.NONE, PAIR_ID, 1, getResources().getString(R.string.pcview_menu_pair_pc));
|
||||||
if (computer.details.reachability == ComputerDetails.Reachability.REMOTE) {
|
menu.add(Menu.NONE, DELETE_ID, 2, getResources().getString(R.string.pcview_menu_delete_pc));
|
||||||
menu.add(Menu.NONE, DELETE_ID, 2, "Delete PC");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
menu.add(Menu.NONE, APP_LIST_ID, 1, "View Game List");
|
menu.add(Menu.NONE, APP_LIST_ID, 1, getResources().getString(R.string.pcview_menu_app_list));
|
||||||
menu.add(Menu.NONE, UNPAIR_ID, 2, "Unpair");
|
menu.add(Menu.NONE, UNPAIR_ID, 2, getResources().getString(R.string.pcview_menu_unpair_pc));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -271,26 +269,25 @@ public class PcView extends Activity {
|
|||||||
|
|
||||||
private void doPair(final ComputerDetails computer) {
|
private void doPair(final ComputerDetails computer) {
|
||||||
if (computer.reachability == ComputerDetails.Reachability.OFFLINE) {
|
if (computer.reachability == ComputerDetails.Reachability.OFFLINE) {
|
||||||
Toast.makeText(PcView.this, "Computer is offline", Toast.LENGTH_SHORT).show();
|
Toast.makeText(PcView.this, getResources().getString(R.string.pair_pc_offline), Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (computer.runningGameId != 0) {
|
if (computer.runningGameId != 0) {
|
||||||
Toast.makeText(PcView.this, "Computer is currently in a game. " +
|
Toast.makeText(PcView.this, getResources().getString(R.string.pair_pc_ingame), Toast.LENGTH_LONG).show();
|
||||||
"You must close the game before pairing.", Toast.LENGTH_LONG).show();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (managerBinder == null) {
|
if (managerBinder == null) {
|
||||||
Toast.makeText(PcView.this, "The ComputerManager service is not running. " +
|
Toast.makeText(PcView.this, getResources().getString(R.string.error_manager_not_running), Toast.LENGTH_LONG).show();
|
||||||
"Please wait a few seconds or restart the app.", Toast.LENGTH_LONG).show();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Toast.makeText(PcView.this, "Pairing...", Toast.LENGTH_SHORT).show();
|
Toast.makeText(PcView.this, getResources().getString(R.string.pairing), Toast.LENGTH_SHORT).show();
|
||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
NvHTTP httpConn;
|
NvHTTP httpConn;
|
||||||
String message;
|
String message;
|
||||||
|
boolean success = false;
|
||||||
try {
|
try {
|
||||||
// Stop updates and wait while pairing
|
// Stop updates and wait while pairing
|
||||||
stopComputerUpdates(true);
|
stopComputerUpdates(true);
|
||||||
@@ -308,23 +305,28 @@ public class PcView extends Activity {
|
|||||||
PlatformBinding.getDeviceName(),
|
PlatformBinding.getDeviceName(),
|
||||||
PlatformBinding.getCryptoProvider(PcView.this));
|
PlatformBinding.getCryptoProvider(PcView.this));
|
||||||
if (httpConn.getPairState() == PairingManager.PairState.PAIRED) {
|
if (httpConn.getPairState() == PairingManager.PairState.PAIRED) {
|
||||||
message = "Already paired";
|
// Don't display any toast, but open the app list
|
||||||
|
message = null;
|
||||||
|
success = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
final String pinStr = PairingManager.generatePinString();
|
final String pinStr = PairingManager.generatePinString();
|
||||||
|
|
||||||
// Spin the dialog off in a thread because it blocks
|
// Spin the dialog off in a thread because it blocks
|
||||||
Dialog.displayDialog(PcView.this, "Pairing", "Please enter the following PIN on the target PC: "+pinStr, false);
|
Dialog.displayDialog(PcView.this, getResources().getString(R.string.pair_pairing_title),
|
||||||
|
getResources().getString(R.string.pair_pairing_msg)+" "+pinStr, false);
|
||||||
|
|
||||||
PairingManager.PairState pairState = httpConn.pair(pinStr);
|
PairingManager.PairState pairState = httpConn.pair(pinStr);
|
||||||
if (pairState == PairingManager.PairState.PIN_WRONG) {
|
if (pairState == PairingManager.PairState.PIN_WRONG) {
|
||||||
message = "Incorrect PIN";
|
message = getResources().getString(R.string.pair_incorrect_pin);
|
||||||
}
|
}
|
||||||
else if (pairState == PairingManager.PairState.FAILED) {
|
else if (pairState == PairingManager.PairState.FAILED) {
|
||||||
message = "Pairing failed";
|
message = getResources().getString(R.string.pair_fail);
|
||||||
}
|
}
|
||||||
else if (pairState == PairingManager.PairState.PAIRED) {
|
else if (pairState == PairingManager.PairState.PAIRED) {
|
||||||
message = "Paired successfully";
|
// Just navigate to the app view without displaying a toast
|
||||||
|
message = null;
|
||||||
|
success = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Should be no other values
|
// Should be no other values
|
||||||
@@ -332,21 +334,29 @@ public class PcView extends Activity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (UnknownHostException e) {
|
} catch (UnknownHostException e) {
|
||||||
message = "Failed to resolve host";
|
message = getResources().getString(R.string.error_unknown_host);
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
message = "GFE returned an HTTP 404 error. Make sure your PC is running a supported GPU. Using remote desktop software can also cause this error. "
|
message = getResources().getString(R.string.error_404);
|
||||||
+ "Try rebooting your machine or reinstalling GFE.";
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
message = e.getMessage();
|
message = e.getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
Dialog.closeDialogs();
|
Dialog.closeDialogs();
|
||||||
|
|
||||||
final String toastMessage = message;
|
final String toastMessage = message;
|
||||||
|
final boolean toastSuccess = success;
|
||||||
runOnUiThread(new Runnable() {
|
runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Toast.makeText(PcView.this, toastMessage, Toast.LENGTH_LONG).show();
|
if (toastMessage != null) {
|
||||||
|
Toast.makeText(PcView.this, toastMessage, Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (toastSuccess) {
|
||||||
|
// Open the app list after a successful pairing attemp
|
||||||
|
doAppList(computer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -358,26 +368,25 @@ public class PcView extends Activity {
|
|||||||
|
|
||||||
private void doWakeOnLan(final ComputerDetails computer) {
|
private void doWakeOnLan(final ComputerDetails computer) {
|
||||||
if (computer.reachability != ComputerDetails.Reachability.OFFLINE) {
|
if (computer.reachability != ComputerDetails.Reachability.OFFLINE) {
|
||||||
Toast.makeText(PcView.this, "Computer is online", Toast.LENGTH_SHORT).show();
|
Toast.makeText(PcView.this, getResources().getString(R.string.wol_pc_online), Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (computer.macAddress == null) {
|
if (computer.macAddress == null) {
|
||||||
Toast.makeText(PcView.this, "Unable to wake PC because GFE didn't send a MAC address", Toast.LENGTH_SHORT).show();
|
Toast.makeText(PcView.this, getResources().getString(R.string.wol_no_mac), Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Toast.makeText(PcView.this, "Waking PC...", Toast.LENGTH_SHORT).show();
|
Toast.makeText(PcView.this, getResources().getString(R.string.wol_waking_pc), Toast.LENGTH_SHORT).show();
|
||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
String message;
|
String message;
|
||||||
try {
|
try {
|
||||||
WakeOnLanSender.sendWolPacket(computer);
|
WakeOnLanSender.sendWolPacket(computer);
|
||||||
message = "It may take a few seconds for your PC to wake up. " +
|
message = getResources().getString(R.string.wol_waking_msg);
|
||||||
"If it doesn't, make sure it's configured properly for Wake-On-LAN.";
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
message = "Failed to send Wake-On-LAN packets";
|
message = getResources().getString(R.string.wol_fail);
|
||||||
}
|
}
|
||||||
|
|
||||||
final String toastMessage = message;
|
final String toastMessage = message;
|
||||||
@@ -393,16 +402,15 @@ public class PcView extends Activity {
|
|||||||
|
|
||||||
private void doUnpair(final ComputerDetails computer) {
|
private void doUnpair(final ComputerDetails computer) {
|
||||||
if (computer.reachability == ComputerDetails.Reachability.OFFLINE) {
|
if (computer.reachability == ComputerDetails.Reachability.OFFLINE) {
|
||||||
Toast.makeText(PcView.this, "Computer is offline", Toast.LENGTH_SHORT).show();
|
Toast.makeText(PcView.this, getResources().getString(R.string.error_pc_offline), Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (managerBinder == null) {
|
if (managerBinder == null) {
|
||||||
Toast.makeText(PcView.this, "The ComputerManager service is not running. " +
|
Toast.makeText(PcView.this, getResources().getString(R.string.error_manager_not_running), Toast.LENGTH_LONG).show();
|
||||||
"Please wait a few seconds or restart the app.", Toast.LENGTH_LONG).show();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Toast.makeText(PcView.this, "Unpairing...", Toast.LENGTH_SHORT).show();
|
Toast.makeText(PcView.this, getResources().getString(R.string.unpairing), Toast.LENGTH_SHORT).show();
|
||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@@ -424,20 +432,19 @@ public class PcView extends Activity {
|
|||||||
if (httpConn.getPairState() == PairingManager.PairState.PAIRED) {
|
if (httpConn.getPairState() == PairingManager.PairState.PAIRED) {
|
||||||
httpConn.unpair();
|
httpConn.unpair();
|
||||||
if (httpConn.getPairState() == PairingManager.PairState.NOT_PAIRED) {
|
if (httpConn.getPairState() == PairingManager.PairState.NOT_PAIRED) {
|
||||||
message = "Unpaired successfully";
|
message = getResources().getString(R.string.unpair_success);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
message = "Failed to unpair";
|
message = getResources().getString(R.string.unpair_fail);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
message = "Device was not paired";
|
message = getResources().getString(R.string.unpair_error);
|
||||||
}
|
}
|
||||||
} catch (UnknownHostException e) {
|
} catch (UnknownHostException e) {
|
||||||
message = "Failed to resolve host";
|
message = getResources().getString(R.string.error_unknown_host);
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
message = "GFE returned an HTTP 404 error. Make sure your PC is running a supported GPU. Using remote desktop software can also cause this error. "
|
message = getResources().getString(R.string.error_404);
|
||||||
+ "Try rebooting your machine or reinstalling GFE.";
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
message = e.getMessage();
|
message = e.getMessage();
|
||||||
}
|
}
|
||||||
@@ -455,12 +462,11 @@ public class PcView extends Activity {
|
|||||||
|
|
||||||
private void doAppList(ComputerDetails computer) {
|
private void doAppList(ComputerDetails computer) {
|
||||||
if (computer.reachability == ComputerDetails.Reachability.OFFLINE) {
|
if (computer.reachability == ComputerDetails.Reachability.OFFLINE) {
|
||||||
Toast.makeText(PcView.this, "Computer is offline", Toast.LENGTH_SHORT).show();
|
Toast.makeText(PcView.this, getResources().getString(R.string.error_pc_offline), Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (managerBinder == null) {
|
if (managerBinder == null) {
|
||||||
Toast.makeText(PcView.this, "The ComputerManager service is not running. " +
|
Toast.makeText(PcView.this, getResources().getString(R.string.error_manager_not_running), Toast.LENGTH_LONG).show();
|
||||||
"Please wait a few seconds or restart the app.", Toast.LENGTH_LONG).show();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -482,7 +488,7 @@ public class PcView extends Activity {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onContextItemSelected(MenuItem item) {
|
public boolean onContextItemSelected(MenuItem item) {
|
||||||
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
|
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
|
||||||
ComputerObject computer = pcListAdapter.getItem(info.position);
|
ComputerObject computer = (ComputerObject) pcGridAdapter.getItem(info.position);
|
||||||
switch (item.getItemId())
|
switch (item.getItemId())
|
||||||
{
|
{
|
||||||
case PAIR_ID:
|
case PAIR_ID:
|
||||||
@@ -499,12 +505,11 @@ public class PcView extends Activity {
|
|||||||
|
|
||||||
case DELETE_ID:
|
case DELETE_ID:
|
||||||
if (managerBinder == null) {
|
if (managerBinder == null) {
|
||||||
Toast.makeText(PcView.this, "The ComputerManager service is not running. " +
|
Toast.makeText(PcView.this, getResources().getString(R.string.error_manager_not_running), Toast.LENGTH_LONG).show();
|
||||||
"Please wait a few seconds or restart the app.", Toast.LENGTH_LONG).show();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
managerBinder.removeComputer(computer.details.name);
|
managerBinder.removeComputer(computer.details.name);
|
||||||
removeListView(computer.details);
|
removeComputer(computer.details);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case APP_LIST_ID:
|
case APP_LIST_ID:
|
||||||
@@ -516,70 +521,23 @@ public class PcView extends Activity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String generateString(ComputerDetails details) {
|
private void removeComputer(ComputerDetails details) {
|
||||||
StringBuilder str = new StringBuilder();
|
for (int i = 0; i < pcGridAdapter.getCount(); i++) {
|
||||||
str.append(details.name).append(" - ");
|
ComputerObject computer = (ComputerObject) pcGridAdapter.getItem(i);
|
||||||
if (details.state == ComputerDetails.State.ONLINE) {
|
|
||||||
str.append("Online ");
|
|
||||||
if (details.reachability == ComputerDetails.Reachability.LOCAL) {
|
|
||||||
str.append("(Local) - ");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
str.append("(Remote) - ");
|
|
||||||
}
|
|
||||||
if (details.pairState == PairState.PAIRED) {
|
|
||||||
if (details.runningGameId == 0) {
|
|
||||||
str.append("Available");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
str.append("In Game");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
str.append("Not Paired");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
str.append("Offline");
|
|
||||||
}
|
|
||||||
return str.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addListPlaceholder() {
|
|
||||||
pcListAdapter.add(new ComputerObject("Discovery is running. No computers found yet. " +
|
|
||||||
"If your PC doesn't show up in about 15 seconds, " +
|
|
||||||
"make sure your computer is running GFE or add your PC manually using the button above.", null));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void removeListView(ComputerDetails details) {
|
|
||||||
for (int i = 0; i < pcListAdapter.getCount(); i++) {
|
|
||||||
ComputerObject computer = pcListAdapter.getItem(i);
|
|
||||||
|
|
||||||
if (details.equals(computer.details)) {
|
if (details.equals(computer.details)) {
|
||||||
pcListAdapter.remove(computer);
|
pcGridAdapter.removeComputer(computer);
|
||||||
|
pcGridAdapter.notifyDataSetChanged();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pcListAdapter.getCount() == 0) {
|
|
||||||
// Add the placeholder if we're down to 0 computers
|
|
||||||
addListPlaceholder();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateListView(ComputerDetails details) {
|
private void updateComputer(ComputerDetails details) {
|
||||||
String computerString = generateString(details);
|
|
||||||
ComputerObject existingEntry = null;
|
ComputerObject existingEntry = null;
|
||||||
boolean placeholderPresent = false;
|
|
||||||
|
|
||||||
for (int i = 0; i < pcListAdapter.getCount(); i++) {
|
for (int i = 0; i < pcGridAdapter.getCount(); i++) {
|
||||||
ComputerObject computer = pcListAdapter.getItem(i);
|
ComputerObject computer = (ComputerObject) pcGridAdapter.getItem(i);
|
||||||
|
|
||||||
// If there's a placeholder, there's nothing else
|
|
||||||
if (computer.details == null) {
|
|
||||||
placeholderPresent = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if this is the same computer
|
// Check if this is the same computer
|
||||||
if (details.equals(computer.details)) {
|
if (details.equals(computer.details)) {
|
||||||
@@ -590,35 +548,30 @@ public class PcView extends Activity {
|
|||||||
|
|
||||||
if (existingEntry != null) {
|
if (existingEntry != null) {
|
||||||
// Replace the information in the existing entry
|
// Replace the information in the existing entry
|
||||||
existingEntry.text = computerString;
|
|
||||||
existingEntry.details = details;
|
existingEntry.details = details;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// If the placeholder is the only object, remove it
|
|
||||||
if (placeholderPresent) {
|
|
||||||
pcListAdapter.remove(pcListAdapter.getItem(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add a new entry
|
// Add a new entry
|
||||||
pcListAdapter.add(new ComputerObject(computerString, details));
|
pcGridAdapter.addComputer(new ComputerObject(details));
|
||||||
|
|
||||||
|
// Remove the "Discovery in progress" view
|
||||||
|
noPcFoundLayout.setVisibility(View.INVISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Notify the view that the data has changed
|
// Notify the view that the data has changed
|
||||||
pcListAdapter.notifyDataSetChanged();
|
pcGridAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ComputerObject {
|
public class ComputerObject {
|
||||||
public String text;
|
|
||||||
public ComputerDetails details;
|
public ComputerDetails details;
|
||||||
|
|
||||||
public ComputerObject(String text, ComputerDetails details) {
|
public ComputerObject(ComputerDetails details) {
|
||||||
this.text = text;
|
|
||||||
this.details = details;
|
this.details = details;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return text;
|
return details.name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,23 +31,50 @@ public class AndroidAudioRenderer implements AudioRenderer {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bufferSize = Math.max(AudioTrack.getMinBufferSize(sampleRate,
|
// We're not supposed to request less than the minimum
|
||||||
channelConfig,
|
// buffer size for our buffer, but it appears that we can
|
||||||
AudioFormat.ENCODING_PCM_16BIT),
|
// do this on many devices and it lowers audio latency.
|
||||||
FRAME_SIZE * 2);
|
// We'll try the small buffer size first and if it fails,
|
||||||
|
// use the recommended larger buffer size.
|
||||||
|
try {
|
||||||
|
// Buffer two frames of audio if possible
|
||||||
|
bufferSize = FRAME_SIZE * 2;
|
||||||
|
|
||||||
// Round to next frame
|
track = new AudioTrack(AudioManager.STREAM_MUSIC,
|
||||||
bufferSize = (((bufferSize + (FRAME_SIZE - 1)) / FRAME_SIZE) * FRAME_SIZE);
|
sampleRate,
|
||||||
|
channelConfig,
|
||||||
|
AudioFormat.ENCODING_PCM_16BIT,
|
||||||
|
bufferSize,
|
||||||
|
AudioTrack.MODE_STREAM);
|
||||||
|
track.play();
|
||||||
|
} catch (Exception e) {
|
||||||
|
// Try to release the AudioTrack if we got far enough
|
||||||
|
try {
|
||||||
|
if (track != null) {
|
||||||
|
track.release();
|
||||||
|
}
|
||||||
|
} catch (Exception ignored) {}
|
||||||
|
|
||||||
|
// Now try the larger buffer size
|
||||||
|
bufferSize = Math.max(AudioTrack.getMinBufferSize(sampleRate,
|
||||||
|
channelConfig,
|
||||||
|
AudioFormat.ENCODING_PCM_16BIT),
|
||||||
|
FRAME_SIZE * 2);
|
||||||
|
|
||||||
|
// Round to next frame
|
||||||
|
bufferSize = (((bufferSize + (FRAME_SIZE - 1)) / FRAME_SIZE) * FRAME_SIZE);
|
||||||
|
|
||||||
|
track = new AudioTrack(AudioManager.STREAM_MUSIC,
|
||||||
|
sampleRate,
|
||||||
|
channelConfig,
|
||||||
|
AudioFormat.ENCODING_PCM_16BIT,
|
||||||
|
bufferSize,
|
||||||
|
AudioTrack.MODE_STREAM);
|
||||||
|
track.play();
|
||||||
|
}
|
||||||
|
|
||||||
LimeLog.info("Audio track buffer size: "+bufferSize);
|
LimeLog.info("Audio track buffer size: "+bufferSize);
|
||||||
track = new AudioTrack(AudioManager.STREAM_MUSIC,
|
|
||||||
sampleRate,
|
|
||||||
channelConfig,
|
|
||||||
AudioFormat.ENCODING_PCM_16BIT,
|
|
||||||
bufferSize,
|
|
||||||
AudioTrack.MODE_STREAM);
|
|
||||||
|
|
||||||
track.play();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import android.view.InputDevice;
|
|||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
|
|
||||||
|
import com.limelight.LimeLog;
|
||||||
import com.limelight.nvstream.NvConnection;
|
import com.limelight.nvstream.NvConnection;
|
||||||
import com.limelight.nvstream.input.ControllerPacket;
|
import com.limelight.nvstream.input.ControllerPacket;
|
||||||
import com.limelight.utils.Vector2d;
|
import com.limelight.utils.Vector2d;
|
||||||
@@ -39,17 +40,51 @@ public class ControllerHandler {
|
|||||||
private static final int EMULATED_SELECT_UP_DELAY_MS = 30;
|
private static final int EMULATED_SELECT_UP_DELAY_MS = 30;
|
||||||
|
|
||||||
private Vector2d inputVector = new Vector2d();
|
private Vector2d inputVector = new Vector2d();
|
||||||
private Vector2d normalizedInputVector = new Vector2d();
|
|
||||||
|
|
||||||
private HashMap<String, ControllerMapping> mappings = new HashMap<String, ControllerMapping>();
|
private HashMap<String, ControllerMapping> mappings = new HashMap<String, ControllerMapping>();
|
||||||
|
|
||||||
private NvConnection conn;
|
private NvConnection conn;
|
||||||
|
private double stickDeadzone;
|
||||||
|
private final ControllerMapping defaultMapping = new ControllerMapping();
|
||||||
|
private boolean hasGameController;
|
||||||
|
|
||||||
public ControllerHandler(NvConnection conn) {
|
public ControllerHandler(NvConnection conn, int deadzonePercentage) {
|
||||||
this.conn = conn;
|
this.conn = conn;
|
||||||
|
|
||||||
// We want limelight-common to scale the axis values to match Xinput values
|
// HACK: For now we're hardcoding a 10% deadzone. Some deadzone
|
||||||
ControllerPacket.enableAxisScaling = true;
|
// is required for controller batching support to work.
|
||||||
|
deadzonePercentage = 10;
|
||||||
|
|
||||||
|
int[] ids = InputDevice.getDeviceIds();
|
||||||
|
for (int i = 0; i < ids.length; i++) {
|
||||||
|
InputDevice dev = InputDevice.getDevice(ids[i]);
|
||||||
|
if ((dev.getSources() & InputDevice.SOURCE_JOYSTICK) != 0 ||
|
||||||
|
(dev.getSources() & InputDevice.SOURCE_GAMEPAD) != 0) {
|
||||||
|
// This looks like a gamepad, but we'll check X and Y to be sure
|
||||||
|
if (getMotionRangeForJoystickAxis(dev, MotionEvent.AXIS_X) != null &&
|
||||||
|
getMotionRangeForJoystickAxis(dev, MotionEvent.AXIS_Y) != null) {
|
||||||
|
// This is a gamepad
|
||||||
|
hasGameController = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1% is the lowest possible deadzone we support
|
||||||
|
if (deadzonePercentage <= 0) {
|
||||||
|
deadzonePercentage = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.stickDeadzone = (double)deadzonePercentage / 100.0;
|
||||||
|
|
||||||
|
// Initialize the default mapping for events with no device
|
||||||
|
defaultMapping.leftStickXAxis = MotionEvent.AXIS_X;
|
||||||
|
defaultMapping.leftStickYAxis = MotionEvent.AXIS_Y;
|
||||||
|
defaultMapping.leftStickDeadzoneRadius = (float) stickDeadzone;
|
||||||
|
defaultMapping.rightStickXAxis = MotionEvent.AXIS_Z;
|
||||||
|
defaultMapping.rightStickYAxis = MotionEvent.AXIS_RZ;
|
||||||
|
defaultMapping.rightStickDeadzoneRadius = (float) stickDeadzone;
|
||||||
|
defaultMapping.leftTriggerAxis = MotionEvent.AXIS_BRAKE;
|
||||||
|
defaultMapping.rightTriggerAxis = MotionEvent.AXIS_GAS;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static InputDevice.MotionRange getMotionRangeForJoystickAxis(InputDevice dev, int axis) {
|
private static InputDevice.MotionRange getMotionRangeForJoystickAxis(InputDevice dev, int axis) {
|
||||||
@@ -67,9 +102,18 @@ public class ControllerHandler {
|
|||||||
|
|
||||||
private ControllerMapping createMappingForDevice(InputDevice dev) {
|
private ControllerMapping createMappingForDevice(InputDevice dev) {
|
||||||
ControllerMapping mapping = new ControllerMapping();
|
ControllerMapping mapping = new ControllerMapping();
|
||||||
|
String devName = dev.getName();
|
||||||
|
|
||||||
mapping.leftStickXAxis = MotionEvent.AXIS_X;
|
LimeLog.info("Creating controller mapping for device: "+devName);
|
||||||
|
|
||||||
|
mapping.leftStickXAxis = MotionEvent.AXIS_X;
|
||||||
mapping.leftStickYAxis = MotionEvent.AXIS_Y;
|
mapping.leftStickYAxis = MotionEvent.AXIS_Y;
|
||||||
|
if (getMotionRangeForJoystickAxis(dev, mapping.leftStickXAxis) != null &&
|
||||||
|
getMotionRangeForJoystickAxis(dev, mapping.leftStickYAxis) != null) {
|
||||||
|
// This is a gamepad
|
||||||
|
hasGameController = true;
|
||||||
|
mapping.hasJoystickAxes = true;
|
||||||
|
}
|
||||||
|
|
||||||
InputDevice.MotionRange leftTriggerRange = getMotionRangeForJoystickAxis(dev, MotionEvent.AXIS_LTRIGGER);
|
InputDevice.MotionRange leftTriggerRange = getMotionRangeForJoystickAxis(dev, MotionEvent.AXIS_LTRIGGER);
|
||||||
InputDevice.MotionRange rightTriggerRange = getMotionRangeForJoystickAxis(dev, MotionEvent.AXIS_RTRIGGER);
|
InputDevice.MotionRange rightTriggerRange = getMotionRangeForJoystickAxis(dev, MotionEvent.AXIS_RTRIGGER);
|
||||||
@@ -91,8 +135,7 @@ public class ControllerHandler {
|
|||||||
{
|
{
|
||||||
InputDevice.MotionRange rxRange = getMotionRangeForJoystickAxis(dev, MotionEvent.AXIS_RX);
|
InputDevice.MotionRange rxRange = getMotionRangeForJoystickAxis(dev, MotionEvent.AXIS_RX);
|
||||||
InputDevice.MotionRange ryRange = getMotionRangeForJoystickAxis(dev, MotionEvent.AXIS_RY);
|
InputDevice.MotionRange ryRange = getMotionRangeForJoystickAxis(dev, MotionEvent.AXIS_RY);
|
||||||
if (rxRange != null && ryRange != null) {
|
if (rxRange != null && ryRange != null && devName != null) {
|
||||||
String devName = dev.getName();
|
|
||||||
if (devName.contains("Xbox") || devName.contains("XBox") || devName.contains("X-Box")) {
|
if (devName.contains("Xbox") || devName.contains("XBox") || devName.contains("X-Box")) {
|
||||||
// Xbox controllers use RX and RY for right stick
|
// Xbox controllers use RX and RY for right stick
|
||||||
mapping.rightStickXAxis = MotionEvent.AXIS_RX;
|
mapping.rightStickXAxis = MotionEvent.AXIS_RX;
|
||||||
@@ -142,70 +185,73 @@ public class ControllerHandler {
|
|||||||
if (hatXRange != null && hatYRange != null) {
|
if (hatXRange != null && hatYRange != null) {
|
||||||
mapping.hatXAxis = MotionEvent.AXIS_HAT_X;
|
mapping.hatXAxis = MotionEvent.AXIS_HAT_X;
|
||||||
mapping.hatYAxis = MotionEvent.AXIS_HAT_Y;
|
mapping.hatYAxis = MotionEvent.AXIS_HAT_Y;
|
||||||
|
|
||||||
mapping.hatXDeadzone = hatXRange.getFlat();
|
|
||||||
mapping.hatYDeadzone = hatYRange.getFlat();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mapping.leftStickXAxis != -1 && mapping.leftStickYAxis != -1) {
|
if (mapping.leftStickXAxis != -1 && mapping.leftStickYAxis != -1) {
|
||||||
InputDevice.MotionRange lsXRange = getMotionRangeForJoystickAxis(dev, mapping.leftStickXAxis);
|
mapping.leftStickDeadzoneRadius = (float) stickDeadzone;
|
||||||
InputDevice.MotionRange lsYRange = getMotionRangeForJoystickAxis(dev, mapping.leftStickYAxis);
|
|
||||||
if (lsXRange != null && lsYRange != null) {
|
|
||||||
// The flat values should never be negative but we'll deal with it if they are
|
|
||||||
mapping.leftStickDeadzoneRadius = Math.max(Math.abs(lsXRange.getFlat()),
|
|
||||||
Math.abs(lsYRange.getFlat()));
|
|
||||||
|
|
||||||
// Some devices (certain OUYAs at least) report a deadzone that's larger
|
|
||||||
// than the entire range of their axis likely due to some system software bug.
|
|
||||||
// If we see a very large deadzone, simply ignore the value and use our default.
|
|
||||||
if (mapping.leftStickDeadzoneRadius > 0.5f) {
|
|
||||||
mapping.leftStickDeadzoneRadius = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If there isn't a (reasonable) deadzone at all, use 20%
|
|
||||||
if (mapping.leftStickDeadzoneRadius < 0.02f) {
|
|
||||||
mapping.leftStickDeadzoneRadius = 0.20f;
|
|
||||||
}
|
|
||||||
// Check that the deadzone is 15% at minimum
|
|
||||||
else if (mapping.leftStickDeadzoneRadius < 0.15f) {
|
|
||||||
mapping.leftStickDeadzoneRadius = 0.15f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mapping.rightStickXAxis != -1 && mapping.rightStickYAxis != -1) {
|
if (mapping.rightStickXAxis != -1 && mapping.rightStickYAxis != -1) {
|
||||||
InputDevice.MotionRange rsXRange = getMotionRangeForJoystickAxis(dev, mapping.rightStickXAxis);
|
mapping.rightStickDeadzoneRadius = (float) stickDeadzone;
|
||||||
InputDevice.MotionRange rsYRange = getMotionRangeForJoystickAxis(dev, mapping.rightStickYAxis);
|
}
|
||||||
if (rsXRange != null && rsYRange != null) {
|
|
||||||
// The flat values should never be negative but we'll deal with it if they are
|
|
||||||
mapping.rightStickDeadzoneRadius = Math.max(Math.abs(rsXRange.getFlat()),
|
|
||||||
Math.abs(rsYRange.getFlat()));
|
|
||||||
|
|
||||||
// Some devices (certain OUYAs at least) report a deadzone that's larger
|
if (mapping.leftTriggerAxis != -1 && mapping.rightTriggerAxis != -1) {
|
||||||
// than the entire range of their axis likely due to some system software bug.
|
InputDevice.MotionRange ltRange = getMotionRangeForJoystickAxis(dev, mapping.leftTriggerAxis);
|
||||||
// If we see a very large deadzone, simply ignore the value and use our default.
|
InputDevice.MotionRange rtRange = getMotionRangeForJoystickAxis(dev, mapping.rightTriggerAxis);
|
||||||
if (mapping.rightStickDeadzoneRadius > 0.5f) {
|
|
||||||
mapping.rightStickDeadzoneRadius = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If there isn't a (reasonable) deadzone at all, use 20%
|
// It's important to have a valid deadzone so controller packet batching works properly
|
||||||
if (mapping.rightStickDeadzoneRadius < 0.02f) {
|
mapping.triggerDeadzone = Math.max(Math.abs(ltRange.getFlat()), Math.abs(rtRange.getFlat()));
|
||||||
mapping.rightStickDeadzoneRadius = 0.20f;
|
|
||||||
}
|
// For triggers without (valid) deadzones, we'll use 13% (around XInput's default)
|
||||||
// Check that the deadzone is 15% at minimum
|
if (mapping.triggerDeadzone < 0.13f ||
|
||||||
else if (mapping.rightStickDeadzoneRadius < 0.15f) {
|
mapping.triggerDeadzone > 0.30f)
|
||||||
mapping.rightStickDeadzoneRadius = 0.15f;
|
{
|
||||||
}
|
mapping.triggerDeadzone = 0.13f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (devName != null) {
|
||||||
|
// For the Nexus Player (and probably other ATV devices), we should
|
||||||
|
// use the back button as start since it doesn't have a start/menu button
|
||||||
|
// on the controller
|
||||||
|
if (devName.contains("ASUS Gamepad")) {
|
||||||
|
// We can only do this check on KitKat or higher, but it doesn't matter since ATV
|
||||||
|
// is Android 5.0 anyway
|
||||||
|
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
|
||||||
|
boolean[] hasStartKey = dev.hasKeys(KeyEvent.KEYCODE_BUTTON_START, KeyEvent.KEYCODE_MENU, 0);
|
||||||
|
if (!hasStartKey[0] && !hasStartKey[1]) {
|
||||||
|
mapping.backIsStart = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// The ASUS Gamepad has triggers that sit far forward and are prone to false presses
|
||||||
|
// so we increase the deadzone on them to minimize this
|
||||||
|
mapping.triggerDeadzone = 0.30f;
|
||||||
|
}
|
||||||
|
// Classify this device as a remote by name
|
||||||
|
else if (devName.contains("Fire TV Remote") || devName.contains("Nexus Remote")) {
|
||||||
|
// It's only a remote if it doesn't any sticks
|
||||||
|
if (!mapping.hasJoystickAxes) {
|
||||||
|
mapping.isRemote = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// NYKO Playpad has a fake hat that mimics the left stick for some reason
|
||||||
|
else if (devName.contains("NYKO PLAYPAD")) {
|
||||||
|
mapping.hatXAxis = -1;
|
||||||
|
mapping.hatYAxis = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LimeLog.info("Analog stick deadzone: "+mapping.leftStickDeadzoneRadius+" "+mapping.rightStickDeadzoneRadius);
|
||||||
|
LimeLog.info("Trigger deadzone: "+mapping.triggerDeadzone);
|
||||||
|
|
||||||
return mapping;
|
return mapping;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ControllerMapping getMappingForDevice(InputDevice dev) {
|
private ControllerMapping getMappingForDevice(InputDevice dev) {
|
||||||
// Unknown devices can't be handled
|
// Unknown devices use the default mapping
|
||||||
if (dev == null) {
|
if (dev == null) {
|
||||||
return null;
|
return defaultMapping;
|
||||||
}
|
}
|
||||||
|
|
||||||
String descriptor = dev.getDescriptor();
|
String descriptor = dev.getDescriptor();
|
||||||
@@ -228,8 +274,17 @@ public class ControllerHandler {
|
|||||||
leftStickX, leftStickY, rightStickX, rightStickY);
|
leftStickX, leftStickY, rightStickX, rightStickY);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int handleRemapping(ControllerMapping mapping, KeyEvent event) {
|
// Return a valid keycode, 0 to consume, or -1 to not consume the event
|
||||||
if (mapping.isDualShock4) {
|
// Device MAY BE NULL
|
||||||
|
private int handleRemapping(ControllerMapping mapping, KeyEvent event) {
|
||||||
|
// For remotes, don't capture the back button
|
||||||
|
if (mapping.isRemote) {
|
||||||
|
if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mapping.isDualShock4) {
|
||||||
switch (event.getKeyCode()) {
|
switch (event.getKeyCode()) {
|
||||||
case KeyEvent.KEYCODE_BUTTON_Y:
|
case KeyEvent.KEYCODE_BUTTON_Y:
|
||||||
return KeyEvent.KEYCODE_BUTTON_L1;
|
return KeyEvent.KEYCODE_BUTTON_L1;
|
||||||
@@ -298,113 +353,144 @@ public class ControllerHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return event.getKeyCode();
|
// Past here we can fixup the keycode and potentially trigger
|
||||||
|
// another special case so we need to remember what keycode we're using
|
||||||
|
int keyCode = event.getKeyCode();
|
||||||
|
|
||||||
|
// This is a hack for (at least) the "Tablet Remote" app
|
||||||
|
// which sends BACK with META_ALT_ON instead of KEYCODE_BUTTON_B
|
||||||
|
if (keyCode == KeyEvent.KEYCODE_BACK &&
|
||||||
|
!event.hasNoModifiers() &&
|
||||||
|
(event.getFlags() & KeyEvent.FLAG_SOFT_KEYBOARD) != 0)
|
||||||
|
{
|
||||||
|
keyCode = KeyEvent.KEYCODE_BUTTON_B;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (keyCode == KeyEvent.KEYCODE_BUTTON_START ||
|
||||||
|
keyCode == KeyEvent.KEYCODE_MENU) {
|
||||||
|
// Ensure that we never use back as start if we have a real start
|
||||||
|
mapping.backIsStart = false;
|
||||||
|
}
|
||||||
|
else if (mapping.backIsStart && keyCode == KeyEvent.KEYCODE_BACK) {
|
||||||
|
// Emulate the start button with back
|
||||||
|
return KeyEvent.KEYCODE_BUTTON_START;
|
||||||
|
}
|
||||||
|
|
||||||
|
return keyCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Vector2d handleDeadZone(float x, float y, float deadzoneRadius) {
|
private Vector2d populateCachedVector(float x, float y) {
|
||||||
// Reinitialize our cached Vector2d object
|
// Reinitialize our cached Vector2d object
|
||||||
inputVector.initialize(x, y);
|
inputVector.initialize(x, y);
|
||||||
|
return inputVector;
|
||||||
|
}
|
||||||
|
|
||||||
if (inputVector.getMagnitude() <= deadzoneRadius) {
|
private void handleDeadZone(Vector2d stickVector, float deadzoneRadius) {
|
||||||
// Deadzone -- return the zero vector
|
if (stickVector.getMagnitude() <= deadzoneRadius) {
|
||||||
return Vector2d.ZERO;
|
// Deadzone
|
||||||
|
stickVector.initialize(0, 0);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
// Scale the input based on the distance from the deadzone
|
|
||||||
inputVector.getNormalized(normalizedInputVector);
|
|
||||||
normalizedInputVector.scalarMultiply((inputVector.getMagnitude() - deadzoneRadius) / (1.0f - deadzoneRadius));
|
|
||||||
|
|
||||||
// Bound the X value to -1.0 to 1.0
|
// We're not normalizing here because we let the computer handle the deadzones.
|
||||||
if (normalizedInputVector.getX() > 1.0f) {
|
// Normalizing can make the deadzones larger than they should be after the computer also
|
||||||
normalizedInputVector.setX(1.0f);
|
// evaluates the deadzone.
|
||||||
}
|
}
|
||||||
else if (normalizedInputVector.getX() < -1.0f) {
|
|
||||||
normalizedInputVector.setX(-1.0f);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Bound the Y value to -1.0 to 1.0
|
private void handleAxisSet(ControllerMapping mapping, float lsX, float lsY, float rsX,
|
||||||
if (normalizedInputVector.getY() > 1.0f) {
|
float rsY, float lt, float rt, float hatX, float hatY) {
|
||||||
normalizedInputVector.setY(1.0f);
|
|
||||||
}
|
|
||||||
else if (normalizedInputVector.getY() < -1.0f) {
|
|
||||||
normalizedInputVector.setY(-1.0f);
|
|
||||||
}
|
|
||||||
|
|
||||||
return normalizedInputVector;
|
if (mapping.leftStickXAxis != -1 && mapping.leftStickYAxis != -1) {
|
||||||
}
|
Vector2d leftStickVector = populateCachedVector(lsX, lsY);
|
||||||
}
|
|
||||||
|
handleDeadZone(leftStickVector, mapping.leftStickDeadzoneRadius);
|
||||||
|
|
||||||
|
leftStickX = (short) (leftStickVector.getX() * 0x7FFE);
|
||||||
|
leftStickY = (short) (-leftStickVector.getY() * 0x7FFE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mapping.rightStickXAxis != -1 && mapping.rightStickYAxis != -1) {
|
||||||
|
Vector2d rightStickVector = populateCachedVector(rsX, rsY);
|
||||||
|
|
||||||
|
handleDeadZone(rightStickVector, mapping.rightStickDeadzoneRadius);
|
||||||
|
|
||||||
|
rightStickX = (short) (rightStickVector.getX() * 0x7FFE);
|
||||||
|
rightStickY = (short) (-rightStickVector.getY() * 0x7FFE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mapping.leftTriggerAxis != -1 && mapping.rightTriggerAxis != -1) {
|
||||||
|
if (mapping.triggersIdleNegative) {
|
||||||
|
lt = (lt + 1) / 2;
|
||||||
|
rt = (rt + 1) / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lt <= mapping.triggerDeadzone) {
|
||||||
|
lt = 0;
|
||||||
|
}
|
||||||
|
if (rt <= mapping.triggerDeadzone) {
|
||||||
|
rt = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
leftTrigger = (byte)(lt * 0xFF);
|
||||||
|
rightTrigger = (byte)(rt * 0xFF);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mapping.hatXAxis != -1 && mapping.hatYAxis != -1) {
|
||||||
|
inputMap &= ~(ControllerPacket.LEFT_FLAG | ControllerPacket.RIGHT_FLAG);
|
||||||
|
if (hatX < -0.5) {
|
||||||
|
inputMap |= ControllerPacket.LEFT_FLAG;
|
||||||
|
}
|
||||||
|
else if (hatX > 0.5) {
|
||||||
|
inputMap |= ControllerPacket.RIGHT_FLAG;
|
||||||
|
}
|
||||||
|
|
||||||
|
inputMap &= ~(ControllerPacket.UP_FLAG | ControllerPacket.DOWN_FLAG);
|
||||||
|
if (hatY < -0.5) {
|
||||||
|
inputMap |= ControllerPacket.UP_FLAG;
|
||||||
|
}
|
||||||
|
else if (hatY > 0.5) {
|
||||||
|
inputMap |= ControllerPacket.DOWN_FLAG;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sendControllerInputPacket();
|
||||||
|
}
|
||||||
|
|
||||||
public boolean handleMotionEvent(MotionEvent event) {
|
public boolean handleMotionEvent(MotionEvent event) {
|
||||||
ControllerMapping mapping = getMappingForDevice(event.getDevice());
|
ControllerMapping mapping = getMappingForDevice(event.getDevice());
|
||||||
if (mapping == null) {
|
float lsX = 0, lsY = 0, rsX = 0, rsY = 0, rt = 0, lt = 0, hatX = 0, hatY = 0;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle left stick events outside of the deadzone
|
// We purposefully ignore the historical values in the motion event as it makes
|
||||||
if (mapping.leftStickXAxis != -1 && mapping.leftStickYAxis != -1) {
|
// the controller feel sluggish for some users.
|
||||||
Vector2d leftStickVector = handleDeadZone(event.getAxisValue(mapping.leftStickXAxis),
|
|
||||||
event.getAxisValue(mapping.leftStickYAxis), mapping.leftStickDeadzoneRadius);
|
|
||||||
|
|
||||||
leftStickX = (short)(leftStickVector.getX() * 0x7FFE);
|
if (mapping.leftStickXAxis != -1 && mapping.leftStickYAxis != -1) {
|
||||||
leftStickY = (short)(-leftStickVector.getY() * 0x7FFE);
|
lsX = event.getAxisValue(mapping.leftStickXAxis);
|
||||||
}
|
lsY = event.getAxisValue(mapping.leftStickYAxis);
|
||||||
|
}
|
||||||
|
|
||||||
// Handle right stick events outside of the deadzone
|
if (mapping.rightStickXAxis != -1 && mapping.rightStickYAxis != -1) {
|
||||||
if (mapping.rightStickXAxis != -1 && mapping.rightStickYAxis != -1) {
|
rsX = event.getAxisValue(mapping.rightStickXAxis);
|
||||||
Vector2d rightStickVector = handleDeadZone(event.getAxisValue(mapping.rightStickXAxis),
|
rsY = event.getAxisValue(mapping.rightStickYAxis);
|
||||||
event.getAxisValue(mapping.rightStickYAxis), mapping.rightStickDeadzoneRadius);
|
}
|
||||||
|
|
||||||
rightStickX = (short)(rightStickVector.getX() * 0x7FFE);
|
if (mapping.leftTriggerAxis != -1 && mapping.rightTriggerAxis != -1) {
|
||||||
rightStickY = (short)(-rightStickVector.getY() * 0x7FFE);
|
lt = event.getAxisValue(mapping.leftTriggerAxis);
|
||||||
}
|
rt = event.getAxisValue(mapping.rightTriggerAxis);
|
||||||
|
}
|
||||||
|
|
||||||
// Handle controllers with analog triggers
|
if (mapping.hatXAxis != -1 && mapping.hatYAxis != -1) {
|
||||||
if (mapping.leftTriggerAxis != -1 && mapping.rightTriggerAxis != -1) {
|
hatX = event.getAxisValue(MotionEvent.AXIS_HAT_X);
|
||||||
float L2 = event.getAxisValue(mapping.leftTriggerAxis);
|
hatY = event.getAxisValue(MotionEvent.AXIS_HAT_Y);
|
||||||
float R2 = event.getAxisValue(mapping.rightTriggerAxis);
|
}
|
||||||
|
|
||||||
if (mapping.triggersIdleNegative) {
|
handleAxisSet(mapping, lsX, lsY, rsX, rsY, lt, rt, hatX, hatY);
|
||||||
L2 = (L2 + 1) / 2;
|
|
||||||
R2 = (R2 + 1) / 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
leftTrigger = (byte)(L2 * 0xFF);
|
|
||||||
rightTrigger = (byte)(R2 * 0xFF);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Hats emulate d-pad events
|
|
||||||
if (mapping.hatXAxis != -1 && mapping.hatYAxis != -1) {
|
|
||||||
float hatX = event.getAxisValue(MotionEvent.AXIS_HAT_X);
|
|
||||||
float hatY = event.getAxisValue(MotionEvent.AXIS_HAT_Y);
|
|
||||||
|
|
||||||
inputMap &= ~(ControllerPacket.LEFT_FLAG | ControllerPacket.RIGHT_FLAG);
|
|
||||||
if (hatX < -(0.5 + mapping.hatXDeadzone)) {
|
|
||||||
inputMap |= ControllerPacket.LEFT_FLAG;
|
|
||||||
}
|
|
||||||
else if (hatX > (0.5 + mapping.hatXDeadzone)) {
|
|
||||||
inputMap |= ControllerPacket.RIGHT_FLAG;
|
|
||||||
}
|
|
||||||
|
|
||||||
inputMap &= ~(ControllerPacket.UP_FLAG | ControllerPacket.DOWN_FLAG);
|
|
||||||
if (hatY < -(0.5 + mapping.hatYDeadzone)) {
|
|
||||||
inputMap |= ControllerPacket.UP_FLAG;
|
|
||||||
}
|
|
||||||
else if (hatY > (0.5 + mapping.hatYDeadzone)) {
|
|
||||||
inputMap |= ControllerPacket.DOWN_FLAG;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sendControllerInputPacket();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean handleButtonUp(int keyCode, KeyEvent event) {
|
public boolean handleButtonUp(KeyEvent event) {
|
||||||
ControllerMapping mapping = getMappingForDevice(event.getDevice());
|
ControllerMapping mapping = getMappingForDevice(event.getDevice());
|
||||||
if (mapping == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
keyCode = handleRemapping(mapping, event);
|
int keyCode = handleRemapping(mapping, event);
|
||||||
if (keyCode == 0) {
|
if (keyCode == 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -521,13 +607,10 @@ public class ControllerHandler {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean handleButtonDown(int keyCode, KeyEvent event) {
|
public boolean handleButtonDown(KeyEvent event) {
|
||||||
ControllerMapping mapping = getMappingForDevice(event.getDevice());
|
ControllerMapping mapping = getMappingForDevice(event.getDevice());
|
||||||
if (mapping == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
keyCode = handleRemapping(mapping, event);
|
int keyCode = handleRemapping(mapping, event);
|
||||||
if (keyCode == 0) {
|
if (keyCode == 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -614,7 +697,11 @@ public class ControllerHandler {
|
|||||||
emulatingButtonFlags |= ControllerHandler.EMULATING_SPECIAL;
|
emulatingButtonFlags |= ControllerHandler.EMULATING_SPECIAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
sendControllerInputPacket();
|
// Send a new input packet if this is the first instance of a button down event
|
||||||
|
// or anytime if we're emulating a button
|
||||||
|
if (event.getRepeatCount() == 0 || emulatingButtonFlags != 0) {
|
||||||
|
sendControllerInputPacket();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -630,13 +717,15 @@ public class ControllerHandler {
|
|||||||
public int leftTriggerAxis = -1;
|
public int leftTriggerAxis = -1;
|
||||||
public int rightTriggerAxis = -1;
|
public int rightTriggerAxis = -1;
|
||||||
public boolean triggersIdleNegative;
|
public boolean triggersIdleNegative;
|
||||||
|
public float triggerDeadzone;
|
||||||
|
|
||||||
public int hatXAxis = -1;
|
public int hatXAxis = -1;
|
||||||
public int hatYAxis = -1;
|
public int hatYAxis = -1;
|
||||||
public float hatXDeadzone;
|
|
||||||
public float hatYDeadzone;
|
|
||||||
|
|
||||||
public boolean isDualShock4;
|
public boolean isDualShock4;
|
||||||
public boolean isXboxController;
|
public boolean isXboxController;
|
||||||
|
public boolean backIsStart;
|
||||||
|
public boolean isRemote;
|
||||||
|
public boolean hasJoystickAxes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,16 +12,24 @@ public class TouchContext {
|
|||||||
|
|
||||||
private NvConnection conn;
|
private NvConnection conn;
|
||||||
private int actionIndex;
|
private int actionIndex;
|
||||||
|
private double xFactor, yFactor;
|
||||||
|
|
||||||
private static final int TAP_MOVEMENT_THRESHOLD = 10;
|
private static final int TAP_MOVEMENT_THRESHOLD = 10;
|
||||||
private static final int TAP_TIME_THRESHOLD = 250;
|
private static final int TAP_TIME_THRESHOLD = 250;
|
||||||
|
|
||||||
public TouchContext(NvConnection conn, int actionIndex)
|
public TouchContext(NvConnection conn, int actionIndex, double xFactor, double yFactor)
|
||||||
{
|
{
|
||||||
this.conn = conn;
|
this.conn = conn;
|
||||||
this.actionIndex = actionIndex;
|
this.actionIndex = actionIndex;
|
||||||
|
this.xFactor = xFactor;
|
||||||
|
this.yFactor = yFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getActionIndex()
|
||||||
|
{
|
||||||
|
return actionIndex;
|
||||||
|
}
|
||||||
|
|
||||||
private boolean isTap()
|
private boolean isTap()
|
||||||
{
|
{
|
||||||
int xDelta = Math.abs(lastTouchX - originalTouchX);
|
int xDelta = Math.abs(lastTouchX - originalTouchX);
|
||||||
@@ -78,16 +86,20 @@ public class TouchContext {
|
|||||||
{
|
{
|
||||||
// We only send moves for the primary touch point
|
// We only send moves for the primary touch point
|
||||||
if (actionIndex == 0) {
|
if (actionIndex == 0) {
|
||||||
conn.sendMouseMove((short)(eventX - lastTouchX),
|
int deltaX = eventX - lastTouchX;
|
||||||
(short)(eventY - lastTouchY));
|
int deltaY = eventY - lastTouchY;
|
||||||
|
|
||||||
|
// Scale the deltas based on the factors passed to our constructor
|
||||||
|
deltaX = (int)Math.round((double)deltaX * xFactor);
|
||||||
|
deltaY = (int)Math.round((double)deltaY * yFactor);
|
||||||
|
|
||||||
|
conn.sendMouseMove((short)deltaX, (short)deltaY);
|
||||||
}
|
}
|
||||||
|
|
||||||
lastTouchX = eventX;
|
lastTouchX = eventX;
|
||||||
lastTouchY = eventY;
|
lastTouchY = eventY;
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.limelight.binding.input.evdev;
|
package com.limelight.binding.input.evdev;
|
||||||
|
|
||||||
import java.io.IOException;
|
import android.os.Build;
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
@@ -12,30 +12,32 @@ public class EvdevReader {
|
|||||||
System.loadLibrary("evdev_reader");
|
System.loadLibrary("evdev_reader");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void patchSeLinuxPolicies() {
|
||||||
|
//
|
||||||
|
// FIXME: We REALLY shouldn't being changing permissions on the input devices like this.
|
||||||
|
// We should probably do something clever with a separate daemon and talk via a localhost
|
||||||
|
// socket. We don't return the SELinux policies back to default after we're done which I feel
|
||||||
|
// bad about, but we do chmod the input devices back so I don't think any additional attack surface
|
||||||
|
// remains opened after streaming other than listing the /dev/input directory which you wouldn't
|
||||||
|
// normally be able to do with SELinux enforcing on Lollipop.
|
||||||
|
//
|
||||||
|
// We need to modify SELinux policies to allow us to capture input devices on Lollipop and possibly other
|
||||||
|
// more restrictive ROMs. Per Chainfire's SuperSU documentation, the supolicy binary is provided on
|
||||||
|
// 4.4 and later to do live SELinux policy changes.
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||||
|
EvdevShell shell = EvdevShell.getInstance();
|
||||||
|
shell.runCommand("supolicy --live \"allow untrusted_app input_device dir getattr\" " +
|
||||||
|
"\"allow untrusted_app input_device chr_file { open read write ioctl }\"");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Requires root to chmod /dev/input/eventX
|
// Requires root to chmod /dev/input/eventX
|
||||||
public static boolean setPermissions(String[] files, int octalPermissions) {
|
public static void setPermissions(String[] files, int octalPermissions) {
|
||||||
ProcessBuilder builder = new ProcessBuilder("su");
|
EvdevShell shell = EvdevShell.getInstance();
|
||||||
|
|
||||||
try {
|
for (String file : files) {
|
||||||
Process p = builder.start();
|
shell.runCommand(String.format((Locale)null, "chmod %o %s", octalPermissions, file));
|
||||||
|
}
|
||||||
OutputStream stdin = p.getOutputStream();
|
|
||||||
for (String file : files) {
|
|
||||||
stdin.write(String.format((Locale)null, "chmod %o %s\n", octalPermissions, file).getBytes("UTF-8"));
|
|
||||||
}
|
|
||||||
stdin.write("exit\n".getBytes("UTF-8"));
|
|
||||||
stdin.flush();
|
|
||||||
|
|
||||||
p.waitFor();
|
|
||||||
p.destroy();
|
|
||||||
return true;
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the fd to be passed to other function or -1 on error
|
// Returns the fd to be passed to other function or -1 on error
|
||||||
|
|||||||
@@ -0,0 +1,116 @@
|
|||||||
|
package com.limelight.binding.input.evdev;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.util.Scanner;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class EvdevShell {
|
||||||
|
private OutputStream stdin;
|
||||||
|
private InputStream stdout;
|
||||||
|
private Process shell;
|
||||||
|
private final String uuidString = UUID.randomUUID().toString();
|
||||||
|
|
||||||
|
private static final EvdevShell globalShell = new EvdevShell();
|
||||||
|
|
||||||
|
public static EvdevShell getInstance() {
|
||||||
|
return globalShell;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void startShell() {
|
||||||
|
ProcessBuilder builder = new ProcessBuilder("su");
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Redirect stderr to stdout
|
||||||
|
builder.redirectErrorStream(true);
|
||||||
|
shell = builder.start();
|
||||||
|
|
||||||
|
stdin = shell.getOutputStream();
|
||||||
|
stdout = shell.getInputStream();
|
||||||
|
} catch (IOException e) {
|
||||||
|
// This is unexpected
|
||||||
|
e.printStackTrace();
|
||||||
|
|
||||||
|
// Kill the shell if it spawned
|
||||||
|
if (stdin != null) {
|
||||||
|
try {
|
||||||
|
stdin.close();
|
||||||
|
} catch (IOException e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
stdin = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (stdout != null) {
|
||||||
|
try {
|
||||||
|
stdout.close();
|
||||||
|
} catch (IOException e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
stdout = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (shell != null) {
|
||||||
|
shell.destroy();
|
||||||
|
shell = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void runCommand(String command) {
|
||||||
|
if (shell == null) {
|
||||||
|
// Shell never started
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Write the command followed by an echo with our UUID
|
||||||
|
stdin.write((command+'\n').getBytes("UTF-8"));
|
||||||
|
stdin.write(("echo "+uuidString+'\n').getBytes("UTF-8"));
|
||||||
|
stdin.flush();
|
||||||
|
|
||||||
|
// This is the only command in flight so we can use a scanner
|
||||||
|
// without worrying about it eating too many characters
|
||||||
|
Scanner scanner = new Scanner(stdout);
|
||||||
|
while (scanner.hasNext()) {
|
||||||
|
if (scanner.next().contains(uuidString)) {
|
||||||
|
// Our command ran
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void stopShell() throws InterruptedException {
|
||||||
|
boolean exitWritten = false;
|
||||||
|
|
||||||
|
if (shell == null) {
|
||||||
|
// Shell never started
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
stdin.write("exit\n".getBytes("UTF-8"));
|
||||||
|
exitWritten = true;
|
||||||
|
} catch (IOException e) {
|
||||||
|
// We'll destroy the process without
|
||||||
|
// waiting for it to terminate since
|
||||||
|
// we don't know whether our exit command made it
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (exitWritten) {
|
||||||
|
try {
|
||||||
|
shell.waitFor();
|
||||||
|
} finally {
|
||||||
|
shell.destroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
shell.destroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -20,6 +20,8 @@ public class EvdevWatcher {
|
|||||||
private EvdevListener listener;
|
private EvdevListener listener;
|
||||||
private Thread startThread;
|
private Thread startThread;
|
||||||
|
|
||||||
|
private static boolean patchedSeLinuxPolicies = false;
|
||||||
|
|
||||||
private FileObserver observer = new FileObserver(PATH, FileObserver.CREATE | FileObserver.DELETE) {
|
private FileObserver observer = new FileObserver(PATH, FileObserver.CREATE | FileObserver.DELETE) {
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(int event, String fileName) {
|
public void onEvent(int event, String fileName) {
|
||||||
@@ -117,6 +119,15 @@ public class EvdevWatcher {
|
|||||||
startThread = new Thread() {
|
startThread = new Thread() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
// Initialize the root shell
|
||||||
|
EvdevShell.getInstance().startShell();
|
||||||
|
|
||||||
|
// Patch SELinux policies (if needed)
|
||||||
|
if (!patchedSeLinuxPolicies) {
|
||||||
|
EvdevReader.patchSeLinuxPolicies();
|
||||||
|
patchedSeLinuxPolicies = true;
|
||||||
|
}
|
||||||
|
|
||||||
// List all files and allow us access
|
// List all files and allow us access
|
||||||
File[] files = rundownWithPermissionsChange(0666);
|
File[] files = rundownWithPermissionsChange(0666);
|
||||||
|
|
||||||
@@ -139,7 +150,12 @@ public class EvdevWatcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Giveup eventX permissions
|
// Giveup eventX permissions
|
||||||
rundownWithPermissionsChange(066);
|
rundownWithPermissionsChange(0660);
|
||||||
|
|
||||||
|
// Kill the root shell
|
||||||
|
try {
|
||||||
|
EvdevShell.getInstance().stopShell();
|
||||||
|
} catch (InterruptedException e) {}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
startThread.start();
|
startThread.start();
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import java.io.File;
|
|||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.util.concurrent.locks.LockSupport;
|
|
||||||
|
|
||||||
import android.graphics.PixelFormat;
|
import android.graphics.PixelFormat;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
@@ -19,16 +18,16 @@ import com.limelight.nvstream.av.video.VideoDepacketizer;
|
|||||||
import com.limelight.nvstream.av.video.cpu.AvcDecoder;
|
import com.limelight.nvstream.av.video.cpu.AvcDecoder;
|
||||||
|
|
||||||
@SuppressWarnings("EmptyCatchBlock")
|
@SuppressWarnings("EmptyCatchBlock")
|
||||||
public class AndroidCpuDecoderRenderer implements VideoDecoderRenderer {
|
public class AndroidCpuDecoderRenderer extends EnhancedDecoderRenderer {
|
||||||
|
|
||||||
private Thread rendererThread;
|
private Thread rendererThread, decoderThread;
|
||||||
private int targetFps;
|
private int targetFps;
|
||||||
|
|
||||||
private static final int DECODER_BUFFER_SIZE = 92*1024;
|
private static final int DECODER_BUFFER_SIZE = 92*1024;
|
||||||
private ByteBuffer decoderBuffer;
|
private ByteBuffer decoderBuffer;
|
||||||
|
|
||||||
// Only sleep if the difference is above this value
|
// Only sleep if the difference is above this value
|
||||||
private static final int WAIT_CEILING_MS = 8;
|
private static final int WAIT_CEILING_MS = 5;
|
||||||
|
|
||||||
private static final int LOW_PERF = 1;
|
private static final int LOW_PERF = 1;
|
||||||
private static final int MED_PERF = 2;
|
private static final int MED_PERF = 2;
|
||||||
@@ -108,9 +107,7 @@ public class AndroidCpuDecoderRenderer implements VideoDecoderRenderer {
|
|||||||
|
|
||||||
case LOW_PERF:
|
case LOW_PERF:
|
||||||
// Disable the loop filter for performance reasons
|
// Disable the loop filter for performance reasons
|
||||||
avcFlags = AvcDecoder.DISABLE_LOOP_FILTER |
|
avcFlags = AvcDecoder.FAST_BILINEAR_FILTERING;
|
||||||
AvcDecoder.FAST_BILINEAR_FILTERING |
|
|
||||||
AvcDecoder.FAST_DECODE;
|
|
||||||
|
|
||||||
// Use plenty of threads to try to utilize the CPU as best we can
|
// Use plenty of threads to try to utilize the CPU as best we can
|
||||||
threadCount = cpuCount - 1;
|
threadCount = cpuCount - 1;
|
||||||
@@ -118,8 +115,7 @@ public class AndroidCpuDecoderRenderer implements VideoDecoderRenderer {
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
case MED_PERF:
|
case MED_PERF:
|
||||||
avcFlags = AvcDecoder.BILINEAR_FILTERING |
|
avcFlags = AvcDecoder.BILINEAR_FILTERING;
|
||||||
AvcDecoder.FAST_DECODE;
|
|
||||||
|
|
||||||
// Only use 2 threads to minimize frame processing latency
|
// Only use 2 threads to minimize frame processing latency
|
||||||
threadCount = 2;
|
threadCount = 2;
|
||||||
@@ -145,7 +141,9 @@ public class AndroidCpuDecoderRenderer implements VideoDecoderRenderer {
|
|||||||
throw new IllegalStateException("AVC decoder initialization failure: "+err);
|
throw new IllegalStateException("AVC decoder initialization failure: "+err);
|
||||||
}
|
}
|
||||||
|
|
||||||
AvcDecoder.setRenderTarget(sh.getSurface());
|
if (!AvcDecoder.setRenderTarget(sh.getSurface())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
decoderBuffer = ByteBuffer.allocate(DECODER_BUFFER_SIZE + AvcDecoder.getInputPaddingSize());
|
decoderBuffer = ByteBuffer.allocate(DECODER_BUFFER_SIZE + AvcDecoder.getInputPaddingSize());
|
||||||
|
|
||||||
@@ -156,6 +154,26 @@ public class AndroidCpuDecoderRenderer implements VideoDecoderRenderer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean start(final VideoDepacketizer depacketizer) {
|
public boolean start(final VideoDepacketizer depacketizer) {
|
||||||
|
decoderThread = new Thread() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
DecodeUnit du;
|
||||||
|
while (!isInterrupted()) {
|
||||||
|
try {
|
||||||
|
du = depacketizer.takeNextDecodeUnit();
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
submitDecodeUnit(du);
|
||||||
|
depacketizer.freeDecodeUnit(du);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
decoderThread.setName("Video - Decoder (CPU)");
|
||||||
|
decoderThread.setPriority(Thread.MAX_PRIORITY - 1);
|
||||||
|
decoderThread.start();
|
||||||
|
|
||||||
rendererThread = new Thread() {
|
rendererThread = new Thread() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@@ -163,17 +181,15 @@ public class AndroidCpuDecoderRenderer implements VideoDecoderRenderer {
|
|||||||
DecodeUnit du;
|
DecodeUnit du;
|
||||||
while (!isInterrupted())
|
while (!isInterrupted())
|
||||||
{
|
{
|
||||||
du = depacketizer.pollNextDecodeUnit();
|
|
||||||
if (du != null) {
|
|
||||||
submitDecodeUnit(du);
|
|
||||||
depacketizer.freeDecodeUnit(du);
|
|
||||||
}
|
|
||||||
|
|
||||||
long diff = nextFrameTime - System.currentTimeMillis();
|
long diff = nextFrameTime - System.currentTimeMillis();
|
||||||
|
|
||||||
if (diff > WAIT_CEILING_MS) {
|
if (diff > WAIT_CEILING_MS) {
|
||||||
LockSupport.parkNanos(1);
|
try {
|
||||||
continue;
|
Thread.sleep(diff - WAIT_CEILING_MS);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
nextFrameTime = computePresentationTimeMs(targetFps);
|
nextFrameTime = computePresentationTimeMs(targetFps);
|
||||||
@@ -194,10 +210,14 @@ public class AndroidCpuDecoderRenderer implements VideoDecoderRenderer {
|
|||||||
@Override
|
@Override
|
||||||
public void stop() {
|
public void stop() {
|
||||||
rendererThread.interrupt();
|
rendererThread.interrupt();
|
||||||
|
decoderThread.interrupt();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
rendererThread.join();
|
rendererThread.join();
|
||||||
} catch (InterruptedException e) { }
|
} catch (InterruptedException e) { }
|
||||||
|
try {
|
||||||
|
decoderThread.join();
|
||||||
|
} catch (InterruptedException e) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -234,7 +254,7 @@ public class AndroidCpuDecoderRenderer implements VideoDecoderRenderer {
|
|||||||
|
|
||||||
// Add delta time to the totals (excluding probable outliers)
|
// Add delta time to the totals (excluding probable outliers)
|
||||||
long delta = timeAfterDecode - decodeUnit.getReceiveTimestamp();
|
long delta = timeAfterDecode - decodeUnit.getReceiveTimestamp();
|
||||||
if (delta >= 0 && delta < 300) {
|
if (delta >= 0 && delta < 1000) {
|
||||||
totalTimeMs += delta;
|
totalTimeMs += delta;
|
||||||
totalFrames++;
|
totalFrames++;
|
||||||
}
|
}
|
||||||
@@ -260,4 +280,9 @@ public class AndroidCpuDecoderRenderer implements VideoDecoderRenderer {
|
|||||||
}
|
}
|
||||||
return (int)(totalTimeMs / totalFrames);
|
return (int)(totalTimeMs / totalFrames);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDecoderName() {
|
||||||
|
return "CPU decoding";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ package com.limelight.binding.video;
|
|||||||
import com.limelight.nvstream.av.video.VideoDecoderRenderer;
|
import com.limelight.nvstream.av.video.VideoDecoderRenderer;
|
||||||
import com.limelight.nvstream.av.video.VideoDepacketizer;
|
import com.limelight.nvstream.av.video.VideoDepacketizer;
|
||||||
|
|
||||||
public class ConfigurableDecoderRenderer implements VideoDecoderRenderer {
|
public class ConfigurableDecoderRenderer extends EnhancedDecoderRenderer {
|
||||||
|
|
||||||
private VideoDecoderRenderer decoderRenderer;
|
private EnhancedDecoderRenderer decoderRenderer;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void release() {
|
public void release() {
|
||||||
@@ -74,4 +74,14 @@ public class ConfigurableDecoderRenderer implements VideoDecoderRenderer {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDecoderName() {
|
||||||
|
if (decoderRenderer != null) {
|
||||||
|
return decoderRenderer.getDecoderName();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.limelight.binding.video;
|
||||||
|
|
||||||
|
import com.limelight.nvstream.av.video.VideoDecoderRenderer;
|
||||||
|
|
||||||
|
public abstract class EnhancedDecoderRenderer implements VideoDecoderRenderer {
|
||||||
|
public abstract String getDecoderName();
|
||||||
|
}
|
||||||
@@ -23,7 +23,7 @@ import android.os.Build;
|
|||||||
import android.view.SurfaceHolder;
|
import android.view.SurfaceHolder;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class MediaCodecDecoderRenderer implements VideoDecoderRenderer {
|
public class MediaCodecDecoderRenderer extends EnhancedDecoderRenderer {
|
||||||
|
|
||||||
private ByteBuffer[] videoDecoderInputBuffers;
|
private ByteBuffer[] videoDecoderInputBuffers;
|
||||||
private MediaCodec videoDecoder;
|
private MediaCodec videoDecoder;
|
||||||
@@ -33,6 +33,9 @@ public class MediaCodecDecoderRenderer implements VideoDecoderRenderer {
|
|||||||
private boolean adaptivePlayback;
|
private boolean adaptivePlayback;
|
||||||
private int initialWidth, initialHeight;
|
private int initialWidth, initialHeight;
|
||||||
|
|
||||||
|
private boolean needsBaselineSpsHack;
|
||||||
|
private SeqParameterSet savedSps;
|
||||||
|
|
||||||
private long lastTimestampUs;
|
private long lastTimestampUs;
|
||||||
private long totalTimeMs;
|
private long totalTimeMs;
|
||||||
private long decoderTimeMs;
|
private long decoderTimeMs;
|
||||||
@@ -63,10 +66,14 @@ public class MediaCodecDecoderRenderer implements VideoDecoderRenderer {
|
|||||||
// Set decoder-specific attributes
|
// Set decoder-specific attributes
|
||||||
adaptivePlayback = MediaCodecHelper.decoderSupportsAdaptivePlayback(decoderName, decoder);
|
adaptivePlayback = MediaCodecHelper.decoderSupportsAdaptivePlayback(decoderName, decoder);
|
||||||
needsSpsBitstreamFixup = MediaCodecHelper.decoderNeedsSpsBitstreamRestrictions(decoderName, decoder);
|
needsSpsBitstreamFixup = MediaCodecHelper.decoderNeedsSpsBitstreamRestrictions(decoderName, decoder);
|
||||||
if (needsSpsBitstreamFixup) {
|
needsBaselineSpsHack = MediaCodecHelper.decoderNeedsBaselineSpsHack(decoderName, decoder);
|
||||||
|
isExynos4 = MediaCodecHelper.isExynos4Device();
|
||||||
|
if (needsSpsBitstreamFixup) {
|
||||||
LimeLog.info("Decoder "+decoderName+" needs SPS bitstream restrictions fixup");
|
LimeLog.info("Decoder "+decoderName+" needs SPS bitstream restrictions fixup");
|
||||||
}
|
}
|
||||||
isExynos4 = MediaCodecHelper.isExynos4Device();
|
if (needsBaselineSpsHack) {
|
||||||
|
LimeLog.info("Decoder "+decoderName+" needs baseline SPS hack");
|
||||||
|
}
|
||||||
if (isExynos4) {
|
if (isExynos4) {
|
||||||
LimeLog.info("Decoder "+decoderName+" is on Exynos 4");
|
LimeLog.info("Decoder "+decoderName+" is on Exynos 4");
|
||||||
}
|
}
|
||||||
@@ -266,7 +273,7 @@ public class MediaCodecDecoderRenderer implements VideoDecoderRenderer {
|
|||||||
|
|
||||||
// Add delta time to the totals (excluding probable outliers)
|
// Add delta time to the totals (excluding probable outliers)
|
||||||
long delta = System.currentTimeMillis()-(presentationTimeUs/1000);
|
long delta = System.currentTimeMillis()-(presentationTimeUs/1000);
|
||||||
if (delta > 5 && delta < 300) {
|
if (delta >= 0 && delta < 1000) {
|
||||||
decoderTimeMs += delta;
|
decoderTimeMs += delta;
|
||||||
totalTimeMs += delta;
|
totalTimeMs += delta;
|
||||||
}
|
}
|
||||||
@@ -364,7 +371,7 @@ public class MediaCodecDecoderRenderer implements VideoDecoderRenderer {
|
|||||||
private void submitDecodeUnit(DecodeUnit decodeUnit, ByteBuffer buf, int inputBufferIndex) {
|
private void submitDecodeUnit(DecodeUnit decodeUnit, ByteBuffer buf, int inputBufferIndex) {
|
||||||
long currentTime = System.currentTimeMillis();
|
long currentTime = System.currentTimeMillis();
|
||||||
long delta = currentTime-decodeUnit.getReceiveTimestamp();
|
long delta = currentTime-decodeUnit.getReceiveTimestamp();
|
||||||
if (delta >= 0 && delta < 300) {
|
if (delta >= 0 && delta < 1000) {
|
||||||
totalTimeMs += currentTime-decodeUnit.getReceiveTimestamp();
|
totalTimeMs += currentTime-decodeUnit.getReceiveTimestamp();
|
||||||
totalFrames++;
|
totalFrames++;
|
||||||
}
|
}
|
||||||
@@ -390,6 +397,8 @@ public class MediaCodecDecoderRenderer implements VideoDecoderRenderer {
|
|||||||
numIframeIn++;
|
numIframeIn++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean needsSpsReplay = false;
|
||||||
|
|
||||||
if ((decodeUnitFlags & DecodeUnit.DU_FLAG_CODEC_CONFIG) != 0) {
|
if ((decodeUnitFlags & DecodeUnit.DU_FLAG_CODEC_CONFIG) != 0) {
|
||||||
ByteBufferDescriptor header = decodeUnit.getBufferList().get(0);
|
ByteBufferDescriptor header = decodeUnit.getBufferList().get(0);
|
||||||
if (header.data[header.offset+4] == 0x67) {
|
if (header.data[header.offset+4] == 0x67) {
|
||||||
@@ -402,6 +411,23 @@ public class MediaCodecDecoderRenderer implements VideoDecoderRenderer {
|
|||||||
|
|
||||||
SeqParameterSet sps = SeqParameterSet.read(spsBuf);
|
SeqParameterSet sps = SeqParameterSet.read(spsBuf);
|
||||||
|
|
||||||
|
// Some decoders rely on H264 level to decide how many buffers are needed
|
||||||
|
// Since we only need one frame buffered, we'll set the level as low as we can
|
||||||
|
// for known resolution combinations
|
||||||
|
if (initialWidth == 1280 && initialHeight == 720) {
|
||||||
|
// Max 5 buffered frames at 1280x720x60
|
||||||
|
LimeLog.info("Patching level_idc to 32");
|
||||||
|
sps.level_idc = 32;
|
||||||
|
}
|
||||||
|
else if (initialWidth == 1920 && initialHeight == 1080) {
|
||||||
|
// Max 4 buffered frames at 1920x1080x64
|
||||||
|
LimeLog.info("Patching level_idc to 42");
|
||||||
|
sps.level_idc = 42;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Leave the profile alone (currently 5.0)
|
||||||
|
}
|
||||||
|
|
||||||
// TI OMAP4 requires a reference frame count of 1 to decode successfully. Exynos 4
|
// TI OMAP4 requires a reference frame count of 1 to decode successfully. Exynos 4
|
||||||
// also requires this fixup.
|
// also requires this fixup.
|
||||||
//
|
//
|
||||||
@@ -426,6 +452,13 @@ public class MediaCodecDecoderRenderer implements VideoDecoderRenderer {
|
|||||||
sps.vuiParams.bitstreamRestriction.max_dec_frame_buffering = 1;
|
sps.vuiParams.bitstreamRestriction.max_dec_frame_buffering = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we need to hack this SPS to say we're baseline, do so now
|
||||||
|
if (needsBaselineSpsHack) {
|
||||||
|
LimeLog.info("Hacking SPS to baseline");
|
||||||
|
sps.profile_idc = 66;
|
||||||
|
savedSps = sps;
|
||||||
|
}
|
||||||
|
|
||||||
// Write the annex B header
|
// Write the annex B header
|
||||||
buf.put(header.data, header.offset, 5);
|
buf.put(header.data, header.offset, 5);
|
||||||
|
|
||||||
@@ -440,6 +473,14 @@ public class MediaCodecDecoderRenderer implements VideoDecoderRenderer {
|
|||||||
return;
|
return;
|
||||||
} else if (header.data[header.offset+4] == 0x68) {
|
} else if (header.data[header.offset+4] == 0x68) {
|
||||||
numPpsIn++;
|
numPpsIn++;
|
||||||
|
|
||||||
|
if (needsBaselineSpsHack) {
|
||||||
|
LimeLog.info("Saw PPS; disabling SPS hack");
|
||||||
|
needsBaselineSpsHack = false;
|
||||||
|
|
||||||
|
// Give the decoder the SPS again with the proper profile now
|
||||||
|
needsSpsReplay = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -454,8 +495,39 @@ public class MediaCodecDecoderRenderer implements VideoDecoderRenderer {
|
|||||||
timestampUs, codecFlags);
|
timestampUs, codecFlags);
|
||||||
|
|
||||||
depacketizer.freeDecodeUnit(decodeUnit);
|
depacketizer.freeDecodeUnit(decodeUnit);
|
||||||
|
|
||||||
|
if (needsSpsReplay) {
|
||||||
|
replaySps();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void replaySps() {
|
||||||
|
int inputIndex = videoDecoder.dequeueInputBuffer(-1);
|
||||||
|
ByteBuffer inputBuffer = videoDecoderInputBuffers[inputIndex];
|
||||||
|
|
||||||
|
inputBuffer.clear();
|
||||||
|
|
||||||
|
// Write the Annex B header
|
||||||
|
inputBuffer.put(new byte[]{0x00, 0x00, 0x00, 0x01, 0x67});
|
||||||
|
|
||||||
|
// Switch the H264 profile back to high
|
||||||
|
savedSps.profile_idc = 100;
|
||||||
|
|
||||||
|
// Write the SPS data
|
||||||
|
savedSps.write(inputBuffer);
|
||||||
|
|
||||||
|
// No need for the SPS anymore
|
||||||
|
savedSps = null;
|
||||||
|
|
||||||
|
// Queue the new SPS
|
||||||
|
queueInputBuffer(inputIndex,
|
||||||
|
0, inputBuffer.position(),
|
||||||
|
System.currentTimeMillis() * 1000,
|
||||||
|
MediaCodec.BUFFER_FLAG_CODEC_CONFIG);
|
||||||
|
|
||||||
|
LimeLog.info("SPS replay complete");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getCapabilities() {
|
public int getCapabilities() {
|
||||||
return adaptivePlayback ?
|
return adaptivePlayback ?
|
||||||
@@ -478,7 +550,12 @@ public class MediaCodecDecoderRenderer implements VideoDecoderRenderer {
|
|||||||
return (int)(totalTimeMs / totalFrames);
|
return (int)(totalTimeMs / totalFrames);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class RendererException extends RuntimeException {
|
@Override
|
||||||
|
public String getDecoderName() {
|
||||||
|
return decoderName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class RendererException extends RuntimeException {
|
||||||
private static final long serialVersionUID = 8985937536997012406L;
|
private static final long serialVersionUID = 8985937536997012406L;
|
||||||
|
|
||||||
private Exception originalException;
|
private Exception originalException;
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ public class MediaCodecHelper {
|
|||||||
public static final List<String> blacklistedDecoderPrefixes;
|
public static final List<String> blacklistedDecoderPrefixes;
|
||||||
public static final List<String> spsFixupBitstreamFixupDecoderPrefixes;
|
public static final List<String> spsFixupBitstreamFixupDecoderPrefixes;
|
||||||
public static final List<String> whitelistedAdaptiveResolutionPrefixes;
|
public static final List<String> whitelistedAdaptiveResolutionPrefixes;
|
||||||
|
public static final List<String> baselineProfileHackPrefixes;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
preferredDecoders = new LinkedList<String>();
|
preferredDecoders = new LinkedList<String>();
|
||||||
@@ -43,6 +44,10 @@ public class MediaCodecHelper {
|
|||||||
spsFixupBitstreamFixupDecoderPrefixes.add("omx.nvidia");
|
spsFixupBitstreamFixupDecoderPrefixes.add("omx.nvidia");
|
||||||
spsFixupBitstreamFixupDecoderPrefixes.add("omx.qcom");
|
spsFixupBitstreamFixupDecoderPrefixes.add("omx.qcom");
|
||||||
spsFixupBitstreamFixupDecoderPrefixes.add("omx.mtk");
|
spsFixupBitstreamFixupDecoderPrefixes.add("omx.mtk");
|
||||||
|
spsFixupBitstreamFixupDecoderPrefixes.add("omx.brcm");
|
||||||
|
|
||||||
|
baselineProfileHackPrefixes = new LinkedList<String>();
|
||||||
|
baselineProfileHackPrefixes.add("omx.intel");
|
||||||
|
|
||||||
whitelistedAdaptiveResolutionPrefixes = new LinkedList<String>();
|
whitelistedAdaptiveResolutionPrefixes = new LinkedList<String>();
|
||||||
whitelistedAdaptiveResolutionPrefixes.add("omx.nvidia");
|
whitelistedAdaptiveResolutionPrefixes.add("omx.nvidia");
|
||||||
@@ -66,6 +71,10 @@ public class MediaCodecHelper {
|
|||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.KITKAT)
|
@TargetApi(Build.VERSION_CODES.KITKAT)
|
||||||
public static boolean decoderSupportsAdaptivePlayback(String decoderName, MediaCodecInfo decoderInfo) {
|
public static boolean decoderSupportsAdaptivePlayback(String decoderName, MediaCodecInfo decoderInfo) {
|
||||||
|
/*
|
||||||
|
FIXME: Intel's decoder on Nexus Player forces the high latency path if adaptive playback is enabled
|
||||||
|
so we'll keep it off for now, since we don't know whether other devices also do the same
|
||||||
|
|
||||||
if (isDecoderInList(whitelistedAdaptiveResolutionPrefixes, decoderName)) {
|
if (isDecoderInList(whitelistedAdaptiveResolutionPrefixes, decoderName)) {
|
||||||
LimeLog.info("Adaptive playback supported (whitelist)");
|
LimeLog.info("Adaptive playback supported (whitelist)");
|
||||||
return true;
|
return true;
|
||||||
@@ -84,7 +93,7 @@ public class MediaCodecHelper {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Tolerate buggy codecs
|
// Tolerate buggy codecs
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -93,6 +102,10 @@ public class MediaCodecHelper {
|
|||||||
return isDecoderInList(spsFixupBitstreamFixupDecoderPrefixes, decoderName);
|
return isDecoderInList(spsFixupBitstreamFixupDecoderPrefixes, decoderName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean decoderNeedsBaselineSpsHack(String decoderName, MediaCodecInfo decoderInfo) {
|
||||||
|
return isDecoderInList(baselineProfileHackPrefixes, decoderName);
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@SuppressLint("NewApi")
|
@SuppressLint("NewApi")
|
||||||
private static LinkedList<MediaCodecInfo> getMediaCodecList() {
|
private static LinkedList<MediaCodecInfo> getMediaCodecList() {
|
||||||
|
|||||||
@@ -99,7 +99,8 @@ public class ComputerDatabaseManager {
|
|||||||
details.macAddress = c.getString(4);
|
details.macAddress = c.getString(4);
|
||||||
|
|
||||||
// This signifies we don't have dynamic state (like pair state)
|
// This signifies we don't have dynamic state (like pair state)
|
||||||
details.state = ComputerDetails.State.UNKNOWN;
|
details.state = ComputerDetails.State.UNKNOWN;
|
||||||
|
details.reachability = ComputerDetails.Reachability.UNKNOWN;
|
||||||
|
|
||||||
// If a field is corrupt or missing, skip the database entry
|
// If a field is corrupt or missing, skip the database entry
|
||||||
if (details.uuid == null || details.localIp == null || details.remoteIp == null ||
|
if (details.uuid == null || details.localIp == null || details.remoteIp == null ||
|
||||||
@@ -107,7 +108,8 @@ public class ComputerDatabaseManager {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
computerList.add(details);
|
|
||||||
|
computerList.add(details);
|
||||||
}
|
}
|
||||||
|
|
||||||
c.close();
|
c.close();
|
||||||
@@ -152,6 +154,9 @@ public class ComputerDatabaseManager {
|
|||||||
|
|
||||||
c.close();
|
c.close();
|
||||||
|
|
||||||
|
details.state = ComputerDetails.State.UNKNOWN;
|
||||||
|
details.reachability = ComputerDetails.Reachability.UNKNOWN;
|
||||||
|
|
||||||
// If a field is corrupt or missing, delete the database entry
|
// If a field is corrupt or missing, delete the database entry
|
||||||
if (details.uuid == null || details.localIp == null || details.remoteIp == null ||
|
if (details.uuid == null || details.localIp == null || details.remoteIp == null ||
|
||||||
details.macAddress == null) {
|
details.macAddress == null) {
|
||||||
|
|||||||
@@ -1,13 +1,7 @@
|
|||||||
package com.limelight.computers;
|
package com.limelight.computers;
|
||||||
|
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.util.HashMap;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Timer;
|
|
||||||
import java.util.TimerTask;
|
|
||||||
import java.util.concurrent.LinkedBlockingQueue;
|
|
||||||
import java.util.concurrent.ThreadPoolExecutor;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import com.limelight.LimeLog;
|
import com.limelight.LimeLog;
|
||||||
@@ -26,7 +20,7 @@ import android.os.Binder;
|
|||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
|
|
||||||
public class ComputerManagerService extends Service {
|
public class ComputerManagerService extends Service {
|
||||||
private static final int POLLING_PERIOD_MS = 5000;
|
private static final int POLLING_PERIOD_MS = 3000;
|
||||||
private static final int MDNS_QUERY_PERIOD_MS = 1000;
|
private static final int MDNS_QUERY_PERIOD_MS = 1000;
|
||||||
|
|
||||||
private ComputerManagerBinder binder = new ComputerManagerBinder();
|
private ComputerManagerBinder binder = new ComputerManagerBinder();
|
||||||
@@ -35,9 +29,10 @@ public class ComputerManagerService extends Service {
|
|||||||
private AtomicInteger dbRefCount = new AtomicInteger(0);
|
private AtomicInteger dbRefCount = new AtomicInteger(0);
|
||||||
|
|
||||||
private IdentityManager idManager;
|
private IdentityManager idManager;
|
||||||
private HashMap<ComputerDetails, Thread> pollingThreads;
|
private final LinkedList<PollingTuple> pollingTuples = new LinkedList<PollingTuple>();
|
||||||
private ComputerManagerListener listener = null;
|
private ComputerManagerListener listener = null;
|
||||||
private AtomicInteger activePolls = new AtomicInteger(0);
|
private AtomicInteger activePolls = new AtomicInteger(0);
|
||||||
|
private boolean pollingActive = false;
|
||||||
|
|
||||||
private DiscoveryService.DiscoveryBinder discoveryBinder;
|
private DiscoveryService.DiscoveryBinder discoveryBinder;
|
||||||
private final ServiceConnection discoveryServiceConnection = new ServiceConnection() {
|
private final ServiceConnection discoveryServiceConnection = new ServiceConnection() {
|
||||||
@@ -62,7 +57,7 @@ public class ComputerManagerService extends Service {
|
|||||||
// Returns true if the details object was modified
|
// Returns true if the details object was modified
|
||||||
private boolean runPoll(ComputerDetails details)
|
private boolean runPoll(ComputerDetails details)
|
||||||
{
|
{
|
||||||
boolean newPc = (details.name == null);
|
boolean newPc = details.name.isEmpty();
|
||||||
|
|
||||||
if (!getLocalDatabaseReference()) {
|
if (!getLocalDatabaseReference()) {
|
||||||
return false;
|
return false;
|
||||||
@@ -106,18 +101,9 @@ public class ComputerManagerService extends Service {
|
|||||||
Thread t = new Thread() {
|
Thread t = new Thread() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
while (!isInterrupted()) {
|
while (!isInterrupted() && pollingActive) {
|
||||||
ComputerDetails originalDetails = new ComputerDetails();
|
|
||||||
originalDetails.update(details);
|
|
||||||
|
|
||||||
// Check if this poll has modified the details
|
// Check if this poll has modified the details
|
||||||
if (runPoll(details) && !originalDetails.equals(details)) {
|
runPoll(details);
|
||||||
// Replace our thread entry with the new one
|
|
||||||
synchronized (pollingThreads) {
|
|
||||||
pollingThreads.remove(originalDetails);
|
|
||||||
pollingThreads.put(details, this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Wait until the next polling interval
|
// Wait until the next polling interval
|
||||||
try {
|
try {
|
||||||
@@ -134,26 +120,24 @@ public class ComputerManagerService extends Service {
|
|||||||
|
|
||||||
public class ComputerManagerBinder extends Binder {
|
public class ComputerManagerBinder extends Binder {
|
||||||
public void startPolling(ComputerManagerListener listener) {
|
public void startPolling(ComputerManagerListener listener) {
|
||||||
|
// Polling is active
|
||||||
|
pollingActive = true;
|
||||||
|
|
||||||
// Set the listener
|
// Set the listener
|
||||||
ComputerManagerService.this.listener = listener;
|
ComputerManagerService.this.listener = listener;
|
||||||
|
|
||||||
// Start mDNS autodiscovery too
|
// Start mDNS autodiscovery too
|
||||||
discoveryBinder.startDiscovery(MDNS_QUERY_PERIOD_MS);
|
discoveryBinder.startDiscovery(MDNS_QUERY_PERIOD_MS);
|
||||||
|
|
||||||
// Start polling known machines
|
synchronized (pollingTuples) {
|
||||||
if (!getLocalDatabaseReference()) {
|
for (PollingTuple tuple : pollingTuples) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
List<ComputerDetails> computerList = dbManager.getAllComputers();
|
|
||||||
releaseLocalDatabaseReference();
|
|
||||||
|
|
||||||
synchronized (pollingThreads) {
|
|
||||||
for (ComputerDetails computer : computerList) {
|
|
||||||
// This polling thread might already be there
|
// This polling thread might already be there
|
||||||
if (!pollingThreads.containsKey(computer)) {
|
if (tuple.thread == null) {
|
||||||
Thread t = createPollingThread(computer);
|
// Report this computer initially
|
||||||
pollingThreads.put(computer, t);
|
listener.notifyComputerUpdated(tuple.computer);
|
||||||
t.start();
|
|
||||||
|
tuple.thread = createPollingThread(tuple.computer);
|
||||||
|
tuple.thread.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -207,11 +191,15 @@ public class ComputerManagerService extends Service {
|
|||||||
discoveryBinder.stopDiscovery();
|
discoveryBinder.stopDiscovery();
|
||||||
|
|
||||||
// Stop polling
|
// Stop polling
|
||||||
synchronized (pollingThreads) {
|
pollingActive = false;
|
||||||
for (Thread t : pollingThreads.values()) {
|
synchronized (pollingTuples) {
|
||||||
t.interrupt();
|
for (PollingTuple tuple : pollingTuples) {
|
||||||
|
if (tuple.thread != null) {
|
||||||
|
// Interrupt and remove the thread
|
||||||
|
tuple.thread.interrupt();
|
||||||
|
tuple.thread = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
pollingThreads.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove the listener
|
// Remove the listener
|
||||||
@@ -246,29 +234,62 @@ public class ComputerManagerService extends Service {
|
|||||||
ComputerDetails fakeDetails = new ComputerDetails();
|
ComputerDetails fakeDetails = new ComputerDetails();
|
||||||
fakeDetails.localIp = addr;
|
fakeDetails.localIp = addr;
|
||||||
fakeDetails.remoteIp = addr;
|
fakeDetails.remoteIp = addr;
|
||||||
|
fakeDetails.name = "";
|
||||||
|
|
||||||
// Spawn a thread for this computer
|
addTuple(fakeDetails);
|
||||||
synchronized (pollingThreads) {
|
}
|
||||||
// This polling thread might already be there
|
|
||||||
if (!pollingThreads.containsKey(fakeDetails)) {
|
private void addTuple(ComputerDetails details) {
|
||||||
Thread t = createPollingThread(fakeDetails);
|
synchronized (pollingTuples) {
|
||||||
pollingThreads.put(fakeDetails, t);
|
for (PollingTuple tuple : pollingTuples) {
|
||||||
t.start();
|
// Check if this is the same computer
|
||||||
|
if (tuple.computer == details ||
|
||||||
|
// If there's no name on one of these computers, compare with the local IP
|
||||||
|
((details.name.isEmpty() || tuple.computer.name.isEmpty()) &&
|
||||||
|
tuple.computer.localIp.equals(details.localIp)) ||
|
||||||
|
// If there is a name on both computers, compare with name
|
||||||
|
((!details.name.isEmpty() && !tuple.computer.name.isEmpty()) &&
|
||||||
|
tuple.computer.name.equals(details.name))) {
|
||||||
|
|
||||||
|
// Start a polling thread if polling is active
|
||||||
|
if (pollingActive && tuple.thread == null) {
|
||||||
|
tuple.thread = createPollingThread(details);
|
||||||
|
tuple.thread.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Found an entry so we're done
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we got here, we didn't find an entry
|
||||||
|
PollingTuple tuple = new PollingTuple(details, pollingActive ? createPollingThread(details) : null);
|
||||||
|
pollingTuples.add(tuple);
|
||||||
|
if (tuple.thread != null) {
|
||||||
|
tuple.thread.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean addComputerBlocking(InetAddress addr) {
|
public boolean addComputerBlocking(InetAddress addr) {
|
||||||
// Setup a placeholder
|
// Setup a placeholder
|
||||||
ComputerDetails fakeDetails = new ComputerDetails();
|
ComputerDetails fakeDetails = new ComputerDetails();
|
||||||
fakeDetails.localIp = addr;
|
fakeDetails.localIp = addr;
|
||||||
fakeDetails.remoteIp = addr;
|
fakeDetails.remoteIp = addr;
|
||||||
|
fakeDetails.name = "";
|
||||||
|
|
||||||
// Block while we try to fill the details
|
// Block while we try to fill the details
|
||||||
runPoll(fakeDetails);
|
runPoll(fakeDetails);
|
||||||
|
|
||||||
// If the machine is reachable, it was successful
|
// If the machine is reachable, it was successful
|
||||||
return fakeDetails.state == ComputerDetails.State.ONLINE;
|
if (fakeDetails.state == ComputerDetails.State.ONLINE) {
|
||||||
|
// Start a polling thread for this machine
|
||||||
|
addTuple(fakeDetails);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeComputer(String name) {
|
public void removeComputer(String name) {
|
||||||
@@ -279,6 +300,20 @@ public class ComputerManagerService extends Service {
|
|||||||
// Remove it from the database
|
// Remove it from the database
|
||||||
dbManager.deleteComputer(name);
|
dbManager.deleteComputer(name);
|
||||||
|
|
||||||
|
synchronized (pollingTuples) {
|
||||||
|
// Remove the computer from the computer list
|
||||||
|
for (PollingTuple tuple : pollingTuples) {
|
||||||
|
if (tuple.computer.name.equals(name)) {
|
||||||
|
if (tuple.thread != null) {
|
||||||
|
// Interrupt the thread on this entry
|
||||||
|
tuple.thread.interrupt();
|
||||||
|
}
|
||||||
|
pollingTuples.remove(tuple);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
releaseLocalDatabaseReference();
|
releaseLocalDatabaseReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -297,12 +332,22 @@ public class ComputerManagerService extends Service {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ComputerDetails tryPollIp(InetAddress ipAddr) {
|
private ComputerDetails tryPollIp(ComputerDetails details, InetAddress ipAddr) {
|
||||||
try {
|
try {
|
||||||
NvHTTP http = new NvHTTP(ipAddr, idManager.getUniqueId(),
|
NvHTTP http = new NvHTTP(ipAddr, idManager.getUniqueId(),
|
||||||
null, PlatformBinding.getCryptoProvider(ComputerManagerService.this));
|
null, PlatformBinding.getCryptoProvider(ComputerManagerService.this));
|
||||||
|
|
||||||
return http.getComputerDetails();
|
ComputerDetails newDetails = http.getComputerDetails();
|
||||||
|
|
||||||
|
// Check if this is the PC we expected
|
||||||
|
if (details.uuid != null && newDetails.uuid != null &&
|
||||||
|
!details.uuid.equals(newDetails.uuid)) {
|
||||||
|
// We got the wrong PC!
|
||||||
|
LimeLog.info("Polling returned the wrong PC!");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return newDetails;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -311,20 +356,26 @@ public class ComputerManagerService extends Service {
|
|||||||
private boolean pollComputer(ComputerDetails details, boolean localFirst) {
|
private boolean pollComputer(ComputerDetails details, boolean localFirst) {
|
||||||
ComputerDetails polledDetails;
|
ComputerDetails polledDetails;
|
||||||
|
|
||||||
|
// If the local address is routable across the Internet,
|
||||||
|
// always consider this PC remote to be conservative
|
||||||
|
if (details.localIp.equals(details.remoteIp)) {
|
||||||
|
localFirst = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (localFirst) {
|
if (localFirst) {
|
||||||
polledDetails = tryPollIp(details.localIp);
|
polledDetails = tryPollIp(details, details.localIp);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
polledDetails = tryPollIp(details.remoteIp);
|
polledDetails = tryPollIp(details, details.remoteIp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (polledDetails == null && !details.localIp.equals(details.remoteIp)) {
|
if (polledDetails == null && !details.localIp.equals(details.remoteIp)) {
|
||||||
// Failed, so let's try the fallback
|
// Failed, so let's try the fallback
|
||||||
if (!localFirst) {
|
if (!localFirst) {
|
||||||
polledDetails = tryPollIp(details.localIp);
|
polledDetails = tryPollIp(details, details.localIp);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
polledDetails = tryPollIp(details.remoteIp);
|
polledDetails = tryPollIp(details, details.remoteIp);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The fallback poll worked
|
// The fallback poll worked
|
||||||
@@ -349,7 +400,18 @@ public class ComputerManagerService extends Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean doPollMachine(ComputerDetails details) {
|
private boolean doPollMachine(ComputerDetails details) {
|
||||||
return pollComputer(details, true);
|
if (details.reachability == ComputerDetails.Reachability.UNKNOWN ||
|
||||||
|
details.reachability == ComputerDetails.Reachability.OFFLINE) {
|
||||||
|
// Always try local first to avoid potential UDP issues when
|
||||||
|
// attempting to stream via the router's external IP address
|
||||||
|
// behind its NAT
|
||||||
|
return pollComputer(details, true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// If we're already reached a machine via a particular IP address,
|
||||||
|
// always try that one first
|
||||||
|
return pollComputer(details, details.reachability == ComputerDetails.Reachability.LOCAL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -358,14 +420,24 @@ public class ComputerManagerService extends Service {
|
|||||||
bindService(new Intent(this, DiscoveryService.class),
|
bindService(new Intent(this, DiscoveryService.class),
|
||||||
discoveryServiceConnection, Service.BIND_AUTO_CREATE);
|
discoveryServiceConnection, Service.BIND_AUTO_CREATE);
|
||||||
|
|
||||||
pollingThreads = new HashMap<ComputerDetails, Thread>();
|
|
||||||
|
|
||||||
// Lookup or generate this device's UID
|
// Lookup or generate this device's UID
|
||||||
idManager = new IdentityManager(this);
|
idManager = new IdentityManager(this);
|
||||||
|
|
||||||
// Initialize the DB
|
// Initialize the DB
|
||||||
dbManager = new ComputerDatabaseManager(this);
|
dbManager = new ComputerDatabaseManager(this);
|
||||||
dbRefCount.set(1);
|
dbRefCount.set(1);
|
||||||
|
|
||||||
|
// Grab known machines into our computer list
|
||||||
|
if (!getLocalDatabaseReference()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (ComputerDetails computer : dbManager.getAllComputers()) {
|
||||||
|
// Add tuples for each computer
|
||||||
|
addTuple(computer);
|
||||||
|
}
|
||||||
|
|
||||||
|
releaseLocalDatabaseReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -386,3 +458,13 @@ public class ComputerManagerService extends Service {
|
|||||||
return binder;
|
return binder;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class PollingTuple {
|
||||||
|
public Thread thread;
|
||||||
|
public ComputerDetails computer;
|
||||||
|
|
||||||
|
public PollingTuple(ComputerDetails computer, Thread thread) {
|
||||||
|
this.computer = computer;
|
||||||
|
this.thread = thread;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,169 @@
|
|||||||
|
package com.limelight.grid;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.koushikdutta.async.future.FutureCallback;
|
||||||
|
import com.koushikdutta.ion.Ion;
|
||||||
|
import com.limelight.AppView;
|
||||||
|
import com.limelight.R;
|
||||||
|
import com.limelight.binding.PlatformBinding;
|
||||||
|
import com.limelight.nvstream.http.LimelightCryptoProvider;
|
||||||
|
|
||||||
|
import java.net.InetAddress;
|
||||||
|
import java.net.Socket;
|
||||||
|
import java.security.KeyManagementException;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.security.Principal;
|
||||||
|
import java.security.PrivateKey;
|
||||||
|
import java.security.SecureRandom;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.concurrent.Future;
|
||||||
|
|
||||||
|
import javax.net.ssl.HostnameVerifier;
|
||||||
|
import javax.net.ssl.KeyManager;
|
||||||
|
import javax.net.ssl.SSLContext;
|
||||||
|
import javax.net.ssl.SSLSession;
|
||||||
|
import javax.net.ssl.TrustManager;
|
||||||
|
import javax.net.ssl.X509KeyManager;
|
||||||
|
import javax.net.ssl.X509TrustManager;
|
||||||
|
import java.security.cert.X509Certificate;
|
||||||
|
|
||||||
|
public class AppGridAdapter extends GenericGridAdapter<AppView.AppObject> {
|
||||||
|
|
||||||
|
private InetAddress address;
|
||||||
|
private String uniqueId;
|
||||||
|
private LimelightCryptoProvider cryptoProvider;
|
||||||
|
private SSLContext sslContext;
|
||||||
|
private final HashMap<ImageView, Future> pendingRequests = new HashMap<ImageView, Future>();
|
||||||
|
|
||||||
|
public AppGridAdapter(Context context, InetAddress address, String uniqueId) throws NoSuchAlgorithmException, KeyManagementException {
|
||||||
|
super(context, R.layout.app_grid_item, R.drawable.image_loading);
|
||||||
|
|
||||||
|
this.address = address;
|
||||||
|
this.uniqueId = uniqueId;
|
||||||
|
|
||||||
|
cryptoProvider = PlatformBinding.getCryptoProvider(context);
|
||||||
|
|
||||||
|
sslContext = SSLContext.getInstance("SSL");
|
||||||
|
sslContext.init(ourKeyman, trustAllCerts, new SecureRandom());
|
||||||
|
}
|
||||||
|
|
||||||
|
TrustManager[] trustAllCerts = new TrustManager[] {
|
||||||
|
new X509TrustManager() {
|
||||||
|
public X509Certificate[] getAcceptedIssuers() {
|
||||||
|
return new X509Certificate[0];
|
||||||
|
}
|
||||||
|
public void checkClientTrusted(X509Certificate[] certs, String authType) {}
|
||||||
|
public void checkServerTrusted(X509Certificate[] certs, String authType) {}
|
||||||
|
}};
|
||||||
|
|
||||||
|
KeyManager[] ourKeyman = new KeyManager[] {
|
||||||
|
new X509KeyManager() {
|
||||||
|
public String chooseClientAlias(String[] keyTypes,
|
||||||
|
Principal[] issuers, Socket socket) {
|
||||||
|
return "Limelight-RSA";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String chooseServerAlias(String keyType, Principal[] issuers,
|
||||||
|
Socket socket) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public X509Certificate[] getCertificateChain(String alias) {
|
||||||
|
return new X509Certificate[] {cryptoProvider.getClientCertificate()};
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getClientAliases(String keyType, Principal[] issuers) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PrivateKey getPrivateKey(String alias) {
|
||||||
|
return cryptoProvider.getClientPrivateKey();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getServerAliases(String keyType, Principal[] issuers) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Ignore differences between given hostname and certificate hostname
|
||||||
|
HostnameVerifier hv = new HostnameVerifier() {
|
||||||
|
public boolean verify(String hostname, SSLSession session) { return true; }
|
||||||
|
};
|
||||||
|
|
||||||
|
public void addApp(AppView.AppObject app) {
|
||||||
|
itemList.add(app);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void abortPendingRequests() {
|
||||||
|
HashMap<ImageView, Future> tempMap;
|
||||||
|
|
||||||
|
synchronized (pendingRequests) {
|
||||||
|
// Copy the pending requests under a lock
|
||||||
|
tempMap = new HashMap<ImageView, Future>(pendingRequests);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Future f : tempMap.values()) {
|
||||||
|
f.cancel(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
synchronized (pendingRequests) {
|
||||||
|
// Remove cancelled requests
|
||||||
|
for (ImageView v : tempMap.keySet()) {
|
||||||
|
pendingRequests.remove(v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean populateImageView(final ImageView imgView, AppView.AppObject obj) {
|
||||||
|
|
||||||
|
// Set SSL contexts correctly to allow us to authenticate
|
||||||
|
Ion.getDefault(imgView.getContext()).getHttpClient().getSSLSocketMiddleware().setTrustManagers(trustAllCerts);
|
||||||
|
Ion.getDefault(imgView.getContext()).getHttpClient().getSSLSocketMiddleware().setSSLContext(sslContext);
|
||||||
|
|
||||||
|
// Set off the deferred image load
|
||||||
|
synchronized (pendingRequests) {
|
||||||
|
Future f = Ion.with(imgView)
|
||||||
|
.placeholder(defaultImageRes)
|
||||||
|
.error(defaultImageRes)
|
||||||
|
.load("https://" + address.getHostAddress() + ":47984/appasset?uniqueid=" + uniqueId + "&appid=" +
|
||||||
|
obj.app.getAppId() + "&AssetType=2&AssetIdx=0")
|
||||||
|
.setCallback(new FutureCallback<ImageView>() {
|
||||||
|
@Override
|
||||||
|
public void onCompleted(Exception e, ImageView result) {
|
||||||
|
synchronized (pendingRequests) {
|
||||||
|
pendingRequests.remove(imgView);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
pendingRequests.put(imgView, f);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean populateTextView(TextView txtView, AppView.AppObject obj) {
|
||||||
|
// Select the text view so it starts marquee mode
|
||||||
|
txtView.setSelected(true);
|
||||||
|
|
||||||
|
// Return false to use the app's toString method
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean populateOverlayView(ImageView overlayView, AppView.AppObject obj) {
|
||||||
|
if (obj.app.getIsRunning()) {
|
||||||
|
// Show the play button overlay
|
||||||
|
overlayView.setImageResource(R.drawable.play);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// No overlay
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
package com.limelight.grid;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.BaseAdapter;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.limelight.R;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public abstract class GenericGridAdapter<T> extends BaseAdapter {
|
||||||
|
protected Context context;
|
||||||
|
protected int defaultImageRes;
|
||||||
|
protected int layoutId;
|
||||||
|
protected ArrayList<T> itemList = new ArrayList<T>();
|
||||||
|
protected LayoutInflater inflater;
|
||||||
|
|
||||||
|
public GenericGridAdapter(Context context, int layoutId, int defaultImageRes) {
|
||||||
|
this.context = context;
|
||||||
|
this.layoutId = layoutId;
|
||||||
|
this.defaultImageRes = defaultImageRes;
|
||||||
|
|
||||||
|
this.inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
itemList.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCount() {
|
||||||
|
return itemList.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getItem(int i) {
|
||||||
|
return itemList.get(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getItemId(int i) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract boolean populateImageView(ImageView imgView, T obj);
|
||||||
|
public abstract boolean populateTextView(TextView txtView, T obj);
|
||||||
|
public abstract boolean populateOverlayView(ImageView overlayView, T obj);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View getView(int i, View convertView, ViewGroup viewGroup) {
|
||||||
|
if (convertView == null) {
|
||||||
|
convertView = inflater.inflate(layoutId, viewGroup, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
ImageView imgView = (ImageView) convertView.findViewById(R.id.grid_image);
|
||||||
|
ImageView overlayView = (ImageView) convertView.findViewById(R.id.grid_overlay);
|
||||||
|
TextView txtView = (TextView) convertView.findViewById(R.id.grid_text);
|
||||||
|
|
||||||
|
if (!populateImageView(imgView, itemList.get(i))) {
|
||||||
|
imgView.setImageResource(defaultImageRes);
|
||||||
|
}
|
||||||
|
if (!populateTextView(txtView, itemList.get(i))) {
|
||||||
|
txtView.setText(itemList.get(i).toString());
|
||||||
|
}
|
||||||
|
if (!populateOverlayView(overlayView, itemList.get(i))) {
|
||||||
|
overlayView.setVisibility(View.INVISIBLE);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
overlayView.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
return convertView;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package com.limelight.grid;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.limelight.PcView;
|
||||||
|
import com.limelight.R;
|
||||||
|
import com.limelight.nvstream.http.ComputerDetails;
|
||||||
|
|
||||||
|
public class PcGridAdapter extends GenericGridAdapter<PcView.ComputerObject> {
|
||||||
|
|
||||||
|
public PcGridAdapter(Context context) {
|
||||||
|
super(context, R.layout.pc_grid_item, R.drawable.computer);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addComputer(PcView.ComputerObject computer) {
|
||||||
|
itemList.add(computer);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean removeComputer(PcView.ComputerObject computer) {
|
||||||
|
return itemList.remove(computer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean populateImageView(ImageView imgView, PcView.ComputerObject obj) {
|
||||||
|
if (obj.details.reachability != ComputerDetails.Reachability.OFFLINE) {
|
||||||
|
imgView.setAlpha(1.0f);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
imgView.setAlpha(0.4f);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return false to use the default drawable
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean populateTextView(TextView txtView, PcView.ComputerObject obj) {
|
||||||
|
if (obj.details.reachability != ComputerDetails.Reachability.OFFLINE) {
|
||||||
|
txtView.setAlpha(1.0f);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
txtView.setAlpha(0.4f);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return false to use the computer's toString method
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean populateOverlayView(ImageView overlayView, PcView.ComputerObject obj) {
|
||||||
|
if (obj.details.reachability == ComputerDetails.Reachability.UNKNOWN) {
|
||||||
|
// Still refreshing this PC so display the overlay
|
||||||
|
overlayView.setImageResource(R.drawable.image_loading);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// No overlay
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,6 +7,8 @@ import java.util.concurrent.LinkedBlockingQueue;
|
|||||||
import com.limelight.computers.ComputerManagerService;
|
import com.limelight.computers.ComputerManagerService;
|
||||||
import com.limelight.R;
|
import com.limelight.R;
|
||||||
import com.limelight.utils.Dialog;
|
import com.limelight.utils.Dialog;
|
||||||
|
import com.limelight.utils.SpinnerDialog;
|
||||||
|
import com.limelight.utils.UiHelper;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.Service;
|
import android.app.Service;
|
||||||
@@ -15,14 +17,12 @@ import android.content.Intent;
|
|||||||
import android.content.ServiceConnection;
|
import android.content.ServiceConnection;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.view.View;
|
import android.view.KeyEvent;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.inputmethod.EditorInfo;
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
public class AddComputerManually extends Activity {
|
public class AddComputerManually extends Activity {
|
||||||
private Button addPcButton;
|
|
||||||
private TextView hostText;
|
private TextView hostText;
|
||||||
private ComputerManagerService.ComputerManagerBinder managerBinder;
|
private ComputerManagerService.ComputerManagerBinder managerBinder;
|
||||||
private LinkedBlockingQueue<String> computersToAdd = new LinkedBlockingQueue<String>();
|
private LinkedBlockingQueue<String> computersToAdd = new LinkedBlockingQueue<String>();
|
||||||
@@ -42,21 +42,27 @@ public class AddComputerManually extends Activity {
|
|||||||
private void doAddPc(String host) {
|
private void doAddPc(String host) {
|
||||||
String msg;
|
String msg;
|
||||||
boolean finish = false;
|
boolean finish = false;
|
||||||
|
|
||||||
|
SpinnerDialog dialog = SpinnerDialog.displayDialog(this, getResources().getString(R.string.title_add_pc),
|
||||||
|
getResources().getString(R.string.msg_add_pc), false);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
InetAddress addr = InetAddress.getByName(host);
|
InetAddress addr = InetAddress.getByName(host);
|
||||||
|
|
||||||
if (!managerBinder.addComputerBlocking(addr)){
|
if (!managerBinder.addComputerBlocking(addr)){
|
||||||
msg = "Unable to connect to the specified computer. Make sure the required ports are allowed through the firewall.";
|
msg = getResources().getString(R.string.addpc_fail);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
msg = "Successfully added computer";
|
msg = getResources().getString(R.string.addpc_success);
|
||||||
finish = true;
|
finish = true;
|
||||||
}
|
}
|
||||||
} catch (UnknownHostException e) {
|
} catch (UnknownHostException e) {
|
||||||
msg = "Unable to resolve PC address. Make sure you didn't make a typo in the address.";
|
msg = getResources().getString(R.string.addpc_unknown_host);
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean toastFinish = finish;
|
dialog.dismiss();
|
||||||
|
|
||||||
|
final boolean toastFinish = finish;
|
||||||
final String toastMsg = msg;
|
final String toastMsg = msg;
|
||||||
AddComputerManually.this.runOnUiThread(new Runnable() {
|
AddComputerManually.this.runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
@@ -109,6 +115,7 @@ public class AddComputerManually extends Activity {
|
|||||||
super.onStop();
|
super.onStop();
|
||||||
|
|
||||||
Dialog.closeDialogs();
|
Dialog.closeDialogs();
|
||||||
|
SpinnerDialog.closeDialogs(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -127,24 +134,31 @@ public class AddComputerManually extends Activity {
|
|||||||
|
|
||||||
setContentView(R.layout.activity_add_computer_manually);
|
setContentView(R.layout.activity_add_computer_manually);
|
||||||
|
|
||||||
this.addPcButton = (Button) findViewById(R.id.addPc);
|
UiHelper.notifyNewRootView(this);
|
||||||
|
|
||||||
this.hostText = (TextView) findViewById(R.id.hostTextView);
|
this.hostText = (TextView) findViewById(R.id.hostTextView);
|
||||||
|
hostText.setImeOptions(EditorInfo.IME_ACTION_DONE);
|
||||||
|
hostText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onEditorAction(TextView textView, int actionId, KeyEvent keyEvent) {
|
||||||
|
if (actionId == EditorInfo.IME_ACTION_DONE ||
|
||||||
|
(keyEvent != null &&
|
||||||
|
keyEvent.getAction() == KeyEvent.ACTION_DOWN &&
|
||||||
|
keyEvent.getKeyCode() == KeyEvent.KEYCODE_ENTER)) {
|
||||||
|
if (hostText.getText().length() == 0) {
|
||||||
|
Toast.makeText(AddComputerManually.this, getResources().getString(R.string.addpc_enter_ip), Toast.LENGTH_LONG).show();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
computersToAdd.add(hostText.getText().toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Bind to the ComputerManager service
|
// Bind to the ComputerManager service
|
||||||
bindService(new Intent(AddComputerManually.this,
|
bindService(new Intent(AddComputerManually.this,
|
||||||
ComputerManagerService.class), serviceConnection, Service.BIND_AUTO_CREATE);
|
ComputerManagerService.class), serviceConnection, Service.BIND_AUTO_CREATE);
|
||||||
|
|
||||||
addPcButton.setOnClickListener(new OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
if (hostText.getText().length() == 0) {
|
|
||||||
Toast.makeText(AddComputerManually.this, "You must enter an IP address", Toast.LENGTH_LONG).show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Toast.makeText(AddComputerManually.this, "Adding PC...", Toast.LENGTH_SHORT).show();
|
|
||||||
computersToAdd.add(hostText.getText().toString());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,11 +12,12 @@ public class PreferenceConfiguration {
|
|||||||
private static final String SOPS_PREF_STRING = "checkbox_enable_sops";
|
private static final String SOPS_PREF_STRING = "checkbox_enable_sops";
|
||||||
private static final String DISABLE_TOASTS_PREF_STRING = "checkbox_disable_warnings";
|
private static final String DISABLE_TOASTS_PREF_STRING = "checkbox_disable_warnings";
|
||||||
private static final String HOST_AUDIO_PREF_STRING = "checkbox_host_audio";
|
private static final String HOST_AUDIO_PREF_STRING = "checkbox_host_audio";
|
||||||
|
private static final String DEADZONE_PREF_STRING = "seekbar_deadzone";
|
||||||
|
|
||||||
private static final int BITRATE_DEFAULT_720_30 = 5;
|
private static final int BITRATE_DEFAULT_720_30 = 5;
|
||||||
private static final int BITRATE_DEFAULT_720_60 = 10;
|
private static final int BITRATE_DEFAULT_720_60 = 10;
|
||||||
private static final int BITRATE_DEFAULT_1080_30 = 10;
|
private static final int BITRATE_DEFAULT_1080_30 = 10;
|
||||||
private static final int BITRATE_DEFAULT_1080_60 = 30;
|
private static final int BITRATE_DEFAULT_1080_60 = 20;
|
||||||
|
|
||||||
private static final String DEFAULT_RES_FPS = "720p60";
|
private static final String DEFAULT_RES_FPS = "720p60";
|
||||||
private static final String DEFAULT_DECODER = "auto";
|
private static final String DEFAULT_DECODER = "auto";
|
||||||
@@ -25,6 +26,7 @@ public class PreferenceConfiguration {
|
|||||||
private static final boolean DEFAULT_SOPS = true;
|
private static final boolean DEFAULT_SOPS = true;
|
||||||
private static final boolean DEFAULT_DISABLE_TOASTS = false;
|
private static final boolean DEFAULT_DISABLE_TOASTS = false;
|
||||||
private static final boolean DEFAULT_HOST_AUDIO = false;
|
private static final boolean DEFAULT_HOST_AUDIO = false;
|
||||||
|
private static final int DEFAULT_DEADZONE = 15;
|
||||||
|
|
||||||
public static final int FORCE_HARDWARE_DECODER = -1;
|
public static final int FORCE_HARDWARE_DECODER = -1;
|
||||||
public static final int AUTOSELECT_DECODER = 0;
|
public static final int AUTOSELECT_DECODER = 0;
|
||||||
@@ -33,6 +35,7 @@ public class PreferenceConfiguration {
|
|||||||
public int width, height, fps;
|
public int width, height, fps;
|
||||||
public int bitrate;
|
public int bitrate;
|
||||||
public int decoder;
|
public int decoder;
|
||||||
|
public int deadzonePercentage;
|
||||||
public boolean stretchVideo, enableSops, playHostAudio, disableWarnings;
|
public boolean stretchVideo, enableSops, playHostAudio, disableWarnings;
|
||||||
|
|
||||||
public static int getDefaultBitrate(String resFpsString) {
|
public static int getDefaultBitrate(String resFpsString) {
|
||||||
@@ -130,6 +133,8 @@ public class PreferenceConfiguration {
|
|||||||
|
|
||||||
config.decoder = getDecoderValue(context);
|
config.decoder = getDecoderValue(context);
|
||||||
|
|
||||||
|
config.deadzonePercentage = prefs.getInt(DEADZONE_PREF_STRING, DEFAULT_DEADZONE);
|
||||||
|
|
||||||
// Checkbox preferences
|
// Checkbox preferences
|
||||||
config.disableWarnings = prefs.getBoolean(DISABLE_TOASTS_PREF_STRING, DEFAULT_DISABLE_TOASTS);
|
config.disableWarnings = prefs.getBoolean(DISABLE_TOASTS_PREF_STRING, DEFAULT_DISABLE_TOASTS);
|
||||||
config.enableSops = prefs.getBoolean(SOPS_PREF_STRING, DEFAULT_SOPS);
|
config.enableSops = prefs.getBoolean(SOPS_PREF_STRING, DEFAULT_SOPS);
|
||||||
|
|||||||
@@ -19,11 +19,11 @@ public class SeekBarPreference extends DialogPreference
|
|||||||
private static final String SCHEMA_URL = "http://schemas.android.com/apk/res/android";
|
private static final String SCHEMA_URL = "http://schemas.android.com/apk/res/android";
|
||||||
|
|
||||||
private SeekBar seekBar;
|
private SeekBar seekBar;
|
||||||
private TextView splashText, valueText;
|
private TextView valueText;
|
||||||
private Context context;
|
private Context context;
|
||||||
|
|
||||||
private String dialogMessage, suffix;
|
private String dialogMessage, suffix;
|
||||||
private int defaultValue, maxValue, currentValue;
|
private int defaultValue, maxValue, minValue, currentValue;
|
||||||
|
|
||||||
public SeekBarPreference(Context context, AttributeSet attrs) {
|
public SeekBarPreference(Context context, AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
@@ -47,9 +47,10 @@ public class SeekBarPreference extends DialogPreference
|
|||||||
suffix = context.getString(suffixId);
|
suffix = context.getString(suffixId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get default and max seekbar values
|
// Get default, min, and max seekbar values
|
||||||
defaultValue = PreferenceConfiguration.getDefaultBitrate(context);
|
defaultValue = attrs.getAttributeIntValue(SCHEMA_URL, "defaultValue", PreferenceConfiguration.getDefaultBitrate(context));
|
||||||
maxValue = attrs.getAttributeIntValue(SCHEMA_URL, "max", 100);
|
maxValue = attrs.getAttributeIntValue(SCHEMA_URL, "max", 100);
|
||||||
|
minValue = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -60,7 +61,7 @@ public class SeekBarPreference extends DialogPreference
|
|||||||
layout.setOrientation(LinearLayout.VERTICAL);
|
layout.setOrientation(LinearLayout.VERTICAL);
|
||||||
layout.setPadding(6, 6, 6, 6);
|
layout.setPadding(6, 6, 6, 6);
|
||||||
|
|
||||||
splashText = new TextView(context);
|
TextView splashText = new TextView(context);
|
||||||
splashText.setPadding(30, 10, 30, 10);
|
splashText.setPadding(30, 10, 30, 10);
|
||||||
if (dialogMessage != null) {
|
if (dialogMessage != null) {
|
||||||
splashText.setText(dialogMessage);
|
splashText.setText(dialogMessage);
|
||||||
@@ -71,7 +72,7 @@ public class SeekBarPreference extends DialogPreference
|
|||||||
valueText.setGravity(Gravity.CENTER_HORIZONTAL);
|
valueText.setGravity(Gravity.CENTER_HORIZONTAL);
|
||||||
valueText.setTextSize(32);
|
valueText.setTextSize(32);
|
||||||
params = new LinearLayout.LayoutParams(
|
params = new LinearLayout.LayoutParams(
|
||||||
LinearLayout.LayoutParams.FILL_PARENT,
|
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||||
LinearLayout.LayoutParams.WRAP_CONTENT);
|
LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||||
layout.addView(valueText, params);
|
layout.addView(valueText, params);
|
||||||
|
|
||||||
@@ -79,8 +80,13 @@ public class SeekBarPreference extends DialogPreference
|
|||||||
seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onProgressChanged(SeekBar seekBar, int value, boolean b) {
|
public void onProgressChanged(SeekBar seekBar, int value, boolean b) {
|
||||||
|
if (value < minValue) {
|
||||||
|
seekBar.setProgress(minValue);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
String t = String.valueOf(value);
|
String t = String.valueOf(value);
|
||||||
valueText.setText(suffix == null ? t : t.concat(" " + suffix));
|
valueText.setText(suffix == null ? t : t.concat(suffix.length() > 1 ? " "+suffix : suffix));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -90,7 +96,7 @@ public class SeekBarPreference extends DialogPreference
|
|||||||
public void onStopTrackingTouch(SeekBar seekBar) {}
|
public void onStopTrackingTouch(SeekBar seekBar) {}
|
||||||
});
|
});
|
||||||
|
|
||||||
layout.addView(seekBar, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
|
layout.addView(seekBar, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
|
||||||
|
|
||||||
if (shouldPersist()) {
|
if (shouldPersist()) {
|
||||||
currentValue = getPersistedInt(defaultValue);
|
currentValue = getPersistedInt(defaultValue);
|
||||||
@@ -149,10 +155,10 @@ public class SeekBarPreference extends DialogPreference
|
|||||||
if (shouldPersist()) {
|
if (shouldPersist()) {
|
||||||
currentValue = seekBar.getProgress();
|
currentValue = seekBar.getProgress();
|
||||||
persistInt(seekBar.getProgress());
|
persistInt(seekBar.getProgress());
|
||||||
callChangeListener(Integer.valueOf(seekBar.getProgress()));
|
callChangeListener(seekBar.getProgress());
|
||||||
}
|
}
|
||||||
|
|
||||||
((AlertDialog) getDialog()).dismiss();
|
getDialog().dismiss();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import android.preference.PreferenceFragment;
|
|||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
|
|
||||||
import com.limelight.R;
|
import com.limelight.R;
|
||||||
|
import com.limelight.utils.UiHelper;
|
||||||
|
|
||||||
public class StreamSettings extends Activity {
|
public class StreamSettings extends Activity {
|
||||||
@Override
|
@Override
|
||||||
@@ -18,6 +19,8 @@ public class StreamSettings extends Activity {
|
|||||||
getFragmentManager().beginTransaction().replace(
|
getFragmentManager().beginTransaction().replace(
|
||||||
R.id.stream_settings, new SettingsFragment()
|
R.id.stream_settings, new SettingsFragment()
|
||||||
).commit();
|
).commit();
|
||||||
|
|
||||||
|
UiHelper.notifyNewRootView(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class SettingsFragment extends PreferenceFragment {
|
public static class SettingsFragment extends PreferenceFragment {
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package com.limelight.utils;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.app.UiModeManager;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.res.Configuration;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
public class UiHelper {
|
||||||
|
|
||||||
|
// Values from https://developer.android.com/training/tv/start/layouts.html
|
||||||
|
private static final int TV_VERTICAL_PADDING_DP = 27;
|
||||||
|
private static final int TV_HORIZONTAL_PADDING_DP = 48;
|
||||||
|
|
||||||
|
public static void notifyNewRootView(Activity activity)
|
||||||
|
{
|
||||||
|
View rootView = activity.findViewById(android.R.id.content);
|
||||||
|
UiModeManager modeMgr = (UiModeManager) activity.getSystemService(Context.UI_MODE_SERVICE);
|
||||||
|
|
||||||
|
if (modeMgr.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION)
|
||||||
|
{
|
||||||
|
// Increase view padding on TVs
|
||||||
|
float scale = activity.getResources().getDisplayMetrics().density;
|
||||||
|
int verticalPaddingPixels = (int) (TV_VERTICAL_PADDING_DP*scale + 0.5f);
|
||||||
|
int horizontalPaddingPixels = (int) (TV_HORIZONTAL_PADDING_DP*scale + 0.5f);
|
||||||
|
|
||||||
|
rootView.setPadding(horizontalPaddingPixels, verticalPaddingPixels,
|
||||||
|
horizontalPaddingPixels, verticalPaddingPixels);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -69,9 +69,6 @@ int nv_avc_init(int width, int height, int perf_lvl, int thread_count) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show frames even before a reference frame
|
|
||||||
decoder_ctx->flags2 |= CODEC_FLAG2_SHOW_ALL;
|
|
||||||
|
|
||||||
if (perf_lvl & DISABLE_LOOP_FILTER) {
|
if (perf_lvl & DISABLE_LOOP_FILTER) {
|
||||||
// Skip the loop filter for performance reasons
|
// Skip the loop filter for performance reasons
|
||||||
decoder_ctx->skip_loop_filter = AVDISCARD_ALL;
|
decoder_ctx->skip_loop_filter = AVDISCARD_ALL;
|
||||||
@@ -370,17 +367,20 @@ int nv_avc_decode(unsigned char* indata, int inlen) {
|
|||||||
|
|
||||||
// Only copy the picture at the end of decoding the packet
|
// Only copy the picture at the end of decoding the packet
|
||||||
if (got_pic) {
|
if (got_pic) {
|
||||||
|
// Clone the current decode frame outside of the mutex
|
||||||
|
AVFrame* new_frame = av_frame_clone(dec_frame);
|
||||||
|
AVFrame* old_frame;
|
||||||
|
|
||||||
|
// Swap it in under lock
|
||||||
pthread_mutex_lock(&mutex);
|
pthread_mutex_lock(&mutex);
|
||||||
|
old_frame = yuv_frame;
|
||||||
// Only clone this frame if the last frame was taken.
|
yuv_frame = new_frame;
|
||||||
// This saves on extra copies for frames that don't get
|
|
||||||
// rendered.
|
|
||||||
if (yuv_frame == NULL) {
|
|
||||||
// Clone a new frame
|
|
||||||
yuv_frame = av_frame_clone(dec_frame);
|
|
||||||
}
|
|
||||||
|
|
||||||
pthread_mutex_unlock(&mutex);
|
pthread_mutex_unlock(&mutex);
|
||||||
|
|
||||||
|
// Free the old frame outside of the mutex
|
||||||
|
if (old_frame != NULL) {
|
||||||
|
av_frame_free(&old_frame);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return err < 0 ? err : 0;
|
return err < 0 ? err : 0;
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 40 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
@@ -1,7 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:shape="rectangle" >
|
|
||||||
|
|
||||||
<stroke android:width="1dip" android:color="#ffffff"/>
|
|
||||||
|
|
||||||
</shape>
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
@@ -8,48 +8,69 @@
|
|||||||
android:paddingTop="@dimen/activity_vertical_margin"
|
android:paddingTop="@dimen/activity_vertical_margin"
|
||||||
tools:context=".PcView" >
|
tools:context=".PcView" >
|
||||||
|
|
||||||
<ListView
|
<RelativeLayout
|
||||||
android:id="@+id/pcListView"
|
android:id="@+id/no_pc_found_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_centerHorizontal="true">
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/pcs_loading"
|
||||||
|
android:layout_width="75dp"
|
||||||
|
android:layout_height="75dp"
|
||||||
|
android:src="@drawable/image_loading"/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_toRightOf="@+id/pcs_loading"
|
||||||
|
android:layout_toEndOf="@+id/pcs_loading"
|
||||||
|
android:layout_marginLeft="5dp"
|
||||||
|
android:layout_marginStart="5dp"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/searching_pc"/>
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<GridView
|
||||||
|
android:id="@+id/pcGridView"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:numColumns="auto_fit"
|
||||||
|
android:columnWidth="160dp"
|
||||||
|
android:gravity="center"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:layout_alignParentLeft="true"
|
android:layout_alignParentTop="true"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_toLeftOf="@+id/manuallyAddPc"
|
||||||
android:layout_below="@+id/settingsButton"
|
android:layout_toStartOf="@+id/manuallyAddPc"
|
||||||
android:background="@drawable/list_view_unselected"
|
android:layout_toRightOf="@+id/settingsButton"
|
||||||
android:fastScrollEnabled="true"
|
android:layout_toEndOf="@+id/settingsButton"/>
|
||||||
android:longClickable="false"
|
|
||||||
android:stackFromBottom="false" >
|
|
||||||
|
|
||||||
</ListView>
|
<ImageButton
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/discoveryText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
|
||||||
android:layout_centerHorizontal="true"
|
|
||||||
android:layout_alignBaseline="@+id/settingsButton"
|
|
||||||
android:text="@string/title_pc_view" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/settingsButton"
|
android:id="@+id/settingsButton"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="70dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="65dp"
|
||||||
android:layout_alignLeft="@+id/pcListView"
|
android:cropToPadding="false"
|
||||||
|
android:scaleType="fitXY"
|
||||||
|
android:nextFocusDown="@+id/pcGridView"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
android:layout_marginTop="10dp"
|
android:src="@drawable/settings"
|
||||||
android:layout_marginBottom="15dp"
|
style="?android:attr/borderlessButtonStyle"/>
|
||||||
android:text="@string/button_stream_settings" />
|
|
||||||
|
|
||||||
<Button
|
<ImageButton
|
||||||
android:id="@+id/manuallyAddPc"
|
android:id="@+id/manuallyAddPc"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="70dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="65dp"
|
||||||
android:layout_alignRight="@+id/pcListView"
|
android:cropToPadding="false"
|
||||||
|
android:scaleType="fitXY"
|
||||||
|
android:nextFocusDown="@+id/pcGridView"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_alignParentRight="true"
|
||||||
android:layout_marginBottom="15dp"
|
android:layout_alignParentEnd="true"
|
||||||
android:text="@string/button_add_pc_manually" />
|
android:src="@drawable/add_computer"
|
||||||
|
style="?android:attr/borderlessButtonStyle"/>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
@@ -8,46 +8,67 @@
|
|||||||
android:paddingTop="@dimen/activity_vertical_margin"
|
android:paddingTop="@dimen/activity_vertical_margin"
|
||||||
tools:context=".PcView" >
|
tools:context=".PcView" >
|
||||||
|
|
||||||
<ListView
|
<RelativeLayout
|
||||||
android:id="@+id/pcListView"
|
android:id="@+id/no_pc_found_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_centerHorizontal="true">
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/pcs_loading"
|
||||||
|
android:layout_width="75dp"
|
||||||
|
android:layout_height="75dp"
|
||||||
|
android:src="@drawable/image_loading"/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_toRightOf="@+id/pcs_loading"
|
||||||
|
android:layout_toEndOf="@+id/pcs_loading"
|
||||||
|
android:layout_marginLeft="5dp"
|
||||||
|
android:layout_marginStart="5dp"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/searching_pc"/>
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<GridView
|
||||||
|
android:id="@+id/pcGridView"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:numColumns="auto_fit"
|
||||||
|
android:columnWidth="160dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:layout_toLeftOf="@+id/manuallyAddPc"
|
||||||
|
android:layout_toStartOf="@+id/manuallyAddPc"
|
||||||
|
android:layout_toRightOf="@+id/settingsButton"
|
||||||
|
android:layout_toEndOf="@+id/settingsButton"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:layout_alignParentLeft="true"
|
android:layout_alignParentTop="true"/>
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:layout_below="@+id/discoveryText"
|
|
||||||
android:background="@drawable/list_view_unselected"
|
|
||||||
android:fastScrollEnabled="true"
|
|
||||||
android:longClickable="false"
|
|
||||||
android:stackFromBottom="false" >
|
|
||||||
|
|
||||||
</ListView>
|
<ImageButton
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/discoveryText"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_centerHorizontal="true"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
|
||||||
android:layout_below="@+id/manuallyAddPc"
|
|
||||||
android:paddingTop="10dp"
|
|
||||||
android:paddingBottom="10dp"
|
|
||||||
android:text="@string/title_pc_view" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/settingsButton"
|
android:id="@+id/settingsButton"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="70dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="65dp"
|
||||||
android:layout_centerHorizontal="true"
|
android:cropToPadding="false"
|
||||||
|
android:scaleType="fitXY"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
android:text="@string/button_stream_settings" />
|
android:src="@drawable/settings"
|
||||||
|
style="?android:attr/borderlessButtonStyle"/>
|
||||||
|
|
||||||
<Button
|
<ImageButton
|
||||||
android:id="@+id/manuallyAddPc"
|
android:id="@+id/manuallyAddPc"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="70dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="65dp"
|
||||||
android:layout_below="@+id/settingsButton"
|
android:cropToPadding="false"
|
||||||
android:layout_centerHorizontal="true"
|
android:scaleType="fitXY"
|
||||||
android:text="@string/button_add_pc_manually" />
|
android:layout_alignParentTop="true"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:src="@drawable/add_computer"
|
||||||
|
style="?android:attr/borderlessButtonStyle"/>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
@@ -5,16 +5,28 @@
|
|||||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||||
android:paddingTop="10dp"
|
android:paddingTop="@dimen/activity_vertical_margin"
|
||||||
tools:context=".Connection" >
|
tools:context=".AddComputerManually" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/manuallyAddPcText"
|
||||||
|
android:text="@string/title_add_pc"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
|
android:layout_alignParentTop="true"/>
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/hostTextView"
|
android:id="@+id/hostTextView"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@+id/manuallyAddPcText"
|
||||||
|
android:layout_marginTop="25dp"
|
||||||
android:layout_alignParentLeft="true"
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:ems="10"
|
android:ems="10"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:inputType="textNoSuggestions"
|
android:inputType="textNoSuggestions"
|
||||||
@@ -23,12 +35,4 @@
|
|||||||
<requestFocus />
|
<requestFocus />
|
||||||
</EditText>
|
</EditText>
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/addPc"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@+id/hostTextView"
|
|
||||||
android:layout_centerHorizontal="true"
|
|
||||||
android:text="@string/button_add_pc" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|||||||
@@ -8,28 +8,30 @@
|
|||||||
android:paddingTop="@dimen/activity_vertical_margin"
|
android:paddingTop="@dimen/activity_vertical_margin"
|
||||||
tools:context=".AppView" >
|
tools:context=".AppView" >
|
||||||
|
|
||||||
<ListView
|
<GridView
|
||||||
android:id="@+id/pcListView"
|
android:id="@+id/appGridView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:numColumns="auto_fit"
|
||||||
|
android:columnWidth="160dp"
|
||||||
|
android:stretchMode="spacingWidth"
|
||||||
|
android:gravity="center"
|
||||||
android:layout_alignParentLeft="true"
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:layout_below="@+id/appListText"
|
android:layout_below="@+id/appListText">
|
||||||
android:fastScrollEnabled="true"
|
</GridView>
|
||||||
android:longClickable="false"
|
|
||||||
android:background="@drawable/list_view_unselected"
|
|
||||||
android:stackFromBottom="false">
|
|
||||||
</ListView>
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/appListText"
|
android:id="@+id/appListText"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_centerHorizontal="true"
|
android:layout_centerHorizontal="true"
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
android:paddingTop="0dp"
|
android:paddingTop="0dp"
|
||||||
android:paddingBottom="10dp" />
|
android:paddingBottom="10dp"
|
||||||
|
android:textSize="28sp"/>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="#000"
|
|
||||||
tools:context=".Game" >
|
tools:context=".Game" >
|
||||||
|
|
||||||
<SurfaceView
|
<SurfaceView
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="20dp">
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/grid_image_layout"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/grid_image"
|
||||||
|
android:cropToPadding="false"
|
||||||
|
android:scaleType="fitXY"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_width="150dp"
|
||||||
|
android:layout_height="175dp">
|
||||||
|
</ImageView>
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/grid_overlay"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="50dp">
|
||||||
|
</ImageView>
|
||||||
|
</RelativeLayout>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/grid_text"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/grid_image_layout"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:gravity="center"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:ellipsize="marquee"
|
||||||
|
android:marqueeRepeatLimit="marquee_forever"
|
||||||
|
android:scrollHorizontally="true"
|
||||||
|
android:textSize="18sp" >
|
||||||
|
</TextView>
|
||||||
|
</RelativeLayout>
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="20dp">
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/grid_image_layout"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/grid_image"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_width="150dp"
|
||||||
|
android:layout_height="100dp">
|
||||||
|
</ImageView>
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/grid_overlay"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:layout_marginLeft="65dp"
|
||||||
|
android:layout_marginStart="65dp"
|
||||||
|
android:layout_marginRight="20dp"
|
||||||
|
android:layout_marginEnd="20dp"
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="50dp">
|
||||||
|
</ImageView>
|
||||||
|
</RelativeLayout>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/grid_text"
|
||||||
|
android:layout_width="150dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/grid_image_layout"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textSize="18sp" >
|
||||||
|
</TextView>
|
||||||
|
</RelativeLayout>
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:padding="10dp"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/rowTextView"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textIsSelectable="false"
|
|
||||||
android:textSize="16sp" >
|
|
||||||
</TextView>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string-array name="resolution_names">
|
||||||
|
<item>720p - 30 FPS</item>
|
||||||
|
<item>720p - 60 FPS</item>
|
||||||
|
<item>1080p - 30 FPS</item>
|
||||||
|
<item>1080p - 60 FPS</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="decoder_names">
|
||||||
|
<item>Scegli decoder automaticamente</item>
|
||||||
|
<item>Forza decoder software</item>
|
||||||
|
<item>Forza decoder hardware</item>
|
||||||
|
</string-array>
|
||||||
|
</resources>
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
|
||||||
|
<!-- PC view menu entries -->
|
||||||
|
<string name="pcview_menu_app_list">Lista applicazioni</string>
|
||||||
|
<string name="pcview_menu_pair_pc">Accoppia PC</string>
|
||||||
|
<string name="pcview_menu_unpair_pc">Disaccoppia PC</string>
|
||||||
|
<string name="pcview_menu_send_wol">Invia richiesta Wake-On-LAN</string>
|
||||||
|
<string name="pcview_menu_delete_pc">Rimuovi PC</string>
|
||||||
|
|
||||||
|
<!-- Pair messages -->
|
||||||
|
<string name="pairing">Accoppiamento…</string>
|
||||||
|
<string name="pair_pc_offline">PC offline</string>
|
||||||
|
<string name="pair_pc_ingame">PC con applicazione avviata. Devi chiudere l\'applicazione prima dell\'accoppiamento.</string>
|
||||||
|
<string name="pair_pairing_title">Accoppiamento</string>
|
||||||
|
<string name="pair_pairing_msg">Inserisci il seguente PIN sul PC:</string>
|
||||||
|
<string name="pair_incorrect_pin">PIN non corretto</string>
|
||||||
|
<string name="pair_fail">Accoppiamento fallito</string>
|
||||||
|
|
||||||
|
<!-- WOL messages -->
|
||||||
|
<string name="wol_pc_online">PC già avviato</string>
|
||||||
|
<string name="wol_no_mac">Impossibile risvegliare il PC perchè GFE non ha inviato nessun indirizzo MAC</string>
|
||||||
|
<string name="wol_waking_pc">Risveglio PC…</string>
|
||||||
|
<string name="wol_waking_msg">Il PC potrebbe impiegare qualche secondo per risvegliarsi.
|
||||||
|
Se non succede niente, assicurati che l\'opzione Wake-On-LAN sia configurata correttamente.
|
||||||
|
</string>
|
||||||
|
<string name="wol_fail">Invio pacchetto Wake-On-LAN fallito</string>
|
||||||
|
|
||||||
|
<!-- Unpair messages -->
|
||||||
|
<string name="unpairing">Disaccoppiamento…</string>
|
||||||
|
<string name="unpair_success">Disaccoppiato con successo</string>
|
||||||
|
<string name="unpair_fail">Disaccoppiamento fallito</string>
|
||||||
|
<string name="unpair_error">PC non accoppiato</string>
|
||||||
|
|
||||||
|
<!-- Errors -->
|
||||||
|
<string name="error_pc_offline">PC offline</string>
|
||||||
|
<string name="error_manager_not_running">Il servizio ComputerManager non è avviato. Attendi qualche secondo o riavvia l\'applicazione.</string>
|
||||||
|
<string name="error_unknown_host">Risoluzione nome host fallita</string>
|
||||||
|
<string name="error_404">GFE ha ritornato un errore HTTP 404 error. Assicurati che il PC stia usando una GPU supportata.
|
||||||
|
Usare un software di remote-desktop può causare questo errore. Prova a riavviare il PC o a reinstallare GFE.
|
||||||
|
</string>
|
||||||
|
|
||||||
|
<!-- Start application messages -->
|
||||||
|
<string name="conn_establishing_title">Connessione</string>
|
||||||
|
<string name="conn_establishing_msg">Connessione in corso</string>
|
||||||
|
<string name="conn_metered">Attenzione: la rete attiva prevede costi aggiuntivi in base all\'utilizzo!</string>
|
||||||
|
<string name="conn_client_latency">Latenza frame media client-side:</string>
|
||||||
|
<string name="conn_client_latency_hw">latenza decoder hardware:</string>
|
||||||
|
<string name="conn_hardware_latency">Latenza decoder hardware media:</string>
|
||||||
|
<string name="conn_starting">Avvio in corso…</string>
|
||||||
|
<string name="conn_error_title">Errore connessione</string>
|
||||||
|
<string name="conn_error_msg">Avvio fallito</string>
|
||||||
|
<string name="conn_terminated_title">Connessione terminata</string>
|
||||||
|
<string name="conn_terminated_msg">La connessione è stata interrotta</string>
|
||||||
|
|
||||||
|
<!-- General strings -->
|
||||||
|
<string name="ip_hint">Indirizzo IP del PC</string>
|
||||||
|
<string name="searching_pc">Ricerca PC in corso…</string>
|
||||||
|
|
||||||
|
<!-- AppList activity -->
|
||||||
|
<string name="title_applist">Applicazioni su</string>
|
||||||
|
<string name="applist_menu_resume">Riprendi Sessione</string>
|
||||||
|
<string name="applist_menu_quit">Chiudi Sessione</string>
|
||||||
|
<string name="applist_menu_quit_and_start">Chiudi sessione corrente e avvia</string>
|
||||||
|
<string name="applist_menu_cancel">Annulla</string>
|
||||||
|
<string name="applist_refresh_title">Lista applicazioni</string>
|
||||||
|
<string name="applist_refresh_msg">Aggiornamento lista in corso…</string>
|
||||||
|
<string name="applist_refresh_error_title">Errore</string>
|
||||||
|
<string name="applist_refresh_error_msg">Ricezione lista applicazioni fallita</string>
|
||||||
|
<string name="applist_quit_app">Chiusura in corso…</string>
|
||||||
|
<string name="applist_quit_success">Sessione chiusa con successo</string>
|
||||||
|
<string name="applist_quit_fail">Chiusura sessione fallita</string>
|
||||||
|
|
||||||
|
<!-- Add computer manually activity -->
|
||||||
|
<string name="title_add_pc">Aggiungi PC Manualmente</string>
|
||||||
|
<string name="msg_add_pc">Connessione al PC in corso…</string>
|
||||||
|
<string name="addpc_fail">Impossibile connettersi al PC. Assicurati che il firewall del PC sia configurato correttamente.</string>
|
||||||
|
<string name="addpc_success">PC aggiunto con successo</string>
|
||||||
|
<string name="addpc_unknown_host">Impossibile risovere l\'indirizzo del PC. Assicurati di aver scritto correttamente l\'indirizzo.</string>
|
||||||
|
<string name="addpc_enter_ip">Devi inserire un indirizzo IP</string>
|
||||||
|
|
||||||
|
<!-- Preferences -->
|
||||||
|
<string name="category_basic_settings">Impostazioni Base</string>
|
||||||
|
<string name="title_resolution_list">Risoluzione e FPS</string>
|
||||||
|
<string name="summary_resolution_list">Valori troppo elevati possono causare lag o crash</string>
|
||||||
|
<string name="title_seekbar_bitrate">Bitrate video</string>
|
||||||
|
<string name="summary_seekbar_bitrate">Abbassa il bitrate per ridurre lo stuttering; alza il bitrate per aumenteare la qualità dell\'immagine</string>
|
||||||
|
<string name="suffix_seekbar_bitrate">Mbps</string>
|
||||||
|
<string name="title_checkbox_stretch_video">Forza video in full-screen</string>
|
||||||
|
<string name="title_checkbox_disable_warnings">Disabilita messaggi di warning</string>
|
||||||
|
<string name="summary_checkbox_disable_warnings">Disabilita i messaggi di warning sullo schermo durante lo streaming</string>
|
||||||
|
|
||||||
|
<string name="category_gamepad_settings">Impostazioni Gamepad</string>
|
||||||
|
<string name="title_seekbar_deadzone">Aggiusta deadzone degli stick analogici</string>
|
||||||
|
<string name="suffix_seekbar_deadzone">%</string>
|
||||||
|
|
||||||
|
<string name="category_host_settings">Impostazioni Host</string>
|
||||||
|
<string name="title_checkbox_enable_sops">Ottimizza le impostazioni dei giochi</string>
|
||||||
|
<string name="summary_checkbox_enable_sops">Permetti a GFE di modificare le impostazioni dei giochi per uno streaming ottimale</string>
|
||||||
|
<string name="title_checkbox_host_audio">Riproduci audio sul PC</string>
|
||||||
|
<string name="summary_checkbox_host_audio">Riproduci l\'audio sul computer e su questo dispositivo. Richiede GFE 2.1.2+</string>
|
||||||
|
|
||||||
|
<string name="category_advanced_settings">Impostazioni Avanzate</string>
|
||||||
|
<string name="title_decoder_list">Cambia decoder</string>
|
||||||
|
<string name="summary_decoder_list">Il decoder software può ridurre la latenza video quando si usano impostazioni streaming basse</string>
|
||||||
|
</resources>
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
<resources>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Customize dimensions originally defined in res/values/dimens.xml (such as
|
|
||||||
screen margins) for sw600dp devices (e.g. 7" tablets) here.
|
|
||||||
-->
|
|
||||||
|
|
||||||
</resources>
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
<resources>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Customize dimensions originally defined in res/values/dimens.xml (such as
|
|
||||||
screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
|
|
||||||
-->
|
|
||||||
<dimen name="activity_horizontal_margin">128dp</dimen>
|
|
||||||
|
|
||||||
</resources>
|
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
<!--
|
<!--
|
||||||
Base application theme for API 21+. This theme completely replaces
|
Base application theme for API 21+. This theme completely replaces
|
||||||
AppBaseTheme from BOTH res/values/styles.xml and
|
AppBaseTheme from BOTH res/values/styles.xml and
|
||||||
res/values-v11/styles.xml on API 21+ devices.
|
res/values-v21/styles.xml on API 21+ devices.
|
||||||
-->
|
-->
|
||||||
<style name="AppBaseTheme" parent="android:Theme.Material">
|
<style name="AppBaseTheme" parent="android:Theme.Material">
|
||||||
<!-- API 21 theme customizations can go here. -->
|
<!-- API 21 theme customizations can go here. -->
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<item>1080p 30 FPS</item>
|
<item>1080p 30 FPS</item>
|
||||||
<item>1080p 60 FPS</item>
|
<item>1080p 60 FPS</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
<string-array name="resolution_values">
|
<string-array name="resolution_values" translatable="false">
|
||||||
<item>720p30</item>
|
<item>720p30</item>
|
||||||
<item>720p60</item>
|
<item>720p60</item>
|
||||||
<item>1080p30</item>
|
<item>1080p30</item>
|
||||||
@@ -14,13 +14,13 @@
|
|||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="decoder_names">
|
<string-array name="decoder_names">
|
||||||
<item>Force Software Decoding</item>
|
|
||||||
<item>Auto-select Decoder</item>
|
<item>Auto-select Decoder</item>
|
||||||
|
<item>Force Software Decoding</item>
|
||||||
<item>Force Hardware Decoding</item>
|
<item>Force Hardware Decoding</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
<string-array name="decoder_values">
|
<string-array name="decoder_values" translatable="false">
|
||||||
<item>software</item>
|
|
||||||
<item>auto</item>
|
<item>auto</item>
|
||||||
|
<item>software</item>
|
||||||
<item>hardware</item>
|
<item>hardware</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
<resources>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Declare custom theme attributes that allow changing which styles are
|
|
||||||
used for button bars depending on the API level.
|
|
||||||
?android:attr/buttonBarStyle is new as of API 11 so this is
|
|
||||||
necessary to support previous API levels.
|
|
||||||
-->
|
|
||||||
<declare-styleable name="ButtonBarContainerTheme">
|
|
||||||
<attr name="buttonBarStyle" format="reference" />
|
|
||||||
<attr name="buttonBarButtonStyle" format="reference" />
|
|
||||||
</declare-styleable>
|
|
||||||
|
|
||||||
</resources>
|
|
||||||
@@ -1,16 +1,83 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
|
<!-- PC view menu entries -->
|
||||||
|
<string name="pcview_menu_app_list">View Game List</string>
|
||||||
|
<string name="pcview_menu_pair_pc">Pair with PC</string>
|
||||||
|
<string name="pcview_menu_unpair_pc">Unpair</string>
|
||||||
|
<string name="pcview_menu_send_wol">Send Wake-On-LAN request</string>
|
||||||
|
<string name="pcview_menu_delete_pc">Delete PC</string>
|
||||||
|
|
||||||
|
<!-- Pair messages -->
|
||||||
|
<string name="pairing">Pairing…</string>
|
||||||
|
<string name="pair_pc_offline">Computer is offline</string>
|
||||||
|
<string name="pair_pc_ingame">Computer is currently in a game. You must close the game before pairing.</string>
|
||||||
|
<string name="pair_pairing_title">Pairing</string>
|
||||||
|
<string name="pair_pairing_msg">Please enter the following PIN on the target PC:</string>
|
||||||
|
<string name="pair_incorrect_pin">Incorrect PIN</string>
|
||||||
|
<string name="pair_fail">Pairing failed</string>
|
||||||
|
|
||||||
|
<!-- WOL messages -->
|
||||||
|
<string name="wol_pc_online">Computer is online</string>
|
||||||
|
<string name="wol_no_mac">Unable to wake PC because GFE didn\'t send a MAC address</string>
|
||||||
|
<string name="wol_waking_pc">Waking PC…</string>
|
||||||
|
<string name="wol_waking_msg">It may take a few seconds for your PC to wake up.
|
||||||
|
If it doesn\'t, make sure it\'s configured properly for Wake-On-LAN.
|
||||||
|
</string>
|
||||||
|
<string name="wol_fail">Failed to send Wake-On-LAN packets</string>
|
||||||
|
|
||||||
|
<!-- Unpair messages -->
|
||||||
|
<string name="unpairing">Unpairing…</string>
|
||||||
|
<string name="unpair_success">Unpaired successfully</string>
|
||||||
|
<string name="unpair_fail">Failed to unpair</string>
|
||||||
|
<string name="unpair_error">Device was not paired</string>
|
||||||
|
|
||||||
|
<!-- Errors -->
|
||||||
|
<string name="error_pc_offline">Computer is offline</string>
|
||||||
|
<string name="error_manager_not_running">The ComputerManager service is not running. Please wait a few seconds or restart the app.</string>
|
||||||
|
<string name="error_unknown_host">Failed to resolve host</string>
|
||||||
|
<string name="error_404">GFE returned an HTTP 404 error. Make sure your PC is running a supported GPU.
|
||||||
|
Using remote desktop software can also cause this error. Try rebooting your machine or reinstalling GFE.
|
||||||
|
</string>
|
||||||
|
|
||||||
|
<!-- Start application messages -->
|
||||||
|
<string name="conn_establishing_title">Establishing Connection</string>
|
||||||
|
<string name="conn_establishing_msg">Starting connection</string>
|
||||||
|
<string name="conn_metered">Warning: Your active network connection is metered!</string>
|
||||||
|
<string name="conn_client_latency">Average client-side frame latency:</string>
|
||||||
|
<string name="conn_client_latency_hw">hardware decoder latency:</string>
|
||||||
|
<string name="conn_hardware_latency">Average hardware decoder latency:</string>
|
||||||
|
<string name="conn_starting">Starting</string>
|
||||||
|
<string name="conn_error_title">Connection Error</string>
|
||||||
|
<string name="conn_error_msg">Failed to start</string>
|
||||||
|
<string name="conn_terminated_title">Connection Terminated</string>
|
||||||
|
<string name="conn_terminated_msg">The connection was terminated</string>
|
||||||
|
|
||||||
<!-- General strings -->
|
<!-- General strings -->
|
||||||
<string name="ip_hint">IP address of GeForce PC</string>
|
<string name="ip_hint">IP address of GeForce PC</string>
|
||||||
|
<string name="searching_pc">Searching for PCs…</string>
|
||||||
|
|
||||||
<!-- PC view activity -->
|
<!-- AppList activity -->
|
||||||
<string name="title_pc_view">PC List</string>
|
<string name="title_applist">Apps on</string>
|
||||||
<string name="button_stream_settings">Streaming Settings</string>
|
<string name="applist_menu_resume">Resume Session</string>
|
||||||
<string name="button_add_pc_manually">Add PC Manually</string>
|
<string name="applist_menu_quit">Quit Session</string>
|
||||||
|
<string name="applist_menu_quit_and_start">Quit Current Game and Start</string>
|
||||||
|
<string name="applist_menu_cancel">Cancel</string>
|
||||||
|
<string name="applist_refresh_title">App List</string>
|
||||||
|
<string name="applist_refresh_msg">Refreshing apps…</string>
|
||||||
|
<string name="applist_refresh_error_title">Error</string>
|
||||||
|
<string name="applist_refresh_error_msg">Failed to get app list</string>
|
||||||
|
<string name="applist_quit_app">Quitting</string>
|
||||||
|
<string name="applist_quit_success">Successfully quit</string>
|
||||||
|
<string name="applist_quit_fail">Failed to quit</string>
|
||||||
|
|
||||||
<!-- Add computer manually activity -->
|
<!-- Add computer manually activity -->
|
||||||
<string name="button_add_pc">Manually Add PC</string>
|
<string name="title_add_pc">Add PC Manually</string>
|
||||||
|
<string name="msg_add_pc">Connecting to the PC…</string>
|
||||||
|
<string name="addpc_fail">Unable to connect to the specified computer. Make sure the required ports are allowed through the firewall.</string>
|
||||||
|
<string name="addpc_success">Successfully added computer</string>
|
||||||
|
<string name="addpc_unknown_host">Unable to resolve PC address. Make sure you didn\'t make a typo in the address.</string>
|
||||||
|
<string name="addpc_enter_ip">You must enter an IP address</string>
|
||||||
|
|
||||||
<!-- Preferences -->
|
<!-- Preferences -->
|
||||||
<string name="category_basic_settings">Basic Settings</string>
|
<string name="category_basic_settings">Basic Settings</string>
|
||||||
@@ -23,6 +90,10 @@
|
|||||||
<string name="title_checkbox_disable_warnings">Disable warning messages</string>
|
<string name="title_checkbox_disable_warnings">Disable warning messages</string>
|
||||||
<string name="summary_checkbox_disable_warnings">Disable on-screen connection warning messages while streaming</string>
|
<string name="summary_checkbox_disable_warnings">Disable on-screen connection warning messages while streaming</string>
|
||||||
|
|
||||||
|
<string name="category_gamepad_settings">Gamepad Settings</string>
|
||||||
|
<string name="title_seekbar_deadzone">Adjust analog stick deadzone</string>
|
||||||
|
<string name="suffix_seekbar_deadzone">%</string>
|
||||||
|
|
||||||
<string name="category_host_settings">Host Settings</string>
|
<string name="category_host_settings">Host Settings</string>
|
||||||
<string name="title_checkbox_enable_sops">Optimize game settings</string>
|
<string name="title_checkbox_enable_sops">Optimize game settings</string>
|
||||||
<string name="summary_checkbox_enable_sops">Allow GFE to modify game settings for optimal streaming</string>
|
<string name="summary_checkbox_enable_sops">Allow GFE to modify game settings for optimal streaming</string>
|
||||||
@@ -31,4 +102,5 @@
|
|||||||
|
|
||||||
<string name="category_advanced_settings">Advanced Settings</string>
|
<string name="category_advanced_settings">Advanced Settings</string>
|
||||||
<string name="title_decoder_list">Change decoder</string>
|
<string name="title_decoder_list">Change decoder</string>
|
||||||
|
<string name="summary_decoder_list">Software decoding may improve video latency at lower streaming settings</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -4,12 +4,14 @@
|
|||||||
<!--
|
<!--
|
||||||
Base application theme, dependent on API level. This theme is replaced
|
Base application theme, dependent on API level. This theme is replaced
|
||||||
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
|
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<style name="AppBaseTheme" parent="android:Theme">
|
<style name="AppBaseTheme" parent="android:Theme">
|
||||||
<!--
|
<!--
|
||||||
Theme customizations available in newer API levels can go in
|
Theme customizations available in newer API levels can go in
|
||||||
res/values-vXX/styles.xml, while customizations related to
|
res/values-vXX/styles.xml, while customizations related to
|
||||||
backward-compatibility can go here.
|
backward-compatibility can go here.
|
||||||
|
|
||||||
-->
|
-->
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
@@ -20,21 +22,14 @@
|
|||||||
<item name="android:windowNoTitle">true</item>
|
<item name="android:windowNoTitle">true</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
</style>
|
<!-- Stream activity theme -->
|
||||||
|
<style name="StreamTheme" parent="AppBaseTheme">
|
||||||
<style name="FullscreenTheme" parent="android:Theme.NoTitleBar">
|
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
|
||||||
<item name="android:windowContentOverlay">@null</item>
|
<item name="android:windowActionBar">false</item>
|
||||||
<item name="android:windowBackground">@null</item>
|
<item name="android:windowNoTitle">true</item>
|
||||||
<item name="buttonBarStyle">@style/ButtonBar</item>
|
|
||||||
|
|
||||||
</style>
|
<!-- Transparent streaming background to avoid extra overdraw -->
|
||||||
|
<item name="android:windowBackground">@android:color/transparent</item>
|
||||||
<style name="ButtonBar">
|
|
||||||
<item name="android:paddingLeft">2dp</item>
|
|
||||||
<item name="android:paddingTop">5dp</item>
|
|
||||||
<item name="android:paddingRight">2dp</item>
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
</style>
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -26,6 +26,14 @@
|
|||||||
android:summary="@string/summary_checkbox_disable_warnings"
|
android:summary="@string/summary_checkbox_disable_warnings"
|
||||||
android:defaultValue="false" />
|
android:defaultValue="false" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
<!--PreferenceCategory android:title="@string/category_gamepad_settings">
|
||||||
|
<com.limelight.preferences.SeekBarPreference
|
||||||
|
android:key="seekbar_deadzone"
|
||||||
|
android:defaultValue="15"
|
||||||
|
android:max="50"
|
||||||
|
android:text="@string/suffix_seekbar_deadzone"
|
||||||
|
android:title="@string/title_seekbar_deadzone"/>
|
||||||
|
</PreferenceCategory-->
|
||||||
<PreferenceCategory android:title="@string/category_host_settings">
|
<PreferenceCategory android:title="@string/category_host_settings">
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:key="checkbox_enable_sops"
|
android:key="checkbox_enable_sops"
|
||||||
@@ -44,6 +52,7 @@
|
|||||||
android:title="@string/title_decoder_list"
|
android:title="@string/title_decoder_list"
|
||||||
android:entries="@array/decoder_names"
|
android:entries="@array/decoder_names"
|
||||||
android:entryValues="@array/decoder_values"
|
android:entryValues="@array/decoder_values"
|
||||||
|
android:summary="@string/summary_decoder_list"
|
||||||
android:defaultValue="auto" />
|
android:defaultValue="auto" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
|||||||
+8
-2
@@ -4,12 +4,12 @@ This file serves to document some of the decoder errata when using MediaCodec ha
|
|||||||
- Affected decoders: TI OMAP4, Allwinner A20
|
- Affected decoders: TI OMAP4, Allwinner A20
|
||||||
|
|
||||||
2. Some decoders have a huge per-frame latency with the unmodified SPS sent from NVENC. Setting max_dec_frame_buffering fixes this latency issue.
|
2. Some decoders have a huge per-frame latency with the unmodified SPS sent from NVENC. Setting max_dec_frame_buffering fixes this latency issue.
|
||||||
- Affected decoders: NVIDIA Tegra 3 and 4
|
- Affected decoders: NVIDIA Tegra 3 and 4, Broadcom VideoCore IV
|
||||||
|
|
||||||
3. Some decoders strictly require that you pass BUFFER_FLAG_CODEC_CONFIG and crash upon the IDR frame if you don't
|
3. Some decoders strictly require that you pass BUFFER_FLAG_CODEC_CONFIG and crash upon the IDR frame if you don't
|
||||||
- Affected decoders: TI OMAP4
|
- Affected decoders: TI OMAP4
|
||||||
|
|
||||||
4. Some decoders require num_ref_frames=1 and max_dec_frame_buffering=1 to avoid crashing on SPS or first I-frame
|
4. Some decoders require num_ref_frames=1 and max_dec_frame_buffering=1 to avoid crashing on SPS on first I-frame
|
||||||
- Affected decoders: Qualcomm in GS3 on 4.3+, Exynos 4 at 1080p only
|
- Affected decoders: Qualcomm in GS3 on 4.3+, Exynos 4 at 1080p only
|
||||||
|
|
||||||
5. Some decoders will hang if max_dec_frame_buffering is not present
|
5. Some decoders will hang if max_dec_frame_buffering is not present
|
||||||
@@ -17,3 +17,9 @@ This file serves to document some of the decoder errata when using MediaCodec ha
|
|||||||
|
|
||||||
6. Some decoders will hang if max_dec_frame_buffering IS present
|
6. Some decoders will hang if max_dec_frame_buffering IS present
|
||||||
- Affected decoders: Exynos 5 in Galaxy Note 10.1 (2014)
|
- Affected decoders: Exynos 5 in Galaxy Note 10.1 (2014)
|
||||||
|
|
||||||
|
7. Some decoders will not enter low latency mode if adaptive playback is enabled
|
||||||
|
- Affected decoders: Intel decoder in Nexus Player
|
||||||
|
|
||||||
|
8. Some decoders will not enter low latency mode if the profile isn't baseline in the first SPS.
|
||||||
|
- Affected decoders: Intel decoder in Nexus Player
|
||||||
Reference in New Issue
Block a user