mavlink_msg_video_stream_information.h 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  1. #pragma once
  2. // MESSAGE VIDEO_STREAM_INFORMATION PACKING
  3. #define MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION 269
  4. typedef struct __mavlink_video_stream_information_t {
  5. float framerate; /*< [Hz] Frame rate.*/
  6. uint32_t bitrate; /*< [bits/s] Bit rate.*/
  7. uint16_t flags; /*< Bitmap of stream status flags.*/
  8. uint16_t resolution_h; /*< [pix] Horizontal resolution.*/
  9. uint16_t resolution_v; /*< [pix] Vertical resolution.*/
  10. uint16_t rotation; /*< [deg] Video image rotation clockwise.*/
  11. uint16_t hfov; /*< [deg] Horizontal Field of view.*/
  12. uint8_t stream_id; /*< Video Stream ID (1 for first, 2 for second, etc.)*/
  13. uint8_t count; /*< Number of streams available.*/
  14. uint8_t type; /*< Type of stream.*/
  15. char name[32]; /*< Stream name.*/
  16. char uri[160]; /*< Video stream URI (TCP or RTSP URI ground station should connect to) or port number (UDP port ground station should listen to).*/
  17. } mavlink_video_stream_information_t;
  18. #define MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN 213
  19. #define MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_MIN_LEN 213
  20. #define MAVLINK_MSG_ID_269_LEN 213
  21. #define MAVLINK_MSG_ID_269_MIN_LEN 213
  22. #define MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_CRC 109
  23. #define MAVLINK_MSG_ID_269_CRC 109
  24. #define MAVLINK_MSG_VIDEO_STREAM_INFORMATION_FIELD_NAME_LEN 32
  25. #define MAVLINK_MSG_VIDEO_STREAM_INFORMATION_FIELD_URI_LEN 160
  26. #if MAVLINK_COMMAND_24BIT
  27. #define MAVLINK_MESSAGE_INFO_VIDEO_STREAM_INFORMATION { \
  28. 269, \
  29. "VIDEO_STREAM_INFORMATION", \
  30. 12, \
  31. { { "stream_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 18, offsetof(mavlink_video_stream_information_t, stream_id) }, \
  32. { "count", NULL, MAVLINK_TYPE_UINT8_T, 0, 19, offsetof(mavlink_video_stream_information_t, count) }, \
  33. { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 20, offsetof(mavlink_video_stream_information_t, type) }, \
  34. { "flags", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_video_stream_information_t, flags) }, \
  35. { "framerate", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_video_stream_information_t, framerate) }, \
  36. { "resolution_h", NULL, MAVLINK_TYPE_UINT16_T, 0, 10, offsetof(mavlink_video_stream_information_t, resolution_h) }, \
  37. { "resolution_v", NULL, MAVLINK_TYPE_UINT16_T, 0, 12, offsetof(mavlink_video_stream_information_t, resolution_v) }, \
  38. { "bitrate", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_video_stream_information_t, bitrate) }, \
  39. { "rotation", NULL, MAVLINK_TYPE_UINT16_T, 0, 14, offsetof(mavlink_video_stream_information_t, rotation) }, \
  40. { "hfov", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_video_stream_information_t, hfov) }, \
  41. { "name", NULL, MAVLINK_TYPE_CHAR, 32, 21, offsetof(mavlink_video_stream_information_t, name) }, \
  42. { "uri", NULL, MAVLINK_TYPE_CHAR, 160, 53, offsetof(mavlink_video_stream_information_t, uri) }, \
  43. } \
  44. }
  45. #else
  46. #define MAVLINK_MESSAGE_INFO_VIDEO_STREAM_INFORMATION { \
  47. "VIDEO_STREAM_INFORMATION", \
  48. 12, \
  49. { { "stream_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 18, offsetof(mavlink_video_stream_information_t, stream_id) }, \
  50. { "count", NULL, MAVLINK_TYPE_UINT8_T, 0, 19, offsetof(mavlink_video_stream_information_t, count) }, \
  51. { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 20, offsetof(mavlink_video_stream_information_t, type) }, \
  52. { "flags", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_video_stream_information_t, flags) }, \
  53. { "framerate", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_video_stream_information_t, framerate) }, \
  54. { "resolution_h", NULL, MAVLINK_TYPE_UINT16_T, 0, 10, offsetof(mavlink_video_stream_information_t, resolution_h) }, \
  55. { "resolution_v", NULL, MAVLINK_TYPE_UINT16_T, 0, 12, offsetof(mavlink_video_stream_information_t, resolution_v) }, \
  56. { "bitrate", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_video_stream_information_t, bitrate) }, \
  57. { "rotation", NULL, MAVLINK_TYPE_UINT16_T, 0, 14, offsetof(mavlink_video_stream_information_t, rotation) }, \
  58. { "hfov", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_video_stream_information_t, hfov) }, \
  59. { "name", NULL, MAVLINK_TYPE_CHAR, 32, 21, offsetof(mavlink_video_stream_information_t, name) }, \
  60. { "uri", NULL, MAVLINK_TYPE_CHAR, 160, 53, offsetof(mavlink_video_stream_information_t, uri) }, \
  61. } \
  62. }
  63. #endif
  64. /**
  65. * @brief Pack a video_stream_information message
  66. * @param system_id ID of this system
  67. * @param component_id ID of this component (e.g. 200 for IMU)
  68. * @param msg The MAVLink message to compress the data into
  69. *
  70. * @param stream_id Video Stream ID (1 for first, 2 for second, etc.)
  71. * @param count Number of streams available.
  72. * @param type Type of stream.
  73. * @param flags Bitmap of stream status flags.
  74. * @param framerate [Hz] Frame rate.
  75. * @param resolution_h [pix] Horizontal resolution.
  76. * @param resolution_v [pix] Vertical resolution.
  77. * @param bitrate [bits/s] Bit rate.
  78. * @param rotation [deg] Video image rotation clockwise.
  79. * @param hfov [deg] Horizontal Field of view.
  80. * @param name Stream name.
  81. * @param uri Video stream URI (TCP or RTSP URI ground station should connect to) or port number (UDP port ground station should listen to).
  82. * @return length of the message in bytes (excluding serial stream start sign)
  83. */
  84. static inline uint16_t mavlink_msg_video_stream_information_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  85. uint8_t stream_id, uint8_t count, uint8_t type, uint16_t flags, float framerate, uint16_t resolution_h, uint16_t resolution_v, uint32_t bitrate, uint16_t rotation, uint16_t hfov, const char *name, const char *uri)
  86. {
  87. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  88. char buf[MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN];
  89. _mav_put_float(buf, 0, framerate);
  90. _mav_put_uint32_t(buf, 4, bitrate);
  91. _mav_put_uint16_t(buf, 8, flags);
  92. _mav_put_uint16_t(buf, 10, resolution_h);
  93. _mav_put_uint16_t(buf, 12, resolution_v);
  94. _mav_put_uint16_t(buf, 14, rotation);
  95. _mav_put_uint16_t(buf, 16, hfov);
  96. _mav_put_uint8_t(buf, 18, stream_id);
  97. _mav_put_uint8_t(buf, 19, count);
  98. _mav_put_uint8_t(buf, 20, type);
  99. _mav_put_char_array(buf, 21, name, 32);
  100. _mav_put_char_array(buf, 53, uri, 160);
  101. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN);
  102. #else
  103. mavlink_video_stream_information_t packet;
  104. packet.framerate = framerate;
  105. packet.bitrate = bitrate;
  106. packet.flags = flags;
  107. packet.resolution_h = resolution_h;
  108. packet.resolution_v = resolution_v;
  109. packet.rotation = rotation;
  110. packet.hfov = hfov;
  111. packet.stream_id = stream_id;
  112. packet.count = count;
  113. packet.type = type;
  114. mav_array_memcpy(packet.name, name, sizeof(char)*32);
  115. mav_array_memcpy(packet.uri, uri, sizeof(char)*160);
  116. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN);
  117. #endif
  118. msg->msgid = MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION;
  119. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_CRC);
  120. }
  121. /**
  122. * @brief Pack a video_stream_information message
  123. * @param system_id ID of this system
  124. * @param component_id ID of this component (e.g. 200 for IMU)
  125. * @param status MAVLink status structure
  126. * @param msg The MAVLink message to compress the data into
  127. *
  128. * @param stream_id Video Stream ID (1 for first, 2 for second, etc.)
  129. * @param count Number of streams available.
  130. * @param type Type of stream.
  131. * @param flags Bitmap of stream status flags.
  132. * @param framerate [Hz] Frame rate.
  133. * @param resolution_h [pix] Horizontal resolution.
  134. * @param resolution_v [pix] Vertical resolution.
  135. * @param bitrate [bits/s] Bit rate.
  136. * @param rotation [deg] Video image rotation clockwise.
  137. * @param hfov [deg] Horizontal Field of view.
  138. * @param name Stream name.
  139. * @param uri Video stream URI (TCP or RTSP URI ground station should connect to) or port number (UDP port ground station should listen to).
  140. * @return length of the message in bytes (excluding serial stream start sign)
  141. */
  142. static inline uint16_t mavlink_msg_video_stream_information_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
  143. uint8_t stream_id, uint8_t count, uint8_t type, uint16_t flags, float framerate, uint16_t resolution_h, uint16_t resolution_v, uint32_t bitrate, uint16_t rotation, uint16_t hfov, const char *name, const char *uri)
  144. {
  145. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  146. char buf[MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN];
  147. _mav_put_float(buf, 0, framerate);
  148. _mav_put_uint32_t(buf, 4, bitrate);
  149. _mav_put_uint16_t(buf, 8, flags);
  150. _mav_put_uint16_t(buf, 10, resolution_h);
  151. _mav_put_uint16_t(buf, 12, resolution_v);
  152. _mav_put_uint16_t(buf, 14, rotation);
  153. _mav_put_uint16_t(buf, 16, hfov);
  154. _mav_put_uint8_t(buf, 18, stream_id);
  155. _mav_put_uint8_t(buf, 19, count);
  156. _mav_put_uint8_t(buf, 20, type);
  157. _mav_put_char_array(buf, 21, name, 32);
  158. _mav_put_char_array(buf, 53, uri, 160);
  159. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN);
  160. #else
  161. mavlink_video_stream_information_t packet;
  162. packet.framerate = framerate;
  163. packet.bitrate = bitrate;
  164. packet.flags = flags;
  165. packet.resolution_h = resolution_h;
  166. packet.resolution_v = resolution_v;
  167. packet.rotation = rotation;
  168. packet.hfov = hfov;
  169. packet.stream_id = stream_id;
  170. packet.count = count;
  171. packet.type = type;
  172. mav_array_memcpy(packet.name, name, sizeof(char)*32);
  173. mav_array_memcpy(packet.uri, uri, sizeof(char)*160);
  174. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN);
  175. #endif
  176. msg->msgid = MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION;
  177. #if MAVLINK_CRC_EXTRA
  178. return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_CRC);
  179. #else
  180. return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN);
  181. #endif
  182. }
  183. /**
  184. * @brief Pack a video_stream_information message on a channel
  185. * @param system_id ID of this system
  186. * @param component_id ID of this component (e.g. 200 for IMU)
  187. * @param chan The MAVLink channel this message will be sent over
  188. * @param msg The MAVLink message to compress the data into
  189. * @param stream_id Video Stream ID (1 for first, 2 for second, etc.)
  190. * @param count Number of streams available.
  191. * @param type Type of stream.
  192. * @param flags Bitmap of stream status flags.
  193. * @param framerate [Hz] Frame rate.
  194. * @param resolution_h [pix] Horizontal resolution.
  195. * @param resolution_v [pix] Vertical resolution.
  196. * @param bitrate [bits/s] Bit rate.
  197. * @param rotation [deg] Video image rotation clockwise.
  198. * @param hfov [deg] Horizontal Field of view.
  199. * @param name Stream name.
  200. * @param uri Video stream URI (TCP or RTSP URI ground station should connect to) or port number (UDP port ground station should listen to).
  201. * @return length of the message in bytes (excluding serial stream start sign)
  202. */
  203. static inline uint16_t mavlink_msg_video_stream_information_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  204. mavlink_message_t* msg,
  205. uint8_t stream_id,uint8_t count,uint8_t type,uint16_t flags,float framerate,uint16_t resolution_h,uint16_t resolution_v,uint32_t bitrate,uint16_t rotation,uint16_t hfov,const char *name,const char *uri)
  206. {
  207. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  208. char buf[MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN];
  209. _mav_put_float(buf, 0, framerate);
  210. _mav_put_uint32_t(buf, 4, bitrate);
  211. _mav_put_uint16_t(buf, 8, flags);
  212. _mav_put_uint16_t(buf, 10, resolution_h);
  213. _mav_put_uint16_t(buf, 12, resolution_v);
  214. _mav_put_uint16_t(buf, 14, rotation);
  215. _mav_put_uint16_t(buf, 16, hfov);
  216. _mav_put_uint8_t(buf, 18, stream_id);
  217. _mav_put_uint8_t(buf, 19, count);
  218. _mav_put_uint8_t(buf, 20, type);
  219. _mav_put_char_array(buf, 21, name, 32);
  220. _mav_put_char_array(buf, 53, uri, 160);
  221. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN);
  222. #else
  223. mavlink_video_stream_information_t packet;
  224. packet.framerate = framerate;
  225. packet.bitrate = bitrate;
  226. packet.flags = flags;
  227. packet.resolution_h = resolution_h;
  228. packet.resolution_v = resolution_v;
  229. packet.rotation = rotation;
  230. packet.hfov = hfov;
  231. packet.stream_id = stream_id;
  232. packet.count = count;
  233. packet.type = type;
  234. mav_array_memcpy(packet.name, name, sizeof(char)*32);
  235. mav_array_memcpy(packet.uri, uri, sizeof(char)*160);
  236. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN);
  237. #endif
  238. msg->msgid = MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION;
  239. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_CRC);
  240. }
  241. /**
  242. * @brief Encode a video_stream_information struct
  243. *
  244. * @param system_id ID of this system
  245. * @param component_id ID of this component (e.g. 200 for IMU)
  246. * @param msg The MAVLink message to compress the data into
  247. * @param video_stream_information C-struct to read the message contents from
  248. */
  249. static inline uint16_t mavlink_msg_video_stream_information_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_video_stream_information_t* video_stream_information)
  250. {
  251. return mavlink_msg_video_stream_information_pack(system_id, component_id, msg, video_stream_information->stream_id, video_stream_information->count, video_stream_information->type, video_stream_information->flags, video_stream_information->framerate, video_stream_information->resolution_h, video_stream_information->resolution_v, video_stream_information->bitrate, video_stream_information->rotation, video_stream_information->hfov, video_stream_information->name, video_stream_information->uri);
  252. }
  253. /**
  254. * @brief Encode a video_stream_information struct on a channel
  255. *
  256. * @param system_id ID of this system
  257. * @param component_id ID of this component (e.g. 200 for IMU)
  258. * @param chan The MAVLink channel this message will be sent over
  259. * @param msg The MAVLink message to compress the data into
  260. * @param video_stream_information C-struct to read the message contents from
  261. */
  262. static inline uint16_t mavlink_msg_video_stream_information_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_video_stream_information_t* video_stream_information)
  263. {
  264. return mavlink_msg_video_stream_information_pack_chan(system_id, component_id, chan, msg, video_stream_information->stream_id, video_stream_information->count, video_stream_information->type, video_stream_information->flags, video_stream_information->framerate, video_stream_information->resolution_h, video_stream_information->resolution_v, video_stream_information->bitrate, video_stream_information->rotation, video_stream_information->hfov, video_stream_information->name, video_stream_information->uri);
  265. }
  266. /**
  267. * @brief Encode a video_stream_information struct with provided status structure
  268. *
  269. * @param system_id ID of this system
  270. * @param component_id ID of this component (e.g. 200 for IMU)
  271. * @param status MAVLink status structure
  272. * @param msg The MAVLink message to compress the data into
  273. * @param video_stream_information C-struct to read the message contents from
  274. */
  275. static inline uint16_t mavlink_msg_video_stream_information_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_video_stream_information_t* video_stream_information)
  276. {
  277. return mavlink_msg_video_stream_information_pack_status(system_id, component_id, _status, msg, video_stream_information->stream_id, video_stream_information->count, video_stream_information->type, video_stream_information->flags, video_stream_information->framerate, video_stream_information->resolution_h, video_stream_information->resolution_v, video_stream_information->bitrate, video_stream_information->rotation, video_stream_information->hfov, video_stream_information->name, video_stream_information->uri);
  278. }
  279. /**
  280. * @brief Send a video_stream_information message
  281. * @param chan MAVLink channel to send the message
  282. *
  283. * @param stream_id Video Stream ID (1 for first, 2 for second, etc.)
  284. * @param count Number of streams available.
  285. * @param type Type of stream.
  286. * @param flags Bitmap of stream status flags.
  287. * @param framerate [Hz] Frame rate.
  288. * @param resolution_h [pix] Horizontal resolution.
  289. * @param resolution_v [pix] Vertical resolution.
  290. * @param bitrate [bits/s] Bit rate.
  291. * @param rotation [deg] Video image rotation clockwise.
  292. * @param hfov [deg] Horizontal Field of view.
  293. * @param name Stream name.
  294. * @param uri Video stream URI (TCP or RTSP URI ground station should connect to) or port number (UDP port ground station should listen to).
  295. */
  296. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  297. static inline void mavlink_msg_video_stream_information_send(mavlink_channel_t chan, uint8_t stream_id, uint8_t count, uint8_t type, uint16_t flags, float framerate, uint16_t resolution_h, uint16_t resolution_v, uint32_t bitrate, uint16_t rotation, uint16_t hfov, const char *name, const char *uri)
  298. {
  299. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  300. char buf[MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN];
  301. _mav_put_float(buf, 0, framerate);
  302. _mav_put_uint32_t(buf, 4, bitrate);
  303. _mav_put_uint16_t(buf, 8, flags);
  304. _mav_put_uint16_t(buf, 10, resolution_h);
  305. _mav_put_uint16_t(buf, 12, resolution_v);
  306. _mav_put_uint16_t(buf, 14, rotation);
  307. _mav_put_uint16_t(buf, 16, hfov);
  308. _mav_put_uint8_t(buf, 18, stream_id);
  309. _mav_put_uint8_t(buf, 19, count);
  310. _mav_put_uint8_t(buf, 20, type);
  311. _mav_put_char_array(buf, 21, name, 32);
  312. _mav_put_char_array(buf, 53, uri, 160);
  313. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION, buf, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_CRC);
  314. #else
  315. mavlink_video_stream_information_t packet;
  316. packet.framerate = framerate;
  317. packet.bitrate = bitrate;
  318. packet.flags = flags;
  319. packet.resolution_h = resolution_h;
  320. packet.resolution_v = resolution_v;
  321. packet.rotation = rotation;
  322. packet.hfov = hfov;
  323. packet.stream_id = stream_id;
  324. packet.count = count;
  325. packet.type = type;
  326. mav_array_memcpy(packet.name, name, sizeof(char)*32);
  327. mav_array_memcpy(packet.uri, uri, sizeof(char)*160);
  328. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION, (const char *)&packet, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_CRC);
  329. #endif
  330. }
  331. /**
  332. * @brief Send a video_stream_information message
  333. * @param chan MAVLink channel to send the message
  334. * @param struct The MAVLink struct to serialize
  335. */
  336. static inline void mavlink_msg_video_stream_information_send_struct(mavlink_channel_t chan, const mavlink_video_stream_information_t* video_stream_information)
  337. {
  338. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  339. mavlink_msg_video_stream_information_send(chan, video_stream_information->stream_id, video_stream_information->count, video_stream_information->type, video_stream_information->flags, video_stream_information->framerate, video_stream_information->resolution_h, video_stream_information->resolution_v, video_stream_information->bitrate, video_stream_information->rotation, video_stream_information->hfov, video_stream_information->name, video_stream_information->uri);
  340. #else
  341. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION, (const char *)video_stream_information, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_CRC);
  342. #endif
  343. }
  344. #if MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  345. /*
  346. This variant of _send() can be used to save stack space by re-using
  347. memory from the receive buffer. The caller provides a
  348. mavlink_message_t which is the size of a full mavlink message. This
  349. is usually the receive buffer for the channel, and allows a reply to an
  350. incoming message with minimum stack space usage.
  351. */
  352. static inline void mavlink_msg_video_stream_information_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t stream_id, uint8_t count, uint8_t type, uint16_t flags, float framerate, uint16_t resolution_h, uint16_t resolution_v, uint32_t bitrate, uint16_t rotation, uint16_t hfov, const char *name, const char *uri)
  353. {
  354. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  355. char *buf = (char *)msgbuf;
  356. _mav_put_float(buf, 0, framerate);
  357. _mav_put_uint32_t(buf, 4, bitrate);
  358. _mav_put_uint16_t(buf, 8, flags);
  359. _mav_put_uint16_t(buf, 10, resolution_h);
  360. _mav_put_uint16_t(buf, 12, resolution_v);
  361. _mav_put_uint16_t(buf, 14, rotation);
  362. _mav_put_uint16_t(buf, 16, hfov);
  363. _mav_put_uint8_t(buf, 18, stream_id);
  364. _mav_put_uint8_t(buf, 19, count);
  365. _mav_put_uint8_t(buf, 20, type);
  366. _mav_put_char_array(buf, 21, name, 32);
  367. _mav_put_char_array(buf, 53, uri, 160);
  368. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION, buf, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_CRC);
  369. #else
  370. mavlink_video_stream_information_t *packet = (mavlink_video_stream_information_t *)msgbuf;
  371. packet->framerate = framerate;
  372. packet->bitrate = bitrate;
  373. packet->flags = flags;
  374. packet->resolution_h = resolution_h;
  375. packet->resolution_v = resolution_v;
  376. packet->rotation = rotation;
  377. packet->hfov = hfov;
  378. packet->stream_id = stream_id;
  379. packet->count = count;
  380. packet->type = type;
  381. mav_array_memcpy(packet->name, name, sizeof(char)*32);
  382. mav_array_memcpy(packet->uri, uri, sizeof(char)*160);
  383. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION, (const char *)packet, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_CRC);
  384. #endif
  385. }
  386. #endif
  387. #endif
  388. // MESSAGE VIDEO_STREAM_INFORMATION UNPACKING
  389. /**
  390. * @brief Get field stream_id from video_stream_information message
  391. *
  392. * @return Video Stream ID (1 for first, 2 for second, etc.)
  393. */
  394. static inline uint8_t mavlink_msg_video_stream_information_get_stream_id(const mavlink_message_t* msg)
  395. {
  396. return _MAV_RETURN_uint8_t(msg, 18);
  397. }
  398. /**
  399. * @brief Get field count from video_stream_information message
  400. *
  401. * @return Number of streams available.
  402. */
  403. static inline uint8_t mavlink_msg_video_stream_information_get_count(const mavlink_message_t* msg)
  404. {
  405. return _MAV_RETURN_uint8_t(msg, 19);
  406. }
  407. /**
  408. * @brief Get field type from video_stream_information message
  409. *
  410. * @return Type of stream.
  411. */
  412. static inline uint8_t mavlink_msg_video_stream_information_get_type(const mavlink_message_t* msg)
  413. {
  414. return _MAV_RETURN_uint8_t(msg, 20);
  415. }
  416. /**
  417. * @brief Get field flags from video_stream_information message
  418. *
  419. * @return Bitmap of stream status flags.
  420. */
  421. static inline uint16_t mavlink_msg_video_stream_information_get_flags(const mavlink_message_t* msg)
  422. {
  423. return _MAV_RETURN_uint16_t(msg, 8);
  424. }
  425. /**
  426. * @brief Get field framerate from video_stream_information message
  427. *
  428. * @return [Hz] Frame rate.
  429. */
  430. static inline float mavlink_msg_video_stream_information_get_framerate(const mavlink_message_t* msg)
  431. {
  432. return _MAV_RETURN_float(msg, 0);
  433. }
  434. /**
  435. * @brief Get field resolution_h from video_stream_information message
  436. *
  437. * @return [pix] Horizontal resolution.
  438. */
  439. static inline uint16_t mavlink_msg_video_stream_information_get_resolution_h(const mavlink_message_t* msg)
  440. {
  441. return _MAV_RETURN_uint16_t(msg, 10);
  442. }
  443. /**
  444. * @brief Get field resolution_v from video_stream_information message
  445. *
  446. * @return [pix] Vertical resolution.
  447. */
  448. static inline uint16_t mavlink_msg_video_stream_information_get_resolution_v(const mavlink_message_t* msg)
  449. {
  450. return _MAV_RETURN_uint16_t(msg, 12);
  451. }
  452. /**
  453. * @brief Get field bitrate from video_stream_information message
  454. *
  455. * @return [bits/s] Bit rate.
  456. */
  457. static inline uint32_t mavlink_msg_video_stream_information_get_bitrate(const mavlink_message_t* msg)
  458. {
  459. return _MAV_RETURN_uint32_t(msg, 4);
  460. }
  461. /**
  462. * @brief Get field rotation from video_stream_information message
  463. *
  464. * @return [deg] Video image rotation clockwise.
  465. */
  466. static inline uint16_t mavlink_msg_video_stream_information_get_rotation(const mavlink_message_t* msg)
  467. {
  468. return _MAV_RETURN_uint16_t(msg, 14);
  469. }
  470. /**
  471. * @brief Get field hfov from video_stream_information message
  472. *
  473. * @return [deg] Horizontal Field of view.
  474. */
  475. static inline uint16_t mavlink_msg_video_stream_information_get_hfov(const mavlink_message_t* msg)
  476. {
  477. return _MAV_RETURN_uint16_t(msg, 16);
  478. }
  479. /**
  480. * @brief Get field name from video_stream_information message
  481. *
  482. * @return Stream name.
  483. */
  484. static inline uint16_t mavlink_msg_video_stream_information_get_name(const mavlink_message_t* msg, char *name)
  485. {
  486. return _MAV_RETURN_char_array(msg, name, 32, 21);
  487. }
  488. /**
  489. * @brief Get field uri from video_stream_information message
  490. *
  491. * @return Video stream URI (TCP or RTSP URI ground station should connect to) or port number (UDP port ground station should listen to).
  492. */
  493. static inline uint16_t mavlink_msg_video_stream_information_get_uri(const mavlink_message_t* msg, char *uri)
  494. {
  495. return _MAV_RETURN_char_array(msg, uri, 160, 53);
  496. }
  497. /**
  498. * @brief Decode a video_stream_information message into a struct
  499. *
  500. * @param msg The message to decode
  501. * @param video_stream_information C-struct to decode the message contents into
  502. */
  503. static inline void mavlink_msg_video_stream_information_decode(const mavlink_message_t* msg, mavlink_video_stream_information_t* video_stream_information)
  504. {
  505. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  506. video_stream_information->framerate = mavlink_msg_video_stream_information_get_framerate(msg);
  507. video_stream_information->bitrate = mavlink_msg_video_stream_information_get_bitrate(msg);
  508. video_stream_information->flags = mavlink_msg_video_stream_information_get_flags(msg);
  509. video_stream_information->resolution_h = mavlink_msg_video_stream_information_get_resolution_h(msg);
  510. video_stream_information->resolution_v = mavlink_msg_video_stream_information_get_resolution_v(msg);
  511. video_stream_information->rotation = mavlink_msg_video_stream_information_get_rotation(msg);
  512. video_stream_information->hfov = mavlink_msg_video_stream_information_get_hfov(msg);
  513. video_stream_information->stream_id = mavlink_msg_video_stream_information_get_stream_id(msg);
  514. video_stream_information->count = mavlink_msg_video_stream_information_get_count(msg);
  515. video_stream_information->type = mavlink_msg_video_stream_information_get_type(msg);
  516. mavlink_msg_video_stream_information_get_name(msg, video_stream_information->name);
  517. mavlink_msg_video_stream_information_get_uri(msg, video_stream_information->uri);
  518. #else
  519. uint8_t len = msg->len < MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN? msg->len : MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN;
  520. memset(video_stream_information, 0, MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION_LEN);
  521. memcpy(video_stream_information, _MAV_PAYLOAD(msg), len);
  522. #endif
  523. }