@@ -65,6 +65,23 @@ CameraSession::CameraSession(CameraManager *cm,
return;
}
+ if (options_.isSet(OptOrientation)) {
+ std::string orient = options_[OptOrientation].toString();
+ if (orient == "rot180") {
+ config->orientation =
+ libcamera::Orientation::rotate180;
+ } else if (orient == "mirror") {
+ config->orientation =
+ libcamera::Orientation::rotate0Flip;
+ } else if (orient == "flip") {
+ config->orientation =
+ libcamera::Orientation::rotate180Flip;
+ } else {
+ std::cerr << "Invalid orientation " << orient << std::endl;
+ return;
+ }
+ }
+
/* Apply configuration if explicitly requested. */
if (StreamKeyValueParser::updateConfiguration(config.get(),
options_[OptStream])) {
@@ -133,6 +133,11 @@ int CamApp::parseOptions(int argc, char *argv[])
"Capture until interrupted by user or until <count> frames captured",
"capture", ArgumentOptional, "count", false,
OptCamera);
+
+ parser.addOption(OptOrientation, OptionString,
+ "The camera stream image orientation (rot180, mirror, flip)",
+ "orientation", ArgumentRequired, "orientation", false,
+ OptCamera);
#ifdef HAVE_KMS
parser.addOption(OptDisplay, OptionString,
"Display viewfinder through DRM/KMS on specified connector",
@@ -17,6 +17,7 @@ enum {
OptList = 'l',
OptListProperties = 'p',
OptMonitor = 'm',
+ OptOrientation = 'o',
OptSDL = 'S',
OptStream = 's',
OptListControls = 256,