MCPcopy Create free account
hub / github.com/OpenHD/OpenHD / create_source_encode_pipeline

Method create_source_encode_pipeline

OpenHD/ohd_video/src/gstreamerstream.cpp:100–216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98}
99
100std::string GStreamerStream::create_source_encode_pipeline(
101 const CameraHolder& cam_holder) {
102 const auto& camera = cam_holder.get_camera();
103 CameraSettings setting = cam_holder.get_settings();
104
105 const bool RPI_HDMI_TO_CSI_USE_V4l2 = OHDFilesystemUtil::exists(
106 std::string(getConfigBasePath()) + "hdmi_v4l2.txt");
107
108 openhd::log::get_default()->debug("RPI_HDMI_TO_CSI_USE_V4l2: {}",
109 RPI_HDMI_TO_CSI_USE_V4l2);
110
111 if (OHDPlatform::instance().is_x20()) {
112 openhd::log::get_default()->debug(
113 "Platform is x20. Applying x20 RunCam IQ settings.");
114 openhd::x20::apply_x20_runcam_iq_settings(setting);
115 } else if (camera.requires_rpi_mmal_pipeline() && RPI_HDMI_TO_CSI_USE_V4l2) {
116 openhd::log::get_default()->debug(
117 "Initializing resolution for RPI MMAL pipeline with V4l2.");
118 openhd::rpi::hdmi::initialize_resolution(
119 setting.streamed_video_format.width,
120 setting.streamed_video_format.height,
121 setting.streamed_video_format.framerate);
122 }
123
124 std::stringstream pipeline;
125
126 if (camera.requires_rpi_mmal_pipeline()) {
127 openhd::log::get_default()->debug("Camera requires RPI MMAL pipeline.");
128 if (RPI_HDMI_TO_CSI_USE_V4l2) {
129 openhd::log::get_default()->warn("Using RPI HDMI V4l2 stream.");
130 pipeline << OHDGstHelper::create_rpi_hdmi_v4l2_stream(setting);
131 } else {
132 openhd::log::get_default()->warn("Using RPI Camera source stream.");
133 pipeline << OHDGstHelper::createRpicamsrcStream(
134 -1, setting, cam_holder.requires_half_bitrate_workaround());
135 }
136 } else if (camera.requires_rpi_libcamera_pipeline()) {
137 openhd::log::get_default()->debug(
138 "Camera requires RPI Libcamera pipeline.");
139 pipeline << OHDGstHelper::createLibcamerasrcStream(setting);
140 } else if (camera.requires_rpi_veye_pipeline()) {
141 openhd::log::get_default()->debug("Camera requires RPI Veye pipeline.");
142 auto bus = "/dev/video0";
143 pipeline << OHDGstHelper::create_veye_vl2_stream(setting, bus);
144 } else if (camera.requires_rockchip3_mpp_pipeline()) {
145 openhd::log::get_default()->debug(
146 "Camera requires Rockchip3 MPP pipeline.");
147 if (camera.camera_type == X_CAM_TYPE_ROCK_3_HDMI_IN) {
148 openhd::log::get_default()->warn("Using Rockchip HDMI stream.");
149 pipeline << OHDGstHelper::createRockchipHDMIStream(setting);
150 } else {
151 openhd::log::get_default()->warn(
152 "Determining V4l2 file number for Rockchip platform.");
153 const int v4l2_filenumber =
154 OHDPlatform::instance().platform_type ==
155 X_PLATFORM_TYPE_ROCKCHIP_RK3566_RADXA_ZERO3W ||
156 OHDPlatform::instance().platform_type ==
157 X_PLATFORM_TYPE_ROCKCHIP_RK3566_RADXA_CM3

Callers

nothing calls this directly

Calls 15

getConfigBasePathFunction · 0.85
initialize_resolutionFunction · 0.85
createRpicamsrcStreamFunction · 0.85
createLibcamerasrcStreamFunction · 0.85
create_veye_vl2_streamFunction · 0.85
createRockchipHDMIStreamFunction · 0.85
createRockchipCSIStreamFunction · 0.85
createAllwinnerStreamFunction · 0.85
is_usb_cameraFunction · 0.85

Tested by

no test coverage detected