1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
// Copyright 2020 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

//! This file was generated by the following commands and modified manually.
//!
//! ```shell
//! $ bindgen virtio_video.h              \
//!     --allowlist-type "virtio_video.*" \
//!     --allowlist-var "VIRTIO_VIDEO_.*" \
//!     --with-derive-default            \
//!     --no-layout-tests                \
//!     --no-prepend-enum-name > protocol.rs
//! $ sed -i "s/__u/u/g" protocol.rs
//! $ sed -i "s/__le/Le/g" protocol.rs
//! ```
//!
//! The main points of the manual modifications are as follows:
//! * Removed `hdr` from each command struct so that we can read the header and a command body
//!   separately. (cf. [related discussion](https://markmail.org/message/tr5g6axqq2zzq64y))
//! * Derive implementations of AsBytes and FromBytes for each struct as needed.
//! * Added GET_PARAMS_EXT and SET_PARAMS_EXT to allow querying and changing the resource type
//!   dynamically.
//! * Moved some definitions such as virtio_video_config to device_constants to make them visible to
//!   vhost-user modules, and also pub-use them.

#![allow(dead_code, non_snake_case, non_camel_case_types)]

use data_model::Le32;
use data_model::Le64;
use zerocopy::AsBytes;
use zerocopy::FromBytes;
use zerocopy::FromZeroes;

pub const VIRTIO_VIDEO_MAX_PLANES: u32 = 8;
pub const VIRTIO_VIDEO_FORMAT_RAW_MIN: virtio_video_format = 1;
pub const VIRTIO_VIDEO_FORMAT_ARGB8888: virtio_video_format = 1;
pub const VIRTIO_VIDEO_FORMAT_BGRA8888: virtio_video_format = 2;
pub const VIRTIO_VIDEO_FORMAT_NV12: virtio_video_format = 3;
pub const VIRTIO_VIDEO_FORMAT_YUV420: virtio_video_format = 4;
pub const VIRTIO_VIDEO_FORMAT_YVU420: virtio_video_format = 5;
pub const VIRTIO_VIDEO_FORMAT_RAW_MAX: virtio_video_format = 5;
pub const VIRTIO_VIDEO_FORMAT_CODED_MIN: virtio_video_format = 4096;
pub const VIRTIO_VIDEO_FORMAT_MPEG2: virtio_video_format = 4096;
pub const VIRTIO_VIDEO_FORMAT_MPEG4: virtio_video_format = 4097;
pub const VIRTIO_VIDEO_FORMAT_H264: virtio_video_format = 4098;
pub const VIRTIO_VIDEO_FORMAT_HEVC: virtio_video_format = 4099;
pub const VIRTIO_VIDEO_FORMAT_VP8: virtio_video_format = 4100;
pub const VIRTIO_VIDEO_FORMAT_VP9: virtio_video_format = 4101;
pub const VIRTIO_VIDEO_FORMAT_CODED_MAX: virtio_video_format = 4101;
pub type virtio_video_format = u32;
pub const VIRTIO_VIDEO_PROFILE_H264_MIN: virtio_video_profile = 256;
pub const VIRTIO_VIDEO_PROFILE_H264_BASELINE: virtio_video_profile = 256;
pub const VIRTIO_VIDEO_PROFILE_H264_MAIN: virtio_video_profile = 257;
pub const VIRTIO_VIDEO_PROFILE_H264_EXTENDED: virtio_video_profile = 258;
pub const VIRTIO_VIDEO_PROFILE_H264_HIGH: virtio_video_profile = 259;
pub const VIRTIO_VIDEO_PROFILE_H264_HIGH10PROFILE: virtio_video_profile = 260;
pub const VIRTIO_VIDEO_PROFILE_H264_HIGH422PROFILE: virtio_video_profile = 261;
pub const VIRTIO_VIDEO_PROFILE_H264_HIGH444PREDICTIVEPROFILE: virtio_video_profile = 262;
pub const VIRTIO_VIDEO_PROFILE_H264_SCALABLEBASELINE: virtio_video_profile = 263;
pub const VIRTIO_VIDEO_PROFILE_H264_SCALABLEHIGH: virtio_video_profile = 264;
pub const VIRTIO_VIDEO_PROFILE_H264_STEREOHIGH: virtio_video_profile = 265;
pub const VIRTIO_VIDEO_PROFILE_H264_MULTIVIEWHIGH: virtio_video_profile = 266;
pub const VIRTIO_VIDEO_PROFILE_H264_MAX: virtio_video_profile = 266;
pub const VIRTIO_VIDEO_PROFILE_HEVC_MIN: virtio_video_profile = 512;
pub const VIRTIO_VIDEO_PROFILE_HEVC_MAIN: virtio_video_profile = 512;
pub const VIRTIO_VIDEO_PROFILE_HEVC_MAIN10: virtio_video_profile = 513;
pub const VIRTIO_VIDEO_PROFILE_HEVC_MAIN_STILL_PICTURE: virtio_video_profile = 514;
pub const VIRTIO_VIDEO_PROFILE_HEVC_MAX: virtio_video_profile = 514;
pub const VIRTIO_VIDEO_PROFILE_VP8_MIN: virtio_video_profile = 768;
pub const VIRTIO_VIDEO_PROFILE_VP8_PROFILE0: virtio_video_profile = 768;
pub const VIRTIO_VIDEO_PROFILE_VP8_PROFILE1: virtio_video_profile = 769;
pub const VIRTIO_VIDEO_PROFILE_VP8_PROFILE2: virtio_video_profile = 770;
pub const VIRTIO_VIDEO_PROFILE_VP8_PROFILE3: virtio_video_profile = 771;
pub const VIRTIO_VIDEO_PROFILE_VP8_MAX: virtio_video_profile = 771;
pub const VIRTIO_VIDEO_PROFILE_VP9_MIN: virtio_video_profile = 1024;
pub const VIRTIO_VIDEO_PROFILE_VP9_PROFILE0: virtio_video_profile = 1024;
pub const VIRTIO_VIDEO_PROFILE_VP9_PROFILE1: virtio_video_profile = 1025;
pub const VIRTIO_VIDEO_PROFILE_VP9_PROFILE2: virtio_video_profile = 1026;
pub const VIRTIO_VIDEO_PROFILE_VP9_PROFILE3: virtio_video_profile = 1027;
pub const VIRTIO_VIDEO_PROFILE_VP9_MAX: virtio_video_profile = 1027;
pub type virtio_video_profile = u32;
pub const VIRTIO_VIDEO_LEVEL_H264_MIN: virtio_video_level = 256;
pub const VIRTIO_VIDEO_LEVEL_H264_1_0: virtio_video_level = 256;
pub const VIRTIO_VIDEO_LEVEL_H264_1_1: virtio_video_level = 257;
pub const VIRTIO_VIDEO_LEVEL_H264_1_2: virtio_video_level = 258;
pub const VIRTIO_VIDEO_LEVEL_H264_1_3: virtio_video_level = 259;
pub const VIRTIO_VIDEO_LEVEL_H264_2_0: virtio_video_level = 260;
pub const VIRTIO_VIDEO_LEVEL_H264_2_1: virtio_video_level = 261;
pub const VIRTIO_VIDEO_LEVEL_H264_2_2: virtio_video_level = 262;
pub const VIRTIO_VIDEO_LEVEL_H264_3_0: virtio_video_level = 263;
pub const VIRTIO_VIDEO_LEVEL_H264_3_1: virtio_video_level = 264;
pub const VIRTIO_VIDEO_LEVEL_H264_3_2: virtio_video_level = 265;
pub const VIRTIO_VIDEO_LEVEL_H264_4_0: virtio_video_level = 266;
pub const VIRTIO_VIDEO_LEVEL_H264_4_1: virtio_video_level = 267;
pub const VIRTIO_VIDEO_LEVEL_H264_4_2: virtio_video_level = 268;
pub const VIRTIO_VIDEO_LEVEL_H264_5_0: virtio_video_level = 269;
pub const VIRTIO_VIDEO_LEVEL_H264_5_1: virtio_video_level = 270;
pub const VIRTIO_VIDEO_LEVEL_H264_MAX: virtio_video_level = 270;
pub type virtio_video_level = u32;
pub const VIRTIO_VIDEO_BITRATE_MODE_VBR: virtio_video_bitrate_mode = 0;
pub const VIRTIO_VIDEO_BITRATE_MODE_CBR: virtio_video_bitrate_mode = 1;
pub type virtio_video_bitrate_mode = u32;

pub const VIRTIO_VIDEO_CMD_QUERY_CAPABILITY: virtio_video_cmd_type = 256;
pub const VIRTIO_VIDEO_CMD_STREAM_CREATE: virtio_video_cmd_type = 257;
pub const VIRTIO_VIDEO_CMD_STREAM_DESTROY: virtio_video_cmd_type = 258;
pub const VIRTIO_VIDEO_CMD_STREAM_DRAIN: virtio_video_cmd_type = 259;
pub const VIRTIO_VIDEO_CMD_RESOURCE_CREATE: virtio_video_cmd_type = 260;
pub const VIRTIO_VIDEO_CMD_RESOURCE_QUEUE: virtio_video_cmd_type = 261;
pub const VIRTIO_VIDEO_CMD_RESOURCE_DESTROY_ALL: virtio_video_cmd_type = 262;
pub const VIRTIO_VIDEO_CMD_QUEUE_CLEAR: virtio_video_cmd_type = 263;
pub const VIRTIO_VIDEO_CMD_GET_PARAMS: virtio_video_cmd_type = 264;
pub const VIRTIO_VIDEO_CMD_SET_PARAMS: virtio_video_cmd_type = 265;
pub const VIRTIO_VIDEO_CMD_QUERY_CONTROL: virtio_video_cmd_type = 266;
pub const VIRTIO_VIDEO_CMD_GET_CONTROL: virtio_video_cmd_type = 267;
pub const VIRTIO_VIDEO_CMD_SET_CONTROL: virtio_video_cmd_type = 268;
pub const VIRTIO_VIDEO_CMD_GET_PARAMS_EXT: virtio_video_cmd_type = 269;
pub const VIRTIO_VIDEO_CMD_SET_PARAMS_EXT: virtio_video_cmd_type = 270;
pub const VIRTIO_VIDEO_RESP_OK_NODATA: virtio_video_cmd_type = 512;
pub const VIRTIO_VIDEO_RESP_OK_QUERY_CAPABILITY: virtio_video_cmd_type = 513;
pub const VIRTIO_VIDEO_RESP_OK_RESOURCE_QUEUE: virtio_video_cmd_type = 514;
pub const VIRTIO_VIDEO_RESP_OK_GET_PARAMS: virtio_video_cmd_type = 515;
pub const VIRTIO_VIDEO_RESP_OK_QUERY_CONTROL: virtio_video_cmd_type = 516;
pub const VIRTIO_VIDEO_RESP_OK_GET_CONTROL: virtio_video_cmd_type = 517;
pub const VIRTIO_VIDEO_RESP_ERR_INVALID_OPERATION: virtio_video_cmd_type = 768;
pub const VIRTIO_VIDEO_RESP_ERR_OUT_OF_MEMORY: virtio_video_cmd_type = 769;
pub const VIRTIO_VIDEO_RESP_ERR_INVALID_STREAM_ID: virtio_video_cmd_type = 770;
pub const VIRTIO_VIDEO_RESP_ERR_INVALID_RESOURCE_ID: virtio_video_cmd_type = 771;
pub const VIRTIO_VIDEO_RESP_ERR_INVALID_PARAMETER: virtio_video_cmd_type = 772;
pub const VIRTIO_VIDEO_RESP_ERR_UNSUPPORTED_CONTROL: virtio_video_cmd_type = 773;
pub type virtio_video_cmd_type = u32;
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)]
pub struct virtio_video_cmd_hdr {
    pub type_: Le32,
    pub stream_id: Le32,
}

pub const VIRTIO_VIDEO_QUEUE_TYPE_INPUT: virtio_video_queue_type = 256;
pub const VIRTIO_VIDEO_QUEUE_TYPE_OUTPUT: virtio_video_queue_type = 257;
pub type virtio_video_queue_type = u32;
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)]
pub struct virtio_video_query_capability {
    pub queue_type: Le32,
    pub padding: [u8; 4usize],
}

pub const VIRTIO_VIDEO_PLANES_LAYOUT_SINGLE_BUFFER: virtio_video_planes_layout_flag = 1;
pub const VIRTIO_VIDEO_PLANES_LAYOUT_PER_PLANE: virtio_video_planes_layout_flag = 2;
pub type virtio_video_planes_layout_flag = u32;
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)]
pub struct virtio_video_format_range {
    pub min: Le32,
    pub max: Le32,
    pub step: Le32,
    pub padding: [u8; 4usize],
}

#[repr(C)]
#[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)]
pub struct virtio_video_format_frame {
    pub width: virtio_video_format_range,
    pub height: virtio_video_format_range,
    pub num_rates: Le32,
    pub padding: [u8; 4usize],
}

#[repr(C)]
#[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)]
pub struct virtio_video_format_desc {
    pub mask: Le64,
    pub format: Le32,
    pub planes_layout: Le32,
    pub plane_align: Le32,
    pub num_frames: Le32,
}

#[repr(C)]
#[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)]
pub struct virtio_video_query_capability_resp {
    pub hdr: virtio_video_cmd_hdr,
    pub num_descs: Le32,
    pub padding: [u8; 4usize],
}

pub const VIRTIO_VIDEO_MEM_TYPE_GUEST_PAGES: virtio_video_mem_type = 0;
pub const VIRTIO_VIDEO_MEM_TYPE_VIRTIO_OBJECT: virtio_video_mem_type = 1;
pub type virtio_video_mem_type = u32;
#[repr(C)]
#[derive(Copy, Clone, AsBytes, FromZeroes, FromBytes)]
pub struct virtio_video_stream_create {
    pub in_mem_type: Le32,
    pub out_mem_type: Le32,
    pub coded_format: Le32,
    pub padding: [u8; 4usize],
    pub tag: [u8; 64usize],
}
impl Default for virtio_video_stream_create {
    fn default() -> Self {
        // SAFETY: trivially safe
        unsafe { ::std::mem::zeroed() }
    }
}

#[repr(C)]
#[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)]
pub struct virtio_video_stream_destroy {}

#[repr(C)]
#[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)]
pub struct virtio_video_stream_drain {}

#[repr(C)]
#[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)]
pub struct virtio_video_mem_entry {
    pub addr: Le64,
    pub length: Le32,
    pub padding: [u8; 4usize],
}
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)]
pub struct virtio_video_object_entry {
    pub uuid: [u8; 16usize],
}

#[repr(C)]
#[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)]
pub struct virtio_video_resource_create {
    pub queue_type: Le32,
    pub resource_id: Le32,
    pub planes_layout: Le32,
    pub num_planes: Le32,
    pub plane_offsets: [Le32; 8usize],
    pub num_entries: [Le32; 8usize],
}

#[repr(C)]
#[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)]
pub struct virtio_video_resource_queue {
    pub queue_type: Le32,
    pub resource_id: Le32,
    pub timestamp: Le64,
    pub num_data_sizes: Le32,
    pub data_sizes: [Le32; 8usize],
    pub padding: [u8; 4usize],
}

pub const VIRTIO_VIDEO_BUFFER_FLAG_ERR: virtio_video_buffer_flag = 1;
pub const VIRTIO_VIDEO_BUFFER_FLAG_EOS: virtio_video_buffer_flag = 2;
pub const VIRTIO_VIDEO_BUFFER_FLAG_IFRAME: virtio_video_buffer_flag = 4;
pub const VIRTIO_VIDEO_BUFFER_FLAG_PFRAME: virtio_video_buffer_flag = 8;
pub const VIRTIO_VIDEO_BUFFER_FLAG_BFRAME: virtio_video_buffer_flag = 16;
pub type virtio_video_buffer_flag = u32;
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)]
pub struct virtio_video_resource_queue_resp {
    pub hdr: virtio_video_cmd_hdr,
    pub timestamp: Le64,
    pub flags: Le32,
    pub size: Le32,
}

#[repr(C)]
#[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)]
pub struct virtio_video_resource_destroy_all {
    pub queue_type: Le32,
    pub padding: [u8; 4usize],
}

#[repr(C)]
#[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)]
pub struct virtio_video_queue_clear {
    pub queue_type: Le32,
    pub padding: [u8; 4usize],
}

#[repr(C)]
#[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)]
pub struct virtio_video_plane_format {
    pub plane_size: Le32,
    pub stride: Le32,
}
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)]
pub struct virtio_video_crop {
    pub left: Le32,
    pub top: Le32,
    pub width: Le32,
    pub height: Le32,
}
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)]
pub struct virtio_video_params {
    pub queue_type: Le32,
    pub format: Le32,
    pub frame_width: Le32,
    pub frame_height: Le32,
    pub min_buffers: Le32,
    pub max_buffers: Le32,
    pub crop: virtio_video_crop,
    pub frame_rate: Le32,
    pub num_planes: Le32,
    pub plane_formats: [virtio_video_plane_format; 8usize],
}
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)]
pub struct virtio_video_get_params {
    pub queue_type: Le32,
    pub padding: [u8; 4usize],
}

#[repr(C)]
#[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)]
pub struct virtio_video_get_params_resp {
    pub hdr: virtio_video_cmd_hdr,
    pub params: virtio_video_params,
}

#[repr(C)]
#[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)]
pub struct virtio_video_set_params {
    pub params: virtio_video_params,
}

/// Extension of the {GET,SET}_PARAMS data to also include the resource type. Not including it
/// was an oversight and the {GET,SET}_PARAMS_EXT commands use this structure to fix it, while
/// the older {GET,SET}_PARAMS commands are kept for backward compatibility.
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)]
pub struct virtio_video_params_ext {
    pub base: virtio_video_params,
    pub resource_type: Le32,
    pub padding: [u8; 4usize],
}
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)]
pub struct virtio_video_get_params_ext {
    pub queue_type: Le32,
    pub padding: [u8; 4usize],
}

#[repr(C)]
#[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)]
pub struct virtio_video_get_params_ext_resp {
    pub hdr: virtio_video_cmd_hdr,
    pub params: virtio_video_params_ext,
}

#[repr(C)]
#[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)]
pub struct virtio_video_set_params_ext {
    pub params: virtio_video_params_ext,
}

pub const VIRTIO_VIDEO_CONTROL_BITRATE: virtio_video_control_type = 1;
pub const VIRTIO_VIDEO_CONTROL_PROFILE: virtio_video_control_type = 2;
pub const VIRTIO_VIDEO_CONTROL_LEVEL: virtio_video_control_type = 3;
pub const VIRTIO_VIDEO_CONTROL_FORCE_KEYFRAME: virtio_video_control_type = 4;
pub const VIRTIO_VIDEO_CONTROL_BITRATE_MODE: virtio_video_control_type = 5;
pub const VIRTIO_VIDEO_CONTROL_BITRATE_PEAK: virtio_video_control_type = 6;
pub const VIRTIO_VIDEO_CONTROL_PREPEND_SPSPPS_TO_IDR: virtio_video_control_type = 7;
pub type virtio_video_control_type = u32;
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)]
pub struct virtio_video_query_control_profile {
    pub format: Le32,
    pub padding: [u8; 4usize],
}

#[repr(C)]
#[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)]
pub struct virtio_video_query_control_level {
    pub format: Le32,
    pub padding: [u8; 4usize],
}

#[repr(C)]
#[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)]
pub struct virtio_video_query_control {
    pub control: Le32,
    pub padding: [u8; 4usize],
}

#[repr(C)]
#[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)]
pub struct virtio_video_query_control_resp_profile {
    pub num: Le32,
    pub padding: [u8; 4usize],
}

#[repr(C)]
#[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)]
pub struct virtio_video_query_control_resp_level {
    pub num: Le32,
    pub padding: [u8; 4usize],
}

#[repr(C)]
#[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)]
pub struct virtio_video_query_control_resp {
    pub hdr: virtio_video_cmd_hdr,
}

#[repr(C)]
#[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)]
pub struct virtio_video_get_control {
    pub control: Le32,
    pub padding: [u8; 4usize],
}

#[repr(C)]
#[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)]
pub struct virtio_video_control_val_bitrate {
    pub bitrate: Le32,
    pub padding: [u8; 4usize],
}

#[repr(C)]
#[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)]
pub struct virtio_video_control_val_bitrate_peak {
    pub bitrate_peak: Le32,
    pub padding: [u8; 4usize],
}

#[repr(C)]
#[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)]
pub struct virtio_video_control_val_bitrate_mode {
    pub bitrate_mode: Le32,
    pub padding: [u8; 4usize],
}

#[repr(C)]
#[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)]
pub struct virtio_video_control_val_profile {
    pub profile: Le32,
    pub padding: [u8; 4usize],
}

#[repr(C)]
#[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)]
pub struct virtio_video_control_val_level {
    pub level: Le32,
    pub padding: [u8; 4usize],
}

#[repr(C)]
#[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)]
pub struct virtio_video_control_val_prepend_spspps_to_idr {
    pub prepend_spspps_to_idr: Le32,
    pub padding: [u8; 4usize],
}

#[repr(C)]
#[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)]
pub struct virtio_video_get_control_resp {
    pub hdr: virtio_video_cmd_hdr,
}

#[repr(C)]
#[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)]
pub struct virtio_video_set_control {
    pub control: Le32,
    pub padding: [u8; 4usize],
}

#[repr(C)]
#[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)]
pub struct virtio_video_set_control_resp {
    pub hdr: virtio_video_cmd_hdr,
}

pub const VIRTIO_VIDEO_EVENT_ERROR: virtio_video_event_type = 256;
pub const VIRTIO_VIDEO_EVENT_DECODER_RESOLUTION_CHANGED: virtio_video_event_type = 512;
pub type virtio_video_event_type = u32;
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, AsBytes, FromZeroes, FromBytes)]
pub struct virtio_video_event {
    pub event_type: Le32,
    pub stream_id: Le32,
}