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/// Flips on every reboot, so a peer that sees it change knows the device restarted.
128pub const MXR_FEATURE_BOOT_BIT: u32 = 1 << 31;
129
130// ---- what a bay is wired for, in `mxr_bay_info_t::features` ----
131
132/// HDMI output.
133pub const MXR_BAY_HDMI_OUT: u32 = 1 << 0;
134
135/// HDMI input.
136pub const MXR_BAY_HDMI_IN: u32 = 1 << 1;
137
138/// Digital audio output.
139pub const MXR_BAY_AUDIO_DIG_OUT: u32 = 1 << 2;
140
141/// Digital audio input.
142pub const MXR_BAY_AUDIO_DIG_IN: u32 = 1 << 3;
143
144/// Analogue audio output.
145pub const MXR_BAY_AUDIO_ANA_OUT: u32 = 1 << 4;
146
147/// Analogue audio input.
148pub const MXR_BAY_AUDIO_ANA_IN: u32 = 1 << 5;
149
150/// Infrared input.
151pub const MXR_BAY_IR_IN: u32 = 1 << 6;
152
153/// Infrared output.
154pub const MXR_BAY_IR_OUT: u32 = 1 << 7;
155
156/// Amplified audio output.
157pub const MXR_BAY_AUDIO_AMP_OUT: u32 = 1 << 8;
158
159/// Remote-control output.
160pub const MXR_BAY_RC_OUT: u32 = 1 << 9;
161
162/// Remote-control input.
163pub const MXR_BAY_RC_IN: u32 = 1 << 10;
164
165/// Dolby decoding.
166pub const MXR_BAY_DOLBY: u32 = 1 << 11;
167
168/// Switches itself off when idle.
169pub const MXR_BAY_AUTO_OFF: u32 = 1 << 12;
170
171/// Is a remote V2IP source.
172pub const MXR_BAY_V2IP_SOURCE_REMOTE: u32 = 1 << 13;
173
174/// Is a remote V2IP sink.
175pub const MXR_BAY_V2IP_SINK_REMOTE: u32 = 1 << 14;
176
177/// Is a local V2IP source.
178pub const MXR_BAY_V2IP_SOURCE_LOCAL: u32 = 1 << 15;
179
180/// Is a local V2IP sink.
181pub const MXR_BAY_V2IP_SINK_LOCAL: u32 = 1 << 16;
182
183// ---- the live status of a bay, in `mxr_signal_details_t::status` ----
184//
185// Bits 16-19 and 22-23 are bit-fields rather than flags. Read them with
186// `mxr_bay_status_rc_type()` and `mxr_bay_status_hdcp()`.
187
188/// The bay reports a fault.
189pub const MXR_BAY_STATUS_FAULT: u32 = 1 << 0;
190
191/// The bay is hidden from the user interface.
192pub const MXR_BAY_STATUS_HIDDEN: u32 = 1 << 1;
193
194/// The bay has power.
195pub const MXR_BAY_STATUS_POWERED: u32 = 1 << 2;
196
197/// A signal is present.
198pub const MXR_BAY_STATUS_SIGNAL_DETECTED: u32 = 1 << 3;
199
200/// Hot-plug detect is asserted.
201pub const MXR_BAY_STATUS_HPD_DETECTED: u32 = 1 << 4;
202
203/// The signal is scrambled.
204pub const MXR_BAY_STATUS_SIGNAL_SCRAMBLE: u32 = 1 << 5;
205
206/// An HDBaseT link is up.
207pub const MXR_BAY_STATUS_HDBT_CONNECTED: u32 = 1 << 6;
208
209/// A CEC device answered.
210pub const MXR_BAY_STATUS_CEC_DETECTED: u32 = 1 << 7;
211
212/// The attached device was powered on.
213pub const MXR_BAY_STATUS_POWERED_ON: u32 = 1 << 8;
214
215/// The attached device was powered off.
216pub const MXR_BAY_STATUS_POWERED_OFF: u32 = 1 << 9;
217
218/// Audio return over HDMI is active.
219pub const MXR_BAY_STATUS_AUDIO_ARC_HDMI: u32 = 1 << 10;
220
221/// Audio return over optical is active.
222pub const MXR_BAY_STATUS_AUDIO_ARC_OPTIC: u32 = 1 << 11;
223
224/// Audio return over analogue is active.
225pub const MXR_BAY_STATUS_AUDIO_ARC_ANALOG: u32 = 1 << 12;
226
227/// The bay is offline.
228pub const MXR_BAY_STATUS_OFFLINE: u32 = 1 << 13;
229
230/// The V2IP decoder is disabled.
231pub const MXR_BAY_STATUS_DECODER_DISABLE: u32 = 1 << 14;
232
233/// The V2IP encoder is disabled.
234pub const MXR_BAY_STATUS_ENCODER_DISABLE: u32 = 1 << 15;
235
236/// CEC is switched off for this bay.
237pub const MXR_BAY_STATUS_CEC_DISABLED: u32 = 1 << 20;
238
239/// The V2IP encoder reports an error.
240pub const MXR_BAY_STATUS_ENCODER_ERROR: u32 = 1 << 21;
241
242/// The bay's name was generated - a default, or taken from CEC or the EDID -
243/// rather than set by a user. A device that predates this bit never sets it,
244/// so a clear bit does not prove a user set the name.
245pub const MXR_BAY_STATUS_AUTO_NAME: u32 = 1 << 24;
246
247// ---- what an audio endpoint can do, in `mxr_audio_endpoint_t::features` ----
248
249/// Accepts audio.
250pub const MXR_AUDIO_INPUT: u32 = 1 << 0;
251
252/// Produces audio.
253pub const MXR_AUDIO_OUTPUT: u32 = 1 << 1;
254
255/// Sends a V2IP audio stream.
256pub const MXR_AUDIO_V2IP_TX: u32 = 1 << 2;
257
258/// Receives a V2IP audio stream.
259pub const MXR_AUDIO_V2IP_RX: u32 = 1 << 3;
260
261/// Carries HDMI audio.
262pub const MXR_AUDIO_HDMI: u32 = 1 << 4;
263
264/// Is an analogue RCA connector.
265pub const MXR_AUDIO_RCA: u32 = 1 << 5;
266
267/// Is an S/PDIF connector.
268pub const MXR_AUDIO_SPDIF: u32 = 1 << 6;
269
270/// Drives a trigger output.
271pub const MXR_AUDIO_TRIGGER: u32 = 1 << 7;
272
273/// Can be muted.
274pub const MXR_AUDIO_MUTE: u32 = 1 << 8;
275
276/// Can be routed to as an input.
277pub const MXR_AUDIO_ROUTE_INPUT: u32 = 1 << 9;
278
279/// Can be routed from as an output.
280pub const MXR_AUDIO_ROUTE_OUTPUT: u32 = 1 << 10;
281
282/// Accepts "no input" as a route.
283pub const MXR_AUDIO_ROUTE_IN_NONE: u32 = 1 << 11;
284
285/// Is an amplifier output.
286pub const MXR_AUDIO_AMP_OUTPUT: u32 = 1 << 12;
287
288/// Has a volume control.
289pub const MXR_AUDIO_VOLUME_CONTROL: u32 = 1 << 13;
290
291/// Has a gain control.
292pub const MXR_AUDIO_GAIN_CONTROL: u32 = 1 << 14;
293
294/// Keeps its audio source when the video route changes, while locked.
295pub const MXR_AUDIO_AUDIO_LOCK: u32 = 1 << 15;
296
297// ---- remote-control keys, for `mxr_send_key()` ----
298//
299// A key above the last named here is sent as it is given: the range from
300// `MXR_KEY_CUSTOM_CEC` carries a raw CEC user-control code and the one from
301// `MXR_KEY_CUSTOM_SKY` a raw Sky code, each as the base plus the code.
302
303/// Digit 0.
304pub const MXR_KEY_NUM0: u16 = 0;
305
306/// Digit 1.
307pub const MXR_KEY_NUM1: u16 = 1;
308
309/// Digit 2.
310pub const MXR_KEY_NUM2: u16 = 2;
311
312/// Digit 3.
313pub const MXR_KEY_NUM3: u16 = 3;
314
315/// Digit 4.
316pub const MXR_KEY_NUM4: u16 = 4;
317
318/// Digit 5.
319pub const MXR_KEY_NUM5: u16 = 5;
320
321/// Digit 6.
322pub const MXR_KEY_NUM6: u16 = 6;
323
324/// Digit 7.
325pub const MXR_KEY_NUM7: u16 = 7;
326
327/// Digit 8.
328pub const MXR_KEY_NUM8: u16 = 8;
329
330/// Digit 9.
331pub const MXR_KEY_NUM9: u16 = 9;
332
333/// Confirm the highlighted item.
334pub const MXR_KEY_SELECT: u16 = 10;
335
336/// Go back one step.
337pub const MXR_KEY_BACK: u16 = 11;
338
339/// Navigate up.
340pub const MXR_KEY_UP: u16 = 12;
341
342/// Navigate down.
343pub const MXR_KEY_DOWN: u16 = 13;
344
345/// Navigate left.
346pub const MXR_KEY_LEFT: u16 = 14;
347
348/// Navigate right.
349pub const MXR_KEY_RIGHT: u16 = 15;
350
351/// Open the main menu.
352pub const MXR_KEY_MENU: u16 = 16;
353
354/// Open the content menu.
355pub const MXR_KEY_CONTENT_MENU: u16 = 17;
356
357/// Next channel.
358pub const MXR_KEY_CHANNEL_UP: u16 = 18;
359
360/// Previous channel.
361pub const MXR_KEY_CHANNEL_DOWN: u16 = 19;
362
363/// Start playback.
364pub const MXR_KEY_PLAY: u16 = 20;
365
366/// Pause playback.
367pub const MXR_KEY_PAUSE: u16 = 21;
368
369/// Stop playback.
370pub const MXR_KEY_STOP: u16 = 22;
371
372/// Start recording.
373pub const MXR_KEY_RECORD: u16 = 23;
374
375/// Fast forward.
376pub const MXR_KEY_FAST_FORWARD: u16 = 24;
377
378/// Rewind.
379pub const MXR_KEY_REWIND: u16 = 25;
380
381/// Red colour key.
382pub const MXR_KEY_RED: u16 = 26;
383
384/// Green colour key.
385pub const MXR_KEY_GREEN: u16 = 27;
386
387/// Yellow colour key.
388pub const MXR_KEY_YELLOW: u16 = 28;
389
390/// Blue colour key.
391pub const MXR_KEY_BLUE: u16 = 29;
392
393/// Open help.
394pub const MXR_KEY_HELP: u16 = 30;
395
396/// Show information.
397pub const MXR_KEY_INFORMATION: u16 = 31;
398
399/// Open teletext.
400pub const MXR_KEY_TEXT: u16 = 32;
401
402/// Open the programme guide.
403pub const MXR_KEY_GUIDE: u16 = 33;
404
405/// Open video on demand.
406pub const MXR_KEY_VIDEO_ON_DEMAND: u16 = 34;
407
408/// Return to the previous channel.
409pub const MXR_KEY_PREVIOUS_CHANNEL: u16 = 80;
410
411/// Toggle 3D mode.
412pub const MXR_KEY_MODE_3D: u16 = 81;
413
414/// Toggle subtitles.
415pub const MXR_KEY_SUBTITLE: u16 = 82;
416
417/// Select an audio track.
418pub const MXR_KEY_SOUND_SELECT: u16 = 83;
419
420/// Select an input.
421pub const MXR_KEY_INPUT_SELECT: u16 = 84;
422
423/// Eject the medium.
424pub const MXR_KEY_EJECT: u16 = 85;
425
426/// Next chapter.
427pub const MXR_KEY_NEXT_CHAPTER: u16 = 86;
428
429/// Previous chapter.
430pub const MXR_KEY_PREV_CHAPTER: u16 = 87;
431
432/// Open interactive services.
433pub const MXR_KEY_INTERACTIVE: u16 = 128;
434
435/// Open search.
436pub const MXR_KEY_SEARCH: u16 = 129;
437
438/// Sky home key.
439pub const MXR_KEY_SKY: u16 = 130;
440
441/// Base of the range carrying a raw CEC user-control code.
442pub const MXR_KEY_CUSTOM_CEC: u16 = 1280;
443
444/// Base of the range carrying a raw Sky key code.
445pub const MXR_KEY_CUSTOM_SKY: u16 = 2048;
446
447// ---- multiviewer settings, for the `mxr_set_multiviewer_*` calls ----
448//
449// The same values come back in `mxr_multiviewer_status_t`, whose fields are
450// the wire's bytes rather than a decoded set: a multiviewer running firmware
451// newer than this library reports a mode named here by none of these, and
452// passing it through is what lets a caller see it at all.
453
454/// The multiviewer reports no window layout.
455pub const MXR_MV_VIEW_MODE_UNKNOWN: u8 = 0;
456
457/// One full-screen window.
458pub const MXR_MV_VIEW_MODE_SINGLE: u8 = 1;
459
460/// Picture in picture.
461pub const MXR_MV_VIEW_MODE_PIP: u8 = 2;
462
463/// Two windows, large.
464pub const MXR_MV_VIEW_MODE_TWO_SCREEN_LARGE: u8 = 3;
465
466/// Two windows, small.
467pub const MXR_MV_VIEW_MODE_TWO_SCREEN_SMALL: u8 = 4;
468
469/// Three windows, large.
470pub const MXR_MV_VIEW_MODE_THREE_SCREEN_LARGE: u8 = 5;
471
472/// Three windows, small.
473pub const MXR_MV_VIEW_MODE_THREE_SCREEN_SMALL: u8 = 6;
474
475/// Four windows, equal size.
476pub const MXR_MV_VIEW_MODE_FOUR_SCREEN_EQUAL: u8 = 7;
477
478/// Four windows, small.
479pub const MXR_MV_VIEW_MODE_FOUR_SCREEN_SMALL: u8 = 8;
480
481/// The multiviewer reports no picture-in-picture position.
482pub const MXR_MV_PIP_POSITION_UNKNOWN: u8 = 0;
483
484/// Top left.
485pub const MXR_MV_PIP_POSITION_LEFT_TOP: u8 = 1;
486
487/// Bottom left.
488pub const MXR_MV_PIP_POSITION_LEFT_BOTTOM: u8 = 2;
489
490/// Top right.
491pub const MXR_MV_PIP_POSITION_RIGHT_TOP: u8 = 3;
492
493/// Bottom right.
494pub const MXR_MV_PIP_POSITION_RIGHT_BOTTOM: u8 = 4;
495
496/// The multiviewer reports no picture-in-picture size.
497pub const MXR_MV_PIP_SIZE_UNKNOWN: u8 = 0;
498
499/// Small.
500pub const MXR_MV_PIP_SIZE_SMALL: u8 = 1;
501
502/// Medium.
503pub const MXR_MV_PIP_SIZE_MEDIUM: u8 = 2;
504
505/// Large.
506pub const MXR_MV_PIP_SIZE_LARGE: u8 = 3;
507
508/// The multiviewer reports no output mode.
509pub const MXR_MV_OUTPUT_UNKNOWN: u8 = 0;
510
511/// 4096x2160p60.
512pub const MXR_MV_OUTPUT_DCI4K_P60: u8 = 1;
513
514/// 4096x2160p50.
515pub const MXR_MV_OUTPUT_DCI4K_P50: u8 = 2;
516
517/// 3840x2160p60.
518pub const MXR_MV_OUTPUT_UHD_P60: u8 = 3;
519
520/// 3840x2160p50.
521pub const MXR_MV_OUTPUT_UHD_P50: u8 = 4;
522
523/// 3840x2160p30.
524pub const MXR_MV_OUTPUT_UHD_P30: u8 = 5;
525
526/// 3840x2160p25.
527pub const MXR_MV_OUTPUT_UHD_P25: u8 = 6;
528
529/// 1920x1200p60, reduced blanking.
530pub const MXR_MV_OUTPUT_WUXGA_P60_RB: u8 = 7;
531
532/// 1920x1080p60.
533pub const MXR_MV_OUTPUT_HD1080_P60: u8 = 8;
534
535/// 1920x1080p50.
536pub const MXR_MV_OUTPUT_HD1080_P50: u8 = 9;
537
538/// 1360x768p60.
539pub const MXR_MV_OUTPUT_WXGA_P60: u8 = 10;
540
541/// 1280x800p60.
542pub const MXR_MV_OUTPUT_WXGA800_P60: u8 = 11;
543
544/// 1280x720p60.
545pub const MXR_MV_OUTPUT_HD720_P60: u8 = 12;
546
547/// 1280x720p50.
548pub const MXR_MV_OUTPUT_HD720_P50: u8 = 13;
549
550/// 1024x768p60.
551pub const MXR_MV_OUTPUT_XGA_P60: u8 = 14;
552
553/// The multiviewer reports no HDCP mode.
554pub const MXR_MV_HDCP_UNKNOWN: u8 = 0;
555
556/// HDCP 1.4.
557pub const MXR_MV_HDCP_V14: u8 = 1;
558
559/// HDCP 2.2.
560pub const MXR_MV_HDCP_V22: u8 = 2;
561
562/// Content protection off.
563pub const MXR_MV_HDCP_OFF: u8 = 3;
564
565/// The multiviewer reports no EDID template.
566pub const MXR_MV_EDID_UNKNOWN: u8 = 0;
567
568/// 4K2K60 4:4:4, stereo 2.0.
569pub const MXR_MV_EDID_4K2K60_444_STEREO: u8 = 1;
570
571/// 4K2K60 4:4:4, Dolby/DTS 5.1.
572pub const MXR_MV_EDID_4K2K60_444_DOLBY_DTS_51: u8 = 2;
573
574/// 4K2K60 4:4:4, HD audio 7.1.
575pub const MXR_MV_EDID_4K2K60_444_HD_AUDIO_71: u8 = 3;
576
577/// 4K2K30 4:4:4, stereo 2.0.
578pub const MXR_MV_EDID_4K2K30_444_STEREO: u8 = 4;
579
580/// 4K2K30 4:4:4, Dolby/DTS 5.1.
581pub const MXR_MV_EDID_4K2K30_444_DOLBY_DTS_51: u8 = 5;
582
583/// 4K2K30 4:4:4, HD audio 7.1.
584pub const MXR_MV_EDID_4K2K30_444_HD_AUDIO_71: u8 = 6;
585
586/// 1080p, stereo 2.0.
587pub const MXR_MV_EDID_1080P_STEREO: u8 = 7;
588
589/// 1080p, Dolby/DTS 5.1.
590pub const MXR_MV_EDID_1080P_DOLBY_DTS_51: u8 = 8;
591
592/// 1080p, HD audio 7.1.
593pub const MXR_MV_EDID_1080P_HD_AUDIO_71: u8 = 9;
594
595/// 1920x1200, stereo 2.0.
596pub const MXR_MV_EDID_1920X1200_STEREO: u8 = 10;
597
598/// 1680x1050, stereo 2.0.
599pub const MXR_MV_EDID_1680X1050_STEREO: u8 = 11;
600
601/// 1600x1200, stereo 2.0.
602pub const MXR_MV_EDID_1600X1200_STEREO: u8 = 12;
603
604/// 1440x900, stereo 2.0.
605pub const MXR_MV_EDID_1440X900_STEREO: u8 = 13;
606
607/// 1360x768, stereo 2.0.
608pub const MXR_MV_EDID_1360X768_STEREO: u8 = 14;
609
610/// 1280x1024, stereo 2.0.
611pub const MXR_MV_EDID_1280X1024_STEREO: u8 = 15;
612
613/// 1024x768, stereo 2.0.
614pub const MXR_MV_EDID_1024X768_STEREO: u8 = 16;
615
616/// 720p, stereo 2.0.
617pub const MXR_MV_EDID_720P_STEREO: u8 = 17;
618
619/// Whatever the display connected to the HDMI output presents. The template a
620/// multiviewer leaves the factory with.
621pub const MXR_MV_EDID_COPY_OUTPUT: u8 = 18;
622
623/// The EDID loaded onto the device.
624pub const MXR_MV_EDID_CUSTOM: u8 = 19;
625
626/// The multiviewer reports no IT-content mode.
627pub const MXR_MV_ITC_UNKNOWN: u8 = 0;
628
629/// Video content.
630pub const MXR_MV_ITC_VIDEO: u8 = 1;
631
632/// PC content.
633pub const MXR_MV_ITC_PC: u8 = 2;
634
635/// The multiviewer reports no aspect ratio.
636pub const MXR_MV_ASPECT_UNKNOWN: u8 = 0;
637
638/// Fill the window.
639pub const MXR_MV_ASPECT_FULL: u8 = 1;
640
641/// 16:9.
642pub const MXR_MV_ASPECT_RATIO_16_9: u8 = 2;
643
644/// Off.
645pub const MXR_MV_BOOL_OFF: u8 = 0;
646
647/// On.
648pub const MXR_MV_BOOL_ON: u8 = 1;
649
650/// The multiviewer reports no value.
651pub const MXR_MV_BOOL_UNKNOWN: u8 = 255;
652
653/// The multiviewer reports no source.
654pub const MXR_MV_SOURCE_UNKNOWN: u8 = 0;
655
656/// Input 1.
657pub const MXR_MV_SOURCE_INPUT_1: u8 = 1;
658
659/// Input 2.
660pub const MXR_MV_SOURCE_INPUT_2: u8 = 2;
661
662/// Input 3.
663pub const MXR_MV_SOURCE_INPUT_3: u8 = 3;
664
665/// Input 4.
666pub const MXR_MV_SOURCE_INPUT_4: u8 = 4;
667
668// ---- V2IP device settings, in `mxr_v2ip_device_settings_t` ----
669
670/// Disables the decoder while the display is off.
671pub const MXR_V2IP_SETTING_SINK_CHECK_POWER: u32 = 1 << 0;
672
673/// Disables the HDMI output while there is no signal.
674pub const MXR_V2IP_SETTING_SINK_OFF_NO_SIGNAL: u32 = 1 << 1;
675
676/// Sends infrared modulated.
677pub const MXR_V2IP_SETTING_IR_TX_MODULATED: u32 = 1 << 2;
678
679/// Lights the status LED.
680pub const MXR_V2IP_SETTING_STATUS_LED: u32 = 1 << 3;
681
682/// Lights the network port LEDs.
683pub const MXR_V2IP_SETTING_NETWORK_LED: u32 = 1 << 4;
684
685/// Runs the fan in quiet mode.
686pub const MXR_V2IP_SETTING_FAN_QUIET: u32 = 1 << 5;
687
688/// Accepts CEC combo keys.
689pub const MXR_V2IP_SETTING_CEC_COMBO_KEYS: u32 = 1 << 6;
690
691/// Accepts CEC combo keys for the device's own input.
692pub const MXR_V2IP_SETTING_CEC_COMBO_INPUT: u32 = 1 << 7;
693
694/// The global infrared port's profile, carried in `ir_profile`.
695pub const MXR_V2IP_SETTING_IR_PROFILE: u32 = 1 << 8;
696
697/// The output infrared port's profile, carried in `ir_profile_sink`.
698pub const MXR_V2IP_SETTING_IR_PROFILE_SINK: u32 = 1 << 9;
699
700/// The stored infrared profiles, carried in `ir_profiles`. Never written.
701pub const MXR_V2IP_SETTING_IR_PROFILES: u32 = 1 << 10;
702
703/// The idle minutes before the device powers down, carried in
704/// `mxr_v2ip_power_save_t.auto_minutes`.
705pub const MXR_V2IP_SETTING_AUTO_POWER_SAVE: u32 = 1 << 11;
706
707/// The daily power save windows, carried in `mxr_v2ip_power_save_t`'s `start`
708/// and `end`.
709pub const MXR_V2IP_SETTING_POWER_SAVE_SCHEDULE: u32 = 1 << 12;
710
711/// The device's clock has been set, on/off. Never written.
712pub const MXR_V2IP_SETTING_CLOCK_SET: u32 = 1 << 13;
713
714// ---- V2IP VLAN flags, in `mxr_v2ip_vlan_t::flags` ----
715
716/// The block carries a configuration. A block without it carries nothing.
717pub const MXR_V2IP_VLAN_VALID: u16 = 1 << 0;
718
719/// Untagged frames arriving on the uplink are dropped instead of reaching the
720/// device.
721pub const MXR_V2IP_VLAN_TRUNK: u16 = 1 << 1;
722
723/// Reported by the device: the configuration is applied, and reverted unless
724/// the mesh controller confirms it. Never written.
725pub const MXR_V2IP_VLAN_PENDING: u16 = 1 << 2;
726
727/// Sent by the mesh controller: a pending configuration it heard, which the
728/// device then keeps.
729pub const MXR_V2IP_VLAN_CONFIRM: u16 = 1 << 3;
730
731/// Reported by the device: it has an SFP port. Never written.
732pub const MXR_V2IP_VLAN_HAS_SFP: u16 = 1 << 4;
733
734// ---- V2IP test card, in `mxr_v2ip_testcard_t` ----
735
736/// No pattern.
737pub const MXR_V2IP_TEST_PATTERN_OFF: u8 = 0;
738/// Colour bars.
739pub const MXR_V2IP_TEST_PATTERN_BARS: u8 = 1;
740/// One flat colour, the test card's `colour`.
741pub const MXR_V2IP_TEST_PATTERN_FLAT: u8 = 2;
742/// A ramp.
743pub const MXR_V2IP_TEST_PATTERN_RAMP: u8 = 3;
744/// A grid.
745pub const MXR_V2IP_TEST_PATTERN_GRID: u8 = 4;
746/// A strip.
747pub const MXR_V2IP_TEST_PATTERN_STRIP: u8 = 5;
748/// A test card.
749pub const MXR_V2IP_TEST_PATTERN_CARD: u8 = 6;
750
751/// No tone.
752pub const MXR_V2IP_TONE_MODE_OFF: u8 = 0;
753/// A continuous tone.
754pub const MXR_V2IP_TONE_MODE_CONTINUOUS: u8 = 1;
755/// A channel ident.
756pub const MXR_V2IP_TONE_MODE_IDENT: u8 = 2;
757/// A line-up tone, which needs two channels or more.
758pub const MXR_V2IP_TONE_MODE_LINEUP: u8 = 3;
759/// A beep on each lip-sync mark.
760pub const MXR_V2IP_TONE_MODE_BEEP: u8 = 4;
761
762/// The sink can draw the test card.
763pub const MXR_V2IP_TESTCARD_SUPPORTED: u8 = 1 << 0;
764/// The output shows the pattern.
765pub const MXR_V2IP_TESTCARD_SHOWING: u8 = 1 << 1;
766/// The tone plays on the output.
767pub const MXR_V2IP_TESTCARD_PLAYING: u8 = 1 << 2;
768/// A pattern change has yet to reach the video processor.
769pub const MXR_V2IP_TESTCARD_PATTERN_PENDING: u8 = 1 << 3;
770/// A tone change has yet to reach the video processor.
771pub const MXR_V2IP_TESTCARD_TONE_PENDING: u8 = 1 << 4;
772/// A lip-sync change has yet to reach the video processor.
773pub const MXR_V2IP_TESTCARD_SYNC_PENDING: u8 = 1 << 5;
774
775// ---- reading the packed words ----
776
777/// The remote-control type a bay status word carries in bits 16-19.
778#[no_mangle]
779pub extern "C" fn mxr_bay_status_rc_type(status: u32) -> u8 {
780    guard(0, || BayStatus::from_bits(status).rc_type().to_wire())
781}
782
783/// The HDCP version a bay status word carries in bits 22-23.
784#[no_mangle]
785pub extern "C" fn mxr_bay_status_hdcp(status: u32) -> u8 {
786    guard(0, || BayStatus::from_bits(status).hdcp())
787}
788
789/// The CTA-861 short video descriptor, zero when the signal is not HDMI.
790#[no_mangle]
791pub extern "C" fn mxr_signal_type_svd(signal_type: mxr_signal_type_t) -> u8 {
792    guard(0, || MxrSignalType::from_wire(signal_type).svd())
793}
794
795/// The colour space: 0 RGB, 1 4:4:4, 2 4:2:2, 3 4:2:0.
796#[no_mangle]
797pub extern "C" fn mxr_signal_type_colour_space(signal_type: mxr_signal_type_t) -> u8 {
798    guard(0, || MxrSignalType::from_wire(signal_type).colour_space())
799}
800
801/// Whether the frame rate carries a 1000/1001 clock.
802#[no_mangle]
803pub extern "C" fn mxr_signal_type_non_integer(signal_type: mxr_signal_type_t) -> bool {
804    guard(false, || {
805        MxrSignalType::from_wire(signal_type).is_non_integer()
806    })
807}
808
809/// The bit depth in bits per component, zero where the word names none.
810///
811/// The field on the wire is an index into a table of four depths, so it is not
812/// the depth: a signal at 12 bits reads 3 there. This converts it.
813#[no_mangle]
814pub extern "C" fn mxr_signal_type_bpp(signal_type: mxr_signal_type_t) -> u8 {
815    guard(0, || {
816        MxrSignalType::from_wire(signal_type).bpp().unwrap_or(0)
817    })
818}
819
820/// The raw bit-depth index, for a caller that wants the wire value.
821///
822/// See `mxr_signal_type_bpp()` for the depth it stands for.
823#[no_mangle]
824pub extern "C" fn mxr_signal_type_bpp_index(signal_type: mxr_signal_type_t) -> u8 {
825    guard(0, || MxrSignalType::from_wire(signal_type).bpp_index())
826}
827
828/// Whether the word names a signal format at all.
829///
830/// A bay with nothing configured says so two ways: a sender that zeroes the
831/// word and stamps the unset bit-depth index, and one that writes a plain
832/// zero. Neither is a format, and the svd and colour space beside them are not
833/// answers either - both read as zero, which is what this word says for "not
834/// HDMI" and "RGB" when it is set.
835#[no_mangle]
836pub extern "C" fn mxr_signal_type_is_set(signal_type: mxr_signal_type_t) -> bool {
837    guard(false, || MxrSignalType::from_wire(signal_type).is_set())
838}