Files

64 lines
1.2 KiB
C++

#ifndef RTSP_CLIENT_H
#define RTSP_CLIENT_H
#include <cstdint>
#include <cstddef>
#include <string>
namespace rtsp_client {
static constexpr int RTSP_DEFAULT_PORT = 554;
static constexpr int RTP_BUFFER_SIZE = 65536;
static constexpr int MAX_URL_LEN = 512;
struct RtspState {
std::string url;
std::string host;
int port;
std::string path;
int rtsp_fd;
int rtp_fd;
int rtcp_fd;
int local_rtp_port;
int local_rtcp_port;
std::string session_id;
std::string control_url;
std::string video_track_url;
bool connected;
bool running;
bool playing;
pthread_t receiver_thread;
int shmem_fd;
uint8_t* shmem_base;
size_t shmem_size;
int32_t width;
int32_t height;
uint32_t frame_count;
uint64_t bytes_received;
};
int init_rtsp(const char* url);
int connect_rtsp();
int play_rtsp();
void stop_rtsp();
void release_rtsp();
bool is_rtsp_connected();
int get_rtsp_shmem_fd();
int get_rtsp_width();
int get_rtsp_height();
// Get the shared memory base pointer (for reading frames)
// Returns nullptr if not initialized
uint8_t* get_rtsp_shmem_base();
} // namespace rtsp_client
#endif // RTSP_CLIENT_H