Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--no-playback, --no-video-playback, --no-audio-playback #4033

Merged
merged 10 commits into from
May 27, 2023
Merged

--no-playback, --no-video-playback, --no-audio-playback #4033

merged 10 commits into from
May 27, 2023

Conversation

rom1v
Copy link
Collaborator

@rom1v rom1v commented May 24, 2023

Firstly, rename --no-mirror to --no-playback (the initial option --no-display option was renamed to --no-mirror by commit 6928acd, but this has never been released, so it is ok to rename it one more time). See #3978 (comment)

Secondly, add two options to control video and audio playback separately:

  • --no-video-playback
  • --no-audio-playback

--no-playback is now an alias for both.

For example:

scrcpy --v4l2-sink=/dev/video2 --no-video-playback  # keep audio playback
scrcpy --record=file.mkv --no-audio-playback        # keep video playback

cc @kevsestrella (#3978 (comment)) @slr (#3989)

rom1v and others added 10 commits May 24, 2023 22:13
For consistency with the other parameters.
The AudioFormat contains several properties. This specific value is
named "encoding".
Some devices (Vivo phones) fail to create an AudioRecord from an
AudioRecord.Builder (which throws a NullPointerException).

In that case, create an AudioRecord instance directly by reflection.

The AOSP version of AudioRecord constructor code can be found at:
 - Android 11 (R):
   <https://cs.android.com/android/platform/superproject/+/android-11.0.0_r1:frameworks/base/media/java/android/media/AudioRecord.java;l=335;drc=64ed2ec38a511bbbd048985fe413268335e072f8>
 - Android 12 (S):
   <https://cs.android.com/android/platform/superproject/+/android-12.0.0_r1:frameworks/base/media/java/android/media/AudioRecord.java;l=388;drc=2eebf929650e0d320a21f0d13677a27d7ab278e9>
 - Android 13 (T, functionally identical to Android 12):
   <https://cs.android.com/android/platform/superproject/+/android-13.0.0_r1:frameworks/base/media/java/android/media/AudioRecord.java;l=382;drc=ed242da52f975a1dd18671afb346b18853d729f2>
 - Android 14 (U): Not released, but expected to change

PR #3862 <#3862>
Fixes #3805 <#3805>

Signed-off-by: Romain Vimont <[email protected]>
This option impacts video and audio _playback_. For example, if we use
V4L2, the device is still "mirrored" (via V4L2), even if playback is
disabled. Therefore, "playback" is more approriate than "mirror".

The initial option --no-display option was renamed to --no-mirror by
commit 6928acd, but this has never been
released, so it is ok to rename it one more time.

Refs #3978 <#3978 (comment)>
PR #4033 <#4033>
Perform checks that impact the options first.
For consistency, use the same error message for --v4l2-sink and
--v4l2-buffer.
If V4L2 support is disabled, there is no v4l2 buffer option.
Define local variables whose value depends on ifdefs, to avoid
cluttering all conditions with ifdefs.
Add --no-video-playback and --no-audio-playback. The option
--no-playback is now an alias for both.

PR #4033 <#4033>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants