调整USB和网络摄像头的控制

main
Matthew 4 months ago
parent 9f31e79605
commit 5d169817d9

@ -649,6 +649,7 @@ public class DeviceActivity extends AppCompatActivity {
int rotation = -1; int rotation = -1;
int usb = 0; int usb = 0;
int netCamera = 0;
Integer chVal = Integer.valueOf(channel); Integer chVal = Integer.valueOf(channel);
if (mChannelCfgs.containsKey(chVal)) { if (mChannelCfgs.containsKey(chVal)) {
JSONObject jsonChannel = mChannelCfgs.get(chVal); JSONObject jsonChannel = mChannelCfgs.get(chVal);
@ -658,7 +659,9 @@ public class DeviceActivity extends AppCompatActivity {
if (orientation > 0) { if (orientation > 0) {
rotation = (orientation - 1) * 90; rotation = (orientation - 1) * 90;
} }
usb = jsonChannel.optInt("usbCamera", 0); int cameraType = jsonChannel.optInt("cameraType", 0);
usb = (cameraType == 1) ? 1 : 0;
netCamera = (cameraType == 2 || cameraType == 4) ? 1 : 0;
} }
} }
@ -669,6 +672,7 @@ public class DeviceActivity extends AppCompatActivity {
intent.putExtra("cameraId", cameraId); intent.putExtra("cameraId", cameraId);
intent.putExtra("channel", channel); intent.putExtra("channel", channel);
intent.putExtra("rotation", rotation); intent.putExtra("rotation", rotation);
intent.putExtra("netCamera", netCamera);
intent.putExtra("usb", usb); intent.putExtra("usb", usb);
intent.putExtra("cmdid", TextUtils.isEmpty(mAppConfig.cmdid) ? "" : mAppConfig.cmdid); intent.putExtra("cmdid", TextUtils.isEmpty(mAppConfig.cmdid) ? "" : mAppConfig.cmdid);
// intent.putExtra("info", info); // intent.putExtra("info", info);

@ -61,13 +61,18 @@ public class StreamActivity extends AppCompatActivity {
int cameraId = intent.getIntExtra("cameraId", 0); int cameraId = intent.getIntExtra("cameraId", 0);
int channel = intent.getIntExtra("channel", 1); int channel = intent.getIntExtra("channel", 1);
int rotation = intent.getIntExtra("rotation", -1); int rotation = intent.getIntExtra("rotation", -1);
int netCamera = intent.getIntExtra("netCamera", 0);
actionBar.setTitle(getResources().getString(R.string.channel) + Integer.toString(channel)); actionBar.setTitle(getResources().getString(R.string.channel) + Integer.toString(channel));
String url = "rtmp://" + mDeviceIp + "/live/0"; String url = "rtmp://" + mDeviceIp + "/live/0";
String cmd = "am start -n com.xypower.mplive/com.xypower.mplive.MainActivity --ei cameraId " + Integer.toString(cameraId) + " --ei rotation " String cmd = "am start -n com.xypower.mplive/com.xypower.mplive.MainActivity"
+ Integer.toString(rotation) + " --ei autoStart 1 --es url \"" + url + "\""; + " --ei cameraId " + Integer.toString(cameraId)
+ " --ei rotation " + Integer.toString(rotation)
+ " --ei netCamera " + Integer.toString(netCamera)
+ " --ei autoStart 1"
+ " --es url \"" + url + "\"";
Runnable runnable = new Runnable() { Runnable runnable = new Runnable() {
@Override @Override

Loading…
Cancel
Save