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