mirror of
https://github.com/Genymobile/scrcpy
synced 2025-09-01 06:45:40 +00:00
Add --record-orientation
Add an option to store the orientation to apply in a recorded file. Only rotations are supported (not flips). PR #4441 <https://github.com/Genymobile/scrcpy/pull/4441>
This commit is contained in:
@@ -91,6 +91,7 @@ enum {
|
||||
OPT_CAMERA_FPS,
|
||||
OPT_CAMERA_HIGH_SPEED,
|
||||
OPT_DISPLAY_ORIENTATION,
|
||||
OPT_RECORD_ORIENTATION,
|
||||
};
|
||||
|
||||
struct sc_option {
|
||||
@@ -609,6 +610,15 @@ static const struct sc_option options[] = {
|
||||
.text = "Force recording format (mp4, mkv, m4a, mka, opus, aac, flac "
|
||||
"or wav).",
|
||||
},
|
||||
{
|
||||
.longopt_id = OPT_RECORD_ORIENTATION,
|
||||
.longopt = "record-orientation",
|
||||
.argdesc = "value",
|
||||
.text = "Set the record orientation.\n"
|
||||
"Possible values are 0, 90, 180 and 270. The number represents "
|
||||
"the clockwise rotation in degrees.\n"
|
||||
"Default is 0.",
|
||||
},
|
||||
{
|
||||
.longopt_id = OPT_RENDER_DRIVER,
|
||||
.longopt = "render-driver",
|
||||
@@ -2131,6 +2141,11 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case OPT_RECORD_ORIENTATION:
|
||||
if (!parse_orientation(optarg, &opts->record_orientation)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case OPT_RENDER_DRIVER:
|
||||
opts->render_driver = optarg;
|
||||
break;
|
||||
@@ -2497,6 +2512,15 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],
|
||||
}
|
||||
}
|
||||
|
||||
if (opts->record_orientation != SC_ORIENTATION_0) {
|
||||
if (sc_orientation_is_mirror(opts->record_orientation)) {
|
||||
LOGE("Record orientation only supports rotation, not "
|
||||
"flipping: %s",
|
||||
sc_orientation_get_name(opts->record_orientation));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (opts->video
|
||||
&& sc_record_format_is_audio_only(opts->record_format)) {
|
||||
LOGE("Audio container does not support video stream");
|
||||
|
Reference in New Issue
Block a user