Skip to content

Commit 1cf11e0

Browse files
committed
vrxtx/h264_*: remove headers
the implementation moved completly to .cpp files (as with ultragrid_rtp)
1 parent 05f3db6 commit 1cf11e0

4 files changed

Lines changed: 56 additions & 159 deletions

File tree

src/video_rxtx/h264_rtp.cpp

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,23 @@
3939
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4040
*/
4141

42+
#include <atomic> // for atomic
43+
#include <cassert> // for assert
4244
#include <cctype>
4345
#include <cstdint> // for uint32_t
4446
#include <cstdio> // for printf
4547
#include <cstdlib>
4648
#include <cstring>
4749
#include <memory>
50+
#include <utility> // for move
4851

49-
#include "compat/strings.h" // strdupa
52+
#include "audio/types.h" // for audio_desc
5053
#include "debug.h"
5154
#include "host.h"
5255
#include "lib_common.h"
5356
#include "messaging.h"
5457
#include "rtp/rtp.h"
58+
#include "rtsp/c_basicRTSPOnlyServer.h" // for rtsp_server_parameters, c_st...
5559
#include "rtsp/rtsp_utils.h" // for rtsp_types_t
5660
#include "transmit.h"
5761
#include "tv.h"
@@ -60,13 +64,37 @@
6064
#include "utils/sdp.h" // for sdp_print_supported_codecs
6165
#include "video_codec.h" // for get_codec_name
6266
#include "video_rxtx.h"
63-
#include "video_rxtx/h264_rtp.hpp"
67+
#include "video_rxtx/rtp.hpp"
6468

6569
constexpr char DEFAULT_RTSP_COMPRESSION[] = "lavc:enc=libx264:safe";
6670
#define MOD_NAME "[vrxtx/h264_rtp] "
6771

6872
using std::shared_ptr;
6973

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+
7098
h264_rtp_video_rxtx::h264_rtp_video_rxtx(const struct vrxtx_params *params,
7199
const struct common_opts *common, int rtsp_port) :
72100
m_parent(common->parent),

src/video_rxtx/h264_rtp.hpp

Lines changed: 0 additions & 80 deletions
This file was deleted.

src/video_rxtx/h264_sdp.cpp

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@
3939
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4040
*/
4141

42-
#include "video_rxtx/h264_sdp.hpp"
43-
4442
#include <cstdint> // for uint32_t
4543
#include <cstdlib> // for abort
46-
#include <cstring> // for strncpy
4744
#include <exception> // for exception
48-
#include <iostream>
45+
#include <memory> // for shared_ptr
46+
#include <ostream> // for basic_ostream, operator<<
47+
#include <string> // for basic_string, string, operator==
48+
#include <utility> // for move
4949

5050
#include "audio/audio.h"
5151
#include "audio/types.h" // for audio_desc
@@ -57,6 +57,7 @@
5757
#include "rtp/rtp.h"
5858
#include "transmit.h"
5959
#include "tv.h"
60+
#include "types.h" // for video_frame, VIDEO_CODEC_NONE, codec_t
6061
#include "ug_runtime_error.hpp"
6162
#include "utils/sdp.h"
6263
#include "video_codec.h" // for is_codec_opaque
@@ -66,7 +67,27 @@
6667
#define DEFAULT_SDP_COMPRESSION "lavc:codec=MJPG:safe"
6768
#define MOD_NAME "[vrxtx/sdp] "
6869

69-
using std::cout;
70+
class h264_sdp_video_rxtx {
71+
public:
72+
h264_sdp_video_rxtx(const struct vrxtx_params *params,
73+
const struct common_opts *common);
74+
~h264_sdp_video_rxtx();
75+
void send_frame(std::shared_ptr<video_frame>) noexcept;
76+
void set_audio_spec(const struct audio_desc *desc, int audio_rx_port,
77+
int audio_tx_port, bool ipv6);
78+
private:
79+
struct rtp_rxtx_common *m_rtp_common;
80+
static void change_address_callback(void *udata, const char *address);
81+
void sdp_add_video(codec_t codec);
82+
codec_t m_sdp_configured_codec = VIDEO_CODEC_NONE;
83+
int m_saved_tx_port;
84+
bool m_sent_compress_change = false;
85+
86+
std::string m_saved_addr; ///< for dynamic address reconfiguration, @see m_autorun
87+
struct module *m_parent;
88+
};
89+
90+
7091
using std::exception;
7192
using std::shared_ptr;
7293
using std::string;

src/video_rxtx/h264_sdp.hpp

Lines changed: 0 additions & 72 deletions
This file was deleted.

0 commit comments

Comments
 (0)