Skip to main content

mx_remote_ffi/
bits.rs

1// Author: Lars Op den Kamp (lars@opdenkamp-it.nl)
2// Copyright (c) 2026 Op den Kamp IT Solutions
3
4//! The names behind the words the API hands over as plain integers.
5//!
6//! A feature word, a status word and a key code all cross the boundary as the
7//! integer the wire carried, because firmware sets bits and sends values this
8//! library has no name for and folding those onto a known set would lose them.
9//! What a caller needs alongside is the names, so that every consumer does not
10//! end up keeping its own copy of each bit position - which is the drift these
11//! definitions exist to end.
12//!
13//! The values are spelled out rather than derived from the core crate's own
14//! constants: cbindgen transliterates a constant's expression into the header
15//! and cannot evaluate a call, so `DeviceFeature::IR_RX.bits()` would reach C
16//! as text it cannot compile. `constants_match_the_core_crate` in
17//! `tests/abi.rs` is what holds the two copies to the same values, and
18//! `every_core_bit_has_a_name_here` is what stops one being added on one side
19//! alone.
20
21use mx_remote::{BayStatus, MxrSignalType};
22
23use crate::abi::guard;
24
25/// The signal format a device reports, packed into one 16-bit word.
26///
27/// Read it with the `mxr_signal_type_*` functions rather than by shifting it
28/// directly: the bit depth in it is an index into a table rather than a depth,
29/// and two different encodings both mean "nothing configured".
30pub type mxr_signal_type_t = u16;
31
32// ---- what a device says it can do, in `mxr_device_info_t::features` ----
33
34/// Receives infrared.
35pub const MXR_FEATURE_IR_RX: u32 = 1 << 0;
36
37/// Transmits infrared.
38pub const MXR_FEATURE_IR_TX: u32 = 1 << 1;
39
40/// Speaks CEC.
41pub const MXR_FEATURE_CEC: u32 = 1 << 2;
42
43/// Acts as a V2IP stream source.
44pub const MXR_FEATURE_V2IP_SOURCE: u32 = 1 << 3;
45
46/// Acts as a V2IP stream sink.
47pub const MXR_FEATURE_V2IP_SINK: u32 = 1 << 4;
48
49/// Routes video.
50pub const MXR_FEATURE_VIDEO_ROUTING: u32 = 1 << 5;
51
52/// Routes audio.
53pub const MXR_FEATURE_AUDIO_ROUTING: u32 = 1 << 6;
54
55/// Controls volume.
56pub const MXR_FEATURE_VOLUME_CONTROL: u32 = 1 << 7;
57
58/// Supports audio return.
59pub const MXR_FEATURE_AUDIO_RETURN: u32 = 1 << 8;
60
61/// Passes remote-control commands through.
62pub const MXR_FEATURE_REMOTE_CONTROL: u32 = 1 << 9;
63
64/// Installer setup has been completed.
65pub const MXR_FEATURE_SETUP_COMPLETED: u32 = 1 << 10;
66
67/// Is the master of its mesh.
68pub const MXR_FEATURE_MESH_MASTER: u32 = 1 << 11;
69
70/// Has a notification pending.
71pub const MXR_FEATURE_STATUS_NOTIFY: u32 = 1 << 12;
72
73/// Has a warning pending.
74pub const MXR_FEATURE_STATUS_WARNING: u32 = 1 << 13;
75
76/// Has an error pending.
77pub const MXR_FEATURE_STATUS_ERROR: u32 = 1 << 14;
78
79/// Is about to reboot.
80pub const MXR_FEATURE_STATUS_REBOOT: u32 = 1 << 15;
81
82/// Is a member of a mesh.
83pub const MXR_FEATURE_MESH_MEMBER: u32 = 1 << 16;
84
85/// Is an audio amplifier.
86pub const MXR_FEATURE_AUDIO_AMPLIFIER: u32 = 1 << 17;
87
88/// Is still booting.
89pub const MXR_FEATURE_BOOTING: u32 = 1 << 18;
90
91/// Is a management client rather than a device.
92pub const MXR_FEATURE_MANAGER: u32 = 1 << 19;
93
94/// Is in power-save mode.
95pub const MXR_FEATURE_STATUS_POWER_SAVE: u32 = 1 << 20;
96
97/// Supports meshing.
98pub const MXR_FEATURE_MESH: u32 = 1 << 21;
99
100/// Is a multiviewer.
101pub const MXR_FEATURE_MULTIVIEWER: u32 = 1 << 22;
102
103/// Has crashed since it last booted.
104pub const MXR_FEATURE_STATUS_CRASHED: u32 = 1 << 23;
105
106/// Supports video walls.
107pub const MXR_FEATURE_VIDEO_WALL: u32 = 1 << 24;
108
109/// Initialises the configuration it broadcasts.
110///
111/// Firmware without this bit sends a device configuration built over
112/// uninitialised memory, so fields it did not mean to write carry junk.
113pub const MXR_FEATURE_CONFIG_INITIALISED: u32 = 1 << 25;
114
115/// Receives one or more peers only by broadcast, because its multicast receive
116/// path is faulty.
117pub const MXR_FEATURE_STATUS_MCAST_FAULT: u32 = 1 << 26;
118
119/// Powers its video processor down in power save. A device without it refuses
120/// to enter power save.
121pub const MXR_FEATURE_POWER_SAVE: u32 = 1 << 27;
122
123/// Tags its uplink by the VLAN configuration it reports, and takes one written
124/// to it.
125pub const MXR_FEATURE_VLAN: u32 = 1 << 28;
126
127/// Copies the overlay settings and logos of another unit when asked.
128pub const MXR_FEATURE_OSD_SYNC: u32 = 1 << 29;
129
130/// Is downloading or installing a firmware or video processor upgrade.
131/// `MXR_FEATURE_STATUS_REBOOT` follows when it reboots to complete it.
132pub const MXR_FEATURE_STATUS_UPGRADING: u32 = 1 << 30;
133
134/// Flips on every reboot, so a peer that sees it change knows the device restarted.
135pub const MXR_FEATURE_BOOT_BIT: u32 = 1 << 31;
136
137// ---- what a bay is wired for, in `mxr_bay_info_t::features` ----
138
139/// HDMI output.
140pub const MXR_BAY_HDMI_OUT: u32 = 1 << 0;
141
142/// HDMI input.
143pub const MXR_BAY_HDMI_IN: u32 = 1 << 1;
144
145/// Digital audio output.
146pub const MXR_BAY_AUDIO_DIG_OUT: u32 = 1 << 2;
147
148/// Digital audio input.
149pub const MXR_BAY_AUDIO_DIG_IN: u32 = 1 << 3;
150
151/// Analogue audio output.
152pub const MXR_BAY_AUDIO_ANA_OUT: u32 = 1 << 4;
153
154/// Analogue audio input.
155pub const MXR_BAY_AUDIO_ANA_IN: u32 = 1 << 5;
156
157/// Infrared input.
158pub const MXR_BAY_IR_IN: u32 = 1 << 6;
159
160/// Infrared output.
161pub const MXR_BAY_IR_OUT: u32 = 1 << 7;
162
163/// Amplified audio output.
164pub const MXR_BAY_AUDIO_AMP_OUT: u32 = 1 << 8;
165
166/// Remote-control output.
167pub const MXR_BAY_RC_OUT: u32 = 1 << 9;
168
169/// Remote-control input.
170pub const MXR_BAY_RC_IN: u32 = 1 << 10;
171
172/// Dolby decoding.
173pub const MXR_BAY_DOLBY: u32 = 1 << 11;
174
175/// Switches itself off when idle.
176pub const MXR_BAY_AUTO_OFF: u32 = 1 << 12;
177
178/// Is a remote V2IP source.
179pub const MXR_BAY_V2IP_SOURCE_REMOTE: u32 = 1 << 13;
180
181/// Is a remote V2IP sink.
182pub const MXR_BAY_V2IP_SINK_REMOTE: u32 = 1 << 14;
183
184/// Is a local V2IP source.
185pub const MXR_BAY_V2IP_SOURCE_LOCAL: u32 = 1 << 15;
186
187/// Is a local V2IP sink.
188pub const MXR_BAY_V2IP_SINK_LOCAL: u32 = 1 << 16;
189
190// ---- the live status of a bay, in `mxr_signal_details_t::status` ----
191//
192// Bits 16-19 and 22-23 are bit-fields rather than flags. Read them with
193// `mxr_bay_status_rc_type()` and `mxr_bay_status_hdcp()`.
194
195/// The bay reports a fault.
196pub const MXR_BAY_STATUS_FAULT: u32 = 1 << 0;
197
198/// The bay is hidden from the user interface.
199pub const MXR_BAY_STATUS_HIDDEN: u32 = 1 << 1;
200
201/// The amplifier zone the bay drives is powered on.
202pub const MXR_BAY_STATUS_POWERED: u32 = 1 << 2;
203
204/// A signal is present.
205pub const MXR_BAY_STATUS_SIGNAL_DETECTED: u32 = 1 << 3;
206
207/// Hot-plug detect is asserted.
208pub const MXR_BAY_STATUS_HPD_DETECTED: u32 = 1 << 4;
209
210/// The signal is scrambled.
211pub const MXR_BAY_STATUS_SIGNAL_SCRAMBLE: u32 = 1 << 5;
212
213/// An HDBaseT link is up.
214pub const MXR_BAY_STATUS_HDBT_CONNECTED: u32 = 1 << 6;
215
216/// A CEC device answered.
217pub const MXR_BAY_STATUS_CEC_DETECTED: u32 = 1 << 7;
218
219/// The attached device was powered on.
220pub const MXR_BAY_STATUS_POWERED_ON: u32 = 1 << 8;
221
222/// The attached device was powered off.
223pub const MXR_BAY_STATUS_POWERED_OFF: u32 = 1 << 9;
224
225/// Audio return over HDMI is active.
226pub const MXR_BAY_STATUS_AUDIO_ARC_HDMI: u32 = 1 << 10;
227
228/// Audio return over optical is active.
229pub const MXR_BAY_STATUS_AUDIO_ARC_OPTIC: u32 = 1 << 11;
230
231/// Audio return over analogue is active.
232pub const MXR_BAY_STATUS_AUDIO_ARC_ANALOG: u32 = 1 << 12;
233
234/// The bay is offline.
235pub const MXR_BAY_STATUS_OFFLINE: u32 = 1 << 13;
236
237/// The V2IP decoder is disabled.
238pub const MXR_BAY_STATUS_DECODER_DISABLE: u32 = 1 << 14;
239
240/// The V2IP encoder is disabled.
241pub const MXR_BAY_STATUS_ENCODER_DISABLE: u32 = 1 << 15;
242
243/// CEC is switched off for this bay.
244pub const MXR_BAY_STATUS_CEC_DISABLED: u32 = 1 << 20;
245
246/// The V2IP encoder reports an error.
247pub const MXR_BAY_STATUS_ENCODER_ERROR: u32 = 1 << 21;
248
249/// The bay's name was generated - a default, or taken from CEC or the EDID -
250/// rather than set by a user. A device that predates this bit never sets it,
251/// so a clear bit does not prove a user set the name.
252pub const MXR_BAY_STATUS_AUTO_NAME: u32 = 1 << 24;
253
254// ---- what an audio endpoint can do, in `mxr_audio_endpoint_t::features` ----
255
256/// Accepts audio.
257pub const MXR_AUDIO_INPUT: u32 = 1 << 0;
258
259/// Produces audio.
260pub const MXR_AUDIO_OUTPUT: u32 = 1 << 1;
261
262/// Sends a V2IP audio stream.
263pub const MXR_AUDIO_V2IP_TX: u32 = 1 << 2;
264
265/// Receives a V2IP audio stream.
266pub const MXR_AUDIO_V2IP_RX: u32 = 1 << 3;
267
268/// Carries HDMI audio.
269pub const MXR_AUDIO_HDMI: u32 = 1 << 4;
270
271/// Is an analogue RCA connector.
272pub const MXR_AUDIO_RCA: u32 = 1 << 5;
273
274/// Is an S/PDIF connector.
275pub const MXR_AUDIO_SPDIF: u32 = 1 << 6;
276
277/// Drives a trigger output.
278pub const MXR_AUDIO_TRIGGER: u32 = 1 << 7;
279
280/// Can be muted.
281pub const MXR_AUDIO_MUTE: u32 = 1 << 8;
282
283/// Can be routed to as an input.
284pub const MXR_AUDIO_ROUTE_INPUT: u32 = 1 << 9;
285
286/// Can be routed from as an output.
287pub const MXR_AUDIO_ROUTE_OUTPUT: u32 = 1 << 10;
288
289/// Accepts "no input" as a route.
290pub const MXR_AUDIO_ROUTE_IN_NONE: u32 = 1 << 11;
291
292/// Is an amplifier output.
293pub const MXR_AUDIO_AMP_OUTPUT: u32 = 1 << 12;
294
295/// Has a volume control.
296pub const MXR_AUDIO_VOLUME_CONTROL: u32 = 1 << 13;
297
298/// Has a gain control.
299pub const MXR_AUDIO_GAIN_CONTROL: u32 = 1 << 14;
300
301/// Keeps its audio source when the video route changes, while locked.
302pub const MXR_AUDIO_AUDIO_LOCK: u32 = 1 << 15;
303
304// ---- remote-control keys, for `mxr_send_key()` ----
305//
306// A key above the last named here is sent as it is given: the range from
307// `MXR_KEY_CUSTOM_CEC` carries a raw CEC user-control code and the one from
308// `MXR_KEY_CUSTOM_SKY` a raw Sky code, each as the base plus the code.
309
310/// Digit 0.
311pub const MXR_KEY_NUM0: u16 = 0;
312
313/// Digit 1.
314pub const MXR_KEY_NUM1: u16 = 1;
315
316/// Digit 2.
317pub const MXR_KEY_NUM2: u16 = 2;
318
319/// Digit 3.
320pub const MXR_KEY_NUM3: u16 = 3;
321
322/// Digit 4.
323pub const MXR_KEY_NUM4: u16 = 4;
324
325/// Digit 5.
326pub const MXR_KEY_NUM5: u16 = 5;
327
328/// Digit 6.
329pub const MXR_KEY_NUM6: u16 = 6;
330
331/// Digit 7.
332pub const MXR_KEY_NUM7: u16 = 7;
333
334/// Digit 8.
335pub const MXR_KEY_NUM8: u16 = 8;
336
337/// Digit 9.
338pub const MXR_KEY_NUM9: u16 = 9;
339
340/// Confirm the highlighted item.
341pub const MXR_KEY_SELECT: u16 = 10;
342
343/// Go back one step.
344pub const MXR_KEY_BACK: u16 = 11;
345
346/// Navigate up.
347pub const MXR_KEY_UP: u16 = 12;
348
349/// Navigate down.
350pub const MXR_KEY_DOWN: u16 = 13;
351
352/// Navigate left.
353pub const MXR_KEY_LEFT: u16 = 14;
354
355/// Navigate right.
356pub const MXR_KEY_RIGHT: u16 = 15;
357
358/// Open the main menu.
359pub const MXR_KEY_MENU: u16 = 16;
360
361/// Open the content menu.
362pub const MXR_KEY_CONTENT_MENU: u16 = 17;
363
364/// Next channel.
365pub const MXR_KEY_CHANNEL_UP: u16 = 18;
366
367/// Previous channel.
368pub const MXR_KEY_CHANNEL_DOWN: u16 = 19;
369
370/// Start playback.
371pub const MXR_KEY_PLAY: u16 = 20;
372
373/// Pause playback.
374pub const MXR_KEY_PAUSE: u16 = 21;
375
376/// Stop playback.
377pub const MXR_KEY_STOP: u16 = 22;
378
379/// Start recording.
380pub const MXR_KEY_RECORD: u16 = 23;
381
382/// Fast forward.
383pub const MXR_KEY_FAST_FORWARD: u16 = 24;
384
385/// Rewind.
386pub const MXR_KEY_REWIND: u16 = 25;
387
388/// Red colour key.
389pub const MXR_KEY_RED: u16 = 26;
390
391/// Green colour key.
392pub const MXR_KEY_GREEN: u16 = 27;
393
394/// Yellow colour key.
395pub const MXR_KEY_YELLOW: u16 = 28;
396
397/// Blue colour key.
398pub const MXR_KEY_BLUE: u16 = 29;
399
400/// Open help.
401pub const MXR_KEY_HELP: u16 = 30;
402
403/// Show information.
404pub const MXR_KEY_INFORMATION: u16 = 31;
405
406/// Open teletext.
407pub const MXR_KEY_TEXT: u16 = 32;
408
409/// Open the programme guide.
410pub const MXR_KEY_GUIDE: u16 = 33;
411
412/// Open video on demand.
413pub const MXR_KEY_VIDEO_ON_DEMAND: u16 = 34;
414
415/// Return to the previous channel.
416pub const MXR_KEY_PREVIOUS_CHANNEL: u16 = 80;
417
418/// Toggle 3D mode.
419pub const MXR_KEY_MODE_3D: u16 = 81;
420
421/// Toggle subtitles.
422pub const MXR_KEY_SUBTITLE: u16 = 82;
423
424/// Select an audio track.
425pub const MXR_KEY_SOUND_SELECT: u16 = 83;
426
427/// Select an input.
428pub const MXR_KEY_INPUT_SELECT: u16 = 84;
429
430/// Eject the medium.
431pub const MXR_KEY_EJECT: u16 = 85;
432
433/// Next chapter.
434pub const MXR_KEY_NEXT_CHAPTER: u16 = 86;
435
436/// Previous chapter.
437pub const MXR_KEY_PREV_CHAPTER: u16 = 87;
438
439/// Open interactive services.
440pub const MXR_KEY_INTERACTIVE: u16 = 128;
441
442/// Open search.
443pub const MXR_KEY_SEARCH: u16 = 129;
444
445/// Sky home key.
446pub const MXR_KEY_SKY: u16 = 130;
447
448/// Base of the range carrying a raw CEC user-control code.
449pub const MXR_KEY_CUSTOM_CEC: u16 = 1280;
450
451/// Base of the range carrying a raw Sky key code.
452pub const MXR_KEY_CUSTOM_SKY: u16 = 2048;
453
454// ---- multiviewer settings, for the `mxr_set_multiviewer_*` calls ----
455//
456// The same values come back in `mxr_multiviewer_status_t`, whose fields are
457// the wire's bytes rather than a decoded set: a multiviewer running firmware
458// newer than this library reports a mode named here by none of these, and
459// passing it through is what lets a caller see it at all.
460
461/// The multiviewer reports no window layout.
462pub const MXR_MV_VIEW_MODE_UNKNOWN: u8 = 0;
463
464/// One full-screen window.
465pub const MXR_MV_VIEW_MODE_SINGLE: u8 = 1;
466
467/// Picture in picture.
468pub const MXR_MV_VIEW_MODE_PIP: u8 = 2;
469
470/// Two windows, large.
471pub const MXR_MV_VIEW_MODE_TWO_SCREEN_LARGE: u8 = 3;
472
473/// Two windows, small.
474pub const MXR_MV_VIEW_MODE_TWO_SCREEN_SMALL: u8 = 4;
475
476/// Three windows, large.
477pub const MXR_MV_VIEW_MODE_THREE_SCREEN_LARGE: u8 = 5;
478
479/// Three windows, small.
480pub const MXR_MV_VIEW_MODE_THREE_SCREEN_SMALL: u8 = 6;
481
482/// Four windows, equal size.
483pub const MXR_MV_VIEW_MODE_FOUR_SCREEN_EQUAL: u8 = 7;
484
485/// Four windows, small.
486pub const MXR_MV_VIEW_MODE_FOUR_SCREEN_SMALL: u8 = 8;
487
488/// The multiviewer reports no picture-in-picture position.
489pub const MXR_MV_PIP_POSITION_UNKNOWN: u8 = 0;
490
491/// Top left.
492pub const MXR_MV_PIP_POSITION_LEFT_TOP: u8 = 1;
493
494/// Bottom left.
495pub const MXR_MV_PIP_POSITION_LEFT_BOTTOM: u8 = 2;
496
497/// Top right.
498pub const MXR_MV_PIP_POSITION_RIGHT_TOP: u8 = 3;
499
500/// Bottom right.
501pub const MXR_MV_PIP_POSITION_RIGHT_BOTTOM: u8 = 4;
502
503/// The multiviewer reports no picture-in-picture size.
504pub const MXR_MV_PIP_SIZE_UNKNOWN: u8 = 0;
505
506/// Small.
507pub const MXR_MV_PIP_SIZE_SMALL: u8 = 1;
508
509/// Medium.
510pub const MXR_MV_PIP_SIZE_MEDIUM: u8 = 2;
511
512/// Large.
513pub const MXR_MV_PIP_SIZE_LARGE: u8 = 3;
514
515/// The multiviewer reports no output mode.
516pub const MXR_MV_OUTPUT_UNKNOWN: u8 = 0;
517
518/// 4096x2160p60.
519pub const MXR_MV_OUTPUT_DCI4K_P60: u8 = 1;
520
521/// 4096x2160p50.
522pub const MXR_MV_OUTPUT_DCI4K_P50: u8 = 2;
523
524/// 3840x2160p60.
525pub const MXR_MV_OUTPUT_UHD_P60: u8 = 3;
526
527/// 3840x2160p50.
528pub const MXR_MV_OUTPUT_UHD_P50: u8 = 4;
529
530/// 3840x2160p30.
531pub const MXR_MV_OUTPUT_UHD_P30: u8 = 5;
532
533/// 3840x2160p25.
534pub const MXR_MV_OUTPUT_UHD_P25: u8 = 6;
535
536/// 1920x1200p60, reduced blanking.
537pub const MXR_MV_OUTPUT_WUXGA_P60_RB: u8 = 7;
538
539/// 1920x1080p60.
540pub const MXR_MV_OUTPUT_HD1080_P60: u8 = 8;
541
542/// 1920x1080p50.
543pub const MXR_MV_OUTPUT_HD1080_P50: u8 = 9;
544
545/// 1360x768p60.
546pub const MXR_MV_OUTPUT_WXGA_P60: u8 = 10;
547
548/// 1280x800p60.
549pub const MXR_MV_OUTPUT_WXGA800_P60: u8 = 11;
550
551/// 1280x720p60.
552pub const MXR_MV_OUTPUT_HD720_P60: u8 = 12;
553
554/// 1280x720p50.
555pub const MXR_MV_OUTPUT_HD720_P50: u8 = 13;
556
557/// 1024x768p60.
558pub const MXR_MV_OUTPUT_XGA_P60: u8 = 14;
559
560/// The multiviewer reports no HDCP mode.
561pub const MXR_MV_HDCP_UNKNOWN: u8 = 0;
562
563/// HDCP 1.4.
564pub const MXR_MV_HDCP_V14: u8 = 1;
565
566/// HDCP 2.2.
567pub const MXR_MV_HDCP_V22: u8 = 2;
568
569/// Content protection off.
570pub const MXR_MV_HDCP_OFF: u8 = 3;
571
572/// The multiviewer reports no EDID template.
573pub const MXR_MV_EDID_UNKNOWN: u8 = 0;
574
575/// 4K2K60 4:4:4, stereo 2.0.
576pub const MXR_MV_EDID_4K2K60_444_STEREO: u8 = 1;
577
578/// 4K2K60 4:4:4, Dolby/DTS 5.1.
579pub const MXR_MV_EDID_4K2K60_444_DOLBY_DTS_51: u8 = 2;
580
581/// 4K2K60 4:4:4, HD audio 7.1.
582pub const MXR_MV_EDID_4K2K60_444_HD_AUDIO_71: u8 = 3;
583
584/// 4K2K30 4:4:4, stereo 2.0.
585pub const MXR_MV_EDID_4K2K30_444_STEREO: u8 = 4;
586
587/// 4K2K30 4:4:4, Dolby/DTS 5.1.
588pub const MXR_MV_EDID_4K2K30_444_DOLBY_DTS_51: u8 = 5;
589
590/// 4K2K30 4:4:4, HD audio 7.1.
591pub const MXR_MV_EDID_4K2K30_444_HD_AUDIO_71: u8 = 6;
592
593/// 1080p, stereo 2.0.
594pub const MXR_MV_EDID_1080P_STEREO: u8 = 7;
595
596/// 1080p, Dolby/DTS 5.1.
597pub const MXR_MV_EDID_1080P_DOLBY_DTS_51: u8 = 8;
598
599/// 1080p, HD audio 7.1.
600pub const MXR_MV_EDID_1080P_HD_AUDIO_71: u8 = 9;
601
602/// 1920x1200, stereo 2.0.
603pub const MXR_MV_EDID_1920X1200_STEREO: u8 = 10;
604
605/// 1680x1050, stereo 2.0.
606pub const MXR_MV_EDID_1680X1050_STEREO: u8 = 11;
607
608/// 1600x1200, stereo 2.0.
609pub const MXR_MV_EDID_1600X1200_STEREO: u8 = 12;
610
611/// 1440x900, stereo 2.0.
612pub const MXR_MV_EDID_1440X900_STEREO: u8 = 13;
613
614/// 1360x768, stereo 2.0.
615pub const MXR_MV_EDID_1360X768_STEREO: u8 = 14;
616
617/// 1280x1024, stereo 2.0.
618pub const MXR_MV_EDID_1280X1024_STEREO: u8 = 15;
619
620/// 1024x768, stereo 2.0.
621pub const MXR_MV_EDID_1024X768_STEREO: u8 = 16;
622
623/// 720p, stereo 2.0.
624pub const MXR_MV_EDID_720P_STEREO: u8 = 17;
625
626/// Whatever the display connected to the HDMI output presents. The template a
627/// multiviewer leaves the factory with.
628pub const MXR_MV_EDID_COPY_OUTPUT: u8 = 18;
629
630/// The EDID loaded onto the device.
631pub const MXR_MV_EDID_CUSTOM: u8 = 19;
632
633/// The multiviewer reports no IT-content mode.
634pub const MXR_MV_ITC_UNKNOWN: u8 = 0;
635
636/// Video content.
637pub const MXR_MV_ITC_VIDEO: u8 = 1;
638
639/// PC content.
640pub const MXR_MV_ITC_PC: u8 = 2;
641
642/// The multiviewer reports no aspect ratio.
643pub const MXR_MV_ASPECT_UNKNOWN: u8 = 0;
644
645/// Fill the window.
646pub const MXR_MV_ASPECT_FULL: u8 = 1;
647
648/// 16:9.
649pub const MXR_MV_ASPECT_RATIO_16_9: u8 = 2;
650
651/// Off.
652pub const MXR_MV_BOOL_OFF: u8 = 0;
653
654/// On.
655pub const MXR_MV_BOOL_ON: u8 = 1;
656
657/// The multiviewer reports no value.
658pub const MXR_MV_BOOL_UNKNOWN: u8 = 255;
659
660/// The multiviewer reports no source.
661pub const MXR_MV_SOURCE_UNKNOWN: u8 = 0;
662
663/// Input 1.
664pub const MXR_MV_SOURCE_INPUT_1: u8 = 1;
665
666/// Input 2.
667pub const MXR_MV_SOURCE_INPUT_2: u8 = 2;
668
669/// Input 3.
670pub const MXR_MV_SOURCE_INPUT_3: u8 = 3;
671
672/// Input 4.
673pub const MXR_MV_SOURCE_INPUT_4: u8 = 4;
674
675// ---- V2IP device settings, in `mxr_v2ip_device_settings_t` ----
676
677/// Disables the decoder while the display is off.
678pub const MXR_V2IP_SETTING_SINK_CHECK_POWER: u32 = 1 << 0;
679
680/// Disables the HDMI output while there is no signal.
681pub const MXR_V2IP_SETTING_SINK_OFF_NO_SIGNAL: u32 = 1 << 1;
682
683/// Sends infrared modulated.
684pub const MXR_V2IP_SETTING_IR_TX_MODULATED: u32 = 1 << 2;
685
686/// Lights the status LED.
687pub const MXR_V2IP_SETTING_STATUS_LED: u32 = 1 << 3;
688
689/// Lights the network port LEDs.
690pub const MXR_V2IP_SETTING_NETWORK_LED: u32 = 1 << 4;
691
692/// Runs the fan in quiet mode.
693pub const MXR_V2IP_SETTING_FAN_QUIET: u32 = 1 << 5;
694
695/// Accepts CEC combo keys.
696pub const MXR_V2IP_SETTING_CEC_COMBO_KEYS: u32 = 1 << 6;
697
698/// Accepts CEC combo keys for the device's own input.
699pub const MXR_V2IP_SETTING_CEC_COMBO_INPUT: u32 = 1 << 7;
700
701/// The global infrared port's profile, carried in `ir_profile`.
702pub const MXR_V2IP_SETTING_IR_PROFILE: u32 = 1 << 8;
703
704/// The output infrared port's profile, carried in `ir_profile_sink`.
705pub const MXR_V2IP_SETTING_IR_PROFILE_SINK: u32 = 1 << 9;
706
707/// The stored infrared profiles, carried in `ir_profiles`. Never written.
708pub const MXR_V2IP_SETTING_IR_PROFILES: u32 = 1 << 10;
709
710/// The idle minutes before the device powers down, carried in
711/// `mxr_v2ip_power_save_t.auto_minutes`.
712pub const MXR_V2IP_SETTING_AUTO_POWER_SAVE: u32 = 1 << 11;
713
714/// The daily power save windows, carried in `mxr_v2ip_power_save_t`'s `start`
715/// and `end`.
716pub const MXR_V2IP_SETTING_POWER_SAVE_SCHEDULE: u32 = 1 << 12;
717
718/// The device's clock has been set, on/off. Never written.
719pub const MXR_V2IP_SETTING_CLOCK_SET: u32 = 1 << 13;
720
721/// The PTP mode, carried in `mxr_v2ip_ptp_settings_t`'s `mode`.
722pub const MXR_V2IP_SETTING_PTP_MODE: u32 = 1 << 14;
723
724/// The PTP domain, carried in `mxr_v2ip_ptp_settings_t`'s `domain`.
725pub const MXR_V2IP_SETTING_PTP_DOMAIN: u32 = 1 << 15;
726
727/// The PTP grandmaster priority1, carried in `mxr_v2ip_ptp_settings_t`'s
728/// `priority1`.
729pub const MXR_V2IP_SETTING_PTP_PRIORITY1: u32 = 1 << 16;
730
731/// The source's audio goes out as an AES67 flow, where the source allows. An
732/// on/off setting.
733pub const MXR_V2IP_SETTING_AES67: u32 = 1 << 17;
734
735/// The power save level, read with `mxr_v2ip_power_save_level()`.
736pub const MXR_V2IP_SETTING_POWER_SAVE_LEVEL: u32 = 1 << 18;
737
738/// The interval between PTP announce messages, carried in
739/// `mxr_v2ip_ptp_messages_t`'s `log_announce_interval`.
740pub const MXR_V2IP_SETTING_PTP_ANNOUNCE: u32 = 1 << 19;
741
742/// The interval between PTP sync messages, in `log_sync_interval`.
743pub const MXR_V2IP_SETTING_PTP_SYNC: u32 = 1 << 20;
744
745/// The interval between PTP delay requests, in `log_delay_req_interval`.
746pub const MXR_V2IP_SETTING_PTP_DELAY_REQ: u32 = 1 << 21;
747
748/// The announce intervals before a silent PTP master is dropped, in
749/// `announce_timeout`.
750pub const MXR_V2IP_SETTING_PTP_ANNOUNCE_TIMEOUT: u32 = 1 << 22;
751
752/// The DSCP of the PTP messages, in `dscp`.
753pub const MXR_V2IP_SETTING_PTP_DSCP: u32 = 1 << 23;
754
755/// The minutes after which a heard SAP announcement is forgotten, in
756/// `mxr_v2ip_ptp_messages_t`'s `sap_expire_min`.
757pub const MXR_V2IP_SETTING_SAP_EXPIRE: u32 = 1 << 24;
758
759/// Listens for SAP announcements. An on/off setting.
760pub const MXR_V2IP_SETTING_SAP_LISTEN: u32 = 1 << 25;
761
762/// Sends SAP announcements. An on/off setting.
763pub const MXR_V2IP_SETTING_SAP_ANNOUNCE: u32 = 1 << 26;
764
765/// The seconds between SAP announcements, in `sap_interval_s`.
766pub const MXR_V2IP_SETTING_SAP_INTERVAL: u32 = 1 << 27;
767
768/// Never powers down by itself; a power save request still powers it down.
769/// An on/off setting, which a power save level write switches off.
770pub const MXR_V2IP_SETTING_POWER_SAVE_DISABLED: u32 = 1 << 28;
771
772/// The TTL of the device's streams, in `mxr_v2ip_ptp_messages_t`'s
773/// `stream_ttl`. Reported only by a device with an encoder.
774pub const MXR_V2IP_SETTING_STREAM_TTL: u32 = 1 << 29;
775
776/// Connects to the cloud service. An on/off setting; a device that does not
777/// report it connects regardless.
778pub const MXR_V2IP_SETTING_CLOUD: u32 = 1 << 30;
779
780/// The TTL a V2IP device's streams carry until it is set.
781pub const MXR_V2IP_STREAM_TTL_DEFAULT: u8 = 64;
782
783// ---- what a V2IP output plays from a description, in `mxr_v2ip_sink_sdp_t` ----
784
785/// The output plays a stream from a description.
786pub const MXR_V2IP_SDP_FLAG_ACTIVE: u8 = 1 << 0;
787/// And nothing else, as no video is routed to it.
788pub const MXR_V2IP_SDP_FLAG_AUDIO_ONLY: u8 = 1 << 1;
789/// `clock_mode` and `clock_state` hold the video processor's answer.
790pub const MXR_V2IP_SDP_FLAG_CLOCK: u8 = 1 << 2;
791
792/// No encoding.
793pub const MXR_V2IP_SDP_ENCODING_NONE: u8 = 0;
794/// 16-bit linear PCM.
795pub const MXR_V2IP_SDP_ENCODING_L16: u8 = 1;
796/// 24-bit linear PCM.
797pub const MXR_V2IP_SDP_ENCODING_L24: u8 = 2;
798/// AM824.
799pub const MXR_V2IP_SDP_ENCODING_AM824: u8 = 3;
800
801/// No media clock given.
802pub const MXR_V2IP_SDP_MEDIA_CLOCK_NONE: u8 = 0;
803/// Direct, at an offset from the reference clock.
804pub const MXR_V2IP_SDP_MEDIA_CLOCK_DIRECT: u8 = 1;
805/// The sender's.
806pub const MXR_V2IP_SDP_MEDIA_CLOCK_SENDER: u8 = 2;
807
808/// No reference clock given.
809pub const MXR_V2IP_SDP_REF_CLOCK_NONE: u8 = 0;
810/// PTP.
811pub const MXR_V2IP_SDP_REF_CLOCK_PTP: u8 = 1;
812/// A traceable clock.
813pub const MXR_V2IP_SDP_REF_CLOCK_TRACEABLE: u8 = 2;
814/// The sender's local MAC.
815pub const MXR_V2IP_SDP_REF_CLOCK_LOCAL_MAC: u8 = 3;
816
817/// Timed by arrival.
818pub const MXR_V2IP_SDP_CLOCK_MODE_ARRIVAL: u8 = 0;
819/// Timed by PTP.
820pub const MXR_V2IP_SDP_CLOCK_MODE_PTP: u8 = 1;
821/// Timed by the sender.
822pub const MXR_V2IP_SDP_CLOCK_MODE_SENDER: u8 = 2;
823
824/// Idle.
825pub const MXR_V2IP_SDP_CLOCK_STATE_IDLE: u8 = 0;
826/// Running its servo.
827pub const MXR_V2IP_SDP_CLOCK_STATE_SERVO: u8 = 1;
828/// Aligning.
829pub const MXR_V2IP_SDP_CLOCK_STATE_ALIGNING: u8 = 2;
830/// Timed.
831pub const MXR_V2IP_SDP_CLOCK_STATE_TIMED: u8 = 3;
832/// Parked.
833pub const MXR_V2IP_SDP_CLOCK_STATE_PARKED: u8 = 4;
834/// Playing untimed.
835pub const MXR_V2IP_SDP_CLOCK_STATE_UNTIMED: u8 = 5;
836/// The timing is not supported.
837pub const MXR_V2IP_SDP_CLOCK_STATE_UNSUPPORTED: u8 = 6;
838
839// ---- V2IP power save levels ----
840
841/// No level.
842pub const MXR_V2IP_POWER_SAVE_LEVEL_NONE: u8 = 0;
843/// Part of the video processing powers down.
844pub const MXR_V2IP_POWER_SAVE_LEVEL_REDUCED: u8 = 1;
845/// All of the video processing powers down.
846pub const MXR_V2IP_POWER_SAVE_LEVEL_LOW: u8 = 2;
847/// Everything but the network powers down.
848pub const MXR_V2IP_POWER_SAVE_LEVEL_OFF: u8 = 3;
849
850// ---- what a unit offers at a power save level, in `mxr_unit_power_save_t` ----
851
852/// The unit can power down to this level.
853pub const MXR_UNIT_POWER_SAVE_SUPPORTED: u8 = 1 << 0;
854/// A signal on the HDMI input wakes the unit.
855pub const MXR_UNIT_POWER_SAVE_INPUT_WAKE: u8 = 1 << 1;
856/// The display powering on wakes the unit, and the unit can power it on.
857pub const MXR_UNIT_POWER_SAVE_OUTPUT_WAKE: u8 = 1 << 2;
858
859// ---- V2IP PTP modes, in `mxr_v2ip_ptp_settings_t::mode` ----
860
861/// No PTP.
862pub const MXR_V2IP_PTP_MODE_OFF: u8 = 0;
863/// Follows a grandmaster, and never becomes one.
864pub const MXR_V2IP_PTP_MODE_FOLLOWER: u8 = 1;
865/// Follows a grandmaster, or becomes one when there is none.
866pub const MXR_V2IP_PTP_MODE_AUTO: u8 = 2;
867
868// ---- unit status flags, in `mxr_unit_status_t::flags` ----
869
870/// A changed setting takes effect after a reboot.
871pub const MXR_UNIT_REBOOT_REQUIRED: u32 = 1 << 0;
872/// A newer video processor image is available.
873pub const MXR_UNIT_FPGA_UPGRADE: u32 = 1 << 1;
874/// The IP configuration comes from DHCP.
875pub const MXR_UNIT_DHCP: u32 = 1 << 2;
876/// The IP configuration was changed through the mesh, and is reverted unless
877/// the mesh controller confirms it within `net_revert_s`.
878pub const MXR_UNIT_NET_PENDING: u32 = 1 << 3;
879/// The fan runs in quiet mode.
880pub const MXR_UNIT_FAN_QUIET: u32 = 1 << 4;
881/// Powered by an external supply rather than PoE.
882pub const MXR_UNIT_EXTERNAL_PSU: u32 = 1 << 5;
883/// The video processor runs with its IP configured. Without it
884/// `encoder_health` and `decoder_health` carry nothing.
885pub const MXR_UNIT_FPGA_CONFIGURED: u32 = 1 << 6;
886/// The encoder is enabled.
887pub const MXR_UNIT_ENCODER_ACTIVE: u32 = 1 << 7;
888/// The decoder is enabled.
889pub const MXR_UNIT_DECODER_ACTIVE: u32 = 1 << 8;
890/// The decoder disables itself without a display.
891pub const MXR_UNIT_AUTO_DISABLE: u32 = 1 << 9;
892/// The decoder disabled itself without a display.
893pub const MXR_UNIT_AUTO_DISABLE_ACTIVE: u32 = 1 << 10;
894/// The HDMI output switches off without a signal.
895pub const MXR_UNIT_OFF_NO_SIGNAL: u32 = 1 << 11;
896/// The HDMI output switched off without a signal.
897pub const MXR_UNIT_OFF_NO_SIGNAL_ACTIVE: u32 = 1 << 12;
898/// Display power is checked before the decoder is enabled.
899pub const MXR_UNIT_POWER_CHECK: u32 = 1 << 13;
900/// `boot_count` is reported.
901pub const MXR_UNIT_BOOT_COUNT: u32 = 1 << 14;
902/// `fan_rpm` is reported.
903pub const MXR_UNIT_FAN_SPEED: u32 = 1 << 15;
904
905// ---- V2IP PTP state, in `mxr_v2ip_ptp_t` ----
906
907/// The device runs PTP and the block holds its state.
908pub const MXR_V2IP_PTP_VALID: u8 = 1 << 0;
909/// The device locked to a master since its PTP started, so its mesh holds a
910/// time.
911pub const MXR_V2IP_PTP_FOLLOWED: u8 = 1 << 1;
912
913/// Not locked.
914pub const MXR_V2IP_PTP_LOCK_UNLOCKED: u8 = 0;
915/// Locking.
916pub const MXR_V2IP_PTP_LOCK_LOCKING: u8 = 1;
917/// Locked.
918pub const MXR_V2IP_PTP_LOCK_LOCKED: u8 = 2;
919
920// ---- V2IP VLAN flags, in `mxr_v2ip_vlan_t::flags` ----
921
922/// The block carries a configuration. A block without it carries nothing.
923pub const MXR_V2IP_VLAN_VALID: u16 = 1 << 0;
924
925/// Untagged frames arriving on the uplink are dropped instead of reaching the
926/// device.
927pub const MXR_V2IP_VLAN_TRUNK: u16 = 1 << 1;
928
929/// Reported by the device: the configuration is applied, and reverted unless
930/// the mesh controller confirms it. Never written.
931pub const MXR_V2IP_VLAN_PENDING: u16 = 1 << 2;
932
933/// Sent by the mesh controller: a pending configuration it heard, which the
934/// device then keeps.
935pub const MXR_V2IP_VLAN_CONFIRM: u16 = 1 << 3;
936
937/// Reported by the device: it has an SFP port. Never written.
938pub const MXR_V2IP_VLAN_HAS_SFP: u16 = 1 << 4;
939
940// ---- V2IP test card, in `mxr_v2ip_testcard_t` ----
941
942/// No pattern.
943pub const MXR_V2IP_TEST_PATTERN_OFF: u8 = 0;
944/// Colour bars.
945pub const MXR_V2IP_TEST_PATTERN_BARS: u8 = 1;
946/// One flat colour, the test card's `colour`.
947pub const MXR_V2IP_TEST_PATTERN_FLAT: u8 = 2;
948/// A ramp.
949pub const MXR_V2IP_TEST_PATTERN_RAMP: u8 = 3;
950/// A grid.
951pub const MXR_V2IP_TEST_PATTERN_GRID: u8 = 4;
952/// A strip.
953pub const MXR_V2IP_TEST_PATTERN_STRIP: u8 = 5;
954/// A test card.
955pub const MXR_V2IP_TEST_PATTERN_CARD: u8 = 6;
956
957/// No tone.
958pub const MXR_V2IP_TONE_MODE_OFF: u8 = 0;
959/// A continuous tone.
960pub const MXR_V2IP_TONE_MODE_CONTINUOUS: u8 = 1;
961/// A channel ident.
962pub const MXR_V2IP_TONE_MODE_IDENT: u8 = 2;
963/// A line-up tone, which needs two channels or more.
964pub const MXR_V2IP_TONE_MODE_LINEUP: u8 = 3;
965/// A beep on each lip-sync mark.
966pub const MXR_V2IP_TONE_MODE_BEEP: u8 = 4;
967
968/// The sink can draw the test card.
969pub const MXR_V2IP_TESTCARD_SUPPORTED: u8 = 1 << 0;
970/// The output shows the pattern.
971pub const MXR_V2IP_TESTCARD_SHOWING: u8 = 1 << 1;
972/// The tone plays on the output.
973pub const MXR_V2IP_TESTCARD_PLAYING: u8 = 1 << 2;
974/// A pattern change has yet to reach the video processor.
975pub const MXR_V2IP_TESTCARD_PATTERN_PENDING: u8 = 1 << 3;
976/// A tone change has yet to reach the video processor.
977pub const MXR_V2IP_TESTCARD_TONE_PENDING: u8 = 1 << 4;
978/// A lip-sync change has yet to reach the video processor.
979pub const MXR_V2IP_TESTCARD_SYNC_PENDING: u8 = 1 << 5;
980
981// ---- overlay sync, in `mxr_osd_sync_t` and `mxr_osd_sync_report_t` ----
982
983/// The sync copies captions.
984pub const MXR_OSD_SYNC_WHAT_CAPTIONS: u8 = 1 << 0;
985/// Which logo is shown, and where.
986pub const MXR_OSD_SYNC_WHAT_LOGO: u8 = 1 << 1;
987/// Background colours.
988pub const MXR_OSD_SYNC_WHAT_BACKGROUNDS: u8 = 1 << 2;
989/// The logo images in the four slots.
990pub const MXR_OSD_SYNC_WHAT_LOGO_SLOTS: u8 = 1 << 3;
991
992/// The unit is taking the sync.
993pub const MXR_OSD_SYNC_STATE_TAKING: u8 = 0;
994/// Every setting written and committed.
995pub const MXR_OSD_SYNC_STATE_DONE: u8 = 1;
996/// Failed, for the reason the report gives.
997pub const MXR_OSD_SYNC_STATE_FAILED: u8 = 2;
998/// Kept for later, as the unit's video processor is off in power save.
999pub const MXR_OSD_SYNC_STATE_DEFERRED: u8 = 3;
1000
1001// ---- overlay sync settings, in `mxr_osd_sync_entry_t` ----
1002
1003/// The setting sets a caption.
1004pub const MXR_OSD_SYNC_TYPE_CAPTION: u8 = 0;
1005/// The setting sets which logo is shown, and where.
1006pub const MXR_OSD_SYNC_TYPE_LOGO: u8 = 1;
1007/// The setting sets a background colour.
1008pub const MXR_OSD_SYNC_TYPE_BACKGROUND: u8 = 2;
1009
1010/// Large outputs, which every value but `SMALL` also means.
1011pub const MXR_OSD_SYNC_SIZE_LARGE: u8 = 1;
1012/// Small outputs.
1013pub const MXR_OSD_SYNC_SIZE_SMALL: u8 = 2;
1014
1015/// A caption's lines aligned to the left.
1016pub const MXR_OSD_CAPTION_ALIGN_LEFT: u8 = 0;
1017/// Centred.
1018pub const MXR_OSD_CAPTION_ALIGN_CENTRE: u8 = 1;
1019/// To the right.
1020pub const MXR_OSD_CAPTION_ALIGN_RIGHT: u8 = 2;
1021/// The layout's default.
1022pub const MXR_OSD_CAPTION_ALIGN_DEFAULT: u8 = 0xFF;
1023
1024/// A caption's text read as plain text.
1025pub const MXR_OSD_CAPTION_FORMAT_PLAIN: u8 = 0;
1026/// As Markdown.
1027pub const MXR_OSD_CAPTION_FORMAT_MARKDOWN: u8 = 1;
1028/// The layout's default.
1029pub const MXR_OSD_CAPTION_FORMAT_DEFAULT: u8 = 0xFF;
1030
1031/// The caption fields a setting gives. A field left out keeps what the unit
1032/// has.
1033pub const MXR_OSD_CAPTION_FIELD_FONT: u16 = 1 << 0;
1034/// The size.
1035pub const MXR_OSD_CAPTION_FIELD_SIZE: u16 = 1 << 1;
1036/// The horizontal position.
1037pub const MXR_OSD_CAPTION_FIELD_X: u16 = 1 << 2;
1038/// The vertical position.
1039pub const MXR_OSD_CAPTION_FIELD_Y: u16 = 1 << 3;
1040/// The alignment.
1041pub const MXR_OSD_CAPTION_FIELD_ALIGN: u16 = 1 << 4;
1042/// The format.
1043pub const MXR_OSD_CAPTION_FIELD_FORMAT: u16 = 1 << 5;
1044/// The colour.
1045pub const MXR_OSD_CAPTION_FIELD_COLOUR: u16 = 1 << 6;
1046/// The wrap width.
1047pub const MXR_OSD_CAPTION_FIELD_WRAP: u16 = 1 << 7;
1048/// The text.
1049pub const MXR_OSD_CAPTION_FIELD_TEXT: u16 = 1 << 8;
1050
1051/// The logo fields a setting gives. A field left out keeps what the unit
1052/// has.
1053pub const MXR_OSD_LOGO_FIELD_LOGO: u16 = 1 << 0;
1054/// The horizontal position.
1055pub const MXR_OSD_LOGO_FIELD_X: u16 = 1 << 1;
1056/// The vertical position.
1057pub const MXR_OSD_LOGO_FIELD_Y: u16 = 1 << 2;
1058
1059// ---- reading the packed words ----
1060
1061/// The remote-control type a bay status word carries in bits 16-19.
1062#[no_mangle]
1063pub extern "C" fn mxr_bay_status_rc_type(status: u32) -> u8 {
1064    guard(0, || BayStatus::from_bits(status).rc_type().to_wire())
1065}
1066
1067/// The HDCP version a bay status word carries in bits 22-23.
1068#[no_mangle]
1069pub extern "C" fn mxr_bay_status_hdcp(status: u32) -> u8 {
1070    guard(0, || BayStatus::from_bits(status).hdcp())
1071}
1072
1073/// The CTA-861 short video descriptor, zero when the signal is not HDMI.
1074#[no_mangle]
1075pub extern "C" fn mxr_signal_type_svd(signal_type: mxr_signal_type_t) -> u8 {
1076    guard(0, || MxrSignalType::from_wire(signal_type).svd())
1077}
1078
1079/// The colour space: 0 RGB, 1 4:4:4, 2 4:2:2, 3 4:2:0.
1080#[no_mangle]
1081pub extern "C" fn mxr_signal_type_colour_space(signal_type: mxr_signal_type_t) -> u8 {
1082    guard(0, || MxrSignalType::from_wire(signal_type).colour_space())
1083}
1084
1085/// Whether the frame rate carries a 1000/1001 clock.
1086#[no_mangle]
1087pub extern "C" fn mxr_signal_type_non_integer(signal_type: mxr_signal_type_t) -> bool {
1088    guard(false, || {
1089        MxrSignalType::from_wire(signal_type).is_non_integer()
1090    })
1091}
1092
1093/// The bit depth in bits per component, zero where the word names none.
1094///
1095/// The field on the wire is an index into a table of four depths, so it is not
1096/// the depth: a signal at 12 bits reads 3 there. This converts it.
1097#[no_mangle]
1098pub extern "C" fn mxr_signal_type_bpp(signal_type: mxr_signal_type_t) -> u8 {
1099    guard(0, || {
1100        MxrSignalType::from_wire(signal_type).bpp().unwrap_or(0)
1101    })
1102}
1103
1104/// The raw bit-depth index, for a caller that wants the wire value.
1105///
1106/// See `mxr_signal_type_bpp()` for the depth it stands for.
1107#[no_mangle]
1108pub extern "C" fn mxr_signal_type_bpp_index(signal_type: mxr_signal_type_t) -> u8 {
1109    guard(0, || MxrSignalType::from_wire(signal_type).bpp_index())
1110}
1111
1112/// Whether the word names a signal format at all.
1113///
1114/// A bay with nothing configured says so two ways: a sender that zeroes the
1115/// word and stamps the unset bit-depth index, and one that writes a plain
1116/// zero. Neither is a format, and the svd and colour space beside them are not
1117/// answers either - both read as zero, which is what this word says for "not
1118/// HDMI" and "RGB" when it is set.
1119#[no_mangle]
1120pub extern "C" fn mxr_signal_type_is_set(signal_type: mxr_signal_type_t) -> bool {
1121    guard(false, || MxrSignalType::from_wire(signal_type).is_set())
1122}