1 // Copyright 2020 The ChromiumOS Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 //! This file was generated by the following commands and modified manually. 6 //! 7 //! ```shell 8 //! $ bindgen virtio_video.h \ 9 //! --allowlist-type "virtio_video.*" \ 10 //! --allowlist-var "VIRTIO_VIDEO_.*" \ 11 //! --with-derive-default \ 12 //! --no-layout-tests \ 13 //! --no-prepend-enum-name > protocol.rs 14 //! $ sed -i "s/__u/u/g" protocol.rs 15 //! $ sed -i "s/__le/Le/g" protocol.rs 16 //! ``` 17 //! 18 //! The main points of the manual modifications are as follows: 19 //! * Removed `hdr` from each command struct so that we can read the header and a command body 20 //! separately. (cf. [related discussion](https://markmail.org/message/tr5g6axqq2zzq64y)) 21 //! * Derive implementations of AsBytes and FromBytes for each struct as needed. 22 //! * Added GET_PARAMS_EXT and SET_PARAMS_EXT to allow querying and changing the resource type 23 //! dynamically. 24 //! * Moved some definitions such as virtio_video_config to device_constants to make them visible to 25 //! vhost-user modules, and also pub-use them. 26 27 #![allow(dead_code, non_snake_case, non_camel_case_types)] 28 29 use data_model::Le32; 30 use data_model::Le64; 31 use zerocopy::AsBytes; 32 use zerocopy::FromBytes; 33 use zerocopy::FromZeroes; 34 35 pub const VIRTIO_VIDEO_MAX_PLANES: u32 = 8; 36 pub const VIRTIO_VIDEO_FORMAT_RAW_MIN: virtio_video_format = 1; 37 pub const VIRTIO_VIDEO_FORMAT_ARGB8888: virtio_video_format = 1; 38 pub const VIRTIO_VIDEO_FORMAT_BGRA8888: virtio_video_format = 2; 39 pub const VIRTIO_VIDEO_FORMAT_NV12: virtio_video_format = 3; 40 pub const VIRTIO_VIDEO_FORMAT_YUV420: virtio_video_format = 4; 41 pub const VIRTIO_VIDEO_FORMAT_YVU420: virtio_video_format = 5; 42 pub const VIRTIO_VIDEO_FORMAT_RAW_MAX: virtio_video_format = 5; 43 pub const VIRTIO_VIDEO_FORMAT_CODED_MIN: virtio_video_format = 4096; 44 pub const VIRTIO_VIDEO_FORMAT_MPEG2: virtio_video_format = 4096; 45 pub const VIRTIO_VIDEO_FORMAT_MPEG4: virtio_video_format = 4097; 46 pub const VIRTIO_VIDEO_FORMAT_H264: virtio_video_format = 4098; 47 pub const VIRTIO_VIDEO_FORMAT_HEVC: virtio_video_format = 4099; 48 pub const VIRTIO_VIDEO_FORMAT_VP8: virtio_video_format = 4100; 49 pub const VIRTIO_VIDEO_FORMAT_VP9: virtio_video_format = 4101; 50 pub const VIRTIO_VIDEO_FORMAT_CODED_MAX: virtio_video_format = 4101; 51 pub type virtio_video_format = u32; 52 pub const VIRTIO_VIDEO_PROFILE_H264_MIN: virtio_video_profile = 256; 53 pub const VIRTIO_VIDEO_PROFILE_H264_BASELINE: virtio_video_profile = 256; 54 pub const VIRTIO_VIDEO_PROFILE_H264_MAIN: virtio_video_profile = 257; 55 pub const VIRTIO_VIDEO_PROFILE_H264_EXTENDED: virtio_video_profile = 258; 56 pub const VIRTIO_VIDEO_PROFILE_H264_HIGH: virtio_video_profile = 259; 57 pub const VIRTIO_VIDEO_PROFILE_H264_HIGH10PROFILE: virtio_video_profile = 260; 58 pub const VIRTIO_VIDEO_PROFILE_H264_HIGH422PROFILE: virtio_video_profile = 261; 59 pub const VIRTIO_VIDEO_PROFILE_H264_HIGH444PREDICTIVEPROFILE: virtio_video_profile = 262; 60 pub const VIRTIO_VIDEO_PROFILE_H264_SCALABLEBASELINE: virtio_video_profile = 263; 61 pub const VIRTIO_VIDEO_PROFILE_H264_SCALABLEHIGH: virtio_video_profile = 264; 62 pub const VIRTIO_VIDEO_PROFILE_H264_STEREOHIGH: virtio_video_profile = 265; 63 pub const VIRTIO_VIDEO_PROFILE_H264_MULTIVIEWHIGH: virtio_video_profile = 266; 64 pub const VIRTIO_VIDEO_PROFILE_H264_MAX: virtio_video_profile = 266; 65 pub const VIRTIO_VIDEO_PROFILE_HEVC_MIN: virtio_video_profile = 512; 66 pub const VIRTIO_VIDEO_PROFILE_HEVC_MAIN: virtio_video_profile = 512; 67 pub const VIRTIO_VIDEO_PROFILE_HEVC_MAIN10: virtio_video_profile = 513; 68 pub const VIRTIO_VIDEO_PROFILE_HEVC_MAIN_STILL_PICTURE: virtio_video_profile = 514; 69 pub const VIRTIO_VIDEO_PROFILE_HEVC_MAX: virtio_video_profile = 514; 70 pub const VIRTIO_VIDEO_PROFILE_VP8_MIN: virtio_video_profile = 768; 71 pub const VIRTIO_VIDEO_PROFILE_VP8_PROFILE0: virtio_video_profile = 768; 72 pub const VIRTIO_VIDEO_PROFILE_VP8_PROFILE1: virtio_video_profile = 769; 73 pub const VIRTIO_VIDEO_PROFILE_VP8_PROFILE2: virtio_video_profile = 770; 74 pub const VIRTIO_VIDEO_PROFILE_VP8_PROFILE3: virtio_video_profile = 771; 75 pub const VIRTIO_VIDEO_PROFILE_VP8_MAX: virtio_video_profile = 771; 76 pub const VIRTIO_VIDEO_PROFILE_VP9_MIN: virtio_video_profile = 1024; 77 pub const VIRTIO_VIDEO_PROFILE_VP9_PROFILE0: virtio_video_profile = 1024; 78 pub const VIRTIO_VIDEO_PROFILE_VP9_PROFILE1: virtio_video_profile = 1025; 79 pub const VIRTIO_VIDEO_PROFILE_VP9_PROFILE2: virtio_video_profile = 1026; 80 pub const VIRTIO_VIDEO_PROFILE_VP9_PROFILE3: virtio_video_profile = 1027; 81 pub const VIRTIO_VIDEO_PROFILE_VP9_MAX: virtio_video_profile = 1027; 82 pub type virtio_video_profile = u32; 83 pub const VIRTIO_VIDEO_LEVEL_H264_MIN: virtio_video_level = 256; 84 pub const VIRTIO_VIDEO_LEVEL_H264_1_0: virtio_video_level = 256; 85 pub const VIRTIO_VIDEO_LEVEL_H264_1_1: virtio_video_level = 257; 86 pub const VIRTIO_VIDEO_LEVEL_H264_1_2: virtio_video_level = 258; 87 pub const VIRTIO_VIDEO_LEVEL_H264_1_3: virtio_video_level = 259; 88 pub const VIRTIO_VIDEO_LEVEL_H264_2_0: virtio_video_level = 260; 89 pub const VIRTIO_VIDEO_LEVEL_H264_2_1: virtio_video_level = 261; 90 pub const VIRTIO_VIDEO_LEVEL_H264_2_2: virtio_video_level = 262; 91 pub const VIRTIO_VIDEO_LEVEL_H264_3_0: virtio_video_level = 263; 92 pub const VIRTIO_VIDEO_LEVEL_H264_3_1: virtio_video_level = 264; 93 pub const VIRTIO_VIDEO_LEVEL_H264_3_2: virtio_video_level = 265; 94 pub const VIRTIO_VIDEO_LEVEL_H264_4_0: virtio_video_level = 266; 95 pub const VIRTIO_VIDEO_LEVEL_H264_4_1: virtio_video_level = 267; 96 pub const VIRTIO_VIDEO_LEVEL_H264_4_2: virtio_video_level = 268; 97 pub const VIRTIO_VIDEO_LEVEL_H264_5_0: virtio_video_level = 269; 98 pub const VIRTIO_VIDEO_LEVEL_H264_5_1: virtio_video_level = 270; 99 pub const VIRTIO_VIDEO_LEVEL_H264_MAX: virtio_video_level = 270; 100 pub type virtio_video_level = u32; 101 pub const VIRTIO_VIDEO_BITRATE_MODE_VBR: virtio_video_bitrate_mode = 0; 102 pub const VIRTIO_VIDEO_BITRATE_MODE_CBR: virtio_video_bitrate_mode = 1; 103 pub type virtio_video_bitrate_mode = u32; 104 105 pub const VIRTIO_VIDEO_CMD_QUERY_CAPABILITY: virtio_video_cmd_type = 256; 106 pub const VIRTIO_VIDEO_CMD_STREAM_CREATE: virtio_video_cmd_type = 257; 107 pub const VIRTIO_VIDEO_CMD_STREAM_DESTROY: virtio_video_cmd_type = 258; 108 pub const VIRTIO_VIDEO_CMD_STREAM_DRAIN: virtio_video_cmd_type = 259; 109 pub const VIRTIO_VIDEO_CMD_RESOURCE_CREATE: virtio_video_cmd_type = 260; 110 pub const VIRTIO_VIDEO_CMD_RESOURCE_QUEUE: virtio_video_cmd_type = 261; 111 pub const VIRTIO_VIDEO_CMD_RESOURCE_DESTROY_ALL: virtio_video_cmd_type = 262; 112 pub const VIRTIO_VIDEO_CMD_QUEUE_CLEAR: virtio_video_cmd_type = 263; 113 pub const VIRTIO_VIDEO_CMD_GET_PARAMS: virtio_video_cmd_type = 264; 114 pub const VIRTIO_VIDEO_CMD_SET_PARAMS: virtio_video_cmd_type = 265; 115 pub const VIRTIO_VIDEO_CMD_QUERY_CONTROL: virtio_video_cmd_type = 266; 116 pub const VIRTIO_VIDEO_CMD_GET_CONTROL: virtio_video_cmd_type = 267; 117 pub const VIRTIO_VIDEO_CMD_SET_CONTROL: virtio_video_cmd_type = 268; 118 pub const VIRTIO_VIDEO_CMD_GET_PARAMS_EXT: virtio_video_cmd_type = 269; 119 pub const VIRTIO_VIDEO_CMD_SET_PARAMS_EXT: virtio_video_cmd_type = 270; 120 pub const VIRTIO_VIDEO_RESP_OK_NODATA: virtio_video_cmd_type = 512; 121 pub const VIRTIO_VIDEO_RESP_OK_QUERY_CAPABILITY: virtio_video_cmd_type = 513; 122 pub const VIRTIO_VIDEO_RESP_OK_RESOURCE_QUEUE: virtio_video_cmd_type = 514; 123 pub const VIRTIO_VIDEO_RESP_OK_GET_PARAMS: virtio_video_cmd_type = 515; 124 pub const VIRTIO_VIDEO_RESP_OK_QUERY_CONTROL: virtio_video_cmd_type = 516; 125 pub const VIRTIO_VIDEO_RESP_OK_GET_CONTROL: virtio_video_cmd_type = 517; 126 pub const VIRTIO_VIDEO_RESP_ERR_INVALID_OPERATION: virtio_video_cmd_type = 768; 127 pub const VIRTIO_VIDEO_RESP_ERR_OUT_OF_MEMORY: virtio_video_cmd_type = 769; 128 pub const VIRTIO_VIDEO_RESP_ERR_INVALID_STREAM_ID: virtio_video_cmd_type = 770; 129 pub const VIRTIO_VIDEO_RESP_ERR_INVALID_RESOURCE_ID: virtio_video_cmd_type = 771; 130 pub const VIRTIO_VIDEO_RESP_ERR_INVALID_PARAMETER: virtio_video_cmd_type = 772; 131 pub const VIRTIO_VIDEO_RESP_ERR_UNSUPPORTED_CONTROL: virtio_video_cmd_type = 773; 132 pub type virtio_video_cmd_type = u32; 133 #[repr(C)] 134 #[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)] 135 pub struct virtio_video_cmd_hdr { 136 pub type_: Le32, 137 pub stream_id: Le32, 138 } 139 140 pub const VIRTIO_VIDEO_QUEUE_TYPE_INPUT: virtio_video_queue_type = 256; 141 pub const VIRTIO_VIDEO_QUEUE_TYPE_OUTPUT: virtio_video_queue_type = 257; 142 pub type virtio_video_queue_type = u32; 143 #[repr(C)] 144 #[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)] 145 pub struct virtio_video_query_capability { 146 pub queue_type: Le32, 147 pub padding: [u8; 4usize], 148 } 149 150 pub const VIRTIO_VIDEO_PLANES_LAYOUT_SINGLE_BUFFER: virtio_video_planes_layout_flag = 1; 151 pub const VIRTIO_VIDEO_PLANES_LAYOUT_PER_PLANE: virtio_video_planes_layout_flag = 2; 152 pub type virtio_video_planes_layout_flag = u32; 153 #[repr(C)] 154 #[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)] 155 pub struct virtio_video_format_range { 156 pub min: Le32, 157 pub max: Le32, 158 pub step: Le32, 159 pub padding: [u8; 4usize], 160 } 161 162 #[repr(C)] 163 #[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)] 164 pub struct virtio_video_format_frame { 165 pub width: virtio_video_format_range, 166 pub height: virtio_video_format_range, 167 pub num_rates: Le32, 168 pub padding: [u8; 4usize], 169 } 170 171 #[repr(C)] 172 #[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)] 173 pub struct virtio_video_format_desc { 174 pub mask: Le64, 175 pub format: Le32, 176 pub planes_layout: Le32, 177 pub plane_align: Le32, 178 pub num_frames: Le32, 179 } 180 181 #[repr(C)] 182 #[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)] 183 pub struct virtio_video_query_capability_resp { 184 pub hdr: virtio_video_cmd_hdr, 185 pub num_descs: Le32, 186 pub padding: [u8; 4usize], 187 } 188 189 pub const VIRTIO_VIDEO_MEM_TYPE_GUEST_PAGES: virtio_video_mem_type = 0; 190 pub const VIRTIO_VIDEO_MEM_TYPE_VIRTIO_OBJECT: virtio_video_mem_type = 1; 191 pub type virtio_video_mem_type = u32; 192 #[repr(C)] 193 #[derive(Copy, Clone, AsBytes, FromZeroes, FromBytes)] 194 pub struct virtio_video_stream_create { 195 pub in_mem_type: Le32, 196 pub out_mem_type: Le32, 197 pub coded_format: Le32, 198 pub padding: [u8; 4usize], 199 pub tag: [u8; 64usize], 200 } 201 impl Default for virtio_video_stream_create { default() -> Self202 fn default() -> Self { 203 // SAFETY: trivially safe 204 unsafe { ::std::mem::zeroed() } 205 } 206 } 207 208 #[repr(C)] 209 #[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)] 210 pub struct virtio_video_stream_destroy {} 211 212 #[repr(C)] 213 #[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)] 214 pub struct virtio_video_stream_drain {} 215 216 #[repr(C)] 217 #[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)] 218 pub struct virtio_video_mem_entry { 219 pub addr: Le64, 220 pub length: Le32, 221 pub padding: [u8; 4usize], 222 } 223 #[repr(C)] 224 #[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)] 225 pub struct virtio_video_object_entry { 226 pub uuid: [u8; 16usize], 227 } 228 229 #[repr(C)] 230 #[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)] 231 pub struct virtio_video_resource_create { 232 pub queue_type: Le32, 233 pub resource_id: Le32, 234 pub planes_layout: Le32, 235 pub num_planes: Le32, 236 pub plane_offsets: [Le32; 8usize], 237 pub num_entries: [Le32; 8usize], 238 } 239 240 #[repr(C)] 241 #[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)] 242 pub struct virtio_video_resource_queue { 243 pub queue_type: Le32, 244 pub resource_id: Le32, 245 pub timestamp: Le64, 246 pub num_data_sizes: Le32, 247 pub data_sizes: [Le32; 8usize], 248 pub padding: [u8; 4usize], 249 } 250 251 pub const VIRTIO_VIDEO_BUFFER_FLAG_ERR: virtio_video_buffer_flag = 1; 252 pub const VIRTIO_VIDEO_BUFFER_FLAG_EOS: virtio_video_buffer_flag = 2; 253 pub const VIRTIO_VIDEO_BUFFER_FLAG_IFRAME: virtio_video_buffer_flag = 4; 254 pub const VIRTIO_VIDEO_BUFFER_FLAG_PFRAME: virtio_video_buffer_flag = 8; 255 pub const VIRTIO_VIDEO_BUFFER_FLAG_BFRAME: virtio_video_buffer_flag = 16; 256 pub type virtio_video_buffer_flag = u32; 257 #[repr(C)] 258 #[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)] 259 pub struct virtio_video_resource_queue_resp { 260 pub hdr: virtio_video_cmd_hdr, 261 pub timestamp: Le64, 262 pub flags: Le32, 263 pub size: Le32, 264 } 265 266 #[repr(C)] 267 #[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)] 268 pub struct virtio_video_resource_destroy_all { 269 pub queue_type: Le32, 270 pub padding: [u8; 4usize], 271 } 272 273 #[repr(C)] 274 #[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)] 275 pub struct virtio_video_queue_clear { 276 pub queue_type: Le32, 277 pub padding: [u8; 4usize], 278 } 279 280 #[repr(C)] 281 #[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)] 282 pub struct virtio_video_plane_format { 283 pub plane_size: Le32, 284 pub stride: Le32, 285 } 286 #[repr(C)] 287 #[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)] 288 pub struct virtio_video_crop { 289 pub left: Le32, 290 pub top: Le32, 291 pub width: Le32, 292 pub height: Le32, 293 } 294 #[repr(C)] 295 #[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)] 296 pub struct virtio_video_params { 297 pub queue_type: Le32, 298 pub format: Le32, 299 pub frame_width: Le32, 300 pub frame_height: Le32, 301 pub min_buffers: Le32, 302 pub max_buffers: Le32, 303 pub crop: virtio_video_crop, 304 pub frame_rate: Le32, 305 pub num_planes: Le32, 306 pub plane_formats: [virtio_video_plane_format; 8usize], 307 } 308 #[repr(C)] 309 #[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)] 310 pub struct virtio_video_get_params { 311 pub queue_type: Le32, 312 pub padding: [u8; 4usize], 313 } 314 315 #[repr(C)] 316 #[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)] 317 pub struct virtio_video_get_params_resp { 318 pub hdr: virtio_video_cmd_hdr, 319 pub params: virtio_video_params, 320 } 321 322 #[repr(C)] 323 #[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)] 324 pub struct virtio_video_set_params { 325 pub params: virtio_video_params, 326 } 327 328 /// Extension of the {GET,SET}_PARAMS data to also include the resource type. Not including it 329 /// was an oversight and the {GET,SET}_PARAMS_EXT commands use this structure to fix it, while 330 /// the older {GET,SET}_PARAMS commands are kept for backward compatibility. 331 #[repr(C)] 332 #[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)] 333 pub struct virtio_video_params_ext { 334 pub base: virtio_video_params, 335 pub resource_type: Le32, 336 pub padding: [u8; 4usize], 337 } 338 #[repr(C)] 339 #[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)] 340 pub struct virtio_video_get_params_ext { 341 pub queue_type: Le32, 342 pub padding: [u8; 4usize], 343 } 344 345 #[repr(C)] 346 #[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)] 347 pub struct virtio_video_get_params_ext_resp { 348 pub hdr: virtio_video_cmd_hdr, 349 pub params: virtio_video_params_ext, 350 } 351 352 #[repr(C)] 353 #[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)] 354 pub struct virtio_video_set_params_ext { 355 pub params: virtio_video_params_ext, 356 } 357 358 pub const VIRTIO_VIDEO_CONTROL_BITRATE: virtio_video_control_type = 1; 359 pub const VIRTIO_VIDEO_CONTROL_PROFILE: virtio_video_control_type = 2; 360 pub const VIRTIO_VIDEO_CONTROL_LEVEL: virtio_video_control_type = 3; 361 pub const VIRTIO_VIDEO_CONTROL_FORCE_KEYFRAME: virtio_video_control_type = 4; 362 pub const VIRTIO_VIDEO_CONTROL_BITRATE_MODE: virtio_video_control_type = 5; 363 pub const VIRTIO_VIDEO_CONTROL_BITRATE_PEAK: virtio_video_control_type = 6; 364 pub const VIRTIO_VIDEO_CONTROL_PREPEND_SPSPPS_TO_IDR: virtio_video_control_type = 7; 365 pub type virtio_video_control_type = u32; 366 #[repr(C)] 367 #[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)] 368 pub struct virtio_video_query_control_profile { 369 pub format: Le32, 370 pub padding: [u8; 4usize], 371 } 372 373 #[repr(C)] 374 #[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)] 375 pub struct virtio_video_query_control_level { 376 pub format: Le32, 377 pub padding: [u8; 4usize], 378 } 379 380 #[repr(C)] 381 #[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)] 382 pub struct virtio_video_query_control { 383 pub control: Le32, 384 pub padding: [u8; 4usize], 385 } 386 387 #[repr(C)] 388 #[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)] 389 pub struct virtio_video_query_control_resp_profile { 390 pub num: Le32, 391 pub padding: [u8; 4usize], 392 } 393 394 #[repr(C)] 395 #[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)] 396 pub struct virtio_video_query_control_resp_level { 397 pub num: Le32, 398 pub padding: [u8; 4usize], 399 } 400 401 #[repr(C)] 402 #[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)] 403 pub struct virtio_video_query_control_resp { 404 pub hdr: virtio_video_cmd_hdr, 405 } 406 407 #[repr(C)] 408 #[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)] 409 pub struct virtio_video_get_control { 410 pub control: Le32, 411 pub padding: [u8; 4usize], 412 } 413 414 #[repr(C)] 415 #[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)] 416 pub struct virtio_video_control_val_bitrate { 417 pub bitrate: Le32, 418 pub padding: [u8; 4usize], 419 } 420 421 #[repr(C)] 422 #[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)] 423 pub struct virtio_video_control_val_bitrate_peak { 424 pub bitrate_peak: Le32, 425 pub padding: [u8; 4usize], 426 } 427 428 #[repr(C)] 429 #[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)] 430 pub struct virtio_video_control_val_bitrate_mode { 431 pub bitrate_mode: Le32, 432 pub padding: [u8; 4usize], 433 } 434 435 #[repr(C)] 436 #[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)] 437 pub struct virtio_video_control_val_profile { 438 pub profile: Le32, 439 pub padding: [u8; 4usize], 440 } 441 442 #[repr(C)] 443 #[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)] 444 pub struct virtio_video_control_val_level { 445 pub level: Le32, 446 pub padding: [u8; 4usize], 447 } 448 449 #[repr(C)] 450 #[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)] 451 pub struct virtio_video_control_val_prepend_spspps_to_idr { 452 pub prepend_spspps_to_idr: Le32, 453 pub padding: [u8; 4usize], 454 } 455 456 #[repr(C)] 457 #[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)] 458 pub struct virtio_video_get_control_resp { 459 pub hdr: virtio_video_cmd_hdr, 460 } 461 462 #[repr(C)] 463 #[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)] 464 pub struct virtio_video_set_control { 465 pub control: Le32, 466 pub padding: [u8; 4usize], 467 } 468 469 #[repr(C)] 470 #[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)] 471 pub struct virtio_video_set_control_resp { 472 pub hdr: virtio_video_cmd_hdr, 473 } 474 475 pub const VIRTIO_VIDEO_EVENT_ERROR: virtio_video_event_type = 256; 476 pub const VIRTIO_VIDEO_EVENT_DECODER_RESOLUTION_CHANGED: virtio_video_event_type = 512; 477 pub type virtio_video_event_type = u32; 478 #[repr(C)] 479 #[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)] 480 pub struct virtio_video_event { 481 pub event_type: Le32, 482 pub stream_id: Le32, 483 } 484