97 lines
1.8 KiB
C++
97 lines
1.8 KiB
C++
/**
|
|
* @file src/rtsp.h
|
|
* @brief Declarations for RTSP streaming.
|
|
*/
|
|
#pragma once
|
|
|
|
#include <atomic>
|
|
#include <memory>
|
|
#include <list>
|
|
|
|
#include "crypto.h"
|
|
#include "thread_safe.h"
|
|
|
|
#ifdef _WIN32
|
|
#include <windows.h>
|
|
#endif
|
|
|
|
// Resolve circular dependencies
|
|
namespace stream {
|
|
struct session_t;
|
|
}
|
|
|
|
namespace rtsp_stream {
|
|
constexpr auto RTSP_SETUP_PORT = 21;
|
|
|
|
struct launch_session_t {
|
|
uint32_t id;
|
|
|
|
crypto::aes_t gcm_key;
|
|
crypto::aes_t iv;
|
|
|
|
std::string av_ping_payload;
|
|
uint32_t control_connect_data;
|
|
|
|
std::string device_name;
|
|
std::string unique_id;
|
|
crypto::PERM perm;
|
|
|
|
bool host_audio;
|
|
int width;
|
|
int height;
|
|
int fps;
|
|
int gcmap;
|
|
int appid;
|
|
int surround_info;
|
|
std::string surround_params;
|
|
bool enable_hdr;
|
|
bool enable_sops;
|
|
bool virtual_display;
|
|
uint32_t scale_factor;
|
|
|
|
std::optional<crypto::cipher::gcm_t> rtsp_cipher;
|
|
std::string rtsp_url_scheme;
|
|
uint32_t rtsp_iv_counter;
|
|
|
|
std::list<crypto::command_entry_t> client_do_cmds;
|
|
std::list<crypto::command_entry_t> client_undo_cmds;
|
|
|
|
#ifdef _WIN32
|
|
GUID display_guid{};
|
|
#endif
|
|
};
|
|
|
|
void
|
|
launch_session_raise(std::shared_ptr<launch_session_t> launch_session);
|
|
|
|
/**
|
|
* @brief Clear state for the specified launch session.
|
|
* @param launch_session_id The ID of the session to clear.
|
|
*/
|
|
void
|
|
launch_session_clear(uint32_t launch_session_id);
|
|
|
|
/**
|
|
* @brief Get the number of active sessions.
|
|
* @return Count of active sessions.
|
|
*/
|
|
int
|
|
session_count();
|
|
|
|
std::shared_ptr<stream::session_t>
|
|
find_session(const std::string& uuid);
|
|
|
|
std::list<std::string>
|
|
get_all_session_uuids();
|
|
|
|
/**
|
|
* @brief Terminates all running streaming sessions.
|
|
*/
|
|
void
|
|
terminate_sessions();
|
|
|
|
void
|
|
rtpThread();
|
|
|
|
} // namespace rtsp_stream
|