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

Method setup

OpenHD/ohd_video/src/gstreamerstream.cpp:218–319  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

216}
217
218void GStreamerStream::setup() {
219 m_console->debug("GStreamerStream::setup() begin");
220 const auto& camera = m_camera_holder->get_camera();
221 const auto& setting = m_camera_holder->get_settings();
222 std::stringstream pipeline_content;
223 m_bitrate_ctrl_element = std::nullopt;
224 pipeline_content << create_source_encode_pipeline(*m_camera_holder);
225 // quick check,here the pipeline should end with a "! ";
226 if (!OHDUtil::endsWith(pipeline_content.str(), "! ")) {
227 m_console->warn("Probably ill-formatted pipeline: [{}]",
228 pipeline_content.str());
229 }
230 const bool ADD_RECORDING_TO_PIPELINE =
231 setting.air_recording == AIR_RECORDING_ON ||
232 (setting.air_recording == AIR_RECORDING_AUTO_ARM_DISARM &&
233 m_armed_enable_air_recording);
234 // for safety we only add the tee command at the right place if recording is
235 // enabled.
236 if (ADD_RECORDING_TO_PIPELINE) {
237 m_console->info("Air recording active");
238 pipeline_content << "tee name=t ! ";
239 }
240 // After we've written the parts for the different camera implementation(s) we
241 // just need to append the rtp part and the udp out add rtp part
242 if (dirty_use_raw) {
243 /*pipeline_content <<
244 OHDGstHelper::create_queue_and_parse(setting.streamed_video_format.videoCodec);
245 pipeline_content <<
246 OHDGstHelper::create_caps_nal(setting.streamed_video_format.videoCodec);
247 pipeline_content << " queue ! ";*/
248 pipeline_content << " queue ! ";
249 /*pipeline_content << OHDGstHelper::create_parse_for_codec(
250 setting.streamed_video_format.videoCodec);
251 pipeline_content << OHDGstHelper::create_caps_nal(
252 setting.streamed_video_format.videoCodec, true);*/
253 pipeline_content << OHDGstHelper::createOutputAppSink();
254 /*pipeline_content << "video/x-h264,stream-format=byte-stream ! ";
255 pipeline_content << OHDGstHelper::createOutputAppSink();*/
256 } else {
257 const int rtp_fragment_size = 1440;
258 m_console->debug("Using {} for rtp fragmentation", rtp_fragment_size);
259 pipeline_content << OHDGstHelper::create_parse_and_rtp_packetize(
260 setting.streamed_video_format.videoCodec, rtp_fragment_size);
261 pipeline_content << OHDGstHelper::createOutputAppSink();
262 }
263 if (ADD_RECORDING_TO_PIPELINE) {
264 const auto recording_filename =
265 openhd::video::create_unused_recording_filename(
266 OHDGstHelper::file_suffix_for_video_codec(
267 setting.streamed_video_format.videoCodec));
268 m_console->debug("Using [{}] for recording", recording_filename);
269 pipeline_content << OHDGstHelper::createRecordingForVideoCodec(
270 setting.streamed_video_format.videoCodec, recording_filename);
271 m_opt_curr_recording_filename = recording_filename;
272 } else {
273 m_opt_curr_recording_filename = std::nullopt;
274 }
275 {

Callers

nothing calls this directly

Calls 11

endsWithFunction · 0.85
createOutputAppSinkFunction · 0.85
video_codec_to_intFunction · 0.85
debugMethod · 0.80
set_cam_infoMethod · 0.80
set_out_cbMethod · 0.80

Tested by

no test coverage detected