-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RSDK-4370 Expand GST pipeline generator to handle libcamera source (#7)
* support libcamera gst pipeline
- Loading branch information
Showing
8 changed files
with
105 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
gst-launch-1.0 libcamerasrc \ | ||
! 'video/x-raw,width=1920,height=1080,framerate=30/1' \ | ||
! videoconvert \ | ||
! jpegenc ! image/jpeg ! appsink name=appsink0 max-buffers=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#include <fstream> | ||
#include <algorithm> | ||
|
||
#include "utils.h" | ||
|
||
device_type get_device_type() { | ||
std::ifstream device_name(DEVICE_PATH); | ||
if (device_name.is_open()) { | ||
std::string line; | ||
while (std::getline(device_name, line)) { | ||
std::string lowercase_line = line; | ||
std::transform(lowercase_line.begin(), lowercase_line.end(), lowercase_line.begin(), ::tolower); | ||
// Check for specific terms in a case-insensitive manner | ||
if (lowercase_line.find("nvidia") != std::string::npos && | ||
(lowercase_line.find("orin") != std::string::npos || | ||
lowercase_line.find("nano") != std::string::npos || | ||
lowercase_line.find("agx") != std::string::npos || | ||
lowercase_line.find("jetson") != std::string::npos)) { | ||
return device_type(device_type::jetson, "Jetson"); | ||
} else if (lowercase_line.find("raspberry") != std::string::npos && | ||
lowercase_line.find("pi") != std::string::npos) { | ||
return device_type(device_type::pi, "Raspberry Pi"); | ||
} | ||
} | ||
device_name.close(); | ||
} | ||
|
||
return device_type(device_type::unknown, "unkwnown"); | ||
} | ||
|
||
device_params get_device_params(device_type device) { | ||
switch (device.value) { | ||
case device_type::jetson: | ||
return device_params { | ||
.input_source = JETSON_INPUT_SOURCE, | ||
.input_format = JETSON_INPUT_FORMAT, | ||
.video_converter = JETSON_VIDEO_CONVERTER, | ||
.output_encoder = JETSON_OUTPUT_ENCODER | ||
}; | ||
case device_type::pi: | ||
return device_params { | ||
.input_source = PI_INPUT_SOURCE, | ||
.input_format = PI_INPUT_FORMAT, | ||
.video_converter = PI_VIDEO_CONVERTER, | ||
.output_encoder = PI_OUTPUT_ENCODER | ||
}; | ||
default: | ||
return device_params { | ||
.input_source = DEFAULT_INPUT_SOURCE, | ||
.input_format = DEFAULT_INPUT_FORMAT, | ||
.video_converter = DEFAULT_VIDEO_CONVERTER, | ||
.output_encoder = DEFAULT_OUTPUT_ENCODER | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters