v4l2启用
This commit is contained in:
@@ -67,6 +67,30 @@ struct PacketHeader {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief 设备信息包头结构(UDP 10000)
|
||||
*
|
||||
* 用于传输设备参数、帧率、像素格式等信息。
|
||||
*/
|
||||
struct DeviceInfoPacket {
|
||||
uint16_t magic; ///< 魔数 0xAA56
|
||||
uint32_t sequence; ///< 序列号
|
||||
uint16_t width; ///< 图像宽度
|
||||
uint16_t height; ///< 图像高度
|
||||
float framerate; ///< 帧率
|
||||
uint32_t pixel_format; ///< 像素格式(V4L2 FourCC)
|
||||
char device_path[32]; ///< 设备路径(/dev/videoX)
|
||||
char device_name[64]; ///< 设备名称
|
||||
float current_fps; ///< 当前实际 FPS
|
||||
uint32_t total_frames; ///< 总帧数
|
||||
uint64_t timestamp; ///< 时间戳(毫秒)
|
||||
uint16_t crc16; ///< CRC 校验(可选)
|
||||
|
||||
static constexpr uint16_t size() {
|
||||
return sizeof(DeviceInfoPacket);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief 恢复默认的对齐方式
|
||||
*/
|
||||
@@ -79,6 +103,12 @@ struct PacketHeader {
|
||||
/** @brief 数据包魔数,用于识别合法的 SkyLink 数据包 */
|
||||
constexpr uint16_t SKYLINK_MAGIC = 0xAA55;
|
||||
|
||||
/** @brief 设备信息魔数,用于识别设备信息数据包 */
|
||||
constexpr uint16_t DEVICE_INFO_MAGIC = 0xAA56;
|
||||
|
||||
/** @brief 设备信息请求魔数,用于请求立即发送设备信息 */
|
||||
constexpr uint16_t DEVICE_INFO_REQUEST = 0xAA57;
|
||||
|
||||
/** @brief 最大的单个 UDP 包大小 (包含报头) - MTU 1500 字节 */
|
||||
constexpr uint16_t MAX_UDP_PACKET_SIZE = 1472; // 1500 - 20 (IP) - 8 (UDP)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user