|
39 | 39 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
40 | 40 | */ |
41 | 41 |
|
| 42 | +#include <atomic> // for atomic |
| 43 | +#include <cassert> // for assert |
42 | 44 | #include <cctype> |
43 | 45 | #include <cstdint> // for uint32_t |
44 | 46 | #include <cstdio> // for printf |
45 | 47 | #include <cstdlib> |
46 | 48 | #include <cstring> |
47 | 49 | #include <memory> |
| 50 | +#include <utility> // for move |
48 | 51 |
|
49 | | -#include "compat/strings.h" // strdupa |
| 52 | +#include "audio/types.h" // for audio_desc |
50 | 53 | #include "debug.h" |
51 | 54 | #include "host.h" |
52 | 55 | #include "lib_common.h" |
53 | 56 | #include "messaging.h" |
54 | 57 | #include "rtp/rtp.h" |
| 58 | +#include "rtsp/c_basicRTSPOnlyServer.h" // for rtsp_server_parameters, c_st... |
55 | 59 | #include "rtsp/rtsp_utils.h" // for rtsp_types_t |
56 | 60 | #include "transmit.h" |
57 | 61 | #include "tv.h" |
|
60 | 64 | #include "utils/sdp.h" // for sdp_print_supported_codecs |
61 | 65 | #include "video_codec.h" // for get_codec_name |
62 | 66 | #include "video_rxtx.h" |
63 | | -#include "video_rxtx/h264_rtp.hpp" |
| 67 | +#include "video_rxtx/rtp.hpp" |
64 | 68 |
|
65 | 69 | constexpr char DEFAULT_RTSP_COMPRESSION[] = "lavc:enc=libx264:safe"; |
66 | 70 | #define MOD_NAME "[vrxtx/h264_rtp] " |
67 | 71 |
|
68 | 72 | using std::shared_ptr; |
69 | 73 |
|
| 74 | +class h264_rtp_video_rxtx { |
| 75 | +public: |
| 76 | + h264_rtp_video_rxtx(const struct vrxtx_params *params, |
| 77 | + const struct common_opts *common, int rtsp_port); |
| 78 | + ~h264_rtp_video_rxtx(); |
| 79 | + void join(); |
| 80 | + void set_audio_spec(const struct audio_desc *desc, int audio_rx_port, |
| 81 | + int audio_tx_port, bool ipv6); |
| 82 | + void send_frame(std::shared_ptr<video_frame>) noexcept; |
| 83 | + |
| 84 | +private: |
| 85 | + struct rtp_rxtx_common *m_rtp_common; |
| 86 | + void configure_rtsp_server_video(); |
| 87 | + struct rtsp_server_parameters rtsp_params{}; |
| 88 | + std::atomic<bool> audio_params_set = false; |
| 89 | + rtsp_serv_t *m_rtsp_server = nullptr; |
| 90 | + void (*tx_send_std)(struct tx *tx_session, struct video_frame *frame, |
| 91 | + struct rtp *rtp_session) = nullptr; |
| 92 | + |
| 93 | + bool m_sent_compress_change = false; |
| 94 | + struct module *m_parent; |
| 95 | + time_ns_t m_start_time; |
| 96 | +}; |
| 97 | + |
70 | 98 | h264_rtp_video_rxtx::h264_rtp_video_rxtx(const struct vrxtx_params *params, |
71 | 99 | const struct common_opts *common, int rtsp_port) : |
72 | 100 | m_parent(common->parent), |
|
0 commit comments