Compare commits
10 Commits
master
...
list_camer
Author | SHA1 | Date | |
---|---|---|---|
|
5387644160 | ||
|
2f44da76f4 | ||
|
95c4f03c1b | ||
|
fb47b87eeb | ||
|
dc2fcc46f5 | ||
|
69264703b1 | ||
|
ec4e826976 | ||
|
17e205e54f | ||
|
f751274b17 | ||
|
6469054b15 |
12
.github/workflows/release.yml
vendored
12
.github/workflows/release.yml
vendored
@ -74,6 +74,7 @@ jobs:
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y meson ninja-build nasm ffmpeg libsdl2-2.0-0 \
|
||||
libsdl2-dev libavcodec-dev libavdevice-dev libavformat-dev \
|
||||
libavutil-dev libswresample-dev libusb-1.0-0 libusb-1.0-0-dev \
|
||||
@ -83,7 +84,7 @@ jobs:
|
||||
run: release/test_client.sh
|
||||
|
||||
build-linux-x86_64:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Check architecture
|
||||
run: |
|
||||
@ -99,6 +100,7 @@ jobs:
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y meson ninja-build nasm ffmpeg libsdl2-2.0-0 \
|
||||
libsdl2-dev libavcodec-dev libavdevice-dev libavformat-dev \
|
||||
libavutil-dev libswresample-dev libusb-1.0-0 libusb-1.0-0-dev \
|
||||
@ -129,14 +131,12 @@ jobs:
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y meson ninja-build nasm ffmpeg libsdl2-2.0-0 \
|
||||
libsdl2-dev libavcodec-dev libavdevice-dev libavformat-dev \
|
||||
libavutil-dev libswresample-dev libusb-1.0-0 libusb-1.0-0-dev \
|
||||
mingw-w64 mingw-w64-tools libz-mingw-w64-dev
|
||||
|
||||
- name: Workaround for old meson version run by Github Actions
|
||||
run: sed -i 's/^pkg-config/pkgconfig/' cross_win32.txt
|
||||
|
||||
- name: Build
|
||||
run: release/build_windows.sh 32
|
||||
|
||||
@ -162,14 +162,12 @@ jobs:
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y meson ninja-build nasm ffmpeg libsdl2-2.0-0 \
|
||||
libsdl2-dev libavcodec-dev libavdevice-dev libavformat-dev \
|
||||
libavutil-dev libswresample-dev libusb-1.0-0 libusb-1.0-0-dev \
|
||||
mingw-w64 mingw-w64-tools libz-mingw-w64-dev
|
||||
|
||||
- name: Workaround for old meson version run by Github Actions
|
||||
run: sed -i 's/^pkg-config/pkgconfig/' cross_win64.txt
|
||||
|
||||
- name: Build
|
||||
run: release/build_windows.sh 64
|
||||
|
||||
|
@ -192,19 +192,19 @@ datadir = get_option('datadir') # by default 'share'
|
||||
install_man('scrcpy.1')
|
||||
install_data('data/icon.png',
|
||||
rename: 'scrcpy.png',
|
||||
install_dir: join_paths(datadir, 'icons/hicolor/256x256/apps'))
|
||||
install_dir: datadir / 'icons/hicolor/256x256/apps')
|
||||
install_data('data/zsh-completion/_scrcpy',
|
||||
install_dir: join_paths(datadir, 'zsh/site-functions'))
|
||||
install_dir: datadir / 'zsh/site-functions')
|
||||
install_data('data/bash-completion/scrcpy',
|
||||
install_dir: join_paths(datadir, 'bash-completion/completions'))
|
||||
install_dir: datadir / 'bash-completion/completions')
|
||||
|
||||
# Desktop entry file for application launchers
|
||||
if host_machine.system() == 'linux'
|
||||
# Install a launcher (ex: /usr/local/share/applications/scrcpy.desktop)
|
||||
install_data('data/scrcpy.desktop',
|
||||
install_dir: join_paths(datadir, 'applications'))
|
||||
install_dir: datadir / 'applications')
|
||||
install_data('data/scrcpy-console.desktop',
|
||||
install_dir: join_paths(datadir, 'applications'))
|
||||
install_dir: datadir / 'applications')
|
||||
endif
|
||||
|
||||
|
||||
@ -279,3 +279,9 @@ if get_option('buildtype') == 'debug'
|
||||
test(t[0], exe)
|
||||
endforeach
|
||||
endif
|
||||
|
||||
if meson.version().version_compare('>= 0.58.0')
|
||||
devenv = environment()
|
||||
devenv.set('SCRCPY_ICON_PATH', meson.current_source_dir() / 'data/icon.png')
|
||||
meson.add_devenv(devenv)
|
||||
endif
|
||||
|
@ -5,7 +5,7 @@ sc_pipe_read_intr(struct sc_intr *intr, sc_pid pid, sc_pipe pipe, char *data,
|
||||
size_t len) {
|
||||
if (intr && !sc_intr_set_process(intr, pid)) {
|
||||
// Already interrupted
|
||||
return false;
|
||||
return -1;
|
||||
}
|
||||
|
||||
ssize_t ret = sc_pipe_read(pipe, data, len);
|
||||
@ -22,7 +22,7 @@ sc_pipe_read_all_intr(struct sc_intr *intr, sc_pid pid, sc_pipe pipe,
|
||||
char *data, size_t len) {
|
||||
if (intr && !sc_intr_set_process(intr, pid)) {
|
||||
// Already interrupted
|
||||
return false;
|
||||
return -1;
|
||||
}
|
||||
|
||||
ssize_t ret = sc_pipe_read_all(pipe, data, len);
|
||||
|
@ -7,6 +7,8 @@ cpp = 'i686-w64-mingw32-g++'
|
||||
ar = 'i686-w64-mingw32-ar'
|
||||
strip = 'i686-w64-mingw32-strip'
|
||||
pkg-config = 'i686-w64-mingw32-pkg-config'
|
||||
# backward compatibility
|
||||
pkgconfig = 'i686-w64-mingw32-pkg-config'
|
||||
windres = 'i686-w64-mingw32-windres'
|
||||
|
||||
[host_machine]
|
||||
|
@ -7,6 +7,8 @@ cpp = 'x86_64-w64-mingw32-g++'
|
||||
ar = 'x86_64-w64-mingw32-ar'
|
||||
strip = 'x86_64-w64-mingw32-strip'
|
||||
pkg-config = 'x86_64-w64-mingw32-pkg-config'
|
||||
# backward compatibility
|
||||
pkgconfig = 'x86_64-w64-mingw32-pkg-config'
|
||||
windres = 'x86_64-w64-mingw32-windres'
|
||||
|
||||
[host_machine]
|
||||
|
@ -1,6 +1,6 @@
|
||||
project('scrcpy', 'c',
|
||||
version: '3.1',
|
||||
meson_version: '>= 0.48',
|
||||
meson_version: '>= 0.49',
|
||||
default_options: [
|
||||
'c_std=c11',
|
||||
'warning_level=2',
|
||||
|
@ -23,3 +23,9 @@ else
|
||||
install: true,
|
||||
install_dir: 'share/scrcpy')
|
||||
endif
|
||||
|
||||
if meson.version().version_compare('>= 0.58.0')
|
||||
devenv = environment()
|
||||
devenv.set('SCRCPY_SERVER_PATH', meson.current_build_dir() / 'scrcpy-server')
|
||||
meson.add_devenv(devenv)
|
||||
endif
|
||||
|
@ -42,6 +42,11 @@ public final class Workarounds {
|
||||
Field sCurrentActivityThreadField = ACTIVITY_THREAD_CLASS.getDeclaredField("sCurrentActivityThread");
|
||||
sCurrentActivityThreadField.setAccessible(true);
|
||||
sCurrentActivityThreadField.set(null, ACTIVITY_THREAD);
|
||||
|
||||
// activityThread.mSystemThread = true;
|
||||
Field mSystemThreadField = ACTIVITY_THREAD_CLASS.getDeclaredField("mSystemThread");
|
||||
mSystemThreadField.setAccessible(true);
|
||||
mSystemThreadField.setBoolean(ACTIVITY_THREAD, true);
|
||||
} catch (Exception e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
@ -132,10 +137,13 @@ public final class Workarounds {
|
||||
try {
|
||||
Class<?> configurationControllerClass = Class.forName("android.app.ConfigurationController");
|
||||
Class<?> activityThreadInternalClass = Class.forName("android.app.ActivityThreadInternal");
|
||||
|
||||
// configurationController = new ConfigurationController(ACTIVITY_THREAD);
|
||||
Constructor<?> configurationControllerConstructor = configurationControllerClass.getDeclaredConstructor(activityThreadInternalClass);
|
||||
configurationControllerConstructor.setAccessible(true);
|
||||
Object configurationController = configurationControllerConstructor.newInstance(ACTIVITY_THREAD);
|
||||
|
||||
// ACTIVITY_THREAD.mConfigurationController = configurationController;
|
||||
Field configurationControllerField = ACTIVITY_THREAD_CLASS.getDeclaredField("mConfigurationController");
|
||||
configurationControllerField.setAccessible(true);
|
||||
configurationControllerField.set(ACTIVITY_THREAD, configurationController);
|
||||
|
@ -120,6 +120,21 @@ public final class LogUtils {
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isCameraBackwardCompatible(CameraCharacteristics characteristics) {
|
||||
int[] capabilities = characteristics.get(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES);
|
||||
if (capabilities == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int capability : capabilities) {
|
||||
if (capability == CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static String buildCameraListMessage(boolean includeSizes) {
|
||||
StringBuilder builder = new StringBuilder("List of cameras:");
|
||||
CameraManager cameraManager = ServiceManager.getCameraManager();
|
||||
@ -129,9 +144,16 @@ public final class LogUtils {
|
||||
builder.append("\n (none)");
|
||||
} else {
|
||||
for (String id : cameraIds) {
|
||||
builder.append("\n --camera-id=").append(id);
|
||||
CameraCharacteristics characteristics = cameraManager.getCameraCharacteristics(id);
|
||||
|
||||
if (!isCameraBackwardCompatible(characteristics)) {
|
||||
// Ignore depth cameras as suggested by official documentation
|
||||
// <https://developer.android.com/media/camera/camera2/camera-enumeration>
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.append("\n --camera-id=").append(id);
|
||||
|
||||
int facing = characteristics.get(CameraCharacteristics.LENS_FACING);
|
||||
builder.append(" (").append(getCameraFacingName(facing)).append(", ");
|
||||
|
||||
@ -141,8 +163,10 @@ public final class LogUtils {
|
||||
try {
|
||||
// Capture frame rates for low-FPS mode are the same for every resolution
|
||||
Range<Integer>[] lowFpsRanges = characteristics.get(CameraCharacteristics.CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES);
|
||||
SortedSet<Integer> uniqueLowFps = getUniqueSet(lowFpsRanges);
|
||||
builder.append(", fps=").append(uniqueLowFps);
|
||||
if (lowFpsRanges != null) {
|
||||
SortedSet<Integer> uniqueLowFps = getUniqueSet(lowFpsRanges);
|
||||
builder.append(", fps=").append(uniqueLowFps);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// Some devices may provide invalid ranges, causing an IllegalArgumentException "lower must be less than or equal to upper"
|
||||
Ln.w("Could not get available frame rates for camera " + id, e);
|
||||
|
Loading…
x
Reference in New Issue
Block a user