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

Add device orientation information to header information #5918

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

sbfkcel
Copy link

@sbfkcel sbfkcel commented Mar 13, 2025

This is useful if need to draw the device appearance correctly.

Related Discussions

#5704
#3605
#925

#5894


CODEC    SESSION packet                         SESSION packet
[codec] [type|width|height|orient] […] […] […] [type|width|height|orient] […] […]
                                              ^
                                              rotation occurs

CODEC packet:

  • codecId 4byte

SESSION packet:

  • type 1byte, The SESSION packet type is 0xff
  • width 4byte
  • hegiht 4byte
  • orient 3byte
    • isFlip 1byte
    • 180° 1byte
    • 90° 1byte

Orient format reference source

scrcpy/app/src/options.h

Lines 72 to 85 in 7998811

// ,----- hflip (applied before the rotation)
// | ,--- 180°
// | | ,- 90° clockwise
// | | |
enum sc_orientation { // v v v
SC_ORIENTATION_0, // 0 0 0
SC_ORIENTATION_90, // 0 0 1
SC_ORIENTATION_180, // 0 1 0
SC_ORIENTATION_270, // 0 1 1
SC_ORIENTATION_FLIP_0, // 1 0 0
SC_ORIENTATION_FLIP_90, // 1 0 1
SC_ORIENTATION_FLIP_180, // 1 1 0
SC_ORIENTATION_FLIP_270, // 1 1 1
};

Test run

meson setup x --buildtype=release --strip -Db_lto=true &&  ninja -Cx && ./run x

Output

INFO: Width=1920, Height=864, Flip=False, Direction=1

@sbfkcel
Copy link
Author

sbfkcel commented Mar 13, 2025

The previous fork has too many redundant records, use the new pull.

@rom1v Please check again to see if there are any new suggestions.

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