| 45 | #include "x20_cam_helper.h" |
| 46 | |
| 47 | GStreamerStream::GStreamerStream(std::shared_ptr<CameraHolder> camera_holder, |
| 48 | openhd::ON_ENCODE_FRAME_CB out_cb) |
| 49 | //: CameraStream(platform, camera_holder, video_udp_port) { |
| 50 | : CameraStream(std::move(camera_holder), std::move(out_cb)) { |
| 51 | m_console = openhd::log::create_or_get( |
| 52 | fmt::format("cam{}", m_camera_holder->get_camera().index)); |
| 53 | assert(m_console); |
| 54 | m_console->debug("GStreamerStream::GStreamerStream for cam {}", |
| 55 | m_camera_holder->get_camera().cam_type_as_verbose_string()); |
| 56 | if (OHDFilesystemUtil::exists( |
| 57 | (std::string(getConfigBasePath()) + "exp_raw.txt").c_str())) { |
| 58 | dirty_use_raw = true; |
| 59 | } |
| 60 | m_camera_holder->register_listener([this]() { |
| 61 | // right now, every time the settings for this camera change, we just |
| 62 | // re-start the whole stream. That is not ideal, since some cameras support |
| 63 | // changing for example the bitrate or white balance during operation. But |
| 64 | // wiring that up is not that easy. We call request_restart() to make sure |
| 65 | // to not perform heavy operation(s) on the mavlink settings callback, since |
| 66 | // we need to send the acknowledging response in time. Also, gstreamer and |
| 67 | // camera(s) are sometimes buggy, so in the worst case gstreamer can become |
| 68 | // unresponsive and block on the restart operation(s) which would be fatal |
| 69 | // for telemetry. |
| 70 | this->request_restart(); |
| 71 | }); |
| 72 | OHDGstHelper::initGstreamerOrThrow(); |
| 73 | if (m_camera_holder->get_camera().is_camera_type_usb_infiray()) { |
| 74 | openhd::set_infiray_custom_control_zoom_absolute_async( |
| 75 | m_camera_holder->get_settings() |
| 76 | .infiray_custom_control_zoom_absolute_colorpalete, |
| 77 | m_camera_holder->get_camera().usb_v4l2_device_number); |
| 78 | } |
| 79 | // m_gst_video_recorder=std::make_unique<GstVideoRecorder>(); |
| 80 | m_console->debug("GStreamerStream::GStreamerStream done"); |
| 81 | } |
| 82 | |
| 83 | GStreamerStream::~GStreamerStream() { GStreamerStream::terminate_looping(); } |
| 84 |
nothing calls this directly
no test coverage detected