Skip to main content

fidl_fuchsia_media_common/
fidl_fuchsia_media_common.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11/// An identifier for compression types.
12pub type CompressionType = String;
13
14pub type EncryptionScheme = String;
15
16pub type InitVector = Vec<u8>;
17
18pub type KeyId = Vec<u8>;
19
20/// Audio encodings.
21pub const AUDIO_ENCODING_AAC: &str = "fuchsia.media.aac";
22
23pub const AUDIO_ENCODING_AACLATM: &str = "fuchsia.media.aaclatm";
24
25pub const AUDIO_ENCODING_AMRNB: &str = "fuchsia.media.amrnb";
26
27pub const AUDIO_ENCODING_AMRWB: &str = "fuchsia.media.amrwb";
28
29pub const AUDIO_ENCODING_APTX: &str = "fuchsia.media.aptx";
30
31pub const AUDIO_ENCODING_FLAC: &str = "fuchsia.media.flac";
32
33pub const AUDIO_ENCODING_GSMMS: &str = "fuchsia.media.gsmms";
34
35pub const AUDIO_ENCODING_LPCM: &str = "fuchsia.media.lpcm";
36
37pub const AUDIO_ENCODING_MP3: &str = "fuchsia.media.mp3";
38
39pub const AUDIO_ENCODING_OPUS: &str = "fuchsia.media.opus";
40
41pub const AUDIO_ENCODING_PCMALAW: &str = "fuchsia.media.pcmalaw";
42
43pub const AUDIO_ENCODING_PCMMULAW: &str = "fuchsia.media.pcmmulaw";
44
45pub const AUDIO_ENCODING_SBC: &str = "fuchsia.media.sbc";
46
47pub const AUDIO_ENCODING_VORBIS: &str = "fuchsia.media.vorbis";
48
49pub const BEHAVIOR_COUNT: u8 = 3;
50
51pub const CAPTURE_USAGE2_COUNT: u8 = 4;
52
53pub const CAPTURE_USAGE_COUNT: u8 = 4;
54
55pub const ENCRYPTION_SCHEME_CBC1: &str = "cbc1";
56
57pub const ENCRYPTION_SCHEME_CBCS: &str = "cbcs";
58
59pub const ENCRYPTION_SCHEME_CENC: &str = "cenc";
60
61pub const ENCRYPTION_SCHEME_CENS: &str = "cens";
62
63pub const ENCRYPTION_SCHEME_UNENCRYPTED: &str = "unencrypted";
64
65pub const MAX_ENCRYPTION_SCHEME_SIZE: u32 = 100;
66
67/// The maximum number of frames that may be contained within a single StreamPacket.
68pub const MAX_FRAMES_PER_RENDERER_PACKET: i64 = 262143;
69
70pub const MAX_INIT_VECTOR_SIZE: u32 = 16;
71
72pub const MAX_KEY_ID_SIZE: u32 = 16;
73
74pub const MAX_PCM_CHANNEL_COUNT: u32 = 8;
75
76pub const MAX_PCM_FRAMES_PER_SECOND: u32 = 192000;
77
78/// A reasonable upper-bound for the maximum number of render or capture usages. Use this value in
79/// FIDL APIs (e.g. for max vector size), instead of RENDER_USAGE2_COUNT or CAPTURE_USAGE2_COUNT
80/// directly. This way, an increase in these consts will not cause an ABI-breaking change.
81pub const MAX_USAGE_COUNT: u8 = 8;
82
83pub const METADATA_LABEL_ALBUM: &str = "fuchsia.media.album";
84
85pub const METADATA_LABEL_ARTIST: &str = "fuchsia.media.artist";
86
87pub const METADATA_LABEL_COMPOSER: &str = "fuchsia.media.composer";
88
89pub const METADATA_LABEL_EPISODE: &str = "fuchsia.media.episode";
90
91pub const METADATA_LABEL_GENRE: &str = "fuchsia.media.genre";
92
93pub const METADATA_LABEL_PUBLISHER: &str = "fuchsia.media.publisher";
94
95pub const METADATA_LABEL_RELEASE_DATE: &str = "fuchsia.media.release_date";
96
97pub const METADATA_LABEL_SEASON: &str = "fuchsia.media.season";
98
99pub const METADATA_LABEL_STUDIO: &str = "fuchsia.media.studio";
100
101pub const METADATA_LABEL_SUBTITLE: &str = "fuchsia.media.subtitle";
102
103pub const METADATA_LABEL_TITLE: &str = "fuchsia.media.title";
104
105pub const METADATA_LABEL_TRACK_NUMBER: &str = "fuchsia.media.track_number";
106
107/// The title of the source of the media, e.g. a player, streaming service, or
108/// website.
109pub const METADATA_SOURCE_TITLE: &str = "fuchsia.media.source_title";
110
111/// Permitted ranges for AudioRenderer and AudioCapturer
112pub const MIN_PCM_CHANNEL_COUNT: u32 = 1;
113
114pub const MIN_PCM_FRAMES_PER_SECOND: u32 = 1000;
115
116/// When used as a `StreamPacket.pts` value, indicates that the packet has no
117/// specific presentation timestamp. The effective presentation time of such a
118/// packet depends on the context in which the `StreamPacket` is used.
119pub const NO_TIMESTAMP: i64 = 9223372036854775807;
120
121pub const RENDER_USAGE2_COUNT: u8 = 6;
122
123pub const RENDER_USAGE_COUNT: u8 = 5;
124
125/// Indicates a discontinuity in an otherwise continuous-in-time sequence of
126/// packets. The precise semantics of this flag depend on the context in which
127/// the `StreamPacket` is used.
128pub const STREAM_PACKET_FLAG_DISCONTINUITY: u32 = 4;
129
130/// Indicates that all other packets in the stream can be understood without
131/// reference to this packet. This is typically used in compressed streams to
132/// identify packets containing frames that may be discarded without affecting
133/// other frames.
134pub const STREAM_PACKET_FLAG_DROPPABLE: u32 = 2;
135
136/// Indicates that the packet can be understood without reference to other
137/// packets in the stream. This is typically used in compressed streams to
138/// identify packets that contain key frames.
139pub const STREAM_PACKET_FLAG_KEY_FRAME: u32 = 1;
140
141/// Video encodings.
142pub const VIDEO_ENCODING_H263: &str = "fuchsia.media.h263";
143
144pub const VIDEO_ENCODING_H264: &str = "fuchsia.media.h264";
145
146pub const VIDEO_ENCODING_MPEG4: &str = "fuchsia.media.mpeg4";
147
148pub const VIDEO_ENCODING_THEORA: &str = "fuchsia.media.theora";
149
150pub const VIDEO_ENCODING_UNCOMPRESSED: &str = "fuchsia.media.uncompressed_video";
151
152pub const VIDEO_ENCODING_VP3: &str = "fuchsia.media.vp3";
153
154pub const VIDEO_ENCODING_VP8: &str = "fuchsia.media.vp8";
155
156pub const VIDEO_ENCODING_VP9: &str = "fuchsia.media.vp9";
157
158pub const MAX_OOB_BYTES_SIZE: u64 = 8192;
159
160bitflags! {
161    /// Flags passed to `AudioConsumer.Start`.
162    #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
163    pub struct AudioConsumerStartFlags: u32 {
164        /// Indicates that latency should be kept as low as possible.
165        const LOW_LATENCY = 1;
166        /// Indicates that the timing of packet delivery is determined by an external process rather
167        /// than being demand-based. When this flag is set, the service should expect underflow or
168        /// overflow due to a mismatch between packet arrival rate and presentation rate. When this
169        /// flag is not set, packets arrive on demand.
170        const SUPPLY_DRIVEN = 2;
171    }
172}
173
174impl AudioConsumerStartFlags {}
175
176bitflags! {
177    #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
178    pub struct AudioGainInfoFlags: u32 {
179        const MUTE = 1;
180        const AGC_SUPPORTED = 2;
181        const AGC_ENABLED = 4;
182    }
183}
184
185impl AudioGainInfoFlags {}
186
187bitflags! {
188    #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
189    pub struct AudioGainValidFlags: u32 {
190        const GAIN_VALID = 1;
191        const MUTE_VALID = 2;
192        const AGC_VALID = 4;
193    }
194}
195
196impl AudioGainValidFlags {}
197
198#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
199#[repr(u32)]
200pub enum AacAudioObjectType {
201    /// MPEG-2 Low Complexity
202    Mpeg2AacLc = 0,
203    /// MPEG-4 Low Complexity
204    Mpeg4AacLc = 1,
205}
206
207impl AacAudioObjectType {
208    #[inline]
209    pub fn from_primitive(prim: u32) -> Option<Self> {
210        match prim {
211            0 => Some(Self::Mpeg2AacLc),
212            1 => Some(Self::Mpeg4AacLc),
213            _ => None,
214        }
215    }
216
217    #[inline]
218    pub const fn into_primitive(self) -> u32 {
219        self as u32
220    }
221}
222
223#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
224#[repr(u32)]
225pub enum AacChannelMode {
226    Mono = 0,
227    Stereo = 2,
228}
229
230impl AacChannelMode {
231    #[inline]
232    pub fn from_primitive(prim: u32) -> Option<Self> {
233        match prim {
234            0 => Some(Self::Mono),
235            2 => Some(Self::Stereo),
236            _ => None,
237        }
238    }
239
240    #[inline]
241    pub const fn into_primitive(self) -> u32 {
242        self as u32
243    }
244}
245
246/// Variable bit rate modes. The actual resulting bitrate
247/// varies based on input signal and other encoding settings.
248///
249/// See https://wiki.hydrogenaud.io/index.php?title=Fraunhofer_FDK_AAC#Bitrate_Modes
250#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
251#[repr(u32)]
252pub enum AacVariableBitRate {
253    V1 = 1,
254    V2 = 2,
255    V3 = 3,
256    V4 = 4,
257    V5 = 5,
258}
259
260impl AacVariableBitRate {
261    #[inline]
262    pub fn from_primitive(prim: u32) -> Option<Self> {
263        match prim {
264            1 => Some(Self::V1),
265            2 => Some(Self::V2),
266            3 => Some(Self::V3),
267            4 => Some(Self::V4),
268            5 => Some(Self::V5),
269            _ => None,
270        }
271    }
272
273    #[inline]
274    pub const fn into_primitive(self) -> u32 {
275        self as u32
276    }
277}
278
279#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
280#[repr(u32)]
281pub enum AudioBitrateMode {
282    Unspecified = 0,
283    Cbr = 1,
284    Vbr = 2,
285}
286
287impl AudioBitrateMode {
288    #[inline]
289    pub fn from_primitive(prim: u32) -> Option<Self> {
290        match prim {
291            0 => Some(Self::Unspecified),
292            1 => Some(Self::Cbr),
293            2 => Some(Self::Vbr),
294            _ => None,
295        }
296    }
297
298    #[inline]
299    pub const fn into_primitive(self) -> u32 {
300        self as u32
301    }
302}
303
304/// Usages annotating the purpose of the stream being used to capture audio. The
305/// AudioCaptureUsage is used by audio policy to dictate how audio streams
306/// interact with each other.
307#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
308#[repr(u32)]
309pub enum AudioCaptureUsage {
310    /// Stream is used to capture audio while in the background. These streams
311    /// may be active at any the time and are considered privileged.
312    /// Example: Listening for Hotwords
313    Background = 0,
314    /// Stream is intended to be used for normal capture functionality. Streams
315    /// that are used for audio capture while the stream creator is in the
316    /// foreground should use this.
317    /// Example: Voice Recorder
318    Foreground = 1,
319    /// Stream is for interaction with a system agent. This should only be used
320    /// once a user has signalled their intent to have the interaction with an
321    /// interested party.
322    /// Examples: Assistant, Siri, Alexa
323    SystemAgent = 2,
324    /// Stream is intended to be used for some form of real time user to user
325    /// communication. Voice/Video chat should use this.
326    Communication = 3,
327}
328
329impl AudioCaptureUsage {
330    #[inline]
331    pub fn from_primitive(prim: u32) -> Option<Self> {
332        match prim {
333            0 => Some(Self::Background),
334            1 => Some(Self::Foreground),
335            2 => Some(Self::SystemAgent),
336            3 => Some(Self::Communication),
337            _ => None,
338        }
339    }
340
341    #[inline]
342    pub const fn into_primitive(self) -> u32 {
343        self as u32
344    }
345}
346
347/// Usages annotating the purpose of the stream being used to capture audio. The
348/// AudioCaptureUsage is used by audio policy to dictate how audio streams
349/// interact with each other.
350#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
351pub enum AudioCaptureUsage2 {
352    /// Stream is used to capture audio while in the background. These streams may be active at
353    /// any the time and are considered privileged.
354    /// Example: Listening for Hotwords
355    Background,
356    /// Stream is intended to be used for normal capture functionality. Streams that are used for
357    /// audio capture while the stream creator is in the foreground should use this.
358    /// Example: Voice Recorder
359    Foreground,
360    /// Stream is for interaction with a system agent. This should only be used once a user has
361    /// signalled their intent to have the interaction with an interested party.
362    /// Examples: Assistant, Siri, Alexa
363    SystemAgent,
364    /// Stream is intended to be used for some form of real time user to user communication.
365    /// Voice/Video chat should use this.
366    Communication,
367    #[doc(hidden)]
368    __SourceBreaking { unknown_ordinal: u32 },
369}
370
371/// Pattern that matches an unknown `AudioCaptureUsage2` member.
372#[macro_export]
373macro_rules! AudioCaptureUsage2Unknown {
374    () => {
375        _
376    };
377}
378
379impl AudioCaptureUsage2 {
380    #[inline]
381    pub fn from_primitive(prim: u32) -> Option<Self> {
382        match prim {
383            0 => Some(Self::Background),
384            1 => Some(Self::Foreground),
385            2 => Some(Self::SystemAgent),
386            3 => Some(Self::Communication),
387            _ => None,
388        }
389    }
390
391    #[inline]
392    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
393        match prim {
394            0 => Self::Background,
395            1 => Self::Foreground,
396            2 => Self::SystemAgent,
397            3 => Self::Communication,
398            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
399        }
400    }
401
402    #[inline]
403    pub fn unknown() -> Self {
404        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
405    }
406
407    #[inline]
408    pub const fn into_primitive(self) -> u32 {
409        match self {
410            Self::Background => 0,
411            Self::Foreground => 1,
412            Self::SystemAgent => 2,
413            Self::Communication => 3,
414            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
415        }
416    }
417
418    #[inline]
419    pub fn is_unknown(&self) -> bool {
420        match self {
421            Self::__SourceBreaking { unknown_ordinal: _ } => true,
422            _ => false,
423        }
424    }
425}
426
427/// AudioChannelId
428///
429/// Used in specifying which audio channel is for which speaker location / type.
430///
431/// TODO(b/529511595): Do we need/want more channel IDs than this?
432#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
433#[repr(u32)]
434pub enum AudioChannelId {
435    Skip = 0,
436    Lf = 1,
437    Rf = 2,
438    Cf = 3,
439    Ls = 4,
440    Rs = 5,
441    Lfe = 6,
442    Cs = 7,
443    Lr = 8,
444    Rr = 9,
445    EndDefined = 10,
446    ExtendedChannelIdBase = 1862270976,
447    Max = 2147483647,
448}
449
450impl AudioChannelId {
451    #[inline]
452    pub fn from_primitive(prim: u32) -> Option<Self> {
453        match prim {
454            0 => Some(Self::Skip),
455            1 => Some(Self::Lf),
456            2 => Some(Self::Rf),
457            3 => Some(Self::Cf),
458            4 => Some(Self::Ls),
459            5 => Some(Self::Rs),
460            6 => Some(Self::Lfe),
461            7 => Some(Self::Cs),
462            8 => Some(Self::Lr),
463            9 => Some(Self::Rr),
464            10 => Some(Self::EndDefined),
465            1862270976 => Some(Self::ExtendedChannelIdBase),
466            2147483647 => Some(Self::Max),
467            _ => None,
468        }
469    }
470
471    #[inline]
472    pub const fn into_primitive(self) -> u32 {
473        self as u32
474    }
475}
476
477#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
478#[repr(u32)]
479pub enum AudioOutputRoutingPolicy {
480    AllPluggedOutputs = 0,
481    LastPluggedOutput = 1,
482}
483
484impl AudioOutputRoutingPolicy {
485    #[inline]
486    pub fn from_primitive(prim: u32) -> Option<Self> {
487        match prim {
488            0 => Some(Self::AllPluggedOutputs),
489            1 => Some(Self::LastPluggedOutput),
490            _ => None,
491        }
492    }
493
494    #[inline]
495    pub const fn into_primitive(self) -> u32 {
496        self as u32
497    }
498}
499
500#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
501#[repr(u32)]
502pub enum AudioPcmMode {
503    Linear = 0,
504    Alaw = 1,
505    Mulaw = 2,
506}
507
508impl AudioPcmMode {
509    #[inline]
510    pub fn from_primitive(prim: u32) -> Option<Self> {
511        match prim {
512            0 => Some(Self::Linear),
513            1 => Some(Self::Alaw),
514            2 => Some(Self::Mulaw),
515            _ => None,
516        }
517    }
518
519    #[inline]
520    pub const fn into_primitive(self) -> u32 {
521        self as u32
522    }
523}
524
525/// Usage annotating the purpose of the stream being used to render audio.
526/// An AudioRenderer's usage cannot be changed after creation. The
527/// AudioRenderUsage is used by audio policy to dictate how audio streams
528/// interact with each other.
529#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
530#[repr(u32)]
531pub enum AudioRenderUsage {
532    /// Stream is intended to be used for ambient or background sound. Streams
533    /// that can be interrupted without consequence should use this.
534    Background = 0,
535    /// Stream is intended to be used for normal functionality. Streams that
536    /// are part of normal functionality should use this.
537    Media = 1,
538    /// Stream is intended to interrupt any ongoing function of the device.
539    /// Streams that are used for interruptions like notifications should use
540    /// this.
541    Interruption = 2,
542    /// Stream is for interaction with a system agent. This should be used
543    /// in response to a user initiated trigger.
544    SystemAgent = 3,
545    /// Stream is intended to be used for some form of real time user to user
546    /// communication. Voice/Video chat should use this.
547    Communication = 4,
548}
549
550impl AudioRenderUsage {
551    #[inline]
552    pub fn from_primitive(prim: u32) -> Option<Self> {
553        match prim {
554            0 => Some(Self::Background),
555            1 => Some(Self::Media),
556            2 => Some(Self::Interruption),
557            3 => Some(Self::SystemAgent),
558            4 => Some(Self::Communication),
559            _ => None,
560        }
561    }
562
563    #[inline]
564    pub const fn into_primitive(self) -> u32 {
565        self as u32
566    }
567}
568
569/// Usage annotating the purpose of the stream being used to render audio. An AudioRenderer's
570/// usage cannot be changed after creation. The AudioRenderUsage2 value is used by audio policy
571/// to dictate how audio streams interact with each other. This enum expands the original (strict)
572/// enum |AudioRenderUsage| with additional stream types.
573#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
574pub enum AudioRenderUsage2 {
575    /// Stream is intended to be used for ambient or background sound. Streams
576    /// that can be interrupted without consequence should use this.
577    Background,
578    /// Stream is intended to be used for normal functionality. Streams that
579    /// are part of normal functionality should use this.
580    Media,
581    /// Stream is intended to interrupt any ongoing function of the device.
582    /// Streams that are used for interruptions like notifications should use
583    /// this.
584    Interruption,
585    /// Stream is for interaction with a system agent. This should be used
586    /// in response to a user initiated trigger.
587    SystemAgent,
588    /// Stream is intended to be used for some form of real time user to user
589    /// communication. Voice/Video chat should use this.
590    Communication,
591    /// Stream is intended to be used for accessibility or other non-system-
592    /// agent speech output, such as screen reader TTS.
593    Accessibility,
594    #[doc(hidden)]
595    __SourceBreaking { unknown_ordinal: u32 },
596}
597
598/// Pattern that matches an unknown `AudioRenderUsage2` member.
599#[macro_export]
600macro_rules! AudioRenderUsage2Unknown {
601    () => {
602        _
603    };
604}
605
606impl AudioRenderUsage2 {
607    #[inline]
608    pub fn from_primitive(prim: u32) -> Option<Self> {
609        match prim {
610            0 => Some(Self::Background),
611            1 => Some(Self::Media),
612            2 => Some(Self::Interruption),
613            3 => Some(Self::SystemAgent),
614            4 => Some(Self::Communication),
615            5 => Some(Self::Accessibility),
616            _ => None,
617        }
618    }
619
620    #[inline]
621    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
622        match prim {
623            0 => Self::Background,
624            1 => Self::Media,
625            2 => Self::Interruption,
626            3 => Self::SystemAgent,
627            4 => Self::Communication,
628            5 => Self::Accessibility,
629            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
630        }
631    }
632
633    #[inline]
634    pub fn unknown() -> Self {
635        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
636    }
637
638    #[inline]
639    pub const fn into_primitive(self) -> u32 {
640        match self {
641            Self::Background => 0,
642            Self::Media => 1,
643            Self::Interruption => 2,
644            Self::SystemAgent => 3,
645            Self::Communication => 4,
646            Self::Accessibility => 5,
647            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
648        }
649    }
650
651    #[inline]
652    pub fn is_unknown(&self) -> bool {
653        match self {
654            Self::__SourceBreaking { unknown_ordinal: _ } => true,
655            _ => false,
656        }
657    }
658}
659
660/// Enumerates the supported audio sample formats.
661#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
662#[repr(u32)]
663pub enum AudioSampleFormat {
664    /// 8-bit unsigned samples, sample size 1 byte.
665    Unsigned8 = 1,
666    /// 16-bit signed samples, host-endian, sample size 2 bytes.
667    Signed16 = 2,
668    /// 24-bit signed samples in 32 bits, host-endian, sample size 4 bytes.
669    Signed24In32 = 3,
670    /// 32-bit floating-point samples, sample size 4 bytes.
671    Float = 4,
672}
673
674impl AudioSampleFormat {
675    #[inline]
676    pub fn from_primitive(prim: u32) -> Option<Self> {
677        match prim {
678            1 => Some(Self::Unsigned8),
679            2 => Some(Self::Signed16),
680            3 => Some(Self::Signed24In32),
681            4 => Some(Self::Float),
682            _ => None,
683        }
684    }
685
686    #[inline]
687    pub const fn into_primitive(self) -> u32 {
688        self as u32
689    }
690}
691
692/// The behaviors applied to streams when multiple are active.
693#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
694pub enum Behavior {
695    /// Mix the streams.
696    None,
697    /// Apply a gain to duck the volume of one of the streams. (-14.0db)
698    Duck,
699    /// Apply a gain to mute one of the streams. (-160.0db)
700    Mute,
701    #[doc(hidden)]
702    __SourceBreaking { unknown_ordinal: u32 },
703}
704
705/// Pattern that matches an unknown `Behavior` member.
706#[macro_export]
707macro_rules! BehaviorUnknown {
708    () => {
709        _
710    };
711}
712
713impl Behavior {
714    #[inline]
715    pub fn from_primitive(prim: u32) -> Option<Self> {
716        match prim {
717            0 => Some(Self::None),
718            1 => Some(Self::Duck),
719            2 => Some(Self::Mute),
720            _ => None,
721        }
722    }
723
724    #[inline]
725    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
726        match prim {
727            0 => Self::None,
728            1 => Self::Duck,
729            2 => Self::Mute,
730            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
731        }
732    }
733
734    #[inline]
735    pub fn unknown() -> Self {
736        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
737    }
738
739    #[inline]
740    pub const fn into_primitive(self) -> u32 {
741        match self {
742            Self::None => 0,
743            Self::Duck => 1,
744            Self::Mute => 2,
745            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
746        }
747    }
748
749    #[inline]
750    pub fn is_unknown(&self) -> bool {
751        match self {
752            Self::__SourceBreaking { unknown_ordinal: _ } => true,
753            _ => false,
754        }
755    }
756}
757
758/// A list of permitted codec profiles. This list should be flexible since codecs can and will be added
759/// in the future. This can contain both video and audio profiles if needed.
760#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
761pub enum CodecProfile {
762    H264ProfileBaseline,
763    H264ProfileMain,
764    H264ProfileExtended,
765    H264ProfileHigh,
766    H264ProfileHigh10Profile,
767    H264ProfileHigh422Profile,
768    H264ProfileHigh444Predictiveprofile,
769    H264ProfileScalablebaseline,
770    H264ProfileScalablehigh,
771    H264ProfileStereohigh,
772    H264ProfileMultiviewhigh,
773    Vp8ProfileAny,
774    Vp9ProfileProfile0,
775    Vp9ProfileProfile1,
776    Vp9ProfileProfile2,
777    Vp9ProfileProfile3,
778    HevcprofileMain,
779    HevcprofileMain10,
780    HevcprofileMainStillPicture,
781    MjpegBaseline,
782    #[doc(hidden)]
783    __SourceBreaking {
784        unknown_ordinal: u32,
785    },
786}
787
788/// Pattern that matches an unknown `CodecProfile` member.
789#[macro_export]
790macro_rules! CodecProfileUnknown {
791    () => {
792        _
793    };
794}
795
796impl CodecProfile {
797    #[inline]
798    pub fn from_primitive(prim: u32) -> Option<Self> {
799        match prim {
800            0 => Some(Self::H264ProfileBaseline),
801            1 => Some(Self::H264ProfileMain),
802            2 => Some(Self::H264ProfileExtended),
803            3 => Some(Self::H264ProfileHigh),
804            4 => Some(Self::H264ProfileHigh10Profile),
805            5 => Some(Self::H264ProfileHigh422Profile),
806            6 => Some(Self::H264ProfileHigh444Predictiveprofile),
807            7 => Some(Self::H264ProfileScalablebaseline),
808            8 => Some(Self::H264ProfileScalablehigh),
809            9 => Some(Self::H264ProfileStereohigh),
810            10 => Some(Self::H264ProfileMultiviewhigh),
811            11 => Some(Self::Vp8ProfileAny),
812            12 => Some(Self::Vp9ProfileProfile0),
813            13 => Some(Self::Vp9ProfileProfile1),
814            14 => Some(Self::Vp9ProfileProfile2),
815            15 => Some(Self::Vp9ProfileProfile3),
816            16 => Some(Self::HevcprofileMain),
817            17 => Some(Self::HevcprofileMain10),
818            18 => Some(Self::HevcprofileMainStillPicture),
819            19 => Some(Self::MjpegBaseline),
820            _ => None,
821        }
822    }
823
824    #[inline]
825    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
826        match prim {
827            0 => Self::H264ProfileBaseline,
828            1 => Self::H264ProfileMain,
829            2 => Self::H264ProfileExtended,
830            3 => Self::H264ProfileHigh,
831            4 => Self::H264ProfileHigh10Profile,
832            5 => Self::H264ProfileHigh422Profile,
833            6 => Self::H264ProfileHigh444Predictiveprofile,
834            7 => Self::H264ProfileScalablebaseline,
835            8 => Self::H264ProfileScalablehigh,
836            9 => Self::H264ProfileStereohigh,
837            10 => Self::H264ProfileMultiviewhigh,
838            11 => Self::Vp8ProfileAny,
839            12 => Self::Vp9ProfileProfile0,
840            13 => Self::Vp9ProfileProfile1,
841            14 => Self::Vp9ProfileProfile2,
842            15 => Self::Vp9ProfileProfile3,
843            16 => Self::HevcprofileMain,
844            17 => Self::HevcprofileMain10,
845            18 => Self::HevcprofileMainStillPicture,
846            19 => Self::MjpegBaseline,
847            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
848        }
849    }
850
851    #[inline]
852    pub fn unknown() -> Self {
853        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
854    }
855
856    #[inline]
857    pub const fn into_primitive(self) -> u32 {
858        match self {
859            Self::H264ProfileBaseline => 0,
860            Self::H264ProfileMain => 1,
861            Self::H264ProfileExtended => 2,
862            Self::H264ProfileHigh => 3,
863            Self::H264ProfileHigh10Profile => 4,
864            Self::H264ProfileHigh422Profile => 5,
865            Self::H264ProfileHigh444Predictiveprofile => 6,
866            Self::H264ProfileScalablebaseline => 7,
867            Self::H264ProfileScalablehigh => 8,
868            Self::H264ProfileStereohigh => 9,
869            Self::H264ProfileMultiviewhigh => 10,
870            Self::Vp8ProfileAny => 11,
871            Self::Vp9ProfileProfile0 => 12,
872            Self::Vp9ProfileProfile1 => 13,
873            Self::Vp9ProfileProfile2 => 14,
874            Self::Vp9ProfileProfile3 => 15,
875            Self::HevcprofileMain => 16,
876            Self::HevcprofileMain10 => 17,
877            Self::HevcprofileMainStillPicture => 18,
878            Self::MjpegBaseline => 19,
879            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
880        }
881    }
882
883    #[inline]
884    pub fn is_unknown(&self) -> bool {
885        match self {
886            Self::__SourceBreaking { unknown_ordinal: _ } => true,
887            _ => false,
888        }
889    }
890}
891
892#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
893#[repr(u32)]
894pub enum ColorSpace {
895    Unknown = 0,
896    NotApplicable = 1,
897    Jpeg = 2,
898    HdRec709 = 3,
899    SdRec601 = 4,
900}
901
902impl ColorSpace {
903    #[inline]
904    pub fn from_primitive(prim: u32) -> Option<Self> {
905        match prim {
906            0 => Some(Self::Unknown),
907            1 => Some(Self::NotApplicable),
908            2 => Some(Self::Jpeg),
909            3 => Some(Self::HdRec709),
910            4 => Some(Self::SdRec601),
911            _ => None,
912        }
913    }
914
915    #[inline]
916    pub const fn into_primitive(self) -> u32 {
917        self as u32
918    }
919}
920
921#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
922pub enum Lc3FrameDuration {
923    D10Ms,
924    D7P5Ms,
925    #[doc(hidden)]
926    __SourceBreaking {
927        unknown_ordinal: u32,
928    },
929}
930
931/// Pattern that matches an unknown `Lc3FrameDuration` member.
932#[macro_export]
933macro_rules! Lc3FrameDurationUnknown {
934    () => {
935        _
936    };
937}
938
939impl Lc3FrameDuration {
940    #[inline]
941    pub fn from_primitive(prim: u32) -> Option<Self> {
942        match prim {
943            1 => Some(Self::D10Ms),
944            2 => Some(Self::D7P5Ms),
945            _ => None,
946        }
947    }
948
949    #[inline]
950    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
951        match prim {
952            1 => Self::D10Ms,
953            2 => Self::D7P5Ms,
954            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
955        }
956    }
957
958    #[inline]
959    pub fn unknown() -> Self {
960        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
961    }
962
963    #[inline]
964    pub const fn into_primitive(self) -> u32 {
965        match self {
966            Self::D10Ms => 1,
967            Self::D7P5Ms => 2,
968            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
969        }
970    }
971
972    #[inline]
973    pub fn is_unknown(&self) -> bool {
974        match self {
975            Self::__SourceBreaking { unknown_ordinal: _ } => true,
976            _ => false,
977        }
978    }
979}
980
981/// This enum indicates the StreamProcessor input or output. This is used in
982/// messages which can apply to either input or output. For example, the
983/// `StreamProcessor.ParticipateInBufferAllocation` message includes a `port`
984/// field.
985#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
986pub enum Port {
987    Invalid,
988    Input,
989    Output,
990    #[doc(hidden)]
991    __SourceBreaking {
992        unknown_ordinal: u32,
993    },
994}
995
996/// Pattern that matches an unknown `Port` member.
997#[macro_export]
998macro_rules! PortUnknown {
999    () => {
1000        _
1001    };
1002}
1003
1004impl Port {
1005    #[inline]
1006    pub fn from_primitive(prim: u32) -> Option<Self> {
1007        match prim {
1008            0 => Some(Self::Invalid),
1009            1 => Some(Self::Input),
1010            2 => Some(Self::Output),
1011            _ => None,
1012        }
1013    }
1014
1015    #[inline]
1016    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
1017        match prim {
1018            0 => Self::Invalid,
1019            1 => Self::Input,
1020            2 => Self::Output,
1021            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
1022        }
1023    }
1024
1025    #[inline]
1026    pub fn unknown() -> Self {
1027        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
1028    }
1029
1030    #[inline]
1031    pub const fn into_primitive(self) -> u32 {
1032        match self {
1033            Self::Invalid => 0,
1034            Self::Input => 1,
1035            Self::Output => 2,
1036            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
1037        }
1038    }
1039
1040    #[inline]
1041    pub fn is_unknown(&self) -> bool {
1042        match self {
1043            Self::__SourceBreaking { unknown_ordinal: _ } => true,
1044            _ => false,
1045        }
1046    }
1047}
1048
1049#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
1050#[repr(u32)]
1051pub enum SbcAllocation {
1052    AllocLoudness = 0,
1053    AllocSnr = 1,
1054}
1055
1056impl SbcAllocation {
1057    #[inline]
1058    pub fn from_primitive(prim: u32) -> Option<Self> {
1059        match prim {
1060            0 => Some(Self::AllocLoudness),
1061            1 => Some(Self::AllocSnr),
1062            _ => None,
1063        }
1064    }
1065
1066    #[inline]
1067    pub const fn into_primitive(self) -> u32 {
1068        self as u32
1069    }
1070}
1071
1072#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
1073#[repr(u32)]
1074pub enum SbcBlockCount {
1075    BlockCount4 = 4,
1076    BlockCount8 = 8,
1077    BlockCount12 = 12,
1078    BlockCount16 = 16,
1079}
1080
1081impl SbcBlockCount {
1082    #[inline]
1083    pub fn from_primitive(prim: u32) -> Option<Self> {
1084        match prim {
1085            4 => Some(Self::BlockCount4),
1086            8 => Some(Self::BlockCount8),
1087            12 => Some(Self::BlockCount12),
1088            16 => Some(Self::BlockCount16),
1089            _ => None,
1090        }
1091    }
1092
1093    #[inline]
1094    pub const fn into_primitive(self) -> u32 {
1095        self as u32
1096    }
1097}
1098
1099#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
1100#[repr(u32)]
1101pub enum SbcChannelMode {
1102    Mono = 0,
1103    Dual = 1,
1104    Stereo = 2,
1105    JointStereo = 3,
1106}
1107
1108impl SbcChannelMode {
1109    #[inline]
1110    pub fn from_primitive(prim: u32) -> Option<Self> {
1111        match prim {
1112            0 => Some(Self::Mono),
1113            1 => Some(Self::Dual),
1114            2 => Some(Self::Stereo),
1115            3 => Some(Self::JointStereo),
1116            _ => None,
1117        }
1118    }
1119
1120    #[inline]
1121    pub const fn into_primitive(self) -> u32 {
1122        self as u32
1123    }
1124}
1125
1126#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
1127#[repr(u32)]
1128pub enum SbcSubBands {
1129    SubBands4 = 4,
1130    SubBands8 = 8,
1131}
1132
1133impl SbcSubBands {
1134    #[inline]
1135    pub fn from_primitive(prim: u32) -> Option<Self> {
1136        match prim {
1137            4 => Some(Self::SubBands4),
1138            8 => Some(Self::SubBands8),
1139            _ => None,
1140        }
1141    }
1142
1143    #[inline]
1144    pub const fn into_primitive(self) -> u32 {
1145        self as u32
1146    }
1147}
1148
1149/// StreamError
1150///
1151/// This error code encapsulates various errors that might emanate from a
1152/// StreamProcessor server. It can be sent either as an OnStreamFailed event or
1153/// as an epitaph for the channel.
1154#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
1155#[repr(u32)]
1156pub enum StreamError {
1157    /// An internal error with an unspecified reason.
1158    Unknown = 1,
1159    /// The client provided invalid input format details.
1160    InvalidInputFormatDetails = 2,
1161    /// The server received buffers that are not suitable for the operation to
1162    /// be performed. An example of this would be if a Decoder received output
1163    /// buffers that are too small to decode a frame into.
1164    IncompatibleBuffersProvided = 3,
1165    /// Processing of input EOS (end of stream) failed, so the stream failed.
1166    /// Currently this can occur if a core codec watchdog fires while processing
1167    /// EOS.
1168    EosProcessing = 4,
1169    /// An internal decoder error with an unspecified reason.
1170    DecoderUnknown = 16777217,
1171    /// Input data that can't be parsed.  Only some parsing problems/errors are
1172    /// reported this way.  Corrupt input data may be reported as other
1173    /// StreamError, or may not cause a StreamError.
1174    DecoderDataParsing = 16777218,
1175    /// An internal encoder error with an unspecified reason.
1176    EncoderUnknown = 33554433,
1177    /// An internal decryptor error with an unspecified reason.
1178    DecryptorUnknown = 50331649,
1179    /// The requested KeyId is not available for use by the Decryptor. The
1180    /// client may try again later if that key becomes available.
1181    DecryptorNoKey = 50331650,
1182}
1183
1184impl StreamError {
1185    #[inline]
1186    pub fn from_primitive(prim: u32) -> Option<Self> {
1187        match prim {
1188            1 => Some(Self::Unknown),
1189            2 => Some(Self::InvalidInputFormatDetails),
1190            3 => Some(Self::IncompatibleBuffersProvided),
1191            4 => Some(Self::EosProcessing),
1192            16777217 => Some(Self::DecoderUnknown),
1193            16777218 => Some(Self::DecoderDataParsing),
1194            33554433 => Some(Self::EncoderUnknown),
1195            50331649 => Some(Self::DecryptorUnknown),
1196            50331650 => Some(Self::DecryptorNoKey),
1197            _ => None,
1198        }
1199    }
1200
1201    #[inline]
1202    pub const fn into_primitive(self) -> u32 {
1203        self as u32
1204    }
1205}
1206
1207#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
1208#[repr(u32)]
1209pub enum VideoColorSpace {
1210    Invalid = 0,
1211}
1212
1213impl VideoColorSpace {
1214    #[inline]
1215    pub fn from_primitive(prim: u32) -> Option<Self> {
1216        match prim {
1217            0 => Some(Self::Invalid),
1218            _ => None,
1219        }
1220    }
1221
1222    #[inline]
1223    pub const fn into_primitive(self) -> u32 {
1224        self as u32
1225    }
1226}
1227
1228#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1229#[repr(C)]
1230pub struct AacConstantBitRate {
1231    /// Bits per second
1232    pub bit_rate: u32,
1233}
1234
1235impl fidl::Persistable for AacConstantBitRate {}
1236
1237#[derive(Clone, Debug, PartialEq)]
1238pub struct AacEncoderSettings {
1239    pub transport: AacTransport,
1240    pub channel_mode: AacChannelMode,
1241    pub bit_rate: AacBitRate,
1242    pub aot: AacAudioObjectType,
1243}
1244
1245impl fidl::Persistable for AacEncoderSettings {}
1246
1247/// AAC inside ADTS
1248#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1249pub struct AacTransportAdts;
1250
1251impl fidl::Persistable for AacTransportAdts {}
1252
1253/// AAC inside LATM
1254#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1255pub struct AacTransportLatm {
1256    /// Whether MuxConfiguration stream element is present
1257    pub mux_config_present: bool,
1258}
1259
1260impl fidl::Persistable for AacTransportLatm {}
1261
1262/// Raw AAC access units.
1263#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1264pub struct AacTransportRaw;
1265
1266impl fidl::Persistable for AacTransportRaw {}
1267
1268#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1269pub struct ActivityReporterWatchCaptureActivityResponse {
1270    pub active_usages: Vec<AudioCaptureUsage>,
1271}
1272
1273impl fidl::Persistable for ActivityReporterWatchCaptureActivityResponse {}
1274
1275#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1276pub struct ActivityReporterWatchRenderActivityResponse {
1277    pub active_usages: Vec<AudioRenderUsage>,
1278}
1279
1280impl fidl::Persistable for ActivityReporterWatchRenderActivityResponse {}
1281
1282#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1283pub struct ActivityReporterWatchCaptureActivity2Response {
1284    pub active_usages: Vec<AudioCaptureUsage2>,
1285}
1286
1287impl fidl::Persistable for ActivityReporterWatchCaptureActivity2Response {}
1288
1289#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1290pub struct ActivityReporterWatchRenderActivity2Response {
1291    pub active_usages: Vec<AudioRenderUsage2>,
1292}
1293
1294impl fidl::Persistable for ActivityReporterWatchRenderActivity2Response {}
1295
1296#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1297#[repr(C)]
1298pub struct AudioCapturerCaptureAtRequest {
1299    pub payload_buffer_id: u32,
1300    pub payload_offset: u32,
1301    pub frames: u32,
1302}
1303
1304impl fidl::Persistable for AudioCapturerCaptureAtRequest {}
1305
1306#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1307#[repr(C)]
1308pub struct AudioCapturerCaptureAtResponse {
1309    pub captured_packet: StreamPacket,
1310}
1311
1312impl fidl::Persistable for AudioCapturerCaptureAtResponse {}
1313
1314#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1315pub struct AudioCapturerGetStreamTypeResponse {
1316    pub stream_type: StreamType,
1317}
1318
1319impl fidl::Persistable for AudioCapturerGetStreamTypeResponse {}
1320
1321#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1322pub struct AudioCapturerSetPcmStreamTypeRequest {
1323    pub stream_type: AudioStreamType,
1324}
1325
1326impl fidl::Persistable for AudioCapturerSetPcmStreamTypeRequest {}
1327
1328#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1329pub struct AudioCapturerSetUsage2Request {
1330    pub usage: AudioCaptureUsage2,
1331}
1332
1333impl fidl::Persistable for AudioCapturerSetUsage2Request {}
1334
1335#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1336pub struct AudioCapturerSetUsageRequest {
1337    pub usage: AudioCaptureUsage,
1338}
1339
1340impl fidl::Persistable for AudioCapturerSetUsageRequest {}
1341
1342#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1343#[repr(C)]
1344pub struct AudioCapturerStartAsyncCaptureRequest {
1345    pub frames_per_packet: u32,
1346}
1347
1348impl fidl::Persistable for AudioCapturerStartAsyncCaptureRequest {}
1349
1350#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1351pub struct AudioCompressedFormatAac;
1352
1353impl fidl::Persistable for AudioCompressedFormatAac {}
1354
1355#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1356pub struct AudioCompressedFormatSbc;
1357
1358impl fidl::Persistable for AudioCompressedFormatSbc {}
1359
1360#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
1361pub struct AudioConsumerSetRateRequest {
1362    pub rate: f32,
1363}
1364
1365impl fidl::Persistable for AudioConsumerSetRateRequest {}
1366
1367#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1368pub struct AudioConsumerStartRequest {
1369    pub flags: AudioConsumerStartFlags,
1370    pub reference_time: i64,
1371    pub media_time: i64,
1372}
1373
1374impl fidl::Persistable for AudioConsumerStartRequest {}
1375
1376#[derive(Clone, Debug, PartialEq)]
1377pub struct AudioConsumerWatchStatusResponse {
1378    pub status: AudioConsumerStatus,
1379}
1380
1381impl fidl::Persistable for AudioConsumerWatchStatusResponse {}
1382
1383#[derive(Clone, Debug, PartialEq)]
1384pub struct AudioCoreGetDbFromVolume2Request {
1385    pub usage: Usage2,
1386    pub volume: f32,
1387}
1388
1389impl fidl::Persistable for AudioCoreGetDbFromVolume2Request {}
1390
1391#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
1392pub struct AudioCoreGetDbFromVolumeRequest {
1393    pub usage: Usage,
1394    pub volume: f32,
1395}
1396
1397impl fidl::Persistable for AudioCoreGetDbFromVolumeRequest {}
1398
1399#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
1400pub struct AudioCoreGetDbFromVolumeResponse {
1401    pub gain_db: f32,
1402}
1403
1404impl fidl::Persistable for AudioCoreGetDbFromVolumeResponse {}
1405
1406#[derive(Clone, Debug, PartialEq)]
1407pub struct AudioCoreGetVolumeFromDb2Request {
1408    pub usage: Usage2,
1409    pub gain_db: f32,
1410}
1411
1412impl fidl::Persistable for AudioCoreGetVolumeFromDb2Request {}
1413
1414#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
1415pub struct AudioCoreGetVolumeFromDbRequest {
1416    pub usage: Usage,
1417    pub gain_db: f32,
1418}
1419
1420impl fidl::Persistable for AudioCoreGetVolumeFromDbRequest {}
1421
1422#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
1423pub struct AudioCoreGetVolumeFromDbResponse {
1424    pub volume: f32,
1425}
1426
1427impl fidl::Persistable for AudioCoreGetVolumeFromDbResponse {}
1428
1429#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
1430pub struct AudioCoreSetCaptureUsageGain2Request {
1431    pub usage: AudioCaptureUsage2,
1432    pub gain_db: f32,
1433}
1434
1435impl fidl::Persistable for AudioCoreSetCaptureUsageGain2Request {}
1436
1437#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
1438pub struct AudioCoreSetCaptureUsageGainRequest {
1439    pub usage: AudioCaptureUsage,
1440    pub gain_db: f32,
1441}
1442
1443impl fidl::Persistable for AudioCoreSetCaptureUsageGainRequest {}
1444
1445#[derive(Clone, Debug, PartialEq)]
1446pub struct AudioCoreSetInteraction2Request {
1447    pub active: Usage2,
1448    pub affected: Usage2,
1449    pub behavior: Behavior,
1450}
1451
1452impl fidl::Persistable for AudioCoreSetInteraction2Request {}
1453
1454#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1455pub struct AudioCoreSetInteractionRequest {
1456    pub active: Usage,
1457    pub affected: Usage,
1458    pub behavior: Behavior,
1459}
1460
1461impl fidl::Persistable for AudioCoreSetInteractionRequest {}
1462
1463#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
1464pub struct AudioCoreSetRenderUsageGain2Request {
1465    pub usage: AudioRenderUsage2,
1466    pub gain_db: f32,
1467}
1468
1469impl fidl::Persistable for AudioCoreSetRenderUsageGain2Request {}
1470
1471#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
1472pub struct AudioCoreSetRenderUsageGainRequest {
1473    pub usage: AudioRenderUsage,
1474    pub gain_db: f32,
1475}
1476
1477impl fidl::Persistable for AudioCoreSetRenderUsageGainRequest {}
1478
1479#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
1480pub struct AudioCoreGetDbFromVolume2Response {
1481    pub gain_db: f32,
1482}
1483
1484impl fidl::Persistable for AudioCoreGetDbFromVolume2Response {}
1485
1486#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
1487pub struct AudioCoreGetVolumeFromDb2Response {
1488    pub volume: f32,
1489}
1490
1491impl fidl::Persistable for AudioCoreGetVolumeFromDb2Response {}
1492
1493#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1494#[repr(C)]
1495pub struct AudioDeviceEnumeratorGetDeviceGainRequest {
1496    pub device_token: u64,
1497}
1498
1499impl fidl::Persistable for AudioDeviceEnumeratorGetDeviceGainRequest {}
1500
1501#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
1502pub struct AudioDeviceEnumeratorGetDeviceGainResponse {
1503    pub device_token: u64,
1504    pub gain_info: AudioGainInfo,
1505}
1506
1507impl fidl::Persistable for AudioDeviceEnumeratorGetDeviceGainResponse {}
1508
1509#[derive(Clone, Debug, PartialEq, PartialOrd)]
1510pub struct AudioDeviceEnumeratorGetDevicesResponse {
1511    pub devices: Vec<AudioDeviceInfo>,
1512}
1513
1514impl fidl::Persistable for AudioDeviceEnumeratorGetDevicesResponse {}
1515
1516#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1517#[repr(C)]
1518pub struct AudioDeviceEnumeratorOnDefaultDeviceChangedRequest {
1519    pub old_default_token: u64,
1520    pub new_default_token: u64,
1521}
1522
1523impl fidl::Persistable for AudioDeviceEnumeratorOnDefaultDeviceChangedRequest {}
1524
1525#[derive(Clone, Debug, PartialEq, PartialOrd)]
1526pub struct AudioDeviceEnumeratorOnDeviceAddedRequest {
1527    pub device: AudioDeviceInfo,
1528}
1529
1530impl fidl::Persistable for AudioDeviceEnumeratorOnDeviceAddedRequest {}
1531
1532#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
1533pub struct AudioDeviceEnumeratorOnDeviceGainChangedRequest {
1534    pub device_token: u64,
1535    pub gain_info: AudioGainInfo,
1536}
1537
1538impl fidl::Persistable for AudioDeviceEnumeratorOnDeviceGainChangedRequest {}
1539
1540#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1541#[repr(C)]
1542pub struct AudioDeviceEnumeratorOnDeviceRemovedRequest {
1543    pub device_token: u64,
1544}
1545
1546impl fidl::Persistable for AudioDeviceEnumeratorOnDeviceRemovedRequest {}
1547
1548#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
1549pub struct AudioDeviceEnumeratorSetDeviceGainRequest {
1550    pub device_token: u64,
1551    pub gain_info: AudioGainInfo,
1552    pub valid_flags: AudioGainValidFlags,
1553}
1554
1555impl fidl::Persistable for AudioDeviceEnumeratorSetDeviceGainRequest {}
1556
1557#[derive(Clone, Debug, PartialEq, PartialOrd)]
1558pub struct AudioDeviceInfo {
1559    pub name: String,
1560    pub unique_id: String,
1561    pub token_id: u64,
1562    pub is_input: bool,
1563    pub gain_info: AudioGainInfo,
1564    pub is_default: bool,
1565}
1566
1567impl fidl::Persistable for AudioDeviceInfo {}
1568
1569#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
1570pub struct AudioGainInfo {
1571    pub gain_db: f32,
1572    pub flags: AudioGainInfoFlags,
1573}
1574
1575impl fidl::Persistable for AudioGainInfo {}
1576
1577#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1578pub struct AudioRendererEnableMinLeadTimeEventsRequest {
1579    pub enabled: bool,
1580}
1581
1582impl fidl::Persistable for AudioRendererEnableMinLeadTimeEventsRequest {}
1583
1584#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1585#[repr(C)]
1586pub struct AudioRendererGetMinLeadTimeResponse {
1587    pub min_lead_time_nsec: i64,
1588}
1589
1590impl fidl::Persistable for AudioRendererGetMinLeadTimeResponse {}
1591
1592#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1593#[repr(C)]
1594pub struct AudioRendererOnMinLeadTimeChangedRequest {
1595    pub min_lead_time_nsec: i64,
1596}
1597
1598impl fidl::Persistable for AudioRendererOnMinLeadTimeChangedRequest {}
1599
1600#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1601#[repr(C)]
1602pub struct AudioRendererPauseResponse {
1603    pub reference_time: i64,
1604    pub media_time: i64,
1605}
1606
1607impl fidl::Persistable for AudioRendererPauseResponse {}
1608
1609#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1610#[repr(C)]
1611pub struct AudioRendererPlayNoReplyRequest {
1612    pub reference_time: i64,
1613    pub media_time: i64,
1614}
1615
1616impl fidl::Persistable for AudioRendererPlayNoReplyRequest {}
1617
1618#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1619#[repr(C)]
1620pub struct AudioRendererPlayRequest {
1621    pub reference_time: i64,
1622    pub media_time: i64,
1623}
1624
1625impl fidl::Persistable for AudioRendererPlayRequest {}
1626
1627#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1628#[repr(C)]
1629pub struct AudioRendererPlayResponse {
1630    pub reference_time: i64,
1631    pub media_time: i64,
1632}
1633
1634impl fidl::Persistable for AudioRendererPlayResponse {}
1635
1636#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1637pub struct AudioRendererSetPcmStreamTypeRequest {
1638    pub type_: AudioStreamType,
1639}
1640
1641impl fidl::Persistable for AudioRendererSetPcmStreamTypeRequest {}
1642
1643#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
1644pub struct AudioRendererSetPtsContinuityThresholdRequest {
1645    pub threshold_seconds: f32,
1646}
1647
1648impl fidl::Persistable for AudioRendererSetPtsContinuityThresholdRequest {}
1649
1650#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1651#[repr(C)]
1652pub struct AudioRendererSetPtsUnitsRequest {
1653    pub tick_per_second_numerator: u32,
1654    pub tick_per_second_denominator: u32,
1655}
1656
1657impl fidl::Persistable for AudioRendererSetPtsUnitsRequest {}
1658
1659#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1660pub struct AudioRendererSetUsage2Request {
1661    pub usage2: AudioRenderUsage2,
1662}
1663
1664impl fidl::Persistable for AudioRendererSetUsage2Request {}
1665
1666#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1667pub struct AudioRendererSetUsageRequest {
1668    pub usage: AudioRenderUsage,
1669}
1670
1671impl fidl::Persistable for AudioRendererSetUsageRequest {}
1672
1673/// Describes the type of an audio elementary stream.
1674#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1675pub struct AudioStreamType {
1676    pub sample_format: AudioSampleFormat,
1677    pub channels: u32,
1678    pub frames_per_second: u32,
1679}
1680
1681impl fidl::Persistable for AudioStreamType {}
1682
1683/// Describes the compression applied to a stream. This type can be used in conjunction with
1684/// `AudioStreamType` or `VideoStreamType` to represent a medium-specific compressed type.
1685#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1686pub struct Compression {
1687    /// The type of compression applied to the stream. This is generally one of the *_ENCODING_*
1688    /// values, though `AUDIO_ENCODING_LPCM` and `VIDEO_ENCODING_UNCOMPRESSED` must not be used,
1689    /// because those encodings are regarded as uncompressed.
1690    pub type_: String,
1691    /// Type-specific, opaque 'out-of-band' parameters describing the compression of the stream.
1692    pub parameters: Option<Vec<u8>>,
1693}
1694
1695impl fidl::Persistable for Compression {}
1696
1697/// EncryptionPattern
1698///
1699/// Pattern encryption utilizes a pattern of encrypted and clear 16 byte blocks
1700/// over the protected range of a subsample (the encrypted_bytes of a
1701/// `SubsampleEntry`). This structure specifies the number of encrypted data
1702/// blocks followed by the number of clear data blocks.
1703#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1704#[repr(C)]
1705pub struct EncryptionPattern {
1706    pub clear_blocks: u32,
1707    pub encrypted_blocks: u32,
1708}
1709
1710impl fidl::Persistable for EncryptionPattern {}
1711
1712#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1713pub struct Metadata {
1714    pub properties: Vec<Property>,
1715}
1716
1717impl fidl::Persistable for Metadata {}
1718
1719/// Parameter
1720///
1721/// Generic parameter.
1722///
1723/// We want to minimize use of this generic "Parameter" structure by natively
1724/// defining as many stream-specific parameter semantics as we can.
1725#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1726pub struct Parameter {
1727    pub scope: String,
1728    pub name: String,
1729    pub value: Value,
1730}
1731
1732impl fidl::Persistable for Parameter {}
1733
1734/// PcmFormat
1735///
1736/// PCM audio format details.
1737#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1738pub struct PcmFormat {
1739    pub pcm_mode: AudioPcmMode,
1740    pub bits_per_sample: u32,
1741    pub frames_per_second: u32,
1742    pub channel_map: Vec<AudioChannelId>,
1743}
1744
1745impl fidl::Persistable for PcmFormat {}
1746
1747#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1748#[repr(C)]
1749pub struct ProfileProviderRegisterHandlerWithCapacityResponse {
1750    pub period: i64,
1751    pub capacity: i64,
1752}
1753
1754impl fidl::Persistable for ProfileProviderRegisterHandlerWithCapacityResponse {}
1755
1756#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1757pub struct Property {
1758    pub label: String,
1759    pub value: String,
1760}
1761
1762impl fidl::Persistable for Property {}
1763
1764/// Settings for an SBC Encoder.
1765///
1766/// SBC Encoders take signed little endian 16 bit linear PCM samples and
1767/// return encoded SBC frames. SBC encoder PCM data in batches of
1768/// `sub_bands * block_count` PCM frames. This encoder will accept PCM data on
1769/// arbitrary frame boundaries, but the output flushed when EOS is queued may be
1770/// zero-padded to make a full batch for encoding.
1771#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1772pub struct SbcEncoderSettings {
1773    pub sub_bands: SbcSubBands,
1774    pub allocation: SbcAllocation,
1775    pub block_count: SbcBlockCount,
1776    pub channel_mode: SbcChannelMode,
1777    /// SBC bit pool value.
1778    pub bit_pool: u64,
1779}
1780
1781impl fidl::Persistable for SbcEncoderSettings {}
1782
1783#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1784#[repr(C)]
1785pub struct StreamBufferSetRemovePayloadBufferRequest {
1786    pub id: u32,
1787}
1788
1789impl fidl::Persistable for StreamBufferSetRemovePayloadBufferRequest {}
1790
1791/// Describes a packet consumed by `StreamSink` or produced by `StreamSource`.
1792#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1793#[repr(C)]
1794pub struct StreamPacket {
1795    /// Time at which the packet is to be presented, according to the
1796    /// presentation clock.
1797    pub pts: i64,
1798    /// ID of the payload buffer used for this packet.
1799    ///
1800    /// When this struct is used with `StreamBufferSet`, this field is the ID of
1801    /// a payload buffer provided via `StreamBufferSet.AddPayloadBuffer`. In
1802    /// that case, this value must identify a payload buffer in the current set.
1803    /// Other interfaces may define different semantics for this field.
1804    pub payload_buffer_id: u32,
1805    /// Offset of the packet payload in the payload buffer.
1806    ///
1807    /// This value plus the `payload_size` value must be less than or equal to
1808    /// the size of the referenced payload buffer.
1809    pub payload_offset: u64,
1810    /// Size in bytes of the payload.
1811    ///
1812    /// This value plus the `payload_offest` value must be less than or equal to
1813    /// the size of the referenced payload buffer.
1814    pub payload_size: u64,
1815    /// An bitwise-or'ed set of flags (see constants below) describing
1816    /// properties of this packet.
1817    pub flags: u32,
1818    /// The buffer configuration associated with this packet. The semantics of
1819    /// this field depend on the interface with which this struct is used.
1820    /// In many contexts, this field is not used. This field is intended for
1821    /// situations in which buffer configurations (i.e. sets of payload buffers)
1822    /// are explicitly identified. In such cases, the `payload_buffer_id` refers
1823    /// to a payload buffer in the buffer configuration identified by this
1824    /// field.
1825    pub buffer_config: u64,
1826    /// The stream segment associated with this packet. The semantics of this
1827    /// field depend on the interface with which this struct is used. In many
1828    /// contexts, this field is not used. This field is intended to distinguish
1829    /// contiguous segments of the stream where stream properties (e.g.
1830    /// encoding) may differ from segment to segment.
1831    pub stream_segment_id: u64,
1832}
1833
1834impl fidl::Persistable for StreamPacket {}
1835
1836#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1837pub struct StreamProcessorCloseCurrentStreamRequest {
1838    pub stream_lifetime_ordinal: u64,
1839    pub release_input_buffers: bool,
1840    pub release_output_buffers: bool,
1841}
1842
1843impl fidl::Persistable for StreamProcessorCloseCurrentStreamRequest {}
1844
1845#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1846#[repr(C)]
1847pub struct StreamProcessorCompleteOutputBufferPartialSettingsRequest {
1848    pub buffer_lifetime_ordinal: u64,
1849}
1850
1851impl fidl::Persistable for StreamProcessorCompleteOutputBufferPartialSettingsRequest {}
1852
1853#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1854#[repr(C)]
1855pub struct StreamProcessorFlushEndOfStreamAndCloseStreamRequest {
1856    pub stream_lifetime_ordinal: u64,
1857}
1858
1859impl fidl::Persistable for StreamProcessorFlushEndOfStreamAndCloseStreamRequest {}
1860
1861#[derive(Clone, Debug, PartialEq)]
1862pub struct StreamProcessorOnFreeInputPacketRequest {
1863    pub free_input_packet: PacketHeader,
1864}
1865
1866impl fidl::Persistable for StreamProcessorOnFreeInputPacketRequest {}
1867
1868#[derive(Clone, Debug, PartialEq)]
1869pub struct StreamProcessorOnInputConstraintsRequest {
1870    pub input_constraints: StreamBufferConstraints,
1871}
1872
1873impl fidl::Persistable for StreamProcessorOnInputConstraintsRequest {}
1874
1875#[derive(Clone, Debug, PartialEq)]
1876pub struct StreamProcessorOnOutputConstraintsRequest {
1877    pub output_config: StreamOutputConstraints,
1878}
1879
1880impl fidl::Persistable for StreamProcessorOnOutputConstraintsRequest {}
1881
1882#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1883pub struct StreamProcessorOnOutputEndOfStreamRequest {
1884    pub stream_lifetime_ordinal: u64,
1885    pub error_detected_before: bool,
1886}
1887
1888impl fidl::Persistable for StreamProcessorOnOutputEndOfStreamRequest {}
1889
1890#[derive(Clone, Debug, PartialEq)]
1891pub struct StreamProcessorOnOutputFormatRequest {
1892    pub output_format: StreamOutputFormat,
1893}
1894
1895impl fidl::Persistable for StreamProcessorOnOutputFormatRequest {}
1896
1897#[derive(Clone, Debug, PartialEq)]
1898pub struct StreamProcessorOnOutputPacketRequest {
1899    pub output_packet: Packet,
1900    pub error_detected_before: bool,
1901    pub error_detected_during: bool,
1902}
1903
1904impl fidl::Persistable for StreamProcessorOnOutputPacketRequest {}
1905
1906#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1907pub struct StreamProcessorOnStreamFailedRequest {
1908    pub stream_lifetime_ordinal: u64,
1909    pub error: StreamError,
1910}
1911
1912impl fidl::Persistable for StreamProcessorOnStreamFailedRequest {}
1913
1914#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1915#[repr(C)]
1916pub struct StreamProcessorQueueInputEndOfStreamRequest {
1917    pub stream_lifetime_ordinal: u64,
1918}
1919
1920impl fidl::Persistable for StreamProcessorQueueInputEndOfStreamRequest {}
1921
1922#[derive(Clone, Debug, PartialEq)]
1923pub struct StreamProcessorQueueInputFormatDetailsRequest {
1924    pub stream_lifetime_ordinal: u64,
1925    pub format_details: FormatDetails,
1926}
1927
1928impl fidl::Persistable for StreamProcessorQueueInputFormatDetailsRequest {}
1929
1930#[derive(Clone, Debug, PartialEq)]
1931pub struct StreamProcessorQueueInputPacketRequest {
1932    pub packet: Packet,
1933}
1934
1935impl fidl::Persistable for StreamProcessorQueueInputPacketRequest {}
1936
1937#[derive(Clone, Debug, PartialEq)]
1938pub struct StreamProcessorRecycleOutputPacketRequest {
1939    pub available_output_packet: PacketHeader,
1940}
1941
1942impl fidl::Persistable for StreamProcessorRecycleOutputPacketRequest {}
1943
1944#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1945#[repr(C)]
1946pub struct StreamSinkSendPacketNoReplyRequest {
1947    pub packet: StreamPacket,
1948}
1949
1950impl fidl::Persistable for StreamSinkSendPacketNoReplyRequest {}
1951
1952#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1953#[repr(C)]
1954pub struct StreamSinkSendPacketRequest {
1955    pub packet: StreamPacket,
1956}
1957
1958impl fidl::Persistable for StreamSinkSendPacketRequest {}
1959
1960#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1961#[repr(C)]
1962pub struct StreamSourceOnPacketProducedRequest {
1963    pub packet: StreamPacket,
1964}
1965
1966impl fidl::Persistable for StreamSourceOnPacketProducedRequest {}
1967
1968#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1969#[repr(C)]
1970pub struct StreamSourceReleasePacketRequest {
1971    pub packet: StreamPacket,
1972}
1973
1974impl fidl::Persistable for StreamSourceReleasePacketRequest {}
1975
1976/// Describes the type of an elementary stream.
1977#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1978pub struct StreamType {
1979    /// Medium-specific type information.
1980    pub medium_specific: MediumSpecificStreamType,
1981    /// Encoding (see constants below). This value is represented as a string
1982    /// so that new encodings can be introduced without modifying this file.
1983    pub encoding: String,
1984    /// Encoding-specific parameters, sometimes referred to as 'out-of-band
1985    /// data'. Typically, this data is associated with a compressed stream and
1986    /// provides parameters required to decompress the stream. This data is
1987    /// generally opaque to all parties except the producer and consumer of the
1988    /// stream.
1989    pub encoding_parameters: Option<Vec<u8>>,
1990}
1991
1992impl fidl::Persistable for StreamType {}
1993
1994/// Describes the type of a subpicture elementary stream.
1995#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1996pub struct SubpictureStreamType;
1997
1998impl fidl::Persistable for SubpictureStreamType {}
1999
2000/// SubsampleEntry
2001///
2002/// A subsample is a byte range within a sample consisting of a clear byte range
2003/// followed by an encrypted byte range. This structure specifies the size of
2004/// each range in the subsample.
2005#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
2006#[repr(C)]
2007pub struct SubsampleEntry {
2008    pub clear_bytes: u32,
2009    pub encrypted_bytes: u32,
2010}
2011
2012impl fidl::Persistable for SubsampleEntry {}
2013
2014/// Describes the type of a text elementary stream.
2015#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
2016pub struct TextStreamType;
2017
2018impl fidl::Persistable for TextStreamType {}
2019
2020/// A TimelineFunction represents a relationship between a subject timeline and a
2021/// reference timeline with a linear relation.
2022///
2023/// For example, consider a common use case in which reference time is the
2024/// monotonic clock of a system and subject time is intended presentation time
2025/// for some media such as a video.
2026///
2027/// `reference_time` is the value of the monotonic clock at the beginning of
2028/// playback. `subject_time` is 0 assuming playback starts at the beginning of
2029/// the media. We then choose a `reference_delta` and `subject_delta` so that
2030/// `subject_delta` / `reference_delta` represents the desired playback rate,
2031/// e.g. 0/1 for paused and 1/1 for normal playback.
2032///
2033/// ## Formulas
2034///
2035/// With a function we can determine the subject timeline value `s` in terms of
2036/// reference timeline value `r` with this formula (where `reference_delta` > 0):
2037///
2038///   s = (r - reference_time) * (subject_delta / reference_delta) + subject_time
2039///
2040/// And similarly we can find the reference timeline value `r` in terms of
2041/// subject timeline value `s` with this formula (where `subject_delta` > 0):
2042///
2043///   r = (s - subject_time) * (reference_delta / subject_delta) + referenc_time
2044///
2045/// ## Choosing time values
2046///
2047/// Time values can be arbitrary and our linear relation will of course be the
2048/// same, but we can use them to represent the bounds of pieces in a piecewise
2049/// linear relation.
2050///
2051/// For example, if a user performs skip-chapter, we might want to describe
2052/// this with a TimelineFunction whose `subject_time` is the time to skip to,
2053/// `reference_time` is now plus some epsilon, and delta ratio is 1/1 for normal
2054/// playback rate.
2055#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
2056#[repr(C)]
2057pub struct TimelineFunction {
2058    pub subject_time: i64,
2059    pub reference_time: i64,
2060    pub subject_delta: u32,
2061    pub reference_delta: u32,
2062}
2063
2064impl fidl::Persistable for TimelineFunction {}
2065
2066#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
2067pub struct UsageGainListenerOnGainMuteChangedRequest {
2068    pub muted: bool,
2069    pub gain_dbfs: f32,
2070}
2071
2072impl fidl::Persistable for UsageGainListenerOnGainMuteChangedRequest {}
2073
2074#[derive(Clone, Debug, PartialEq)]
2075pub struct UsageWatcher2OnStateChangedRequest {
2076    pub usage: Usage2,
2077    pub state: UsageState,
2078}
2079
2080impl fidl::Persistable for UsageWatcher2OnStateChangedRequest {}
2081
2082#[derive(Clone, Debug, PartialEq)]
2083pub struct UsageWatcherOnStateChangedRequest {
2084    pub usage: Usage,
2085    pub state: UsageState,
2086}
2087
2088impl fidl::Persistable for UsageWatcherOnStateChangedRequest {}
2089
2090/// Describes the type of a video elementary stream.
2091#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
2092pub struct VideoStreamType {
2093    pub pixel_format: fidl_fuchsia_images_common::PixelFormat,
2094    pub color_space: ColorSpace,
2095    /// Dimensions of the video frames as displayed in pixels.
2096    pub width: u32,
2097    pub height: u32,
2098    /// Dimensions of the video frames as encoded in pixels. These values must
2099    /// be equal to or greater than the respective width/height values.
2100    pub coded_width: u32,
2101    pub coded_height: u32,
2102    /// The aspect ratio of a single pixel as frames are intended to be
2103    /// displayed.
2104    pub pixel_aspect_ratio_width: u32,
2105    pub pixel_aspect_ratio_height: u32,
2106    /// The number of bytes per 'coded' row in the primary video plane.
2107    pub stride: u32,
2108}
2109
2110impl fidl::Persistable for VideoStreamType {}
2111
2112/// VideoUncompressedFormat
2113///
2114/// Uncompressed video format details.
2115#[derive(Clone, Debug, PartialEq)]
2116pub struct VideoUncompressedFormat {
2117    pub image_format: fidl_fuchsia_sysmem_common::ImageFormat2,
2118    pub fourcc: u32,
2119    pub primary_width_pixels: u32,
2120    pub primary_height_pixels: u32,
2121    pub secondary_width_pixels: u32,
2122    pub secondary_height_pixels: u32,
2123    pub planar: bool,
2124    pub swizzled: bool,
2125    pub primary_line_stride_bytes: u32,
2126    pub secondary_line_stride_bytes: u32,
2127    pub primary_start_offset: u32,
2128    pub secondary_start_offset: u32,
2129    pub tertiary_start_offset: u32,
2130    pub primary_pixel_stride: u32,
2131    pub secondary_pixel_stride: u32,
2132    pub primary_display_width_pixels: u32,
2133    pub primary_display_height_pixels: u32,
2134    pub has_pixel_aspect_ratio: bool,
2135    pub pixel_aspect_ratio_width: u32,
2136    pub pixel_aspect_ratio_height: u32,
2137}
2138
2139impl fidl::Persistable for VideoUncompressedFormat {}
2140
2141#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
2142pub struct Void;
2143
2144impl fidl::Persistable for Void {}
2145
2146/// AudioCompressedFormatCvsd contains no fields for now since we will be
2147/// using the parameter values recommended by Bluetooth Core Spec v5.3
2148/// section 9.2.
2149#[derive(Clone, Debug, Default, PartialEq)]
2150pub struct AudioCompressedFormatCvsd {
2151    #[doc(hidden)]
2152    pub __source_breaking: fidl::marker::SourceBreaking,
2153}
2154
2155impl fidl::Persistable for AudioCompressedFormatCvsd {}
2156
2157/// AudioCompressedFormatLc3 contains no fields. The required parameters
2158/// for setting up the decoder would be embedded as Codec_Specific_Configuration
2159/// (Assigned Numbers section 6.12.5) in `FormatDetails.oob_bytes`.
2160#[derive(Clone, Debug, Default, PartialEq)]
2161pub struct AudioCompressedFormatLc3 {
2162    #[doc(hidden)]
2163    pub __source_breaking: fidl::marker::SourceBreaking,
2164}
2165
2166impl fidl::Persistable for AudioCompressedFormatLc3 {}
2167
2168/// Represents the status of the consumer. In the initial status, `error` and
2169/// `presentation_timeline` are absent. The lead time fields are always present.
2170#[derive(Clone, Debug, Default, PartialEq)]
2171pub struct AudioConsumerStatus {
2172    /// If present, indicates an error condition currently in effect. Absent if no error.
2173    pub error: Option<AudioConsumerError>,
2174    /// If present, indicates the current relationship between the presentation timeline
2175    /// and local monotonic clock, both in nanosecond units. If not present,
2176    /// indicates there is no relationship. Absent initially.
2177    ///
2178    /// 'Presentation timeline' refers to the `pts` (presentation timestamp) values on the packets.
2179    /// This timeline function can be used to determine the local monotonic clock time that a
2180    /// packet will be presented based on that packet's `pts` value.
2181    pub presentation_timeline: Option<TimelineFunction>,
2182    /// Indicates the minimum lead time in nanoseconds supported by this
2183    /// `AudioConsumer`.  Or in other words, how small of a gap between the
2184    /// `media_time` provided to `AudioConsumer.Start` and the pts on the first
2185    /// packet can be. Values outside this range will be clipped.
2186    pub min_lead_time: Option<u64>,
2187    /// Indicates the maximum lead time in nanoseconds supported by this
2188    /// `AudioConsumer`.  Or in other words, how large of a gap between the
2189    /// `media_time` provided to `AudioConsumer.Start` and the pts on the first
2190    /// packet can be. Values outside this range will be clipped.
2191    pub max_lead_time: Option<u64>,
2192    #[doc(hidden)]
2193    pub __source_breaking: fidl::marker::SourceBreaking,
2194}
2195
2196impl fidl::Persistable for AudioConsumerStatus {}
2197
2198/// Settings for CVSD Encoders. It contains no fields for now since we will be
2199/// using the parameter values recommended by Bluetooth Core Spec v5.3
2200/// section 9.2.
2201#[derive(Clone, Debug, Default, PartialEq)]
2202pub struct CvsdEncoderSettings {
2203    #[doc(hidden)]
2204    pub __source_breaking: fidl::marker::SourceBreaking,
2205}
2206
2207impl fidl::Persistable for CvsdEncoderSettings {}
2208
2209/// DecryptedFormat
2210///
2211/// This describes the format of the decrypted content. It is required to be
2212/// sent by the StreamProcessor server prior to the delivery of output packets.
2213/// Currently, there is no additional format details for decrypted output.
2214#[derive(Clone, Debug, Default, PartialEq)]
2215pub struct DecryptedFormat {
2216    pub ignore_this_field: Option<bool>,
2217    #[doc(hidden)]
2218    pub __source_breaking: fidl::marker::SourceBreaking,
2219}
2220
2221impl fidl::Persistable for DecryptedFormat {}
2222
2223/// EncryptedFormat
2224///
2225/// The stream format details payload of a decrypting stream processor. This is
2226/// a sparsely populated table to specify parameters necessary for decryption
2227/// other than the data stream. It is only necessary to update fields if they
2228/// changed, but not an error if the same value is repeated.
2229#[derive(Clone, Debug, Default, PartialEq)]
2230pub struct EncryptedFormat {
2231    /// `init_vector` is used in combination with a key and a block of content
2232    /// to create the first cipher block in a chain and derive subsequent cipher
2233    /// blocks in a cipher block chain.
2234    /// Usage:
2235    ///  - It is required to be set prior to the delivery of input packets to a
2236    ///    decryptor.
2237    ///  - This may be changed multiple times during a data stream.
2238    pub init_vector: Option<Vec<u8>>,
2239    /// `subsamples` is used to identify the clear and encrypted portions of a
2240    /// subsample.
2241    /// Usage:
2242    ///  - For whole sample encryption, this parameter should not be sent.
2243    ///  - This may be changed multiple times during a data stream.
2244    pub subsamples: Option<Vec<SubsampleEntry>>,
2245    /// `pattern` is used to identify the clear and encrypted blocks for pattern
2246    /// based encryption.
2247    /// Usage:
2248    /// - This is not allowed for CENC and CBC1 and required for CENS and CBCS.
2249    /// - If required, it must be set prior to the delivery of input packets to
2250    ///   a decryptor.
2251    /// - This may be changed multiple times during a data stream.
2252    pub pattern: Option<EncryptionPattern>,
2253    /// `scheme` specifies which encryption scheme to use, such as
2254    /// `fuchsia.media.ENCRYPTION_SCHEME_CENC`.
2255    /// Usage:
2256    ///  - It is required to be set prior to delivery of input packets.
2257    ///  - Changing the scheme mid-stream is only permitted in some scenarios.
2258    ///    Once an encrypted scheme is selected for a stream, the scheme may
2259    ///    only be set to `fuchsia.media.ENCRYPTION_SCHEME_UNENCRYPTED` or that
2260    ///    same initial encrypted scheme. The scheme may be set to
2261    ///    `fuchsia.media.ENCRYPTION_SCHEME_UNENCRYPTED` at any point.
2262    pub scheme: Option<String>,
2263    /// `key_id` identifies the key that should be used for decrypting
2264    /// subsequent data.
2265    /// Usage:
2266    ///  - It is required to be set prior to delivery of input packets to a
2267    ///    decryptor.
2268    ///  - This may be changed multiple times during a data stream.
2269    pub key_id: Option<Vec<u8>>,
2270    #[doc(hidden)]
2271    pub __source_breaking: fidl::marker::SourceBreaking,
2272}
2273
2274impl fidl::Persistable for EncryptedFormat {}
2275
2276/// FormatDetails
2277///
2278/// This describes/details the format on input or output of a StreamProcessor
2279/// (separate instances for input vs. output).
2280#[derive(Clone, Debug, Default, PartialEq)]
2281pub struct FormatDetails {
2282    pub format_details_version_ordinal: Option<u64>,
2283    pub mime_type: Option<String>,
2284    pub oob_bytes: Option<Vec<u8>>,
2285    pub domain: Option<DomainFormat>,
2286    pub pass_through_parameters: Option<Vec<Parameter>>,
2287    /// Instructs an encoder on how to encode raw data.
2288    ///
2289    /// Decoders may ignore this field but are entitled to rejected requests with
2290    /// this field set because it doesn't make sense.
2291    pub encoder_settings: Option<EncoderSettings>,
2292    /// The number of ticks of the timebase of input packet timestamp_ish values
2293    /// per second.
2294    ///
2295    /// The timebase is only used used for optional extrapolation of timestamp_ish
2296    /// values when an input timestamp which applies to byte 0 of the valid portion
2297    /// of the input packet does not correspond directly to byte 0 of the valid
2298    /// portion of any output packet.
2299    ///
2300    /// Leave unset if timestamp extrapolation is not needed, either due to lack of
2301    /// timestamps on input, or due to input being provided in increments of the
2302    /// encoder's input chunk size (based on the encoder settings and calculated
2303    /// independently by the client).  Set if timestamp extrapolation is known to be
2304    /// needed or known to be acceptable to the client.
2305    pub timebase: Option<u64>,
2306    /// The codec profile for the given encoder or decoder.
2307    ///
2308    /// For encoders: This value is completely optional. A client may want to specify the codec
2309    /// profile used for protocol compatibility reasons (i.e. WebRTC). However if the value is not
2310    /// set then the the encoder is free to choose any supported codec profile.
2311    ///
2312    /// For decoders: This value is optional but providing it is best practice (at least of
2313    /// unencrypted streams). Container formats include the encoded profile and this should be
2314    /// provided to the decoder. Certain formats like VP9 and AV1 include the encoded profile in
2315    /// their elementary bitstream so it is possible for those decoders to figure out the profile
2316    /// the stream is encoded in. Regardless, clients should provide the encoded profile if
2317    /// possible.
2318    pub profile: Option<CodecProfile>,
2319    #[doc(hidden)]
2320    pub __source_breaking: fidl::marker::SourceBreaking,
2321}
2322
2323impl fidl::Persistable for FormatDetails {}
2324
2325/// Settings for H264 Encoders.
2326#[derive(Clone, Debug, Default, PartialEq)]
2327pub struct H264EncoderSettings {
2328    /// Target bits per second for encoded stream.
2329    /// If omitted, interpreted as 200,000.
2330    pub bit_rate: Option<u32>,
2331    /// Target frames per second for encoded stream.
2332    /// If omitted, interpreted as 30.
2333    pub frame_rate: Option<u32>,
2334    /// Number of pictures per keyframe.  Setting to 0 will disable key frame
2335    /// encoding, except for if force_key_frame is set to true.
2336    /// If omitted, interpreted as 8.
2337    pub gop_size: Option<u32>,
2338    /// Whether to enable frame rate adjustments in order to meet target bitrate.
2339    /// If omitted, interpreted as false.
2340    pub variable_frame_rate: Option<bool>,
2341    /// Lowest frame rate allowed if `variable_frame_rate` is enabled. If
2342    /// omitted, interpreted as 10.
2343    pub min_frame_rate: Option<u32>,
2344    /// If true, next frame encoded will be a key frame. If omitted, interpreted
2345    /// as false.
2346    pub force_key_frame: Option<bool>,
2347    /// Allow customization of quantization parameters for encoding. Each frame
2348    /// submitted after setting this will use the new values. If omitted, no
2349    /// change from encoder defaults is made.
2350    pub quantization_params: Option<H264QuantizationParameters>,
2351    #[doc(hidden)]
2352    pub __source_breaking: fidl::marker::SourceBreaking,
2353}
2354
2355impl fidl::Persistable for H264EncoderSettings {}
2356
2357/// Customization of h264 encoder parameters for macroblock quantization. The values
2358/// can range from 0 to 51, with lower numbers indicating higher
2359/// quality/bitrate. While encoders should support these fields if feasible,
2360/// some encoders may ignore these fields. It's ok to not set this table, or
2361/// not set some of the fields in this table, as encoders can determine their
2362/// own defaults. If the targeted bitrate can't be achieved with the specified values,
2363/// then the user should expect the resulting encoded stream bitrate to differ from
2364/// the requested bitrate.
2365#[derive(Clone, Debug, Default, PartialEq)]
2366pub struct H264QuantizationParameters {
2367    /// Starting value for quantization of key frames.
2368    pub i_base: Option<u32>,
2369    /// Smallest allowed value for quantization of key frames.
2370    pub i_min: Option<u32>,
2371    /// Largest allowed value for quantization of key frames.
2372    pub i_max: Option<u32>,
2373    /// Starting value for quantization of predicted frames.
2374    pub p_base: Option<u32>,
2375    /// Smallest allowed value for quantization of predicted frames.
2376    pub p_min: Option<u32>,
2377    /// Largest allowed value for quantization of predicted frames.
2378    pub p_max: Option<u32>,
2379    #[doc(hidden)]
2380    pub __source_breaking: fidl::marker::SourceBreaking,
2381}
2382
2383impl fidl::Persistable for H264QuantizationParameters {}
2384
2385/// Settings for HEVC/H265 Encoders.
2386#[derive(Clone, Debug, Default, PartialEq)]
2387pub struct HevcEncoderSettings {
2388    /// Target bits per second for encoded stream. Defaults to 200,000 if
2389    /// omitted.
2390    pub bit_rate: Option<u32>,
2391    /// Target frames per second for encoded stream. Defaults to 30 if omitted.
2392    pub frame_rate: Option<u32>,
2393    /// Number of pictures per keyframe. Defaults to 8 if omitted.
2394    pub gop_size: Option<u32>,
2395    #[doc(hidden)]
2396    pub __source_breaking: fidl::marker::SourceBreaking,
2397}
2398
2399impl fidl::Persistable for HevcEncoderSettings {}
2400
2401/// Configuration for a capturer which will receive a stream from an
2402/// input device.
2403#[derive(Clone, Debug, Default, PartialEq)]
2404pub struct InputAudioCapturerConfiguration {
2405    pub usage: Option<AudioCaptureUsage>,
2406    pub usage2: Option<AudioCaptureUsage2>,
2407    #[doc(hidden)]
2408    pub __source_breaking: fidl::marker::SourceBreaking,
2409}
2410
2411impl fidl::Persistable for InputAudioCapturerConfiguration {}
2412
2413/// Settings for LC3 Encoders. Contains parameters stated in LC3 Specification v1.0.
2414/// Contains fields that are not represented by PcmFormat.
2415#[derive(Clone, Debug, Default, PartialEq)]
2416pub struct Lc3EncoderSettings {
2417    /// External byte count values to be used for the frame encoding of audio.
2418    /// According to the LC3 Specification v1.0, each audio channel could have different
2419    /// output byte size value, but for Fuchsia use case, we use the same `nbytes` value
2420    /// for all channels.
2421    pub nbytes: Option<u16>,
2422    /// Frame duration is used together with sampling frequency to determine the
2423    /// frame size.
2424    pub frame_duration: Option<Lc3FrameDuration>,
2425    #[doc(hidden)]
2426    pub __source_breaking: fidl::marker::SourceBreaking,
2427}
2428
2429impl fidl::Persistable for Lc3EncoderSettings {}
2430
2431/// Configuration for a capturer which will receive a loopback stream
2432/// a system output.
2433#[derive(Clone, Debug, Default, PartialEq)]
2434pub struct LoopbackAudioCapturerConfiguration {
2435    #[doc(hidden)]
2436    pub __source_breaking: fidl::marker::SourceBreaking,
2437}
2438
2439impl fidl::Persistable for LoopbackAudioCapturerConfiguration {}
2440
2441/// Settings for the mSBC encoder. There are no settings as the mSBC encoder uses the values
2442/// required by HFP Spec v1.8.
2443#[derive(Clone, Debug, Default, PartialEq)]
2444pub struct MSbcEncoderSettings {
2445    #[doc(hidden)]
2446    pub __source_breaking: fidl::marker::SourceBreaking,
2447}
2448
2449impl fidl::Persistable for MSbcEncoderSettings {}
2450
2451/// A Packet represents a chunk of input or output data to or from a stream
2452/// processor.
2453///
2454/// stream processor output:
2455///
2456/// While the Packet is outstanding with the client via OnOutputPacket(), the
2457/// stream processor will avoid modifying the referenced output data.  After the
2458/// client calls RecycleOutputPacket(packet_index), the stream processor is
2459/// notified that the client is again ok with the referenced data changing.
2460///
2461/// stream processor input:
2462///
2463/// The client initially has all packet_index(es) available to fill, and later
2464/// gets packet_index(s) that are again ready to fill via OnFreeInputPacket().
2465/// The client must not modify the referenced data in between QueueInputPacket()
2466/// and OnFreeInputPacket().
2467#[derive(Clone, Debug, Default, PartialEq)]
2468pub struct Packet {
2469    pub header: Option<PacketHeader>,
2470    /// Which buffer this packet refers to. A given in-flight interval of a
2471    /// packet refers to a specfic buffer using buffer_lifetime_ordinal (in
2472    /// PacketHeader) and buffer_index.
2473    ///
2474    /// A client should be prepared to handle output packets that refer to a
2475    /// buffer_lifetime_ordinal that's old (with buffer_index scoped to the old
2476    /// buffer_lifetime_ordinal). Streams that do this are not common (in this
2477    /// author's experience so far). Some clients may prefer to just ignore
2478    /// output packets with an old buffer_lifetime_ordinal, or notice the old
2479    /// buffer_lifetime_ordinal and fail the stream client-side. Clients that do
2480    /// want to fully handle such streams (for bitstream formats that can do
2481    /// this in the first place) can use RemoveBuffer completion to detect when
2482    /// each buffer of an old buffer_lifetime_ordinal will never again be
2483    /// referenced in any subsequent output packet. If the dimensions of the
2484    /// frame in the old buffer are different than the previous output frame,
2485    /// OnOutputFormat will be sent in between the output packets (as usual).
2486    ///
2487    /// A client should be prepared to handle (as in "not crash when") two or
2488    /// more output packets reference the same buffer, without the first output
2489    /// packet having been recycled back to the StreamProcessor yet. There is
2490    /// intentionally no guarantee that packets in-flight with the client will
2491    /// all refer to unique buffers, at least due to VP9 show_existing_frame,
2492    /// and possibly similar coding tools in other bitstream formats. Some
2493    /// layers above the direct client may not support this, in which case
2494    /// failing the stream client-side may be acceptable if the client has no
2495    /// need to support decode of streams that do this. More sophisticated
2496    /// translation strategies in this situation are outside the scope of this
2497    /// documentation. Clients intending to handle DRM-protected streams should
2498    /// keep in mind that copying frame contents with the CPU is likely not
2499    /// possible. To be clear, this author has never seen a DRM-protected stream
2500    /// that does this, and the only non-DRM-protected streams that this author
2501    /// has seen do this are test streams. Still, client authors should be aware
2502    /// that streams "in the wild" can potentially do this.
2503    ///
2504    /// RemoveBuffer is supported both when using dynamic buffers, and when not
2505    /// using dynamic buffers. When using RemoveBuffer with non-dynamic buffers,
2506    /// there is no AddBuffer involved or required, as
2507    /// SetInputBufferPartialSettings or SetOutputBufferPartialSettings was used
2508    /// to add all the buffers of the buffer_lifetime_ordinal. In the case of
2509    /// non-dynamic buffers however, the RemoveBuffer won't actaully start the
2510    /// removal of a buffer. But it will complete when the buffer is fully done
2511    /// removing.
2512    ///
2513    /// The packet has an associated buffer_lifetime_ordinal and buffer_index
2514    /// only while the packet is in-flight, not while the packet is free.
2515    ///
2516    /// When not using dynamic buffers, this value is the same as the sysmem
2517    /// buffer_index.
2518    ///
2519    /// When using dynamic buffers, this value is not the same as the sysmem
2520    /// buffer_index (other than by chance), nor is it guaranteed to be a small
2521    /// number.
2522    ///
2523    /// By default, for output buffers, this buffer_index value is guaranteed to
2524    /// be unique among buffers with the same buffer_lifetime_ordinal currently
2525    /// in-flight with the client. For decoding bitstream formats that can
2526    /// output the same buffer backing different output packets where the
2527    /// multiple packets are in the output queue at the same time (possibly with
2528    /// different timestamp_ish values), a client can send
2529    /// EnableSameOutputBufferConcurrentlyInFlight to indicate that the client
2530    /// is prepared to handle more than one output packet concurrently in flight
2531    /// referencing the same output buffer. Streams where this makes any
2532    /// difference are rare outside of bitstream format tests.
2533    pub buffer_index: Option<u32>,
2534    /// The value 1 is the lowest permitted value after stream processor
2535    /// creation.  Values sent by the client must be odd.  Values must only
2536    /// increase.
2537    ///
2538    /// A stream_lifetime_ordinal represents the lifetime of a stream.  All
2539    /// messages that are specific to a stream have the stream_lifetime_ordinal
2540    /// value and the value is the same for all messages relating to a given
2541    /// stream.
2542    pub stream_lifetime_ordinal: Option<u64>,
2543    /// Which part of the relevant buffer is this packet using.  These are valid
2544    /// for input data that's in-flight to the stream processor, and are valid
2545    /// for output data from the stream processor.
2546    ///
2547    /// For compressed formats and uncompressed audio, the data in
2548    /// [start_offset, start_offset + valid_length_bytes) is the contiguously
2549    /// valid data referred to by this packet.
2550    ///
2551    /// For uncompressed video frames, FormatDetails is the primary means of
2552    /// determining which bytes are relevant.  The offsets in FormatDetails
2553    /// are relative to the start_offset here.  The valid_length_bytes must be
2554    /// large enough to include the full last line of pixel data, including the
2555    /// full line stride of the last line (not just the width in pixels of the
2556    /// last line).
2557    ///
2558    /// Despite these being filled out, some uncompressed video buffers are of
2559    /// types that are not readable by the CPU.  These fields being here don't
2560    /// imply there's any way for the CPU to read an uncompressed frame.
2561    pub start_offset: Option<u32>,
2562    /// This must be > 0.
2563    ///
2564    /// The semantics for valid data per packet vary depending on data type as
2565    /// follows.
2566    ///
2567    /// uncompressed video - A video frame can't be split across packets.  Each
2568    /// packet is one video frame.
2569    ///
2570    /// uncompressed audio - Regardless of float or int, linear or uLaw, or
2571    /// number of channels, a packet must contain an non-negative number of
2572    /// complete audio frames, where a single audio frame consists of data for
2573    /// all the channels for the same single point in time.  Any
2574    /// stream-processor-specific internal details re. lower rate sampling for
2575    /// LFE channel or the like should be hidden by the StreamProcessor server
2576    /// implementation.
2577    ///
2578    /// compressed data input - A packet must contain at least one byte of data.
2579    /// See also stream_input_bytes_min.  Splitting AUs at arbitrary byte
2580    /// boundaries is permitted, including at boundaries that are in AU headers.
2581    ///
2582    /// compressed data output - The stream processor is not required to fully
2583    /// fill each output packet's buffer.
2584    pub valid_length_bytes: Option<u32>,
2585    /// This value is not strictly speaking a timestamp.  It is an arbitrary
2586    /// unsigned 64-bit number that, under some circumstances, will be passed by
2587    /// a stream processor unmodified from an input packet to the
2588    /// exactly-corresponding output packet.
2589    ///
2590    /// For timestamp_ish values to be propagated from input to output the
2591    /// following conditions must be true:
2592    ///  * promise_separate_access_units_on_input must be true
2593    ///  * has_timestamp_ish must be true for a given input packet, to have that
2594    ///    timestamp_ish value (potentially) propagate through to an output
2595    ///    packet
2596    ///  * the StreamProcessor instance itself decides (async) that the input
2597    ///    packet generates an output packet - if a given input never generates
2598    ///    an output packet then the timestamp_ish value on the input will never
2599    ///    show up on any output packet - depending on the characteristics of the
2600    ///    input and output formats, and whether a decoder is willing to join
2601    ///    mid-stream, etc this can be more or less likely to occur, but clients
2602    ///    should be written to accommodate timestamp_ish values that are fed on
2603    ///    input but never show up on output, at least to a reasonable degree
2604    ///    (not crashing, not treating as an error).
2605    pub timestamp_ish: Option<u64>,
2606    /// If promise_separate_access_units_on_input (TODO(dustingreen): or any
2607    /// similar mode for output) is true, this bool must be set appropriately
2608    /// depending on whether byte 0 _is_ or _is not_ the start of an access
2609    /// unit. The client is required to know, and required to set this boolean
2610    /// properly. The server is allowed to infer that when this boolean is
2611    /// false, byte 0 is the first byte of a continuation of a
2612    /// previously-started AU.  (The byte at start_offset is "byte 0".)
2613    ///
2614    /// If promise_separate_access_units_on_input is false, this boolean is
2615    /// ignored.
2616    pub start_access_unit: Option<bool>,
2617    /// A client is never required to set this boolean to true.
2618    ///
2619    /// If promise_separate_access_units_on_input is true, for input data, this
2620    /// boolean must be false if this packet does not contain the last byte of
2621    /// the up to one AU contained or partially contained in this packet, and
2622    /// this boolean _may_ be true if the last byte of the up-to-one AU is in
2623    /// this packet. A client delivering one AU at a time that's interested in
2624    /// the lowest possible latency via the decoder should set this boolean to
2625    /// true when it can be set to true.
2626    ///
2627    /// If promise_separate_access_units_on_input is false, this boolean is
2628    /// ignored.
2629    ///
2630    /// Some bitstream formats have the concept of an access unit delimiter or
2631    /// similar. A client wishing to achieve low latency may choose to inject
2632    /// correctly-formed access unit delimiters (or similar) after each access
2633    /// unit as an alternate way to signal to a decoder that the access unit has
2634    /// ended. However, such a client is encouraged to also set this field to
2635    /// true when possible, to ensure that all layers of a decoder notice.
2636    /// Injecting an access unit delimiter is allowed but unnecessary (for
2637    /// latency reduction purposes) if this is set to true (for a
2638    /// properly-functioning decoder). A client never needs to strip away any
2639    /// access unit delimiters that are potentially already present in the
2640    /// stream - there is no requirement that the setting of this field match
2641    /// the existence/non-existence of any access unit delimiter(s).
2642    pub known_end_access_unit: Option<bool>,
2643    /// Used for compressed video packets. If not present should be assumed to
2644    /// be unknown. If false, indicates the packet is not part of a key frame.
2645    /// If true, indicates the packet is part of a key frame.
2646    pub key_frame: Option<bool>,
2647    #[doc(hidden)]
2648    pub __source_breaking: fidl::marker::SourceBreaking,
2649}
2650
2651impl fidl::Persistable for Packet {}
2652
2653/// PacketHeader
2654///
2655/// When referring to a free packet, we use PacketHeader alone instead of
2656/// Packet, since while a packet is free it doesn't really have meaningful
2657/// offset or length etc.
2658///
2659/// A populated Packet also has a PacketHeader.
2660#[derive(Clone, Debug, Default, PartialEq)]
2661pub struct PacketHeader {
2662    /// This is which buffer configuration lifetime this header is referring to.
2663    ///
2664    /// See
2665    /// `[fuchsia.mediacodec/StreamBufferPartialSettings.buffer_lifetime_ordinal]`.
2666    ///
2667    /// For QueueInputPacket(), a server receiving a buffer_lifetime_ordinal
2668    /// that isn't the current input buffer_lifetime_ordinal will close the
2669    /// channel.
2670    ///
2671    /// For output packets, this can be an old buffer_lifetime_ordinal only if
2672    /// EnableOldOutputBuffers was sent by the client. See also RemoveBuffer to
2673    /// determine when it's safe to stop tracking old output buffers (only
2674    /// relevant to some video bitstream formats such as VP9, and only relevant
2675    /// to decoders). Streams that want to emit old output buffers are rare
2676    /// outside of bitstream format test streams.
2677    pub buffer_lifetime_ordinal: Option<u64>,
2678    /// When using `SetInputBufferPartialSettings` or
2679    /// `SetOutputBufferPartialSettings` to allocate buffers, the valid range of
2680    /// `packet_index` is from 0..buffer_count-1, where buffer_count is the
2681    /// length of `[fuchsia.sysmem2/BufferCollectionInfo.buffers]`, considering
2682    /// input and output separately.
2683    ///
2684    /// When using `ParticipateInBufferAllocation` and `AddBuffer` to allocate
2685    /// and add buffers, the valid range of `packet_index` is unconstrained (any
2686    /// uint32 value). The client and server must still ensure that
2687    /// `packet_index` values aren't re-used until the other end has indicated
2688    /// the `packet_index` value is again available and can be re-used.
2689    ///
2690    /// The number of concurrently in-flight `packet_index` values is limited
2691    /// per port (input vs. output) and `buffer_lifetime_ordinal`. If a client
2692    /// never puts the same input buffer in flight using more than one input
2693    /// packet concurrently, this inherently ensures the client will conform to
2694    /// this limit. Most clients can safely ignore this limit for output from
2695    /// the server. The limit is as follows:
2696    ///   * When sending a packet, the sender must ensure that the number of
2697    ///     concurrently in-flight `packet_index` values under the port (input
2698    ///     or output) and `buffer_lifetime_ordinal` does not exceed the
2699    ///     high-water-mark number of buffers that have concurrently existed
2700    ///     from the server's point of view under the `buffer_lifetime_ordinal`
2701    ///     so far. When using `SetInputBufferPartialSettings`, this is
2702    ///     buffer_count as defined above.
2703    ///   * When using `AddBuffer`, the high-water-mark value is determined
2704    ///     slightly differently for input vs. output.
2705    ///     * For input, this high-water-mark value is the maximum value so far
2706    ///       under the `buffer_lifetime_ordinal` of the total number of
2707    ///       `AddBuffer` messages regarding the `buffer_lifetime_ordinal` minus
2708    ///       the total number of `RemoveBuffer` messages regarding the
2709    ///       `buffer_lifetime_ordinal`.
2710    ///       * If a client never puts an input buffer in flight more than once
2711    ///         concurrently using multiple different input `packet_index`
2712    ///         values, then the client will inherently stay under this limit
2713    ///         for input.
2714    ///     * For output, this high-water-mark value is the maximum so far under
2715    ///       the `buffer_lifetime_ordinal` of the total number of `AddBuffer`
2716    ///       messages regarding the `buffer_lifetime_ordinal` minus the total
2717    ///       number of completed buffer removals under the
2718    ///       `buffer_lifetime_ordinal`. This is without regard to which buffer
2719    ///       removals had a corresponding `RemoveBuffer` completion.
2720    ///       * If a client wishes to (optionally) validate this server
2721    ///         behavior, the client can rely on the server to not complete a
2722    ///         `RemoveBuffer` until after completion of buffer removal
2723    ///         server-side (else the server is failing to conform to
2724    ///         `RemoveBuffer` semantics or failing to conform to this limit).
2725    ///
2726    /// For input, the client chooses an available `packet_index` value
2727    /// arbitrarily when sending an input packet with `QueueInputPacket`, and
2728    /// the client doesn't re-use the value until the server has sent
2729    /// `OnFreeInputPacket` with that `packet_index` value.
2730    ///
2731    /// For output, the server chooses an available `packet_index` value
2732    /// arbitrarily (among all uint32 values) when sending an output packet with
2733    /// `OnOutputPacket`, and doesn't re-use the value until the client has sent
2734    /// `RecycleOutputPacket` with that `packet_index` value.
2735    ///
2736    /// Available `packet_index` values can be queued in arbitrary order.
2737    ///
2738    /// Both the client and server should validate the packet_index against the
2739    /// known bound (if any; see above) and disconnect if it's out of bounds.
2740    ///
2741    /// The packet_index values don't imply anything about order of use of
2742    /// packets. The client should not expect the ordering to remain the same
2743    /// over time - the stream processor is free to hold on to an input or
2744    /// output packet for a while during which some other packet_index values
2745    /// may be re-used multiple times.
2746    ///
2747    /// For a given properly-functioning StreamProcessor instance, output
2748    /// packet_index values will be unique among concurrently-outstanding
2749    /// packets.
2750    ///
2751    /// Servers should validate that a client isn't double-using a packet and
2752    /// clients may similarly validate `packet_index` values from the server.
2753    pub packet_index: Option<u32>,
2754    #[doc(hidden)]
2755    pub __source_breaking: fidl::marker::SourceBreaking,
2756}
2757
2758impl fidl::Persistable for PacketHeader {}
2759
2760/// This struct conveys the buffer_constraints_version_ordinal.
2761///
2762/// Historically this table conveyed more fields than it currently does, but
2763/// those fields are all deprecated in favor of using sysmem instead.
2764///
2765/// There are separate instances of this struct for stream input and stream
2766/// output.
2767///
2768/// Notes about fields:
2769///
2770/// For uncompressed video, separate and complete frames in their
2771/// separate buffers (buffer-per-packet mode) are always a requirement.
2772#[derive(Clone, Debug, Default, PartialEq)]
2773pub struct StreamBufferConstraints {
2774    /// This is a version number the server sets on the constraints to allow the
2775    /// server to determine when the client has caught up with the latest
2776    /// constraints sent by the server.  The server won't emit output data until
2777    /// the client has configured output settings and buffers with a
2778    /// buffer_constraints_version_ordinal >= the latest
2779    /// buffer_constraints_version_ordinal that had
2780    /// buffer_constraints_action_required true.  See
2781    /// buffer_constraints_action_required comments for more.
2782    ///
2783    /// A buffer_constraints_version_ordinal of 0 is not permitted, to simplify
2784    /// initial state handling. Other than 0, both odd and even version ordinals
2785    /// are allowed (in contrast to the stream_lifetime_ordinal, neither the
2786    /// client nor server ever has a reason to consider the latest version to be
2787    /// stale, so there would be no benefit to disallowing even values).
2788    pub buffer_constraints_version_ordinal: Option<u64>,
2789    pub default_settings: Option<StreamBufferSettings>,
2790    pub per_packet_buffer_bytes_min: Option<u32>,
2791    pub per_packet_buffer_bytes_recommended: Option<u32>,
2792    pub per_packet_buffer_bytes_max: Option<u32>,
2793    pub packet_count_for_server_min: Option<u32>,
2794    pub packet_count_for_server_recommended: Option<u32>,
2795    pub packet_count_for_server_recommended_max: Option<u32>,
2796    pub packet_count_for_server_max: Option<u32>,
2797    pub packet_count_for_client_min: Option<u32>,
2798    pub packet_count_for_client_max: Option<u32>,
2799    pub single_buffer_mode_allowed: Option<bool>,
2800    pub is_physically_contiguous_required: Option<bool>,
2801    /// If a codec has
2802    /// `[fuchsia.mediacodec/DetailedCodecDescription.supports_dynamic_buffers]`
2803    /// set to true, this field must be set by the server and will be the
2804    /// minimum number of input or output buffers that the server needs to be
2805    /// able to concurrently use (or continue using) to guarantee forward
2806    /// progress. For video decoders, this number assumes a
2807    /// bitstream-standard-compliant stream. Any time the server doesn't have
2808    /// this many buffers available for the server's concurrent use (DPB size +
2809    /// 1), processing may pause, but will not fail - in this case the client
2810    /// can add more buffers with AddBuffers to get the processing to start
2811    /// again. When the DPB needs to reference more images, recycling an output
2812    /// buffer won't necessarily cause processing to start again, as the image
2813    /// may still be in the DPB, so the buffer can't be re-used yet despite
2814    /// being recycled by the client.
2815    ///
2816    /// For input, the codec may require this many buffers before the codec will
2817    /// process any input. Currently, for input, this value is static per
2818    /// StreamProcessor instance. The client is allowed to send QueueInput...()
2819    /// messages before this many input buffers have been added, but should not
2820    /// expect any output to necessarily be emitted until at least this many
2821    /// input buffers have been added. This also applies for
2822    /// QueueInputFormatDetails and QueueInputEndOfStream before any
2823    /// QueueInputPacket, for a newly starting stream, so the first two can be
2824    /// sent while there are still zero added input buffers so far. Codecs that
2825    /// only need one input buffer to make forward progress (non-continuous
2826    /// non-smooth forward progress still counts) should set this to one. Most
2827    /// clients will want to add a low number of additional buffers to keep the
2828    /// pipeline running smoothly, to avoid stalling processing while an
2829    /// OnFreeInputPacket is on its way from the codec to the client. Decoders
2830    /// that copy input data into a separate stream buffer (sometimes treated as
2831    /// circular) typically will only need one input buffer for forward progress
2832    /// to be possible, but most clients will still want to add a low number of
2833    /// additional input buffers for smoother thread scheduling, even if such a
2834    /// decoder core might be able to run at 100% utilization with a single
2835    /// input buffer.
2836    ///
2837    /// For video decoder output, if a client were to only `AddBuffers` this
2838    /// many buffers overall, every time `OnOutputPacket` happened, the decoder
2839    /// would be potentially stalled until `RecycleOutputPacket` is received at
2840    /// the server. For this reason, most clients will prefer to allocate a few
2841    /// more buffers, accounting for other parts of the pipeline (locally in the
2842    /// client or not) that may also need to "camp" on buffers for reasons
2843    /// unrelated to video decode, and possibly also a low number of additional
2844    /// buffers to keep the pipeline running smoothly, to avoid stalling decode
2845    /// while a free buffer on its way to being recycled or similar.
2846    ///
2847    /// For video decoder output, when set, this value will always be less than
2848    /// or equal to
2849    /// `[fuchsia.mediacodec/DetailedCodecDescription.dynamic_buffers_video_decoder_output_safe]`.
2850    ///
2851    /// This value can be updated by a new OnOutputConstraints from the server
2852    /// with action_required false. However, despite "action_required" being
2853    /// false, the client must still ensure that the number of buffers currently
2854    /// available for concurrent use by the codec is at least this many.
2855    ///
2856    /// If a client using dynamic buffers with a video decoder doesn't want to
2857    /// pay attention to this field, the client should still pay attention to
2858    /// `[fuchsia.mediacodec/DetailedCodecDescription.dynamic_buffers_video_decoder_output_safe]`.
2859    /// Or the client can instead use
2860    /// SetInputBufferPartialSettings/SetOutputBufferPartialSettings which has
2861    /// approximately the same (potentially adverse) effect in terms of overall
2862    /// buffer count (assuming a correctly operating pipeline). While these less
2863    /// complicated client implementation options might initially seem like
2864    /// they're wasting some memory, paying attention to
2865    /// buffer_count_for_server_current (in contrast to only
2866    /// dynamic_buffers_video_decoder_output_safe) only saves memory if the
2867    /// stream has the needed optional fields with values less than the max DPB
2868    /// size, which is unfortunately not guaranteed. In particular, h.264
2869    /// streams without max_num_reorder_frames or max_dec_frame_buffering set in
2870    /// vui_parameters (or anywhere else) seem more common than not (to this
2871    /// author, among streams looked at so far), though this could depend
2872    /// strongly on which particular set of streams a client wants to decode.
2873    /// Client implementers may want to check some of the relevant streams for
2874    /// relevant bitstream header fields before caring about this field and the
2875    /// dynamic changes to the value conveyed by this field, for video decoders.
2876    /// Also, client implementers are free to use other strategies to save
2877    /// memory, such as being stingy with buffer counts but adding buffers
2878    /// dynamically and quickly if it seems like the codec might be starving for
2879    /// buffers (such as if downstream queued output buffers start to run low).
2880    /// This sort of strategy is up to the client, and it's on the client to get
2881    /// the timing right if it goes with that sort of strategy (not super easy
2882    /// to get perfectly correct / tuned). The platform makes no specific
2883    /// guarantee re. how quickly an additional buffer can be allocated, so a
2884    /// client attempting to run with fewer than
2885    /// dynamic_buffers_video_decoder_output_safe may encounter stream rendering
2886    /// jank or similar, including mid-stream. The platform makes no promises
2887    /// regarding the ability to avoid jank in this situation, such as if
2888    /// there's a mid-stream header that increases this value for output (not
2889    /// common).
2890    ///
2891    /// Layers above are encouraged to permit storing smaller images in larger
2892    /// buffers, so that mid-stream dimensions changes don't each need to
2893    /// re-allocate buffers. Instead, it's almost always better to just keep
2894    /// using existing larger buffers in this case, to avoid possibility of
2895    /// rendering jank due to allocating buffers not always being as fast as
2896    /// desired combined with output buffer count not necessarily having
2897    /// sufficient extra buffers to absorb the buffer reallocation in a timing
2898    /// sense. However, if a layer above really must re-allocate buffers when
2899    /// the image size changes and the needed buffer size to hold the images
2900    /// goes down, such a client must set force_new_buffers_for_new_dimensions
2901    /// passed to CreateDecoder. Otherwise a video decoder is permitted to start
2902    /// putting smaller images in the existing larger buffers, with
2903    /// OnOutputFormat message(s) indicating this.
2904    pub buffer_count_for_server_current: Option<u32>,
2905    /// Clients are free to ignore this field.
2906    ///
2907    /// This field is set iff
2908    /// `[fuchsia.mediacodec/DetailedCodecDescription.supports_dynamic_buffers]`
2909    /// is true and the indicating port is outputting uncompressed video.
2910    ///
2911    /// This field is provided for informational purposes, for clients that may
2912    /// want to know this information. However, the StreamProcessor and sysmem
2913    /// protocols work fine without the client ever reading this field.
2914    ///
2915    /// This is the required coded size, without any cropping down to display
2916    /// size.
2917    ///
2918    /// If the client gets directly involved as a sysmem participant, the client
2919    /// should not set constraints which are incompatible with this size, or
2920    /// allocation will fail. This field should not be taken to imply that a
2921    /// given buffer only has a single allowed image size. That is incorrect in
2922    /// general. Rather, this field indicates a size which will be covered by
2923    /// the required_min_size and required_max_size set by the StreamProcessor
2924    /// sysmem participant using token passed into
2925    /// SetInputBufferPartialSettings, SetOutputBufferPartialSettings, or
2926    /// ParticipateInBufferAllocation.
2927    ///
2928    /// Despite this size indicating a specific width and height, the allocated
2929    /// buffers may permit a range of image sizes (for video decoder output or
2930    /// video encoder input).
2931    pub size: Option<fidl_fuchsia_math_common::SizeU>,
2932    /// Clients are free to ignore this field.
2933    ///
2934    /// This field is set iff
2935    /// `[fuchsia.mediacodec/DetailedCodecDescription.supports_dynamic_buffers]`
2936    /// is true and the indicating port is conveying uncompressed video.
2937    ///
2938    /// This field is provided for informational purposes, for clients that may
2939    /// want to know this information. However, the StreamProcessor and sysmem
2940    /// protocols work fine without the client ever reading this field.
2941    ///
2942    /// Among the pixel formats supported by the StreamProcessor server which
2943    /// can carry the full bit depth of the images, and which are broadly
2944    /// supported for carrying images of the needed bit depth, and assuming
2945    /// linear pixel_format_modifier, this is the pixel format that is most
2946    /// performant for the StreamProcessor considered in isolation. If multiple
2947    /// qualified formats are essentially the same performance, this should be
2948    /// the most common format (or chosen arbitrarily among roughly
2949    /// equally-common formats). Most StreamProcessor servers will hard code a
2950    /// particular format to put in this field for each supported bit depth.
2951    ///
2952    /// Currently, there is no anticipated need for a list here, but please
2953    /// don't hesitate to reach out if a non-test scenario is encountered which
2954    /// can only be addressed by having a list here (or by attempting several
2955    /// test allocations via ParticipateInBufferAllocation, or by adding a
2956    /// sysmem feature).
2957    ///
2958    /// In general, sysmem is not guaranteed to select this pixel format, since
2959    /// that depends on the full set of pixel formats supported by the
2960    /// StreamProcessor instance and other sysmem participants. If only the
2961    /// client and StreamProcessor are sysmem participants (such as in some
2962    /// tests), if the client requires this pixel format, buffer allocation can
2963    /// still succeed. Typical non-test clients will not need or want to
2964    /// constrain the sysmem allocation to only allow this pixel format, as that
2965    /// would be more likely to fail allocation in comparison to letting sysmem
2966    /// pick a format mutually supported by all participants.
2967    pub pixel_format: Option<fidl_fuchsia_images2_common::PixelFormat>,
2968    #[doc(hidden)]
2969    pub __source_breaking: fidl::marker::SourceBreaking,
2970}
2971
2972impl fidl::Persistable for StreamBufferConstraints {}
2973
2974/// Deprecated.  Use SetStreamBufferPartialSettings() and
2975/// StreamBufferPartialSettings instead.
2976#[derive(Clone, Debug, Default, PartialEq)]
2977pub struct StreamBufferSettings {
2978    pub buffer_lifetime_ordinal: Option<u64>,
2979    pub buffer_constraints_version_ordinal: Option<u64>,
2980    pub packet_count_for_server: Option<u32>,
2981    pub packet_count_for_client: Option<u32>,
2982    pub per_packet_buffer_bytes: Option<u32>,
2983    pub single_buffer_mode: Option<bool>,
2984    #[doc(hidden)]
2985    pub __source_breaking: fidl::marker::SourceBreaking,
2986}
2987
2988impl fidl::Persistable for StreamBufferSettings {}
2989
2990/// The stream-processor-controlled output configuration, including both
2991/// StreamBufferConstraints for the output and FormatDetails for the output.
2992#[derive(Clone, Debug, Default, PartialEq)]
2993pub struct StreamOutputConstraints {
2994    /// A client which always immediately re-configures output buffers on
2995    /// receipt of OnOutputConstraints() with buffer_constraints_action_required
2996    /// true can safely ignore this field.
2997    ///
2998    /// A client is permitted to ignore an OnOutputConstraints() message even with
2999    /// buffer_constraints_action_required true if the client knows the server
3000    /// has already been told to discard the remainder of the stream with the
3001    /// same stream_lifetime_ordinal or if this stream_lifetime_ordinal field is
3002    /// set to 0.  The server is required to re-send needed output config via
3003    /// OnOutputConstraints() with new stream_lifetime_ordinal and
3004    /// buffer_constraints_action_required true, if the most recent completed
3005    /// server-side output config isn't what the server wants/needs yet for the
3006    /// new stream.
3007    pub stream_lifetime_ordinal: Option<u64>,
3008    /// When the buffer constraints are delivered, they indicate whether action
3009    /// is required. A false value here permits delivery of constraints which
3010    /// are fresher without forcing a buffer reconfiguration. If this is false,
3011    /// a client cannot assume that it's safe to immediately re-configure output
3012    /// buffers. If this is true, the client can assume it's safe to immediately
3013    /// configure output buffers once.
3014    ///
3015    /// When not using dynamic buffers, a false value is deprecated and not sent
3016    /// by any known servers.
3017    ///
3018    /// When using dynamic buffers, a false value can be sent by the server to
3019    /// update buffer_count_for_server_current, but that value will always be
3020    /// less than or equal to dynamic_buffers_video_decoder_output_safe. A
3021    /// client that prefers to just use
3022    /// dynamic_buffers_video_decoder_output_safe can ignore new
3023    /// StreamOutputConstraints if buffer_constraints_action_required false
3024    /// (assuming the client has no other reason to pay attention to the
3025    /// message). If a client is using buffer_count_for_server_current to
3026    /// potentially save a few buffers for streams that explicitly allow for
3027    /// that (unfortunately streams which specify a lower required DPB size are
3028    /// fairly rare AFAICT), the client must pay attention to new values of
3029    /// buffer_count_for_server_current even when
3030    /// buffer_constraints_action_required false, and ensure that the codec will
3031    /// have a buffer count available for the codec's use that's consistent with
3032    /// the new value. The codec will not set true or false depending on how
3033    /// many buffers the codec currently has available / free / seemingly for
3034    /// the codec's use, because there's no way for the codec to reliably detect
3035    /// that, as buffers can be opportunistically handed to the codec, yet
3036    /// actually reserved for potential use (and potential "camping") by the
3037    /// downstream pipeline (or similar).
3038    ///
3039    /// A client is permitted to ignore buffer constraint versions which have
3040    /// buffer_constraints_action_required false.  The server is not permitted
3041    /// to change buffer_constraints_action_required from false to true for the
3042    /// same buffer_constraints_version_ordinal.
3043    ///
3044    /// For each configuration, a client must use new buffers, never buffers
3045    /// that were previously used for anything else, and never buffers
3046    /// previously used for any other StreamProcessor purposes.  This rule
3047    /// exists for multiple good reasons, relevant to both mid-stream changes,
3048    /// and changes on stream boundaries. A client should just use new buffers
3049    /// each time.
3050    ///
3051    /// When this is true, the server has already de-refed as many low-level
3052    /// output buffers as the server can while still performing efficient
3053    /// transition to the new buffers and will de-ref the rest asap.  A Sync()
3054    /// is not necessary to achieve non-overlap of resource usage to the extent
3055    /// efficiently permitted by the formats involved.
3056    ///
3057    /// If buffer_constraints_action_required is true, the server _must_ not
3058    /// deliver more output data until after output buffers have been configured
3059    /// (or re-configured) by the client.
3060    pub buffer_constraints_action_required: Option<bool>,
3061    pub buffer_constraints: Option<StreamBufferConstraints>,
3062    #[doc(hidden)]
3063    pub __source_breaking: fidl::marker::SourceBreaking,
3064}
3065
3066impl fidl::Persistable for StreamOutputConstraints {}
3067
3068#[derive(Clone, Debug, Default, PartialEq)]
3069pub struct StreamOutputFormat {
3070    /// A client is permitted to ignore an OnOutputFormat() message even with
3071    /// buffer_constraints_action_required true if the client knows the server
3072    /// has already been told to discard the remainder of the stream with the
3073    /// same stream_lifetime_ordinal or if this stream_lifetime_ordinal field is
3074    /// set to 0.  The server is required to re-send needed output config via
3075    /// OnOutputConstraints() with new stream_lifetime_ordinal and
3076    /// buffer_constraints_action_required true, if the most recent completed
3077    /// server-side output config isn't what the server wants/needs yet for the
3078    /// new stream.
3079    ///
3080    /// The server is required to send an OnOutputFormat() before the first
3081    /// output packet of a stream.
3082    pub stream_lifetime_ordinal: Option<u64>,
3083    /// If format_details.format_details_version_ordinal changes, the client
3084    /// should inspect the new format details and determine if it must adjust to
3085    /// the new format. The server guarantees that if the format has changed, then
3086    /// format_details.format_details_version_ordinal will change, but a change
3087    /// to format_details.format_details_version_ordinal does not guarantee that
3088    /// the format details actually changed.  Servers are strongly encouraged to
3089    /// not change format_details.format_details_version_ordinal other than
3090    /// before the first output data of a stream unless there is a real
3091    /// mid-stream format change in the stream.  Unnecessary mid-stream format
3092    /// changes can cause simpler clients that have no need to handle mid-stream
3093    /// format changes to just close the channel.  Format changes before the
3094    /// first output data of a stream are not "mid-stream" in this context -
3095    /// those can be useful for stream format detection / setup reasons.
3096    ///
3097    /// Note that in case output buffers don't really need to be re-configured
3098    /// despite a format change, a server is encouraged, but not required, to
3099    /// set buffer_constraints_action_required false on the message that conveys
3100    /// the new format details.  Simpler servers may just treat the whole output
3101    /// situation as one big thing and demand output buffer reconfiguration on
3102    /// any change in the output situation.
3103    ///
3104    /// A client may or may not actually handle a new buffer_constraints with
3105    /// buffer_constraints_action_required false, but the client should always
3106    /// track the latest format_details.
3107    ///
3108    /// An updated format_details is ordered with respect to emitted output
3109    /// packets, and applies to all subsequent packets until the next
3110    /// format_details with larger version_ordinal.  A simple client that does
3111    /// not intend to handle mid-stream format changes should still keep track
3112    /// of the most recently received format_details until the first output
3113    /// packet arrives, then lock down the format details, handle those format
3114    /// details, and verify that any
3115    /// format_details.format_details_version_ordinal received from the server
3116    /// is the same as the locked-down format_details, until the client is done
3117    /// with the stream.  Even such a simple client must tolerate
3118    /// format_details.format_details_version_ordinal changing multiple times
3119    /// before the start of data output from a stream (any stream - the first
3120    /// stream or a subsequent stream).  This allows a stream processor to
3121    /// request that output buffers and output format be configured
3122    /// speculatively, and for the output config to be optionally adjusted by
3123    /// the server before the first data output from a stream after the server
3124    /// knows everything it needs to know to fully establish the initial output
3125    /// format details.  This simplifies stream processor server implementation,
3126    /// and allows a clever stream processor server to guess it's output config
3127    /// for lower latency before any input data, while still being able to fix
3128    /// the output config (including format details) if the guess turns out to
3129    /// be wrong.
3130    ///
3131    /// Whether the format_details.format_details_version_ordinal will actually
3132    /// change mid-stream is a per-stream-processor and per-stream detail that
3133    /// is not specified in comments here, and in most cases also depends on
3134    /// whether the format changes on the input to the stream processor.
3135    /// Probably it'll be fairly common for a client to use a format which
3136    /// technically supports mid-stream format change, but the client happens to
3137    /// know that none of the streams the client intends to process will ever
3138    /// have a mid-stream format change.
3139    pub format_details: Option<FormatDetails>,
3140    #[doc(hidden)]
3141    pub __source_breaking: fidl::marker::SourceBreaking,
3142}
3143
3144impl fidl::Persistable for StreamOutputFormat {}
3145
3146#[derive(Clone, Debug, Default, PartialEq)]
3147pub struct StreamProcessorOnOutputTimestampHasNoOutputRequest {
3148    /// All servers will set this field. This is the
3149    /// `stream_lifetime_ordinal` value from the input `Packet` that will
3150    /// never generate any output packet.
3151    pub stream_lifetime_ordinal: Option<u64>,
3152    /// All servers will set this field. This is the `timestamp_ish` value
3153    /// from the input `Packet` that will never generate any output packet
3154    /// under the `stream_lifetime_ordinal` having this `timestamp_ish`
3155    /// value.
3156    pub timestamp_ish: Option<u64>,
3157    #[doc(hidden)]
3158    pub __source_breaking: fidl::marker::SourceBreaking,
3159}
3160
3161impl fidl::Persistable for StreamProcessorOnOutputTimestampHasNoOutputRequest {}
3162
3163/// A state of audio usages in which a policy decision has been made to temporarily
3164/// lower the volume of all streams with this usage.
3165#[derive(Clone, Debug, Default, PartialEq)]
3166pub struct UsageStateDucked {
3167    #[doc(hidden)]
3168    pub __source_breaking: fidl::marker::SourceBreaking,
3169}
3170
3171impl fidl::Persistable for UsageStateDucked {}
3172
3173/// A state of audio usages in which a policy decision has been made to temporarily
3174/// mute the volume of all streams with this usage.
3175#[derive(Clone, Debug, Default, PartialEq)]
3176pub struct UsageStateMuted {
3177    #[doc(hidden)]
3178    pub __source_breaking: fidl::marker::SourceBreaking,
3179}
3180
3181impl fidl::Persistable for UsageStateMuted {}
3182
3183/// A state of audio usages in which no policy actions are taken on any streams with the usage.
3184#[derive(Clone, Debug, Default, PartialEq)]
3185pub struct UsageStateUnadjusted {
3186    #[doc(hidden)]
3187    pub __source_breaking: fidl::marker::SourceBreaking,
3188}
3189
3190impl fidl::Persistable for UsageStateUnadjusted {}
3191
3192#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
3193pub enum AacBitRate {
3194    Constant(AacConstantBitRate),
3195    Variable(AacVariableBitRate),
3196}
3197
3198impl AacBitRate {
3199    #[inline]
3200    pub fn ordinal(&self) -> u64 {
3201        match *self {
3202            Self::Constant(_) => 1,
3203            Self::Variable(_) => 2,
3204        }
3205    }
3206}
3207
3208impl fidl::Persistable for AacBitRate {}
3209
3210#[derive(Clone, Debug)]
3211pub enum AacTransport {
3212    Raw(AacTransportRaw),
3213    Latm(AacTransportLatm),
3214    Adts(AacTransportAdts),
3215    #[doc(hidden)]
3216    __SourceBreaking {
3217        unknown_ordinal: u64,
3218    },
3219}
3220
3221/// Pattern that matches an unknown `AacTransport` member.
3222#[macro_export]
3223macro_rules! AacTransportUnknown {
3224    () => {
3225        _
3226    };
3227}
3228
3229// Custom PartialEq so that unknown variants are not equal to themselves.
3230impl PartialEq for AacTransport {
3231    fn eq(&self, other: &Self) -> bool {
3232        match (self, other) {
3233            (Self::Raw(x), Self::Raw(y)) => *x == *y,
3234            (Self::Latm(x), Self::Latm(y)) => *x == *y,
3235            (Self::Adts(x), Self::Adts(y)) => *x == *y,
3236            _ => false,
3237        }
3238    }
3239}
3240
3241impl AacTransport {
3242    #[inline]
3243    pub fn ordinal(&self) -> u64 {
3244        match *self {
3245            Self::Raw(_) => 1,
3246            Self::Latm(_) => 2,
3247            Self::Adts(_) => 3,
3248            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
3249        }
3250    }
3251
3252    #[inline]
3253    pub fn unknown_variant_for_testing() -> Self {
3254        Self::__SourceBreaking { unknown_ordinal: 0 }
3255    }
3256
3257    #[inline]
3258    pub fn is_unknown(&self) -> bool {
3259        match self {
3260            Self::__SourceBreaking { .. } => true,
3261            _ => false,
3262        }
3263    }
3264}
3265
3266impl fidl::Persistable for AacTransport {}
3267
3268/// Configuration for an audio Capturer.
3269#[derive(Clone, Debug, PartialEq)]
3270pub enum AudioCapturerConfiguration {
3271    Loopback(LoopbackAudioCapturerConfiguration),
3272    Input(InputAudioCapturerConfiguration),
3273}
3274
3275impl AudioCapturerConfiguration {
3276    #[inline]
3277    pub fn ordinal(&self) -> u64 {
3278        match *self {
3279            Self::Loopback(_) => 1,
3280            Self::Input(_) => 2,
3281        }
3282    }
3283}
3284
3285impl fidl::Persistable for AudioCapturerConfiguration {}
3286
3287#[derive(Clone, Debug)]
3288pub enum AudioCompressedFormat {
3289    Aac(AudioCompressedFormatAac),
3290    Sbc(AudioCompressedFormatSbc),
3291    Cvsd(AudioCompressedFormatCvsd),
3292    Lc3(AudioCompressedFormatLc3),
3293    #[doc(hidden)]
3294    __SourceBreaking {
3295        unknown_ordinal: u64,
3296    },
3297}
3298
3299/// Pattern that matches an unknown `AudioCompressedFormat` member.
3300#[macro_export]
3301macro_rules! AudioCompressedFormatUnknown {
3302    () => {
3303        _
3304    };
3305}
3306
3307// Custom PartialEq so that unknown variants are not equal to themselves.
3308impl PartialEq for AudioCompressedFormat {
3309    fn eq(&self, other: &Self) -> bool {
3310        match (self, other) {
3311            (Self::Aac(x), Self::Aac(y)) => *x == *y,
3312            (Self::Sbc(x), Self::Sbc(y)) => *x == *y,
3313            (Self::Cvsd(x), Self::Cvsd(y)) => *x == *y,
3314            (Self::Lc3(x), Self::Lc3(y)) => *x == *y,
3315            _ => false,
3316        }
3317    }
3318}
3319
3320impl AudioCompressedFormat {
3321    #[inline]
3322    pub fn ordinal(&self) -> u64 {
3323        match *self {
3324            Self::Aac(_) => 1,
3325            Self::Sbc(_) => 2,
3326            Self::Cvsd(_) => 3,
3327            Self::Lc3(_) => 4,
3328            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
3329        }
3330    }
3331
3332    #[inline]
3333    pub fn unknown_variant_for_testing() -> Self {
3334        Self::__SourceBreaking { unknown_ordinal: 0 }
3335    }
3336
3337    #[inline]
3338    pub fn is_unknown(&self) -> bool {
3339        match self {
3340            Self::__SourceBreaking { .. } => true,
3341            _ => false,
3342        }
3343    }
3344}
3345
3346impl fidl::Persistable for AudioCompressedFormat {}
3347
3348/// Represents a `AudioConsumer` error condition.
3349#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
3350pub enum AudioConsumerError {
3351    PlaceHolder(Void),
3352}
3353
3354impl AudioConsumerError {
3355    #[inline]
3356    pub fn ordinal(&self) -> u64 {
3357        match *self {
3358            Self::PlaceHolder(_) => 1,
3359        }
3360    }
3361}
3362
3363impl fidl::Persistable for AudioConsumerError {}
3364
3365/// AudioFormat
3366#[derive(Clone, Debug, PartialEq)]
3367pub enum AudioFormat {
3368    Compressed(AudioCompressedFormat),
3369    Uncompressed(AudioUncompressedFormat),
3370}
3371
3372impl AudioFormat {
3373    #[inline]
3374    pub fn ordinal(&self) -> u64 {
3375        match *self {
3376            Self::Compressed(_) => 1,
3377            Self::Uncompressed(_) => 2,
3378        }
3379    }
3380}
3381
3382impl fidl::Persistable for AudioFormat {}
3383
3384/// AudioUncompressedFormat
3385#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
3386pub enum AudioUncompressedFormat {
3387    Pcm(PcmFormat),
3388}
3389
3390impl AudioUncompressedFormat {
3391    #[inline]
3392    pub fn ordinal(&self) -> u64 {
3393        match *self {
3394            Self::Pcm(_) => 1,
3395        }
3396    }
3397}
3398
3399impl fidl::Persistable for AudioUncompressedFormat {}
3400
3401/// CryptoFormat
3402///
3403/// Crypto (encrypted or decrypted) format details.
3404#[derive(Clone, Debug)]
3405pub enum CryptoFormat {
3406    Encrypted(EncryptedFormat),
3407    Decrypted(DecryptedFormat),
3408    #[doc(hidden)]
3409    __SourceBreaking {
3410        unknown_ordinal: u64,
3411    },
3412}
3413
3414/// Pattern that matches an unknown `CryptoFormat` member.
3415#[macro_export]
3416macro_rules! CryptoFormatUnknown {
3417    () => {
3418        _
3419    };
3420}
3421
3422// Custom PartialEq so that unknown variants are not equal to themselves.
3423impl PartialEq for CryptoFormat {
3424    fn eq(&self, other: &Self) -> bool {
3425        match (self, other) {
3426            (Self::Encrypted(x), Self::Encrypted(y)) => *x == *y,
3427            (Self::Decrypted(x), Self::Decrypted(y)) => *x == *y,
3428            _ => false,
3429        }
3430    }
3431}
3432
3433impl CryptoFormat {
3434    #[inline]
3435    pub fn ordinal(&self) -> u64 {
3436        match *self {
3437            Self::Encrypted(_) => 1,
3438            Self::Decrypted(_) => 2,
3439            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
3440        }
3441    }
3442
3443    #[inline]
3444    pub fn unknown_variant_for_testing() -> Self {
3445        Self::__SourceBreaking { unknown_ordinal: 0 }
3446    }
3447
3448    #[inline]
3449    pub fn is_unknown(&self) -> bool {
3450        match self {
3451            Self::__SourceBreaking { .. } => true,
3452            _ => false,
3453        }
3454    }
3455}
3456
3457impl fidl::Persistable for CryptoFormat {}
3458
3459/// DomainFormat
3460#[derive(Clone, Debug, PartialEq)]
3461pub enum DomainFormat {
3462    Audio(AudioFormat),
3463    Video(VideoFormat),
3464    Crypto(CryptoFormat),
3465}
3466
3467impl DomainFormat {
3468    #[inline]
3469    pub fn ordinal(&self) -> u64 {
3470        match *self {
3471            Self::Audio(_) => 1,
3472            Self::Video(_) => 2,
3473            Self::Crypto(_) => 3,
3474        }
3475    }
3476}
3477
3478impl fidl::Persistable for DomainFormat {}
3479
3480/// Settings for encoders that tell them how to encode raw
3481/// formats.
3482#[derive(Clone, Debug)]
3483pub enum EncoderSettings {
3484    Sbc(SbcEncoderSettings),
3485    Aac(AacEncoderSettings),
3486    H264(H264EncoderSettings),
3487    Hevc(HevcEncoderSettings),
3488    Cvsd(CvsdEncoderSettings),
3489    Lc3(Lc3EncoderSettings),
3490    Msbc(MSbcEncoderSettings),
3491    #[doc(hidden)]
3492    __SourceBreaking {
3493        unknown_ordinal: u64,
3494    },
3495}
3496
3497/// Pattern that matches an unknown `EncoderSettings` member.
3498#[macro_export]
3499macro_rules! EncoderSettingsUnknown {
3500    () => {
3501        _
3502    };
3503}
3504
3505// Custom PartialEq so that unknown variants are not equal to themselves.
3506impl PartialEq for EncoderSettings {
3507    fn eq(&self, other: &Self) -> bool {
3508        match (self, other) {
3509            (Self::Sbc(x), Self::Sbc(y)) => *x == *y,
3510            (Self::Aac(x), Self::Aac(y)) => *x == *y,
3511            (Self::H264(x), Self::H264(y)) => *x == *y,
3512            (Self::Hevc(x), Self::Hevc(y)) => *x == *y,
3513            (Self::Cvsd(x), Self::Cvsd(y)) => *x == *y,
3514            (Self::Lc3(x), Self::Lc3(y)) => *x == *y,
3515            (Self::Msbc(x), Self::Msbc(y)) => *x == *y,
3516            _ => false,
3517        }
3518    }
3519}
3520
3521impl EncoderSettings {
3522    #[inline]
3523    pub fn ordinal(&self) -> u64 {
3524        match *self {
3525            Self::Sbc(_) => 1,
3526            Self::Aac(_) => 2,
3527            Self::H264(_) => 3,
3528            Self::Hevc(_) => 4,
3529            Self::Cvsd(_) => 5,
3530            Self::Lc3(_) => 6,
3531            Self::Msbc(_) => 7,
3532            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
3533        }
3534    }
3535
3536    #[inline]
3537    pub fn unknown_variant_for_testing() -> Self {
3538        Self::__SourceBreaking { unknown_ordinal: 0 }
3539    }
3540
3541    #[inline]
3542    pub fn is_unknown(&self) -> bool {
3543        match self {
3544            Self::__SourceBreaking { .. } => true,
3545            _ => false,
3546        }
3547    }
3548}
3549
3550impl fidl::Persistable for EncoderSettings {}
3551
3552/// A union of all medium-specific stream type structs.
3553#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
3554pub enum MediumSpecificStreamType {
3555    Audio(AudioStreamType),
3556    Video(VideoStreamType),
3557    Text(TextStreamType),
3558    Subpicture(SubpictureStreamType),
3559}
3560
3561impl MediumSpecificStreamType {
3562    #[inline]
3563    pub fn ordinal(&self) -> u64 {
3564        match *self {
3565            Self::Audio(_) => 1,
3566            Self::Video(_) => 2,
3567            Self::Text(_) => 3,
3568            Self::Subpicture(_) => 4,
3569        }
3570    }
3571}
3572
3573impl fidl::Persistable for MediumSpecificStreamType {}
3574
3575#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
3576pub enum Usage {
3577    RenderUsage(AudioRenderUsage),
3578    CaptureUsage(AudioCaptureUsage),
3579}
3580
3581impl Usage {
3582    #[inline]
3583    pub fn ordinal(&self) -> u64 {
3584        match *self {
3585            Self::RenderUsage(_) => 1,
3586            Self::CaptureUsage(_) => 2,
3587        }
3588    }
3589}
3590
3591impl fidl::Persistable for Usage {}
3592
3593#[derive(Clone, Debug)]
3594pub enum Usage2 {
3595    RenderUsage(AudioRenderUsage2),
3596    CaptureUsage(AudioCaptureUsage2),
3597    #[doc(hidden)]
3598    __SourceBreaking {
3599        unknown_ordinal: u64,
3600    },
3601}
3602
3603/// Pattern that matches an unknown `Usage2` member.
3604#[macro_export]
3605macro_rules! Usage2Unknown {
3606    () => {
3607        _
3608    };
3609}
3610
3611// Custom PartialEq so that unknown variants are not equal to themselves.
3612impl PartialEq for Usage2 {
3613    fn eq(&self, other: &Self) -> bool {
3614        match (self, other) {
3615            (Self::RenderUsage(x), Self::RenderUsage(y)) => *x == *y,
3616            (Self::CaptureUsage(x), Self::CaptureUsage(y)) => *x == *y,
3617            _ => false,
3618        }
3619    }
3620}
3621
3622impl Usage2 {
3623    #[inline]
3624    pub fn ordinal(&self) -> u64 {
3625        match *self {
3626            Self::RenderUsage(_) => 1,
3627            Self::CaptureUsage(_) => 2,
3628            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
3629        }
3630    }
3631
3632    #[inline]
3633    pub fn unknown_variant_for_testing() -> Self {
3634        Self::__SourceBreaking { unknown_ordinal: 0 }
3635    }
3636
3637    #[inline]
3638    pub fn is_unknown(&self) -> bool {
3639        match self {
3640            Self::__SourceBreaking { .. } => true,
3641            _ => false,
3642        }
3643    }
3644}
3645
3646impl fidl::Persistable for Usage2 {}
3647
3648/// The state of audio policy enforcement on a stream or set of streams.
3649#[derive(Clone, Debug)]
3650pub enum UsageState {
3651    Unadjusted(UsageStateUnadjusted),
3652    Ducked(UsageStateDucked),
3653    Muted(UsageStateMuted),
3654    #[doc(hidden)]
3655    __SourceBreaking {
3656        unknown_ordinal: u64,
3657    },
3658}
3659
3660/// Pattern that matches an unknown `UsageState` member.
3661#[macro_export]
3662macro_rules! UsageStateUnknown {
3663    () => {
3664        _
3665    };
3666}
3667
3668// Custom PartialEq so that unknown variants are not equal to themselves.
3669impl PartialEq for UsageState {
3670    fn eq(&self, other: &Self) -> bool {
3671        match (self, other) {
3672            (Self::Unadjusted(x), Self::Unadjusted(y)) => *x == *y,
3673            (Self::Ducked(x), Self::Ducked(y)) => *x == *y,
3674            (Self::Muted(x), Self::Muted(y)) => *x == *y,
3675            _ => false,
3676        }
3677    }
3678}
3679
3680impl UsageState {
3681    #[inline]
3682    pub fn ordinal(&self) -> u64 {
3683        match *self {
3684            Self::Unadjusted(_) => 1,
3685            Self::Ducked(_) => 2,
3686            Self::Muted(_) => 3,
3687            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
3688        }
3689    }
3690
3691    #[inline]
3692    pub fn unknown_variant_for_testing() -> Self {
3693        Self::__SourceBreaking { unknown_ordinal: 0 }
3694    }
3695
3696    #[inline]
3697    pub fn is_unknown(&self) -> bool {
3698        match self {
3699            Self::__SourceBreaking { .. } => true,
3700            _ => false,
3701        }
3702    }
3703}
3704
3705impl fidl::Persistable for UsageState {}
3706
3707/// Value
3708///
3709/// Generic "value" for use within generic "Parameter" struct.
3710#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
3711pub enum Value {
3712    BoolValue(bool),
3713    Uint64Value(u64),
3714    Int64Value(i64),
3715    StringValue(String),
3716    BytesValue(Vec<u8>),
3717}
3718
3719impl Value {
3720    #[inline]
3721    pub fn ordinal(&self) -> u64 {
3722        match *self {
3723            Self::BoolValue(_) => 1,
3724            Self::Uint64Value(_) => 2,
3725            Self::Int64Value(_) => 3,
3726            Self::StringValue(_) => 4,
3727            Self::BytesValue(_) => 5,
3728        }
3729    }
3730}
3731
3732impl fidl::Persistable for Value {}
3733
3734/// VideoCompressedFormat
3735///
3736/// Compressed video format details.
3737#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
3738pub enum VideoCompressedFormat {
3739    /// Temp field to make the compiler happy until we have at least one real
3740    /// field. Do not reference this field in code.
3741    TempFieldTodoRemove(u32),
3742}
3743
3744impl VideoCompressedFormat {
3745    #[inline]
3746    pub fn ordinal(&self) -> u64 {
3747        match *self {
3748            Self::TempFieldTodoRemove(_) => 1,
3749        }
3750    }
3751}
3752
3753impl fidl::Persistable for VideoCompressedFormat {}
3754
3755/// VideoFormat
3756///
3757/// Video (compress or uncompressed) format details.  In this context,
3758/// "uncompressed" can include block-based image compression formats that still
3759/// permit fairly fast random access to image data.
3760#[derive(Clone, Debug, PartialEq)]
3761pub enum VideoFormat {
3762    Compressed(VideoCompressedFormat),
3763    Uncompressed(VideoUncompressedFormat),
3764}
3765
3766impl VideoFormat {
3767    #[inline]
3768    pub fn ordinal(&self) -> u64 {
3769        match *self {
3770            Self::Compressed(_) => 1,
3771            Self::Uncompressed(_) => 2,
3772        }
3773    }
3774}
3775
3776impl fidl::Persistable for VideoFormat {}
3777
3778pub mod activity_reporter_ordinals {
3779    pub const WATCH_RENDER_ACTIVITY: u64 = 0x2974e9f5880b2f1f;
3780    pub const WATCH_RENDER_ACTIVITY2: u64 = 0x484236fc11b363e6;
3781    pub const WATCH_CAPTURE_ACTIVITY: u64 = 0x70e7038e9658e128;
3782    pub const WATCH_CAPTURE_ACTIVITY2: u64 = 0x3d137e0364f9d550;
3783}
3784
3785pub mod audio_ordinals {
3786    pub const CREATE_AUDIO_RENDERER: u64 = 0x572f413566fd58f1;
3787    pub const CREATE_AUDIO_CAPTURER: u64 = 0x44660fc63a6202f;
3788}
3789
3790pub mod audio_capturer_ordinals {
3791    pub const ADD_PAYLOAD_BUFFER: u64 = 0x3b3a37fc34fe5b56;
3792    pub const REMOVE_PAYLOAD_BUFFER: u64 = 0x5d1e4f74c3658262;
3793    pub const ON_PACKET_PRODUCED: u64 = 0x6bbe69746a3c8bd9;
3794    pub const ON_END_OF_STREAM: u64 = 0x550e69b41d03e2c2;
3795    pub const RELEASE_PACKET: u64 = 0x7a7b57f0f7d9e4bb;
3796    pub const DISCARD_ALL_PACKETS: u64 = 0x27afd605e97b09d2;
3797    pub const DISCARD_ALL_PACKETS_NO_REPLY: u64 = 0x35f9d721e905b831;
3798    pub const SET_PCM_STREAM_TYPE: u64 = 0x1531ea9ea2c852cd;
3799    pub const CAPTURE_AT: u64 = 0x784e25df72cea780;
3800    pub const START_ASYNC_CAPTURE: u64 = 0x7768adbb1ccfd7a6;
3801    pub const STOP_ASYNC_CAPTURE: u64 = 0x5bfc8790a8cef8cb;
3802    pub const STOP_ASYNC_CAPTURE_NO_REPLY: u64 = 0x33223cb2962c95e3;
3803    pub const BIND_GAIN_CONTROL: u64 = 0x658a6a17ddb3a8e0;
3804    pub const GET_REFERENCE_CLOCK: u64 = 0x50d037aa5a4b4d71;
3805    pub const SET_REFERENCE_CLOCK: u64 = 0x732b2c496d521bcf;
3806    pub const SET_USAGE: u64 = 0x42a16f392bd21b25;
3807    pub const SET_USAGE2: u64 = 0x7a73e251b8d2382b;
3808    pub const GET_STREAM_TYPE: u64 = 0x5dcaaa670b433088;
3809}
3810
3811pub mod audio_consumer_ordinals {
3812    pub const CREATE_STREAM_SINK: u64 = 0x525b3b97fdf7d884;
3813    pub const ON_END_OF_STREAM: u64 = 0x53a64e6d0e8f8a20;
3814    pub const START: u64 = 0x4fdbd44b3f2a3a3c;
3815    pub const STOP: u64 = 0x3d46c3741686c40d;
3816    pub const SET_RATE: u64 = 0x45342b73968bfafe;
3817    pub const BIND_VOLUME_CONTROL: u64 = 0x6f1b01fd887f5748;
3818    pub const WATCH_STATUS: u64 = 0x35cf702c721e2cc6;
3819}
3820
3821pub mod audio_core_ordinals {
3822    pub const CREATE_AUDIO_RENDERER: u64 = 0x2ac9beba47f83435;
3823    pub const CREATE_AUDIO_CAPTURER_WITH_CONFIGURATION: u64 = 0x459de383b0d76d97;
3824    pub const CREATE_AUDIO_CAPTURER: u64 = 0x787db169df99aed0;
3825    pub const SET_RENDER_USAGE_GAIN: u64 = 0x48097f45f6e2b8e7;
3826    pub const SET_RENDER_USAGE_GAIN2: u64 = 0x779b1531dc9e64f4;
3827    pub const SET_CAPTURE_USAGE_GAIN: u64 = 0x457d29217d4ea248;
3828    pub const SET_CAPTURE_USAGE_GAIN2: u64 = 0x15065ee308f44af0;
3829    pub const BIND_USAGE_VOLUME_CONTROL: u64 = 0x7225be116aadc137;
3830    pub const BIND_USAGE_VOLUME_CONTROL2: u64 = 0x729dff93019d055;
3831    pub const GET_VOLUME_FROM_DB: u64 = 0x50e3ca45509770bf;
3832    pub const GET_VOLUME_FROM_DB2: u64 = 0x165c811091ef99da;
3833    pub const GET_DB_FROM_VOLUME: u64 = 0x3e8eec27dd5a8bda;
3834    pub const GET_DB_FROM_VOLUME2: u64 = 0x5f421a8ebf265bf3;
3835    pub const SET_INTERACTION: u64 = 0x7bfed14345ece7b7;
3836    pub const SET_INTERACTION2: u64 = 0x7226c7c6e6edc62f;
3837    pub const RESET_INTERACTIONS: u64 = 0x65bd94d9d0a28b5e;
3838    pub const LOAD_DEFAULTS: u64 = 0x54a0bebca85f6b31;
3839}
3840
3841pub mod audio_device_enumerator_ordinals {
3842    pub const GET_DEVICES: u64 = 0x4ce1aa218aeb12a6;
3843    pub const ON_DEVICE_ADDED: u64 = 0xe0fbe40057c4b44;
3844    pub const ON_DEVICE_REMOVED: u64 = 0x6f3b7574463d9ff8;
3845    pub const ON_DEVICE_GAIN_CHANGED: u64 = 0x14aefcbbb076b0e9;
3846    pub const ON_DEFAULT_DEVICE_CHANGED: u64 = 0x16357b42d4c16e11;
3847    pub const GET_DEVICE_GAIN: u64 = 0x25dd4723403c414b;
3848    pub const SET_DEVICE_GAIN: u64 = 0x5bdabc8ebe83591;
3849    pub const ADD_DEVICE_BY_CHANNEL: u64 = 0x72cdbada4d70ed67;
3850}
3851
3852pub mod audio_renderer_ordinals {
3853    pub const ADD_PAYLOAD_BUFFER: u64 = 0x3b3a37fc34fe5b56;
3854    pub const REMOVE_PAYLOAD_BUFFER: u64 = 0x5d1e4f74c3658262;
3855    pub const SEND_PACKET: u64 = 0x67cddd607442775f;
3856    pub const SEND_PACKET_NO_REPLY: u64 = 0x8d9b8b413ceba9d;
3857    pub const END_OF_STREAM: u64 = 0x6180fd6f7e793b71;
3858    pub const DISCARD_ALL_PACKETS: u64 = 0x6f4dad7af2917665;
3859    pub const DISCARD_ALL_PACKETS_NO_REPLY: u64 = 0x50d36d0d23081bc4;
3860    pub const BIND_GAIN_CONTROL: u64 = 0x293f5c7f8fba2bdc;
3861    pub const SET_PTS_UNITS: u64 = 0xf68cd108785a27c;
3862    pub const SET_PTS_CONTINUITY_THRESHOLD: u64 = 0x2849ba571d1971ba;
3863    pub const GET_REFERENCE_CLOCK: u64 = 0x2f7a7f011a172f7e;
3864    pub const SET_REFERENCE_CLOCK: u64 = 0x39acd05d832b5fed;
3865    pub const SET_USAGE: u64 = 0x3994bd23b55a733e;
3866    pub const SET_USAGE2: u64 = 0x2904035c7132b103;
3867    pub const SET_PCM_STREAM_TYPE: u64 = 0x27aa715d8901fa19;
3868    pub const ENABLE_MIN_LEAD_TIME_EVENTS: u64 = 0x62808dfad72bf890;
3869    pub const ON_MIN_LEAD_TIME_CHANGED: u64 = 0x4feff7d278978c4e;
3870    pub const GET_MIN_LEAD_TIME: u64 = 0x1cf3c3ecd8fec26b;
3871    pub const PLAY: u64 = 0x3c0162db084f74a3;
3872    pub const PLAY_NO_REPLY: u64 = 0x1b7fe832b68c22ef;
3873    pub const PAUSE: u64 = 0x41d557588d93d153;
3874    pub const PAUSE_NO_REPLY: u64 = 0x24cc45d4f3855ab;
3875}
3876
3877pub mod profile_provider_ordinals {
3878    pub const REGISTER_HANDLER_WITH_CAPACITY: u64 = 0x60459ecef7458176;
3879    pub const UNREGISTER_HANDLER: u64 = 0x724d9d5fd8ef544c;
3880    pub const REGISTER_MEMORY_RANGE: u64 = 0x2f509d3523e9562d;
3881    pub const UNREGISTER_MEMORY_RANGE: u64 = 0x2dc313d6aa81ad27;
3882}
3883
3884pub mod session_audio_consumer_factory_ordinals {
3885    pub const CREATE_AUDIO_CONSUMER: u64 = 0x6fab96f988e7d7fb;
3886}
3887
3888pub mod simple_stream_sink_ordinals {
3889    pub const ADD_PAYLOAD_BUFFER: u64 = 0x3b3a37fc34fe5b56;
3890    pub const REMOVE_PAYLOAD_BUFFER: u64 = 0x5d1e4f74c3658262;
3891    pub const SEND_PACKET: u64 = 0x67cddd607442775f;
3892    pub const SEND_PACKET_NO_REPLY: u64 = 0x8d9b8b413ceba9d;
3893    pub const END_OF_STREAM: u64 = 0x6180fd6f7e793b71;
3894    pub const DISCARD_ALL_PACKETS: u64 = 0x6f4dad7af2917665;
3895    pub const DISCARD_ALL_PACKETS_NO_REPLY: u64 = 0x50d36d0d23081bc4;
3896}
3897
3898pub mod stream_buffer_set_ordinals {
3899    pub const ADD_PAYLOAD_BUFFER: u64 = 0x3b3a37fc34fe5b56;
3900    pub const REMOVE_PAYLOAD_BUFFER: u64 = 0x5d1e4f74c3658262;
3901}
3902
3903pub mod stream_processor_ordinals {
3904    pub const ENABLE_ON_STREAM_FAILED: u64 = 0x3940929617dbf02b;
3905    pub const ON_STREAM_FAILED: u64 = 0x77ccf70bb061cf8e;
3906    pub const ON_INPUT_CONSTRAINTS: u64 = 0x211da9966a8ca0;
3907    pub const SET_INPUT_BUFFER_PARTIAL_SETTINGS: u64 = 0xb02e0663a40e4c4;
3908    pub const ON_OUTPUT_CONSTRAINTS: u64 = 0x40d8234504c170f3;
3909    pub const ON_OUTPUT_FORMAT: u64 = 0x131b77ae120360bc;
3910    pub const SET_OUTPUT_BUFFER_PARTIAL_SETTINGS: u64 = 0x118bb8c819a7bbbb;
3911    pub const COMPLETE_OUTPUT_BUFFER_PARTIAL_SETTINGS: u64 = 0x50529e5c680ae3ab;
3912    pub const FLUSH_END_OF_STREAM_AND_CLOSE_STREAM: u64 = 0x2b62c3e26d0667e6;
3913    pub const CLOSE_CURRENT_STREAM: u64 = 0x1d8a67522170ca07;
3914    pub const SYNC: u64 = 0x4b3e44300b0ec6aa;
3915    pub const ON_OUTPUT_PACKET: u64 = 0x5c2029be1090ce93;
3916    pub const RECYCLE_OUTPUT_PACKET: u64 = 0x32763632b94e0bd5;
3917    pub const ON_OUTPUT_END_OF_STREAM: u64 = 0x3bb65d237cfa50e6;
3918    pub const QUEUE_INPUT_FORMAT_DETAILS: u64 = 0x170dc0979d52231;
3919    pub const QUEUE_INPUT_PACKET: u64 = 0x47173d2652d9df3b;
3920    pub const ON_FREE_INPUT_PACKET: u64 = 0xeef799b28708bbd;
3921    pub const QUEUE_INPUT_END_OF_STREAM: u64 = 0x2051b6ad00f20b37;
3922    pub const PARTICIPATE_IN_BUFFER_ALLOCATION: u64 = 0x122be3b0096183cb;
3923    pub const ADD_BUFFER: u64 = 0x6eca773e923e0ada;
3924    pub const REMOVE_BUFFER: u64 = 0x40b967ffa6b2da43;
3925    pub const ENABLE_OLD_OUTPUT_BUFFERS: u64 = 0x3aedefeedf3898b0;
3926    pub const ENABLE_SAME_OUTPUT_BUFFER_CONCURRENTLY_IN_FLIGHT: u64 = 0x244e9f43b29709e7;
3927    pub const ENABLE_FORCE_OUTPUT_BUFFERS_FIXED_IMAGE_SIZE: u64 = 0x3994b040f91dc1e9;
3928    pub const ON_OUTPUT_TIMESTAMP_HAS_NO_OUTPUT: u64 = 0x7436457799a25cd4;
3929}
3930
3931pub mod stream_sink_ordinals {
3932    pub const SEND_PACKET: u64 = 0x67cddd607442775f;
3933    pub const SEND_PACKET_NO_REPLY: u64 = 0x8d9b8b413ceba9d;
3934    pub const END_OF_STREAM: u64 = 0x6180fd6f7e793b71;
3935    pub const DISCARD_ALL_PACKETS: u64 = 0x6f4dad7af2917665;
3936    pub const DISCARD_ALL_PACKETS_NO_REPLY: u64 = 0x50d36d0d23081bc4;
3937}
3938
3939pub mod stream_source_ordinals {
3940    pub const ON_PACKET_PRODUCED: u64 = 0x6bbe69746a3c8bd9;
3941    pub const ON_END_OF_STREAM: u64 = 0x550e69b41d03e2c2;
3942    pub const RELEASE_PACKET: u64 = 0x7a7b57f0f7d9e4bb;
3943    pub const DISCARD_ALL_PACKETS: u64 = 0x27afd605e97b09d2;
3944    pub const DISCARD_ALL_PACKETS_NO_REPLY: u64 = 0x35f9d721e905b831;
3945}
3946
3947pub mod usage2_audio_consumer_factory_ordinals {
3948    pub const CREATE_AUDIO_CONSUMER: u64 = 0x767722302a171873;
3949}
3950
3951pub mod usage_audio_consumer_factory_ordinals {
3952    pub const CREATE_AUDIO_CONSUMER: u64 = 0x4d975ca9b8f625a3;
3953}
3954
3955pub mod usage_gain_listener_ordinals {
3956    pub const ON_GAIN_MUTE_CHANGED: u64 = 0x681570258eac3a8d;
3957}
3958
3959pub mod usage_gain_reporter_ordinals {
3960    pub const REGISTER_LISTENER: u64 = 0x767107c168c226af;
3961    pub const REGISTER_LISTENER2: u64 = 0x760a8e1c5873629c;
3962}
3963
3964pub mod usage_reporter_ordinals {
3965    pub const WATCH: u64 = 0x769e6fb17075c959;
3966    pub const WATCH2: u64 = 0x4a43c4c82f5d8ce8;
3967}
3968
3969pub mod usage_watcher_ordinals {
3970    pub const ON_STATE_CHANGED: u64 = 0x5b955c5768ec75c5;
3971}
3972
3973pub mod usage_watcher2_ordinals {
3974    pub const ON_STATE_CHANGED: u64 = 0xca31a8b13c324d4;
3975}
3976
3977mod internal {
3978    use super::*;
3979    unsafe impl fidl::encoding::TypeMarker for AudioConsumerStartFlags {
3980        type Owned = Self;
3981
3982        #[inline(always)]
3983        fn inline_align(_context: fidl::encoding::Context) -> usize {
3984            4
3985        }
3986
3987        #[inline(always)]
3988        fn inline_size(_context: fidl::encoding::Context) -> usize {
3989            4
3990        }
3991    }
3992
3993    impl fidl::encoding::ValueTypeMarker for AudioConsumerStartFlags {
3994        type Borrowed<'a> = Self;
3995        #[inline(always)]
3996        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3997            *value
3998        }
3999    }
4000
4001    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
4002        for AudioConsumerStartFlags
4003    {
4004        #[inline]
4005        unsafe fn encode(
4006            self,
4007            encoder: &mut fidl::encoding::Encoder<'_, D>,
4008            offset: usize,
4009            _depth: fidl::encoding::Depth,
4010        ) -> fidl::Result<()> {
4011            encoder.debug_check_bounds::<Self>(offset);
4012            if self.bits() & Self::all().bits() != self.bits() {
4013                return Err(fidl::Error::InvalidBitsValue);
4014            }
4015            encoder.write_num(self.bits(), offset);
4016            Ok(())
4017        }
4018    }
4019
4020    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4021        for AudioConsumerStartFlags
4022    {
4023        #[inline(always)]
4024        fn new_empty() -> Self {
4025            Self::empty()
4026        }
4027
4028        #[inline]
4029        unsafe fn decode(
4030            &mut self,
4031            decoder: &mut fidl::encoding::Decoder<'_, D>,
4032            offset: usize,
4033            _depth: fidl::encoding::Depth,
4034        ) -> fidl::Result<()> {
4035            decoder.debug_check_bounds::<Self>(offset);
4036            let prim = decoder.read_num::<u32>(offset);
4037            *self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
4038            Ok(())
4039        }
4040    }
4041    unsafe impl fidl::encoding::TypeMarker for AudioGainInfoFlags {
4042        type Owned = Self;
4043
4044        #[inline(always)]
4045        fn inline_align(_context: fidl::encoding::Context) -> usize {
4046            4
4047        }
4048
4049        #[inline(always)]
4050        fn inline_size(_context: fidl::encoding::Context) -> usize {
4051            4
4052        }
4053    }
4054
4055    impl fidl::encoding::ValueTypeMarker for AudioGainInfoFlags {
4056        type Borrowed<'a> = Self;
4057        #[inline(always)]
4058        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4059            *value
4060        }
4061    }
4062
4063    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
4064        for AudioGainInfoFlags
4065    {
4066        #[inline]
4067        unsafe fn encode(
4068            self,
4069            encoder: &mut fidl::encoding::Encoder<'_, D>,
4070            offset: usize,
4071            _depth: fidl::encoding::Depth,
4072        ) -> fidl::Result<()> {
4073            encoder.debug_check_bounds::<Self>(offset);
4074            if self.bits() & Self::all().bits() != self.bits() {
4075                return Err(fidl::Error::InvalidBitsValue);
4076            }
4077            encoder.write_num(self.bits(), offset);
4078            Ok(())
4079        }
4080    }
4081
4082    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AudioGainInfoFlags {
4083        #[inline(always)]
4084        fn new_empty() -> Self {
4085            Self::empty()
4086        }
4087
4088        #[inline]
4089        unsafe fn decode(
4090            &mut self,
4091            decoder: &mut fidl::encoding::Decoder<'_, D>,
4092            offset: usize,
4093            _depth: fidl::encoding::Depth,
4094        ) -> fidl::Result<()> {
4095            decoder.debug_check_bounds::<Self>(offset);
4096            let prim = decoder.read_num::<u32>(offset);
4097            *self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
4098            Ok(())
4099        }
4100    }
4101    unsafe impl fidl::encoding::TypeMarker for AudioGainValidFlags {
4102        type Owned = Self;
4103
4104        #[inline(always)]
4105        fn inline_align(_context: fidl::encoding::Context) -> usize {
4106            4
4107        }
4108
4109        #[inline(always)]
4110        fn inline_size(_context: fidl::encoding::Context) -> usize {
4111            4
4112        }
4113    }
4114
4115    impl fidl::encoding::ValueTypeMarker for AudioGainValidFlags {
4116        type Borrowed<'a> = Self;
4117        #[inline(always)]
4118        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4119            *value
4120        }
4121    }
4122
4123    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
4124        for AudioGainValidFlags
4125    {
4126        #[inline]
4127        unsafe fn encode(
4128            self,
4129            encoder: &mut fidl::encoding::Encoder<'_, D>,
4130            offset: usize,
4131            _depth: fidl::encoding::Depth,
4132        ) -> fidl::Result<()> {
4133            encoder.debug_check_bounds::<Self>(offset);
4134            if self.bits() & Self::all().bits() != self.bits() {
4135                return Err(fidl::Error::InvalidBitsValue);
4136            }
4137            encoder.write_num(self.bits(), offset);
4138            Ok(())
4139        }
4140    }
4141
4142    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AudioGainValidFlags {
4143        #[inline(always)]
4144        fn new_empty() -> Self {
4145            Self::empty()
4146        }
4147
4148        #[inline]
4149        unsafe fn decode(
4150            &mut self,
4151            decoder: &mut fidl::encoding::Decoder<'_, D>,
4152            offset: usize,
4153            _depth: fidl::encoding::Depth,
4154        ) -> fidl::Result<()> {
4155            decoder.debug_check_bounds::<Self>(offset);
4156            let prim = decoder.read_num::<u32>(offset);
4157            *self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
4158            Ok(())
4159        }
4160    }
4161    unsafe impl fidl::encoding::TypeMarker for AacAudioObjectType {
4162        type Owned = Self;
4163
4164        #[inline(always)]
4165        fn inline_align(_context: fidl::encoding::Context) -> usize {
4166            std::mem::align_of::<u32>()
4167        }
4168
4169        #[inline(always)]
4170        fn inline_size(_context: fidl::encoding::Context) -> usize {
4171            std::mem::size_of::<u32>()
4172        }
4173
4174        #[inline(always)]
4175        fn encode_is_copy() -> bool {
4176            true
4177        }
4178
4179        #[inline(always)]
4180        fn decode_is_copy() -> bool {
4181            false
4182        }
4183    }
4184
4185    impl fidl::encoding::ValueTypeMarker for AacAudioObjectType {
4186        type Borrowed<'a> = Self;
4187        #[inline(always)]
4188        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4189            *value
4190        }
4191    }
4192
4193    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
4194        for AacAudioObjectType
4195    {
4196        #[inline]
4197        unsafe fn encode(
4198            self,
4199            encoder: &mut fidl::encoding::Encoder<'_, D>,
4200            offset: usize,
4201            _depth: fidl::encoding::Depth,
4202        ) -> fidl::Result<()> {
4203            encoder.debug_check_bounds::<Self>(offset);
4204            encoder.write_num(self.into_primitive(), offset);
4205            Ok(())
4206        }
4207    }
4208
4209    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AacAudioObjectType {
4210        #[inline(always)]
4211        fn new_empty() -> Self {
4212            Self::Mpeg2AacLc
4213        }
4214
4215        #[inline]
4216        unsafe fn decode(
4217            &mut self,
4218            decoder: &mut fidl::encoding::Decoder<'_, D>,
4219            offset: usize,
4220            _depth: fidl::encoding::Depth,
4221        ) -> fidl::Result<()> {
4222            decoder.debug_check_bounds::<Self>(offset);
4223            let prim = decoder.read_num::<u32>(offset);
4224
4225            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
4226            Ok(())
4227        }
4228    }
4229    unsafe impl fidl::encoding::TypeMarker for AacChannelMode {
4230        type Owned = Self;
4231
4232        #[inline(always)]
4233        fn inline_align(_context: fidl::encoding::Context) -> usize {
4234            std::mem::align_of::<u32>()
4235        }
4236
4237        #[inline(always)]
4238        fn inline_size(_context: fidl::encoding::Context) -> usize {
4239            std::mem::size_of::<u32>()
4240        }
4241
4242        #[inline(always)]
4243        fn encode_is_copy() -> bool {
4244            true
4245        }
4246
4247        #[inline(always)]
4248        fn decode_is_copy() -> bool {
4249            false
4250        }
4251    }
4252
4253    impl fidl::encoding::ValueTypeMarker for AacChannelMode {
4254        type Borrowed<'a> = Self;
4255        #[inline(always)]
4256        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4257            *value
4258        }
4259    }
4260
4261    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for AacChannelMode {
4262        #[inline]
4263        unsafe fn encode(
4264            self,
4265            encoder: &mut fidl::encoding::Encoder<'_, D>,
4266            offset: usize,
4267            _depth: fidl::encoding::Depth,
4268        ) -> fidl::Result<()> {
4269            encoder.debug_check_bounds::<Self>(offset);
4270            encoder.write_num(self.into_primitive(), offset);
4271            Ok(())
4272        }
4273    }
4274
4275    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AacChannelMode {
4276        #[inline(always)]
4277        fn new_empty() -> Self {
4278            Self::Mono
4279        }
4280
4281        #[inline]
4282        unsafe fn decode(
4283            &mut self,
4284            decoder: &mut fidl::encoding::Decoder<'_, D>,
4285            offset: usize,
4286            _depth: fidl::encoding::Depth,
4287        ) -> fidl::Result<()> {
4288            decoder.debug_check_bounds::<Self>(offset);
4289            let prim = decoder.read_num::<u32>(offset);
4290
4291            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
4292            Ok(())
4293        }
4294    }
4295    unsafe impl fidl::encoding::TypeMarker for AacVariableBitRate {
4296        type Owned = Self;
4297
4298        #[inline(always)]
4299        fn inline_align(_context: fidl::encoding::Context) -> usize {
4300            std::mem::align_of::<u32>()
4301        }
4302
4303        #[inline(always)]
4304        fn inline_size(_context: fidl::encoding::Context) -> usize {
4305            std::mem::size_of::<u32>()
4306        }
4307
4308        #[inline(always)]
4309        fn encode_is_copy() -> bool {
4310            true
4311        }
4312
4313        #[inline(always)]
4314        fn decode_is_copy() -> bool {
4315            false
4316        }
4317    }
4318
4319    impl fidl::encoding::ValueTypeMarker for AacVariableBitRate {
4320        type Borrowed<'a> = Self;
4321        #[inline(always)]
4322        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4323            *value
4324        }
4325    }
4326
4327    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
4328        for AacVariableBitRate
4329    {
4330        #[inline]
4331        unsafe fn encode(
4332            self,
4333            encoder: &mut fidl::encoding::Encoder<'_, D>,
4334            offset: usize,
4335            _depth: fidl::encoding::Depth,
4336        ) -> fidl::Result<()> {
4337            encoder.debug_check_bounds::<Self>(offset);
4338            encoder.write_num(self.into_primitive(), offset);
4339            Ok(())
4340        }
4341    }
4342
4343    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AacVariableBitRate {
4344        #[inline(always)]
4345        fn new_empty() -> Self {
4346            Self::V1
4347        }
4348
4349        #[inline]
4350        unsafe fn decode(
4351            &mut self,
4352            decoder: &mut fidl::encoding::Decoder<'_, D>,
4353            offset: usize,
4354            _depth: fidl::encoding::Depth,
4355        ) -> fidl::Result<()> {
4356            decoder.debug_check_bounds::<Self>(offset);
4357            let prim = decoder.read_num::<u32>(offset);
4358
4359            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
4360            Ok(())
4361        }
4362    }
4363    unsafe impl fidl::encoding::TypeMarker for AudioBitrateMode {
4364        type Owned = Self;
4365
4366        #[inline(always)]
4367        fn inline_align(_context: fidl::encoding::Context) -> usize {
4368            std::mem::align_of::<u32>()
4369        }
4370
4371        #[inline(always)]
4372        fn inline_size(_context: fidl::encoding::Context) -> usize {
4373            std::mem::size_of::<u32>()
4374        }
4375
4376        #[inline(always)]
4377        fn encode_is_copy() -> bool {
4378            true
4379        }
4380
4381        #[inline(always)]
4382        fn decode_is_copy() -> bool {
4383            false
4384        }
4385    }
4386
4387    impl fidl::encoding::ValueTypeMarker for AudioBitrateMode {
4388        type Borrowed<'a> = Self;
4389        #[inline(always)]
4390        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4391            *value
4392        }
4393    }
4394
4395    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
4396        for AudioBitrateMode
4397    {
4398        #[inline]
4399        unsafe fn encode(
4400            self,
4401            encoder: &mut fidl::encoding::Encoder<'_, D>,
4402            offset: usize,
4403            _depth: fidl::encoding::Depth,
4404        ) -> fidl::Result<()> {
4405            encoder.debug_check_bounds::<Self>(offset);
4406            encoder.write_num(self.into_primitive(), offset);
4407            Ok(())
4408        }
4409    }
4410
4411    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AudioBitrateMode {
4412        #[inline(always)]
4413        fn new_empty() -> Self {
4414            Self::Unspecified
4415        }
4416
4417        #[inline]
4418        unsafe fn decode(
4419            &mut self,
4420            decoder: &mut fidl::encoding::Decoder<'_, D>,
4421            offset: usize,
4422            _depth: fidl::encoding::Depth,
4423        ) -> fidl::Result<()> {
4424            decoder.debug_check_bounds::<Self>(offset);
4425            let prim = decoder.read_num::<u32>(offset);
4426
4427            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
4428            Ok(())
4429        }
4430    }
4431    unsafe impl fidl::encoding::TypeMarker for AudioCaptureUsage {
4432        type Owned = Self;
4433
4434        #[inline(always)]
4435        fn inline_align(_context: fidl::encoding::Context) -> usize {
4436            std::mem::align_of::<u32>()
4437        }
4438
4439        #[inline(always)]
4440        fn inline_size(_context: fidl::encoding::Context) -> usize {
4441            std::mem::size_of::<u32>()
4442        }
4443
4444        #[inline(always)]
4445        fn encode_is_copy() -> bool {
4446            true
4447        }
4448
4449        #[inline(always)]
4450        fn decode_is_copy() -> bool {
4451            false
4452        }
4453    }
4454
4455    impl fidl::encoding::ValueTypeMarker for AudioCaptureUsage {
4456        type Borrowed<'a> = Self;
4457        #[inline(always)]
4458        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4459            *value
4460        }
4461    }
4462
4463    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
4464        for AudioCaptureUsage
4465    {
4466        #[inline]
4467        unsafe fn encode(
4468            self,
4469            encoder: &mut fidl::encoding::Encoder<'_, D>,
4470            offset: usize,
4471            _depth: fidl::encoding::Depth,
4472        ) -> fidl::Result<()> {
4473            encoder.debug_check_bounds::<Self>(offset);
4474            encoder.write_num(self.into_primitive(), offset);
4475            Ok(())
4476        }
4477    }
4478
4479    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AudioCaptureUsage {
4480        #[inline(always)]
4481        fn new_empty() -> Self {
4482            Self::Background
4483        }
4484
4485        #[inline]
4486        unsafe fn decode(
4487            &mut self,
4488            decoder: &mut fidl::encoding::Decoder<'_, D>,
4489            offset: usize,
4490            _depth: fidl::encoding::Depth,
4491        ) -> fidl::Result<()> {
4492            decoder.debug_check_bounds::<Self>(offset);
4493            let prim = decoder.read_num::<u32>(offset);
4494
4495            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
4496            Ok(())
4497        }
4498    }
4499    unsafe impl fidl::encoding::TypeMarker for AudioCaptureUsage2 {
4500        type Owned = Self;
4501
4502        #[inline(always)]
4503        fn inline_align(_context: fidl::encoding::Context) -> usize {
4504            std::mem::align_of::<u32>()
4505        }
4506
4507        #[inline(always)]
4508        fn inline_size(_context: fidl::encoding::Context) -> usize {
4509            std::mem::size_of::<u32>()
4510        }
4511
4512        #[inline(always)]
4513        fn encode_is_copy() -> bool {
4514            false
4515        }
4516
4517        #[inline(always)]
4518        fn decode_is_copy() -> bool {
4519            false
4520        }
4521    }
4522
4523    impl fidl::encoding::ValueTypeMarker for AudioCaptureUsage2 {
4524        type Borrowed<'a> = Self;
4525        #[inline(always)]
4526        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4527            *value
4528        }
4529    }
4530
4531    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
4532        for AudioCaptureUsage2
4533    {
4534        #[inline]
4535        unsafe fn encode(
4536            self,
4537            encoder: &mut fidl::encoding::Encoder<'_, D>,
4538            offset: usize,
4539            _depth: fidl::encoding::Depth,
4540        ) -> fidl::Result<()> {
4541            encoder.debug_check_bounds::<Self>(offset);
4542            encoder.write_num(self.into_primitive(), offset);
4543            Ok(())
4544        }
4545    }
4546
4547    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AudioCaptureUsage2 {
4548        #[inline(always)]
4549        fn new_empty() -> Self {
4550            Self::unknown()
4551        }
4552
4553        #[inline]
4554        unsafe fn decode(
4555            &mut self,
4556            decoder: &mut fidl::encoding::Decoder<'_, D>,
4557            offset: usize,
4558            _depth: fidl::encoding::Depth,
4559        ) -> fidl::Result<()> {
4560            decoder.debug_check_bounds::<Self>(offset);
4561            let prim = decoder.read_num::<u32>(offset);
4562
4563            *self = Self::from_primitive_allow_unknown(prim);
4564            Ok(())
4565        }
4566    }
4567    unsafe impl fidl::encoding::TypeMarker for AudioChannelId {
4568        type Owned = Self;
4569
4570        #[inline(always)]
4571        fn inline_align(_context: fidl::encoding::Context) -> usize {
4572            std::mem::align_of::<u32>()
4573        }
4574
4575        #[inline(always)]
4576        fn inline_size(_context: fidl::encoding::Context) -> usize {
4577            std::mem::size_of::<u32>()
4578        }
4579
4580        #[inline(always)]
4581        fn encode_is_copy() -> bool {
4582            true
4583        }
4584
4585        #[inline(always)]
4586        fn decode_is_copy() -> bool {
4587            false
4588        }
4589    }
4590
4591    impl fidl::encoding::ValueTypeMarker for AudioChannelId {
4592        type Borrowed<'a> = Self;
4593        #[inline(always)]
4594        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4595            *value
4596        }
4597    }
4598
4599    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for AudioChannelId {
4600        #[inline]
4601        unsafe fn encode(
4602            self,
4603            encoder: &mut fidl::encoding::Encoder<'_, D>,
4604            offset: usize,
4605            _depth: fidl::encoding::Depth,
4606        ) -> fidl::Result<()> {
4607            encoder.debug_check_bounds::<Self>(offset);
4608            encoder.write_num(self.into_primitive(), offset);
4609            Ok(())
4610        }
4611    }
4612
4613    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AudioChannelId {
4614        #[inline(always)]
4615        fn new_empty() -> Self {
4616            Self::Skip
4617        }
4618
4619        #[inline]
4620        unsafe fn decode(
4621            &mut self,
4622            decoder: &mut fidl::encoding::Decoder<'_, D>,
4623            offset: usize,
4624            _depth: fidl::encoding::Depth,
4625        ) -> fidl::Result<()> {
4626            decoder.debug_check_bounds::<Self>(offset);
4627            let prim = decoder.read_num::<u32>(offset);
4628
4629            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
4630            Ok(())
4631        }
4632    }
4633    unsafe impl fidl::encoding::TypeMarker for AudioOutputRoutingPolicy {
4634        type Owned = Self;
4635
4636        #[inline(always)]
4637        fn inline_align(_context: fidl::encoding::Context) -> usize {
4638            std::mem::align_of::<u32>()
4639        }
4640
4641        #[inline(always)]
4642        fn inline_size(_context: fidl::encoding::Context) -> usize {
4643            std::mem::size_of::<u32>()
4644        }
4645
4646        #[inline(always)]
4647        fn encode_is_copy() -> bool {
4648            true
4649        }
4650
4651        #[inline(always)]
4652        fn decode_is_copy() -> bool {
4653            false
4654        }
4655    }
4656
4657    impl fidl::encoding::ValueTypeMarker for AudioOutputRoutingPolicy {
4658        type Borrowed<'a> = Self;
4659        #[inline(always)]
4660        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4661            *value
4662        }
4663    }
4664
4665    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
4666        for AudioOutputRoutingPolicy
4667    {
4668        #[inline]
4669        unsafe fn encode(
4670            self,
4671            encoder: &mut fidl::encoding::Encoder<'_, D>,
4672            offset: usize,
4673            _depth: fidl::encoding::Depth,
4674        ) -> fidl::Result<()> {
4675            encoder.debug_check_bounds::<Self>(offset);
4676            encoder.write_num(self.into_primitive(), offset);
4677            Ok(())
4678        }
4679    }
4680
4681    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4682        for AudioOutputRoutingPolicy
4683    {
4684        #[inline(always)]
4685        fn new_empty() -> Self {
4686            Self::AllPluggedOutputs
4687        }
4688
4689        #[inline]
4690        unsafe fn decode(
4691            &mut self,
4692            decoder: &mut fidl::encoding::Decoder<'_, D>,
4693            offset: usize,
4694            _depth: fidl::encoding::Depth,
4695        ) -> fidl::Result<()> {
4696            decoder.debug_check_bounds::<Self>(offset);
4697            let prim = decoder.read_num::<u32>(offset);
4698
4699            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
4700            Ok(())
4701        }
4702    }
4703    unsafe impl fidl::encoding::TypeMarker for AudioPcmMode {
4704        type Owned = Self;
4705
4706        #[inline(always)]
4707        fn inline_align(_context: fidl::encoding::Context) -> usize {
4708            std::mem::align_of::<u32>()
4709        }
4710
4711        #[inline(always)]
4712        fn inline_size(_context: fidl::encoding::Context) -> usize {
4713            std::mem::size_of::<u32>()
4714        }
4715
4716        #[inline(always)]
4717        fn encode_is_copy() -> bool {
4718            true
4719        }
4720
4721        #[inline(always)]
4722        fn decode_is_copy() -> bool {
4723            false
4724        }
4725    }
4726
4727    impl fidl::encoding::ValueTypeMarker for AudioPcmMode {
4728        type Borrowed<'a> = Self;
4729        #[inline(always)]
4730        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4731            *value
4732        }
4733    }
4734
4735    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for AudioPcmMode {
4736        #[inline]
4737        unsafe fn encode(
4738            self,
4739            encoder: &mut fidl::encoding::Encoder<'_, D>,
4740            offset: usize,
4741            _depth: fidl::encoding::Depth,
4742        ) -> fidl::Result<()> {
4743            encoder.debug_check_bounds::<Self>(offset);
4744            encoder.write_num(self.into_primitive(), offset);
4745            Ok(())
4746        }
4747    }
4748
4749    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AudioPcmMode {
4750        #[inline(always)]
4751        fn new_empty() -> Self {
4752            Self::Linear
4753        }
4754
4755        #[inline]
4756        unsafe fn decode(
4757            &mut self,
4758            decoder: &mut fidl::encoding::Decoder<'_, D>,
4759            offset: usize,
4760            _depth: fidl::encoding::Depth,
4761        ) -> fidl::Result<()> {
4762            decoder.debug_check_bounds::<Self>(offset);
4763            let prim = decoder.read_num::<u32>(offset);
4764
4765            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
4766            Ok(())
4767        }
4768    }
4769    unsafe impl fidl::encoding::TypeMarker for AudioRenderUsage {
4770        type Owned = Self;
4771
4772        #[inline(always)]
4773        fn inline_align(_context: fidl::encoding::Context) -> usize {
4774            std::mem::align_of::<u32>()
4775        }
4776
4777        #[inline(always)]
4778        fn inline_size(_context: fidl::encoding::Context) -> usize {
4779            std::mem::size_of::<u32>()
4780        }
4781
4782        #[inline(always)]
4783        fn encode_is_copy() -> bool {
4784            true
4785        }
4786
4787        #[inline(always)]
4788        fn decode_is_copy() -> bool {
4789            false
4790        }
4791    }
4792
4793    impl fidl::encoding::ValueTypeMarker for AudioRenderUsage {
4794        type Borrowed<'a> = Self;
4795        #[inline(always)]
4796        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4797            *value
4798        }
4799    }
4800
4801    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
4802        for AudioRenderUsage
4803    {
4804        #[inline]
4805        unsafe fn encode(
4806            self,
4807            encoder: &mut fidl::encoding::Encoder<'_, D>,
4808            offset: usize,
4809            _depth: fidl::encoding::Depth,
4810        ) -> fidl::Result<()> {
4811            encoder.debug_check_bounds::<Self>(offset);
4812            encoder.write_num(self.into_primitive(), offset);
4813            Ok(())
4814        }
4815    }
4816
4817    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AudioRenderUsage {
4818        #[inline(always)]
4819        fn new_empty() -> Self {
4820            Self::Background
4821        }
4822
4823        #[inline]
4824        unsafe fn decode(
4825            &mut self,
4826            decoder: &mut fidl::encoding::Decoder<'_, D>,
4827            offset: usize,
4828            _depth: fidl::encoding::Depth,
4829        ) -> fidl::Result<()> {
4830            decoder.debug_check_bounds::<Self>(offset);
4831            let prim = decoder.read_num::<u32>(offset);
4832
4833            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
4834            Ok(())
4835        }
4836    }
4837    unsafe impl fidl::encoding::TypeMarker for AudioRenderUsage2 {
4838        type Owned = Self;
4839
4840        #[inline(always)]
4841        fn inline_align(_context: fidl::encoding::Context) -> usize {
4842            std::mem::align_of::<u32>()
4843        }
4844
4845        #[inline(always)]
4846        fn inline_size(_context: fidl::encoding::Context) -> usize {
4847            std::mem::size_of::<u32>()
4848        }
4849
4850        #[inline(always)]
4851        fn encode_is_copy() -> bool {
4852            false
4853        }
4854
4855        #[inline(always)]
4856        fn decode_is_copy() -> bool {
4857            false
4858        }
4859    }
4860
4861    impl fidl::encoding::ValueTypeMarker for AudioRenderUsage2 {
4862        type Borrowed<'a> = Self;
4863        #[inline(always)]
4864        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4865            *value
4866        }
4867    }
4868
4869    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
4870        for AudioRenderUsage2
4871    {
4872        #[inline]
4873        unsafe fn encode(
4874            self,
4875            encoder: &mut fidl::encoding::Encoder<'_, D>,
4876            offset: usize,
4877            _depth: fidl::encoding::Depth,
4878        ) -> fidl::Result<()> {
4879            encoder.debug_check_bounds::<Self>(offset);
4880            encoder.write_num(self.into_primitive(), offset);
4881            Ok(())
4882        }
4883    }
4884
4885    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AudioRenderUsage2 {
4886        #[inline(always)]
4887        fn new_empty() -> Self {
4888            Self::unknown()
4889        }
4890
4891        #[inline]
4892        unsafe fn decode(
4893            &mut self,
4894            decoder: &mut fidl::encoding::Decoder<'_, D>,
4895            offset: usize,
4896            _depth: fidl::encoding::Depth,
4897        ) -> fidl::Result<()> {
4898            decoder.debug_check_bounds::<Self>(offset);
4899            let prim = decoder.read_num::<u32>(offset);
4900
4901            *self = Self::from_primitive_allow_unknown(prim);
4902            Ok(())
4903        }
4904    }
4905    unsafe impl fidl::encoding::TypeMarker for AudioSampleFormat {
4906        type Owned = Self;
4907
4908        #[inline(always)]
4909        fn inline_align(_context: fidl::encoding::Context) -> usize {
4910            std::mem::align_of::<u32>()
4911        }
4912
4913        #[inline(always)]
4914        fn inline_size(_context: fidl::encoding::Context) -> usize {
4915            std::mem::size_of::<u32>()
4916        }
4917
4918        #[inline(always)]
4919        fn encode_is_copy() -> bool {
4920            true
4921        }
4922
4923        #[inline(always)]
4924        fn decode_is_copy() -> bool {
4925            false
4926        }
4927    }
4928
4929    impl fidl::encoding::ValueTypeMarker for AudioSampleFormat {
4930        type Borrowed<'a> = Self;
4931        #[inline(always)]
4932        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4933            *value
4934        }
4935    }
4936
4937    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
4938        for AudioSampleFormat
4939    {
4940        #[inline]
4941        unsafe fn encode(
4942            self,
4943            encoder: &mut fidl::encoding::Encoder<'_, D>,
4944            offset: usize,
4945            _depth: fidl::encoding::Depth,
4946        ) -> fidl::Result<()> {
4947            encoder.debug_check_bounds::<Self>(offset);
4948            encoder.write_num(self.into_primitive(), offset);
4949            Ok(())
4950        }
4951    }
4952
4953    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AudioSampleFormat {
4954        #[inline(always)]
4955        fn new_empty() -> Self {
4956            Self::Unsigned8
4957        }
4958
4959        #[inline]
4960        unsafe fn decode(
4961            &mut self,
4962            decoder: &mut fidl::encoding::Decoder<'_, D>,
4963            offset: usize,
4964            _depth: fidl::encoding::Depth,
4965        ) -> fidl::Result<()> {
4966            decoder.debug_check_bounds::<Self>(offset);
4967            let prim = decoder.read_num::<u32>(offset);
4968
4969            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
4970            Ok(())
4971        }
4972    }
4973    unsafe impl fidl::encoding::TypeMarker for Behavior {
4974        type Owned = Self;
4975
4976        #[inline(always)]
4977        fn inline_align(_context: fidl::encoding::Context) -> usize {
4978            std::mem::align_of::<u32>()
4979        }
4980
4981        #[inline(always)]
4982        fn inline_size(_context: fidl::encoding::Context) -> usize {
4983            std::mem::size_of::<u32>()
4984        }
4985
4986        #[inline(always)]
4987        fn encode_is_copy() -> bool {
4988            false
4989        }
4990
4991        #[inline(always)]
4992        fn decode_is_copy() -> bool {
4993            false
4994        }
4995    }
4996
4997    impl fidl::encoding::ValueTypeMarker for Behavior {
4998        type Borrowed<'a> = Self;
4999        #[inline(always)]
5000        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5001            *value
5002        }
5003    }
5004
5005    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Behavior {
5006        #[inline]
5007        unsafe fn encode(
5008            self,
5009            encoder: &mut fidl::encoding::Encoder<'_, D>,
5010            offset: usize,
5011            _depth: fidl::encoding::Depth,
5012        ) -> fidl::Result<()> {
5013            encoder.debug_check_bounds::<Self>(offset);
5014            encoder.write_num(self.into_primitive(), offset);
5015            Ok(())
5016        }
5017    }
5018
5019    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Behavior {
5020        #[inline(always)]
5021        fn new_empty() -> Self {
5022            Self::unknown()
5023        }
5024
5025        #[inline]
5026        unsafe fn decode(
5027            &mut self,
5028            decoder: &mut fidl::encoding::Decoder<'_, D>,
5029            offset: usize,
5030            _depth: fidl::encoding::Depth,
5031        ) -> fidl::Result<()> {
5032            decoder.debug_check_bounds::<Self>(offset);
5033            let prim = decoder.read_num::<u32>(offset);
5034
5035            *self = Self::from_primitive_allow_unknown(prim);
5036            Ok(())
5037        }
5038    }
5039    unsafe impl fidl::encoding::TypeMarker for CodecProfile {
5040        type Owned = Self;
5041
5042        #[inline(always)]
5043        fn inline_align(_context: fidl::encoding::Context) -> usize {
5044            std::mem::align_of::<u32>()
5045        }
5046
5047        #[inline(always)]
5048        fn inline_size(_context: fidl::encoding::Context) -> usize {
5049            std::mem::size_of::<u32>()
5050        }
5051
5052        #[inline(always)]
5053        fn encode_is_copy() -> bool {
5054            false
5055        }
5056
5057        #[inline(always)]
5058        fn decode_is_copy() -> bool {
5059            false
5060        }
5061    }
5062
5063    impl fidl::encoding::ValueTypeMarker for CodecProfile {
5064        type Borrowed<'a> = Self;
5065        #[inline(always)]
5066        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5067            *value
5068        }
5069    }
5070
5071    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for CodecProfile {
5072        #[inline]
5073        unsafe fn encode(
5074            self,
5075            encoder: &mut fidl::encoding::Encoder<'_, D>,
5076            offset: usize,
5077            _depth: fidl::encoding::Depth,
5078        ) -> fidl::Result<()> {
5079            encoder.debug_check_bounds::<Self>(offset);
5080            encoder.write_num(self.into_primitive(), offset);
5081            Ok(())
5082        }
5083    }
5084
5085    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CodecProfile {
5086        #[inline(always)]
5087        fn new_empty() -> Self {
5088            Self::unknown()
5089        }
5090
5091        #[inline]
5092        unsafe fn decode(
5093            &mut self,
5094            decoder: &mut fidl::encoding::Decoder<'_, D>,
5095            offset: usize,
5096            _depth: fidl::encoding::Depth,
5097        ) -> fidl::Result<()> {
5098            decoder.debug_check_bounds::<Self>(offset);
5099            let prim = decoder.read_num::<u32>(offset);
5100
5101            *self = Self::from_primitive_allow_unknown(prim);
5102            Ok(())
5103        }
5104    }
5105    unsafe impl fidl::encoding::TypeMarker for ColorSpace {
5106        type Owned = Self;
5107
5108        #[inline(always)]
5109        fn inline_align(_context: fidl::encoding::Context) -> usize {
5110            std::mem::align_of::<u32>()
5111        }
5112
5113        #[inline(always)]
5114        fn inline_size(_context: fidl::encoding::Context) -> usize {
5115            std::mem::size_of::<u32>()
5116        }
5117
5118        #[inline(always)]
5119        fn encode_is_copy() -> bool {
5120            true
5121        }
5122
5123        #[inline(always)]
5124        fn decode_is_copy() -> bool {
5125            false
5126        }
5127    }
5128
5129    impl fidl::encoding::ValueTypeMarker for ColorSpace {
5130        type Borrowed<'a> = Self;
5131        #[inline(always)]
5132        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5133            *value
5134        }
5135    }
5136
5137    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ColorSpace {
5138        #[inline]
5139        unsafe fn encode(
5140            self,
5141            encoder: &mut fidl::encoding::Encoder<'_, D>,
5142            offset: usize,
5143            _depth: fidl::encoding::Depth,
5144        ) -> fidl::Result<()> {
5145            encoder.debug_check_bounds::<Self>(offset);
5146            encoder.write_num(self.into_primitive(), offset);
5147            Ok(())
5148        }
5149    }
5150
5151    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ColorSpace {
5152        #[inline(always)]
5153        fn new_empty() -> Self {
5154            Self::Unknown
5155        }
5156
5157        #[inline]
5158        unsafe fn decode(
5159            &mut self,
5160            decoder: &mut fidl::encoding::Decoder<'_, D>,
5161            offset: usize,
5162            _depth: fidl::encoding::Depth,
5163        ) -> fidl::Result<()> {
5164            decoder.debug_check_bounds::<Self>(offset);
5165            let prim = decoder.read_num::<u32>(offset);
5166
5167            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
5168            Ok(())
5169        }
5170    }
5171    unsafe impl fidl::encoding::TypeMarker for Lc3FrameDuration {
5172        type Owned = Self;
5173
5174        #[inline(always)]
5175        fn inline_align(_context: fidl::encoding::Context) -> usize {
5176            std::mem::align_of::<u32>()
5177        }
5178
5179        #[inline(always)]
5180        fn inline_size(_context: fidl::encoding::Context) -> usize {
5181            std::mem::size_of::<u32>()
5182        }
5183
5184        #[inline(always)]
5185        fn encode_is_copy() -> bool {
5186            false
5187        }
5188
5189        #[inline(always)]
5190        fn decode_is_copy() -> bool {
5191            false
5192        }
5193    }
5194
5195    impl fidl::encoding::ValueTypeMarker for Lc3FrameDuration {
5196        type Borrowed<'a> = Self;
5197        #[inline(always)]
5198        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5199            *value
5200        }
5201    }
5202
5203    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
5204        for Lc3FrameDuration
5205    {
5206        #[inline]
5207        unsafe fn encode(
5208            self,
5209            encoder: &mut fidl::encoding::Encoder<'_, D>,
5210            offset: usize,
5211            _depth: fidl::encoding::Depth,
5212        ) -> fidl::Result<()> {
5213            encoder.debug_check_bounds::<Self>(offset);
5214            encoder.write_num(self.into_primitive(), offset);
5215            Ok(())
5216        }
5217    }
5218
5219    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Lc3FrameDuration {
5220        #[inline(always)]
5221        fn new_empty() -> Self {
5222            Self::unknown()
5223        }
5224
5225        #[inline]
5226        unsafe fn decode(
5227            &mut self,
5228            decoder: &mut fidl::encoding::Decoder<'_, D>,
5229            offset: usize,
5230            _depth: fidl::encoding::Depth,
5231        ) -> fidl::Result<()> {
5232            decoder.debug_check_bounds::<Self>(offset);
5233            let prim = decoder.read_num::<u32>(offset);
5234
5235            *self = Self::from_primitive_allow_unknown(prim);
5236            Ok(())
5237        }
5238    }
5239    unsafe impl fidl::encoding::TypeMarker for Port {
5240        type Owned = Self;
5241
5242        #[inline(always)]
5243        fn inline_align(_context: fidl::encoding::Context) -> usize {
5244            std::mem::align_of::<u32>()
5245        }
5246
5247        #[inline(always)]
5248        fn inline_size(_context: fidl::encoding::Context) -> usize {
5249            std::mem::size_of::<u32>()
5250        }
5251
5252        #[inline(always)]
5253        fn encode_is_copy() -> bool {
5254            false
5255        }
5256
5257        #[inline(always)]
5258        fn decode_is_copy() -> bool {
5259            false
5260        }
5261    }
5262
5263    impl fidl::encoding::ValueTypeMarker for Port {
5264        type Borrowed<'a> = Self;
5265        #[inline(always)]
5266        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5267            *value
5268        }
5269    }
5270
5271    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Port {
5272        #[inline]
5273        unsafe fn encode(
5274            self,
5275            encoder: &mut fidl::encoding::Encoder<'_, D>,
5276            offset: usize,
5277            _depth: fidl::encoding::Depth,
5278        ) -> fidl::Result<()> {
5279            encoder.debug_check_bounds::<Self>(offset);
5280            encoder.write_num(self.into_primitive(), offset);
5281            Ok(())
5282        }
5283    }
5284
5285    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Port {
5286        #[inline(always)]
5287        fn new_empty() -> Self {
5288            Self::unknown()
5289        }
5290
5291        #[inline]
5292        unsafe fn decode(
5293            &mut self,
5294            decoder: &mut fidl::encoding::Decoder<'_, D>,
5295            offset: usize,
5296            _depth: fidl::encoding::Depth,
5297        ) -> fidl::Result<()> {
5298            decoder.debug_check_bounds::<Self>(offset);
5299            let prim = decoder.read_num::<u32>(offset);
5300
5301            *self = Self::from_primitive_allow_unknown(prim);
5302            Ok(())
5303        }
5304    }
5305    unsafe impl fidl::encoding::TypeMarker for SbcAllocation {
5306        type Owned = Self;
5307
5308        #[inline(always)]
5309        fn inline_align(_context: fidl::encoding::Context) -> usize {
5310            std::mem::align_of::<u32>()
5311        }
5312
5313        #[inline(always)]
5314        fn inline_size(_context: fidl::encoding::Context) -> usize {
5315            std::mem::size_of::<u32>()
5316        }
5317
5318        #[inline(always)]
5319        fn encode_is_copy() -> bool {
5320            true
5321        }
5322
5323        #[inline(always)]
5324        fn decode_is_copy() -> bool {
5325            false
5326        }
5327    }
5328
5329    impl fidl::encoding::ValueTypeMarker for SbcAllocation {
5330        type Borrowed<'a> = Self;
5331        #[inline(always)]
5332        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5333            *value
5334        }
5335    }
5336
5337    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for SbcAllocation {
5338        #[inline]
5339        unsafe fn encode(
5340            self,
5341            encoder: &mut fidl::encoding::Encoder<'_, D>,
5342            offset: usize,
5343            _depth: fidl::encoding::Depth,
5344        ) -> fidl::Result<()> {
5345            encoder.debug_check_bounds::<Self>(offset);
5346            encoder.write_num(self.into_primitive(), offset);
5347            Ok(())
5348        }
5349    }
5350
5351    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SbcAllocation {
5352        #[inline(always)]
5353        fn new_empty() -> Self {
5354            Self::AllocLoudness
5355        }
5356
5357        #[inline]
5358        unsafe fn decode(
5359            &mut self,
5360            decoder: &mut fidl::encoding::Decoder<'_, D>,
5361            offset: usize,
5362            _depth: fidl::encoding::Depth,
5363        ) -> fidl::Result<()> {
5364            decoder.debug_check_bounds::<Self>(offset);
5365            let prim = decoder.read_num::<u32>(offset);
5366
5367            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
5368            Ok(())
5369        }
5370    }
5371    unsafe impl fidl::encoding::TypeMarker for SbcBlockCount {
5372        type Owned = Self;
5373
5374        #[inline(always)]
5375        fn inline_align(_context: fidl::encoding::Context) -> usize {
5376            std::mem::align_of::<u32>()
5377        }
5378
5379        #[inline(always)]
5380        fn inline_size(_context: fidl::encoding::Context) -> usize {
5381            std::mem::size_of::<u32>()
5382        }
5383
5384        #[inline(always)]
5385        fn encode_is_copy() -> bool {
5386            true
5387        }
5388
5389        #[inline(always)]
5390        fn decode_is_copy() -> bool {
5391            false
5392        }
5393    }
5394
5395    impl fidl::encoding::ValueTypeMarker for SbcBlockCount {
5396        type Borrowed<'a> = Self;
5397        #[inline(always)]
5398        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5399            *value
5400        }
5401    }
5402
5403    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for SbcBlockCount {
5404        #[inline]
5405        unsafe fn encode(
5406            self,
5407            encoder: &mut fidl::encoding::Encoder<'_, D>,
5408            offset: usize,
5409            _depth: fidl::encoding::Depth,
5410        ) -> fidl::Result<()> {
5411            encoder.debug_check_bounds::<Self>(offset);
5412            encoder.write_num(self.into_primitive(), offset);
5413            Ok(())
5414        }
5415    }
5416
5417    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SbcBlockCount {
5418        #[inline(always)]
5419        fn new_empty() -> Self {
5420            Self::BlockCount4
5421        }
5422
5423        #[inline]
5424        unsafe fn decode(
5425            &mut self,
5426            decoder: &mut fidl::encoding::Decoder<'_, D>,
5427            offset: usize,
5428            _depth: fidl::encoding::Depth,
5429        ) -> fidl::Result<()> {
5430            decoder.debug_check_bounds::<Self>(offset);
5431            let prim = decoder.read_num::<u32>(offset);
5432
5433            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
5434            Ok(())
5435        }
5436    }
5437    unsafe impl fidl::encoding::TypeMarker for SbcChannelMode {
5438        type Owned = Self;
5439
5440        #[inline(always)]
5441        fn inline_align(_context: fidl::encoding::Context) -> usize {
5442            std::mem::align_of::<u32>()
5443        }
5444
5445        #[inline(always)]
5446        fn inline_size(_context: fidl::encoding::Context) -> usize {
5447            std::mem::size_of::<u32>()
5448        }
5449
5450        #[inline(always)]
5451        fn encode_is_copy() -> bool {
5452            true
5453        }
5454
5455        #[inline(always)]
5456        fn decode_is_copy() -> bool {
5457            false
5458        }
5459    }
5460
5461    impl fidl::encoding::ValueTypeMarker for SbcChannelMode {
5462        type Borrowed<'a> = Self;
5463        #[inline(always)]
5464        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5465            *value
5466        }
5467    }
5468
5469    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for SbcChannelMode {
5470        #[inline]
5471        unsafe fn encode(
5472            self,
5473            encoder: &mut fidl::encoding::Encoder<'_, D>,
5474            offset: usize,
5475            _depth: fidl::encoding::Depth,
5476        ) -> fidl::Result<()> {
5477            encoder.debug_check_bounds::<Self>(offset);
5478            encoder.write_num(self.into_primitive(), offset);
5479            Ok(())
5480        }
5481    }
5482
5483    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SbcChannelMode {
5484        #[inline(always)]
5485        fn new_empty() -> Self {
5486            Self::Mono
5487        }
5488
5489        #[inline]
5490        unsafe fn decode(
5491            &mut self,
5492            decoder: &mut fidl::encoding::Decoder<'_, D>,
5493            offset: usize,
5494            _depth: fidl::encoding::Depth,
5495        ) -> fidl::Result<()> {
5496            decoder.debug_check_bounds::<Self>(offset);
5497            let prim = decoder.read_num::<u32>(offset);
5498
5499            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
5500            Ok(())
5501        }
5502    }
5503    unsafe impl fidl::encoding::TypeMarker for SbcSubBands {
5504        type Owned = Self;
5505
5506        #[inline(always)]
5507        fn inline_align(_context: fidl::encoding::Context) -> usize {
5508            std::mem::align_of::<u32>()
5509        }
5510
5511        #[inline(always)]
5512        fn inline_size(_context: fidl::encoding::Context) -> usize {
5513            std::mem::size_of::<u32>()
5514        }
5515
5516        #[inline(always)]
5517        fn encode_is_copy() -> bool {
5518            true
5519        }
5520
5521        #[inline(always)]
5522        fn decode_is_copy() -> bool {
5523            false
5524        }
5525    }
5526
5527    impl fidl::encoding::ValueTypeMarker for SbcSubBands {
5528        type Borrowed<'a> = Self;
5529        #[inline(always)]
5530        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5531            *value
5532        }
5533    }
5534
5535    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for SbcSubBands {
5536        #[inline]
5537        unsafe fn encode(
5538            self,
5539            encoder: &mut fidl::encoding::Encoder<'_, D>,
5540            offset: usize,
5541            _depth: fidl::encoding::Depth,
5542        ) -> fidl::Result<()> {
5543            encoder.debug_check_bounds::<Self>(offset);
5544            encoder.write_num(self.into_primitive(), offset);
5545            Ok(())
5546        }
5547    }
5548
5549    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SbcSubBands {
5550        #[inline(always)]
5551        fn new_empty() -> Self {
5552            Self::SubBands4
5553        }
5554
5555        #[inline]
5556        unsafe fn decode(
5557            &mut self,
5558            decoder: &mut fidl::encoding::Decoder<'_, D>,
5559            offset: usize,
5560            _depth: fidl::encoding::Depth,
5561        ) -> fidl::Result<()> {
5562            decoder.debug_check_bounds::<Self>(offset);
5563            let prim = decoder.read_num::<u32>(offset);
5564
5565            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
5566            Ok(())
5567        }
5568    }
5569    unsafe impl fidl::encoding::TypeMarker for StreamError {
5570        type Owned = Self;
5571
5572        #[inline(always)]
5573        fn inline_align(_context: fidl::encoding::Context) -> usize {
5574            std::mem::align_of::<u32>()
5575        }
5576
5577        #[inline(always)]
5578        fn inline_size(_context: fidl::encoding::Context) -> usize {
5579            std::mem::size_of::<u32>()
5580        }
5581
5582        #[inline(always)]
5583        fn encode_is_copy() -> bool {
5584            true
5585        }
5586
5587        #[inline(always)]
5588        fn decode_is_copy() -> bool {
5589            false
5590        }
5591    }
5592
5593    impl fidl::encoding::ValueTypeMarker for StreamError {
5594        type Borrowed<'a> = Self;
5595        #[inline(always)]
5596        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5597            *value
5598        }
5599    }
5600
5601    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for StreamError {
5602        #[inline]
5603        unsafe fn encode(
5604            self,
5605            encoder: &mut fidl::encoding::Encoder<'_, D>,
5606            offset: usize,
5607            _depth: fidl::encoding::Depth,
5608        ) -> fidl::Result<()> {
5609            encoder.debug_check_bounds::<Self>(offset);
5610            encoder.write_num(self.into_primitive(), offset);
5611            Ok(())
5612        }
5613    }
5614
5615    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StreamError {
5616        #[inline(always)]
5617        fn new_empty() -> Self {
5618            Self::Unknown
5619        }
5620
5621        #[inline]
5622        unsafe fn decode(
5623            &mut self,
5624            decoder: &mut fidl::encoding::Decoder<'_, D>,
5625            offset: usize,
5626            _depth: fidl::encoding::Depth,
5627        ) -> fidl::Result<()> {
5628            decoder.debug_check_bounds::<Self>(offset);
5629            let prim = decoder.read_num::<u32>(offset);
5630
5631            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
5632            Ok(())
5633        }
5634    }
5635    unsafe impl fidl::encoding::TypeMarker for VideoColorSpace {
5636        type Owned = Self;
5637
5638        #[inline(always)]
5639        fn inline_align(_context: fidl::encoding::Context) -> usize {
5640            std::mem::align_of::<u32>()
5641        }
5642
5643        #[inline(always)]
5644        fn inline_size(_context: fidl::encoding::Context) -> usize {
5645            std::mem::size_of::<u32>()
5646        }
5647
5648        #[inline(always)]
5649        fn encode_is_copy() -> bool {
5650            true
5651        }
5652
5653        #[inline(always)]
5654        fn decode_is_copy() -> bool {
5655            false
5656        }
5657    }
5658
5659    impl fidl::encoding::ValueTypeMarker for VideoColorSpace {
5660        type Borrowed<'a> = Self;
5661        #[inline(always)]
5662        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5663            *value
5664        }
5665    }
5666
5667    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
5668        for VideoColorSpace
5669    {
5670        #[inline]
5671        unsafe fn encode(
5672            self,
5673            encoder: &mut fidl::encoding::Encoder<'_, D>,
5674            offset: usize,
5675            _depth: fidl::encoding::Depth,
5676        ) -> fidl::Result<()> {
5677            encoder.debug_check_bounds::<Self>(offset);
5678            encoder.write_num(self.into_primitive(), offset);
5679            Ok(())
5680        }
5681    }
5682
5683    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VideoColorSpace {
5684        #[inline(always)]
5685        fn new_empty() -> Self {
5686            Self::Invalid
5687        }
5688
5689        #[inline]
5690        unsafe fn decode(
5691            &mut self,
5692            decoder: &mut fidl::encoding::Decoder<'_, D>,
5693            offset: usize,
5694            _depth: fidl::encoding::Depth,
5695        ) -> fidl::Result<()> {
5696            decoder.debug_check_bounds::<Self>(offset);
5697            let prim = decoder.read_num::<u32>(offset);
5698
5699            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
5700            Ok(())
5701        }
5702    }
5703
5704    impl fidl::encoding::ValueTypeMarker for AacConstantBitRate {
5705        type Borrowed<'a> = &'a Self;
5706        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5707            value
5708        }
5709    }
5710
5711    unsafe impl fidl::encoding::TypeMarker for AacConstantBitRate {
5712        type Owned = Self;
5713
5714        #[inline(always)]
5715        fn inline_align(_context: fidl::encoding::Context) -> usize {
5716            4
5717        }
5718
5719        #[inline(always)]
5720        fn inline_size(_context: fidl::encoding::Context) -> usize {
5721            4
5722        }
5723        #[inline(always)]
5724        fn encode_is_copy() -> bool {
5725            true
5726        }
5727
5728        #[inline(always)]
5729        fn decode_is_copy() -> bool {
5730            true
5731        }
5732    }
5733
5734    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AacConstantBitRate, D>
5735        for &AacConstantBitRate
5736    {
5737        #[inline]
5738        unsafe fn encode(
5739            self,
5740            encoder: &mut fidl::encoding::Encoder<'_, D>,
5741            offset: usize,
5742            _depth: fidl::encoding::Depth,
5743        ) -> fidl::Result<()> {
5744            encoder.debug_check_bounds::<AacConstantBitRate>(offset);
5745            unsafe {
5746                // Copy the object into the buffer.
5747                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
5748                (buf_ptr as *mut AacConstantBitRate)
5749                    .write_unaligned((self as *const AacConstantBitRate).read());
5750                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
5751                // done second because the memcpy will write garbage to these bytes.
5752            }
5753            Ok(())
5754        }
5755    }
5756    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
5757        fidl::encoding::Encode<AacConstantBitRate, D> for (T0,)
5758    {
5759        #[inline]
5760        unsafe fn encode(
5761            self,
5762            encoder: &mut fidl::encoding::Encoder<'_, D>,
5763            offset: usize,
5764            depth: fidl::encoding::Depth,
5765        ) -> fidl::Result<()> {
5766            encoder.debug_check_bounds::<AacConstantBitRate>(offset);
5767            // Zero out padding regions. There's no need to apply masks
5768            // because the unmasked parts will be overwritten by fields.
5769            // Write the fields.
5770            self.0.encode(encoder, offset + 0, depth)?;
5771            Ok(())
5772        }
5773    }
5774
5775    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AacConstantBitRate {
5776        #[inline(always)]
5777        fn new_empty() -> Self {
5778            Self { bit_rate: fidl::new_empty!(u32, D) }
5779        }
5780
5781        #[inline]
5782        unsafe fn decode(
5783            &mut self,
5784            decoder: &mut fidl::encoding::Decoder<'_, D>,
5785            offset: usize,
5786            _depth: fidl::encoding::Depth,
5787        ) -> fidl::Result<()> {
5788            decoder.debug_check_bounds::<Self>(offset);
5789            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
5790            // Verify that padding bytes are zero.
5791            // Copy from the buffer into the object.
5792            unsafe {
5793                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
5794            }
5795            Ok(())
5796        }
5797    }
5798
5799    impl fidl::encoding::ValueTypeMarker for AacEncoderSettings {
5800        type Borrowed<'a> = &'a Self;
5801        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5802            value
5803        }
5804    }
5805
5806    unsafe impl fidl::encoding::TypeMarker for AacEncoderSettings {
5807        type Owned = Self;
5808
5809        #[inline(always)]
5810        fn inline_align(_context: fidl::encoding::Context) -> usize {
5811            8
5812        }
5813
5814        #[inline(always)]
5815        fn inline_size(_context: fidl::encoding::Context) -> usize {
5816            48
5817        }
5818    }
5819
5820    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AacEncoderSettings, D>
5821        for &AacEncoderSettings
5822    {
5823        #[inline]
5824        unsafe fn encode(
5825            self,
5826            encoder: &mut fidl::encoding::Encoder<'_, D>,
5827            offset: usize,
5828            _depth: fidl::encoding::Depth,
5829        ) -> fidl::Result<()> {
5830            encoder.debug_check_bounds::<AacEncoderSettings>(offset);
5831            // Delegate to tuple encoding.
5832            fidl::encoding::Encode::<AacEncoderSettings, D>::encode(
5833                (
5834                    <AacTransport as fidl::encoding::ValueTypeMarker>::borrow(&self.transport),
5835                    <AacChannelMode as fidl::encoding::ValueTypeMarker>::borrow(&self.channel_mode),
5836                    <AacBitRate as fidl::encoding::ValueTypeMarker>::borrow(&self.bit_rate),
5837                    <AacAudioObjectType as fidl::encoding::ValueTypeMarker>::borrow(&self.aot),
5838                ),
5839                encoder,
5840                offset,
5841                _depth,
5842            )
5843        }
5844    }
5845    unsafe impl<
5846        D: fidl::encoding::ResourceDialect,
5847        T0: fidl::encoding::Encode<AacTransport, D>,
5848        T1: fidl::encoding::Encode<AacChannelMode, D>,
5849        T2: fidl::encoding::Encode<AacBitRate, D>,
5850        T3: fidl::encoding::Encode<AacAudioObjectType, D>,
5851    > fidl::encoding::Encode<AacEncoderSettings, D> for (T0, T1, T2, T3)
5852    {
5853        #[inline]
5854        unsafe fn encode(
5855            self,
5856            encoder: &mut fidl::encoding::Encoder<'_, D>,
5857            offset: usize,
5858            depth: fidl::encoding::Depth,
5859        ) -> fidl::Result<()> {
5860            encoder.debug_check_bounds::<AacEncoderSettings>(offset);
5861            // Zero out padding regions. There's no need to apply masks
5862            // because the unmasked parts will be overwritten by fields.
5863            unsafe {
5864                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
5865                (ptr as *mut u64).write_unaligned(0);
5866            }
5867            unsafe {
5868                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
5869                (ptr as *mut u64).write_unaligned(0);
5870            }
5871            // Write the fields.
5872            self.0.encode(encoder, offset + 0, depth)?;
5873            self.1.encode(encoder, offset + 16, depth)?;
5874            self.2.encode(encoder, offset + 24, depth)?;
5875            self.3.encode(encoder, offset + 40, depth)?;
5876            Ok(())
5877        }
5878    }
5879
5880    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AacEncoderSettings {
5881        #[inline(always)]
5882        fn new_empty() -> Self {
5883            Self {
5884                transport: fidl::new_empty!(AacTransport, D),
5885                channel_mode: fidl::new_empty!(AacChannelMode, D),
5886                bit_rate: fidl::new_empty!(AacBitRate, D),
5887                aot: fidl::new_empty!(AacAudioObjectType, D),
5888            }
5889        }
5890
5891        #[inline]
5892        unsafe fn decode(
5893            &mut self,
5894            decoder: &mut fidl::encoding::Decoder<'_, D>,
5895            offset: usize,
5896            _depth: fidl::encoding::Depth,
5897        ) -> fidl::Result<()> {
5898            decoder.debug_check_bounds::<Self>(offset);
5899            // Verify that padding bytes are zero.
5900            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
5901            let padval = unsafe { (ptr as *const u64).read_unaligned() };
5902            let mask = 0xffffffff00000000u64;
5903            let maskedval = padval & mask;
5904            if maskedval != 0 {
5905                return Err(fidl::Error::NonZeroPadding {
5906                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
5907                });
5908            }
5909            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
5910            let padval = unsafe { (ptr as *const u64).read_unaligned() };
5911            let mask = 0xffffffff00000000u64;
5912            let maskedval = padval & mask;
5913            if maskedval != 0 {
5914                return Err(fidl::Error::NonZeroPadding {
5915                    padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
5916                });
5917            }
5918            fidl::decode!(AacTransport, D, &mut self.transport, decoder, offset + 0, _depth)?;
5919            fidl::decode!(AacChannelMode, D, &mut self.channel_mode, decoder, offset + 16, _depth)?;
5920            fidl::decode!(AacBitRate, D, &mut self.bit_rate, decoder, offset + 24, _depth)?;
5921            fidl::decode!(AacAudioObjectType, D, &mut self.aot, decoder, offset + 40, _depth)?;
5922            Ok(())
5923        }
5924    }
5925
5926    impl fidl::encoding::ValueTypeMarker for AacTransportAdts {
5927        type Borrowed<'a> = &'a Self;
5928        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5929            value
5930        }
5931    }
5932
5933    unsafe impl fidl::encoding::TypeMarker for AacTransportAdts {
5934        type Owned = Self;
5935
5936        #[inline(always)]
5937        fn inline_align(_context: fidl::encoding::Context) -> usize {
5938            1
5939        }
5940
5941        #[inline(always)]
5942        fn inline_size(_context: fidl::encoding::Context) -> usize {
5943            1
5944        }
5945    }
5946
5947    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AacTransportAdts, D>
5948        for &AacTransportAdts
5949    {
5950        #[inline]
5951        unsafe fn encode(
5952            self,
5953            encoder: &mut fidl::encoding::Encoder<'_, D>,
5954            offset: usize,
5955            _depth: fidl::encoding::Depth,
5956        ) -> fidl::Result<()> {
5957            encoder.debug_check_bounds::<AacTransportAdts>(offset);
5958            encoder.write_num(0u8, offset);
5959            Ok(())
5960        }
5961    }
5962
5963    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AacTransportAdts {
5964        #[inline(always)]
5965        fn new_empty() -> Self {
5966            Self
5967        }
5968
5969        #[inline]
5970        unsafe fn decode(
5971            &mut self,
5972            decoder: &mut fidl::encoding::Decoder<'_, D>,
5973            offset: usize,
5974            _depth: fidl::encoding::Depth,
5975        ) -> fidl::Result<()> {
5976            decoder.debug_check_bounds::<Self>(offset);
5977            match decoder.read_num::<u8>(offset) {
5978                0 => Ok(()),
5979                _ => Err(fidl::Error::Invalid),
5980            }
5981        }
5982    }
5983
5984    impl fidl::encoding::ValueTypeMarker for AacTransportLatm {
5985        type Borrowed<'a> = &'a Self;
5986        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5987            value
5988        }
5989    }
5990
5991    unsafe impl fidl::encoding::TypeMarker for AacTransportLatm {
5992        type Owned = Self;
5993
5994        #[inline(always)]
5995        fn inline_align(_context: fidl::encoding::Context) -> usize {
5996            1
5997        }
5998
5999        #[inline(always)]
6000        fn inline_size(_context: fidl::encoding::Context) -> usize {
6001            1
6002        }
6003    }
6004
6005    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AacTransportLatm, D>
6006        for &AacTransportLatm
6007    {
6008        #[inline]
6009        unsafe fn encode(
6010            self,
6011            encoder: &mut fidl::encoding::Encoder<'_, D>,
6012            offset: usize,
6013            _depth: fidl::encoding::Depth,
6014        ) -> fidl::Result<()> {
6015            encoder.debug_check_bounds::<AacTransportLatm>(offset);
6016            // Delegate to tuple encoding.
6017            fidl::encoding::Encode::<AacTransportLatm, D>::encode(
6018                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.mux_config_present),),
6019                encoder,
6020                offset,
6021                _depth,
6022            )
6023        }
6024    }
6025    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
6026        fidl::encoding::Encode<AacTransportLatm, D> for (T0,)
6027    {
6028        #[inline]
6029        unsafe fn encode(
6030            self,
6031            encoder: &mut fidl::encoding::Encoder<'_, D>,
6032            offset: usize,
6033            depth: fidl::encoding::Depth,
6034        ) -> fidl::Result<()> {
6035            encoder.debug_check_bounds::<AacTransportLatm>(offset);
6036            // Zero out padding regions. There's no need to apply masks
6037            // because the unmasked parts will be overwritten by fields.
6038            // Write the fields.
6039            self.0.encode(encoder, offset + 0, depth)?;
6040            Ok(())
6041        }
6042    }
6043
6044    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AacTransportLatm {
6045        #[inline(always)]
6046        fn new_empty() -> Self {
6047            Self { mux_config_present: fidl::new_empty!(bool, D) }
6048        }
6049
6050        #[inline]
6051        unsafe fn decode(
6052            &mut self,
6053            decoder: &mut fidl::encoding::Decoder<'_, D>,
6054            offset: usize,
6055            _depth: fidl::encoding::Depth,
6056        ) -> fidl::Result<()> {
6057            decoder.debug_check_bounds::<Self>(offset);
6058            // Verify that padding bytes are zero.
6059            fidl::decode!(bool, D, &mut self.mux_config_present, decoder, offset + 0, _depth)?;
6060            Ok(())
6061        }
6062    }
6063
6064    impl fidl::encoding::ValueTypeMarker for AacTransportRaw {
6065        type Borrowed<'a> = &'a Self;
6066        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6067            value
6068        }
6069    }
6070
6071    unsafe impl fidl::encoding::TypeMarker for AacTransportRaw {
6072        type Owned = Self;
6073
6074        #[inline(always)]
6075        fn inline_align(_context: fidl::encoding::Context) -> usize {
6076            1
6077        }
6078
6079        #[inline(always)]
6080        fn inline_size(_context: fidl::encoding::Context) -> usize {
6081            1
6082        }
6083    }
6084
6085    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AacTransportRaw, D>
6086        for &AacTransportRaw
6087    {
6088        #[inline]
6089        unsafe fn encode(
6090            self,
6091            encoder: &mut fidl::encoding::Encoder<'_, D>,
6092            offset: usize,
6093            _depth: fidl::encoding::Depth,
6094        ) -> fidl::Result<()> {
6095            encoder.debug_check_bounds::<AacTransportRaw>(offset);
6096            encoder.write_num(0u8, offset);
6097            Ok(())
6098        }
6099    }
6100
6101    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AacTransportRaw {
6102        #[inline(always)]
6103        fn new_empty() -> Self {
6104            Self
6105        }
6106
6107        #[inline]
6108        unsafe fn decode(
6109            &mut self,
6110            decoder: &mut fidl::encoding::Decoder<'_, D>,
6111            offset: usize,
6112            _depth: fidl::encoding::Depth,
6113        ) -> fidl::Result<()> {
6114            decoder.debug_check_bounds::<Self>(offset);
6115            match decoder.read_num::<u8>(offset) {
6116                0 => Ok(()),
6117                _ => Err(fidl::Error::Invalid),
6118            }
6119        }
6120    }
6121
6122    impl fidl::encoding::ValueTypeMarker for ActivityReporterWatchCaptureActivityResponse {
6123        type Borrowed<'a> = &'a Self;
6124        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6125            value
6126        }
6127    }
6128
6129    unsafe impl fidl::encoding::TypeMarker for ActivityReporterWatchCaptureActivityResponse {
6130        type Owned = Self;
6131
6132        #[inline(always)]
6133        fn inline_align(_context: fidl::encoding::Context) -> usize {
6134            8
6135        }
6136
6137        #[inline(always)]
6138        fn inline_size(_context: fidl::encoding::Context) -> usize {
6139            16
6140        }
6141    }
6142
6143    unsafe impl<D: fidl::encoding::ResourceDialect>
6144        fidl::encoding::Encode<ActivityReporterWatchCaptureActivityResponse, D>
6145        for &ActivityReporterWatchCaptureActivityResponse
6146    {
6147        #[inline]
6148        unsafe fn encode(
6149            self,
6150            encoder: &mut fidl::encoding::Encoder<'_, D>,
6151            offset: usize,
6152            _depth: fidl::encoding::Depth,
6153        ) -> fidl::Result<()> {
6154            encoder.debug_check_bounds::<ActivityReporterWatchCaptureActivityResponse>(offset);
6155            // Delegate to tuple encoding.
6156            fidl::encoding::Encode::<ActivityReporterWatchCaptureActivityResponse, D>::encode(
6157                (
6158                    <fidl::encoding::Vector<AudioCaptureUsage, 4> as fidl::encoding::ValueTypeMarker>::borrow(&self.active_usages),
6159                ),
6160                encoder, offset, _depth
6161            )
6162        }
6163    }
6164    unsafe impl<
6165        D: fidl::encoding::ResourceDialect,
6166        T0: fidl::encoding::Encode<fidl::encoding::Vector<AudioCaptureUsage, 4>, D>,
6167    > fidl::encoding::Encode<ActivityReporterWatchCaptureActivityResponse, D> for (T0,)
6168    {
6169        #[inline]
6170        unsafe fn encode(
6171            self,
6172            encoder: &mut fidl::encoding::Encoder<'_, D>,
6173            offset: usize,
6174            depth: fidl::encoding::Depth,
6175        ) -> fidl::Result<()> {
6176            encoder.debug_check_bounds::<ActivityReporterWatchCaptureActivityResponse>(offset);
6177            // Zero out padding regions. There's no need to apply masks
6178            // because the unmasked parts will be overwritten by fields.
6179            // Write the fields.
6180            self.0.encode(encoder, offset + 0, depth)?;
6181            Ok(())
6182        }
6183    }
6184
6185    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
6186        for ActivityReporterWatchCaptureActivityResponse
6187    {
6188        #[inline(always)]
6189        fn new_empty() -> Self {
6190            Self {
6191                active_usages: fidl::new_empty!(fidl::encoding::Vector<AudioCaptureUsage, 4>, D),
6192            }
6193        }
6194
6195        #[inline]
6196        unsafe fn decode(
6197            &mut self,
6198            decoder: &mut fidl::encoding::Decoder<'_, D>,
6199            offset: usize,
6200            _depth: fidl::encoding::Depth,
6201        ) -> fidl::Result<()> {
6202            decoder.debug_check_bounds::<Self>(offset);
6203            // Verify that padding bytes are zero.
6204            fidl::decode!(fidl::encoding::Vector<AudioCaptureUsage, 4>, D, &mut self.active_usages, decoder, offset + 0, _depth)?;
6205            Ok(())
6206        }
6207    }
6208
6209    impl fidl::encoding::ValueTypeMarker for ActivityReporterWatchRenderActivityResponse {
6210        type Borrowed<'a> = &'a Self;
6211        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6212            value
6213        }
6214    }
6215
6216    unsafe impl fidl::encoding::TypeMarker for ActivityReporterWatchRenderActivityResponse {
6217        type Owned = Self;
6218
6219        #[inline(always)]
6220        fn inline_align(_context: fidl::encoding::Context) -> usize {
6221            8
6222        }
6223
6224        #[inline(always)]
6225        fn inline_size(_context: fidl::encoding::Context) -> usize {
6226            16
6227        }
6228    }
6229
6230    unsafe impl<D: fidl::encoding::ResourceDialect>
6231        fidl::encoding::Encode<ActivityReporterWatchRenderActivityResponse, D>
6232        for &ActivityReporterWatchRenderActivityResponse
6233    {
6234        #[inline]
6235        unsafe fn encode(
6236            self,
6237            encoder: &mut fidl::encoding::Encoder<'_, D>,
6238            offset: usize,
6239            _depth: fidl::encoding::Depth,
6240        ) -> fidl::Result<()> {
6241            encoder.debug_check_bounds::<ActivityReporterWatchRenderActivityResponse>(offset);
6242            // Delegate to tuple encoding.
6243            fidl::encoding::Encode::<ActivityReporterWatchRenderActivityResponse, D>::encode(
6244                (
6245                    <fidl::encoding::Vector<AudioRenderUsage, 5> as fidl::encoding::ValueTypeMarker>::borrow(&self.active_usages),
6246                ),
6247                encoder, offset, _depth
6248            )
6249        }
6250    }
6251    unsafe impl<
6252        D: fidl::encoding::ResourceDialect,
6253        T0: fidl::encoding::Encode<fidl::encoding::Vector<AudioRenderUsage, 5>, D>,
6254    > fidl::encoding::Encode<ActivityReporterWatchRenderActivityResponse, D> for (T0,)
6255    {
6256        #[inline]
6257        unsafe fn encode(
6258            self,
6259            encoder: &mut fidl::encoding::Encoder<'_, D>,
6260            offset: usize,
6261            depth: fidl::encoding::Depth,
6262        ) -> fidl::Result<()> {
6263            encoder.debug_check_bounds::<ActivityReporterWatchRenderActivityResponse>(offset);
6264            // Zero out padding regions. There's no need to apply masks
6265            // because the unmasked parts will be overwritten by fields.
6266            // Write the fields.
6267            self.0.encode(encoder, offset + 0, depth)?;
6268            Ok(())
6269        }
6270    }
6271
6272    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
6273        for ActivityReporterWatchRenderActivityResponse
6274    {
6275        #[inline(always)]
6276        fn new_empty() -> Self {
6277            Self { active_usages: fidl::new_empty!(fidl::encoding::Vector<AudioRenderUsage, 5>, D) }
6278        }
6279
6280        #[inline]
6281        unsafe fn decode(
6282            &mut self,
6283            decoder: &mut fidl::encoding::Decoder<'_, D>,
6284            offset: usize,
6285            _depth: fidl::encoding::Depth,
6286        ) -> fidl::Result<()> {
6287            decoder.debug_check_bounds::<Self>(offset);
6288            // Verify that padding bytes are zero.
6289            fidl::decode!(fidl::encoding::Vector<AudioRenderUsage, 5>, D, &mut self.active_usages, decoder, offset + 0, _depth)?;
6290            Ok(())
6291        }
6292    }
6293
6294    impl fidl::encoding::ValueTypeMarker for ActivityReporterWatchCaptureActivity2Response {
6295        type Borrowed<'a> = &'a Self;
6296        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6297            value
6298        }
6299    }
6300
6301    unsafe impl fidl::encoding::TypeMarker for ActivityReporterWatchCaptureActivity2Response {
6302        type Owned = Self;
6303
6304        #[inline(always)]
6305        fn inline_align(_context: fidl::encoding::Context) -> usize {
6306            8
6307        }
6308
6309        #[inline(always)]
6310        fn inline_size(_context: fidl::encoding::Context) -> usize {
6311            16
6312        }
6313    }
6314
6315    unsafe impl<D: fidl::encoding::ResourceDialect>
6316        fidl::encoding::Encode<ActivityReporterWatchCaptureActivity2Response, D>
6317        for &ActivityReporterWatchCaptureActivity2Response
6318    {
6319        #[inline]
6320        unsafe fn encode(
6321            self,
6322            encoder: &mut fidl::encoding::Encoder<'_, D>,
6323            offset: usize,
6324            _depth: fidl::encoding::Depth,
6325        ) -> fidl::Result<()> {
6326            encoder.debug_check_bounds::<ActivityReporterWatchCaptureActivity2Response>(offset);
6327            // Delegate to tuple encoding.
6328            fidl::encoding::Encode::<ActivityReporterWatchCaptureActivity2Response, D>::encode(
6329                (
6330                    <fidl::encoding::Vector<AudioCaptureUsage2, 8> as fidl::encoding::ValueTypeMarker>::borrow(&self.active_usages),
6331                ),
6332                encoder, offset, _depth
6333            )
6334        }
6335    }
6336    unsafe impl<
6337        D: fidl::encoding::ResourceDialect,
6338        T0: fidl::encoding::Encode<fidl::encoding::Vector<AudioCaptureUsage2, 8>, D>,
6339    > fidl::encoding::Encode<ActivityReporterWatchCaptureActivity2Response, D> for (T0,)
6340    {
6341        #[inline]
6342        unsafe fn encode(
6343            self,
6344            encoder: &mut fidl::encoding::Encoder<'_, D>,
6345            offset: usize,
6346            depth: fidl::encoding::Depth,
6347        ) -> fidl::Result<()> {
6348            encoder.debug_check_bounds::<ActivityReporterWatchCaptureActivity2Response>(offset);
6349            // Zero out padding regions. There's no need to apply masks
6350            // because the unmasked parts will be overwritten by fields.
6351            // Write the fields.
6352            self.0.encode(encoder, offset + 0, depth)?;
6353            Ok(())
6354        }
6355    }
6356
6357    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
6358        for ActivityReporterWatchCaptureActivity2Response
6359    {
6360        #[inline(always)]
6361        fn new_empty() -> Self {
6362            Self {
6363                active_usages: fidl::new_empty!(fidl::encoding::Vector<AudioCaptureUsage2, 8>, D),
6364            }
6365        }
6366
6367        #[inline]
6368        unsafe fn decode(
6369            &mut self,
6370            decoder: &mut fidl::encoding::Decoder<'_, D>,
6371            offset: usize,
6372            _depth: fidl::encoding::Depth,
6373        ) -> fidl::Result<()> {
6374            decoder.debug_check_bounds::<Self>(offset);
6375            // Verify that padding bytes are zero.
6376            fidl::decode!(fidl::encoding::Vector<AudioCaptureUsage2, 8>, D, &mut self.active_usages, decoder, offset + 0, _depth)?;
6377            Ok(())
6378        }
6379    }
6380
6381    impl fidl::encoding::ValueTypeMarker for ActivityReporterWatchRenderActivity2Response {
6382        type Borrowed<'a> = &'a Self;
6383        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6384            value
6385        }
6386    }
6387
6388    unsafe impl fidl::encoding::TypeMarker for ActivityReporterWatchRenderActivity2Response {
6389        type Owned = Self;
6390
6391        #[inline(always)]
6392        fn inline_align(_context: fidl::encoding::Context) -> usize {
6393            8
6394        }
6395
6396        #[inline(always)]
6397        fn inline_size(_context: fidl::encoding::Context) -> usize {
6398            16
6399        }
6400    }
6401
6402    unsafe impl<D: fidl::encoding::ResourceDialect>
6403        fidl::encoding::Encode<ActivityReporterWatchRenderActivity2Response, D>
6404        for &ActivityReporterWatchRenderActivity2Response
6405    {
6406        #[inline]
6407        unsafe fn encode(
6408            self,
6409            encoder: &mut fidl::encoding::Encoder<'_, D>,
6410            offset: usize,
6411            _depth: fidl::encoding::Depth,
6412        ) -> fidl::Result<()> {
6413            encoder.debug_check_bounds::<ActivityReporterWatchRenderActivity2Response>(offset);
6414            // Delegate to tuple encoding.
6415            fidl::encoding::Encode::<ActivityReporterWatchRenderActivity2Response, D>::encode(
6416                (
6417                    <fidl::encoding::Vector<AudioRenderUsage2, 8> as fidl::encoding::ValueTypeMarker>::borrow(&self.active_usages),
6418                ),
6419                encoder, offset, _depth
6420            )
6421        }
6422    }
6423    unsafe impl<
6424        D: fidl::encoding::ResourceDialect,
6425        T0: fidl::encoding::Encode<fidl::encoding::Vector<AudioRenderUsage2, 8>, D>,
6426    > fidl::encoding::Encode<ActivityReporterWatchRenderActivity2Response, D> for (T0,)
6427    {
6428        #[inline]
6429        unsafe fn encode(
6430            self,
6431            encoder: &mut fidl::encoding::Encoder<'_, D>,
6432            offset: usize,
6433            depth: fidl::encoding::Depth,
6434        ) -> fidl::Result<()> {
6435            encoder.debug_check_bounds::<ActivityReporterWatchRenderActivity2Response>(offset);
6436            // Zero out padding regions. There's no need to apply masks
6437            // because the unmasked parts will be overwritten by fields.
6438            // Write the fields.
6439            self.0.encode(encoder, offset + 0, depth)?;
6440            Ok(())
6441        }
6442    }
6443
6444    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
6445        for ActivityReporterWatchRenderActivity2Response
6446    {
6447        #[inline(always)]
6448        fn new_empty() -> Self {
6449            Self {
6450                active_usages: fidl::new_empty!(fidl::encoding::Vector<AudioRenderUsage2, 8>, D),
6451            }
6452        }
6453
6454        #[inline]
6455        unsafe fn decode(
6456            &mut self,
6457            decoder: &mut fidl::encoding::Decoder<'_, D>,
6458            offset: usize,
6459            _depth: fidl::encoding::Depth,
6460        ) -> fidl::Result<()> {
6461            decoder.debug_check_bounds::<Self>(offset);
6462            // Verify that padding bytes are zero.
6463            fidl::decode!(fidl::encoding::Vector<AudioRenderUsage2, 8>, D, &mut self.active_usages, decoder, offset + 0, _depth)?;
6464            Ok(())
6465        }
6466    }
6467
6468    impl fidl::encoding::ValueTypeMarker for AudioCapturerCaptureAtRequest {
6469        type Borrowed<'a> = &'a Self;
6470        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6471            value
6472        }
6473    }
6474
6475    unsafe impl fidl::encoding::TypeMarker for AudioCapturerCaptureAtRequest {
6476        type Owned = Self;
6477
6478        #[inline(always)]
6479        fn inline_align(_context: fidl::encoding::Context) -> usize {
6480            4
6481        }
6482
6483        #[inline(always)]
6484        fn inline_size(_context: fidl::encoding::Context) -> usize {
6485            12
6486        }
6487        #[inline(always)]
6488        fn encode_is_copy() -> bool {
6489            true
6490        }
6491
6492        #[inline(always)]
6493        fn decode_is_copy() -> bool {
6494            true
6495        }
6496    }
6497
6498    unsafe impl<D: fidl::encoding::ResourceDialect>
6499        fidl::encoding::Encode<AudioCapturerCaptureAtRequest, D>
6500        for &AudioCapturerCaptureAtRequest
6501    {
6502        #[inline]
6503        unsafe fn encode(
6504            self,
6505            encoder: &mut fidl::encoding::Encoder<'_, D>,
6506            offset: usize,
6507            _depth: fidl::encoding::Depth,
6508        ) -> fidl::Result<()> {
6509            encoder.debug_check_bounds::<AudioCapturerCaptureAtRequest>(offset);
6510            unsafe {
6511                // Copy the object into the buffer.
6512                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
6513                (buf_ptr as *mut AudioCapturerCaptureAtRequest)
6514                    .write_unaligned((self as *const AudioCapturerCaptureAtRequest).read());
6515                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
6516                // done second because the memcpy will write garbage to these bytes.
6517            }
6518            Ok(())
6519        }
6520    }
6521    unsafe impl<
6522        D: fidl::encoding::ResourceDialect,
6523        T0: fidl::encoding::Encode<u32, D>,
6524        T1: fidl::encoding::Encode<u32, D>,
6525        T2: fidl::encoding::Encode<u32, D>,
6526    > fidl::encoding::Encode<AudioCapturerCaptureAtRequest, D> for (T0, T1, T2)
6527    {
6528        #[inline]
6529        unsafe fn encode(
6530            self,
6531            encoder: &mut fidl::encoding::Encoder<'_, D>,
6532            offset: usize,
6533            depth: fidl::encoding::Depth,
6534        ) -> fidl::Result<()> {
6535            encoder.debug_check_bounds::<AudioCapturerCaptureAtRequest>(offset);
6536            // Zero out padding regions. There's no need to apply masks
6537            // because the unmasked parts will be overwritten by fields.
6538            // Write the fields.
6539            self.0.encode(encoder, offset + 0, depth)?;
6540            self.1.encode(encoder, offset + 4, depth)?;
6541            self.2.encode(encoder, offset + 8, depth)?;
6542            Ok(())
6543        }
6544    }
6545
6546    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
6547        for AudioCapturerCaptureAtRequest
6548    {
6549        #[inline(always)]
6550        fn new_empty() -> Self {
6551            Self {
6552                payload_buffer_id: fidl::new_empty!(u32, D),
6553                payload_offset: fidl::new_empty!(u32, D),
6554                frames: fidl::new_empty!(u32, D),
6555            }
6556        }
6557
6558        #[inline]
6559        unsafe fn decode(
6560            &mut self,
6561            decoder: &mut fidl::encoding::Decoder<'_, D>,
6562            offset: usize,
6563            _depth: fidl::encoding::Depth,
6564        ) -> fidl::Result<()> {
6565            decoder.debug_check_bounds::<Self>(offset);
6566            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
6567            // Verify that padding bytes are zero.
6568            // Copy from the buffer into the object.
6569            unsafe {
6570                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 12);
6571            }
6572            Ok(())
6573        }
6574    }
6575
6576    impl fidl::encoding::ValueTypeMarker for AudioCapturerCaptureAtResponse {
6577        type Borrowed<'a> = &'a Self;
6578        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6579            value
6580        }
6581    }
6582
6583    unsafe impl fidl::encoding::TypeMarker for AudioCapturerCaptureAtResponse {
6584        type Owned = Self;
6585
6586        #[inline(always)]
6587        fn inline_align(_context: fidl::encoding::Context) -> usize {
6588            8
6589        }
6590
6591        #[inline(always)]
6592        fn inline_size(_context: fidl::encoding::Context) -> usize {
6593            56
6594        }
6595    }
6596
6597    unsafe impl<D: fidl::encoding::ResourceDialect>
6598        fidl::encoding::Encode<AudioCapturerCaptureAtResponse, D>
6599        for &AudioCapturerCaptureAtResponse
6600    {
6601        #[inline]
6602        unsafe fn encode(
6603            self,
6604            encoder: &mut fidl::encoding::Encoder<'_, D>,
6605            offset: usize,
6606            _depth: fidl::encoding::Depth,
6607        ) -> fidl::Result<()> {
6608            encoder.debug_check_bounds::<AudioCapturerCaptureAtResponse>(offset);
6609            unsafe {
6610                // Copy the object into the buffer.
6611                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
6612                (buf_ptr as *mut AudioCapturerCaptureAtResponse)
6613                    .write_unaligned((self as *const AudioCapturerCaptureAtResponse).read());
6614                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
6615                // done second because the memcpy will write garbage to these bytes.
6616                let padding_ptr = buf_ptr.offset(8) as *mut u64;
6617                let padding_mask = 0xffffffff00000000u64;
6618                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
6619                let padding_ptr = buf_ptr.offset(32) as *mut u64;
6620                let padding_mask = 0xffffffff00000000u64;
6621                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
6622            }
6623            Ok(())
6624        }
6625    }
6626    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<StreamPacket, D>>
6627        fidl::encoding::Encode<AudioCapturerCaptureAtResponse, D> for (T0,)
6628    {
6629        #[inline]
6630        unsafe fn encode(
6631            self,
6632            encoder: &mut fidl::encoding::Encoder<'_, D>,
6633            offset: usize,
6634            depth: fidl::encoding::Depth,
6635        ) -> fidl::Result<()> {
6636            encoder.debug_check_bounds::<AudioCapturerCaptureAtResponse>(offset);
6637            // Zero out padding regions. There's no need to apply masks
6638            // because the unmasked parts will be overwritten by fields.
6639            // Write the fields.
6640            self.0.encode(encoder, offset + 0, depth)?;
6641            Ok(())
6642        }
6643    }
6644
6645    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
6646        for AudioCapturerCaptureAtResponse
6647    {
6648        #[inline(always)]
6649        fn new_empty() -> Self {
6650            Self { captured_packet: fidl::new_empty!(StreamPacket, D) }
6651        }
6652
6653        #[inline]
6654        unsafe fn decode(
6655            &mut self,
6656            decoder: &mut fidl::encoding::Decoder<'_, D>,
6657            offset: usize,
6658            _depth: fidl::encoding::Depth,
6659        ) -> fidl::Result<()> {
6660            decoder.debug_check_bounds::<Self>(offset);
6661            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
6662            // Verify that padding bytes are zero.
6663            let ptr = unsafe { buf_ptr.offset(8) };
6664            let padval = unsafe { (ptr as *const u64).read_unaligned() };
6665            let mask = 0xffffffff00000000u64;
6666            let maskedval = padval & mask;
6667            if maskedval != 0 {
6668                return Err(fidl::Error::NonZeroPadding {
6669                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
6670                });
6671            }
6672            let ptr = unsafe { buf_ptr.offset(32) };
6673            let padval = unsafe { (ptr as *const u64).read_unaligned() };
6674            let mask = 0xffffffff00000000u64;
6675            let maskedval = padval & mask;
6676            if maskedval != 0 {
6677                return Err(fidl::Error::NonZeroPadding {
6678                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
6679                });
6680            }
6681            // Copy from the buffer into the object.
6682            unsafe {
6683                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 56);
6684            }
6685            Ok(())
6686        }
6687    }
6688
6689    impl fidl::encoding::ValueTypeMarker for AudioCapturerGetStreamTypeResponse {
6690        type Borrowed<'a> = &'a Self;
6691        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6692            value
6693        }
6694    }
6695
6696    unsafe impl fidl::encoding::TypeMarker for AudioCapturerGetStreamTypeResponse {
6697        type Owned = Self;
6698
6699        #[inline(always)]
6700        fn inline_align(_context: fidl::encoding::Context) -> usize {
6701            8
6702        }
6703
6704        #[inline(always)]
6705        fn inline_size(_context: fidl::encoding::Context) -> usize {
6706            48
6707        }
6708    }
6709
6710    unsafe impl<D: fidl::encoding::ResourceDialect>
6711        fidl::encoding::Encode<AudioCapturerGetStreamTypeResponse, D>
6712        for &AudioCapturerGetStreamTypeResponse
6713    {
6714        #[inline]
6715        unsafe fn encode(
6716            self,
6717            encoder: &mut fidl::encoding::Encoder<'_, D>,
6718            offset: usize,
6719            _depth: fidl::encoding::Depth,
6720        ) -> fidl::Result<()> {
6721            encoder.debug_check_bounds::<AudioCapturerGetStreamTypeResponse>(offset);
6722            // Delegate to tuple encoding.
6723            fidl::encoding::Encode::<AudioCapturerGetStreamTypeResponse, D>::encode(
6724                (<StreamType as fidl::encoding::ValueTypeMarker>::borrow(&self.stream_type),),
6725                encoder,
6726                offset,
6727                _depth,
6728            )
6729        }
6730    }
6731    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<StreamType, D>>
6732        fidl::encoding::Encode<AudioCapturerGetStreamTypeResponse, D> for (T0,)
6733    {
6734        #[inline]
6735        unsafe fn encode(
6736            self,
6737            encoder: &mut fidl::encoding::Encoder<'_, D>,
6738            offset: usize,
6739            depth: fidl::encoding::Depth,
6740        ) -> fidl::Result<()> {
6741            encoder.debug_check_bounds::<AudioCapturerGetStreamTypeResponse>(offset);
6742            // Zero out padding regions. There's no need to apply masks
6743            // because the unmasked parts will be overwritten by fields.
6744            // Write the fields.
6745            self.0.encode(encoder, offset + 0, depth)?;
6746            Ok(())
6747        }
6748    }
6749
6750    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
6751        for AudioCapturerGetStreamTypeResponse
6752    {
6753        #[inline(always)]
6754        fn new_empty() -> Self {
6755            Self { stream_type: fidl::new_empty!(StreamType, D) }
6756        }
6757
6758        #[inline]
6759        unsafe fn decode(
6760            &mut self,
6761            decoder: &mut fidl::encoding::Decoder<'_, D>,
6762            offset: usize,
6763            _depth: fidl::encoding::Depth,
6764        ) -> fidl::Result<()> {
6765            decoder.debug_check_bounds::<Self>(offset);
6766            // Verify that padding bytes are zero.
6767            fidl::decode!(StreamType, D, &mut self.stream_type, decoder, offset + 0, _depth)?;
6768            Ok(())
6769        }
6770    }
6771
6772    impl fidl::encoding::ValueTypeMarker for AudioCapturerSetPcmStreamTypeRequest {
6773        type Borrowed<'a> = &'a Self;
6774        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6775            value
6776        }
6777    }
6778
6779    unsafe impl fidl::encoding::TypeMarker for AudioCapturerSetPcmStreamTypeRequest {
6780        type Owned = Self;
6781
6782        #[inline(always)]
6783        fn inline_align(_context: fidl::encoding::Context) -> usize {
6784            4
6785        }
6786
6787        #[inline(always)]
6788        fn inline_size(_context: fidl::encoding::Context) -> usize {
6789            12
6790        }
6791    }
6792
6793    unsafe impl<D: fidl::encoding::ResourceDialect>
6794        fidl::encoding::Encode<AudioCapturerSetPcmStreamTypeRequest, D>
6795        for &AudioCapturerSetPcmStreamTypeRequest
6796    {
6797        #[inline]
6798        unsafe fn encode(
6799            self,
6800            encoder: &mut fidl::encoding::Encoder<'_, D>,
6801            offset: usize,
6802            _depth: fidl::encoding::Depth,
6803        ) -> fidl::Result<()> {
6804            encoder.debug_check_bounds::<AudioCapturerSetPcmStreamTypeRequest>(offset);
6805            // Delegate to tuple encoding.
6806            fidl::encoding::Encode::<AudioCapturerSetPcmStreamTypeRequest, D>::encode(
6807                (<AudioStreamType as fidl::encoding::ValueTypeMarker>::borrow(&self.stream_type),),
6808                encoder,
6809                offset,
6810                _depth,
6811            )
6812        }
6813    }
6814    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<AudioStreamType, D>>
6815        fidl::encoding::Encode<AudioCapturerSetPcmStreamTypeRequest, D> for (T0,)
6816    {
6817        #[inline]
6818        unsafe fn encode(
6819            self,
6820            encoder: &mut fidl::encoding::Encoder<'_, D>,
6821            offset: usize,
6822            depth: fidl::encoding::Depth,
6823        ) -> fidl::Result<()> {
6824            encoder.debug_check_bounds::<AudioCapturerSetPcmStreamTypeRequest>(offset);
6825            // Zero out padding regions. There's no need to apply masks
6826            // because the unmasked parts will be overwritten by fields.
6827            // Write the fields.
6828            self.0.encode(encoder, offset + 0, depth)?;
6829            Ok(())
6830        }
6831    }
6832
6833    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
6834        for AudioCapturerSetPcmStreamTypeRequest
6835    {
6836        #[inline(always)]
6837        fn new_empty() -> Self {
6838            Self { stream_type: fidl::new_empty!(AudioStreamType, D) }
6839        }
6840
6841        #[inline]
6842        unsafe fn decode(
6843            &mut self,
6844            decoder: &mut fidl::encoding::Decoder<'_, D>,
6845            offset: usize,
6846            _depth: fidl::encoding::Depth,
6847        ) -> fidl::Result<()> {
6848            decoder.debug_check_bounds::<Self>(offset);
6849            // Verify that padding bytes are zero.
6850            fidl::decode!(AudioStreamType, D, &mut self.stream_type, decoder, offset + 0, _depth)?;
6851            Ok(())
6852        }
6853    }
6854
6855    impl fidl::encoding::ValueTypeMarker for AudioCapturerSetUsage2Request {
6856        type Borrowed<'a> = &'a Self;
6857        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6858            value
6859        }
6860    }
6861
6862    unsafe impl fidl::encoding::TypeMarker for AudioCapturerSetUsage2Request {
6863        type Owned = Self;
6864
6865        #[inline(always)]
6866        fn inline_align(_context: fidl::encoding::Context) -> usize {
6867            4
6868        }
6869
6870        #[inline(always)]
6871        fn inline_size(_context: fidl::encoding::Context) -> usize {
6872            4
6873        }
6874    }
6875
6876    unsafe impl<D: fidl::encoding::ResourceDialect>
6877        fidl::encoding::Encode<AudioCapturerSetUsage2Request, D>
6878        for &AudioCapturerSetUsage2Request
6879    {
6880        #[inline]
6881        unsafe fn encode(
6882            self,
6883            encoder: &mut fidl::encoding::Encoder<'_, D>,
6884            offset: usize,
6885            _depth: fidl::encoding::Depth,
6886        ) -> fidl::Result<()> {
6887            encoder.debug_check_bounds::<AudioCapturerSetUsage2Request>(offset);
6888            // Delegate to tuple encoding.
6889            fidl::encoding::Encode::<AudioCapturerSetUsage2Request, D>::encode(
6890                (<AudioCaptureUsage2 as fidl::encoding::ValueTypeMarker>::borrow(&self.usage),),
6891                encoder,
6892                offset,
6893                _depth,
6894            )
6895        }
6896    }
6897    unsafe impl<
6898        D: fidl::encoding::ResourceDialect,
6899        T0: fidl::encoding::Encode<AudioCaptureUsage2, D>,
6900    > fidl::encoding::Encode<AudioCapturerSetUsage2Request, D> for (T0,)
6901    {
6902        #[inline]
6903        unsafe fn encode(
6904            self,
6905            encoder: &mut fidl::encoding::Encoder<'_, D>,
6906            offset: usize,
6907            depth: fidl::encoding::Depth,
6908        ) -> fidl::Result<()> {
6909            encoder.debug_check_bounds::<AudioCapturerSetUsage2Request>(offset);
6910            // Zero out padding regions. There's no need to apply masks
6911            // because the unmasked parts will be overwritten by fields.
6912            // Write the fields.
6913            self.0.encode(encoder, offset + 0, depth)?;
6914            Ok(())
6915        }
6916    }
6917
6918    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
6919        for AudioCapturerSetUsage2Request
6920    {
6921        #[inline(always)]
6922        fn new_empty() -> Self {
6923            Self { usage: fidl::new_empty!(AudioCaptureUsage2, D) }
6924        }
6925
6926        #[inline]
6927        unsafe fn decode(
6928            &mut self,
6929            decoder: &mut fidl::encoding::Decoder<'_, D>,
6930            offset: usize,
6931            _depth: fidl::encoding::Depth,
6932        ) -> fidl::Result<()> {
6933            decoder.debug_check_bounds::<Self>(offset);
6934            // Verify that padding bytes are zero.
6935            fidl::decode!(AudioCaptureUsage2, D, &mut self.usage, decoder, offset + 0, _depth)?;
6936            Ok(())
6937        }
6938    }
6939
6940    impl fidl::encoding::ValueTypeMarker for AudioCapturerSetUsageRequest {
6941        type Borrowed<'a> = &'a Self;
6942        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6943            value
6944        }
6945    }
6946
6947    unsafe impl fidl::encoding::TypeMarker for AudioCapturerSetUsageRequest {
6948        type Owned = Self;
6949
6950        #[inline(always)]
6951        fn inline_align(_context: fidl::encoding::Context) -> usize {
6952            4
6953        }
6954
6955        #[inline(always)]
6956        fn inline_size(_context: fidl::encoding::Context) -> usize {
6957            4
6958        }
6959    }
6960
6961    unsafe impl<D: fidl::encoding::ResourceDialect>
6962        fidl::encoding::Encode<AudioCapturerSetUsageRequest, D> for &AudioCapturerSetUsageRequest
6963    {
6964        #[inline]
6965        unsafe fn encode(
6966            self,
6967            encoder: &mut fidl::encoding::Encoder<'_, D>,
6968            offset: usize,
6969            _depth: fidl::encoding::Depth,
6970        ) -> fidl::Result<()> {
6971            encoder.debug_check_bounds::<AudioCapturerSetUsageRequest>(offset);
6972            // Delegate to tuple encoding.
6973            fidl::encoding::Encode::<AudioCapturerSetUsageRequest, D>::encode(
6974                (<AudioCaptureUsage as fidl::encoding::ValueTypeMarker>::borrow(&self.usage),),
6975                encoder,
6976                offset,
6977                _depth,
6978            )
6979        }
6980    }
6981    unsafe impl<
6982        D: fidl::encoding::ResourceDialect,
6983        T0: fidl::encoding::Encode<AudioCaptureUsage, D>,
6984    > fidl::encoding::Encode<AudioCapturerSetUsageRequest, D> for (T0,)
6985    {
6986        #[inline]
6987        unsafe fn encode(
6988            self,
6989            encoder: &mut fidl::encoding::Encoder<'_, D>,
6990            offset: usize,
6991            depth: fidl::encoding::Depth,
6992        ) -> fidl::Result<()> {
6993            encoder.debug_check_bounds::<AudioCapturerSetUsageRequest>(offset);
6994            // Zero out padding regions. There's no need to apply masks
6995            // because the unmasked parts will be overwritten by fields.
6996            // Write the fields.
6997            self.0.encode(encoder, offset + 0, depth)?;
6998            Ok(())
6999        }
7000    }
7001
7002    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
7003        for AudioCapturerSetUsageRequest
7004    {
7005        #[inline(always)]
7006        fn new_empty() -> Self {
7007            Self { usage: fidl::new_empty!(AudioCaptureUsage, D) }
7008        }
7009
7010        #[inline]
7011        unsafe fn decode(
7012            &mut self,
7013            decoder: &mut fidl::encoding::Decoder<'_, D>,
7014            offset: usize,
7015            _depth: fidl::encoding::Depth,
7016        ) -> fidl::Result<()> {
7017            decoder.debug_check_bounds::<Self>(offset);
7018            // Verify that padding bytes are zero.
7019            fidl::decode!(AudioCaptureUsage, D, &mut self.usage, decoder, offset + 0, _depth)?;
7020            Ok(())
7021        }
7022    }
7023
7024    impl fidl::encoding::ValueTypeMarker for AudioCapturerStartAsyncCaptureRequest {
7025        type Borrowed<'a> = &'a Self;
7026        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7027            value
7028        }
7029    }
7030
7031    unsafe impl fidl::encoding::TypeMarker for AudioCapturerStartAsyncCaptureRequest {
7032        type Owned = Self;
7033
7034        #[inline(always)]
7035        fn inline_align(_context: fidl::encoding::Context) -> usize {
7036            4
7037        }
7038
7039        #[inline(always)]
7040        fn inline_size(_context: fidl::encoding::Context) -> usize {
7041            4
7042        }
7043        #[inline(always)]
7044        fn encode_is_copy() -> bool {
7045            true
7046        }
7047
7048        #[inline(always)]
7049        fn decode_is_copy() -> bool {
7050            true
7051        }
7052    }
7053
7054    unsafe impl<D: fidl::encoding::ResourceDialect>
7055        fidl::encoding::Encode<AudioCapturerStartAsyncCaptureRequest, D>
7056        for &AudioCapturerStartAsyncCaptureRequest
7057    {
7058        #[inline]
7059        unsafe fn encode(
7060            self,
7061            encoder: &mut fidl::encoding::Encoder<'_, D>,
7062            offset: usize,
7063            _depth: fidl::encoding::Depth,
7064        ) -> fidl::Result<()> {
7065            encoder.debug_check_bounds::<AudioCapturerStartAsyncCaptureRequest>(offset);
7066            unsafe {
7067                // Copy the object into the buffer.
7068                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
7069                (buf_ptr as *mut AudioCapturerStartAsyncCaptureRequest)
7070                    .write_unaligned((self as *const AudioCapturerStartAsyncCaptureRequest).read());
7071                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
7072                // done second because the memcpy will write garbage to these bytes.
7073            }
7074            Ok(())
7075        }
7076    }
7077    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
7078        fidl::encoding::Encode<AudioCapturerStartAsyncCaptureRequest, D> for (T0,)
7079    {
7080        #[inline]
7081        unsafe fn encode(
7082            self,
7083            encoder: &mut fidl::encoding::Encoder<'_, D>,
7084            offset: usize,
7085            depth: fidl::encoding::Depth,
7086        ) -> fidl::Result<()> {
7087            encoder.debug_check_bounds::<AudioCapturerStartAsyncCaptureRequest>(offset);
7088            // Zero out padding regions. There's no need to apply masks
7089            // because the unmasked parts will be overwritten by fields.
7090            // Write the fields.
7091            self.0.encode(encoder, offset + 0, depth)?;
7092            Ok(())
7093        }
7094    }
7095
7096    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
7097        for AudioCapturerStartAsyncCaptureRequest
7098    {
7099        #[inline(always)]
7100        fn new_empty() -> Self {
7101            Self { frames_per_packet: fidl::new_empty!(u32, D) }
7102        }
7103
7104        #[inline]
7105        unsafe fn decode(
7106            &mut self,
7107            decoder: &mut fidl::encoding::Decoder<'_, D>,
7108            offset: usize,
7109            _depth: fidl::encoding::Depth,
7110        ) -> fidl::Result<()> {
7111            decoder.debug_check_bounds::<Self>(offset);
7112            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
7113            // Verify that padding bytes are zero.
7114            // Copy from the buffer into the object.
7115            unsafe {
7116                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
7117            }
7118            Ok(())
7119        }
7120    }
7121
7122    impl fidl::encoding::ValueTypeMarker for AudioCompressedFormatAac {
7123        type Borrowed<'a> = &'a Self;
7124        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7125            value
7126        }
7127    }
7128
7129    unsafe impl fidl::encoding::TypeMarker for AudioCompressedFormatAac {
7130        type Owned = Self;
7131
7132        #[inline(always)]
7133        fn inline_align(_context: fidl::encoding::Context) -> usize {
7134            1
7135        }
7136
7137        #[inline(always)]
7138        fn inline_size(_context: fidl::encoding::Context) -> usize {
7139            1
7140        }
7141    }
7142
7143    unsafe impl<D: fidl::encoding::ResourceDialect>
7144        fidl::encoding::Encode<AudioCompressedFormatAac, D> for &AudioCompressedFormatAac
7145    {
7146        #[inline]
7147        unsafe fn encode(
7148            self,
7149            encoder: &mut fidl::encoding::Encoder<'_, D>,
7150            offset: usize,
7151            _depth: fidl::encoding::Depth,
7152        ) -> fidl::Result<()> {
7153            encoder.debug_check_bounds::<AudioCompressedFormatAac>(offset);
7154            encoder.write_num(0u8, offset);
7155            Ok(())
7156        }
7157    }
7158
7159    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
7160        for AudioCompressedFormatAac
7161    {
7162        #[inline(always)]
7163        fn new_empty() -> Self {
7164            Self
7165        }
7166
7167        #[inline]
7168        unsafe fn decode(
7169            &mut self,
7170            decoder: &mut fidl::encoding::Decoder<'_, D>,
7171            offset: usize,
7172            _depth: fidl::encoding::Depth,
7173        ) -> fidl::Result<()> {
7174            decoder.debug_check_bounds::<Self>(offset);
7175            match decoder.read_num::<u8>(offset) {
7176                0 => Ok(()),
7177                _ => Err(fidl::Error::Invalid),
7178            }
7179        }
7180    }
7181
7182    impl fidl::encoding::ValueTypeMarker for AudioCompressedFormatSbc {
7183        type Borrowed<'a> = &'a Self;
7184        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7185            value
7186        }
7187    }
7188
7189    unsafe impl fidl::encoding::TypeMarker for AudioCompressedFormatSbc {
7190        type Owned = Self;
7191
7192        #[inline(always)]
7193        fn inline_align(_context: fidl::encoding::Context) -> usize {
7194            1
7195        }
7196
7197        #[inline(always)]
7198        fn inline_size(_context: fidl::encoding::Context) -> usize {
7199            1
7200        }
7201    }
7202
7203    unsafe impl<D: fidl::encoding::ResourceDialect>
7204        fidl::encoding::Encode<AudioCompressedFormatSbc, D> for &AudioCompressedFormatSbc
7205    {
7206        #[inline]
7207        unsafe fn encode(
7208            self,
7209            encoder: &mut fidl::encoding::Encoder<'_, D>,
7210            offset: usize,
7211            _depth: fidl::encoding::Depth,
7212        ) -> fidl::Result<()> {
7213            encoder.debug_check_bounds::<AudioCompressedFormatSbc>(offset);
7214            encoder.write_num(0u8, offset);
7215            Ok(())
7216        }
7217    }
7218
7219    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
7220        for AudioCompressedFormatSbc
7221    {
7222        #[inline(always)]
7223        fn new_empty() -> Self {
7224            Self
7225        }
7226
7227        #[inline]
7228        unsafe fn decode(
7229            &mut self,
7230            decoder: &mut fidl::encoding::Decoder<'_, D>,
7231            offset: usize,
7232            _depth: fidl::encoding::Depth,
7233        ) -> fidl::Result<()> {
7234            decoder.debug_check_bounds::<Self>(offset);
7235            match decoder.read_num::<u8>(offset) {
7236                0 => Ok(()),
7237                _ => Err(fidl::Error::Invalid),
7238            }
7239        }
7240    }
7241
7242    impl fidl::encoding::ValueTypeMarker for AudioConsumerSetRateRequest {
7243        type Borrowed<'a> = &'a Self;
7244        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7245            value
7246        }
7247    }
7248
7249    unsafe impl fidl::encoding::TypeMarker for AudioConsumerSetRateRequest {
7250        type Owned = Self;
7251
7252        #[inline(always)]
7253        fn inline_align(_context: fidl::encoding::Context) -> usize {
7254            4
7255        }
7256
7257        #[inline(always)]
7258        fn inline_size(_context: fidl::encoding::Context) -> usize {
7259            4
7260        }
7261    }
7262
7263    unsafe impl<D: fidl::encoding::ResourceDialect>
7264        fidl::encoding::Encode<AudioConsumerSetRateRequest, D> for &AudioConsumerSetRateRequest
7265    {
7266        #[inline]
7267        unsafe fn encode(
7268            self,
7269            encoder: &mut fidl::encoding::Encoder<'_, D>,
7270            offset: usize,
7271            _depth: fidl::encoding::Depth,
7272        ) -> fidl::Result<()> {
7273            encoder.debug_check_bounds::<AudioConsumerSetRateRequest>(offset);
7274            // Delegate to tuple encoding.
7275            fidl::encoding::Encode::<AudioConsumerSetRateRequest, D>::encode(
7276                (<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.rate),),
7277                encoder,
7278                offset,
7279                _depth,
7280            )
7281        }
7282    }
7283    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f32, D>>
7284        fidl::encoding::Encode<AudioConsumerSetRateRequest, D> for (T0,)
7285    {
7286        #[inline]
7287        unsafe fn encode(
7288            self,
7289            encoder: &mut fidl::encoding::Encoder<'_, D>,
7290            offset: usize,
7291            depth: fidl::encoding::Depth,
7292        ) -> fidl::Result<()> {
7293            encoder.debug_check_bounds::<AudioConsumerSetRateRequest>(offset);
7294            // Zero out padding regions. There's no need to apply masks
7295            // because the unmasked parts will be overwritten by fields.
7296            // Write the fields.
7297            self.0.encode(encoder, offset + 0, depth)?;
7298            Ok(())
7299        }
7300    }
7301
7302    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
7303        for AudioConsumerSetRateRequest
7304    {
7305        #[inline(always)]
7306        fn new_empty() -> Self {
7307            Self { rate: fidl::new_empty!(f32, D) }
7308        }
7309
7310        #[inline]
7311        unsafe fn decode(
7312            &mut self,
7313            decoder: &mut fidl::encoding::Decoder<'_, D>,
7314            offset: usize,
7315            _depth: fidl::encoding::Depth,
7316        ) -> fidl::Result<()> {
7317            decoder.debug_check_bounds::<Self>(offset);
7318            // Verify that padding bytes are zero.
7319            fidl::decode!(f32, D, &mut self.rate, decoder, offset + 0, _depth)?;
7320            Ok(())
7321        }
7322    }
7323
7324    impl fidl::encoding::ValueTypeMarker for AudioConsumerStartRequest {
7325        type Borrowed<'a> = &'a Self;
7326        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7327            value
7328        }
7329    }
7330
7331    unsafe impl fidl::encoding::TypeMarker for AudioConsumerStartRequest {
7332        type Owned = Self;
7333
7334        #[inline(always)]
7335        fn inline_align(_context: fidl::encoding::Context) -> usize {
7336            8
7337        }
7338
7339        #[inline(always)]
7340        fn inline_size(_context: fidl::encoding::Context) -> usize {
7341            24
7342        }
7343    }
7344
7345    unsafe impl<D: fidl::encoding::ResourceDialect>
7346        fidl::encoding::Encode<AudioConsumerStartRequest, D> for &AudioConsumerStartRequest
7347    {
7348        #[inline]
7349        unsafe fn encode(
7350            self,
7351            encoder: &mut fidl::encoding::Encoder<'_, D>,
7352            offset: usize,
7353            _depth: fidl::encoding::Depth,
7354        ) -> fidl::Result<()> {
7355            encoder.debug_check_bounds::<AudioConsumerStartRequest>(offset);
7356            // Delegate to tuple encoding.
7357            fidl::encoding::Encode::<AudioConsumerStartRequest, D>::encode(
7358                (
7359                    <AudioConsumerStartFlags as fidl::encoding::ValueTypeMarker>::borrow(
7360                        &self.flags,
7361                    ),
7362                    <i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.reference_time),
7363                    <i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.media_time),
7364                ),
7365                encoder,
7366                offset,
7367                _depth,
7368            )
7369        }
7370    }
7371    unsafe impl<
7372        D: fidl::encoding::ResourceDialect,
7373        T0: fidl::encoding::Encode<AudioConsumerStartFlags, D>,
7374        T1: fidl::encoding::Encode<i64, D>,
7375        T2: fidl::encoding::Encode<i64, D>,
7376    > fidl::encoding::Encode<AudioConsumerStartRequest, D> for (T0, T1, T2)
7377    {
7378        #[inline]
7379        unsafe fn encode(
7380            self,
7381            encoder: &mut fidl::encoding::Encoder<'_, D>,
7382            offset: usize,
7383            depth: fidl::encoding::Depth,
7384        ) -> fidl::Result<()> {
7385            encoder.debug_check_bounds::<AudioConsumerStartRequest>(offset);
7386            // Zero out padding regions. There's no need to apply masks
7387            // because the unmasked parts will be overwritten by fields.
7388            unsafe {
7389                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
7390                (ptr as *mut u64).write_unaligned(0);
7391            }
7392            // Write the fields.
7393            self.0.encode(encoder, offset + 0, depth)?;
7394            self.1.encode(encoder, offset + 8, depth)?;
7395            self.2.encode(encoder, offset + 16, depth)?;
7396            Ok(())
7397        }
7398    }
7399
7400    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
7401        for AudioConsumerStartRequest
7402    {
7403        #[inline(always)]
7404        fn new_empty() -> Self {
7405            Self {
7406                flags: fidl::new_empty!(AudioConsumerStartFlags, D),
7407                reference_time: fidl::new_empty!(i64, D),
7408                media_time: fidl::new_empty!(i64, D),
7409            }
7410        }
7411
7412        #[inline]
7413        unsafe fn decode(
7414            &mut self,
7415            decoder: &mut fidl::encoding::Decoder<'_, D>,
7416            offset: usize,
7417            _depth: fidl::encoding::Depth,
7418        ) -> fidl::Result<()> {
7419            decoder.debug_check_bounds::<Self>(offset);
7420            // Verify that padding bytes are zero.
7421            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
7422            let padval = unsafe { (ptr as *const u64).read_unaligned() };
7423            let mask = 0xffffffff00000000u64;
7424            let maskedval = padval & mask;
7425            if maskedval != 0 {
7426                return Err(fidl::Error::NonZeroPadding {
7427                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
7428                });
7429            }
7430            fidl::decode!(
7431                AudioConsumerStartFlags,
7432                D,
7433                &mut self.flags,
7434                decoder,
7435                offset + 0,
7436                _depth
7437            )?;
7438            fidl::decode!(i64, D, &mut self.reference_time, decoder, offset + 8, _depth)?;
7439            fidl::decode!(i64, D, &mut self.media_time, decoder, offset + 16, _depth)?;
7440            Ok(())
7441        }
7442    }
7443
7444    impl fidl::encoding::ValueTypeMarker for AudioConsumerWatchStatusResponse {
7445        type Borrowed<'a> = &'a Self;
7446        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7447            value
7448        }
7449    }
7450
7451    unsafe impl fidl::encoding::TypeMarker for AudioConsumerWatchStatusResponse {
7452        type Owned = Self;
7453
7454        #[inline(always)]
7455        fn inline_align(_context: fidl::encoding::Context) -> usize {
7456            8
7457        }
7458
7459        #[inline(always)]
7460        fn inline_size(_context: fidl::encoding::Context) -> usize {
7461            16
7462        }
7463    }
7464
7465    unsafe impl<D: fidl::encoding::ResourceDialect>
7466        fidl::encoding::Encode<AudioConsumerWatchStatusResponse, D>
7467        for &AudioConsumerWatchStatusResponse
7468    {
7469        #[inline]
7470        unsafe fn encode(
7471            self,
7472            encoder: &mut fidl::encoding::Encoder<'_, D>,
7473            offset: usize,
7474            _depth: fidl::encoding::Depth,
7475        ) -> fidl::Result<()> {
7476            encoder.debug_check_bounds::<AudioConsumerWatchStatusResponse>(offset);
7477            // Delegate to tuple encoding.
7478            fidl::encoding::Encode::<AudioConsumerWatchStatusResponse, D>::encode(
7479                (<AudioConsumerStatus as fidl::encoding::ValueTypeMarker>::borrow(&self.status),),
7480                encoder,
7481                offset,
7482                _depth,
7483            )
7484        }
7485    }
7486    unsafe impl<
7487        D: fidl::encoding::ResourceDialect,
7488        T0: fidl::encoding::Encode<AudioConsumerStatus, D>,
7489    > fidl::encoding::Encode<AudioConsumerWatchStatusResponse, D> for (T0,)
7490    {
7491        #[inline]
7492        unsafe fn encode(
7493            self,
7494            encoder: &mut fidl::encoding::Encoder<'_, D>,
7495            offset: usize,
7496            depth: fidl::encoding::Depth,
7497        ) -> fidl::Result<()> {
7498            encoder.debug_check_bounds::<AudioConsumerWatchStatusResponse>(offset);
7499            // Zero out padding regions. There's no need to apply masks
7500            // because the unmasked parts will be overwritten by fields.
7501            // Write the fields.
7502            self.0.encode(encoder, offset + 0, depth)?;
7503            Ok(())
7504        }
7505    }
7506
7507    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
7508        for AudioConsumerWatchStatusResponse
7509    {
7510        #[inline(always)]
7511        fn new_empty() -> Self {
7512            Self { status: fidl::new_empty!(AudioConsumerStatus, D) }
7513        }
7514
7515        #[inline]
7516        unsafe fn decode(
7517            &mut self,
7518            decoder: &mut fidl::encoding::Decoder<'_, D>,
7519            offset: usize,
7520            _depth: fidl::encoding::Depth,
7521        ) -> fidl::Result<()> {
7522            decoder.debug_check_bounds::<Self>(offset);
7523            // Verify that padding bytes are zero.
7524            fidl::decode!(AudioConsumerStatus, D, &mut self.status, decoder, offset + 0, _depth)?;
7525            Ok(())
7526        }
7527    }
7528
7529    impl fidl::encoding::ValueTypeMarker for AudioCoreGetDbFromVolume2Request {
7530        type Borrowed<'a> = &'a Self;
7531        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7532            value
7533        }
7534    }
7535
7536    unsafe impl fidl::encoding::TypeMarker for AudioCoreGetDbFromVolume2Request {
7537        type Owned = Self;
7538
7539        #[inline(always)]
7540        fn inline_align(_context: fidl::encoding::Context) -> usize {
7541            8
7542        }
7543
7544        #[inline(always)]
7545        fn inline_size(_context: fidl::encoding::Context) -> usize {
7546            24
7547        }
7548    }
7549
7550    unsafe impl<D: fidl::encoding::ResourceDialect>
7551        fidl::encoding::Encode<AudioCoreGetDbFromVolume2Request, D>
7552        for &AudioCoreGetDbFromVolume2Request
7553    {
7554        #[inline]
7555        unsafe fn encode(
7556            self,
7557            encoder: &mut fidl::encoding::Encoder<'_, D>,
7558            offset: usize,
7559            _depth: fidl::encoding::Depth,
7560        ) -> fidl::Result<()> {
7561            encoder.debug_check_bounds::<AudioCoreGetDbFromVolume2Request>(offset);
7562            // Delegate to tuple encoding.
7563            fidl::encoding::Encode::<AudioCoreGetDbFromVolume2Request, D>::encode(
7564                (
7565                    <Usage2 as fidl::encoding::ValueTypeMarker>::borrow(&self.usage),
7566                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.volume),
7567                ),
7568                encoder,
7569                offset,
7570                _depth,
7571            )
7572        }
7573    }
7574    unsafe impl<
7575        D: fidl::encoding::ResourceDialect,
7576        T0: fidl::encoding::Encode<Usage2, D>,
7577        T1: fidl::encoding::Encode<f32, D>,
7578    > fidl::encoding::Encode<AudioCoreGetDbFromVolume2Request, D> for (T0, T1)
7579    {
7580        #[inline]
7581        unsafe fn encode(
7582            self,
7583            encoder: &mut fidl::encoding::Encoder<'_, D>,
7584            offset: usize,
7585            depth: fidl::encoding::Depth,
7586        ) -> fidl::Result<()> {
7587            encoder.debug_check_bounds::<AudioCoreGetDbFromVolume2Request>(offset);
7588            // Zero out padding regions. There's no need to apply masks
7589            // because the unmasked parts will be overwritten by fields.
7590            unsafe {
7591                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
7592                (ptr as *mut u64).write_unaligned(0);
7593            }
7594            // Write the fields.
7595            self.0.encode(encoder, offset + 0, depth)?;
7596            self.1.encode(encoder, offset + 16, depth)?;
7597            Ok(())
7598        }
7599    }
7600
7601    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
7602        for AudioCoreGetDbFromVolume2Request
7603    {
7604        #[inline(always)]
7605        fn new_empty() -> Self {
7606            Self { usage: fidl::new_empty!(Usage2, D), volume: fidl::new_empty!(f32, D) }
7607        }
7608
7609        #[inline]
7610        unsafe fn decode(
7611            &mut self,
7612            decoder: &mut fidl::encoding::Decoder<'_, D>,
7613            offset: usize,
7614            _depth: fidl::encoding::Depth,
7615        ) -> fidl::Result<()> {
7616            decoder.debug_check_bounds::<Self>(offset);
7617            // Verify that padding bytes are zero.
7618            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
7619            let padval = unsafe { (ptr as *const u64).read_unaligned() };
7620            let mask = 0xffffffff00000000u64;
7621            let maskedval = padval & mask;
7622            if maskedval != 0 {
7623                return Err(fidl::Error::NonZeroPadding {
7624                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
7625                });
7626            }
7627            fidl::decode!(Usage2, D, &mut self.usage, decoder, offset + 0, _depth)?;
7628            fidl::decode!(f32, D, &mut self.volume, decoder, offset + 16, _depth)?;
7629            Ok(())
7630        }
7631    }
7632
7633    impl fidl::encoding::ValueTypeMarker for AudioCoreGetDbFromVolumeRequest {
7634        type Borrowed<'a> = &'a Self;
7635        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7636            value
7637        }
7638    }
7639
7640    unsafe impl fidl::encoding::TypeMarker for AudioCoreGetDbFromVolumeRequest {
7641        type Owned = Self;
7642
7643        #[inline(always)]
7644        fn inline_align(_context: fidl::encoding::Context) -> usize {
7645            8
7646        }
7647
7648        #[inline(always)]
7649        fn inline_size(_context: fidl::encoding::Context) -> usize {
7650            24
7651        }
7652    }
7653
7654    unsafe impl<D: fidl::encoding::ResourceDialect>
7655        fidl::encoding::Encode<AudioCoreGetDbFromVolumeRequest, D>
7656        for &AudioCoreGetDbFromVolumeRequest
7657    {
7658        #[inline]
7659        unsafe fn encode(
7660            self,
7661            encoder: &mut fidl::encoding::Encoder<'_, D>,
7662            offset: usize,
7663            _depth: fidl::encoding::Depth,
7664        ) -> fidl::Result<()> {
7665            encoder.debug_check_bounds::<AudioCoreGetDbFromVolumeRequest>(offset);
7666            // Delegate to tuple encoding.
7667            fidl::encoding::Encode::<AudioCoreGetDbFromVolumeRequest, D>::encode(
7668                (
7669                    <Usage as fidl::encoding::ValueTypeMarker>::borrow(&self.usage),
7670                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.volume),
7671                ),
7672                encoder,
7673                offset,
7674                _depth,
7675            )
7676        }
7677    }
7678    unsafe impl<
7679        D: fidl::encoding::ResourceDialect,
7680        T0: fidl::encoding::Encode<Usage, D>,
7681        T1: fidl::encoding::Encode<f32, D>,
7682    > fidl::encoding::Encode<AudioCoreGetDbFromVolumeRequest, D> for (T0, T1)
7683    {
7684        #[inline]
7685        unsafe fn encode(
7686            self,
7687            encoder: &mut fidl::encoding::Encoder<'_, D>,
7688            offset: usize,
7689            depth: fidl::encoding::Depth,
7690        ) -> fidl::Result<()> {
7691            encoder.debug_check_bounds::<AudioCoreGetDbFromVolumeRequest>(offset);
7692            // Zero out padding regions. There's no need to apply masks
7693            // because the unmasked parts will be overwritten by fields.
7694            unsafe {
7695                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
7696                (ptr as *mut u64).write_unaligned(0);
7697            }
7698            // Write the fields.
7699            self.0.encode(encoder, offset + 0, depth)?;
7700            self.1.encode(encoder, offset + 16, depth)?;
7701            Ok(())
7702        }
7703    }
7704
7705    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
7706        for AudioCoreGetDbFromVolumeRequest
7707    {
7708        #[inline(always)]
7709        fn new_empty() -> Self {
7710            Self { usage: fidl::new_empty!(Usage, D), volume: fidl::new_empty!(f32, D) }
7711        }
7712
7713        #[inline]
7714        unsafe fn decode(
7715            &mut self,
7716            decoder: &mut fidl::encoding::Decoder<'_, D>,
7717            offset: usize,
7718            _depth: fidl::encoding::Depth,
7719        ) -> fidl::Result<()> {
7720            decoder.debug_check_bounds::<Self>(offset);
7721            // Verify that padding bytes are zero.
7722            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
7723            let padval = unsafe { (ptr as *const u64).read_unaligned() };
7724            let mask = 0xffffffff00000000u64;
7725            let maskedval = padval & mask;
7726            if maskedval != 0 {
7727                return Err(fidl::Error::NonZeroPadding {
7728                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
7729                });
7730            }
7731            fidl::decode!(Usage, D, &mut self.usage, decoder, offset + 0, _depth)?;
7732            fidl::decode!(f32, D, &mut self.volume, decoder, offset + 16, _depth)?;
7733            Ok(())
7734        }
7735    }
7736
7737    impl fidl::encoding::ValueTypeMarker for AudioCoreGetDbFromVolumeResponse {
7738        type Borrowed<'a> = &'a Self;
7739        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7740            value
7741        }
7742    }
7743
7744    unsafe impl fidl::encoding::TypeMarker for AudioCoreGetDbFromVolumeResponse {
7745        type Owned = Self;
7746
7747        #[inline(always)]
7748        fn inline_align(_context: fidl::encoding::Context) -> usize {
7749            4
7750        }
7751
7752        #[inline(always)]
7753        fn inline_size(_context: fidl::encoding::Context) -> usize {
7754            4
7755        }
7756    }
7757
7758    unsafe impl<D: fidl::encoding::ResourceDialect>
7759        fidl::encoding::Encode<AudioCoreGetDbFromVolumeResponse, D>
7760        for &AudioCoreGetDbFromVolumeResponse
7761    {
7762        #[inline]
7763        unsafe fn encode(
7764            self,
7765            encoder: &mut fidl::encoding::Encoder<'_, D>,
7766            offset: usize,
7767            _depth: fidl::encoding::Depth,
7768        ) -> fidl::Result<()> {
7769            encoder.debug_check_bounds::<AudioCoreGetDbFromVolumeResponse>(offset);
7770            // Delegate to tuple encoding.
7771            fidl::encoding::Encode::<AudioCoreGetDbFromVolumeResponse, D>::encode(
7772                (<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.gain_db),),
7773                encoder,
7774                offset,
7775                _depth,
7776            )
7777        }
7778    }
7779    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f32, D>>
7780        fidl::encoding::Encode<AudioCoreGetDbFromVolumeResponse, D> for (T0,)
7781    {
7782        #[inline]
7783        unsafe fn encode(
7784            self,
7785            encoder: &mut fidl::encoding::Encoder<'_, D>,
7786            offset: usize,
7787            depth: fidl::encoding::Depth,
7788        ) -> fidl::Result<()> {
7789            encoder.debug_check_bounds::<AudioCoreGetDbFromVolumeResponse>(offset);
7790            // Zero out padding regions. There's no need to apply masks
7791            // because the unmasked parts will be overwritten by fields.
7792            // Write the fields.
7793            self.0.encode(encoder, offset + 0, depth)?;
7794            Ok(())
7795        }
7796    }
7797
7798    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
7799        for AudioCoreGetDbFromVolumeResponse
7800    {
7801        #[inline(always)]
7802        fn new_empty() -> Self {
7803            Self { gain_db: fidl::new_empty!(f32, D) }
7804        }
7805
7806        #[inline]
7807        unsafe fn decode(
7808            &mut self,
7809            decoder: &mut fidl::encoding::Decoder<'_, D>,
7810            offset: usize,
7811            _depth: fidl::encoding::Depth,
7812        ) -> fidl::Result<()> {
7813            decoder.debug_check_bounds::<Self>(offset);
7814            // Verify that padding bytes are zero.
7815            fidl::decode!(f32, D, &mut self.gain_db, decoder, offset + 0, _depth)?;
7816            Ok(())
7817        }
7818    }
7819
7820    impl fidl::encoding::ValueTypeMarker for AudioCoreGetVolumeFromDb2Request {
7821        type Borrowed<'a> = &'a Self;
7822        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7823            value
7824        }
7825    }
7826
7827    unsafe impl fidl::encoding::TypeMarker for AudioCoreGetVolumeFromDb2Request {
7828        type Owned = Self;
7829
7830        #[inline(always)]
7831        fn inline_align(_context: fidl::encoding::Context) -> usize {
7832            8
7833        }
7834
7835        #[inline(always)]
7836        fn inline_size(_context: fidl::encoding::Context) -> usize {
7837            24
7838        }
7839    }
7840
7841    unsafe impl<D: fidl::encoding::ResourceDialect>
7842        fidl::encoding::Encode<AudioCoreGetVolumeFromDb2Request, D>
7843        for &AudioCoreGetVolumeFromDb2Request
7844    {
7845        #[inline]
7846        unsafe fn encode(
7847            self,
7848            encoder: &mut fidl::encoding::Encoder<'_, D>,
7849            offset: usize,
7850            _depth: fidl::encoding::Depth,
7851        ) -> fidl::Result<()> {
7852            encoder.debug_check_bounds::<AudioCoreGetVolumeFromDb2Request>(offset);
7853            // Delegate to tuple encoding.
7854            fidl::encoding::Encode::<AudioCoreGetVolumeFromDb2Request, D>::encode(
7855                (
7856                    <Usage2 as fidl::encoding::ValueTypeMarker>::borrow(&self.usage),
7857                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.gain_db),
7858                ),
7859                encoder,
7860                offset,
7861                _depth,
7862            )
7863        }
7864    }
7865    unsafe impl<
7866        D: fidl::encoding::ResourceDialect,
7867        T0: fidl::encoding::Encode<Usage2, D>,
7868        T1: fidl::encoding::Encode<f32, D>,
7869    > fidl::encoding::Encode<AudioCoreGetVolumeFromDb2Request, D> for (T0, T1)
7870    {
7871        #[inline]
7872        unsafe fn encode(
7873            self,
7874            encoder: &mut fidl::encoding::Encoder<'_, D>,
7875            offset: usize,
7876            depth: fidl::encoding::Depth,
7877        ) -> fidl::Result<()> {
7878            encoder.debug_check_bounds::<AudioCoreGetVolumeFromDb2Request>(offset);
7879            // Zero out padding regions. There's no need to apply masks
7880            // because the unmasked parts will be overwritten by fields.
7881            unsafe {
7882                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
7883                (ptr as *mut u64).write_unaligned(0);
7884            }
7885            // Write the fields.
7886            self.0.encode(encoder, offset + 0, depth)?;
7887            self.1.encode(encoder, offset + 16, depth)?;
7888            Ok(())
7889        }
7890    }
7891
7892    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
7893        for AudioCoreGetVolumeFromDb2Request
7894    {
7895        #[inline(always)]
7896        fn new_empty() -> Self {
7897            Self { usage: fidl::new_empty!(Usage2, D), gain_db: fidl::new_empty!(f32, D) }
7898        }
7899
7900        #[inline]
7901        unsafe fn decode(
7902            &mut self,
7903            decoder: &mut fidl::encoding::Decoder<'_, D>,
7904            offset: usize,
7905            _depth: fidl::encoding::Depth,
7906        ) -> fidl::Result<()> {
7907            decoder.debug_check_bounds::<Self>(offset);
7908            // Verify that padding bytes are zero.
7909            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
7910            let padval = unsafe { (ptr as *const u64).read_unaligned() };
7911            let mask = 0xffffffff00000000u64;
7912            let maskedval = padval & mask;
7913            if maskedval != 0 {
7914                return Err(fidl::Error::NonZeroPadding {
7915                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
7916                });
7917            }
7918            fidl::decode!(Usage2, D, &mut self.usage, decoder, offset + 0, _depth)?;
7919            fidl::decode!(f32, D, &mut self.gain_db, decoder, offset + 16, _depth)?;
7920            Ok(())
7921        }
7922    }
7923
7924    impl fidl::encoding::ValueTypeMarker for AudioCoreGetVolumeFromDbRequest {
7925        type Borrowed<'a> = &'a Self;
7926        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7927            value
7928        }
7929    }
7930
7931    unsafe impl fidl::encoding::TypeMarker for AudioCoreGetVolumeFromDbRequest {
7932        type Owned = Self;
7933
7934        #[inline(always)]
7935        fn inline_align(_context: fidl::encoding::Context) -> usize {
7936            8
7937        }
7938
7939        #[inline(always)]
7940        fn inline_size(_context: fidl::encoding::Context) -> usize {
7941            24
7942        }
7943    }
7944
7945    unsafe impl<D: fidl::encoding::ResourceDialect>
7946        fidl::encoding::Encode<AudioCoreGetVolumeFromDbRequest, D>
7947        for &AudioCoreGetVolumeFromDbRequest
7948    {
7949        #[inline]
7950        unsafe fn encode(
7951            self,
7952            encoder: &mut fidl::encoding::Encoder<'_, D>,
7953            offset: usize,
7954            _depth: fidl::encoding::Depth,
7955        ) -> fidl::Result<()> {
7956            encoder.debug_check_bounds::<AudioCoreGetVolumeFromDbRequest>(offset);
7957            // Delegate to tuple encoding.
7958            fidl::encoding::Encode::<AudioCoreGetVolumeFromDbRequest, D>::encode(
7959                (
7960                    <Usage as fidl::encoding::ValueTypeMarker>::borrow(&self.usage),
7961                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.gain_db),
7962                ),
7963                encoder,
7964                offset,
7965                _depth,
7966            )
7967        }
7968    }
7969    unsafe impl<
7970        D: fidl::encoding::ResourceDialect,
7971        T0: fidl::encoding::Encode<Usage, D>,
7972        T1: fidl::encoding::Encode<f32, D>,
7973    > fidl::encoding::Encode<AudioCoreGetVolumeFromDbRequest, D> for (T0, T1)
7974    {
7975        #[inline]
7976        unsafe fn encode(
7977            self,
7978            encoder: &mut fidl::encoding::Encoder<'_, D>,
7979            offset: usize,
7980            depth: fidl::encoding::Depth,
7981        ) -> fidl::Result<()> {
7982            encoder.debug_check_bounds::<AudioCoreGetVolumeFromDbRequest>(offset);
7983            // Zero out padding regions. There's no need to apply masks
7984            // because the unmasked parts will be overwritten by fields.
7985            unsafe {
7986                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
7987                (ptr as *mut u64).write_unaligned(0);
7988            }
7989            // Write the fields.
7990            self.0.encode(encoder, offset + 0, depth)?;
7991            self.1.encode(encoder, offset + 16, depth)?;
7992            Ok(())
7993        }
7994    }
7995
7996    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
7997        for AudioCoreGetVolumeFromDbRequest
7998    {
7999        #[inline(always)]
8000        fn new_empty() -> Self {
8001            Self { usage: fidl::new_empty!(Usage, D), gain_db: fidl::new_empty!(f32, D) }
8002        }
8003
8004        #[inline]
8005        unsafe fn decode(
8006            &mut self,
8007            decoder: &mut fidl::encoding::Decoder<'_, D>,
8008            offset: usize,
8009            _depth: fidl::encoding::Depth,
8010        ) -> fidl::Result<()> {
8011            decoder.debug_check_bounds::<Self>(offset);
8012            // Verify that padding bytes are zero.
8013            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
8014            let padval = unsafe { (ptr as *const u64).read_unaligned() };
8015            let mask = 0xffffffff00000000u64;
8016            let maskedval = padval & mask;
8017            if maskedval != 0 {
8018                return Err(fidl::Error::NonZeroPadding {
8019                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
8020                });
8021            }
8022            fidl::decode!(Usage, D, &mut self.usage, decoder, offset + 0, _depth)?;
8023            fidl::decode!(f32, D, &mut self.gain_db, decoder, offset + 16, _depth)?;
8024            Ok(())
8025        }
8026    }
8027
8028    impl fidl::encoding::ValueTypeMarker for AudioCoreGetVolumeFromDbResponse {
8029        type Borrowed<'a> = &'a Self;
8030        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8031            value
8032        }
8033    }
8034
8035    unsafe impl fidl::encoding::TypeMarker for AudioCoreGetVolumeFromDbResponse {
8036        type Owned = Self;
8037
8038        #[inline(always)]
8039        fn inline_align(_context: fidl::encoding::Context) -> usize {
8040            4
8041        }
8042
8043        #[inline(always)]
8044        fn inline_size(_context: fidl::encoding::Context) -> usize {
8045            4
8046        }
8047    }
8048
8049    unsafe impl<D: fidl::encoding::ResourceDialect>
8050        fidl::encoding::Encode<AudioCoreGetVolumeFromDbResponse, D>
8051        for &AudioCoreGetVolumeFromDbResponse
8052    {
8053        #[inline]
8054        unsafe fn encode(
8055            self,
8056            encoder: &mut fidl::encoding::Encoder<'_, D>,
8057            offset: usize,
8058            _depth: fidl::encoding::Depth,
8059        ) -> fidl::Result<()> {
8060            encoder.debug_check_bounds::<AudioCoreGetVolumeFromDbResponse>(offset);
8061            // Delegate to tuple encoding.
8062            fidl::encoding::Encode::<AudioCoreGetVolumeFromDbResponse, D>::encode(
8063                (<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.volume),),
8064                encoder,
8065                offset,
8066                _depth,
8067            )
8068        }
8069    }
8070    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f32, D>>
8071        fidl::encoding::Encode<AudioCoreGetVolumeFromDbResponse, D> for (T0,)
8072    {
8073        #[inline]
8074        unsafe fn encode(
8075            self,
8076            encoder: &mut fidl::encoding::Encoder<'_, D>,
8077            offset: usize,
8078            depth: fidl::encoding::Depth,
8079        ) -> fidl::Result<()> {
8080            encoder.debug_check_bounds::<AudioCoreGetVolumeFromDbResponse>(offset);
8081            // Zero out padding regions. There's no need to apply masks
8082            // because the unmasked parts will be overwritten by fields.
8083            // Write the fields.
8084            self.0.encode(encoder, offset + 0, depth)?;
8085            Ok(())
8086        }
8087    }
8088
8089    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
8090        for AudioCoreGetVolumeFromDbResponse
8091    {
8092        #[inline(always)]
8093        fn new_empty() -> Self {
8094            Self { volume: fidl::new_empty!(f32, D) }
8095        }
8096
8097        #[inline]
8098        unsafe fn decode(
8099            &mut self,
8100            decoder: &mut fidl::encoding::Decoder<'_, D>,
8101            offset: usize,
8102            _depth: fidl::encoding::Depth,
8103        ) -> fidl::Result<()> {
8104            decoder.debug_check_bounds::<Self>(offset);
8105            // Verify that padding bytes are zero.
8106            fidl::decode!(f32, D, &mut self.volume, decoder, offset + 0, _depth)?;
8107            Ok(())
8108        }
8109    }
8110
8111    impl fidl::encoding::ValueTypeMarker for AudioCoreSetCaptureUsageGain2Request {
8112        type Borrowed<'a> = &'a Self;
8113        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8114            value
8115        }
8116    }
8117
8118    unsafe impl fidl::encoding::TypeMarker for AudioCoreSetCaptureUsageGain2Request {
8119        type Owned = Self;
8120
8121        #[inline(always)]
8122        fn inline_align(_context: fidl::encoding::Context) -> usize {
8123            4
8124        }
8125
8126        #[inline(always)]
8127        fn inline_size(_context: fidl::encoding::Context) -> usize {
8128            8
8129        }
8130    }
8131
8132    unsafe impl<D: fidl::encoding::ResourceDialect>
8133        fidl::encoding::Encode<AudioCoreSetCaptureUsageGain2Request, D>
8134        for &AudioCoreSetCaptureUsageGain2Request
8135    {
8136        #[inline]
8137        unsafe fn encode(
8138            self,
8139            encoder: &mut fidl::encoding::Encoder<'_, D>,
8140            offset: usize,
8141            _depth: fidl::encoding::Depth,
8142        ) -> fidl::Result<()> {
8143            encoder.debug_check_bounds::<AudioCoreSetCaptureUsageGain2Request>(offset);
8144            // Delegate to tuple encoding.
8145            fidl::encoding::Encode::<AudioCoreSetCaptureUsageGain2Request, D>::encode(
8146                (
8147                    <AudioCaptureUsage2 as fidl::encoding::ValueTypeMarker>::borrow(&self.usage),
8148                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.gain_db),
8149                ),
8150                encoder,
8151                offset,
8152                _depth,
8153            )
8154        }
8155    }
8156    unsafe impl<
8157        D: fidl::encoding::ResourceDialect,
8158        T0: fidl::encoding::Encode<AudioCaptureUsage2, D>,
8159        T1: fidl::encoding::Encode<f32, D>,
8160    > fidl::encoding::Encode<AudioCoreSetCaptureUsageGain2Request, D> for (T0, T1)
8161    {
8162        #[inline]
8163        unsafe fn encode(
8164            self,
8165            encoder: &mut fidl::encoding::Encoder<'_, D>,
8166            offset: usize,
8167            depth: fidl::encoding::Depth,
8168        ) -> fidl::Result<()> {
8169            encoder.debug_check_bounds::<AudioCoreSetCaptureUsageGain2Request>(offset);
8170            // Zero out padding regions. There's no need to apply masks
8171            // because the unmasked parts will be overwritten by fields.
8172            // Write the fields.
8173            self.0.encode(encoder, offset + 0, depth)?;
8174            self.1.encode(encoder, offset + 4, depth)?;
8175            Ok(())
8176        }
8177    }
8178
8179    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
8180        for AudioCoreSetCaptureUsageGain2Request
8181    {
8182        #[inline(always)]
8183        fn new_empty() -> Self {
8184            Self {
8185                usage: fidl::new_empty!(AudioCaptureUsage2, D),
8186                gain_db: fidl::new_empty!(f32, D),
8187            }
8188        }
8189
8190        #[inline]
8191        unsafe fn decode(
8192            &mut self,
8193            decoder: &mut fidl::encoding::Decoder<'_, D>,
8194            offset: usize,
8195            _depth: fidl::encoding::Depth,
8196        ) -> fidl::Result<()> {
8197            decoder.debug_check_bounds::<Self>(offset);
8198            // Verify that padding bytes are zero.
8199            fidl::decode!(AudioCaptureUsage2, D, &mut self.usage, decoder, offset + 0, _depth)?;
8200            fidl::decode!(f32, D, &mut self.gain_db, decoder, offset + 4, _depth)?;
8201            Ok(())
8202        }
8203    }
8204
8205    impl fidl::encoding::ValueTypeMarker for AudioCoreSetCaptureUsageGainRequest {
8206        type Borrowed<'a> = &'a Self;
8207        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8208            value
8209        }
8210    }
8211
8212    unsafe impl fidl::encoding::TypeMarker for AudioCoreSetCaptureUsageGainRequest {
8213        type Owned = Self;
8214
8215        #[inline(always)]
8216        fn inline_align(_context: fidl::encoding::Context) -> usize {
8217            4
8218        }
8219
8220        #[inline(always)]
8221        fn inline_size(_context: fidl::encoding::Context) -> usize {
8222            8
8223        }
8224    }
8225
8226    unsafe impl<D: fidl::encoding::ResourceDialect>
8227        fidl::encoding::Encode<AudioCoreSetCaptureUsageGainRequest, D>
8228        for &AudioCoreSetCaptureUsageGainRequest
8229    {
8230        #[inline]
8231        unsafe fn encode(
8232            self,
8233            encoder: &mut fidl::encoding::Encoder<'_, D>,
8234            offset: usize,
8235            _depth: fidl::encoding::Depth,
8236        ) -> fidl::Result<()> {
8237            encoder.debug_check_bounds::<AudioCoreSetCaptureUsageGainRequest>(offset);
8238            // Delegate to tuple encoding.
8239            fidl::encoding::Encode::<AudioCoreSetCaptureUsageGainRequest, D>::encode(
8240                (
8241                    <AudioCaptureUsage as fidl::encoding::ValueTypeMarker>::borrow(&self.usage),
8242                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.gain_db),
8243                ),
8244                encoder,
8245                offset,
8246                _depth,
8247            )
8248        }
8249    }
8250    unsafe impl<
8251        D: fidl::encoding::ResourceDialect,
8252        T0: fidl::encoding::Encode<AudioCaptureUsage, D>,
8253        T1: fidl::encoding::Encode<f32, D>,
8254    > fidl::encoding::Encode<AudioCoreSetCaptureUsageGainRequest, D> for (T0, T1)
8255    {
8256        #[inline]
8257        unsafe fn encode(
8258            self,
8259            encoder: &mut fidl::encoding::Encoder<'_, D>,
8260            offset: usize,
8261            depth: fidl::encoding::Depth,
8262        ) -> fidl::Result<()> {
8263            encoder.debug_check_bounds::<AudioCoreSetCaptureUsageGainRequest>(offset);
8264            // Zero out padding regions. There's no need to apply masks
8265            // because the unmasked parts will be overwritten by fields.
8266            // Write the fields.
8267            self.0.encode(encoder, offset + 0, depth)?;
8268            self.1.encode(encoder, offset + 4, depth)?;
8269            Ok(())
8270        }
8271    }
8272
8273    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
8274        for AudioCoreSetCaptureUsageGainRequest
8275    {
8276        #[inline(always)]
8277        fn new_empty() -> Self {
8278            Self {
8279                usage: fidl::new_empty!(AudioCaptureUsage, D),
8280                gain_db: fidl::new_empty!(f32, D),
8281            }
8282        }
8283
8284        #[inline]
8285        unsafe fn decode(
8286            &mut self,
8287            decoder: &mut fidl::encoding::Decoder<'_, D>,
8288            offset: usize,
8289            _depth: fidl::encoding::Depth,
8290        ) -> fidl::Result<()> {
8291            decoder.debug_check_bounds::<Self>(offset);
8292            // Verify that padding bytes are zero.
8293            fidl::decode!(AudioCaptureUsage, D, &mut self.usage, decoder, offset + 0, _depth)?;
8294            fidl::decode!(f32, D, &mut self.gain_db, decoder, offset + 4, _depth)?;
8295            Ok(())
8296        }
8297    }
8298
8299    impl fidl::encoding::ValueTypeMarker for AudioCoreSetInteraction2Request {
8300        type Borrowed<'a> = &'a Self;
8301        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8302            value
8303        }
8304    }
8305
8306    unsafe impl fidl::encoding::TypeMarker for AudioCoreSetInteraction2Request {
8307        type Owned = Self;
8308
8309        #[inline(always)]
8310        fn inline_align(_context: fidl::encoding::Context) -> usize {
8311            8
8312        }
8313
8314        #[inline(always)]
8315        fn inline_size(_context: fidl::encoding::Context) -> usize {
8316            40
8317        }
8318    }
8319
8320    unsafe impl<D: fidl::encoding::ResourceDialect>
8321        fidl::encoding::Encode<AudioCoreSetInteraction2Request, D>
8322        for &AudioCoreSetInteraction2Request
8323    {
8324        #[inline]
8325        unsafe fn encode(
8326            self,
8327            encoder: &mut fidl::encoding::Encoder<'_, D>,
8328            offset: usize,
8329            _depth: fidl::encoding::Depth,
8330        ) -> fidl::Result<()> {
8331            encoder.debug_check_bounds::<AudioCoreSetInteraction2Request>(offset);
8332            // Delegate to tuple encoding.
8333            fidl::encoding::Encode::<AudioCoreSetInteraction2Request, D>::encode(
8334                (
8335                    <Usage2 as fidl::encoding::ValueTypeMarker>::borrow(&self.active),
8336                    <Usage2 as fidl::encoding::ValueTypeMarker>::borrow(&self.affected),
8337                    <Behavior as fidl::encoding::ValueTypeMarker>::borrow(&self.behavior),
8338                ),
8339                encoder,
8340                offset,
8341                _depth,
8342            )
8343        }
8344    }
8345    unsafe impl<
8346        D: fidl::encoding::ResourceDialect,
8347        T0: fidl::encoding::Encode<Usage2, D>,
8348        T1: fidl::encoding::Encode<Usage2, D>,
8349        T2: fidl::encoding::Encode<Behavior, D>,
8350    > fidl::encoding::Encode<AudioCoreSetInteraction2Request, D> for (T0, T1, T2)
8351    {
8352        #[inline]
8353        unsafe fn encode(
8354            self,
8355            encoder: &mut fidl::encoding::Encoder<'_, D>,
8356            offset: usize,
8357            depth: fidl::encoding::Depth,
8358        ) -> fidl::Result<()> {
8359            encoder.debug_check_bounds::<AudioCoreSetInteraction2Request>(offset);
8360            // Zero out padding regions. There's no need to apply masks
8361            // because the unmasked parts will be overwritten by fields.
8362            unsafe {
8363                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
8364                (ptr as *mut u64).write_unaligned(0);
8365            }
8366            // Write the fields.
8367            self.0.encode(encoder, offset + 0, depth)?;
8368            self.1.encode(encoder, offset + 16, depth)?;
8369            self.2.encode(encoder, offset + 32, depth)?;
8370            Ok(())
8371        }
8372    }
8373
8374    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
8375        for AudioCoreSetInteraction2Request
8376    {
8377        #[inline(always)]
8378        fn new_empty() -> Self {
8379            Self {
8380                active: fidl::new_empty!(Usage2, D),
8381                affected: fidl::new_empty!(Usage2, D),
8382                behavior: fidl::new_empty!(Behavior, D),
8383            }
8384        }
8385
8386        #[inline]
8387        unsafe fn decode(
8388            &mut self,
8389            decoder: &mut fidl::encoding::Decoder<'_, D>,
8390            offset: usize,
8391            _depth: fidl::encoding::Depth,
8392        ) -> fidl::Result<()> {
8393            decoder.debug_check_bounds::<Self>(offset);
8394            // Verify that padding bytes are zero.
8395            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
8396            let padval = unsafe { (ptr as *const u64).read_unaligned() };
8397            let mask = 0xffffffff00000000u64;
8398            let maskedval = padval & mask;
8399            if maskedval != 0 {
8400                return Err(fidl::Error::NonZeroPadding {
8401                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
8402                });
8403            }
8404            fidl::decode!(Usage2, D, &mut self.active, decoder, offset + 0, _depth)?;
8405            fidl::decode!(Usage2, D, &mut self.affected, decoder, offset + 16, _depth)?;
8406            fidl::decode!(Behavior, D, &mut self.behavior, decoder, offset + 32, _depth)?;
8407            Ok(())
8408        }
8409    }
8410
8411    impl fidl::encoding::ValueTypeMarker for AudioCoreSetInteractionRequest {
8412        type Borrowed<'a> = &'a Self;
8413        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8414            value
8415        }
8416    }
8417
8418    unsafe impl fidl::encoding::TypeMarker for AudioCoreSetInteractionRequest {
8419        type Owned = Self;
8420
8421        #[inline(always)]
8422        fn inline_align(_context: fidl::encoding::Context) -> usize {
8423            8
8424        }
8425
8426        #[inline(always)]
8427        fn inline_size(_context: fidl::encoding::Context) -> usize {
8428            40
8429        }
8430    }
8431
8432    unsafe impl<D: fidl::encoding::ResourceDialect>
8433        fidl::encoding::Encode<AudioCoreSetInteractionRequest, D>
8434        for &AudioCoreSetInteractionRequest
8435    {
8436        #[inline]
8437        unsafe fn encode(
8438            self,
8439            encoder: &mut fidl::encoding::Encoder<'_, D>,
8440            offset: usize,
8441            _depth: fidl::encoding::Depth,
8442        ) -> fidl::Result<()> {
8443            encoder.debug_check_bounds::<AudioCoreSetInteractionRequest>(offset);
8444            // Delegate to tuple encoding.
8445            fidl::encoding::Encode::<AudioCoreSetInteractionRequest, D>::encode(
8446                (
8447                    <Usage as fidl::encoding::ValueTypeMarker>::borrow(&self.active),
8448                    <Usage as fidl::encoding::ValueTypeMarker>::borrow(&self.affected),
8449                    <Behavior as fidl::encoding::ValueTypeMarker>::borrow(&self.behavior),
8450                ),
8451                encoder,
8452                offset,
8453                _depth,
8454            )
8455        }
8456    }
8457    unsafe impl<
8458        D: fidl::encoding::ResourceDialect,
8459        T0: fidl::encoding::Encode<Usage, D>,
8460        T1: fidl::encoding::Encode<Usage, D>,
8461        T2: fidl::encoding::Encode<Behavior, D>,
8462    > fidl::encoding::Encode<AudioCoreSetInteractionRequest, D> for (T0, T1, T2)
8463    {
8464        #[inline]
8465        unsafe fn encode(
8466            self,
8467            encoder: &mut fidl::encoding::Encoder<'_, D>,
8468            offset: usize,
8469            depth: fidl::encoding::Depth,
8470        ) -> fidl::Result<()> {
8471            encoder.debug_check_bounds::<AudioCoreSetInteractionRequest>(offset);
8472            // Zero out padding regions. There's no need to apply masks
8473            // because the unmasked parts will be overwritten by fields.
8474            unsafe {
8475                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
8476                (ptr as *mut u64).write_unaligned(0);
8477            }
8478            // Write the fields.
8479            self.0.encode(encoder, offset + 0, depth)?;
8480            self.1.encode(encoder, offset + 16, depth)?;
8481            self.2.encode(encoder, offset + 32, depth)?;
8482            Ok(())
8483        }
8484    }
8485
8486    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
8487        for AudioCoreSetInteractionRequest
8488    {
8489        #[inline(always)]
8490        fn new_empty() -> Self {
8491            Self {
8492                active: fidl::new_empty!(Usage, D),
8493                affected: fidl::new_empty!(Usage, D),
8494                behavior: fidl::new_empty!(Behavior, D),
8495            }
8496        }
8497
8498        #[inline]
8499        unsafe fn decode(
8500            &mut self,
8501            decoder: &mut fidl::encoding::Decoder<'_, D>,
8502            offset: usize,
8503            _depth: fidl::encoding::Depth,
8504        ) -> fidl::Result<()> {
8505            decoder.debug_check_bounds::<Self>(offset);
8506            // Verify that padding bytes are zero.
8507            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
8508            let padval = unsafe { (ptr as *const u64).read_unaligned() };
8509            let mask = 0xffffffff00000000u64;
8510            let maskedval = padval & mask;
8511            if maskedval != 0 {
8512                return Err(fidl::Error::NonZeroPadding {
8513                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
8514                });
8515            }
8516            fidl::decode!(Usage, D, &mut self.active, decoder, offset + 0, _depth)?;
8517            fidl::decode!(Usage, D, &mut self.affected, decoder, offset + 16, _depth)?;
8518            fidl::decode!(Behavior, D, &mut self.behavior, decoder, offset + 32, _depth)?;
8519            Ok(())
8520        }
8521    }
8522
8523    impl fidl::encoding::ValueTypeMarker for AudioCoreSetRenderUsageGain2Request {
8524        type Borrowed<'a> = &'a Self;
8525        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8526            value
8527        }
8528    }
8529
8530    unsafe impl fidl::encoding::TypeMarker for AudioCoreSetRenderUsageGain2Request {
8531        type Owned = Self;
8532
8533        #[inline(always)]
8534        fn inline_align(_context: fidl::encoding::Context) -> usize {
8535            4
8536        }
8537
8538        #[inline(always)]
8539        fn inline_size(_context: fidl::encoding::Context) -> usize {
8540            8
8541        }
8542    }
8543
8544    unsafe impl<D: fidl::encoding::ResourceDialect>
8545        fidl::encoding::Encode<AudioCoreSetRenderUsageGain2Request, D>
8546        for &AudioCoreSetRenderUsageGain2Request
8547    {
8548        #[inline]
8549        unsafe fn encode(
8550            self,
8551            encoder: &mut fidl::encoding::Encoder<'_, D>,
8552            offset: usize,
8553            _depth: fidl::encoding::Depth,
8554        ) -> fidl::Result<()> {
8555            encoder.debug_check_bounds::<AudioCoreSetRenderUsageGain2Request>(offset);
8556            // Delegate to tuple encoding.
8557            fidl::encoding::Encode::<AudioCoreSetRenderUsageGain2Request, D>::encode(
8558                (
8559                    <AudioRenderUsage2 as fidl::encoding::ValueTypeMarker>::borrow(&self.usage),
8560                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.gain_db),
8561                ),
8562                encoder,
8563                offset,
8564                _depth,
8565            )
8566        }
8567    }
8568    unsafe impl<
8569        D: fidl::encoding::ResourceDialect,
8570        T0: fidl::encoding::Encode<AudioRenderUsage2, D>,
8571        T1: fidl::encoding::Encode<f32, D>,
8572    > fidl::encoding::Encode<AudioCoreSetRenderUsageGain2Request, D> for (T0, T1)
8573    {
8574        #[inline]
8575        unsafe fn encode(
8576            self,
8577            encoder: &mut fidl::encoding::Encoder<'_, D>,
8578            offset: usize,
8579            depth: fidl::encoding::Depth,
8580        ) -> fidl::Result<()> {
8581            encoder.debug_check_bounds::<AudioCoreSetRenderUsageGain2Request>(offset);
8582            // Zero out padding regions. There's no need to apply masks
8583            // because the unmasked parts will be overwritten by fields.
8584            // Write the fields.
8585            self.0.encode(encoder, offset + 0, depth)?;
8586            self.1.encode(encoder, offset + 4, depth)?;
8587            Ok(())
8588        }
8589    }
8590
8591    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
8592        for AudioCoreSetRenderUsageGain2Request
8593    {
8594        #[inline(always)]
8595        fn new_empty() -> Self {
8596            Self {
8597                usage: fidl::new_empty!(AudioRenderUsage2, D),
8598                gain_db: fidl::new_empty!(f32, D),
8599            }
8600        }
8601
8602        #[inline]
8603        unsafe fn decode(
8604            &mut self,
8605            decoder: &mut fidl::encoding::Decoder<'_, D>,
8606            offset: usize,
8607            _depth: fidl::encoding::Depth,
8608        ) -> fidl::Result<()> {
8609            decoder.debug_check_bounds::<Self>(offset);
8610            // Verify that padding bytes are zero.
8611            fidl::decode!(AudioRenderUsage2, D, &mut self.usage, decoder, offset + 0, _depth)?;
8612            fidl::decode!(f32, D, &mut self.gain_db, decoder, offset + 4, _depth)?;
8613            Ok(())
8614        }
8615    }
8616
8617    impl fidl::encoding::ValueTypeMarker for AudioCoreSetRenderUsageGainRequest {
8618        type Borrowed<'a> = &'a Self;
8619        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8620            value
8621        }
8622    }
8623
8624    unsafe impl fidl::encoding::TypeMarker for AudioCoreSetRenderUsageGainRequest {
8625        type Owned = Self;
8626
8627        #[inline(always)]
8628        fn inline_align(_context: fidl::encoding::Context) -> usize {
8629            4
8630        }
8631
8632        #[inline(always)]
8633        fn inline_size(_context: fidl::encoding::Context) -> usize {
8634            8
8635        }
8636    }
8637
8638    unsafe impl<D: fidl::encoding::ResourceDialect>
8639        fidl::encoding::Encode<AudioCoreSetRenderUsageGainRequest, D>
8640        for &AudioCoreSetRenderUsageGainRequest
8641    {
8642        #[inline]
8643        unsafe fn encode(
8644            self,
8645            encoder: &mut fidl::encoding::Encoder<'_, D>,
8646            offset: usize,
8647            _depth: fidl::encoding::Depth,
8648        ) -> fidl::Result<()> {
8649            encoder.debug_check_bounds::<AudioCoreSetRenderUsageGainRequest>(offset);
8650            // Delegate to tuple encoding.
8651            fidl::encoding::Encode::<AudioCoreSetRenderUsageGainRequest, D>::encode(
8652                (
8653                    <AudioRenderUsage as fidl::encoding::ValueTypeMarker>::borrow(&self.usage),
8654                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.gain_db),
8655                ),
8656                encoder,
8657                offset,
8658                _depth,
8659            )
8660        }
8661    }
8662    unsafe impl<
8663        D: fidl::encoding::ResourceDialect,
8664        T0: fidl::encoding::Encode<AudioRenderUsage, D>,
8665        T1: fidl::encoding::Encode<f32, D>,
8666    > fidl::encoding::Encode<AudioCoreSetRenderUsageGainRequest, D> for (T0, T1)
8667    {
8668        #[inline]
8669        unsafe fn encode(
8670            self,
8671            encoder: &mut fidl::encoding::Encoder<'_, D>,
8672            offset: usize,
8673            depth: fidl::encoding::Depth,
8674        ) -> fidl::Result<()> {
8675            encoder.debug_check_bounds::<AudioCoreSetRenderUsageGainRequest>(offset);
8676            // Zero out padding regions. There's no need to apply masks
8677            // because the unmasked parts will be overwritten by fields.
8678            // Write the fields.
8679            self.0.encode(encoder, offset + 0, depth)?;
8680            self.1.encode(encoder, offset + 4, depth)?;
8681            Ok(())
8682        }
8683    }
8684
8685    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
8686        for AudioCoreSetRenderUsageGainRequest
8687    {
8688        #[inline(always)]
8689        fn new_empty() -> Self {
8690            Self { usage: fidl::new_empty!(AudioRenderUsage, D), gain_db: fidl::new_empty!(f32, D) }
8691        }
8692
8693        #[inline]
8694        unsafe fn decode(
8695            &mut self,
8696            decoder: &mut fidl::encoding::Decoder<'_, D>,
8697            offset: usize,
8698            _depth: fidl::encoding::Depth,
8699        ) -> fidl::Result<()> {
8700            decoder.debug_check_bounds::<Self>(offset);
8701            // Verify that padding bytes are zero.
8702            fidl::decode!(AudioRenderUsage, D, &mut self.usage, decoder, offset + 0, _depth)?;
8703            fidl::decode!(f32, D, &mut self.gain_db, decoder, offset + 4, _depth)?;
8704            Ok(())
8705        }
8706    }
8707
8708    impl fidl::encoding::ValueTypeMarker for AudioCoreGetDbFromVolume2Response {
8709        type Borrowed<'a> = &'a Self;
8710        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8711            value
8712        }
8713    }
8714
8715    unsafe impl fidl::encoding::TypeMarker for AudioCoreGetDbFromVolume2Response {
8716        type Owned = Self;
8717
8718        #[inline(always)]
8719        fn inline_align(_context: fidl::encoding::Context) -> usize {
8720            4
8721        }
8722
8723        #[inline(always)]
8724        fn inline_size(_context: fidl::encoding::Context) -> usize {
8725            4
8726        }
8727    }
8728
8729    unsafe impl<D: fidl::encoding::ResourceDialect>
8730        fidl::encoding::Encode<AudioCoreGetDbFromVolume2Response, D>
8731        for &AudioCoreGetDbFromVolume2Response
8732    {
8733        #[inline]
8734        unsafe fn encode(
8735            self,
8736            encoder: &mut fidl::encoding::Encoder<'_, D>,
8737            offset: usize,
8738            _depth: fidl::encoding::Depth,
8739        ) -> fidl::Result<()> {
8740            encoder.debug_check_bounds::<AudioCoreGetDbFromVolume2Response>(offset);
8741            // Delegate to tuple encoding.
8742            fidl::encoding::Encode::<AudioCoreGetDbFromVolume2Response, D>::encode(
8743                (<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.gain_db),),
8744                encoder,
8745                offset,
8746                _depth,
8747            )
8748        }
8749    }
8750    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f32, D>>
8751        fidl::encoding::Encode<AudioCoreGetDbFromVolume2Response, D> for (T0,)
8752    {
8753        #[inline]
8754        unsafe fn encode(
8755            self,
8756            encoder: &mut fidl::encoding::Encoder<'_, D>,
8757            offset: usize,
8758            depth: fidl::encoding::Depth,
8759        ) -> fidl::Result<()> {
8760            encoder.debug_check_bounds::<AudioCoreGetDbFromVolume2Response>(offset);
8761            // Zero out padding regions. There's no need to apply masks
8762            // because the unmasked parts will be overwritten by fields.
8763            // Write the fields.
8764            self.0.encode(encoder, offset + 0, depth)?;
8765            Ok(())
8766        }
8767    }
8768
8769    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
8770        for AudioCoreGetDbFromVolume2Response
8771    {
8772        #[inline(always)]
8773        fn new_empty() -> Self {
8774            Self { gain_db: fidl::new_empty!(f32, D) }
8775        }
8776
8777        #[inline]
8778        unsafe fn decode(
8779            &mut self,
8780            decoder: &mut fidl::encoding::Decoder<'_, D>,
8781            offset: usize,
8782            _depth: fidl::encoding::Depth,
8783        ) -> fidl::Result<()> {
8784            decoder.debug_check_bounds::<Self>(offset);
8785            // Verify that padding bytes are zero.
8786            fidl::decode!(f32, D, &mut self.gain_db, decoder, offset + 0, _depth)?;
8787            Ok(())
8788        }
8789    }
8790
8791    impl fidl::encoding::ValueTypeMarker for AudioCoreGetVolumeFromDb2Response {
8792        type Borrowed<'a> = &'a Self;
8793        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8794            value
8795        }
8796    }
8797
8798    unsafe impl fidl::encoding::TypeMarker for AudioCoreGetVolumeFromDb2Response {
8799        type Owned = Self;
8800
8801        #[inline(always)]
8802        fn inline_align(_context: fidl::encoding::Context) -> usize {
8803            4
8804        }
8805
8806        #[inline(always)]
8807        fn inline_size(_context: fidl::encoding::Context) -> usize {
8808            4
8809        }
8810    }
8811
8812    unsafe impl<D: fidl::encoding::ResourceDialect>
8813        fidl::encoding::Encode<AudioCoreGetVolumeFromDb2Response, D>
8814        for &AudioCoreGetVolumeFromDb2Response
8815    {
8816        #[inline]
8817        unsafe fn encode(
8818            self,
8819            encoder: &mut fidl::encoding::Encoder<'_, D>,
8820            offset: usize,
8821            _depth: fidl::encoding::Depth,
8822        ) -> fidl::Result<()> {
8823            encoder.debug_check_bounds::<AudioCoreGetVolumeFromDb2Response>(offset);
8824            // Delegate to tuple encoding.
8825            fidl::encoding::Encode::<AudioCoreGetVolumeFromDb2Response, D>::encode(
8826                (<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.volume),),
8827                encoder,
8828                offset,
8829                _depth,
8830            )
8831        }
8832    }
8833    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f32, D>>
8834        fidl::encoding::Encode<AudioCoreGetVolumeFromDb2Response, D> for (T0,)
8835    {
8836        #[inline]
8837        unsafe fn encode(
8838            self,
8839            encoder: &mut fidl::encoding::Encoder<'_, D>,
8840            offset: usize,
8841            depth: fidl::encoding::Depth,
8842        ) -> fidl::Result<()> {
8843            encoder.debug_check_bounds::<AudioCoreGetVolumeFromDb2Response>(offset);
8844            // Zero out padding regions. There's no need to apply masks
8845            // because the unmasked parts will be overwritten by fields.
8846            // Write the fields.
8847            self.0.encode(encoder, offset + 0, depth)?;
8848            Ok(())
8849        }
8850    }
8851
8852    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
8853        for AudioCoreGetVolumeFromDb2Response
8854    {
8855        #[inline(always)]
8856        fn new_empty() -> Self {
8857            Self { volume: fidl::new_empty!(f32, D) }
8858        }
8859
8860        #[inline]
8861        unsafe fn decode(
8862            &mut self,
8863            decoder: &mut fidl::encoding::Decoder<'_, D>,
8864            offset: usize,
8865            _depth: fidl::encoding::Depth,
8866        ) -> fidl::Result<()> {
8867            decoder.debug_check_bounds::<Self>(offset);
8868            // Verify that padding bytes are zero.
8869            fidl::decode!(f32, D, &mut self.volume, decoder, offset + 0, _depth)?;
8870            Ok(())
8871        }
8872    }
8873
8874    impl fidl::encoding::ValueTypeMarker for AudioDeviceEnumeratorGetDeviceGainRequest {
8875        type Borrowed<'a> = &'a Self;
8876        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8877            value
8878        }
8879    }
8880
8881    unsafe impl fidl::encoding::TypeMarker for AudioDeviceEnumeratorGetDeviceGainRequest {
8882        type Owned = Self;
8883
8884        #[inline(always)]
8885        fn inline_align(_context: fidl::encoding::Context) -> usize {
8886            8
8887        }
8888
8889        #[inline(always)]
8890        fn inline_size(_context: fidl::encoding::Context) -> usize {
8891            8
8892        }
8893        #[inline(always)]
8894        fn encode_is_copy() -> bool {
8895            true
8896        }
8897
8898        #[inline(always)]
8899        fn decode_is_copy() -> bool {
8900            true
8901        }
8902    }
8903
8904    unsafe impl<D: fidl::encoding::ResourceDialect>
8905        fidl::encoding::Encode<AudioDeviceEnumeratorGetDeviceGainRequest, D>
8906        for &AudioDeviceEnumeratorGetDeviceGainRequest
8907    {
8908        #[inline]
8909        unsafe fn encode(
8910            self,
8911            encoder: &mut fidl::encoding::Encoder<'_, D>,
8912            offset: usize,
8913            _depth: fidl::encoding::Depth,
8914        ) -> fidl::Result<()> {
8915            encoder.debug_check_bounds::<AudioDeviceEnumeratorGetDeviceGainRequest>(offset);
8916            unsafe {
8917                // Copy the object into the buffer.
8918                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
8919                (buf_ptr as *mut AudioDeviceEnumeratorGetDeviceGainRequest).write_unaligned(
8920                    (self as *const AudioDeviceEnumeratorGetDeviceGainRequest).read(),
8921                );
8922                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
8923                // done second because the memcpy will write garbage to these bytes.
8924            }
8925            Ok(())
8926        }
8927    }
8928    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
8929        fidl::encoding::Encode<AudioDeviceEnumeratorGetDeviceGainRequest, D> for (T0,)
8930    {
8931        #[inline]
8932        unsafe fn encode(
8933            self,
8934            encoder: &mut fidl::encoding::Encoder<'_, D>,
8935            offset: usize,
8936            depth: fidl::encoding::Depth,
8937        ) -> fidl::Result<()> {
8938            encoder.debug_check_bounds::<AudioDeviceEnumeratorGetDeviceGainRequest>(offset);
8939            // Zero out padding regions. There's no need to apply masks
8940            // because the unmasked parts will be overwritten by fields.
8941            // Write the fields.
8942            self.0.encode(encoder, offset + 0, depth)?;
8943            Ok(())
8944        }
8945    }
8946
8947    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
8948        for AudioDeviceEnumeratorGetDeviceGainRequest
8949    {
8950        #[inline(always)]
8951        fn new_empty() -> Self {
8952            Self { device_token: fidl::new_empty!(u64, D) }
8953        }
8954
8955        #[inline]
8956        unsafe fn decode(
8957            &mut self,
8958            decoder: &mut fidl::encoding::Decoder<'_, D>,
8959            offset: usize,
8960            _depth: fidl::encoding::Depth,
8961        ) -> fidl::Result<()> {
8962            decoder.debug_check_bounds::<Self>(offset);
8963            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
8964            // Verify that padding bytes are zero.
8965            // Copy from the buffer into the object.
8966            unsafe {
8967                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
8968            }
8969            Ok(())
8970        }
8971    }
8972
8973    impl fidl::encoding::ValueTypeMarker for AudioDeviceEnumeratorGetDeviceGainResponse {
8974        type Borrowed<'a> = &'a Self;
8975        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8976            value
8977        }
8978    }
8979
8980    unsafe impl fidl::encoding::TypeMarker for AudioDeviceEnumeratorGetDeviceGainResponse {
8981        type Owned = Self;
8982
8983        #[inline(always)]
8984        fn inline_align(_context: fidl::encoding::Context) -> usize {
8985            8
8986        }
8987
8988        #[inline(always)]
8989        fn inline_size(_context: fidl::encoding::Context) -> usize {
8990            16
8991        }
8992    }
8993
8994    unsafe impl<D: fidl::encoding::ResourceDialect>
8995        fidl::encoding::Encode<AudioDeviceEnumeratorGetDeviceGainResponse, D>
8996        for &AudioDeviceEnumeratorGetDeviceGainResponse
8997    {
8998        #[inline]
8999        unsafe fn encode(
9000            self,
9001            encoder: &mut fidl::encoding::Encoder<'_, D>,
9002            offset: usize,
9003            _depth: fidl::encoding::Depth,
9004        ) -> fidl::Result<()> {
9005            encoder.debug_check_bounds::<AudioDeviceEnumeratorGetDeviceGainResponse>(offset);
9006            // Delegate to tuple encoding.
9007            fidl::encoding::Encode::<AudioDeviceEnumeratorGetDeviceGainResponse, D>::encode(
9008                (
9009                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.device_token),
9010                    <AudioGainInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.gain_info),
9011                ),
9012                encoder,
9013                offset,
9014                _depth,
9015            )
9016        }
9017    }
9018    unsafe impl<
9019        D: fidl::encoding::ResourceDialect,
9020        T0: fidl::encoding::Encode<u64, D>,
9021        T1: fidl::encoding::Encode<AudioGainInfo, D>,
9022    > fidl::encoding::Encode<AudioDeviceEnumeratorGetDeviceGainResponse, D> for (T0, T1)
9023    {
9024        #[inline]
9025        unsafe fn encode(
9026            self,
9027            encoder: &mut fidl::encoding::Encoder<'_, D>,
9028            offset: usize,
9029            depth: fidl::encoding::Depth,
9030        ) -> fidl::Result<()> {
9031            encoder.debug_check_bounds::<AudioDeviceEnumeratorGetDeviceGainResponse>(offset);
9032            // Zero out padding regions. There's no need to apply masks
9033            // because the unmasked parts will be overwritten by fields.
9034            // Write the fields.
9035            self.0.encode(encoder, offset + 0, depth)?;
9036            self.1.encode(encoder, offset + 8, depth)?;
9037            Ok(())
9038        }
9039    }
9040
9041    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
9042        for AudioDeviceEnumeratorGetDeviceGainResponse
9043    {
9044        #[inline(always)]
9045        fn new_empty() -> Self {
9046            Self {
9047                device_token: fidl::new_empty!(u64, D),
9048                gain_info: fidl::new_empty!(AudioGainInfo, D),
9049            }
9050        }
9051
9052        #[inline]
9053        unsafe fn decode(
9054            &mut self,
9055            decoder: &mut fidl::encoding::Decoder<'_, D>,
9056            offset: usize,
9057            _depth: fidl::encoding::Depth,
9058        ) -> fidl::Result<()> {
9059            decoder.debug_check_bounds::<Self>(offset);
9060            // Verify that padding bytes are zero.
9061            fidl::decode!(u64, D, &mut self.device_token, decoder, offset + 0, _depth)?;
9062            fidl::decode!(AudioGainInfo, D, &mut self.gain_info, decoder, offset + 8, _depth)?;
9063            Ok(())
9064        }
9065    }
9066
9067    impl fidl::encoding::ValueTypeMarker for AudioDeviceEnumeratorGetDevicesResponse {
9068        type Borrowed<'a> = &'a Self;
9069        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9070            value
9071        }
9072    }
9073
9074    unsafe impl fidl::encoding::TypeMarker for AudioDeviceEnumeratorGetDevicesResponse {
9075        type Owned = Self;
9076
9077        #[inline(always)]
9078        fn inline_align(_context: fidl::encoding::Context) -> usize {
9079            8
9080        }
9081
9082        #[inline(always)]
9083        fn inline_size(_context: fidl::encoding::Context) -> usize {
9084            16
9085        }
9086    }
9087
9088    unsafe impl<D: fidl::encoding::ResourceDialect>
9089        fidl::encoding::Encode<AudioDeviceEnumeratorGetDevicesResponse, D>
9090        for &AudioDeviceEnumeratorGetDevicesResponse
9091    {
9092        #[inline]
9093        unsafe fn encode(
9094            self,
9095            encoder: &mut fidl::encoding::Encoder<'_, D>,
9096            offset: usize,
9097            _depth: fidl::encoding::Depth,
9098        ) -> fidl::Result<()> {
9099            encoder.debug_check_bounds::<AudioDeviceEnumeratorGetDevicesResponse>(offset);
9100            // Delegate to tuple encoding.
9101            fidl::encoding::Encode::<AudioDeviceEnumeratorGetDevicesResponse, D>::encode(
9102                (
9103                    <fidl::encoding::UnboundedVector<AudioDeviceInfo> as fidl::encoding::ValueTypeMarker>::borrow(&self.devices),
9104                ),
9105                encoder, offset, _depth
9106            )
9107        }
9108    }
9109    unsafe impl<
9110        D: fidl::encoding::ResourceDialect,
9111        T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<AudioDeviceInfo>, D>,
9112    > fidl::encoding::Encode<AudioDeviceEnumeratorGetDevicesResponse, D> for (T0,)
9113    {
9114        #[inline]
9115        unsafe fn encode(
9116            self,
9117            encoder: &mut fidl::encoding::Encoder<'_, D>,
9118            offset: usize,
9119            depth: fidl::encoding::Depth,
9120        ) -> fidl::Result<()> {
9121            encoder.debug_check_bounds::<AudioDeviceEnumeratorGetDevicesResponse>(offset);
9122            // Zero out padding regions. There's no need to apply masks
9123            // because the unmasked parts will be overwritten by fields.
9124            // Write the fields.
9125            self.0.encode(encoder, offset + 0, depth)?;
9126            Ok(())
9127        }
9128    }
9129
9130    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
9131        for AudioDeviceEnumeratorGetDevicesResponse
9132    {
9133        #[inline(always)]
9134        fn new_empty() -> Self {
9135            Self { devices: fidl::new_empty!(fidl::encoding::UnboundedVector<AudioDeviceInfo>, D) }
9136        }
9137
9138        #[inline]
9139        unsafe fn decode(
9140            &mut self,
9141            decoder: &mut fidl::encoding::Decoder<'_, D>,
9142            offset: usize,
9143            _depth: fidl::encoding::Depth,
9144        ) -> fidl::Result<()> {
9145            decoder.debug_check_bounds::<Self>(offset);
9146            // Verify that padding bytes are zero.
9147            fidl::decode!(
9148                fidl::encoding::UnboundedVector<AudioDeviceInfo>,
9149                D,
9150                &mut self.devices,
9151                decoder,
9152                offset + 0,
9153                _depth
9154            )?;
9155            Ok(())
9156        }
9157    }
9158
9159    impl fidl::encoding::ValueTypeMarker for AudioDeviceEnumeratorOnDefaultDeviceChangedRequest {
9160        type Borrowed<'a> = &'a Self;
9161        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9162            value
9163        }
9164    }
9165
9166    unsafe impl fidl::encoding::TypeMarker for AudioDeviceEnumeratorOnDefaultDeviceChangedRequest {
9167        type Owned = Self;
9168
9169        #[inline(always)]
9170        fn inline_align(_context: fidl::encoding::Context) -> usize {
9171            8
9172        }
9173
9174        #[inline(always)]
9175        fn inline_size(_context: fidl::encoding::Context) -> usize {
9176            16
9177        }
9178        #[inline(always)]
9179        fn encode_is_copy() -> bool {
9180            true
9181        }
9182
9183        #[inline(always)]
9184        fn decode_is_copy() -> bool {
9185            true
9186        }
9187    }
9188
9189    unsafe impl<D: fidl::encoding::ResourceDialect>
9190        fidl::encoding::Encode<AudioDeviceEnumeratorOnDefaultDeviceChangedRequest, D>
9191        for &AudioDeviceEnumeratorOnDefaultDeviceChangedRequest
9192    {
9193        #[inline]
9194        unsafe fn encode(
9195            self,
9196            encoder: &mut fidl::encoding::Encoder<'_, D>,
9197            offset: usize,
9198            _depth: fidl::encoding::Depth,
9199        ) -> fidl::Result<()> {
9200            encoder
9201                .debug_check_bounds::<AudioDeviceEnumeratorOnDefaultDeviceChangedRequest>(offset);
9202            unsafe {
9203                // Copy the object into the buffer.
9204                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
9205                (buf_ptr as *mut AudioDeviceEnumeratorOnDefaultDeviceChangedRequest)
9206                    .write_unaligned(
9207                        (self as *const AudioDeviceEnumeratorOnDefaultDeviceChangedRequest).read(),
9208                    );
9209                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
9210                // done second because the memcpy will write garbage to these bytes.
9211            }
9212            Ok(())
9213        }
9214    }
9215    unsafe impl<
9216        D: fidl::encoding::ResourceDialect,
9217        T0: fidl::encoding::Encode<u64, D>,
9218        T1: fidl::encoding::Encode<u64, D>,
9219    > fidl::encoding::Encode<AudioDeviceEnumeratorOnDefaultDeviceChangedRequest, D> for (T0, T1)
9220    {
9221        #[inline]
9222        unsafe fn encode(
9223            self,
9224            encoder: &mut fidl::encoding::Encoder<'_, D>,
9225            offset: usize,
9226            depth: fidl::encoding::Depth,
9227        ) -> fidl::Result<()> {
9228            encoder
9229                .debug_check_bounds::<AudioDeviceEnumeratorOnDefaultDeviceChangedRequest>(offset);
9230            // Zero out padding regions. There's no need to apply masks
9231            // because the unmasked parts will be overwritten by fields.
9232            // Write the fields.
9233            self.0.encode(encoder, offset + 0, depth)?;
9234            self.1.encode(encoder, offset + 8, depth)?;
9235            Ok(())
9236        }
9237    }
9238
9239    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
9240        for AudioDeviceEnumeratorOnDefaultDeviceChangedRequest
9241    {
9242        #[inline(always)]
9243        fn new_empty() -> Self {
9244            Self {
9245                old_default_token: fidl::new_empty!(u64, D),
9246                new_default_token: fidl::new_empty!(u64, D),
9247            }
9248        }
9249
9250        #[inline]
9251        unsafe fn decode(
9252            &mut self,
9253            decoder: &mut fidl::encoding::Decoder<'_, D>,
9254            offset: usize,
9255            _depth: fidl::encoding::Depth,
9256        ) -> fidl::Result<()> {
9257            decoder.debug_check_bounds::<Self>(offset);
9258            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
9259            // Verify that padding bytes are zero.
9260            // Copy from the buffer into the object.
9261            unsafe {
9262                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
9263            }
9264            Ok(())
9265        }
9266    }
9267
9268    impl fidl::encoding::ValueTypeMarker for AudioDeviceEnumeratorOnDeviceAddedRequest {
9269        type Borrowed<'a> = &'a Self;
9270        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9271            value
9272        }
9273    }
9274
9275    unsafe impl fidl::encoding::TypeMarker for AudioDeviceEnumeratorOnDeviceAddedRequest {
9276        type Owned = Self;
9277
9278        #[inline(always)]
9279        fn inline_align(_context: fidl::encoding::Context) -> usize {
9280            8
9281        }
9282
9283        #[inline(always)]
9284        fn inline_size(_context: fidl::encoding::Context) -> usize {
9285            56
9286        }
9287    }
9288
9289    unsafe impl<D: fidl::encoding::ResourceDialect>
9290        fidl::encoding::Encode<AudioDeviceEnumeratorOnDeviceAddedRequest, D>
9291        for &AudioDeviceEnumeratorOnDeviceAddedRequest
9292    {
9293        #[inline]
9294        unsafe fn encode(
9295            self,
9296            encoder: &mut fidl::encoding::Encoder<'_, D>,
9297            offset: usize,
9298            _depth: fidl::encoding::Depth,
9299        ) -> fidl::Result<()> {
9300            encoder.debug_check_bounds::<AudioDeviceEnumeratorOnDeviceAddedRequest>(offset);
9301            // Delegate to tuple encoding.
9302            fidl::encoding::Encode::<AudioDeviceEnumeratorOnDeviceAddedRequest, D>::encode(
9303                (<AudioDeviceInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.device),),
9304                encoder,
9305                offset,
9306                _depth,
9307            )
9308        }
9309    }
9310    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<AudioDeviceInfo, D>>
9311        fidl::encoding::Encode<AudioDeviceEnumeratorOnDeviceAddedRequest, D> for (T0,)
9312    {
9313        #[inline]
9314        unsafe fn encode(
9315            self,
9316            encoder: &mut fidl::encoding::Encoder<'_, D>,
9317            offset: usize,
9318            depth: fidl::encoding::Depth,
9319        ) -> fidl::Result<()> {
9320            encoder.debug_check_bounds::<AudioDeviceEnumeratorOnDeviceAddedRequest>(offset);
9321            // Zero out padding regions. There's no need to apply masks
9322            // because the unmasked parts will be overwritten by fields.
9323            // Write the fields.
9324            self.0.encode(encoder, offset + 0, depth)?;
9325            Ok(())
9326        }
9327    }
9328
9329    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
9330        for AudioDeviceEnumeratorOnDeviceAddedRequest
9331    {
9332        #[inline(always)]
9333        fn new_empty() -> Self {
9334            Self { device: fidl::new_empty!(AudioDeviceInfo, D) }
9335        }
9336
9337        #[inline]
9338        unsafe fn decode(
9339            &mut self,
9340            decoder: &mut fidl::encoding::Decoder<'_, D>,
9341            offset: usize,
9342            _depth: fidl::encoding::Depth,
9343        ) -> fidl::Result<()> {
9344            decoder.debug_check_bounds::<Self>(offset);
9345            // Verify that padding bytes are zero.
9346            fidl::decode!(AudioDeviceInfo, D, &mut self.device, decoder, offset + 0, _depth)?;
9347            Ok(())
9348        }
9349    }
9350
9351    impl fidl::encoding::ValueTypeMarker for AudioDeviceEnumeratorOnDeviceGainChangedRequest {
9352        type Borrowed<'a> = &'a Self;
9353        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9354            value
9355        }
9356    }
9357
9358    unsafe impl fidl::encoding::TypeMarker for AudioDeviceEnumeratorOnDeviceGainChangedRequest {
9359        type Owned = Self;
9360
9361        #[inline(always)]
9362        fn inline_align(_context: fidl::encoding::Context) -> usize {
9363            8
9364        }
9365
9366        #[inline(always)]
9367        fn inline_size(_context: fidl::encoding::Context) -> usize {
9368            16
9369        }
9370    }
9371
9372    unsafe impl<D: fidl::encoding::ResourceDialect>
9373        fidl::encoding::Encode<AudioDeviceEnumeratorOnDeviceGainChangedRequest, D>
9374        for &AudioDeviceEnumeratorOnDeviceGainChangedRequest
9375    {
9376        #[inline]
9377        unsafe fn encode(
9378            self,
9379            encoder: &mut fidl::encoding::Encoder<'_, D>,
9380            offset: usize,
9381            _depth: fidl::encoding::Depth,
9382        ) -> fidl::Result<()> {
9383            encoder.debug_check_bounds::<AudioDeviceEnumeratorOnDeviceGainChangedRequest>(offset);
9384            // Delegate to tuple encoding.
9385            fidl::encoding::Encode::<AudioDeviceEnumeratorOnDeviceGainChangedRequest, D>::encode(
9386                (
9387                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.device_token),
9388                    <AudioGainInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.gain_info),
9389                ),
9390                encoder,
9391                offset,
9392                _depth,
9393            )
9394        }
9395    }
9396    unsafe impl<
9397        D: fidl::encoding::ResourceDialect,
9398        T0: fidl::encoding::Encode<u64, D>,
9399        T1: fidl::encoding::Encode<AudioGainInfo, D>,
9400    > fidl::encoding::Encode<AudioDeviceEnumeratorOnDeviceGainChangedRequest, D> for (T0, T1)
9401    {
9402        #[inline]
9403        unsafe fn encode(
9404            self,
9405            encoder: &mut fidl::encoding::Encoder<'_, D>,
9406            offset: usize,
9407            depth: fidl::encoding::Depth,
9408        ) -> fidl::Result<()> {
9409            encoder.debug_check_bounds::<AudioDeviceEnumeratorOnDeviceGainChangedRequest>(offset);
9410            // Zero out padding regions. There's no need to apply masks
9411            // because the unmasked parts will be overwritten by fields.
9412            // Write the fields.
9413            self.0.encode(encoder, offset + 0, depth)?;
9414            self.1.encode(encoder, offset + 8, depth)?;
9415            Ok(())
9416        }
9417    }
9418
9419    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
9420        for AudioDeviceEnumeratorOnDeviceGainChangedRequest
9421    {
9422        #[inline(always)]
9423        fn new_empty() -> Self {
9424            Self {
9425                device_token: fidl::new_empty!(u64, D),
9426                gain_info: fidl::new_empty!(AudioGainInfo, D),
9427            }
9428        }
9429
9430        #[inline]
9431        unsafe fn decode(
9432            &mut self,
9433            decoder: &mut fidl::encoding::Decoder<'_, D>,
9434            offset: usize,
9435            _depth: fidl::encoding::Depth,
9436        ) -> fidl::Result<()> {
9437            decoder.debug_check_bounds::<Self>(offset);
9438            // Verify that padding bytes are zero.
9439            fidl::decode!(u64, D, &mut self.device_token, decoder, offset + 0, _depth)?;
9440            fidl::decode!(AudioGainInfo, D, &mut self.gain_info, decoder, offset + 8, _depth)?;
9441            Ok(())
9442        }
9443    }
9444
9445    impl fidl::encoding::ValueTypeMarker for AudioDeviceEnumeratorOnDeviceRemovedRequest {
9446        type Borrowed<'a> = &'a Self;
9447        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9448            value
9449        }
9450    }
9451
9452    unsafe impl fidl::encoding::TypeMarker for AudioDeviceEnumeratorOnDeviceRemovedRequest {
9453        type Owned = Self;
9454
9455        #[inline(always)]
9456        fn inline_align(_context: fidl::encoding::Context) -> usize {
9457            8
9458        }
9459
9460        #[inline(always)]
9461        fn inline_size(_context: fidl::encoding::Context) -> usize {
9462            8
9463        }
9464        #[inline(always)]
9465        fn encode_is_copy() -> bool {
9466            true
9467        }
9468
9469        #[inline(always)]
9470        fn decode_is_copy() -> bool {
9471            true
9472        }
9473    }
9474
9475    unsafe impl<D: fidl::encoding::ResourceDialect>
9476        fidl::encoding::Encode<AudioDeviceEnumeratorOnDeviceRemovedRequest, D>
9477        for &AudioDeviceEnumeratorOnDeviceRemovedRequest
9478    {
9479        #[inline]
9480        unsafe fn encode(
9481            self,
9482            encoder: &mut fidl::encoding::Encoder<'_, D>,
9483            offset: usize,
9484            _depth: fidl::encoding::Depth,
9485        ) -> fidl::Result<()> {
9486            encoder.debug_check_bounds::<AudioDeviceEnumeratorOnDeviceRemovedRequest>(offset);
9487            unsafe {
9488                // Copy the object into the buffer.
9489                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
9490                (buf_ptr as *mut AudioDeviceEnumeratorOnDeviceRemovedRequest).write_unaligned(
9491                    (self as *const AudioDeviceEnumeratorOnDeviceRemovedRequest).read(),
9492                );
9493                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
9494                // done second because the memcpy will write garbage to these bytes.
9495            }
9496            Ok(())
9497        }
9498    }
9499    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
9500        fidl::encoding::Encode<AudioDeviceEnumeratorOnDeviceRemovedRequest, D> for (T0,)
9501    {
9502        #[inline]
9503        unsafe fn encode(
9504            self,
9505            encoder: &mut fidl::encoding::Encoder<'_, D>,
9506            offset: usize,
9507            depth: fidl::encoding::Depth,
9508        ) -> fidl::Result<()> {
9509            encoder.debug_check_bounds::<AudioDeviceEnumeratorOnDeviceRemovedRequest>(offset);
9510            // Zero out padding regions. There's no need to apply masks
9511            // because the unmasked parts will be overwritten by fields.
9512            // Write the fields.
9513            self.0.encode(encoder, offset + 0, depth)?;
9514            Ok(())
9515        }
9516    }
9517
9518    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
9519        for AudioDeviceEnumeratorOnDeviceRemovedRequest
9520    {
9521        #[inline(always)]
9522        fn new_empty() -> Self {
9523            Self { device_token: fidl::new_empty!(u64, D) }
9524        }
9525
9526        #[inline]
9527        unsafe fn decode(
9528            &mut self,
9529            decoder: &mut fidl::encoding::Decoder<'_, D>,
9530            offset: usize,
9531            _depth: fidl::encoding::Depth,
9532        ) -> fidl::Result<()> {
9533            decoder.debug_check_bounds::<Self>(offset);
9534            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
9535            // Verify that padding bytes are zero.
9536            // Copy from the buffer into the object.
9537            unsafe {
9538                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
9539            }
9540            Ok(())
9541        }
9542    }
9543
9544    impl fidl::encoding::ValueTypeMarker for AudioDeviceEnumeratorSetDeviceGainRequest {
9545        type Borrowed<'a> = &'a Self;
9546        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9547            value
9548        }
9549    }
9550
9551    unsafe impl fidl::encoding::TypeMarker for AudioDeviceEnumeratorSetDeviceGainRequest {
9552        type Owned = Self;
9553
9554        #[inline(always)]
9555        fn inline_align(_context: fidl::encoding::Context) -> usize {
9556            8
9557        }
9558
9559        #[inline(always)]
9560        fn inline_size(_context: fidl::encoding::Context) -> usize {
9561            24
9562        }
9563    }
9564
9565    unsafe impl<D: fidl::encoding::ResourceDialect>
9566        fidl::encoding::Encode<AudioDeviceEnumeratorSetDeviceGainRequest, D>
9567        for &AudioDeviceEnumeratorSetDeviceGainRequest
9568    {
9569        #[inline]
9570        unsafe fn encode(
9571            self,
9572            encoder: &mut fidl::encoding::Encoder<'_, D>,
9573            offset: usize,
9574            _depth: fidl::encoding::Depth,
9575        ) -> fidl::Result<()> {
9576            encoder.debug_check_bounds::<AudioDeviceEnumeratorSetDeviceGainRequest>(offset);
9577            // Delegate to tuple encoding.
9578            fidl::encoding::Encode::<AudioDeviceEnumeratorSetDeviceGainRequest, D>::encode(
9579                (
9580                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.device_token),
9581                    <AudioGainInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.gain_info),
9582                    <AudioGainValidFlags as fidl::encoding::ValueTypeMarker>::borrow(
9583                        &self.valid_flags,
9584                    ),
9585                ),
9586                encoder,
9587                offset,
9588                _depth,
9589            )
9590        }
9591    }
9592    unsafe impl<
9593        D: fidl::encoding::ResourceDialect,
9594        T0: fidl::encoding::Encode<u64, D>,
9595        T1: fidl::encoding::Encode<AudioGainInfo, D>,
9596        T2: fidl::encoding::Encode<AudioGainValidFlags, D>,
9597    > fidl::encoding::Encode<AudioDeviceEnumeratorSetDeviceGainRequest, D> for (T0, T1, T2)
9598    {
9599        #[inline]
9600        unsafe fn encode(
9601            self,
9602            encoder: &mut fidl::encoding::Encoder<'_, D>,
9603            offset: usize,
9604            depth: fidl::encoding::Depth,
9605        ) -> fidl::Result<()> {
9606            encoder.debug_check_bounds::<AudioDeviceEnumeratorSetDeviceGainRequest>(offset);
9607            // Zero out padding regions. There's no need to apply masks
9608            // because the unmasked parts will be overwritten by fields.
9609            unsafe {
9610                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
9611                (ptr as *mut u64).write_unaligned(0);
9612            }
9613            // Write the fields.
9614            self.0.encode(encoder, offset + 0, depth)?;
9615            self.1.encode(encoder, offset + 8, depth)?;
9616            self.2.encode(encoder, offset + 16, depth)?;
9617            Ok(())
9618        }
9619    }
9620
9621    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
9622        for AudioDeviceEnumeratorSetDeviceGainRequest
9623    {
9624        #[inline(always)]
9625        fn new_empty() -> Self {
9626            Self {
9627                device_token: fidl::new_empty!(u64, D),
9628                gain_info: fidl::new_empty!(AudioGainInfo, D),
9629                valid_flags: fidl::new_empty!(AudioGainValidFlags, D),
9630            }
9631        }
9632
9633        #[inline]
9634        unsafe fn decode(
9635            &mut self,
9636            decoder: &mut fidl::encoding::Decoder<'_, D>,
9637            offset: usize,
9638            _depth: fidl::encoding::Depth,
9639        ) -> fidl::Result<()> {
9640            decoder.debug_check_bounds::<Self>(offset);
9641            // Verify that padding bytes are zero.
9642            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
9643            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9644            let mask = 0xffffffff00000000u64;
9645            let maskedval = padval & mask;
9646            if maskedval != 0 {
9647                return Err(fidl::Error::NonZeroPadding {
9648                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
9649                });
9650            }
9651            fidl::decode!(u64, D, &mut self.device_token, decoder, offset + 0, _depth)?;
9652            fidl::decode!(AudioGainInfo, D, &mut self.gain_info, decoder, offset + 8, _depth)?;
9653            fidl::decode!(
9654                AudioGainValidFlags,
9655                D,
9656                &mut self.valid_flags,
9657                decoder,
9658                offset + 16,
9659                _depth
9660            )?;
9661            Ok(())
9662        }
9663    }
9664
9665    impl fidl::encoding::ValueTypeMarker for AudioDeviceInfo {
9666        type Borrowed<'a> = &'a Self;
9667        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9668            value
9669        }
9670    }
9671
9672    unsafe impl fidl::encoding::TypeMarker for AudioDeviceInfo {
9673        type Owned = Self;
9674
9675        #[inline(always)]
9676        fn inline_align(_context: fidl::encoding::Context) -> usize {
9677            8
9678        }
9679
9680        #[inline(always)]
9681        fn inline_size(_context: fidl::encoding::Context) -> usize {
9682            56
9683        }
9684    }
9685
9686    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AudioDeviceInfo, D>
9687        for &AudioDeviceInfo
9688    {
9689        #[inline]
9690        unsafe fn encode(
9691            self,
9692            encoder: &mut fidl::encoding::Encoder<'_, D>,
9693            offset: usize,
9694            _depth: fidl::encoding::Depth,
9695        ) -> fidl::Result<()> {
9696            encoder.debug_check_bounds::<AudioDeviceInfo>(offset);
9697            // Delegate to tuple encoding.
9698            fidl::encoding::Encode::<AudioDeviceInfo, D>::encode(
9699                (
9700                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
9701                        &self.name,
9702                    ),
9703                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
9704                        &self.unique_id,
9705                    ),
9706                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.token_id),
9707                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.is_input),
9708                    <AudioGainInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.gain_info),
9709                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.is_default),
9710                ),
9711                encoder,
9712                offset,
9713                _depth,
9714            )
9715        }
9716    }
9717    unsafe impl<
9718        D: fidl::encoding::ResourceDialect,
9719        T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
9720        T1: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
9721        T2: fidl::encoding::Encode<u64, D>,
9722        T3: fidl::encoding::Encode<bool, D>,
9723        T4: fidl::encoding::Encode<AudioGainInfo, D>,
9724        T5: fidl::encoding::Encode<bool, D>,
9725    > fidl::encoding::Encode<AudioDeviceInfo, D> for (T0, T1, T2, T3, T4, T5)
9726    {
9727        #[inline]
9728        unsafe fn encode(
9729            self,
9730            encoder: &mut fidl::encoding::Encoder<'_, D>,
9731            offset: usize,
9732            depth: fidl::encoding::Depth,
9733        ) -> fidl::Result<()> {
9734            encoder.debug_check_bounds::<AudioDeviceInfo>(offset);
9735            // Zero out padding regions. There's no need to apply masks
9736            // because the unmasked parts will be overwritten by fields.
9737            unsafe {
9738                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
9739                (ptr as *mut u64).write_unaligned(0);
9740            }
9741            unsafe {
9742                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(48);
9743                (ptr as *mut u64).write_unaligned(0);
9744            }
9745            // Write the fields.
9746            self.0.encode(encoder, offset + 0, depth)?;
9747            self.1.encode(encoder, offset + 16, depth)?;
9748            self.2.encode(encoder, offset + 32, depth)?;
9749            self.3.encode(encoder, offset + 40, depth)?;
9750            self.4.encode(encoder, offset + 44, depth)?;
9751            self.5.encode(encoder, offset + 52, depth)?;
9752            Ok(())
9753        }
9754    }
9755
9756    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AudioDeviceInfo {
9757        #[inline(always)]
9758        fn new_empty() -> Self {
9759            Self {
9760                name: fidl::new_empty!(fidl::encoding::UnboundedString, D),
9761                unique_id: fidl::new_empty!(fidl::encoding::UnboundedString, D),
9762                token_id: fidl::new_empty!(u64, D),
9763                is_input: fidl::new_empty!(bool, D),
9764                gain_info: fidl::new_empty!(AudioGainInfo, D),
9765                is_default: fidl::new_empty!(bool, D),
9766            }
9767        }
9768
9769        #[inline]
9770        unsafe fn decode(
9771            &mut self,
9772            decoder: &mut fidl::encoding::Decoder<'_, D>,
9773            offset: usize,
9774            _depth: fidl::encoding::Depth,
9775        ) -> fidl::Result<()> {
9776            decoder.debug_check_bounds::<Self>(offset);
9777            // Verify that padding bytes are zero.
9778            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
9779            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9780            let mask = 0xffffff00u64;
9781            let maskedval = padval & mask;
9782            if maskedval != 0 {
9783                return Err(fidl::Error::NonZeroPadding {
9784                    padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
9785                });
9786            }
9787            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(48) };
9788            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9789            let mask = 0xffffff0000000000u64;
9790            let maskedval = padval & mask;
9791            if maskedval != 0 {
9792                return Err(fidl::Error::NonZeroPadding {
9793                    padding_start: offset + 48 + ((mask as u64).trailing_zeros() / 8) as usize,
9794                });
9795            }
9796            fidl::decode!(
9797                fidl::encoding::UnboundedString,
9798                D,
9799                &mut self.name,
9800                decoder,
9801                offset + 0,
9802                _depth
9803            )?;
9804            fidl::decode!(
9805                fidl::encoding::UnboundedString,
9806                D,
9807                &mut self.unique_id,
9808                decoder,
9809                offset + 16,
9810                _depth
9811            )?;
9812            fidl::decode!(u64, D, &mut self.token_id, decoder, offset + 32, _depth)?;
9813            fidl::decode!(bool, D, &mut self.is_input, decoder, offset + 40, _depth)?;
9814            fidl::decode!(AudioGainInfo, D, &mut self.gain_info, decoder, offset + 44, _depth)?;
9815            fidl::decode!(bool, D, &mut self.is_default, decoder, offset + 52, _depth)?;
9816            Ok(())
9817        }
9818    }
9819
9820    impl fidl::encoding::ValueTypeMarker for AudioGainInfo {
9821        type Borrowed<'a> = &'a Self;
9822        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9823            value
9824        }
9825    }
9826
9827    unsafe impl fidl::encoding::TypeMarker for AudioGainInfo {
9828        type Owned = Self;
9829
9830        #[inline(always)]
9831        fn inline_align(_context: fidl::encoding::Context) -> usize {
9832            4
9833        }
9834
9835        #[inline(always)]
9836        fn inline_size(_context: fidl::encoding::Context) -> usize {
9837            8
9838        }
9839    }
9840
9841    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AudioGainInfo, D>
9842        for &AudioGainInfo
9843    {
9844        #[inline]
9845        unsafe fn encode(
9846            self,
9847            encoder: &mut fidl::encoding::Encoder<'_, D>,
9848            offset: usize,
9849            _depth: fidl::encoding::Depth,
9850        ) -> fidl::Result<()> {
9851            encoder.debug_check_bounds::<AudioGainInfo>(offset);
9852            // Delegate to tuple encoding.
9853            fidl::encoding::Encode::<AudioGainInfo, D>::encode(
9854                (
9855                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.gain_db),
9856                    <AudioGainInfoFlags as fidl::encoding::ValueTypeMarker>::borrow(&self.flags),
9857                ),
9858                encoder,
9859                offset,
9860                _depth,
9861            )
9862        }
9863    }
9864    unsafe impl<
9865        D: fidl::encoding::ResourceDialect,
9866        T0: fidl::encoding::Encode<f32, D>,
9867        T1: fidl::encoding::Encode<AudioGainInfoFlags, D>,
9868    > fidl::encoding::Encode<AudioGainInfo, D> for (T0, T1)
9869    {
9870        #[inline]
9871        unsafe fn encode(
9872            self,
9873            encoder: &mut fidl::encoding::Encoder<'_, D>,
9874            offset: usize,
9875            depth: fidl::encoding::Depth,
9876        ) -> fidl::Result<()> {
9877            encoder.debug_check_bounds::<AudioGainInfo>(offset);
9878            // Zero out padding regions. There's no need to apply masks
9879            // because the unmasked parts will be overwritten by fields.
9880            // Write the fields.
9881            self.0.encode(encoder, offset + 0, depth)?;
9882            self.1.encode(encoder, offset + 4, depth)?;
9883            Ok(())
9884        }
9885    }
9886
9887    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AudioGainInfo {
9888        #[inline(always)]
9889        fn new_empty() -> Self {
9890            Self {
9891                gain_db: fidl::new_empty!(f32, D),
9892                flags: fidl::new_empty!(AudioGainInfoFlags, D),
9893            }
9894        }
9895
9896        #[inline]
9897        unsafe fn decode(
9898            &mut self,
9899            decoder: &mut fidl::encoding::Decoder<'_, D>,
9900            offset: usize,
9901            _depth: fidl::encoding::Depth,
9902        ) -> fidl::Result<()> {
9903            decoder.debug_check_bounds::<Self>(offset);
9904            // Verify that padding bytes are zero.
9905            fidl::decode!(f32, D, &mut self.gain_db, decoder, offset + 0, _depth)?;
9906            fidl::decode!(AudioGainInfoFlags, D, &mut self.flags, decoder, offset + 4, _depth)?;
9907            Ok(())
9908        }
9909    }
9910
9911    impl fidl::encoding::ValueTypeMarker for AudioRendererEnableMinLeadTimeEventsRequest {
9912        type Borrowed<'a> = &'a Self;
9913        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9914            value
9915        }
9916    }
9917
9918    unsafe impl fidl::encoding::TypeMarker for AudioRendererEnableMinLeadTimeEventsRequest {
9919        type Owned = Self;
9920
9921        #[inline(always)]
9922        fn inline_align(_context: fidl::encoding::Context) -> usize {
9923            1
9924        }
9925
9926        #[inline(always)]
9927        fn inline_size(_context: fidl::encoding::Context) -> usize {
9928            1
9929        }
9930    }
9931
9932    unsafe impl<D: fidl::encoding::ResourceDialect>
9933        fidl::encoding::Encode<AudioRendererEnableMinLeadTimeEventsRequest, D>
9934        for &AudioRendererEnableMinLeadTimeEventsRequest
9935    {
9936        #[inline]
9937        unsafe fn encode(
9938            self,
9939            encoder: &mut fidl::encoding::Encoder<'_, D>,
9940            offset: usize,
9941            _depth: fidl::encoding::Depth,
9942        ) -> fidl::Result<()> {
9943            encoder.debug_check_bounds::<AudioRendererEnableMinLeadTimeEventsRequest>(offset);
9944            // Delegate to tuple encoding.
9945            fidl::encoding::Encode::<AudioRendererEnableMinLeadTimeEventsRequest, D>::encode(
9946                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enabled),),
9947                encoder,
9948                offset,
9949                _depth,
9950            )
9951        }
9952    }
9953    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
9954        fidl::encoding::Encode<AudioRendererEnableMinLeadTimeEventsRequest, D> for (T0,)
9955    {
9956        #[inline]
9957        unsafe fn encode(
9958            self,
9959            encoder: &mut fidl::encoding::Encoder<'_, D>,
9960            offset: usize,
9961            depth: fidl::encoding::Depth,
9962        ) -> fidl::Result<()> {
9963            encoder.debug_check_bounds::<AudioRendererEnableMinLeadTimeEventsRequest>(offset);
9964            // Zero out padding regions. There's no need to apply masks
9965            // because the unmasked parts will be overwritten by fields.
9966            // Write the fields.
9967            self.0.encode(encoder, offset + 0, depth)?;
9968            Ok(())
9969        }
9970    }
9971
9972    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
9973        for AudioRendererEnableMinLeadTimeEventsRequest
9974    {
9975        #[inline(always)]
9976        fn new_empty() -> Self {
9977            Self { enabled: fidl::new_empty!(bool, D) }
9978        }
9979
9980        #[inline]
9981        unsafe fn decode(
9982            &mut self,
9983            decoder: &mut fidl::encoding::Decoder<'_, D>,
9984            offset: usize,
9985            _depth: fidl::encoding::Depth,
9986        ) -> fidl::Result<()> {
9987            decoder.debug_check_bounds::<Self>(offset);
9988            // Verify that padding bytes are zero.
9989            fidl::decode!(bool, D, &mut self.enabled, decoder, offset + 0, _depth)?;
9990            Ok(())
9991        }
9992    }
9993
9994    impl fidl::encoding::ValueTypeMarker for AudioRendererGetMinLeadTimeResponse {
9995        type Borrowed<'a> = &'a Self;
9996        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9997            value
9998        }
9999    }
10000
10001    unsafe impl fidl::encoding::TypeMarker for AudioRendererGetMinLeadTimeResponse {
10002        type Owned = Self;
10003
10004        #[inline(always)]
10005        fn inline_align(_context: fidl::encoding::Context) -> usize {
10006            8
10007        }
10008
10009        #[inline(always)]
10010        fn inline_size(_context: fidl::encoding::Context) -> usize {
10011            8
10012        }
10013        #[inline(always)]
10014        fn encode_is_copy() -> bool {
10015            true
10016        }
10017
10018        #[inline(always)]
10019        fn decode_is_copy() -> bool {
10020            true
10021        }
10022    }
10023
10024    unsafe impl<D: fidl::encoding::ResourceDialect>
10025        fidl::encoding::Encode<AudioRendererGetMinLeadTimeResponse, D>
10026        for &AudioRendererGetMinLeadTimeResponse
10027    {
10028        #[inline]
10029        unsafe fn encode(
10030            self,
10031            encoder: &mut fidl::encoding::Encoder<'_, D>,
10032            offset: usize,
10033            _depth: fidl::encoding::Depth,
10034        ) -> fidl::Result<()> {
10035            encoder.debug_check_bounds::<AudioRendererGetMinLeadTimeResponse>(offset);
10036            unsafe {
10037                // Copy the object into the buffer.
10038                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
10039                (buf_ptr as *mut AudioRendererGetMinLeadTimeResponse)
10040                    .write_unaligned((self as *const AudioRendererGetMinLeadTimeResponse).read());
10041                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
10042                // done second because the memcpy will write garbage to these bytes.
10043            }
10044            Ok(())
10045        }
10046    }
10047    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i64, D>>
10048        fidl::encoding::Encode<AudioRendererGetMinLeadTimeResponse, D> for (T0,)
10049    {
10050        #[inline]
10051        unsafe fn encode(
10052            self,
10053            encoder: &mut fidl::encoding::Encoder<'_, D>,
10054            offset: usize,
10055            depth: fidl::encoding::Depth,
10056        ) -> fidl::Result<()> {
10057            encoder.debug_check_bounds::<AudioRendererGetMinLeadTimeResponse>(offset);
10058            // Zero out padding regions. There's no need to apply masks
10059            // because the unmasked parts will be overwritten by fields.
10060            // Write the fields.
10061            self.0.encode(encoder, offset + 0, depth)?;
10062            Ok(())
10063        }
10064    }
10065
10066    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
10067        for AudioRendererGetMinLeadTimeResponse
10068    {
10069        #[inline(always)]
10070        fn new_empty() -> Self {
10071            Self { min_lead_time_nsec: fidl::new_empty!(i64, D) }
10072        }
10073
10074        #[inline]
10075        unsafe fn decode(
10076            &mut self,
10077            decoder: &mut fidl::encoding::Decoder<'_, D>,
10078            offset: usize,
10079            _depth: fidl::encoding::Depth,
10080        ) -> fidl::Result<()> {
10081            decoder.debug_check_bounds::<Self>(offset);
10082            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
10083            // Verify that padding bytes are zero.
10084            // Copy from the buffer into the object.
10085            unsafe {
10086                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
10087            }
10088            Ok(())
10089        }
10090    }
10091
10092    impl fidl::encoding::ValueTypeMarker for AudioRendererOnMinLeadTimeChangedRequest {
10093        type Borrowed<'a> = &'a Self;
10094        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10095            value
10096        }
10097    }
10098
10099    unsafe impl fidl::encoding::TypeMarker for AudioRendererOnMinLeadTimeChangedRequest {
10100        type Owned = Self;
10101
10102        #[inline(always)]
10103        fn inline_align(_context: fidl::encoding::Context) -> usize {
10104            8
10105        }
10106
10107        #[inline(always)]
10108        fn inline_size(_context: fidl::encoding::Context) -> usize {
10109            8
10110        }
10111        #[inline(always)]
10112        fn encode_is_copy() -> bool {
10113            true
10114        }
10115
10116        #[inline(always)]
10117        fn decode_is_copy() -> bool {
10118            true
10119        }
10120    }
10121
10122    unsafe impl<D: fidl::encoding::ResourceDialect>
10123        fidl::encoding::Encode<AudioRendererOnMinLeadTimeChangedRequest, D>
10124        for &AudioRendererOnMinLeadTimeChangedRequest
10125    {
10126        #[inline]
10127        unsafe fn encode(
10128            self,
10129            encoder: &mut fidl::encoding::Encoder<'_, D>,
10130            offset: usize,
10131            _depth: fidl::encoding::Depth,
10132        ) -> fidl::Result<()> {
10133            encoder.debug_check_bounds::<AudioRendererOnMinLeadTimeChangedRequest>(offset);
10134            unsafe {
10135                // Copy the object into the buffer.
10136                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
10137                (buf_ptr as *mut AudioRendererOnMinLeadTimeChangedRequest).write_unaligned(
10138                    (self as *const AudioRendererOnMinLeadTimeChangedRequest).read(),
10139                );
10140                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
10141                // done second because the memcpy will write garbage to these bytes.
10142            }
10143            Ok(())
10144        }
10145    }
10146    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i64, D>>
10147        fidl::encoding::Encode<AudioRendererOnMinLeadTimeChangedRequest, D> for (T0,)
10148    {
10149        #[inline]
10150        unsafe fn encode(
10151            self,
10152            encoder: &mut fidl::encoding::Encoder<'_, D>,
10153            offset: usize,
10154            depth: fidl::encoding::Depth,
10155        ) -> fidl::Result<()> {
10156            encoder.debug_check_bounds::<AudioRendererOnMinLeadTimeChangedRequest>(offset);
10157            // Zero out padding regions. There's no need to apply masks
10158            // because the unmasked parts will be overwritten by fields.
10159            // Write the fields.
10160            self.0.encode(encoder, offset + 0, depth)?;
10161            Ok(())
10162        }
10163    }
10164
10165    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
10166        for AudioRendererOnMinLeadTimeChangedRequest
10167    {
10168        #[inline(always)]
10169        fn new_empty() -> Self {
10170            Self { min_lead_time_nsec: fidl::new_empty!(i64, D) }
10171        }
10172
10173        #[inline]
10174        unsafe fn decode(
10175            &mut self,
10176            decoder: &mut fidl::encoding::Decoder<'_, D>,
10177            offset: usize,
10178            _depth: fidl::encoding::Depth,
10179        ) -> fidl::Result<()> {
10180            decoder.debug_check_bounds::<Self>(offset);
10181            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
10182            // Verify that padding bytes are zero.
10183            // Copy from the buffer into the object.
10184            unsafe {
10185                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
10186            }
10187            Ok(())
10188        }
10189    }
10190
10191    impl fidl::encoding::ValueTypeMarker for AudioRendererPauseResponse {
10192        type Borrowed<'a> = &'a Self;
10193        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10194            value
10195        }
10196    }
10197
10198    unsafe impl fidl::encoding::TypeMarker for AudioRendererPauseResponse {
10199        type Owned = Self;
10200
10201        #[inline(always)]
10202        fn inline_align(_context: fidl::encoding::Context) -> usize {
10203            8
10204        }
10205
10206        #[inline(always)]
10207        fn inline_size(_context: fidl::encoding::Context) -> usize {
10208            16
10209        }
10210        #[inline(always)]
10211        fn encode_is_copy() -> bool {
10212            true
10213        }
10214
10215        #[inline(always)]
10216        fn decode_is_copy() -> bool {
10217            true
10218        }
10219    }
10220
10221    unsafe impl<D: fidl::encoding::ResourceDialect>
10222        fidl::encoding::Encode<AudioRendererPauseResponse, D> for &AudioRendererPauseResponse
10223    {
10224        #[inline]
10225        unsafe fn encode(
10226            self,
10227            encoder: &mut fidl::encoding::Encoder<'_, D>,
10228            offset: usize,
10229            _depth: fidl::encoding::Depth,
10230        ) -> fidl::Result<()> {
10231            encoder.debug_check_bounds::<AudioRendererPauseResponse>(offset);
10232            unsafe {
10233                // Copy the object into the buffer.
10234                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
10235                (buf_ptr as *mut AudioRendererPauseResponse)
10236                    .write_unaligned((self as *const AudioRendererPauseResponse).read());
10237                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
10238                // done second because the memcpy will write garbage to these bytes.
10239            }
10240            Ok(())
10241        }
10242    }
10243    unsafe impl<
10244        D: fidl::encoding::ResourceDialect,
10245        T0: fidl::encoding::Encode<i64, D>,
10246        T1: fidl::encoding::Encode<i64, D>,
10247    > fidl::encoding::Encode<AudioRendererPauseResponse, D> for (T0, T1)
10248    {
10249        #[inline]
10250        unsafe fn encode(
10251            self,
10252            encoder: &mut fidl::encoding::Encoder<'_, D>,
10253            offset: usize,
10254            depth: fidl::encoding::Depth,
10255        ) -> fidl::Result<()> {
10256            encoder.debug_check_bounds::<AudioRendererPauseResponse>(offset);
10257            // Zero out padding regions. There's no need to apply masks
10258            // because the unmasked parts will be overwritten by fields.
10259            // Write the fields.
10260            self.0.encode(encoder, offset + 0, depth)?;
10261            self.1.encode(encoder, offset + 8, depth)?;
10262            Ok(())
10263        }
10264    }
10265
10266    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
10267        for AudioRendererPauseResponse
10268    {
10269        #[inline(always)]
10270        fn new_empty() -> Self {
10271            Self { reference_time: fidl::new_empty!(i64, D), media_time: fidl::new_empty!(i64, D) }
10272        }
10273
10274        #[inline]
10275        unsafe fn decode(
10276            &mut self,
10277            decoder: &mut fidl::encoding::Decoder<'_, D>,
10278            offset: usize,
10279            _depth: fidl::encoding::Depth,
10280        ) -> fidl::Result<()> {
10281            decoder.debug_check_bounds::<Self>(offset);
10282            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
10283            // Verify that padding bytes are zero.
10284            // Copy from the buffer into the object.
10285            unsafe {
10286                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
10287            }
10288            Ok(())
10289        }
10290    }
10291
10292    impl fidl::encoding::ValueTypeMarker for AudioRendererPlayNoReplyRequest {
10293        type Borrowed<'a> = &'a Self;
10294        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10295            value
10296        }
10297    }
10298
10299    unsafe impl fidl::encoding::TypeMarker for AudioRendererPlayNoReplyRequest {
10300        type Owned = Self;
10301
10302        #[inline(always)]
10303        fn inline_align(_context: fidl::encoding::Context) -> usize {
10304            8
10305        }
10306
10307        #[inline(always)]
10308        fn inline_size(_context: fidl::encoding::Context) -> usize {
10309            16
10310        }
10311        #[inline(always)]
10312        fn encode_is_copy() -> bool {
10313            true
10314        }
10315
10316        #[inline(always)]
10317        fn decode_is_copy() -> bool {
10318            true
10319        }
10320    }
10321
10322    unsafe impl<D: fidl::encoding::ResourceDialect>
10323        fidl::encoding::Encode<AudioRendererPlayNoReplyRequest, D>
10324        for &AudioRendererPlayNoReplyRequest
10325    {
10326        #[inline]
10327        unsafe fn encode(
10328            self,
10329            encoder: &mut fidl::encoding::Encoder<'_, D>,
10330            offset: usize,
10331            _depth: fidl::encoding::Depth,
10332        ) -> fidl::Result<()> {
10333            encoder.debug_check_bounds::<AudioRendererPlayNoReplyRequest>(offset);
10334            unsafe {
10335                // Copy the object into the buffer.
10336                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
10337                (buf_ptr as *mut AudioRendererPlayNoReplyRequest)
10338                    .write_unaligned((self as *const AudioRendererPlayNoReplyRequest).read());
10339                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
10340                // done second because the memcpy will write garbage to these bytes.
10341            }
10342            Ok(())
10343        }
10344    }
10345    unsafe impl<
10346        D: fidl::encoding::ResourceDialect,
10347        T0: fidl::encoding::Encode<i64, D>,
10348        T1: fidl::encoding::Encode<i64, D>,
10349    > fidl::encoding::Encode<AudioRendererPlayNoReplyRequest, D> for (T0, T1)
10350    {
10351        #[inline]
10352        unsafe fn encode(
10353            self,
10354            encoder: &mut fidl::encoding::Encoder<'_, D>,
10355            offset: usize,
10356            depth: fidl::encoding::Depth,
10357        ) -> fidl::Result<()> {
10358            encoder.debug_check_bounds::<AudioRendererPlayNoReplyRequest>(offset);
10359            // Zero out padding regions. There's no need to apply masks
10360            // because the unmasked parts will be overwritten by fields.
10361            // Write the fields.
10362            self.0.encode(encoder, offset + 0, depth)?;
10363            self.1.encode(encoder, offset + 8, depth)?;
10364            Ok(())
10365        }
10366    }
10367
10368    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
10369        for AudioRendererPlayNoReplyRequest
10370    {
10371        #[inline(always)]
10372        fn new_empty() -> Self {
10373            Self { reference_time: fidl::new_empty!(i64, D), media_time: fidl::new_empty!(i64, D) }
10374        }
10375
10376        #[inline]
10377        unsafe fn decode(
10378            &mut self,
10379            decoder: &mut fidl::encoding::Decoder<'_, D>,
10380            offset: usize,
10381            _depth: fidl::encoding::Depth,
10382        ) -> fidl::Result<()> {
10383            decoder.debug_check_bounds::<Self>(offset);
10384            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
10385            // Verify that padding bytes are zero.
10386            // Copy from the buffer into the object.
10387            unsafe {
10388                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
10389            }
10390            Ok(())
10391        }
10392    }
10393
10394    impl fidl::encoding::ValueTypeMarker for AudioRendererPlayRequest {
10395        type Borrowed<'a> = &'a Self;
10396        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10397            value
10398        }
10399    }
10400
10401    unsafe impl fidl::encoding::TypeMarker for AudioRendererPlayRequest {
10402        type Owned = Self;
10403
10404        #[inline(always)]
10405        fn inline_align(_context: fidl::encoding::Context) -> usize {
10406            8
10407        }
10408
10409        #[inline(always)]
10410        fn inline_size(_context: fidl::encoding::Context) -> usize {
10411            16
10412        }
10413        #[inline(always)]
10414        fn encode_is_copy() -> bool {
10415            true
10416        }
10417
10418        #[inline(always)]
10419        fn decode_is_copy() -> bool {
10420            true
10421        }
10422    }
10423
10424    unsafe impl<D: fidl::encoding::ResourceDialect>
10425        fidl::encoding::Encode<AudioRendererPlayRequest, D> for &AudioRendererPlayRequest
10426    {
10427        #[inline]
10428        unsafe fn encode(
10429            self,
10430            encoder: &mut fidl::encoding::Encoder<'_, D>,
10431            offset: usize,
10432            _depth: fidl::encoding::Depth,
10433        ) -> fidl::Result<()> {
10434            encoder.debug_check_bounds::<AudioRendererPlayRequest>(offset);
10435            unsafe {
10436                // Copy the object into the buffer.
10437                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
10438                (buf_ptr as *mut AudioRendererPlayRequest)
10439                    .write_unaligned((self as *const AudioRendererPlayRequest).read());
10440                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
10441                // done second because the memcpy will write garbage to these bytes.
10442            }
10443            Ok(())
10444        }
10445    }
10446    unsafe impl<
10447        D: fidl::encoding::ResourceDialect,
10448        T0: fidl::encoding::Encode<i64, D>,
10449        T1: fidl::encoding::Encode<i64, D>,
10450    > fidl::encoding::Encode<AudioRendererPlayRequest, D> for (T0, T1)
10451    {
10452        #[inline]
10453        unsafe fn encode(
10454            self,
10455            encoder: &mut fidl::encoding::Encoder<'_, D>,
10456            offset: usize,
10457            depth: fidl::encoding::Depth,
10458        ) -> fidl::Result<()> {
10459            encoder.debug_check_bounds::<AudioRendererPlayRequest>(offset);
10460            // Zero out padding regions. There's no need to apply masks
10461            // because the unmasked parts will be overwritten by fields.
10462            // Write the fields.
10463            self.0.encode(encoder, offset + 0, depth)?;
10464            self.1.encode(encoder, offset + 8, depth)?;
10465            Ok(())
10466        }
10467    }
10468
10469    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
10470        for AudioRendererPlayRequest
10471    {
10472        #[inline(always)]
10473        fn new_empty() -> Self {
10474            Self { reference_time: fidl::new_empty!(i64, D), media_time: fidl::new_empty!(i64, D) }
10475        }
10476
10477        #[inline]
10478        unsafe fn decode(
10479            &mut self,
10480            decoder: &mut fidl::encoding::Decoder<'_, D>,
10481            offset: usize,
10482            _depth: fidl::encoding::Depth,
10483        ) -> fidl::Result<()> {
10484            decoder.debug_check_bounds::<Self>(offset);
10485            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
10486            // Verify that padding bytes are zero.
10487            // Copy from the buffer into the object.
10488            unsafe {
10489                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
10490            }
10491            Ok(())
10492        }
10493    }
10494
10495    impl fidl::encoding::ValueTypeMarker for AudioRendererPlayResponse {
10496        type Borrowed<'a> = &'a Self;
10497        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10498            value
10499        }
10500    }
10501
10502    unsafe impl fidl::encoding::TypeMarker for AudioRendererPlayResponse {
10503        type Owned = Self;
10504
10505        #[inline(always)]
10506        fn inline_align(_context: fidl::encoding::Context) -> usize {
10507            8
10508        }
10509
10510        #[inline(always)]
10511        fn inline_size(_context: fidl::encoding::Context) -> usize {
10512            16
10513        }
10514        #[inline(always)]
10515        fn encode_is_copy() -> bool {
10516            true
10517        }
10518
10519        #[inline(always)]
10520        fn decode_is_copy() -> bool {
10521            true
10522        }
10523    }
10524
10525    unsafe impl<D: fidl::encoding::ResourceDialect>
10526        fidl::encoding::Encode<AudioRendererPlayResponse, D> for &AudioRendererPlayResponse
10527    {
10528        #[inline]
10529        unsafe fn encode(
10530            self,
10531            encoder: &mut fidl::encoding::Encoder<'_, D>,
10532            offset: usize,
10533            _depth: fidl::encoding::Depth,
10534        ) -> fidl::Result<()> {
10535            encoder.debug_check_bounds::<AudioRendererPlayResponse>(offset);
10536            unsafe {
10537                // Copy the object into the buffer.
10538                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
10539                (buf_ptr as *mut AudioRendererPlayResponse)
10540                    .write_unaligned((self as *const AudioRendererPlayResponse).read());
10541                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
10542                // done second because the memcpy will write garbage to these bytes.
10543            }
10544            Ok(())
10545        }
10546    }
10547    unsafe impl<
10548        D: fidl::encoding::ResourceDialect,
10549        T0: fidl::encoding::Encode<i64, D>,
10550        T1: fidl::encoding::Encode<i64, D>,
10551    > fidl::encoding::Encode<AudioRendererPlayResponse, D> for (T0, T1)
10552    {
10553        #[inline]
10554        unsafe fn encode(
10555            self,
10556            encoder: &mut fidl::encoding::Encoder<'_, D>,
10557            offset: usize,
10558            depth: fidl::encoding::Depth,
10559        ) -> fidl::Result<()> {
10560            encoder.debug_check_bounds::<AudioRendererPlayResponse>(offset);
10561            // Zero out padding regions. There's no need to apply masks
10562            // because the unmasked parts will be overwritten by fields.
10563            // Write the fields.
10564            self.0.encode(encoder, offset + 0, depth)?;
10565            self.1.encode(encoder, offset + 8, depth)?;
10566            Ok(())
10567        }
10568    }
10569
10570    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
10571        for AudioRendererPlayResponse
10572    {
10573        #[inline(always)]
10574        fn new_empty() -> Self {
10575            Self { reference_time: fidl::new_empty!(i64, D), media_time: fidl::new_empty!(i64, D) }
10576        }
10577
10578        #[inline]
10579        unsafe fn decode(
10580            &mut self,
10581            decoder: &mut fidl::encoding::Decoder<'_, D>,
10582            offset: usize,
10583            _depth: fidl::encoding::Depth,
10584        ) -> fidl::Result<()> {
10585            decoder.debug_check_bounds::<Self>(offset);
10586            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
10587            // Verify that padding bytes are zero.
10588            // Copy from the buffer into the object.
10589            unsafe {
10590                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
10591            }
10592            Ok(())
10593        }
10594    }
10595
10596    impl fidl::encoding::ValueTypeMarker for AudioRendererSetPcmStreamTypeRequest {
10597        type Borrowed<'a> = &'a Self;
10598        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10599            value
10600        }
10601    }
10602
10603    unsafe impl fidl::encoding::TypeMarker for AudioRendererSetPcmStreamTypeRequest {
10604        type Owned = Self;
10605
10606        #[inline(always)]
10607        fn inline_align(_context: fidl::encoding::Context) -> usize {
10608            4
10609        }
10610
10611        #[inline(always)]
10612        fn inline_size(_context: fidl::encoding::Context) -> usize {
10613            12
10614        }
10615    }
10616
10617    unsafe impl<D: fidl::encoding::ResourceDialect>
10618        fidl::encoding::Encode<AudioRendererSetPcmStreamTypeRequest, D>
10619        for &AudioRendererSetPcmStreamTypeRequest
10620    {
10621        #[inline]
10622        unsafe fn encode(
10623            self,
10624            encoder: &mut fidl::encoding::Encoder<'_, D>,
10625            offset: usize,
10626            _depth: fidl::encoding::Depth,
10627        ) -> fidl::Result<()> {
10628            encoder.debug_check_bounds::<AudioRendererSetPcmStreamTypeRequest>(offset);
10629            // Delegate to tuple encoding.
10630            fidl::encoding::Encode::<AudioRendererSetPcmStreamTypeRequest, D>::encode(
10631                (<AudioStreamType as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),),
10632                encoder,
10633                offset,
10634                _depth,
10635            )
10636        }
10637    }
10638    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<AudioStreamType, D>>
10639        fidl::encoding::Encode<AudioRendererSetPcmStreamTypeRequest, D> for (T0,)
10640    {
10641        #[inline]
10642        unsafe fn encode(
10643            self,
10644            encoder: &mut fidl::encoding::Encoder<'_, D>,
10645            offset: usize,
10646            depth: fidl::encoding::Depth,
10647        ) -> fidl::Result<()> {
10648            encoder.debug_check_bounds::<AudioRendererSetPcmStreamTypeRequest>(offset);
10649            // Zero out padding regions. There's no need to apply masks
10650            // because the unmasked parts will be overwritten by fields.
10651            // Write the fields.
10652            self.0.encode(encoder, offset + 0, depth)?;
10653            Ok(())
10654        }
10655    }
10656
10657    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
10658        for AudioRendererSetPcmStreamTypeRequest
10659    {
10660        #[inline(always)]
10661        fn new_empty() -> Self {
10662            Self { type_: fidl::new_empty!(AudioStreamType, D) }
10663        }
10664
10665        #[inline]
10666        unsafe fn decode(
10667            &mut self,
10668            decoder: &mut fidl::encoding::Decoder<'_, D>,
10669            offset: usize,
10670            _depth: fidl::encoding::Depth,
10671        ) -> fidl::Result<()> {
10672            decoder.debug_check_bounds::<Self>(offset);
10673            // Verify that padding bytes are zero.
10674            fidl::decode!(AudioStreamType, D, &mut self.type_, decoder, offset + 0, _depth)?;
10675            Ok(())
10676        }
10677    }
10678
10679    impl fidl::encoding::ValueTypeMarker for AudioRendererSetPtsContinuityThresholdRequest {
10680        type Borrowed<'a> = &'a Self;
10681        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10682            value
10683        }
10684    }
10685
10686    unsafe impl fidl::encoding::TypeMarker for AudioRendererSetPtsContinuityThresholdRequest {
10687        type Owned = Self;
10688
10689        #[inline(always)]
10690        fn inline_align(_context: fidl::encoding::Context) -> usize {
10691            4
10692        }
10693
10694        #[inline(always)]
10695        fn inline_size(_context: fidl::encoding::Context) -> usize {
10696            4
10697        }
10698    }
10699
10700    unsafe impl<D: fidl::encoding::ResourceDialect>
10701        fidl::encoding::Encode<AudioRendererSetPtsContinuityThresholdRequest, D>
10702        for &AudioRendererSetPtsContinuityThresholdRequest
10703    {
10704        #[inline]
10705        unsafe fn encode(
10706            self,
10707            encoder: &mut fidl::encoding::Encoder<'_, D>,
10708            offset: usize,
10709            _depth: fidl::encoding::Depth,
10710        ) -> fidl::Result<()> {
10711            encoder.debug_check_bounds::<AudioRendererSetPtsContinuityThresholdRequest>(offset);
10712            // Delegate to tuple encoding.
10713            fidl::encoding::Encode::<AudioRendererSetPtsContinuityThresholdRequest, D>::encode(
10714                (<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.threshold_seconds),),
10715                encoder,
10716                offset,
10717                _depth,
10718            )
10719        }
10720    }
10721    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f32, D>>
10722        fidl::encoding::Encode<AudioRendererSetPtsContinuityThresholdRequest, D> for (T0,)
10723    {
10724        #[inline]
10725        unsafe fn encode(
10726            self,
10727            encoder: &mut fidl::encoding::Encoder<'_, D>,
10728            offset: usize,
10729            depth: fidl::encoding::Depth,
10730        ) -> fidl::Result<()> {
10731            encoder.debug_check_bounds::<AudioRendererSetPtsContinuityThresholdRequest>(offset);
10732            // Zero out padding regions. There's no need to apply masks
10733            // because the unmasked parts will be overwritten by fields.
10734            // Write the fields.
10735            self.0.encode(encoder, offset + 0, depth)?;
10736            Ok(())
10737        }
10738    }
10739
10740    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
10741        for AudioRendererSetPtsContinuityThresholdRequest
10742    {
10743        #[inline(always)]
10744        fn new_empty() -> Self {
10745            Self { threshold_seconds: fidl::new_empty!(f32, D) }
10746        }
10747
10748        #[inline]
10749        unsafe fn decode(
10750            &mut self,
10751            decoder: &mut fidl::encoding::Decoder<'_, D>,
10752            offset: usize,
10753            _depth: fidl::encoding::Depth,
10754        ) -> fidl::Result<()> {
10755            decoder.debug_check_bounds::<Self>(offset);
10756            // Verify that padding bytes are zero.
10757            fidl::decode!(f32, D, &mut self.threshold_seconds, decoder, offset + 0, _depth)?;
10758            Ok(())
10759        }
10760    }
10761
10762    impl fidl::encoding::ValueTypeMarker for AudioRendererSetPtsUnitsRequest {
10763        type Borrowed<'a> = &'a Self;
10764        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10765            value
10766        }
10767    }
10768
10769    unsafe impl fidl::encoding::TypeMarker for AudioRendererSetPtsUnitsRequest {
10770        type Owned = Self;
10771
10772        #[inline(always)]
10773        fn inline_align(_context: fidl::encoding::Context) -> usize {
10774            4
10775        }
10776
10777        #[inline(always)]
10778        fn inline_size(_context: fidl::encoding::Context) -> usize {
10779            8
10780        }
10781        #[inline(always)]
10782        fn encode_is_copy() -> bool {
10783            true
10784        }
10785
10786        #[inline(always)]
10787        fn decode_is_copy() -> bool {
10788            true
10789        }
10790    }
10791
10792    unsafe impl<D: fidl::encoding::ResourceDialect>
10793        fidl::encoding::Encode<AudioRendererSetPtsUnitsRequest, D>
10794        for &AudioRendererSetPtsUnitsRequest
10795    {
10796        #[inline]
10797        unsafe fn encode(
10798            self,
10799            encoder: &mut fidl::encoding::Encoder<'_, D>,
10800            offset: usize,
10801            _depth: fidl::encoding::Depth,
10802        ) -> fidl::Result<()> {
10803            encoder.debug_check_bounds::<AudioRendererSetPtsUnitsRequest>(offset);
10804            unsafe {
10805                // Copy the object into the buffer.
10806                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
10807                (buf_ptr as *mut AudioRendererSetPtsUnitsRequest)
10808                    .write_unaligned((self as *const AudioRendererSetPtsUnitsRequest).read());
10809                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
10810                // done second because the memcpy will write garbage to these bytes.
10811            }
10812            Ok(())
10813        }
10814    }
10815    unsafe impl<
10816        D: fidl::encoding::ResourceDialect,
10817        T0: fidl::encoding::Encode<u32, D>,
10818        T1: fidl::encoding::Encode<u32, D>,
10819    > fidl::encoding::Encode<AudioRendererSetPtsUnitsRequest, D> for (T0, T1)
10820    {
10821        #[inline]
10822        unsafe fn encode(
10823            self,
10824            encoder: &mut fidl::encoding::Encoder<'_, D>,
10825            offset: usize,
10826            depth: fidl::encoding::Depth,
10827        ) -> fidl::Result<()> {
10828            encoder.debug_check_bounds::<AudioRendererSetPtsUnitsRequest>(offset);
10829            // Zero out padding regions. There's no need to apply masks
10830            // because the unmasked parts will be overwritten by fields.
10831            // Write the fields.
10832            self.0.encode(encoder, offset + 0, depth)?;
10833            self.1.encode(encoder, offset + 4, depth)?;
10834            Ok(())
10835        }
10836    }
10837
10838    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
10839        for AudioRendererSetPtsUnitsRequest
10840    {
10841        #[inline(always)]
10842        fn new_empty() -> Self {
10843            Self {
10844                tick_per_second_numerator: fidl::new_empty!(u32, D),
10845                tick_per_second_denominator: fidl::new_empty!(u32, D),
10846            }
10847        }
10848
10849        #[inline]
10850        unsafe fn decode(
10851            &mut self,
10852            decoder: &mut fidl::encoding::Decoder<'_, D>,
10853            offset: usize,
10854            _depth: fidl::encoding::Depth,
10855        ) -> fidl::Result<()> {
10856            decoder.debug_check_bounds::<Self>(offset);
10857            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
10858            // Verify that padding bytes are zero.
10859            // Copy from the buffer into the object.
10860            unsafe {
10861                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
10862            }
10863            Ok(())
10864        }
10865    }
10866
10867    impl fidl::encoding::ValueTypeMarker for AudioRendererSetUsage2Request {
10868        type Borrowed<'a> = &'a Self;
10869        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10870            value
10871        }
10872    }
10873
10874    unsafe impl fidl::encoding::TypeMarker for AudioRendererSetUsage2Request {
10875        type Owned = Self;
10876
10877        #[inline(always)]
10878        fn inline_align(_context: fidl::encoding::Context) -> usize {
10879            4
10880        }
10881
10882        #[inline(always)]
10883        fn inline_size(_context: fidl::encoding::Context) -> usize {
10884            4
10885        }
10886    }
10887
10888    unsafe impl<D: fidl::encoding::ResourceDialect>
10889        fidl::encoding::Encode<AudioRendererSetUsage2Request, D>
10890        for &AudioRendererSetUsage2Request
10891    {
10892        #[inline]
10893        unsafe fn encode(
10894            self,
10895            encoder: &mut fidl::encoding::Encoder<'_, D>,
10896            offset: usize,
10897            _depth: fidl::encoding::Depth,
10898        ) -> fidl::Result<()> {
10899            encoder.debug_check_bounds::<AudioRendererSetUsage2Request>(offset);
10900            // Delegate to tuple encoding.
10901            fidl::encoding::Encode::<AudioRendererSetUsage2Request, D>::encode(
10902                (<AudioRenderUsage2 as fidl::encoding::ValueTypeMarker>::borrow(&self.usage2),),
10903                encoder,
10904                offset,
10905                _depth,
10906            )
10907        }
10908    }
10909    unsafe impl<
10910        D: fidl::encoding::ResourceDialect,
10911        T0: fidl::encoding::Encode<AudioRenderUsage2, D>,
10912    > fidl::encoding::Encode<AudioRendererSetUsage2Request, D> for (T0,)
10913    {
10914        #[inline]
10915        unsafe fn encode(
10916            self,
10917            encoder: &mut fidl::encoding::Encoder<'_, D>,
10918            offset: usize,
10919            depth: fidl::encoding::Depth,
10920        ) -> fidl::Result<()> {
10921            encoder.debug_check_bounds::<AudioRendererSetUsage2Request>(offset);
10922            // Zero out padding regions. There's no need to apply masks
10923            // because the unmasked parts will be overwritten by fields.
10924            // Write the fields.
10925            self.0.encode(encoder, offset + 0, depth)?;
10926            Ok(())
10927        }
10928    }
10929
10930    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
10931        for AudioRendererSetUsage2Request
10932    {
10933        #[inline(always)]
10934        fn new_empty() -> Self {
10935            Self { usage2: fidl::new_empty!(AudioRenderUsage2, D) }
10936        }
10937
10938        #[inline]
10939        unsafe fn decode(
10940            &mut self,
10941            decoder: &mut fidl::encoding::Decoder<'_, D>,
10942            offset: usize,
10943            _depth: fidl::encoding::Depth,
10944        ) -> fidl::Result<()> {
10945            decoder.debug_check_bounds::<Self>(offset);
10946            // Verify that padding bytes are zero.
10947            fidl::decode!(AudioRenderUsage2, D, &mut self.usage2, decoder, offset + 0, _depth)?;
10948            Ok(())
10949        }
10950    }
10951
10952    impl fidl::encoding::ValueTypeMarker for AudioRendererSetUsageRequest {
10953        type Borrowed<'a> = &'a Self;
10954        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10955            value
10956        }
10957    }
10958
10959    unsafe impl fidl::encoding::TypeMarker for AudioRendererSetUsageRequest {
10960        type Owned = Self;
10961
10962        #[inline(always)]
10963        fn inline_align(_context: fidl::encoding::Context) -> usize {
10964            4
10965        }
10966
10967        #[inline(always)]
10968        fn inline_size(_context: fidl::encoding::Context) -> usize {
10969            4
10970        }
10971    }
10972
10973    unsafe impl<D: fidl::encoding::ResourceDialect>
10974        fidl::encoding::Encode<AudioRendererSetUsageRequest, D> for &AudioRendererSetUsageRequest
10975    {
10976        #[inline]
10977        unsafe fn encode(
10978            self,
10979            encoder: &mut fidl::encoding::Encoder<'_, D>,
10980            offset: usize,
10981            _depth: fidl::encoding::Depth,
10982        ) -> fidl::Result<()> {
10983            encoder.debug_check_bounds::<AudioRendererSetUsageRequest>(offset);
10984            // Delegate to tuple encoding.
10985            fidl::encoding::Encode::<AudioRendererSetUsageRequest, D>::encode(
10986                (<AudioRenderUsage as fidl::encoding::ValueTypeMarker>::borrow(&self.usage),),
10987                encoder,
10988                offset,
10989                _depth,
10990            )
10991        }
10992    }
10993    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<AudioRenderUsage, D>>
10994        fidl::encoding::Encode<AudioRendererSetUsageRequest, D> for (T0,)
10995    {
10996        #[inline]
10997        unsafe fn encode(
10998            self,
10999            encoder: &mut fidl::encoding::Encoder<'_, D>,
11000            offset: usize,
11001            depth: fidl::encoding::Depth,
11002        ) -> fidl::Result<()> {
11003            encoder.debug_check_bounds::<AudioRendererSetUsageRequest>(offset);
11004            // Zero out padding regions. There's no need to apply masks
11005            // because the unmasked parts will be overwritten by fields.
11006            // Write the fields.
11007            self.0.encode(encoder, offset + 0, depth)?;
11008            Ok(())
11009        }
11010    }
11011
11012    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
11013        for AudioRendererSetUsageRequest
11014    {
11015        #[inline(always)]
11016        fn new_empty() -> Self {
11017            Self { usage: fidl::new_empty!(AudioRenderUsage, D) }
11018        }
11019
11020        #[inline]
11021        unsafe fn decode(
11022            &mut self,
11023            decoder: &mut fidl::encoding::Decoder<'_, D>,
11024            offset: usize,
11025            _depth: fidl::encoding::Depth,
11026        ) -> fidl::Result<()> {
11027            decoder.debug_check_bounds::<Self>(offset);
11028            // Verify that padding bytes are zero.
11029            fidl::decode!(AudioRenderUsage, D, &mut self.usage, decoder, offset + 0, _depth)?;
11030            Ok(())
11031        }
11032    }
11033
11034    impl fidl::encoding::ValueTypeMarker for AudioStreamType {
11035        type Borrowed<'a> = &'a Self;
11036        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11037            value
11038        }
11039    }
11040
11041    unsafe impl fidl::encoding::TypeMarker for AudioStreamType {
11042        type Owned = Self;
11043
11044        #[inline(always)]
11045        fn inline_align(_context: fidl::encoding::Context) -> usize {
11046            4
11047        }
11048
11049        #[inline(always)]
11050        fn inline_size(_context: fidl::encoding::Context) -> usize {
11051            12
11052        }
11053    }
11054
11055    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AudioStreamType, D>
11056        for &AudioStreamType
11057    {
11058        #[inline]
11059        unsafe fn encode(
11060            self,
11061            encoder: &mut fidl::encoding::Encoder<'_, D>,
11062            offset: usize,
11063            _depth: fidl::encoding::Depth,
11064        ) -> fidl::Result<()> {
11065            encoder.debug_check_bounds::<AudioStreamType>(offset);
11066            // Delegate to tuple encoding.
11067            fidl::encoding::Encode::<AudioStreamType, D>::encode(
11068                (
11069                    <AudioSampleFormat as fidl::encoding::ValueTypeMarker>::borrow(
11070                        &self.sample_format,
11071                    ),
11072                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.channels),
11073                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.frames_per_second),
11074                ),
11075                encoder,
11076                offset,
11077                _depth,
11078            )
11079        }
11080    }
11081    unsafe impl<
11082        D: fidl::encoding::ResourceDialect,
11083        T0: fidl::encoding::Encode<AudioSampleFormat, D>,
11084        T1: fidl::encoding::Encode<u32, D>,
11085        T2: fidl::encoding::Encode<u32, D>,
11086    > fidl::encoding::Encode<AudioStreamType, D> for (T0, T1, T2)
11087    {
11088        #[inline]
11089        unsafe fn encode(
11090            self,
11091            encoder: &mut fidl::encoding::Encoder<'_, D>,
11092            offset: usize,
11093            depth: fidl::encoding::Depth,
11094        ) -> fidl::Result<()> {
11095            encoder.debug_check_bounds::<AudioStreamType>(offset);
11096            // Zero out padding regions. There's no need to apply masks
11097            // because the unmasked parts will be overwritten by fields.
11098            // Write the fields.
11099            self.0.encode(encoder, offset + 0, depth)?;
11100            self.1.encode(encoder, offset + 4, depth)?;
11101            self.2.encode(encoder, offset + 8, depth)?;
11102            Ok(())
11103        }
11104    }
11105
11106    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AudioStreamType {
11107        #[inline(always)]
11108        fn new_empty() -> Self {
11109            Self {
11110                sample_format: fidl::new_empty!(AudioSampleFormat, D),
11111                channels: fidl::new_empty!(u32, D),
11112                frames_per_second: fidl::new_empty!(u32, D),
11113            }
11114        }
11115
11116        #[inline]
11117        unsafe fn decode(
11118            &mut self,
11119            decoder: &mut fidl::encoding::Decoder<'_, D>,
11120            offset: usize,
11121            _depth: fidl::encoding::Depth,
11122        ) -> fidl::Result<()> {
11123            decoder.debug_check_bounds::<Self>(offset);
11124            // Verify that padding bytes are zero.
11125            fidl::decode!(
11126                AudioSampleFormat,
11127                D,
11128                &mut self.sample_format,
11129                decoder,
11130                offset + 0,
11131                _depth
11132            )?;
11133            fidl::decode!(u32, D, &mut self.channels, decoder, offset + 4, _depth)?;
11134            fidl::decode!(u32, D, &mut self.frames_per_second, decoder, offset + 8, _depth)?;
11135            Ok(())
11136        }
11137    }
11138
11139    impl fidl::encoding::ValueTypeMarker for Compression {
11140        type Borrowed<'a> = &'a Self;
11141        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11142            value
11143        }
11144    }
11145
11146    unsafe impl fidl::encoding::TypeMarker for Compression {
11147        type Owned = Self;
11148
11149        #[inline(always)]
11150        fn inline_align(_context: fidl::encoding::Context) -> usize {
11151            8
11152        }
11153
11154        #[inline(always)]
11155        fn inline_size(_context: fidl::encoding::Context) -> usize {
11156            32
11157        }
11158    }
11159
11160    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Compression, D>
11161        for &Compression
11162    {
11163        #[inline]
11164        unsafe fn encode(
11165            self,
11166            encoder: &mut fidl::encoding::Encoder<'_, D>,
11167            offset: usize,
11168            _depth: fidl::encoding::Depth,
11169        ) -> fidl::Result<()> {
11170            encoder.debug_check_bounds::<Compression>(offset);
11171            // Delegate to tuple encoding.
11172            fidl::encoding::Encode::<Compression, D>::encode(
11173                (
11174                    <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
11175                    <fidl::encoding::Optional<fidl::encoding::Vector<u8, 8192>> as fidl::encoding::ValueTypeMarker>::borrow(&self.parameters),
11176                ),
11177                encoder, offset, _depth
11178            )
11179        }
11180    }
11181    unsafe impl<
11182        D: fidl::encoding::ResourceDialect,
11183        T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
11184        T1: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::Vector<u8, 8192>>, D>,
11185    > fidl::encoding::Encode<Compression, D> for (T0, T1)
11186    {
11187        #[inline]
11188        unsafe fn encode(
11189            self,
11190            encoder: &mut fidl::encoding::Encoder<'_, D>,
11191            offset: usize,
11192            depth: fidl::encoding::Depth,
11193        ) -> fidl::Result<()> {
11194            encoder.debug_check_bounds::<Compression>(offset);
11195            // Zero out padding regions. There's no need to apply masks
11196            // because the unmasked parts will be overwritten by fields.
11197            // Write the fields.
11198            self.0.encode(encoder, offset + 0, depth)?;
11199            self.1.encode(encoder, offset + 16, depth)?;
11200            Ok(())
11201        }
11202    }
11203
11204    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Compression {
11205        #[inline(always)]
11206        fn new_empty() -> Self {
11207            Self {
11208                type_: fidl::new_empty!(fidl::encoding::BoundedString<256>, D),
11209                parameters: fidl::new_empty!(
11210                    fidl::encoding::Optional<fidl::encoding::Vector<u8, 8192>>,
11211                    D
11212                ),
11213            }
11214        }
11215
11216        #[inline]
11217        unsafe fn decode(
11218            &mut self,
11219            decoder: &mut fidl::encoding::Decoder<'_, D>,
11220            offset: usize,
11221            _depth: fidl::encoding::Depth,
11222        ) -> fidl::Result<()> {
11223            decoder.debug_check_bounds::<Self>(offset);
11224            // Verify that padding bytes are zero.
11225            fidl::decode!(
11226                fidl::encoding::BoundedString<256>,
11227                D,
11228                &mut self.type_,
11229                decoder,
11230                offset + 0,
11231                _depth
11232            )?;
11233            fidl::decode!(
11234                fidl::encoding::Optional<fidl::encoding::Vector<u8, 8192>>,
11235                D,
11236                &mut self.parameters,
11237                decoder,
11238                offset + 16,
11239                _depth
11240            )?;
11241            Ok(())
11242        }
11243    }
11244
11245    impl fidl::encoding::ValueTypeMarker for EncryptionPattern {
11246        type Borrowed<'a> = &'a Self;
11247        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11248            value
11249        }
11250    }
11251
11252    unsafe impl fidl::encoding::TypeMarker for EncryptionPattern {
11253        type Owned = Self;
11254
11255        #[inline(always)]
11256        fn inline_align(_context: fidl::encoding::Context) -> usize {
11257            4
11258        }
11259
11260        #[inline(always)]
11261        fn inline_size(_context: fidl::encoding::Context) -> usize {
11262            8
11263        }
11264        #[inline(always)]
11265        fn encode_is_copy() -> bool {
11266            true
11267        }
11268
11269        #[inline(always)]
11270        fn decode_is_copy() -> bool {
11271            true
11272        }
11273    }
11274
11275    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<EncryptionPattern, D>
11276        for &EncryptionPattern
11277    {
11278        #[inline]
11279        unsafe fn encode(
11280            self,
11281            encoder: &mut fidl::encoding::Encoder<'_, D>,
11282            offset: usize,
11283            _depth: fidl::encoding::Depth,
11284        ) -> fidl::Result<()> {
11285            encoder.debug_check_bounds::<EncryptionPattern>(offset);
11286            unsafe {
11287                // Copy the object into the buffer.
11288                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
11289                (buf_ptr as *mut EncryptionPattern)
11290                    .write_unaligned((self as *const EncryptionPattern).read());
11291                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
11292                // done second because the memcpy will write garbage to these bytes.
11293            }
11294            Ok(())
11295        }
11296    }
11297    unsafe impl<
11298        D: fidl::encoding::ResourceDialect,
11299        T0: fidl::encoding::Encode<u32, D>,
11300        T1: fidl::encoding::Encode<u32, D>,
11301    > fidl::encoding::Encode<EncryptionPattern, D> for (T0, T1)
11302    {
11303        #[inline]
11304        unsafe fn encode(
11305            self,
11306            encoder: &mut fidl::encoding::Encoder<'_, D>,
11307            offset: usize,
11308            depth: fidl::encoding::Depth,
11309        ) -> fidl::Result<()> {
11310            encoder.debug_check_bounds::<EncryptionPattern>(offset);
11311            // Zero out padding regions. There's no need to apply masks
11312            // because the unmasked parts will be overwritten by fields.
11313            // Write the fields.
11314            self.0.encode(encoder, offset + 0, depth)?;
11315            self.1.encode(encoder, offset + 4, depth)?;
11316            Ok(())
11317        }
11318    }
11319
11320    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for EncryptionPattern {
11321        #[inline(always)]
11322        fn new_empty() -> Self {
11323            Self {
11324                clear_blocks: fidl::new_empty!(u32, D),
11325                encrypted_blocks: fidl::new_empty!(u32, D),
11326            }
11327        }
11328
11329        #[inline]
11330        unsafe fn decode(
11331            &mut self,
11332            decoder: &mut fidl::encoding::Decoder<'_, D>,
11333            offset: usize,
11334            _depth: fidl::encoding::Depth,
11335        ) -> fidl::Result<()> {
11336            decoder.debug_check_bounds::<Self>(offset);
11337            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
11338            // Verify that padding bytes are zero.
11339            // Copy from the buffer into the object.
11340            unsafe {
11341                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
11342            }
11343            Ok(())
11344        }
11345    }
11346
11347    impl fidl::encoding::ValueTypeMarker for Metadata {
11348        type Borrowed<'a> = &'a Self;
11349        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11350            value
11351        }
11352    }
11353
11354    unsafe impl fidl::encoding::TypeMarker for Metadata {
11355        type Owned = Self;
11356
11357        #[inline(always)]
11358        fn inline_align(_context: fidl::encoding::Context) -> usize {
11359            8
11360        }
11361
11362        #[inline(always)]
11363        fn inline_size(_context: fidl::encoding::Context) -> usize {
11364            16
11365        }
11366    }
11367
11368    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Metadata, D> for &Metadata {
11369        #[inline]
11370        unsafe fn encode(
11371            self,
11372            encoder: &mut fidl::encoding::Encoder<'_, D>,
11373            offset: usize,
11374            _depth: fidl::encoding::Depth,
11375        ) -> fidl::Result<()> {
11376            encoder.debug_check_bounds::<Metadata>(offset);
11377            // Delegate to tuple encoding.
11378            fidl::encoding::Encode::<Metadata, D>::encode(
11379                (
11380                    <fidl::encoding::UnboundedVector<Property> as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),
11381                ),
11382                encoder, offset, _depth
11383            )
11384        }
11385    }
11386    unsafe impl<
11387        D: fidl::encoding::ResourceDialect,
11388        T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<Property>, D>,
11389    > fidl::encoding::Encode<Metadata, D> for (T0,)
11390    {
11391        #[inline]
11392        unsafe fn encode(
11393            self,
11394            encoder: &mut fidl::encoding::Encoder<'_, D>,
11395            offset: usize,
11396            depth: fidl::encoding::Depth,
11397        ) -> fidl::Result<()> {
11398            encoder.debug_check_bounds::<Metadata>(offset);
11399            // Zero out padding regions. There's no need to apply masks
11400            // because the unmasked parts will be overwritten by fields.
11401            // Write the fields.
11402            self.0.encode(encoder, offset + 0, depth)?;
11403            Ok(())
11404        }
11405    }
11406
11407    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Metadata {
11408        #[inline(always)]
11409        fn new_empty() -> Self {
11410            Self { properties: fidl::new_empty!(fidl::encoding::UnboundedVector<Property>, D) }
11411        }
11412
11413        #[inline]
11414        unsafe fn decode(
11415            &mut self,
11416            decoder: &mut fidl::encoding::Decoder<'_, D>,
11417            offset: usize,
11418            _depth: fidl::encoding::Depth,
11419        ) -> fidl::Result<()> {
11420            decoder.debug_check_bounds::<Self>(offset);
11421            // Verify that padding bytes are zero.
11422            fidl::decode!(
11423                fidl::encoding::UnboundedVector<Property>,
11424                D,
11425                &mut self.properties,
11426                decoder,
11427                offset + 0,
11428                _depth
11429            )?;
11430            Ok(())
11431        }
11432    }
11433
11434    impl fidl::encoding::ValueTypeMarker for Parameter {
11435        type Borrowed<'a> = &'a Self;
11436        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11437            value
11438        }
11439    }
11440
11441    unsafe impl fidl::encoding::TypeMarker for Parameter {
11442        type Owned = Self;
11443
11444        #[inline(always)]
11445        fn inline_align(_context: fidl::encoding::Context) -> usize {
11446            8
11447        }
11448
11449        #[inline(always)]
11450        fn inline_size(_context: fidl::encoding::Context) -> usize {
11451            48
11452        }
11453    }
11454
11455    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Parameter, D>
11456        for &Parameter
11457    {
11458        #[inline]
11459        unsafe fn encode(
11460            self,
11461            encoder: &mut fidl::encoding::Encoder<'_, D>,
11462            offset: usize,
11463            _depth: fidl::encoding::Depth,
11464        ) -> fidl::Result<()> {
11465            encoder.debug_check_bounds::<Parameter>(offset);
11466            // Delegate to tuple encoding.
11467            fidl::encoding::Encode::<Parameter, D>::encode(
11468                (
11469                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
11470                        &self.scope,
11471                    ),
11472                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
11473                        &self.name,
11474                    ),
11475                    <Value as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
11476                ),
11477                encoder,
11478                offset,
11479                _depth,
11480            )
11481        }
11482    }
11483    unsafe impl<
11484        D: fidl::encoding::ResourceDialect,
11485        T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
11486        T1: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
11487        T2: fidl::encoding::Encode<Value, D>,
11488    > fidl::encoding::Encode<Parameter, D> for (T0, T1, T2)
11489    {
11490        #[inline]
11491        unsafe fn encode(
11492            self,
11493            encoder: &mut fidl::encoding::Encoder<'_, D>,
11494            offset: usize,
11495            depth: fidl::encoding::Depth,
11496        ) -> fidl::Result<()> {
11497            encoder.debug_check_bounds::<Parameter>(offset);
11498            // Zero out padding regions. There's no need to apply masks
11499            // because the unmasked parts will be overwritten by fields.
11500            // Write the fields.
11501            self.0.encode(encoder, offset + 0, depth)?;
11502            self.1.encode(encoder, offset + 16, depth)?;
11503            self.2.encode(encoder, offset + 32, depth)?;
11504            Ok(())
11505        }
11506    }
11507
11508    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Parameter {
11509        #[inline(always)]
11510        fn new_empty() -> Self {
11511            Self {
11512                scope: fidl::new_empty!(fidl::encoding::UnboundedString, D),
11513                name: fidl::new_empty!(fidl::encoding::UnboundedString, D),
11514                value: fidl::new_empty!(Value, D),
11515            }
11516        }
11517
11518        #[inline]
11519        unsafe fn decode(
11520            &mut self,
11521            decoder: &mut fidl::encoding::Decoder<'_, D>,
11522            offset: usize,
11523            _depth: fidl::encoding::Depth,
11524        ) -> fidl::Result<()> {
11525            decoder.debug_check_bounds::<Self>(offset);
11526            // Verify that padding bytes are zero.
11527            fidl::decode!(
11528                fidl::encoding::UnboundedString,
11529                D,
11530                &mut self.scope,
11531                decoder,
11532                offset + 0,
11533                _depth
11534            )?;
11535            fidl::decode!(
11536                fidl::encoding::UnboundedString,
11537                D,
11538                &mut self.name,
11539                decoder,
11540                offset + 16,
11541                _depth
11542            )?;
11543            fidl::decode!(Value, D, &mut self.value, decoder, offset + 32, _depth)?;
11544            Ok(())
11545        }
11546    }
11547
11548    impl fidl::encoding::ValueTypeMarker for PcmFormat {
11549        type Borrowed<'a> = &'a Self;
11550        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11551            value
11552        }
11553    }
11554
11555    unsafe impl fidl::encoding::TypeMarker for PcmFormat {
11556        type Owned = Self;
11557
11558        #[inline(always)]
11559        fn inline_align(_context: fidl::encoding::Context) -> usize {
11560            8
11561        }
11562
11563        #[inline(always)]
11564        fn inline_size(_context: fidl::encoding::Context) -> usize {
11565            32
11566        }
11567    }
11568
11569    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PcmFormat, D>
11570        for &PcmFormat
11571    {
11572        #[inline]
11573        unsafe fn encode(
11574            self,
11575            encoder: &mut fidl::encoding::Encoder<'_, D>,
11576            offset: usize,
11577            _depth: fidl::encoding::Depth,
11578        ) -> fidl::Result<()> {
11579            encoder.debug_check_bounds::<PcmFormat>(offset);
11580            // Delegate to tuple encoding.
11581            fidl::encoding::Encode::<PcmFormat, D>::encode(
11582                (
11583                    <AudioPcmMode as fidl::encoding::ValueTypeMarker>::borrow(&self.pcm_mode),
11584                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.bits_per_sample),
11585                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.frames_per_second),
11586                    <fidl::encoding::Vector<AudioChannelId, 16> as fidl::encoding::ValueTypeMarker>::borrow(&self.channel_map),
11587                ),
11588                encoder, offset, _depth
11589            )
11590        }
11591    }
11592    unsafe impl<
11593        D: fidl::encoding::ResourceDialect,
11594        T0: fidl::encoding::Encode<AudioPcmMode, D>,
11595        T1: fidl::encoding::Encode<u32, D>,
11596        T2: fidl::encoding::Encode<u32, D>,
11597        T3: fidl::encoding::Encode<fidl::encoding::Vector<AudioChannelId, 16>, D>,
11598    > fidl::encoding::Encode<PcmFormat, D> for (T0, T1, T2, T3)
11599    {
11600        #[inline]
11601        unsafe fn encode(
11602            self,
11603            encoder: &mut fidl::encoding::Encoder<'_, D>,
11604            offset: usize,
11605            depth: fidl::encoding::Depth,
11606        ) -> fidl::Result<()> {
11607            encoder.debug_check_bounds::<PcmFormat>(offset);
11608            // Zero out padding regions. There's no need to apply masks
11609            // because the unmasked parts will be overwritten by fields.
11610            unsafe {
11611                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
11612                (ptr as *mut u64).write_unaligned(0);
11613            }
11614            // Write the fields.
11615            self.0.encode(encoder, offset + 0, depth)?;
11616            self.1.encode(encoder, offset + 4, depth)?;
11617            self.2.encode(encoder, offset + 8, depth)?;
11618            self.3.encode(encoder, offset + 16, depth)?;
11619            Ok(())
11620        }
11621    }
11622
11623    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PcmFormat {
11624        #[inline(always)]
11625        fn new_empty() -> Self {
11626            Self {
11627                pcm_mode: fidl::new_empty!(AudioPcmMode, D),
11628                bits_per_sample: fidl::new_empty!(u32, D),
11629                frames_per_second: fidl::new_empty!(u32, D),
11630                channel_map: fidl::new_empty!(fidl::encoding::Vector<AudioChannelId, 16>, D),
11631            }
11632        }
11633
11634        #[inline]
11635        unsafe fn decode(
11636            &mut self,
11637            decoder: &mut fidl::encoding::Decoder<'_, D>,
11638            offset: usize,
11639            _depth: fidl::encoding::Depth,
11640        ) -> fidl::Result<()> {
11641            decoder.debug_check_bounds::<Self>(offset);
11642            // Verify that padding bytes are zero.
11643            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
11644            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11645            let mask = 0xffffffff00000000u64;
11646            let maskedval = padval & mask;
11647            if maskedval != 0 {
11648                return Err(fidl::Error::NonZeroPadding {
11649                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
11650                });
11651            }
11652            fidl::decode!(AudioPcmMode, D, &mut self.pcm_mode, decoder, offset + 0, _depth)?;
11653            fidl::decode!(u32, D, &mut self.bits_per_sample, decoder, offset + 4, _depth)?;
11654            fidl::decode!(u32, D, &mut self.frames_per_second, decoder, offset + 8, _depth)?;
11655            fidl::decode!(fidl::encoding::Vector<AudioChannelId, 16>, D, &mut self.channel_map, decoder, offset + 16, _depth)?;
11656            Ok(())
11657        }
11658    }
11659
11660    impl fidl::encoding::ValueTypeMarker for ProfileProviderRegisterHandlerWithCapacityResponse {
11661        type Borrowed<'a> = &'a Self;
11662        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11663            value
11664        }
11665    }
11666
11667    unsafe impl fidl::encoding::TypeMarker for ProfileProviderRegisterHandlerWithCapacityResponse {
11668        type Owned = Self;
11669
11670        #[inline(always)]
11671        fn inline_align(_context: fidl::encoding::Context) -> usize {
11672            8
11673        }
11674
11675        #[inline(always)]
11676        fn inline_size(_context: fidl::encoding::Context) -> usize {
11677            16
11678        }
11679        #[inline(always)]
11680        fn encode_is_copy() -> bool {
11681            true
11682        }
11683
11684        #[inline(always)]
11685        fn decode_is_copy() -> bool {
11686            true
11687        }
11688    }
11689
11690    unsafe impl<D: fidl::encoding::ResourceDialect>
11691        fidl::encoding::Encode<ProfileProviderRegisterHandlerWithCapacityResponse, D>
11692        for &ProfileProviderRegisterHandlerWithCapacityResponse
11693    {
11694        #[inline]
11695        unsafe fn encode(
11696            self,
11697            encoder: &mut fidl::encoding::Encoder<'_, D>,
11698            offset: usize,
11699            _depth: fidl::encoding::Depth,
11700        ) -> fidl::Result<()> {
11701            encoder
11702                .debug_check_bounds::<ProfileProviderRegisterHandlerWithCapacityResponse>(offset);
11703            unsafe {
11704                // Copy the object into the buffer.
11705                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
11706                (buf_ptr as *mut ProfileProviderRegisterHandlerWithCapacityResponse)
11707                    .write_unaligned(
11708                        (self as *const ProfileProviderRegisterHandlerWithCapacityResponse).read(),
11709                    );
11710                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
11711                // done second because the memcpy will write garbage to these bytes.
11712            }
11713            Ok(())
11714        }
11715    }
11716    unsafe impl<
11717        D: fidl::encoding::ResourceDialect,
11718        T0: fidl::encoding::Encode<i64, D>,
11719        T1: fidl::encoding::Encode<i64, D>,
11720    > fidl::encoding::Encode<ProfileProviderRegisterHandlerWithCapacityResponse, D> for (T0, T1)
11721    {
11722        #[inline]
11723        unsafe fn encode(
11724            self,
11725            encoder: &mut fidl::encoding::Encoder<'_, D>,
11726            offset: usize,
11727            depth: fidl::encoding::Depth,
11728        ) -> fidl::Result<()> {
11729            encoder
11730                .debug_check_bounds::<ProfileProviderRegisterHandlerWithCapacityResponse>(offset);
11731            // Zero out padding regions. There's no need to apply masks
11732            // because the unmasked parts will be overwritten by fields.
11733            // Write the fields.
11734            self.0.encode(encoder, offset + 0, depth)?;
11735            self.1.encode(encoder, offset + 8, depth)?;
11736            Ok(())
11737        }
11738    }
11739
11740    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
11741        for ProfileProviderRegisterHandlerWithCapacityResponse
11742    {
11743        #[inline(always)]
11744        fn new_empty() -> Self {
11745            Self { period: fidl::new_empty!(i64, D), capacity: fidl::new_empty!(i64, D) }
11746        }
11747
11748        #[inline]
11749        unsafe fn decode(
11750            &mut self,
11751            decoder: &mut fidl::encoding::Decoder<'_, D>,
11752            offset: usize,
11753            _depth: fidl::encoding::Depth,
11754        ) -> fidl::Result<()> {
11755            decoder.debug_check_bounds::<Self>(offset);
11756            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
11757            // Verify that padding bytes are zero.
11758            // Copy from the buffer into the object.
11759            unsafe {
11760                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
11761            }
11762            Ok(())
11763        }
11764    }
11765
11766    impl fidl::encoding::ValueTypeMarker for Property {
11767        type Borrowed<'a> = &'a Self;
11768        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11769            value
11770        }
11771    }
11772
11773    unsafe impl fidl::encoding::TypeMarker for Property {
11774        type Owned = Self;
11775
11776        #[inline(always)]
11777        fn inline_align(_context: fidl::encoding::Context) -> usize {
11778            8
11779        }
11780
11781        #[inline(always)]
11782        fn inline_size(_context: fidl::encoding::Context) -> usize {
11783            32
11784        }
11785    }
11786
11787    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Property, D> for &Property {
11788        #[inline]
11789        unsafe fn encode(
11790            self,
11791            encoder: &mut fidl::encoding::Encoder<'_, D>,
11792            offset: usize,
11793            _depth: fidl::encoding::Depth,
11794        ) -> fidl::Result<()> {
11795            encoder.debug_check_bounds::<Property>(offset);
11796            // Delegate to tuple encoding.
11797            fidl::encoding::Encode::<Property, D>::encode(
11798                (
11799                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
11800                        &self.label,
11801                    ),
11802                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
11803                        &self.value,
11804                    ),
11805                ),
11806                encoder,
11807                offset,
11808                _depth,
11809            )
11810        }
11811    }
11812    unsafe impl<
11813        D: fidl::encoding::ResourceDialect,
11814        T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
11815        T1: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
11816    > fidl::encoding::Encode<Property, D> for (T0, T1)
11817    {
11818        #[inline]
11819        unsafe fn encode(
11820            self,
11821            encoder: &mut fidl::encoding::Encoder<'_, D>,
11822            offset: usize,
11823            depth: fidl::encoding::Depth,
11824        ) -> fidl::Result<()> {
11825            encoder.debug_check_bounds::<Property>(offset);
11826            // Zero out padding regions. There's no need to apply masks
11827            // because the unmasked parts will be overwritten by fields.
11828            // Write the fields.
11829            self.0.encode(encoder, offset + 0, depth)?;
11830            self.1.encode(encoder, offset + 16, depth)?;
11831            Ok(())
11832        }
11833    }
11834
11835    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Property {
11836        #[inline(always)]
11837        fn new_empty() -> Self {
11838            Self {
11839                label: fidl::new_empty!(fidl::encoding::UnboundedString, D),
11840                value: fidl::new_empty!(fidl::encoding::UnboundedString, D),
11841            }
11842        }
11843
11844        #[inline]
11845        unsafe fn decode(
11846            &mut self,
11847            decoder: &mut fidl::encoding::Decoder<'_, D>,
11848            offset: usize,
11849            _depth: fidl::encoding::Depth,
11850        ) -> fidl::Result<()> {
11851            decoder.debug_check_bounds::<Self>(offset);
11852            // Verify that padding bytes are zero.
11853            fidl::decode!(
11854                fidl::encoding::UnboundedString,
11855                D,
11856                &mut self.label,
11857                decoder,
11858                offset + 0,
11859                _depth
11860            )?;
11861            fidl::decode!(
11862                fidl::encoding::UnboundedString,
11863                D,
11864                &mut self.value,
11865                decoder,
11866                offset + 16,
11867                _depth
11868            )?;
11869            Ok(())
11870        }
11871    }
11872
11873    impl fidl::encoding::ValueTypeMarker for SbcEncoderSettings {
11874        type Borrowed<'a> = &'a Self;
11875        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11876            value
11877        }
11878    }
11879
11880    unsafe impl fidl::encoding::TypeMarker for SbcEncoderSettings {
11881        type Owned = Self;
11882
11883        #[inline(always)]
11884        fn inline_align(_context: fidl::encoding::Context) -> usize {
11885            8
11886        }
11887
11888        #[inline(always)]
11889        fn inline_size(_context: fidl::encoding::Context) -> usize {
11890            24
11891        }
11892    }
11893
11894    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SbcEncoderSettings, D>
11895        for &SbcEncoderSettings
11896    {
11897        #[inline]
11898        unsafe fn encode(
11899            self,
11900            encoder: &mut fidl::encoding::Encoder<'_, D>,
11901            offset: usize,
11902            _depth: fidl::encoding::Depth,
11903        ) -> fidl::Result<()> {
11904            encoder.debug_check_bounds::<SbcEncoderSettings>(offset);
11905            // Delegate to tuple encoding.
11906            fidl::encoding::Encode::<SbcEncoderSettings, D>::encode(
11907                (
11908                    <SbcSubBands as fidl::encoding::ValueTypeMarker>::borrow(&self.sub_bands),
11909                    <SbcAllocation as fidl::encoding::ValueTypeMarker>::borrow(&self.allocation),
11910                    <SbcBlockCount as fidl::encoding::ValueTypeMarker>::borrow(&self.block_count),
11911                    <SbcChannelMode as fidl::encoding::ValueTypeMarker>::borrow(&self.channel_mode),
11912                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.bit_pool),
11913                ),
11914                encoder,
11915                offset,
11916                _depth,
11917            )
11918        }
11919    }
11920    unsafe impl<
11921        D: fidl::encoding::ResourceDialect,
11922        T0: fidl::encoding::Encode<SbcSubBands, D>,
11923        T1: fidl::encoding::Encode<SbcAllocation, D>,
11924        T2: fidl::encoding::Encode<SbcBlockCount, D>,
11925        T3: fidl::encoding::Encode<SbcChannelMode, D>,
11926        T4: fidl::encoding::Encode<u64, D>,
11927    > fidl::encoding::Encode<SbcEncoderSettings, D> for (T0, T1, T2, T3, T4)
11928    {
11929        #[inline]
11930        unsafe fn encode(
11931            self,
11932            encoder: &mut fidl::encoding::Encoder<'_, D>,
11933            offset: usize,
11934            depth: fidl::encoding::Depth,
11935        ) -> fidl::Result<()> {
11936            encoder.debug_check_bounds::<SbcEncoderSettings>(offset);
11937            // Zero out padding regions. There's no need to apply masks
11938            // because the unmasked parts will be overwritten by fields.
11939            // Write the fields.
11940            self.0.encode(encoder, offset + 0, depth)?;
11941            self.1.encode(encoder, offset + 4, depth)?;
11942            self.2.encode(encoder, offset + 8, depth)?;
11943            self.3.encode(encoder, offset + 12, depth)?;
11944            self.4.encode(encoder, offset + 16, depth)?;
11945            Ok(())
11946        }
11947    }
11948
11949    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SbcEncoderSettings {
11950        #[inline(always)]
11951        fn new_empty() -> Self {
11952            Self {
11953                sub_bands: fidl::new_empty!(SbcSubBands, D),
11954                allocation: fidl::new_empty!(SbcAllocation, D),
11955                block_count: fidl::new_empty!(SbcBlockCount, D),
11956                channel_mode: fidl::new_empty!(SbcChannelMode, D),
11957                bit_pool: fidl::new_empty!(u64, D),
11958            }
11959        }
11960
11961        #[inline]
11962        unsafe fn decode(
11963            &mut self,
11964            decoder: &mut fidl::encoding::Decoder<'_, D>,
11965            offset: usize,
11966            _depth: fidl::encoding::Depth,
11967        ) -> fidl::Result<()> {
11968            decoder.debug_check_bounds::<Self>(offset);
11969            // Verify that padding bytes are zero.
11970            fidl::decode!(SbcSubBands, D, &mut self.sub_bands, decoder, offset + 0, _depth)?;
11971            fidl::decode!(SbcAllocation, D, &mut self.allocation, decoder, offset + 4, _depth)?;
11972            fidl::decode!(SbcBlockCount, D, &mut self.block_count, decoder, offset + 8, _depth)?;
11973            fidl::decode!(SbcChannelMode, D, &mut self.channel_mode, decoder, offset + 12, _depth)?;
11974            fidl::decode!(u64, D, &mut self.bit_pool, decoder, offset + 16, _depth)?;
11975            Ok(())
11976        }
11977    }
11978
11979    impl fidl::encoding::ValueTypeMarker for StreamBufferSetRemovePayloadBufferRequest {
11980        type Borrowed<'a> = &'a Self;
11981        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11982            value
11983        }
11984    }
11985
11986    unsafe impl fidl::encoding::TypeMarker for StreamBufferSetRemovePayloadBufferRequest {
11987        type Owned = Self;
11988
11989        #[inline(always)]
11990        fn inline_align(_context: fidl::encoding::Context) -> usize {
11991            4
11992        }
11993
11994        #[inline(always)]
11995        fn inline_size(_context: fidl::encoding::Context) -> usize {
11996            4
11997        }
11998        #[inline(always)]
11999        fn encode_is_copy() -> bool {
12000            true
12001        }
12002
12003        #[inline(always)]
12004        fn decode_is_copy() -> bool {
12005            true
12006        }
12007    }
12008
12009    unsafe impl<D: fidl::encoding::ResourceDialect>
12010        fidl::encoding::Encode<StreamBufferSetRemovePayloadBufferRequest, D>
12011        for &StreamBufferSetRemovePayloadBufferRequest
12012    {
12013        #[inline]
12014        unsafe fn encode(
12015            self,
12016            encoder: &mut fidl::encoding::Encoder<'_, D>,
12017            offset: usize,
12018            _depth: fidl::encoding::Depth,
12019        ) -> fidl::Result<()> {
12020            encoder.debug_check_bounds::<StreamBufferSetRemovePayloadBufferRequest>(offset);
12021            unsafe {
12022                // Copy the object into the buffer.
12023                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
12024                (buf_ptr as *mut StreamBufferSetRemovePayloadBufferRequest).write_unaligned(
12025                    (self as *const StreamBufferSetRemovePayloadBufferRequest).read(),
12026                );
12027                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
12028                // done second because the memcpy will write garbage to these bytes.
12029            }
12030            Ok(())
12031        }
12032    }
12033    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
12034        fidl::encoding::Encode<StreamBufferSetRemovePayloadBufferRequest, D> for (T0,)
12035    {
12036        #[inline]
12037        unsafe fn encode(
12038            self,
12039            encoder: &mut fidl::encoding::Encoder<'_, D>,
12040            offset: usize,
12041            depth: fidl::encoding::Depth,
12042        ) -> fidl::Result<()> {
12043            encoder.debug_check_bounds::<StreamBufferSetRemovePayloadBufferRequest>(offset);
12044            // Zero out padding regions. There's no need to apply masks
12045            // because the unmasked parts will be overwritten by fields.
12046            // Write the fields.
12047            self.0.encode(encoder, offset + 0, depth)?;
12048            Ok(())
12049        }
12050    }
12051
12052    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
12053        for StreamBufferSetRemovePayloadBufferRequest
12054    {
12055        #[inline(always)]
12056        fn new_empty() -> Self {
12057            Self { id: fidl::new_empty!(u32, D) }
12058        }
12059
12060        #[inline]
12061        unsafe fn decode(
12062            &mut self,
12063            decoder: &mut fidl::encoding::Decoder<'_, D>,
12064            offset: usize,
12065            _depth: fidl::encoding::Depth,
12066        ) -> fidl::Result<()> {
12067            decoder.debug_check_bounds::<Self>(offset);
12068            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
12069            // Verify that padding bytes are zero.
12070            // Copy from the buffer into the object.
12071            unsafe {
12072                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
12073            }
12074            Ok(())
12075        }
12076    }
12077
12078    impl fidl::encoding::ValueTypeMarker for StreamPacket {
12079        type Borrowed<'a> = &'a Self;
12080        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
12081            value
12082        }
12083    }
12084
12085    unsafe impl fidl::encoding::TypeMarker for StreamPacket {
12086        type Owned = Self;
12087
12088        #[inline(always)]
12089        fn inline_align(_context: fidl::encoding::Context) -> usize {
12090            8
12091        }
12092
12093        #[inline(always)]
12094        fn inline_size(_context: fidl::encoding::Context) -> usize {
12095            56
12096        }
12097    }
12098
12099    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StreamPacket, D>
12100        for &StreamPacket
12101    {
12102        #[inline]
12103        unsafe fn encode(
12104            self,
12105            encoder: &mut fidl::encoding::Encoder<'_, D>,
12106            offset: usize,
12107            _depth: fidl::encoding::Depth,
12108        ) -> fidl::Result<()> {
12109            encoder.debug_check_bounds::<StreamPacket>(offset);
12110            unsafe {
12111                // Copy the object into the buffer.
12112                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
12113                (buf_ptr as *mut StreamPacket)
12114                    .write_unaligned((self as *const StreamPacket).read());
12115                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
12116                // done second because the memcpy will write garbage to these bytes.
12117                let padding_ptr = buf_ptr.offset(8) as *mut u64;
12118                let padding_mask = 0xffffffff00000000u64;
12119                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
12120                let padding_ptr = buf_ptr.offset(32) as *mut u64;
12121                let padding_mask = 0xffffffff00000000u64;
12122                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
12123            }
12124            Ok(())
12125        }
12126    }
12127    unsafe impl<
12128        D: fidl::encoding::ResourceDialect,
12129        T0: fidl::encoding::Encode<i64, D>,
12130        T1: fidl::encoding::Encode<u32, D>,
12131        T2: fidl::encoding::Encode<u64, D>,
12132        T3: fidl::encoding::Encode<u64, D>,
12133        T4: fidl::encoding::Encode<u32, D>,
12134        T5: fidl::encoding::Encode<u64, D>,
12135        T6: fidl::encoding::Encode<u64, D>,
12136    > fidl::encoding::Encode<StreamPacket, D> for (T0, T1, T2, T3, T4, T5, T6)
12137    {
12138        #[inline]
12139        unsafe fn encode(
12140            self,
12141            encoder: &mut fidl::encoding::Encoder<'_, D>,
12142            offset: usize,
12143            depth: fidl::encoding::Depth,
12144        ) -> fidl::Result<()> {
12145            encoder.debug_check_bounds::<StreamPacket>(offset);
12146            // Zero out padding regions. There's no need to apply masks
12147            // because the unmasked parts will be overwritten by fields.
12148            unsafe {
12149                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
12150                (ptr as *mut u64).write_unaligned(0);
12151            }
12152            unsafe {
12153                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
12154                (ptr as *mut u64).write_unaligned(0);
12155            }
12156            // Write the fields.
12157            self.0.encode(encoder, offset + 0, depth)?;
12158            self.1.encode(encoder, offset + 8, depth)?;
12159            self.2.encode(encoder, offset + 16, depth)?;
12160            self.3.encode(encoder, offset + 24, depth)?;
12161            self.4.encode(encoder, offset + 32, depth)?;
12162            self.5.encode(encoder, offset + 40, depth)?;
12163            self.6.encode(encoder, offset + 48, depth)?;
12164            Ok(())
12165        }
12166    }
12167
12168    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StreamPacket {
12169        #[inline(always)]
12170        fn new_empty() -> Self {
12171            Self {
12172                pts: fidl::new_empty!(i64, D),
12173                payload_buffer_id: fidl::new_empty!(u32, D),
12174                payload_offset: fidl::new_empty!(u64, D),
12175                payload_size: fidl::new_empty!(u64, D),
12176                flags: fidl::new_empty!(u32, D),
12177                buffer_config: fidl::new_empty!(u64, D),
12178                stream_segment_id: fidl::new_empty!(u64, D),
12179            }
12180        }
12181
12182        #[inline]
12183        unsafe fn decode(
12184            &mut self,
12185            decoder: &mut fidl::encoding::Decoder<'_, D>,
12186            offset: usize,
12187            _depth: fidl::encoding::Depth,
12188        ) -> fidl::Result<()> {
12189            decoder.debug_check_bounds::<Self>(offset);
12190            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
12191            // Verify that padding bytes are zero.
12192            let ptr = unsafe { buf_ptr.offset(8) };
12193            let padval = unsafe { (ptr as *const u64).read_unaligned() };
12194            let mask = 0xffffffff00000000u64;
12195            let maskedval = padval & mask;
12196            if maskedval != 0 {
12197                return Err(fidl::Error::NonZeroPadding {
12198                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
12199                });
12200            }
12201            let ptr = unsafe { buf_ptr.offset(32) };
12202            let padval = unsafe { (ptr as *const u64).read_unaligned() };
12203            let mask = 0xffffffff00000000u64;
12204            let maskedval = padval & mask;
12205            if maskedval != 0 {
12206                return Err(fidl::Error::NonZeroPadding {
12207                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
12208                });
12209            }
12210            // Copy from the buffer into the object.
12211            unsafe {
12212                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 56);
12213            }
12214            Ok(())
12215        }
12216    }
12217
12218    impl fidl::encoding::ValueTypeMarker for StreamProcessorCloseCurrentStreamRequest {
12219        type Borrowed<'a> = &'a Self;
12220        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
12221            value
12222        }
12223    }
12224
12225    unsafe impl fidl::encoding::TypeMarker for StreamProcessorCloseCurrentStreamRequest {
12226        type Owned = Self;
12227
12228        #[inline(always)]
12229        fn inline_align(_context: fidl::encoding::Context) -> usize {
12230            8
12231        }
12232
12233        #[inline(always)]
12234        fn inline_size(_context: fidl::encoding::Context) -> usize {
12235            16
12236        }
12237    }
12238
12239    unsafe impl<D: fidl::encoding::ResourceDialect>
12240        fidl::encoding::Encode<StreamProcessorCloseCurrentStreamRequest, D>
12241        for &StreamProcessorCloseCurrentStreamRequest
12242    {
12243        #[inline]
12244        unsafe fn encode(
12245            self,
12246            encoder: &mut fidl::encoding::Encoder<'_, D>,
12247            offset: usize,
12248            _depth: fidl::encoding::Depth,
12249        ) -> fidl::Result<()> {
12250            encoder.debug_check_bounds::<StreamProcessorCloseCurrentStreamRequest>(offset);
12251            // Delegate to tuple encoding.
12252            fidl::encoding::Encode::<StreamProcessorCloseCurrentStreamRequest, D>::encode(
12253                (
12254                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.stream_lifetime_ordinal),
12255                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.release_input_buffers),
12256                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.release_output_buffers),
12257                ),
12258                encoder,
12259                offset,
12260                _depth,
12261            )
12262        }
12263    }
12264    unsafe impl<
12265        D: fidl::encoding::ResourceDialect,
12266        T0: fidl::encoding::Encode<u64, D>,
12267        T1: fidl::encoding::Encode<bool, D>,
12268        T2: fidl::encoding::Encode<bool, D>,
12269    > fidl::encoding::Encode<StreamProcessorCloseCurrentStreamRequest, D> for (T0, T1, T2)
12270    {
12271        #[inline]
12272        unsafe fn encode(
12273            self,
12274            encoder: &mut fidl::encoding::Encoder<'_, D>,
12275            offset: usize,
12276            depth: fidl::encoding::Depth,
12277        ) -> fidl::Result<()> {
12278            encoder.debug_check_bounds::<StreamProcessorCloseCurrentStreamRequest>(offset);
12279            // Zero out padding regions. There's no need to apply masks
12280            // because the unmasked parts will be overwritten by fields.
12281            unsafe {
12282                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
12283                (ptr as *mut u64).write_unaligned(0);
12284            }
12285            // Write the fields.
12286            self.0.encode(encoder, offset + 0, depth)?;
12287            self.1.encode(encoder, offset + 8, depth)?;
12288            self.2.encode(encoder, offset + 9, depth)?;
12289            Ok(())
12290        }
12291    }
12292
12293    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
12294        for StreamProcessorCloseCurrentStreamRequest
12295    {
12296        #[inline(always)]
12297        fn new_empty() -> Self {
12298            Self {
12299                stream_lifetime_ordinal: fidl::new_empty!(u64, D),
12300                release_input_buffers: fidl::new_empty!(bool, D),
12301                release_output_buffers: fidl::new_empty!(bool, D),
12302            }
12303        }
12304
12305        #[inline]
12306        unsafe fn decode(
12307            &mut self,
12308            decoder: &mut fidl::encoding::Decoder<'_, D>,
12309            offset: usize,
12310            _depth: fidl::encoding::Depth,
12311        ) -> fidl::Result<()> {
12312            decoder.debug_check_bounds::<Self>(offset);
12313            // Verify that padding bytes are zero.
12314            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
12315            let padval = unsafe { (ptr as *const u64).read_unaligned() };
12316            let mask = 0xffffffffffff0000u64;
12317            let maskedval = padval & mask;
12318            if maskedval != 0 {
12319                return Err(fidl::Error::NonZeroPadding {
12320                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
12321                });
12322            }
12323            fidl::decode!(u64, D, &mut self.stream_lifetime_ordinal, decoder, offset + 0, _depth)?;
12324            fidl::decode!(bool, D, &mut self.release_input_buffers, decoder, offset + 8, _depth)?;
12325            fidl::decode!(bool, D, &mut self.release_output_buffers, decoder, offset + 9, _depth)?;
12326            Ok(())
12327        }
12328    }
12329
12330    impl fidl::encoding::ValueTypeMarker for StreamProcessorCompleteOutputBufferPartialSettingsRequest {
12331        type Borrowed<'a> = &'a Self;
12332        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
12333            value
12334        }
12335    }
12336
12337    unsafe impl fidl::encoding::TypeMarker
12338        for StreamProcessorCompleteOutputBufferPartialSettingsRequest
12339    {
12340        type Owned = Self;
12341
12342        #[inline(always)]
12343        fn inline_align(_context: fidl::encoding::Context) -> usize {
12344            8
12345        }
12346
12347        #[inline(always)]
12348        fn inline_size(_context: fidl::encoding::Context) -> usize {
12349            8
12350        }
12351        #[inline(always)]
12352        fn encode_is_copy() -> bool {
12353            true
12354        }
12355
12356        #[inline(always)]
12357        fn decode_is_copy() -> bool {
12358            true
12359        }
12360    }
12361
12362    unsafe impl<D: fidl::encoding::ResourceDialect>
12363        fidl::encoding::Encode<StreamProcessorCompleteOutputBufferPartialSettingsRequest, D>
12364        for &StreamProcessorCompleteOutputBufferPartialSettingsRequest
12365    {
12366        #[inline]
12367        unsafe fn encode(
12368            self,
12369            encoder: &mut fidl::encoding::Encoder<'_, D>,
12370            offset: usize,
12371            _depth: fidl::encoding::Depth,
12372        ) -> fidl::Result<()> {
12373            encoder
12374                .debug_check_bounds::<StreamProcessorCompleteOutputBufferPartialSettingsRequest>(
12375                    offset,
12376                );
12377            unsafe {
12378                // Copy the object into the buffer.
12379                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
12380                (buf_ptr as *mut StreamProcessorCompleteOutputBufferPartialSettingsRequest)
12381                    .write_unaligned(
12382                        (self as *const StreamProcessorCompleteOutputBufferPartialSettingsRequest)
12383                            .read(),
12384                    );
12385                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
12386                // done second because the memcpy will write garbage to these bytes.
12387            }
12388            Ok(())
12389        }
12390    }
12391    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
12392        fidl::encoding::Encode<StreamProcessorCompleteOutputBufferPartialSettingsRequest, D>
12393        for (T0,)
12394    {
12395        #[inline]
12396        unsafe fn encode(
12397            self,
12398            encoder: &mut fidl::encoding::Encoder<'_, D>,
12399            offset: usize,
12400            depth: fidl::encoding::Depth,
12401        ) -> fidl::Result<()> {
12402            encoder
12403                .debug_check_bounds::<StreamProcessorCompleteOutputBufferPartialSettingsRequest>(
12404                    offset,
12405                );
12406            // Zero out padding regions. There's no need to apply masks
12407            // because the unmasked parts will be overwritten by fields.
12408            // Write the fields.
12409            self.0.encode(encoder, offset + 0, depth)?;
12410            Ok(())
12411        }
12412    }
12413
12414    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
12415        for StreamProcessorCompleteOutputBufferPartialSettingsRequest
12416    {
12417        #[inline(always)]
12418        fn new_empty() -> Self {
12419            Self { buffer_lifetime_ordinal: fidl::new_empty!(u64, D) }
12420        }
12421
12422        #[inline]
12423        unsafe fn decode(
12424            &mut self,
12425            decoder: &mut fidl::encoding::Decoder<'_, D>,
12426            offset: usize,
12427            _depth: fidl::encoding::Depth,
12428        ) -> fidl::Result<()> {
12429            decoder.debug_check_bounds::<Self>(offset);
12430            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
12431            // Verify that padding bytes are zero.
12432            // Copy from the buffer into the object.
12433            unsafe {
12434                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
12435            }
12436            Ok(())
12437        }
12438    }
12439
12440    impl fidl::encoding::ValueTypeMarker for StreamProcessorFlushEndOfStreamAndCloseStreamRequest {
12441        type Borrowed<'a> = &'a Self;
12442        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
12443            value
12444        }
12445    }
12446
12447    unsafe impl fidl::encoding::TypeMarker for StreamProcessorFlushEndOfStreamAndCloseStreamRequest {
12448        type Owned = Self;
12449
12450        #[inline(always)]
12451        fn inline_align(_context: fidl::encoding::Context) -> usize {
12452            8
12453        }
12454
12455        #[inline(always)]
12456        fn inline_size(_context: fidl::encoding::Context) -> usize {
12457            8
12458        }
12459        #[inline(always)]
12460        fn encode_is_copy() -> bool {
12461            true
12462        }
12463
12464        #[inline(always)]
12465        fn decode_is_copy() -> bool {
12466            true
12467        }
12468    }
12469
12470    unsafe impl<D: fidl::encoding::ResourceDialect>
12471        fidl::encoding::Encode<StreamProcessorFlushEndOfStreamAndCloseStreamRequest, D>
12472        for &StreamProcessorFlushEndOfStreamAndCloseStreamRequest
12473    {
12474        #[inline]
12475        unsafe fn encode(
12476            self,
12477            encoder: &mut fidl::encoding::Encoder<'_, D>,
12478            offset: usize,
12479            _depth: fidl::encoding::Depth,
12480        ) -> fidl::Result<()> {
12481            encoder
12482                .debug_check_bounds::<StreamProcessorFlushEndOfStreamAndCloseStreamRequest>(offset);
12483            unsafe {
12484                // Copy the object into the buffer.
12485                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
12486                (buf_ptr as *mut StreamProcessorFlushEndOfStreamAndCloseStreamRequest)
12487                    .write_unaligned(
12488                        (self as *const StreamProcessorFlushEndOfStreamAndCloseStreamRequest)
12489                            .read(),
12490                    );
12491                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
12492                // done second because the memcpy will write garbage to these bytes.
12493            }
12494            Ok(())
12495        }
12496    }
12497    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
12498        fidl::encoding::Encode<StreamProcessorFlushEndOfStreamAndCloseStreamRequest, D> for (T0,)
12499    {
12500        #[inline]
12501        unsafe fn encode(
12502            self,
12503            encoder: &mut fidl::encoding::Encoder<'_, D>,
12504            offset: usize,
12505            depth: fidl::encoding::Depth,
12506        ) -> fidl::Result<()> {
12507            encoder
12508                .debug_check_bounds::<StreamProcessorFlushEndOfStreamAndCloseStreamRequest>(offset);
12509            // Zero out padding regions. There's no need to apply masks
12510            // because the unmasked parts will be overwritten by fields.
12511            // Write the fields.
12512            self.0.encode(encoder, offset + 0, depth)?;
12513            Ok(())
12514        }
12515    }
12516
12517    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
12518        for StreamProcessorFlushEndOfStreamAndCloseStreamRequest
12519    {
12520        #[inline(always)]
12521        fn new_empty() -> Self {
12522            Self { stream_lifetime_ordinal: fidl::new_empty!(u64, D) }
12523        }
12524
12525        #[inline]
12526        unsafe fn decode(
12527            &mut self,
12528            decoder: &mut fidl::encoding::Decoder<'_, D>,
12529            offset: usize,
12530            _depth: fidl::encoding::Depth,
12531        ) -> fidl::Result<()> {
12532            decoder.debug_check_bounds::<Self>(offset);
12533            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
12534            // Verify that padding bytes are zero.
12535            // Copy from the buffer into the object.
12536            unsafe {
12537                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
12538            }
12539            Ok(())
12540        }
12541    }
12542
12543    impl fidl::encoding::ValueTypeMarker for StreamProcessorOnFreeInputPacketRequest {
12544        type Borrowed<'a> = &'a Self;
12545        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
12546            value
12547        }
12548    }
12549
12550    unsafe impl fidl::encoding::TypeMarker for StreamProcessorOnFreeInputPacketRequest {
12551        type Owned = Self;
12552
12553        #[inline(always)]
12554        fn inline_align(_context: fidl::encoding::Context) -> usize {
12555            8
12556        }
12557
12558        #[inline(always)]
12559        fn inline_size(_context: fidl::encoding::Context) -> usize {
12560            16
12561        }
12562    }
12563
12564    unsafe impl<D: fidl::encoding::ResourceDialect>
12565        fidl::encoding::Encode<StreamProcessorOnFreeInputPacketRequest, D>
12566        for &StreamProcessorOnFreeInputPacketRequest
12567    {
12568        #[inline]
12569        unsafe fn encode(
12570            self,
12571            encoder: &mut fidl::encoding::Encoder<'_, D>,
12572            offset: usize,
12573            _depth: fidl::encoding::Depth,
12574        ) -> fidl::Result<()> {
12575            encoder.debug_check_bounds::<StreamProcessorOnFreeInputPacketRequest>(offset);
12576            // Delegate to tuple encoding.
12577            fidl::encoding::Encode::<StreamProcessorOnFreeInputPacketRequest, D>::encode(
12578                (<PacketHeader as fidl::encoding::ValueTypeMarker>::borrow(
12579                    &self.free_input_packet,
12580                ),),
12581                encoder,
12582                offset,
12583                _depth,
12584            )
12585        }
12586    }
12587    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PacketHeader, D>>
12588        fidl::encoding::Encode<StreamProcessorOnFreeInputPacketRequest, D> for (T0,)
12589    {
12590        #[inline]
12591        unsafe fn encode(
12592            self,
12593            encoder: &mut fidl::encoding::Encoder<'_, D>,
12594            offset: usize,
12595            depth: fidl::encoding::Depth,
12596        ) -> fidl::Result<()> {
12597            encoder.debug_check_bounds::<StreamProcessorOnFreeInputPacketRequest>(offset);
12598            // Zero out padding regions. There's no need to apply masks
12599            // because the unmasked parts will be overwritten by fields.
12600            // Write the fields.
12601            self.0.encode(encoder, offset + 0, depth)?;
12602            Ok(())
12603        }
12604    }
12605
12606    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
12607        for StreamProcessorOnFreeInputPacketRequest
12608    {
12609        #[inline(always)]
12610        fn new_empty() -> Self {
12611            Self { free_input_packet: fidl::new_empty!(PacketHeader, D) }
12612        }
12613
12614        #[inline]
12615        unsafe fn decode(
12616            &mut self,
12617            decoder: &mut fidl::encoding::Decoder<'_, D>,
12618            offset: usize,
12619            _depth: fidl::encoding::Depth,
12620        ) -> fidl::Result<()> {
12621            decoder.debug_check_bounds::<Self>(offset);
12622            // Verify that padding bytes are zero.
12623            fidl::decode!(
12624                PacketHeader,
12625                D,
12626                &mut self.free_input_packet,
12627                decoder,
12628                offset + 0,
12629                _depth
12630            )?;
12631            Ok(())
12632        }
12633    }
12634
12635    impl fidl::encoding::ValueTypeMarker for StreamProcessorOnInputConstraintsRequest {
12636        type Borrowed<'a> = &'a Self;
12637        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
12638            value
12639        }
12640    }
12641
12642    unsafe impl fidl::encoding::TypeMarker for StreamProcessorOnInputConstraintsRequest {
12643        type Owned = Self;
12644
12645        #[inline(always)]
12646        fn inline_align(_context: fidl::encoding::Context) -> usize {
12647            8
12648        }
12649
12650        #[inline(always)]
12651        fn inline_size(_context: fidl::encoding::Context) -> usize {
12652            16
12653        }
12654    }
12655
12656    unsafe impl<D: fidl::encoding::ResourceDialect>
12657        fidl::encoding::Encode<StreamProcessorOnInputConstraintsRequest, D>
12658        for &StreamProcessorOnInputConstraintsRequest
12659    {
12660        #[inline]
12661        unsafe fn encode(
12662            self,
12663            encoder: &mut fidl::encoding::Encoder<'_, D>,
12664            offset: usize,
12665            _depth: fidl::encoding::Depth,
12666        ) -> fidl::Result<()> {
12667            encoder.debug_check_bounds::<StreamProcessorOnInputConstraintsRequest>(offset);
12668            // Delegate to tuple encoding.
12669            fidl::encoding::Encode::<StreamProcessorOnInputConstraintsRequest, D>::encode(
12670                (<StreamBufferConstraints as fidl::encoding::ValueTypeMarker>::borrow(
12671                    &self.input_constraints,
12672                ),),
12673                encoder,
12674                offset,
12675                _depth,
12676            )
12677        }
12678    }
12679    unsafe impl<
12680        D: fidl::encoding::ResourceDialect,
12681        T0: fidl::encoding::Encode<StreamBufferConstraints, D>,
12682    > fidl::encoding::Encode<StreamProcessorOnInputConstraintsRequest, D> for (T0,)
12683    {
12684        #[inline]
12685        unsafe fn encode(
12686            self,
12687            encoder: &mut fidl::encoding::Encoder<'_, D>,
12688            offset: usize,
12689            depth: fidl::encoding::Depth,
12690        ) -> fidl::Result<()> {
12691            encoder.debug_check_bounds::<StreamProcessorOnInputConstraintsRequest>(offset);
12692            // Zero out padding regions. There's no need to apply masks
12693            // because the unmasked parts will be overwritten by fields.
12694            // Write the fields.
12695            self.0.encode(encoder, offset + 0, depth)?;
12696            Ok(())
12697        }
12698    }
12699
12700    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
12701        for StreamProcessorOnInputConstraintsRequest
12702    {
12703        #[inline(always)]
12704        fn new_empty() -> Self {
12705            Self { input_constraints: fidl::new_empty!(StreamBufferConstraints, D) }
12706        }
12707
12708        #[inline]
12709        unsafe fn decode(
12710            &mut self,
12711            decoder: &mut fidl::encoding::Decoder<'_, D>,
12712            offset: usize,
12713            _depth: fidl::encoding::Depth,
12714        ) -> fidl::Result<()> {
12715            decoder.debug_check_bounds::<Self>(offset);
12716            // Verify that padding bytes are zero.
12717            fidl::decode!(
12718                StreamBufferConstraints,
12719                D,
12720                &mut self.input_constraints,
12721                decoder,
12722                offset + 0,
12723                _depth
12724            )?;
12725            Ok(())
12726        }
12727    }
12728
12729    impl fidl::encoding::ValueTypeMarker for StreamProcessorOnOutputConstraintsRequest {
12730        type Borrowed<'a> = &'a Self;
12731        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
12732            value
12733        }
12734    }
12735
12736    unsafe impl fidl::encoding::TypeMarker for StreamProcessorOnOutputConstraintsRequest {
12737        type Owned = Self;
12738
12739        #[inline(always)]
12740        fn inline_align(_context: fidl::encoding::Context) -> usize {
12741            8
12742        }
12743
12744        #[inline(always)]
12745        fn inline_size(_context: fidl::encoding::Context) -> usize {
12746            16
12747        }
12748    }
12749
12750    unsafe impl<D: fidl::encoding::ResourceDialect>
12751        fidl::encoding::Encode<StreamProcessorOnOutputConstraintsRequest, D>
12752        for &StreamProcessorOnOutputConstraintsRequest
12753    {
12754        #[inline]
12755        unsafe fn encode(
12756            self,
12757            encoder: &mut fidl::encoding::Encoder<'_, D>,
12758            offset: usize,
12759            _depth: fidl::encoding::Depth,
12760        ) -> fidl::Result<()> {
12761            encoder.debug_check_bounds::<StreamProcessorOnOutputConstraintsRequest>(offset);
12762            // Delegate to tuple encoding.
12763            fidl::encoding::Encode::<StreamProcessorOnOutputConstraintsRequest, D>::encode(
12764                (<StreamOutputConstraints as fidl::encoding::ValueTypeMarker>::borrow(
12765                    &self.output_config,
12766                ),),
12767                encoder,
12768                offset,
12769                _depth,
12770            )
12771        }
12772    }
12773    unsafe impl<
12774        D: fidl::encoding::ResourceDialect,
12775        T0: fidl::encoding::Encode<StreamOutputConstraints, D>,
12776    > fidl::encoding::Encode<StreamProcessorOnOutputConstraintsRequest, D> for (T0,)
12777    {
12778        #[inline]
12779        unsafe fn encode(
12780            self,
12781            encoder: &mut fidl::encoding::Encoder<'_, D>,
12782            offset: usize,
12783            depth: fidl::encoding::Depth,
12784        ) -> fidl::Result<()> {
12785            encoder.debug_check_bounds::<StreamProcessorOnOutputConstraintsRequest>(offset);
12786            // Zero out padding regions. There's no need to apply masks
12787            // because the unmasked parts will be overwritten by fields.
12788            // Write the fields.
12789            self.0.encode(encoder, offset + 0, depth)?;
12790            Ok(())
12791        }
12792    }
12793
12794    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
12795        for StreamProcessorOnOutputConstraintsRequest
12796    {
12797        #[inline(always)]
12798        fn new_empty() -> Self {
12799            Self { output_config: fidl::new_empty!(StreamOutputConstraints, D) }
12800        }
12801
12802        #[inline]
12803        unsafe fn decode(
12804            &mut self,
12805            decoder: &mut fidl::encoding::Decoder<'_, D>,
12806            offset: usize,
12807            _depth: fidl::encoding::Depth,
12808        ) -> fidl::Result<()> {
12809            decoder.debug_check_bounds::<Self>(offset);
12810            // Verify that padding bytes are zero.
12811            fidl::decode!(
12812                StreamOutputConstraints,
12813                D,
12814                &mut self.output_config,
12815                decoder,
12816                offset + 0,
12817                _depth
12818            )?;
12819            Ok(())
12820        }
12821    }
12822
12823    impl fidl::encoding::ValueTypeMarker for StreamProcessorOnOutputEndOfStreamRequest {
12824        type Borrowed<'a> = &'a Self;
12825        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
12826            value
12827        }
12828    }
12829
12830    unsafe impl fidl::encoding::TypeMarker for StreamProcessorOnOutputEndOfStreamRequest {
12831        type Owned = Self;
12832
12833        #[inline(always)]
12834        fn inline_align(_context: fidl::encoding::Context) -> usize {
12835            8
12836        }
12837
12838        #[inline(always)]
12839        fn inline_size(_context: fidl::encoding::Context) -> usize {
12840            16
12841        }
12842    }
12843
12844    unsafe impl<D: fidl::encoding::ResourceDialect>
12845        fidl::encoding::Encode<StreamProcessorOnOutputEndOfStreamRequest, D>
12846        for &StreamProcessorOnOutputEndOfStreamRequest
12847    {
12848        #[inline]
12849        unsafe fn encode(
12850            self,
12851            encoder: &mut fidl::encoding::Encoder<'_, D>,
12852            offset: usize,
12853            _depth: fidl::encoding::Depth,
12854        ) -> fidl::Result<()> {
12855            encoder.debug_check_bounds::<StreamProcessorOnOutputEndOfStreamRequest>(offset);
12856            // Delegate to tuple encoding.
12857            fidl::encoding::Encode::<StreamProcessorOnOutputEndOfStreamRequest, D>::encode(
12858                (
12859                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.stream_lifetime_ordinal),
12860                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.error_detected_before),
12861                ),
12862                encoder,
12863                offset,
12864                _depth,
12865            )
12866        }
12867    }
12868    unsafe impl<
12869        D: fidl::encoding::ResourceDialect,
12870        T0: fidl::encoding::Encode<u64, D>,
12871        T1: fidl::encoding::Encode<bool, D>,
12872    > fidl::encoding::Encode<StreamProcessorOnOutputEndOfStreamRequest, D> for (T0, T1)
12873    {
12874        #[inline]
12875        unsafe fn encode(
12876            self,
12877            encoder: &mut fidl::encoding::Encoder<'_, D>,
12878            offset: usize,
12879            depth: fidl::encoding::Depth,
12880        ) -> fidl::Result<()> {
12881            encoder.debug_check_bounds::<StreamProcessorOnOutputEndOfStreamRequest>(offset);
12882            // Zero out padding regions. There's no need to apply masks
12883            // because the unmasked parts will be overwritten by fields.
12884            unsafe {
12885                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
12886                (ptr as *mut u64).write_unaligned(0);
12887            }
12888            // Write the fields.
12889            self.0.encode(encoder, offset + 0, depth)?;
12890            self.1.encode(encoder, offset + 8, depth)?;
12891            Ok(())
12892        }
12893    }
12894
12895    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
12896        for StreamProcessorOnOutputEndOfStreamRequest
12897    {
12898        #[inline(always)]
12899        fn new_empty() -> Self {
12900            Self {
12901                stream_lifetime_ordinal: fidl::new_empty!(u64, D),
12902                error_detected_before: fidl::new_empty!(bool, D),
12903            }
12904        }
12905
12906        #[inline]
12907        unsafe fn decode(
12908            &mut self,
12909            decoder: &mut fidl::encoding::Decoder<'_, D>,
12910            offset: usize,
12911            _depth: fidl::encoding::Depth,
12912        ) -> fidl::Result<()> {
12913            decoder.debug_check_bounds::<Self>(offset);
12914            // Verify that padding bytes are zero.
12915            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
12916            let padval = unsafe { (ptr as *const u64).read_unaligned() };
12917            let mask = 0xffffffffffffff00u64;
12918            let maskedval = padval & mask;
12919            if maskedval != 0 {
12920                return Err(fidl::Error::NonZeroPadding {
12921                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
12922                });
12923            }
12924            fidl::decode!(u64, D, &mut self.stream_lifetime_ordinal, decoder, offset + 0, _depth)?;
12925            fidl::decode!(bool, D, &mut self.error_detected_before, decoder, offset + 8, _depth)?;
12926            Ok(())
12927        }
12928    }
12929
12930    impl fidl::encoding::ValueTypeMarker for StreamProcessorOnOutputFormatRequest {
12931        type Borrowed<'a> = &'a Self;
12932        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
12933            value
12934        }
12935    }
12936
12937    unsafe impl fidl::encoding::TypeMarker for StreamProcessorOnOutputFormatRequest {
12938        type Owned = Self;
12939
12940        #[inline(always)]
12941        fn inline_align(_context: fidl::encoding::Context) -> usize {
12942            8
12943        }
12944
12945        #[inline(always)]
12946        fn inline_size(_context: fidl::encoding::Context) -> usize {
12947            16
12948        }
12949    }
12950
12951    unsafe impl<D: fidl::encoding::ResourceDialect>
12952        fidl::encoding::Encode<StreamProcessorOnOutputFormatRequest, D>
12953        for &StreamProcessorOnOutputFormatRequest
12954    {
12955        #[inline]
12956        unsafe fn encode(
12957            self,
12958            encoder: &mut fidl::encoding::Encoder<'_, D>,
12959            offset: usize,
12960            _depth: fidl::encoding::Depth,
12961        ) -> fidl::Result<()> {
12962            encoder.debug_check_bounds::<StreamProcessorOnOutputFormatRequest>(offset);
12963            // Delegate to tuple encoding.
12964            fidl::encoding::Encode::<StreamProcessorOnOutputFormatRequest, D>::encode(
12965                (<StreamOutputFormat as fidl::encoding::ValueTypeMarker>::borrow(
12966                    &self.output_format,
12967                ),),
12968                encoder,
12969                offset,
12970                _depth,
12971            )
12972        }
12973    }
12974    unsafe impl<
12975        D: fidl::encoding::ResourceDialect,
12976        T0: fidl::encoding::Encode<StreamOutputFormat, D>,
12977    > fidl::encoding::Encode<StreamProcessorOnOutputFormatRequest, D> for (T0,)
12978    {
12979        #[inline]
12980        unsafe fn encode(
12981            self,
12982            encoder: &mut fidl::encoding::Encoder<'_, D>,
12983            offset: usize,
12984            depth: fidl::encoding::Depth,
12985        ) -> fidl::Result<()> {
12986            encoder.debug_check_bounds::<StreamProcessorOnOutputFormatRequest>(offset);
12987            // Zero out padding regions. There's no need to apply masks
12988            // because the unmasked parts will be overwritten by fields.
12989            // Write the fields.
12990            self.0.encode(encoder, offset + 0, depth)?;
12991            Ok(())
12992        }
12993    }
12994
12995    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
12996        for StreamProcessorOnOutputFormatRequest
12997    {
12998        #[inline(always)]
12999        fn new_empty() -> Self {
13000            Self { output_format: fidl::new_empty!(StreamOutputFormat, D) }
13001        }
13002
13003        #[inline]
13004        unsafe fn decode(
13005            &mut self,
13006            decoder: &mut fidl::encoding::Decoder<'_, D>,
13007            offset: usize,
13008            _depth: fidl::encoding::Depth,
13009        ) -> fidl::Result<()> {
13010            decoder.debug_check_bounds::<Self>(offset);
13011            // Verify that padding bytes are zero.
13012            fidl::decode!(
13013                StreamOutputFormat,
13014                D,
13015                &mut self.output_format,
13016                decoder,
13017                offset + 0,
13018                _depth
13019            )?;
13020            Ok(())
13021        }
13022    }
13023
13024    impl fidl::encoding::ValueTypeMarker for StreamProcessorOnOutputPacketRequest {
13025        type Borrowed<'a> = &'a Self;
13026        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
13027            value
13028        }
13029    }
13030
13031    unsafe impl fidl::encoding::TypeMarker for StreamProcessorOnOutputPacketRequest {
13032        type Owned = Self;
13033
13034        #[inline(always)]
13035        fn inline_align(_context: fidl::encoding::Context) -> usize {
13036            8
13037        }
13038
13039        #[inline(always)]
13040        fn inline_size(_context: fidl::encoding::Context) -> usize {
13041            24
13042        }
13043    }
13044
13045    unsafe impl<D: fidl::encoding::ResourceDialect>
13046        fidl::encoding::Encode<StreamProcessorOnOutputPacketRequest, D>
13047        for &StreamProcessorOnOutputPacketRequest
13048    {
13049        #[inline]
13050        unsafe fn encode(
13051            self,
13052            encoder: &mut fidl::encoding::Encoder<'_, D>,
13053            offset: usize,
13054            _depth: fidl::encoding::Depth,
13055        ) -> fidl::Result<()> {
13056            encoder.debug_check_bounds::<StreamProcessorOnOutputPacketRequest>(offset);
13057            // Delegate to tuple encoding.
13058            fidl::encoding::Encode::<StreamProcessorOnOutputPacketRequest, D>::encode(
13059                (
13060                    <Packet as fidl::encoding::ValueTypeMarker>::borrow(&self.output_packet),
13061                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.error_detected_before),
13062                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.error_detected_during),
13063                ),
13064                encoder,
13065                offset,
13066                _depth,
13067            )
13068        }
13069    }
13070    unsafe impl<
13071        D: fidl::encoding::ResourceDialect,
13072        T0: fidl::encoding::Encode<Packet, D>,
13073        T1: fidl::encoding::Encode<bool, D>,
13074        T2: fidl::encoding::Encode<bool, D>,
13075    > fidl::encoding::Encode<StreamProcessorOnOutputPacketRequest, D> for (T0, T1, T2)
13076    {
13077        #[inline]
13078        unsafe fn encode(
13079            self,
13080            encoder: &mut fidl::encoding::Encoder<'_, D>,
13081            offset: usize,
13082            depth: fidl::encoding::Depth,
13083        ) -> fidl::Result<()> {
13084            encoder.debug_check_bounds::<StreamProcessorOnOutputPacketRequest>(offset);
13085            // Zero out padding regions. There's no need to apply masks
13086            // because the unmasked parts will be overwritten by fields.
13087            unsafe {
13088                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
13089                (ptr as *mut u64).write_unaligned(0);
13090            }
13091            // Write the fields.
13092            self.0.encode(encoder, offset + 0, depth)?;
13093            self.1.encode(encoder, offset + 16, depth)?;
13094            self.2.encode(encoder, offset + 17, depth)?;
13095            Ok(())
13096        }
13097    }
13098
13099    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
13100        for StreamProcessorOnOutputPacketRequest
13101    {
13102        #[inline(always)]
13103        fn new_empty() -> Self {
13104            Self {
13105                output_packet: fidl::new_empty!(Packet, D),
13106                error_detected_before: fidl::new_empty!(bool, D),
13107                error_detected_during: fidl::new_empty!(bool, D),
13108            }
13109        }
13110
13111        #[inline]
13112        unsafe fn decode(
13113            &mut self,
13114            decoder: &mut fidl::encoding::Decoder<'_, D>,
13115            offset: usize,
13116            _depth: fidl::encoding::Depth,
13117        ) -> fidl::Result<()> {
13118            decoder.debug_check_bounds::<Self>(offset);
13119            // Verify that padding bytes are zero.
13120            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
13121            let padval = unsafe { (ptr as *const u64).read_unaligned() };
13122            let mask = 0xffffffffffff0000u64;
13123            let maskedval = padval & mask;
13124            if maskedval != 0 {
13125                return Err(fidl::Error::NonZeroPadding {
13126                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
13127                });
13128            }
13129            fidl::decode!(Packet, D, &mut self.output_packet, decoder, offset + 0, _depth)?;
13130            fidl::decode!(bool, D, &mut self.error_detected_before, decoder, offset + 16, _depth)?;
13131            fidl::decode!(bool, D, &mut self.error_detected_during, decoder, offset + 17, _depth)?;
13132            Ok(())
13133        }
13134    }
13135
13136    impl fidl::encoding::ValueTypeMarker for StreamProcessorOnStreamFailedRequest {
13137        type Borrowed<'a> = &'a Self;
13138        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
13139            value
13140        }
13141    }
13142
13143    unsafe impl fidl::encoding::TypeMarker for StreamProcessorOnStreamFailedRequest {
13144        type Owned = Self;
13145
13146        #[inline(always)]
13147        fn inline_align(_context: fidl::encoding::Context) -> usize {
13148            8
13149        }
13150
13151        #[inline(always)]
13152        fn inline_size(_context: fidl::encoding::Context) -> usize {
13153            16
13154        }
13155    }
13156
13157    unsafe impl<D: fidl::encoding::ResourceDialect>
13158        fidl::encoding::Encode<StreamProcessorOnStreamFailedRequest, D>
13159        for &StreamProcessorOnStreamFailedRequest
13160    {
13161        #[inline]
13162        unsafe fn encode(
13163            self,
13164            encoder: &mut fidl::encoding::Encoder<'_, D>,
13165            offset: usize,
13166            _depth: fidl::encoding::Depth,
13167        ) -> fidl::Result<()> {
13168            encoder.debug_check_bounds::<StreamProcessorOnStreamFailedRequest>(offset);
13169            // Delegate to tuple encoding.
13170            fidl::encoding::Encode::<StreamProcessorOnStreamFailedRequest, D>::encode(
13171                (
13172                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.stream_lifetime_ordinal),
13173                    <StreamError as fidl::encoding::ValueTypeMarker>::borrow(&self.error),
13174                ),
13175                encoder,
13176                offset,
13177                _depth,
13178            )
13179        }
13180    }
13181    unsafe impl<
13182        D: fidl::encoding::ResourceDialect,
13183        T0: fidl::encoding::Encode<u64, D>,
13184        T1: fidl::encoding::Encode<StreamError, D>,
13185    > fidl::encoding::Encode<StreamProcessorOnStreamFailedRequest, D> for (T0, T1)
13186    {
13187        #[inline]
13188        unsafe fn encode(
13189            self,
13190            encoder: &mut fidl::encoding::Encoder<'_, D>,
13191            offset: usize,
13192            depth: fidl::encoding::Depth,
13193        ) -> fidl::Result<()> {
13194            encoder.debug_check_bounds::<StreamProcessorOnStreamFailedRequest>(offset);
13195            // Zero out padding regions. There's no need to apply masks
13196            // because the unmasked parts will be overwritten by fields.
13197            unsafe {
13198                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
13199                (ptr as *mut u64).write_unaligned(0);
13200            }
13201            // Write the fields.
13202            self.0.encode(encoder, offset + 0, depth)?;
13203            self.1.encode(encoder, offset + 8, depth)?;
13204            Ok(())
13205        }
13206    }
13207
13208    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
13209        for StreamProcessorOnStreamFailedRequest
13210    {
13211        #[inline(always)]
13212        fn new_empty() -> Self {
13213            Self {
13214                stream_lifetime_ordinal: fidl::new_empty!(u64, D),
13215                error: fidl::new_empty!(StreamError, D),
13216            }
13217        }
13218
13219        #[inline]
13220        unsafe fn decode(
13221            &mut self,
13222            decoder: &mut fidl::encoding::Decoder<'_, D>,
13223            offset: usize,
13224            _depth: fidl::encoding::Depth,
13225        ) -> fidl::Result<()> {
13226            decoder.debug_check_bounds::<Self>(offset);
13227            // Verify that padding bytes are zero.
13228            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
13229            let padval = unsafe { (ptr as *const u64).read_unaligned() };
13230            let mask = 0xffffffff00000000u64;
13231            let maskedval = padval & mask;
13232            if maskedval != 0 {
13233                return Err(fidl::Error::NonZeroPadding {
13234                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
13235                });
13236            }
13237            fidl::decode!(u64, D, &mut self.stream_lifetime_ordinal, decoder, offset + 0, _depth)?;
13238            fidl::decode!(StreamError, D, &mut self.error, decoder, offset + 8, _depth)?;
13239            Ok(())
13240        }
13241    }
13242
13243    impl fidl::encoding::ValueTypeMarker for StreamProcessorQueueInputEndOfStreamRequest {
13244        type Borrowed<'a> = &'a Self;
13245        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
13246            value
13247        }
13248    }
13249
13250    unsafe impl fidl::encoding::TypeMarker for StreamProcessorQueueInputEndOfStreamRequest {
13251        type Owned = Self;
13252
13253        #[inline(always)]
13254        fn inline_align(_context: fidl::encoding::Context) -> usize {
13255            8
13256        }
13257
13258        #[inline(always)]
13259        fn inline_size(_context: fidl::encoding::Context) -> usize {
13260            8
13261        }
13262        #[inline(always)]
13263        fn encode_is_copy() -> bool {
13264            true
13265        }
13266
13267        #[inline(always)]
13268        fn decode_is_copy() -> bool {
13269            true
13270        }
13271    }
13272
13273    unsafe impl<D: fidl::encoding::ResourceDialect>
13274        fidl::encoding::Encode<StreamProcessorQueueInputEndOfStreamRequest, D>
13275        for &StreamProcessorQueueInputEndOfStreamRequest
13276    {
13277        #[inline]
13278        unsafe fn encode(
13279            self,
13280            encoder: &mut fidl::encoding::Encoder<'_, D>,
13281            offset: usize,
13282            _depth: fidl::encoding::Depth,
13283        ) -> fidl::Result<()> {
13284            encoder.debug_check_bounds::<StreamProcessorQueueInputEndOfStreamRequest>(offset);
13285            unsafe {
13286                // Copy the object into the buffer.
13287                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
13288                (buf_ptr as *mut StreamProcessorQueueInputEndOfStreamRequest).write_unaligned(
13289                    (self as *const StreamProcessorQueueInputEndOfStreamRequest).read(),
13290                );
13291                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
13292                // done second because the memcpy will write garbage to these bytes.
13293            }
13294            Ok(())
13295        }
13296    }
13297    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
13298        fidl::encoding::Encode<StreamProcessorQueueInputEndOfStreamRequest, D> for (T0,)
13299    {
13300        #[inline]
13301        unsafe fn encode(
13302            self,
13303            encoder: &mut fidl::encoding::Encoder<'_, D>,
13304            offset: usize,
13305            depth: fidl::encoding::Depth,
13306        ) -> fidl::Result<()> {
13307            encoder.debug_check_bounds::<StreamProcessorQueueInputEndOfStreamRequest>(offset);
13308            // Zero out padding regions. There's no need to apply masks
13309            // because the unmasked parts will be overwritten by fields.
13310            // Write the fields.
13311            self.0.encode(encoder, offset + 0, depth)?;
13312            Ok(())
13313        }
13314    }
13315
13316    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
13317        for StreamProcessorQueueInputEndOfStreamRequest
13318    {
13319        #[inline(always)]
13320        fn new_empty() -> Self {
13321            Self { stream_lifetime_ordinal: fidl::new_empty!(u64, D) }
13322        }
13323
13324        #[inline]
13325        unsafe fn decode(
13326            &mut self,
13327            decoder: &mut fidl::encoding::Decoder<'_, D>,
13328            offset: usize,
13329            _depth: fidl::encoding::Depth,
13330        ) -> fidl::Result<()> {
13331            decoder.debug_check_bounds::<Self>(offset);
13332            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
13333            // Verify that padding bytes are zero.
13334            // Copy from the buffer into the object.
13335            unsafe {
13336                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
13337            }
13338            Ok(())
13339        }
13340    }
13341
13342    impl fidl::encoding::ValueTypeMarker for StreamProcessorQueueInputFormatDetailsRequest {
13343        type Borrowed<'a> = &'a Self;
13344        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
13345            value
13346        }
13347    }
13348
13349    unsafe impl fidl::encoding::TypeMarker for StreamProcessorQueueInputFormatDetailsRequest {
13350        type Owned = Self;
13351
13352        #[inline(always)]
13353        fn inline_align(_context: fidl::encoding::Context) -> usize {
13354            8
13355        }
13356
13357        #[inline(always)]
13358        fn inline_size(_context: fidl::encoding::Context) -> usize {
13359            24
13360        }
13361    }
13362
13363    unsafe impl<D: fidl::encoding::ResourceDialect>
13364        fidl::encoding::Encode<StreamProcessorQueueInputFormatDetailsRequest, D>
13365        for &StreamProcessorQueueInputFormatDetailsRequest
13366    {
13367        #[inline]
13368        unsafe fn encode(
13369            self,
13370            encoder: &mut fidl::encoding::Encoder<'_, D>,
13371            offset: usize,
13372            _depth: fidl::encoding::Depth,
13373        ) -> fidl::Result<()> {
13374            encoder.debug_check_bounds::<StreamProcessorQueueInputFormatDetailsRequest>(offset);
13375            // Delegate to tuple encoding.
13376            fidl::encoding::Encode::<StreamProcessorQueueInputFormatDetailsRequest, D>::encode(
13377                (
13378                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.stream_lifetime_ordinal),
13379                    <FormatDetails as fidl::encoding::ValueTypeMarker>::borrow(
13380                        &self.format_details,
13381                    ),
13382                ),
13383                encoder,
13384                offset,
13385                _depth,
13386            )
13387        }
13388    }
13389    unsafe impl<
13390        D: fidl::encoding::ResourceDialect,
13391        T0: fidl::encoding::Encode<u64, D>,
13392        T1: fidl::encoding::Encode<FormatDetails, D>,
13393    > fidl::encoding::Encode<StreamProcessorQueueInputFormatDetailsRequest, D> for (T0, T1)
13394    {
13395        #[inline]
13396        unsafe fn encode(
13397            self,
13398            encoder: &mut fidl::encoding::Encoder<'_, D>,
13399            offset: usize,
13400            depth: fidl::encoding::Depth,
13401        ) -> fidl::Result<()> {
13402            encoder.debug_check_bounds::<StreamProcessorQueueInputFormatDetailsRequest>(offset);
13403            // Zero out padding regions. There's no need to apply masks
13404            // because the unmasked parts will be overwritten by fields.
13405            // Write the fields.
13406            self.0.encode(encoder, offset + 0, depth)?;
13407            self.1.encode(encoder, offset + 8, depth)?;
13408            Ok(())
13409        }
13410    }
13411
13412    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
13413        for StreamProcessorQueueInputFormatDetailsRequest
13414    {
13415        #[inline(always)]
13416        fn new_empty() -> Self {
13417            Self {
13418                stream_lifetime_ordinal: fidl::new_empty!(u64, D),
13419                format_details: fidl::new_empty!(FormatDetails, D),
13420            }
13421        }
13422
13423        #[inline]
13424        unsafe fn decode(
13425            &mut self,
13426            decoder: &mut fidl::encoding::Decoder<'_, D>,
13427            offset: usize,
13428            _depth: fidl::encoding::Depth,
13429        ) -> fidl::Result<()> {
13430            decoder.debug_check_bounds::<Self>(offset);
13431            // Verify that padding bytes are zero.
13432            fidl::decode!(u64, D, &mut self.stream_lifetime_ordinal, decoder, offset + 0, _depth)?;
13433            fidl::decode!(FormatDetails, D, &mut self.format_details, decoder, offset + 8, _depth)?;
13434            Ok(())
13435        }
13436    }
13437
13438    impl fidl::encoding::ValueTypeMarker for StreamProcessorQueueInputPacketRequest {
13439        type Borrowed<'a> = &'a Self;
13440        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
13441            value
13442        }
13443    }
13444
13445    unsafe impl fidl::encoding::TypeMarker for StreamProcessorQueueInputPacketRequest {
13446        type Owned = Self;
13447
13448        #[inline(always)]
13449        fn inline_align(_context: fidl::encoding::Context) -> usize {
13450            8
13451        }
13452
13453        #[inline(always)]
13454        fn inline_size(_context: fidl::encoding::Context) -> usize {
13455            16
13456        }
13457    }
13458
13459    unsafe impl<D: fidl::encoding::ResourceDialect>
13460        fidl::encoding::Encode<StreamProcessorQueueInputPacketRequest, D>
13461        for &StreamProcessorQueueInputPacketRequest
13462    {
13463        #[inline]
13464        unsafe fn encode(
13465            self,
13466            encoder: &mut fidl::encoding::Encoder<'_, D>,
13467            offset: usize,
13468            _depth: fidl::encoding::Depth,
13469        ) -> fidl::Result<()> {
13470            encoder.debug_check_bounds::<StreamProcessorQueueInputPacketRequest>(offset);
13471            // Delegate to tuple encoding.
13472            fidl::encoding::Encode::<StreamProcessorQueueInputPacketRequest, D>::encode(
13473                (<Packet as fidl::encoding::ValueTypeMarker>::borrow(&self.packet),),
13474                encoder,
13475                offset,
13476                _depth,
13477            )
13478        }
13479    }
13480    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Packet, D>>
13481        fidl::encoding::Encode<StreamProcessorQueueInputPacketRequest, D> for (T0,)
13482    {
13483        #[inline]
13484        unsafe fn encode(
13485            self,
13486            encoder: &mut fidl::encoding::Encoder<'_, D>,
13487            offset: usize,
13488            depth: fidl::encoding::Depth,
13489        ) -> fidl::Result<()> {
13490            encoder.debug_check_bounds::<StreamProcessorQueueInputPacketRequest>(offset);
13491            // Zero out padding regions. There's no need to apply masks
13492            // because the unmasked parts will be overwritten by fields.
13493            // Write the fields.
13494            self.0.encode(encoder, offset + 0, depth)?;
13495            Ok(())
13496        }
13497    }
13498
13499    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
13500        for StreamProcessorQueueInputPacketRequest
13501    {
13502        #[inline(always)]
13503        fn new_empty() -> Self {
13504            Self { packet: fidl::new_empty!(Packet, D) }
13505        }
13506
13507        #[inline]
13508        unsafe fn decode(
13509            &mut self,
13510            decoder: &mut fidl::encoding::Decoder<'_, D>,
13511            offset: usize,
13512            _depth: fidl::encoding::Depth,
13513        ) -> fidl::Result<()> {
13514            decoder.debug_check_bounds::<Self>(offset);
13515            // Verify that padding bytes are zero.
13516            fidl::decode!(Packet, D, &mut self.packet, decoder, offset + 0, _depth)?;
13517            Ok(())
13518        }
13519    }
13520
13521    impl fidl::encoding::ValueTypeMarker for StreamProcessorRecycleOutputPacketRequest {
13522        type Borrowed<'a> = &'a Self;
13523        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
13524            value
13525        }
13526    }
13527
13528    unsafe impl fidl::encoding::TypeMarker for StreamProcessorRecycleOutputPacketRequest {
13529        type Owned = Self;
13530
13531        #[inline(always)]
13532        fn inline_align(_context: fidl::encoding::Context) -> usize {
13533            8
13534        }
13535
13536        #[inline(always)]
13537        fn inline_size(_context: fidl::encoding::Context) -> usize {
13538            16
13539        }
13540    }
13541
13542    unsafe impl<D: fidl::encoding::ResourceDialect>
13543        fidl::encoding::Encode<StreamProcessorRecycleOutputPacketRequest, D>
13544        for &StreamProcessorRecycleOutputPacketRequest
13545    {
13546        #[inline]
13547        unsafe fn encode(
13548            self,
13549            encoder: &mut fidl::encoding::Encoder<'_, D>,
13550            offset: usize,
13551            _depth: fidl::encoding::Depth,
13552        ) -> fidl::Result<()> {
13553            encoder.debug_check_bounds::<StreamProcessorRecycleOutputPacketRequest>(offset);
13554            // Delegate to tuple encoding.
13555            fidl::encoding::Encode::<StreamProcessorRecycleOutputPacketRequest, D>::encode(
13556                (<PacketHeader as fidl::encoding::ValueTypeMarker>::borrow(
13557                    &self.available_output_packet,
13558                ),),
13559                encoder,
13560                offset,
13561                _depth,
13562            )
13563        }
13564    }
13565    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PacketHeader, D>>
13566        fidl::encoding::Encode<StreamProcessorRecycleOutputPacketRequest, D> for (T0,)
13567    {
13568        #[inline]
13569        unsafe fn encode(
13570            self,
13571            encoder: &mut fidl::encoding::Encoder<'_, D>,
13572            offset: usize,
13573            depth: fidl::encoding::Depth,
13574        ) -> fidl::Result<()> {
13575            encoder.debug_check_bounds::<StreamProcessorRecycleOutputPacketRequest>(offset);
13576            // Zero out padding regions. There's no need to apply masks
13577            // because the unmasked parts will be overwritten by fields.
13578            // Write the fields.
13579            self.0.encode(encoder, offset + 0, depth)?;
13580            Ok(())
13581        }
13582    }
13583
13584    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
13585        for StreamProcessorRecycleOutputPacketRequest
13586    {
13587        #[inline(always)]
13588        fn new_empty() -> Self {
13589            Self { available_output_packet: fidl::new_empty!(PacketHeader, D) }
13590        }
13591
13592        #[inline]
13593        unsafe fn decode(
13594            &mut self,
13595            decoder: &mut fidl::encoding::Decoder<'_, D>,
13596            offset: usize,
13597            _depth: fidl::encoding::Depth,
13598        ) -> fidl::Result<()> {
13599            decoder.debug_check_bounds::<Self>(offset);
13600            // Verify that padding bytes are zero.
13601            fidl::decode!(
13602                PacketHeader,
13603                D,
13604                &mut self.available_output_packet,
13605                decoder,
13606                offset + 0,
13607                _depth
13608            )?;
13609            Ok(())
13610        }
13611    }
13612
13613    impl fidl::encoding::ValueTypeMarker for StreamSinkSendPacketNoReplyRequest {
13614        type Borrowed<'a> = &'a Self;
13615        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
13616            value
13617        }
13618    }
13619
13620    unsafe impl fidl::encoding::TypeMarker for StreamSinkSendPacketNoReplyRequest {
13621        type Owned = Self;
13622
13623        #[inline(always)]
13624        fn inline_align(_context: fidl::encoding::Context) -> usize {
13625            8
13626        }
13627
13628        #[inline(always)]
13629        fn inline_size(_context: fidl::encoding::Context) -> usize {
13630            56
13631        }
13632    }
13633
13634    unsafe impl<D: fidl::encoding::ResourceDialect>
13635        fidl::encoding::Encode<StreamSinkSendPacketNoReplyRequest, D>
13636        for &StreamSinkSendPacketNoReplyRequest
13637    {
13638        #[inline]
13639        unsafe fn encode(
13640            self,
13641            encoder: &mut fidl::encoding::Encoder<'_, D>,
13642            offset: usize,
13643            _depth: fidl::encoding::Depth,
13644        ) -> fidl::Result<()> {
13645            encoder.debug_check_bounds::<StreamSinkSendPacketNoReplyRequest>(offset);
13646            unsafe {
13647                // Copy the object into the buffer.
13648                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
13649                (buf_ptr as *mut StreamSinkSendPacketNoReplyRequest)
13650                    .write_unaligned((self as *const StreamSinkSendPacketNoReplyRequest).read());
13651                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
13652                // done second because the memcpy will write garbage to these bytes.
13653                let padding_ptr = buf_ptr.offset(8) as *mut u64;
13654                let padding_mask = 0xffffffff00000000u64;
13655                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
13656                let padding_ptr = buf_ptr.offset(32) as *mut u64;
13657                let padding_mask = 0xffffffff00000000u64;
13658                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
13659            }
13660            Ok(())
13661        }
13662    }
13663    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<StreamPacket, D>>
13664        fidl::encoding::Encode<StreamSinkSendPacketNoReplyRequest, D> for (T0,)
13665    {
13666        #[inline]
13667        unsafe fn encode(
13668            self,
13669            encoder: &mut fidl::encoding::Encoder<'_, D>,
13670            offset: usize,
13671            depth: fidl::encoding::Depth,
13672        ) -> fidl::Result<()> {
13673            encoder.debug_check_bounds::<StreamSinkSendPacketNoReplyRequest>(offset);
13674            // Zero out padding regions. There's no need to apply masks
13675            // because the unmasked parts will be overwritten by fields.
13676            // Write the fields.
13677            self.0.encode(encoder, offset + 0, depth)?;
13678            Ok(())
13679        }
13680    }
13681
13682    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
13683        for StreamSinkSendPacketNoReplyRequest
13684    {
13685        #[inline(always)]
13686        fn new_empty() -> Self {
13687            Self { packet: fidl::new_empty!(StreamPacket, D) }
13688        }
13689
13690        #[inline]
13691        unsafe fn decode(
13692            &mut self,
13693            decoder: &mut fidl::encoding::Decoder<'_, D>,
13694            offset: usize,
13695            _depth: fidl::encoding::Depth,
13696        ) -> fidl::Result<()> {
13697            decoder.debug_check_bounds::<Self>(offset);
13698            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
13699            // Verify that padding bytes are zero.
13700            let ptr = unsafe { buf_ptr.offset(8) };
13701            let padval = unsafe { (ptr as *const u64).read_unaligned() };
13702            let mask = 0xffffffff00000000u64;
13703            let maskedval = padval & mask;
13704            if maskedval != 0 {
13705                return Err(fidl::Error::NonZeroPadding {
13706                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
13707                });
13708            }
13709            let ptr = unsafe { buf_ptr.offset(32) };
13710            let padval = unsafe { (ptr as *const u64).read_unaligned() };
13711            let mask = 0xffffffff00000000u64;
13712            let maskedval = padval & mask;
13713            if maskedval != 0 {
13714                return Err(fidl::Error::NonZeroPadding {
13715                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
13716                });
13717            }
13718            // Copy from the buffer into the object.
13719            unsafe {
13720                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 56);
13721            }
13722            Ok(())
13723        }
13724    }
13725
13726    impl fidl::encoding::ValueTypeMarker for StreamSinkSendPacketRequest {
13727        type Borrowed<'a> = &'a Self;
13728        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
13729            value
13730        }
13731    }
13732
13733    unsafe impl fidl::encoding::TypeMarker for StreamSinkSendPacketRequest {
13734        type Owned = Self;
13735
13736        #[inline(always)]
13737        fn inline_align(_context: fidl::encoding::Context) -> usize {
13738            8
13739        }
13740
13741        #[inline(always)]
13742        fn inline_size(_context: fidl::encoding::Context) -> usize {
13743            56
13744        }
13745    }
13746
13747    unsafe impl<D: fidl::encoding::ResourceDialect>
13748        fidl::encoding::Encode<StreamSinkSendPacketRequest, D> for &StreamSinkSendPacketRequest
13749    {
13750        #[inline]
13751        unsafe fn encode(
13752            self,
13753            encoder: &mut fidl::encoding::Encoder<'_, D>,
13754            offset: usize,
13755            _depth: fidl::encoding::Depth,
13756        ) -> fidl::Result<()> {
13757            encoder.debug_check_bounds::<StreamSinkSendPacketRequest>(offset);
13758            unsafe {
13759                // Copy the object into the buffer.
13760                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
13761                (buf_ptr as *mut StreamSinkSendPacketRequest)
13762                    .write_unaligned((self as *const StreamSinkSendPacketRequest).read());
13763                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
13764                // done second because the memcpy will write garbage to these bytes.
13765                let padding_ptr = buf_ptr.offset(8) as *mut u64;
13766                let padding_mask = 0xffffffff00000000u64;
13767                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
13768                let padding_ptr = buf_ptr.offset(32) as *mut u64;
13769                let padding_mask = 0xffffffff00000000u64;
13770                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
13771            }
13772            Ok(())
13773        }
13774    }
13775    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<StreamPacket, D>>
13776        fidl::encoding::Encode<StreamSinkSendPacketRequest, D> for (T0,)
13777    {
13778        #[inline]
13779        unsafe fn encode(
13780            self,
13781            encoder: &mut fidl::encoding::Encoder<'_, D>,
13782            offset: usize,
13783            depth: fidl::encoding::Depth,
13784        ) -> fidl::Result<()> {
13785            encoder.debug_check_bounds::<StreamSinkSendPacketRequest>(offset);
13786            // Zero out padding regions. There's no need to apply masks
13787            // because the unmasked parts will be overwritten by fields.
13788            // Write the fields.
13789            self.0.encode(encoder, offset + 0, depth)?;
13790            Ok(())
13791        }
13792    }
13793
13794    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
13795        for StreamSinkSendPacketRequest
13796    {
13797        #[inline(always)]
13798        fn new_empty() -> Self {
13799            Self { packet: fidl::new_empty!(StreamPacket, D) }
13800        }
13801
13802        #[inline]
13803        unsafe fn decode(
13804            &mut self,
13805            decoder: &mut fidl::encoding::Decoder<'_, D>,
13806            offset: usize,
13807            _depth: fidl::encoding::Depth,
13808        ) -> fidl::Result<()> {
13809            decoder.debug_check_bounds::<Self>(offset);
13810            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
13811            // Verify that padding bytes are zero.
13812            let ptr = unsafe { buf_ptr.offset(8) };
13813            let padval = unsafe { (ptr as *const u64).read_unaligned() };
13814            let mask = 0xffffffff00000000u64;
13815            let maskedval = padval & mask;
13816            if maskedval != 0 {
13817                return Err(fidl::Error::NonZeroPadding {
13818                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
13819                });
13820            }
13821            let ptr = unsafe { buf_ptr.offset(32) };
13822            let padval = unsafe { (ptr as *const u64).read_unaligned() };
13823            let mask = 0xffffffff00000000u64;
13824            let maskedval = padval & mask;
13825            if maskedval != 0 {
13826                return Err(fidl::Error::NonZeroPadding {
13827                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
13828                });
13829            }
13830            // Copy from the buffer into the object.
13831            unsafe {
13832                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 56);
13833            }
13834            Ok(())
13835        }
13836    }
13837
13838    impl fidl::encoding::ValueTypeMarker for StreamSourceOnPacketProducedRequest {
13839        type Borrowed<'a> = &'a Self;
13840        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
13841            value
13842        }
13843    }
13844
13845    unsafe impl fidl::encoding::TypeMarker for StreamSourceOnPacketProducedRequest {
13846        type Owned = Self;
13847
13848        #[inline(always)]
13849        fn inline_align(_context: fidl::encoding::Context) -> usize {
13850            8
13851        }
13852
13853        #[inline(always)]
13854        fn inline_size(_context: fidl::encoding::Context) -> usize {
13855            56
13856        }
13857    }
13858
13859    unsafe impl<D: fidl::encoding::ResourceDialect>
13860        fidl::encoding::Encode<StreamSourceOnPacketProducedRequest, D>
13861        for &StreamSourceOnPacketProducedRequest
13862    {
13863        #[inline]
13864        unsafe fn encode(
13865            self,
13866            encoder: &mut fidl::encoding::Encoder<'_, D>,
13867            offset: usize,
13868            _depth: fidl::encoding::Depth,
13869        ) -> fidl::Result<()> {
13870            encoder.debug_check_bounds::<StreamSourceOnPacketProducedRequest>(offset);
13871            unsafe {
13872                // Copy the object into the buffer.
13873                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
13874                (buf_ptr as *mut StreamSourceOnPacketProducedRequest)
13875                    .write_unaligned((self as *const StreamSourceOnPacketProducedRequest).read());
13876                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
13877                // done second because the memcpy will write garbage to these bytes.
13878                let padding_ptr = buf_ptr.offset(8) as *mut u64;
13879                let padding_mask = 0xffffffff00000000u64;
13880                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
13881                let padding_ptr = buf_ptr.offset(32) as *mut u64;
13882                let padding_mask = 0xffffffff00000000u64;
13883                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
13884            }
13885            Ok(())
13886        }
13887    }
13888    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<StreamPacket, D>>
13889        fidl::encoding::Encode<StreamSourceOnPacketProducedRequest, D> for (T0,)
13890    {
13891        #[inline]
13892        unsafe fn encode(
13893            self,
13894            encoder: &mut fidl::encoding::Encoder<'_, D>,
13895            offset: usize,
13896            depth: fidl::encoding::Depth,
13897        ) -> fidl::Result<()> {
13898            encoder.debug_check_bounds::<StreamSourceOnPacketProducedRequest>(offset);
13899            // Zero out padding regions. There's no need to apply masks
13900            // because the unmasked parts will be overwritten by fields.
13901            // Write the fields.
13902            self.0.encode(encoder, offset + 0, depth)?;
13903            Ok(())
13904        }
13905    }
13906
13907    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
13908        for StreamSourceOnPacketProducedRequest
13909    {
13910        #[inline(always)]
13911        fn new_empty() -> Self {
13912            Self { packet: fidl::new_empty!(StreamPacket, D) }
13913        }
13914
13915        #[inline]
13916        unsafe fn decode(
13917            &mut self,
13918            decoder: &mut fidl::encoding::Decoder<'_, D>,
13919            offset: usize,
13920            _depth: fidl::encoding::Depth,
13921        ) -> fidl::Result<()> {
13922            decoder.debug_check_bounds::<Self>(offset);
13923            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
13924            // Verify that padding bytes are zero.
13925            let ptr = unsafe { buf_ptr.offset(8) };
13926            let padval = unsafe { (ptr as *const u64).read_unaligned() };
13927            let mask = 0xffffffff00000000u64;
13928            let maskedval = padval & mask;
13929            if maskedval != 0 {
13930                return Err(fidl::Error::NonZeroPadding {
13931                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
13932                });
13933            }
13934            let ptr = unsafe { buf_ptr.offset(32) };
13935            let padval = unsafe { (ptr as *const u64).read_unaligned() };
13936            let mask = 0xffffffff00000000u64;
13937            let maskedval = padval & mask;
13938            if maskedval != 0 {
13939                return Err(fidl::Error::NonZeroPadding {
13940                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
13941                });
13942            }
13943            // Copy from the buffer into the object.
13944            unsafe {
13945                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 56);
13946            }
13947            Ok(())
13948        }
13949    }
13950
13951    impl fidl::encoding::ValueTypeMarker for StreamSourceReleasePacketRequest {
13952        type Borrowed<'a> = &'a Self;
13953        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
13954            value
13955        }
13956    }
13957
13958    unsafe impl fidl::encoding::TypeMarker for StreamSourceReleasePacketRequest {
13959        type Owned = Self;
13960
13961        #[inline(always)]
13962        fn inline_align(_context: fidl::encoding::Context) -> usize {
13963            8
13964        }
13965
13966        #[inline(always)]
13967        fn inline_size(_context: fidl::encoding::Context) -> usize {
13968            56
13969        }
13970    }
13971
13972    unsafe impl<D: fidl::encoding::ResourceDialect>
13973        fidl::encoding::Encode<StreamSourceReleasePacketRequest, D>
13974        for &StreamSourceReleasePacketRequest
13975    {
13976        #[inline]
13977        unsafe fn encode(
13978            self,
13979            encoder: &mut fidl::encoding::Encoder<'_, D>,
13980            offset: usize,
13981            _depth: fidl::encoding::Depth,
13982        ) -> fidl::Result<()> {
13983            encoder.debug_check_bounds::<StreamSourceReleasePacketRequest>(offset);
13984            unsafe {
13985                // Copy the object into the buffer.
13986                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
13987                (buf_ptr as *mut StreamSourceReleasePacketRequest)
13988                    .write_unaligned((self as *const StreamSourceReleasePacketRequest).read());
13989                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
13990                // done second because the memcpy will write garbage to these bytes.
13991                let padding_ptr = buf_ptr.offset(8) as *mut u64;
13992                let padding_mask = 0xffffffff00000000u64;
13993                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
13994                let padding_ptr = buf_ptr.offset(32) as *mut u64;
13995                let padding_mask = 0xffffffff00000000u64;
13996                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
13997            }
13998            Ok(())
13999        }
14000    }
14001    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<StreamPacket, D>>
14002        fidl::encoding::Encode<StreamSourceReleasePacketRequest, D> for (T0,)
14003    {
14004        #[inline]
14005        unsafe fn encode(
14006            self,
14007            encoder: &mut fidl::encoding::Encoder<'_, D>,
14008            offset: usize,
14009            depth: fidl::encoding::Depth,
14010        ) -> fidl::Result<()> {
14011            encoder.debug_check_bounds::<StreamSourceReleasePacketRequest>(offset);
14012            // Zero out padding regions. There's no need to apply masks
14013            // because the unmasked parts will be overwritten by fields.
14014            // Write the fields.
14015            self.0.encode(encoder, offset + 0, depth)?;
14016            Ok(())
14017        }
14018    }
14019
14020    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
14021        for StreamSourceReleasePacketRequest
14022    {
14023        #[inline(always)]
14024        fn new_empty() -> Self {
14025            Self { packet: fidl::new_empty!(StreamPacket, D) }
14026        }
14027
14028        #[inline]
14029        unsafe fn decode(
14030            &mut self,
14031            decoder: &mut fidl::encoding::Decoder<'_, D>,
14032            offset: usize,
14033            _depth: fidl::encoding::Depth,
14034        ) -> fidl::Result<()> {
14035            decoder.debug_check_bounds::<Self>(offset);
14036            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
14037            // Verify that padding bytes are zero.
14038            let ptr = unsafe { buf_ptr.offset(8) };
14039            let padval = unsafe { (ptr as *const u64).read_unaligned() };
14040            let mask = 0xffffffff00000000u64;
14041            let maskedval = padval & mask;
14042            if maskedval != 0 {
14043                return Err(fidl::Error::NonZeroPadding {
14044                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
14045                });
14046            }
14047            let ptr = unsafe { buf_ptr.offset(32) };
14048            let padval = unsafe { (ptr as *const u64).read_unaligned() };
14049            let mask = 0xffffffff00000000u64;
14050            let maskedval = padval & mask;
14051            if maskedval != 0 {
14052                return Err(fidl::Error::NonZeroPadding {
14053                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
14054                });
14055            }
14056            // Copy from the buffer into the object.
14057            unsafe {
14058                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 56);
14059            }
14060            Ok(())
14061        }
14062    }
14063
14064    impl fidl::encoding::ValueTypeMarker for StreamType {
14065        type Borrowed<'a> = &'a Self;
14066        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
14067            value
14068        }
14069    }
14070
14071    unsafe impl fidl::encoding::TypeMarker for StreamType {
14072        type Owned = Self;
14073
14074        #[inline(always)]
14075        fn inline_align(_context: fidl::encoding::Context) -> usize {
14076            8
14077        }
14078
14079        #[inline(always)]
14080        fn inline_size(_context: fidl::encoding::Context) -> usize {
14081            48
14082        }
14083    }
14084
14085    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StreamType, D>
14086        for &StreamType
14087    {
14088        #[inline]
14089        unsafe fn encode(
14090            self,
14091            encoder: &mut fidl::encoding::Encoder<'_, D>,
14092            offset: usize,
14093            _depth: fidl::encoding::Depth,
14094        ) -> fidl::Result<()> {
14095            encoder.debug_check_bounds::<StreamType>(offset);
14096            // Delegate to tuple encoding.
14097            fidl::encoding::Encode::<StreamType, D>::encode(
14098                (
14099                    <MediumSpecificStreamType as fidl::encoding::ValueTypeMarker>::borrow(&self.medium_specific),
14100                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(&self.encoding),
14101                    <fidl::encoding::Optional<fidl::encoding::UnboundedVector<u8>> as fidl::encoding::ValueTypeMarker>::borrow(&self.encoding_parameters),
14102                ),
14103                encoder, offset, _depth
14104            )
14105        }
14106    }
14107    unsafe impl<
14108        D: fidl::encoding::ResourceDialect,
14109        T0: fidl::encoding::Encode<MediumSpecificStreamType, D>,
14110        T1: fidl::encoding::Encode<fidl::encoding::BoundedString<255>, D>,
14111        T2: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::UnboundedVector<u8>>, D>,
14112    > fidl::encoding::Encode<StreamType, D> for (T0, T1, T2)
14113    {
14114        #[inline]
14115        unsafe fn encode(
14116            self,
14117            encoder: &mut fidl::encoding::Encoder<'_, D>,
14118            offset: usize,
14119            depth: fidl::encoding::Depth,
14120        ) -> fidl::Result<()> {
14121            encoder.debug_check_bounds::<StreamType>(offset);
14122            // Zero out padding regions. There's no need to apply masks
14123            // because the unmasked parts will be overwritten by fields.
14124            // Write the fields.
14125            self.0.encode(encoder, offset + 0, depth)?;
14126            self.1.encode(encoder, offset + 16, depth)?;
14127            self.2.encode(encoder, offset + 32, depth)?;
14128            Ok(())
14129        }
14130    }
14131
14132    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StreamType {
14133        #[inline(always)]
14134        fn new_empty() -> Self {
14135            Self {
14136                medium_specific: fidl::new_empty!(MediumSpecificStreamType, D),
14137                encoding: fidl::new_empty!(fidl::encoding::BoundedString<255>, D),
14138                encoding_parameters: fidl::new_empty!(
14139                    fidl::encoding::Optional<fidl::encoding::UnboundedVector<u8>>,
14140                    D
14141                ),
14142            }
14143        }
14144
14145        #[inline]
14146        unsafe fn decode(
14147            &mut self,
14148            decoder: &mut fidl::encoding::Decoder<'_, D>,
14149            offset: usize,
14150            _depth: fidl::encoding::Depth,
14151        ) -> fidl::Result<()> {
14152            decoder.debug_check_bounds::<Self>(offset);
14153            // Verify that padding bytes are zero.
14154            fidl::decode!(
14155                MediumSpecificStreamType,
14156                D,
14157                &mut self.medium_specific,
14158                decoder,
14159                offset + 0,
14160                _depth
14161            )?;
14162            fidl::decode!(
14163                fidl::encoding::BoundedString<255>,
14164                D,
14165                &mut self.encoding,
14166                decoder,
14167                offset + 16,
14168                _depth
14169            )?;
14170            fidl::decode!(
14171                fidl::encoding::Optional<fidl::encoding::UnboundedVector<u8>>,
14172                D,
14173                &mut self.encoding_parameters,
14174                decoder,
14175                offset + 32,
14176                _depth
14177            )?;
14178            Ok(())
14179        }
14180    }
14181
14182    impl fidl::encoding::ValueTypeMarker for SubpictureStreamType {
14183        type Borrowed<'a> = &'a Self;
14184        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
14185            value
14186        }
14187    }
14188
14189    unsafe impl fidl::encoding::TypeMarker for SubpictureStreamType {
14190        type Owned = Self;
14191
14192        #[inline(always)]
14193        fn inline_align(_context: fidl::encoding::Context) -> usize {
14194            1
14195        }
14196
14197        #[inline(always)]
14198        fn inline_size(_context: fidl::encoding::Context) -> usize {
14199            1
14200        }
14201    }
14202
14203    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SubpictureStreamType, D>
14204        for &SubpictureStreamType
14205    {
14206        #[inline]
14207        unsafe fn encode(
14208            self,
14209            encoder: &mut fidl::encoding::Encoder<'_, D>,
14210            offset: usize,
14211            _depth: fidl::encoding::Depth,
14212        ) -> fidl::Result<()> {
14213            encoder.debug_check_bounds::<SubpictureStreamType>(offset);
14214            encoder.write_num(0u8, offset);
14215            Ok(())
14216        }
14217    }
14218
14219    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SubpictureStreamType {
14220        #[inline(always)]
14221        fn new_empty() -> Self {
14222            Self
14223        }
14224
14225        #[inline]
14226        unsafe fn decode(
14227            &mut self,
14228            decoder: &mut fidl::encoding::Decoder<'_, D>,
14229            offset: usize,
14230            _depth: fidl::encoding::Depth,
14231        ) -> fidl::Result<()> {
14232            decoder.debug_check_bounds::<Self>(offset);
14233            match decoder.read_num::<u8>(offset) {
14234                0 => Ok(()),
14235                _ => Err(fidl::Error::Invalid),
14236            }
14237        }
14238    }
14239
14240    impl fidl::encoding::ValueTypeMarker for SubsampleEntry {
14241        type Borrowed<'a> = &'a Self;
14242        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
14243            value
14244        }
14245    }
14246
14247    unsafe impl fidl::encoding::TypeMarker for SubsampleEntry {
14248        type Owned = Self;
14249
14250        #[inline(always)]
14251        fn inline_align(_context: fidl::encoding::Context) -> usize {
14252            4
14253        }
14254
14255        #[inline(always)]
14256        fn inline_size(_context: fidl::encoding::Context) -> usize {
14257            8
14258        }
14259        #[inline(always)]
14260        fn encode_is_copy() -> bool {
14261            true
14262        }
14263
14264        #[inline(always)]
14265        fn decode_is_copy() -> bool {
14266            true
14267        }
14268    }
14269
14270    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SubsampleEntry, D>
14271        for &SubsampleEntry
14272    {
14273        #[inline]
14274        unsafe fn encode(
14275            self,
14276            encoder: &mut fidl::encoding::Encoder<'_, D>,
14277            offset: usize,
14278            _depth: fidl::encoding::Depth,
14279        ) -> fidl::Result<()> {
14280            encoder.debug_check_bounds::<SubsampleEntry>(offset);
14281            unsafe {
14282                // Copy the object into the buffer.
14283                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
14284                (buf_ptr as *mut SubsampleEntry)
14285                    .write_unaligned((self as *const SubsampleEntry).read());
14286                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
14287                // done second because the memcpy will write garbage to these bytes.
14288            }
14289            Ok(())
14290        }
14291    }
14292    unsafe impl<
14293        D: fidl::encoding::ResourceDialect,
14294        T0: fidl::encoding::Encode<u32, D>,
14295        T1: fidl::encoding::Encode<u32, D>,
14296    > fidl::encoding::Encode<SubsampleEntry, D> for (T0, T1)
14297    {
14298        #[inline]
14299        unsafe fn encode(
14300            self,
14301            encoder: &mut fidl::encoding::Encoder<'_, D>,
14302            offset: usize,
14303            depth: fidl::encoding::Depth,
14304        ) -> fidl::Result<()> {
14305            encoder.debug_check_bounds::<SubsampleEntry>(offset);
14306            // Zero out padding regions. There's no need to apply masks
14307            // because the unmasked parts will be overwritten by fields.
14308            // Write the fields.
14309            self.0.encode(encoder, offset + 0, depth)?;
14310            self.1.encode(encoder, offset + 4, depth)?;
14311            Ok(())
14312        }
14313    }
14314
14315    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SubsampleEntry {
14316        #[inline(always)]
14317        fn new_empty() -> Self {
14318            Self {
14319                clear_bytes: fidl::new_empty!(u32, D),
14320                encrypted_bytes: fidl::new_empty!(u32, D),
14321            }
14322        }
14323
14324        #[inline]
14325        unsafe fn decode(
14326            &mut self,
14327            decoder: &mut fidl::encoding::Decoder<'_, D>,
14328            offset: usize,
14329            _depth: fidl::encoding::Depth,
14330        ) -> fidl::Result<()> {
14331            decoder.debug_check_bounds::<Self>(offset);
14332            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
14333            // Verify that padding bytes are zero.
14334            // Copy from the buffer into the object.
14335            unsafe {
14336                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
14337            }
14338            Ok(())
14339        }
14340    }
14341
14342    impl fidl::encoding::ValueTypeMarker for TextStreamType {
14343        type Borrowed<'a> = &'a Self;
14344        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
14345            value
14346        }
14347    }
14348
14349    unsafe impl fidl::encoding::TypeMarker for TextStreamType {
14350        type Owned = Self;
14351
14352        #[inline(always)]
14353        fn inline_align(_context: fidl::encoding::Context) -> usize {
14354            1
14355        }
14356
14357        #[inline(always)]
14358        fn inline_size(_context: fidl::encoding::Context) -> usize {
14359            1
14360        }
14361    }
14362
14363    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TextStreamType, D>
14364        for &TextStreamType
14365    {
14366        #[inline]
14367        unsafe fn encode(
14368            self,
14369            encoder: &mut fidl::encoding::Encoder<'_, D>,
14370            offset: usize,
14371            _depth: fidl::encoding::Depth,
14372        ) -> fidl::Result<()> {
14373            encoder.debug_check_bounds::<TextStreamType>(offset);
14374            encoder.write_num(0u8, offset);
14375            Ok(())
14376        }
14377    }
14378
14379    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TextStreamType {
14380        #[inline(always)]
14381        fn new_empty() -> Self {
14382            Self
14383        }
14384
14385        #[inline]
14386        unsafe fn decode(
14387            &mut self,
14388            decoder: &mut fidl::encoding::Decoder<'_, D>,
14389            offset: usize,
14390            _depth: fidl::encoding::Depth,
14391        ) -> fidl::Result<()> {
14392            decoder.debug_check_bounds::<Self>(offset);
14393            match decoder.read_num::<u8>(offset) {
14394                0 => Ok(()),
14395                _ => Err(fidl::Error::Invalid),
14396            }
14397        }
14398    }
14399
14400    impl fidl::encoding::ValueTypeMarker for TimelineFunction {
14401        type Borrowed<'a> = &'a Self;
14402        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
14403            value
14404        }
14405    }
14406
14407    unsafe impl fidl::encoding::TypeMarker for TimelineFunction {
14408        type Owned = Self;
14409
14410        #[inline(always)]
14411        fn inline_align(_context: fidl::encoding::Context) -> usize {
14412            8
14413        }
14414
14415        #[inline(always)]
14416        fn inline_size(_context: fidl::encoding::Context) -> usize {
14417            24
14418        }
14419        #[inline(always)]
14420        fn encode_is_copy() -> bool {
14421            true
14422        }
14423
14424        #[inline(always)]
14425        fn decode_is_copy() -> bool {
14426            true
14427        }
14428    }
14429
14430    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TimelineFunction, D>
14431        for &TimelineFunction
14432    {
14433        #[inline]
14434        unsafe fn encode(
14435            self,
14436            encoder: &mut fidl::encoding::Encoder<'_, D>,
14437            offset: usize,
14438            _depth: fidl::encoding::Depth,
14439        ) -> fidl::Result<()> {
14440            encoder.debug_check_bounds::<TimelineFunction>(offset);
14441            unsafe {
14442                // Copy the object into the buffer.
14443                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
14444                (buf_ptr as *mut TimelineFunction)
14445                    .write_unaligned((self as *const TimelineFunction).read());
14446                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
14447                // done second because the memcpy will write garbage to these bytes.
14448            }
14449            Ok(())
14450        }
14451    }
14452    unsafe impl<
14453        D: fidl::encoding::ResourceDialect,
14454        T0: fidl::encoding::Encode<i64, D>,
14455        T1: fidl::encoding::Encode<i64, D>,
14456        T2: fidl::encoding::Encode<u32, D>,
14457        T3: fidl::encoding::Encode<u32, D>,
14458    > fidl::encoding::Encode<TimelineFunction, D> for (T0, T1, T2, T3)
14459    {
14460        #[inline]
14461        unsafe fn encode(
14462            self,
14463            encoder: &mut fidl::encoding::Encoder<'_, D>,
14464            offset: usize,
14465            depth: fidl::encoding::Depth,
14466        ) -> fidl::Result<()> {
14467            encoder.debug_check_bounds::<TimelineFunction>(offset);
14468            // Zero out padding regions. There's no need to apply masks
14469            // because the unmasked parts will be overwritten by fields.
14470            // Write the fields.
14471            self.0.encode(encoder, offset + 0, depth)?;
14472            self.1.encode(encoder, offset + 8, depth)?;
14473            self.2.encode(encoder, offset + 16, depth)?;
14474            self.3.encode(encoder, offset + 20, depth)?;
14475            Ok(())
14476        }
14477    }
14478
14479    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TimelineFunction {
14480        #[inline(always)]
14481        fn new_empty() -> Self {
14482            Self {
14483                subject_time: fidl::new_empty!(i64, D),
14484                reference_time: fidl::new_empty!(i64, D),
14485                subject_delta: fidl::new_empty!(u32, D),
14486                reference_delta: fidl::new_empty!(u32, D),
14487            }
14488        }
14489
14490        #[inline]
14491        unsafe fn decode(
14492            &mut self,
14493            decoder: &mut fidl::encoding::Decoder<'_, D>,
14494            offset: usize,
14495            _depth: fidl::encoding::Depth,
14496        ) -> fidl::Result<()> {
14497            decoder.debug_check_bounds::<Self>(offset);
14498            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
14499            // Verify that padding bytes are zero.
14500            // Copy from the buffer into the object.
14501            unsafe {
14502                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 24);
14503            }
14504            Ok(())
14505        }
14506    }
14507
14508    impl fidl::encoding::ValueTypeMarker for UsageGainListenerOnGainMuteChangedRequest {
14509        type Borrowed<'a> = &'a Self;
14510        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
14511            value
14512        }
14513    }
14514
14515    unsafe impl fidl::encoding::TypeMarker for UsageGainListenerOnGainMuteChangedRequest {
14516        type Owned = Self;
14517
14518        #[inline(always)]
14519        fn inline_align(_context: fidl::encoding::Context) -> usize {
14520            4
14521        }
14522
14523        #[inline(always)]
14524        fn inline_size(_context: fidl::encoding::Context) -> usize {
14525            8
14526        }
14527    }
14528
14529    unsafe impl<D: fidl::encoding::ResourceDialect>
14530        fidl::encoding::Encode<UsageGainListenerOnGainMuteChangedRequest, D>
14531        for &UsageGainListenerOnGainMuteChangedRequest
14532    {
14533        #[inline]
14534        unsafe fn encode(
14535            self,
14536            encoder: &mut fidl::encoding::Encoder<'_, D>,
14537            offset: usize,
14538            _depth: fidl::encoding::Depth,
14539        ) -> fidl::Result<()> {
14540            encoder.debug_check_bounds::<UsageGainListenerOnGainMuteChangedRequest>(offset);
14541            // Delegate to tuple encoding.
14542            fidl::encoding::Encode::<UsageGainListenerOnGainMuteChangedRequest, D>::encode(
14543                (
14544                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.muted),
14545                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.gain_dbfs),
14546                ),
14547                encoder,
14548                offset,
14549                _depth,
14550            )
14551        }
14552    }
14553    unsafe impl<
14554        D: fidl::encoding::ResourceDialect,
14555        T0: fidl::encoding::Encode<bool, D>,
14556        T1: fidl::encoding::Encode<f32, D>,
14557    > fidl::encoding::Encode<UsageGainListenerOnGainMuteChangedRequest, D> for (T0, T1)
14558    {
14559        #[inline]
14560        unsafe fn encode(
14561            self,
14562            encoder: &mut fidl::encoding::Encoder<'_, D>,
14563            offset: usize,
14564            depth: fidl::encoding::Depth,
14565        ) -> fidl::Result<()> {
14566            encoder.debug_check_bounds::<UsageGainListenerOnGainMuteChangedRequest>(offset);
14567            // Zero out padding regions. There's no need to apply masks
14568            // because the unmasked parts will be overwritten by fields.
14569            unsafe {
14570                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
14571                (ptr as *mut u32).write_unaligned(0);
14572            }
14573            // Write the fields.
14574            self.0.encode(encoder, offset + 0, depth)?;
14575            self.1.encode(encoder, offset + 4, depth)?;
14576            Ok(())
14577        }
14578    }
14579
14580    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
14581        for UsageGainListenerOnGainMuteChangedRequest
14582    {
14583        #[inline(always)]
14584        fn new_empty() -> Self {
14585            Self { muted: fidl::new_empty!(bool, D), gain_dbfs: fidl::new_empty!(f32, D) }
14586        }
14587
14588        #[inline]
14589        unsafe fn decode(
14590            &mut self,
14591            decoder: &mut fidl::encoding::Decoder<'_, D>,
14592            offset: usize,
14593            _depth: fidl::encoding::Depth,
14594        ) -> fidl::Result<()> {
14595            decoder.debug_check_bounds::<Self>(offset);
14596            // Verify that padding bytes are zero.
14597            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
14598            let padval = unsafe { (ptr as *const u32).read_unaligned() };
14599            let mask = 0xffffff00u32;
14600            let maskedval = padval & mask;
14601            if maskedval != 0 {
14602                return Err(fidl::Error::NonZeroPadding {
14603                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
14604                });
14605            }
14606            fidl::decode!(bool, D, &mut self.muted, decoder, offset + 0, _depth)?;
14607            fidl::decode!(f32, D, &mut self.gain_dbfs, decoder, offset + 4, _depth)?;
14608            Ok(())
14609        }
14610    }
14611
14612    impl fidl::encoding::ValueTypeMarker for UsageWatcher2OnStateChangedRequest {
14613        type Borrowed<'a> = &'a Self;
14614        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
14615            value
14616        }
14617    }
14618
14619    unsafe impl fidl::encoding::TypeMarker for UsageWatcher2OnStateChangedRequest {
14620        type Owned = Self;
14621
14622        #[inline(always)]
14623        fn inline_align(_context: fidl::encoding::Context) -> usize {
14624            8
14625        }
14626
14627        #[inline(always)]
14628        fn inline_size(_context: fidl::encoding::Context) -> usize {
14629            32
14630        }
14631    }
14632
14633    unsafe impl<D: fidl::encoding::ResourceDialect>
14634        fidl::encoding::Encode<UsageWatcher2OnStateChangedRequest, D>
14635        for &UsageWatcher2OnStateChangedRequest
14636    {
14637        #[inline]
14638        unsafe fn encode(
14639            self,
14640            encoder: &mut fidl::encoding::Encoder<'_, D>,
14641            offset: usize,
14642            _depth: fidl::encoding::Depth,
14643        ) -> fidl::Result<()> {
14644            encoder.debug_check_bounds::<UsageWatcher2OnStateChangedRequest>(offset);
14645            // Delegate to tuple encoding.
14646            fidl::encoding::Encode::<UsageWatcher2OnStateChangedRequest, D>::encode(
14647                (
14648                    <Usage2 as fidl::encoding::ValueTypeMarker>::borrow(&self.usage),
14649                    <UsageState as fidl::encoding::ValueTypeMarker>::borrow(&self.state),
14650                ),
14651                encoder,
14652                offset,
14653                _depth,
14654            )
14655        }
14656    }
14657    unsafe impl<
14658        D: fidl::encoding::ResourceDialect,
14659        T0: fidl::encoding::Encode<Usage2, D>,
14660        T1: fidl::encoding::Encode<UsageState, D>,
14661    > fidl::encoding::Encode<UsageWatcher2OnStateChangedRequest, D> for (T0, T1)
14662    {
14663        #[inline]
14664        unsafe fn encode(
14665            self,
14666            encoder: &mut fidl::encoding::Encoder<'_, D>,
14667            offset: usize,
14668            depth: fidl::encoding::Depth,
14669        ) -> fidl::Result<()> {
14670            encoder.debug_check_bounds::<UsageWatcher2OnStateChangedRequest>(offset);
14671            // Zero out padding regions. There's no need to apply masks
14672            // because the unmasked parts will be overwritten by fields.
14673            // Write the fields.
14674            self.0.encode(encoder, offset + 0, depth)?;
14675            self.1.encode(encoder, offset + 16, depth)?;
14676            Ok(())
14677        }
14678    }
14679
14680    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
14681        for UsageWatcher2OnStateChangedRequest
14682    {
14683        #[inline(always)]
14684        fn new_empty() -> Self {
14685            Self { usage: fidl::new_empty!(Usage2, D), state: fidl::new_empty!(UsageState, D) }
14686        }
14687
14688        #[inline]
14689        unsafe fn decode(
14690            &mut self,
14691            decoder: &mut fidl::encoding::Decoder<'_, D>,
14692            offset: usize,
14693            _depth: fidl::encoding::Depth,
14694        ) -> fidl::Result<()> {
14695            decoder.debug_check_bounds::<Self>(offset);
14696            // Verify that padding bytes are zero.
14697            fidl::decode!(Usage2, D, &mut self.usage, decoder, offset + 0, _depth)?;
14698            fidl::decode!(UsageState, D, &mut self.state, decoder, offset + 16, _depth)?;
14699            Ok(())
14700        }
14701    }
14702
14703    impl fidl::encoding::ValueTypeMarker for UsageWatcherOnStateChangedRequest {
14704        type Borrowed<'a> = &'a Self;
14705        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
14706            value
14707        }
14708    }
14709
14710    unsafe impl fidl::encoding::TypeMarker for UsageWatcherOnStateChangedRequest {
14711        type Owned = Self;
14712
14713        #[inline(always)]
14714        fn inline_align(_context: fidl::encoding::Context) -> usize {
14715            8
14716        }
14717
14718        #[inline(always)]
14719        fn inline_size(_context: fidl::encoding::Context) -> usize {
14720            32
14721        }
14722    }
14723
14724    unsafe impl<D: fidl::encoding::ResourceDialect>
14725        fidl::encoding::Encode<UsageWatcherOnStateChangedRequest, D>
14726        for &UsageWatcherOnStateChangedRequest
14727    {
14728        #[inline]
14729        unsafe fn encode(
14730            self,
14731            encoder: &mut fidl::encoding::Encoder<'_, D>,
14732            offset: usize,
14733            _depth: fidl::encoding::Depth,
14734        ) -> fidl::Result<()> {
14735            encoder.debug_check_bounds::<UsageWatcherOnStateChangedRequest>(offset);
14736            // Delegate to tuple encoding.
14737            fidl::encoding::Encode::<UsageWatcherOnStateChangedRequest, D>::encode(
14738                (
14739                    <Usage as fidl::encoding::ValueTypeMarker>::borrow(&self.usage),
14740                    <UsageState as fidl::encoding::ValueTypeMarker>::borrow(&self.state),
14741                ),
14742                encoder,
14743                offset,
14744                _depth,
14745            )
14746        }
14747    }
14748    unsafe impl<
14749        D: fidl::encoding::ResourceDialect,
14750        T0: fidl::encoding::Encode<Usage, D>,
14751        T1: fidl::encoding::Encode<UsageState, D>,
14752    > fidl::encoding::Encode<UsageWatcherOnStateChangedRequest, D> for (T0, T1)
14753    {
14754        #[inline]
14755        unsafe fn encode(
14756            self,
14757            encoder: &mut fidl::encoding::Encoder<'_, D>,
14758            offset: usize,
14759            depth: fidl::encoding::Depth,
14760        ) -> fidl::Result<()> {
14761            encoder.debug_check_bounds::<UsageWatcherOnStateChangedRequest>(offset);
14762            // Zero out padding regions. There's no need to apply masks
14763            // because the unmasked parts will be overwritten by fields.
14764            // Write the fields.
14765            self.0.encode(encoder, offset + 0, depth)?;
14766            self.1.encode(encoder, offset + 16, depth)?;
14767            Ok(())
14768        }
14769    }
14770
14771    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
14772        for UsageWatcherOnStateChangedRequest
14773    {
14774        #[inline(always)]
14775        fn new_empty() -> Self {
14776            Self { usage: fidl::new_empty!(Usage, D), state: fidl::new_empty!(UsageState, D) }
14777        }
14778
14779        #[inline]
14780        unsafe fn decode(
14781            &mut self,
14782            decoder: &mut fidl::encoding::Decoder<'_, D>,
14783            offset: usize,
14784            _depth: fidl::encoding::Depth,
14785        ) -> fidl::Result<()> {
14786            decoder.debug_check_bounds::<Self>(offset);
14787            // Verify that padding bytes are zero.
14788            fidl::decode!(Usage, D, &mut self.usage, decoder, offset + 0, _depth)?;
14789            fidl::decode!(UsageState, D, &mut self.state, decoder, offset + 16, _depth)?;
14790            Ok(())
14791        }
14792    }
14793
14794    impl fidl::encoding::ValueTypeMarker for VideoStreamType {
14795        type Borrowed<'a> = &'a Self;
14796        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
14797            value
14798        }
14799    }
14800
14801    unsafe impl fidl::encoding::TypeMarker for VideoStreamType {
14802        type Owned = Self;
14803
14804        #[inline(always)]
14805        fn inline_align(_context: fidl::encoding::Context) -> usize {
14806            4
14807        }
14808
14809        #[inline(always)]
14810        fn inline_size(_context: fidl::encoding::Context) -> usize {
14811            36
14812        }
14813    }
14814
14815    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<VideoStreamType, D>
14816        for &VideoStreamType
14817    {
14818        #[inline]
14819        unsafe fn encode(
14820            self,
14821            encoder: &mut fidl::encoding::Encoder<'_, D>,
14822            offset: usize,
14823            _depth: fidl::encoding::Depth,
14824        ) -> fidl::Result<()> {
14825            encoder.debug_check_bounds::<VideoStreamType>(offset);
14826            // Delegate to tuple encoding.
14827            fidl::encoding::Encode::<VideoStreamType, D>::encode(
14828                (
14829                    <fidl_fuchsia_images_common::PixelFormat as fidl::encoding::ValueTypeMarker>::borrow(&self.pixel_format),
14830                    <ColorSpace as fidl::encoding::ValueTypeMarker>::borrow(&self.color_space),
14831                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.width),
14832                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.height),
14833                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.coded_width),
14834                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.coded_height),
14835                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.pixel_aspect_ratio_width),
14836                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.pixel_aspect_ratio_height),
14837                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.stride),
14838                ),
14839                encoder, offset, _depth
14840            )
14841        }
14842    }
14843    unsafe impl<
14844        D: fidl::encoding::ResourceDialect,
14845        T0: fidl::encoding::Encode<fidl_fuchsia_images_common::PixelFormat, D>,
14846        T1: fidl::encoding::Encode<ColorSpace, D>,
14847        T2: fidl::encoding::Encode<u32, D>,
14848        T3: fidl::encoding::Encode<u32, D>,
14849        T4: fidl::encoding::Encode<u32, D>,
14850        T5: fidl::encoding::Encode<u32, D>,
14851        T6: fidl::encoding::Encode<u32, D>,
14852        T7: fidl::encoding::Encode<u32, D>,
14853        T8: fidl::encoding::Encode<u32, D>,
14854    > fidl::encoding::Encode<VideoStreamType, D> for (T0, T1, T2, T3, T4, T5, T6, T7, T8)
14855    {
14856        #[inline]
14857        unsafe fn encode(
14858            self,
14859            encoder: &mut fidl::encoding::Encoder<'_, D>,
14860            offset: usize,
14861            depth: fidl::encoding::Depth,
14862        ) -> fidl::Result<()> {
14863            encoder.debug_check_bounds::<VideoStreamType>(offset);
14864            // Zero out padding regions. There's no need to apply masks
14865            // because the unmasked parts will be overwritten by fields.
14866            // Write the fields.
14867            self.0.encode(encoder, offset + 0, depth)?;
14868            self.1.encode(encoder, offset + 4, depth)?;
14869            self.2.encode(encoder, offset + 8, depth)?;
14870            self.3.encode(encoder, offset + 12, depth)?;
14871            self.4.encode(encoder, offset + 16, depth)?;
14872            self.5.encode(encoder, offset + 20, depth)?;
14873            self.6.encode(encoder, offset + 24, depth)?;
14874            self.7.encode(encoder, offset + 28, depth)?;
14875            self.8.encode(encoder, offset + 32, depth)?;
14876            Ok(())
14877        }
14878    }
14879
14880    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VideoStreamType {
14881        #[inline(always)]
14882        fn new_empty() -> Self {
14883            Self {
14884                pixel_format: fidl::new_empty!(fidl_fuchsia_images_common::PixelFormat, D),
14885                color_space: fidl::new_empty!(ColorSpace, D),
14886                width: fidl::new_empty!(u32, D),
14887                height: fidl::new_empty!(u32, D),
14888                coded_width: fidl::new_empty!(u32, D),
14889                coded_height: fidl::new_empty!(u32, D),
14890                pixel_aspect_ratio_width: fidl::new_empty!(u32, D),
14891                pixel_aspect_ratio_height: fidl::new_empty!(u32, D),
14892                stride: fidl::new_empty!(u32, D),
14893            }
14894        }
14895
14896        #[inline]
14897        unsafe fn decode(
14898            &mut self,
14899            decoder: &mut fidl::encoding::Decoder<'_, D>,
14900            offset: usize,
14901            _depth: fidl::encoding::Depth,
14902        ) -> fidl::Result<()> {
14903            decoder.debug_check_bounds::<Self>(offset);
14904            // Verify that padding bytes are zero.
14905            fidl::decode!(
14906                fidl_fuchsia_images_common::PixelFormat,
14907                D,
14908                &mut self.pixel_format,
14909                decoder,
14910                offset + 0,
14911                _depth
14912            )?;
14913            fidl::decode!(ColorSpace, D, &mut self.color_space, decoder, offset + 4, _depth)?;
14914            fidl::decode!(u32, D, &mut self.width, decoder, offset + 8, _depth)?;
14915            fidl::decode!(u32, D, &mut self.height, decoder, offset + 12, _depth)?;
14916            fidl::decode!(u32, D, &mut self.coded_width, decoder, offset + 16, _depth)?;
14917            fidl::decode!(u32, D, &mut self.coded_height, decoder, offset + 20, _depth)?;
14918            fidl::decode!(
14919                u32,
14920                D,
14921                &mut self.pixel_aspect_ratio_width,
14922                decoder,
14923                offset + 24,
14924                _depth
14925            )?;
14926            fidl::decode!(
14927                u32,
14928                D,
14929                &mut self.pixel_aspect_ratio_height,
14930                decoder,
14931                offset + 28,
14932                _depth
14933            )?;
14934            fidl::decode!(u32, D, &mut self.stride, decoder, offset + 32, _depth)?;
14935            Ok(())
14936        }
14937    }
14938
14939    impl fidl::encoding::ValueTypeMarker for VideoUncompressedFormat {
14940        type Borrowed<'a> = &'a Self;
14941        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
14942            value
14943        }
14944    }
14945
14946    unsafe impl fidl::encoding::TypeMarker for VideoUncompressedFormat {
14947        type Owned = Self;
14948
14949        #[inline(always)]
14950        fn inline_align(_context: fidl::encoding::Context) -> usize {
14951            8
14952        }
14953
14954        #[inline(always)]
14955        fn inline_size(_context: fidl::encoding::Context) -> usize {
14956            128
14957        }
14958    }
14959
14960    unsafe impl<D: fidl::encoding::ResourceDialect>
14961        fidl::encoding::Encode<VideoUncompressedFormat, D> for &VideoUncompressedFormat
14962    {
14963        #[inline]
14964        unsafe fn encode(
14965            self,
14966            encoder: &mut fidl::encoding::Encoder<'_, D>,
14967            offset: usize,
14968            _depth: fidl::encoding::Depth,
14969        ) -> fidl::Result<()> {
14970            encoder.debug_check_bounds::<VideoUncompressedFormat>(offset);
14971            // Delegate to tuple encoding.
14972            fidl::encoding::Encode::<VideoUncompressedFormat, D>::encode(
14973                (
14974                    <fidl_fuchsia_sysmem_common::ImageFormat2 as fidl::encoding::ValueTypeMarker>::borrow(&self.image_format),
14975                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.fourcc),
14976                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.primary_width_pixels),
14977                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.primary_height_pixels),
14978                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.secondary_width_pixels),
14979                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.secondary_height_pixels),
14980                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.planar),
14981                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.swizzled),
14982                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.primary_line_stride_bytes),
14983                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.secondary_line_stride_bytes),
14984                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.primary_start_offset),
14985                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.secondary_start_offset),
14986                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.tertiary_start_offset),
14987                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.primary_pixel_stride),
14988                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.secondary_pixel_stride),
14989                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.primary_display_width_pixels),
14990                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.primary_display_height_pixels),
14991                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.has_pixel_aspect_ratio),
14992                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.pixel_aspect_ratio_width),
14993                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.pixel_aspect_ratio_height),
14994                ),
14995                encoder, offset, _depth
14996            )
14997        }
14998    }
14999    unsafe impl<
15000        D: fidl::encoding::ResourceDialect,
15001        T0: fidl::encoding::Encode<fidl_fuchsia_sysmem_common::ImageFormat2, D>,
15002        T1: fidl::encoding::Encode<u32, D>,
15003        T2: fidl::encoding::Encode<u32, D>,
15004        T3: fidl::encoding::Encode<u32, D>,
15005        T4: fidl::encoding::Encode<u32, D>,
15006        T5: fidl::encoding::Encode<u32, D>,
15007        T6: fidl::encoding::Encode<bool, D>,
15008        T7: fidl::encoding::Encode<bool, D>,
15009        T8: fidl::encoding::Encode<u32, D>,
15010        T9: fidl::encoding::Encode<u32, D>,
15011        T10: fidl::encoding::Encode<u32, D>,
15012        T11: fidl::encoding::Encode<u32, D>,
15013        T12: fidl::encoding::Encode<u32, D>,
15014        T13: fidl::encoding::Encode<u32, D>,
15015        T14: fidl::encoding::Encode<u32, D>,
15016        T15: fidl::encoding::Encode<u32, D>,
15017        T16: fidl::encoding::Encode<u32, D>,
15018        T17: fidl::encoding::Encode<bool, D>,
15019        T18: fidl::encoding::Encode<u32, D>,
15020        T19: fidl::encoding::Encode<u32, D>,
15021    > fidl::encoding::Encode<VideoUncompressedFormat, D>
15022        for (
15023            T0,
15024            T1,
15025            T2,
15026            T3,
15027            T4,
15028            T5,
15029            T6,
15030            T7,
15031            T8,
15032            T9,
15033            T10,
15034            T11,
15035            T12,
15036            T13,
15037            T14,
15038            T15,
15039            T16,
15040            T17,
15041            T18,
15042            T19,
15043        )
15044    {
15045        #[inline]
15046        unsafe fn encode(
15047            self,
15048            encoder: &mut fidl::encoding::Encoder<'_, D>,
15049            offset: usize,
15050            depth: fidl::encoding::Depth,
15051        ) -> fidl::Result<()> {
15052            encoder.debug_check_bounds::<VideoUncompressedFormat>(offset);
15053            // Zero out padding regions. There's no need to apply masks
15054            // because the unmasked parts will be overwritten by fields.
15055            unsafe {
15056                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(72);
15057                (ptr as *mut u64).write_unaligned(0);
15058            }
15059            unsafe {
15060                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(112);
15061                (ptr as *mut u64).write_unaligned(0);
15062            }
15063            // Write the fields.
15064            self.0.encode(encoder, offset + 0, depth)?;
15065            self.1.encode(encoder, offset + 56, depth)?;
15066            self.2.encode(encoder, offset + 60, depth)?;
15067            self.3.encode(encoder, offset + 64, depth)?;
15068            self.4.encode(encoder, offset + 68, depth)?;
15069            self.5.encode(encoder, offset + 72, depth)?;
15070            self.6.encode(encoder, offset + 76, depth)?;
15071            self.7.encode(encoder, offset + 77, depth)?;
15072            self.8.encode(encoder, offset + 80, depth)?;
15073            self.9.encode(encoder, offset + 84, depth)?;
15074            self.10.encode(encoder, offset + 88, depth)?;
15075            self.11.encode(encoder, offset + 92, depth)?;
15076            self.12.encode(encoder, offset + 96, depth)?;
15077            self.13.encode(encoder, offset + 100, depth)?;
15078            self.14.encode(encoder, offset + 104, depth)?;
15079            self.15.encode(encoder, offset + 108, depth)?;
15080            self.16.encode(encoder, offset + 112, depth)?;
15081            self.17.encode(encoder, offset + 116, depth)?;
15082            self.18.encode(encoder, offset + 120, depth)?;
15083            self.19.encode(encoder, offset + 124, depth)?;
15084            Ok(())
15085        }
15086    }
15087
15088    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
15089        for VideoUncompressedFormat
15090    {
15091        #[inline(always)]
15092        fn new_empty() -> Self {
15093            Self {
15094                image_format: fidl::new_empty!(fidl_fuchsia_sysmem_common::ImageFormat2, D),
15095                fourcc: fidl::new_empty!(u32, D),
15096                primary_width_pixels: fidl::new_empty!(u32, D),
15097                primary_height_pixels: fidl::new_empty!(u32, D),
15098                secondary_width_pixels: fidl::new_empty!(u32, D),
15099                secondary_height_pixels: fidl::new_empty!(u32, D),
15100                planar: fidl::new_empty!(bool, D),
15101                swizzled: fidl::new_empty!(bool, D),
15102                primary_line_stride_bytes: fidl::new_empty!(u32, D),
15103                secondary_line_stride_bytes: fidl::new_empty!(u32, D),
15104                primary_start_offset: fidl::new_empty!(u32, D),
15105                secondary_start_offset: fidl::new_empty!(u32, D),
15106                tertiary_start_offset: fidl::new_empty!(u32, D),
15107                primary_pixel_stride: fidl::new_empty!(u32, D),
15108                secondary_pixel_stride: fidl::new_empty!(u32, D),
15109                primary_display_width_pixels: fidl::new_empty!(u32, D),
15110                primary_display_height_pixels: fidl::new_empty!(u32, D),
15111                has_pixel_aspect_ratio: fidl::new_empty!(bool, D),
15112                pixel_aspect_ratio_width: fidl::new_empty!(u32, D),
15113                pixel_aspect_ratio_height: fidl::new_empty!(u32, D),
15114            }
15115        }
15116
15117        #[inline]
15118        unsafe fn decode(
15119            &mut self,
15120            decoder: &mut fidl::encoding::Decoder<'_, D>,
15121            offset: usize,
15122            _depth: fidl::encoding::Depth,
15123        ) -> fidl::Result<()> {
15124            decoder.debug_check_bounds::<Self>(offset);
15125            // Verify that padding bytes are zero.
15126            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(72) };
15127            let padval = unsafe { (ptr as *const u64).read_unaligned() };
15128            let mask = 0xffff000000000000u64;
15129            let maskedval = padval & mask;
15130            if maskedval != 0 {
15131                return Err(fidl::Error::NonZeroPadding {
15132                    padding_start: offset + 72 + ((mask as u64).trailing_zeros() / 8) as usize,
15133                });
15134            }
15135            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(112) };
15136            let padval = unsafe { (ptr as *const u64).read_unaligned() };
15137            let mask = 0xffffff0000000000u64;
15138            let maskedval = padval & mask;
15139            if maskedval != 0 {
15140                return Err(fidl::Error::NonZeroPadding {
15141                    padding_start: offset + 112 + ((mask as u64).trailing_zeros() / 8) as usize,
15142                });
15143            }
15144            fidl::decode!(
15145                fidl_fuchsia_sysmem_common::ImageFormat2,
15146                D,
15147                &mut self.image_format,
15148                decoder,
15149                offset + 0,
15150                _depth
15151            )?;
15152            fidl::decode!(u32, D, &mut self.fourcc, decoder, offset + 56, _depth)?;
15153            fidl::decode!(u32, D, &mut self.primary_width_pixels, decoder, offset + 60, _depth)?;
15154            fidl::decode!(u32, D, &mut self.primary_height_pixels, decoder, offset + 64, _depth)?;
15155            fidl::decode!(u32, D, &mut self.secondary_width_pixels, decoder, offset + 68, _depth)?;
15156            fidl::decode!(u32, D, &mut self.secondary_height_pixels, decoder, offset + 72, _depth)?;
15157            fidl::decode!(bool, D, &mut self.planar, decoder, offset + 76, _depth)?;
15158            fidl::decode!(bool, D, &mut self.swizzled, decoder, offset + 77, _depth)?;
15159            fidl::decode!(
15160                u32,
15161                D,
15162                &mut self.primary_line_stride_bytes,
15163                decoder,
15164                offset + 80,
15165                _depth
15166            )?;
15167            fidl::decode!(
15168                u32,
15169                D,
15170                &mut self.secondary_line_stride_bytes,
15171                decoder,
15172                offset + 84,
15173                _depth
15174            )?;
15175            fidl::decode!(u32, D, &mut self.primary_start_offset, decoder, offset + 88, _depth)?;
15176            fidl::decode!(u32, D, &mut self.secondary_start_offset, decoder, offset + 92, _depth)?;
15177            fidl::decode!(u32, D, &mut self.tertiary_start_offset, decoder, offset + 96, _depth)?;
15178            fidl::decode!(u32, D, &mut self.primary_pixel_stride, decoder, offset + 100, _depth)?;
15179            fidl::decode!(u32, D, &mut self.secondary_pixel_stride, decoder, offset + 104, _depth)?;
15180            fidl::decode!(
15181                u32,
15182                D,
15183                &mut self.primary_display_width_pixels,
15184                decoder,
15185                offset + 108,
15186                _depth
15187            )?;
15188            fidl::decode!(
15189                u32,
15190                D,
15191                &mut self.primary_display_height_pixels,
15192                decoder,
15193                offset + 112,
15194                _depth
15195            )?;
15196            fidl::decode!(
15197                bool,
15198                D,
15199                &mut self.has_pixel_aspect_ratio,
15200                decoder,
15201                offset + 116,
15202                _depth
15203            )?;
15204            fidl::decode!(
15205                u32,
15206                D,
15207                &mut self.pixel_aspect_ratio_width,
15208                decoder,
15209                offset + 120,
15210                _depth
15211            )?;
15212            fidl::decode!(
15213                u32,
15214                D,
15215                &mut self.pixel_aspect_ratio_height,
15216                decoder,
15217                offset + 124,
15218                _depth
15219            )?;
15220            Ok(())
15221        }
15222    }
15223
15224    impl fidl::encoding::ValueTypeMarker for Void {
15225        type Borrowed<'a> = &'a Self;
15226        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
15227            value
15228        }
15229    }
15230
15231    unsafe impl fidl::encoding::TypeMarker for Void {
15232        type Owned = Self;
15233
15234        #[inline(always)]
15235        fn inline_align(_context: fidl::encoding::Context) -> usize {
15236            1
15237        }
15238
15239        #[inline(always)]
15240        fn inline_size(_context: fidl::encoding::Context) -> usize {
15241            1
15242        }
15243    }
15244
15245    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Void, D> for &Void {
15246        #[inline]
15247        unsafe fn encode(
15248            self,
15249            encoder: &mut fidl::encoding::Encoder<'_, D>,
15250            offset: usize,
15251            _depth: fidl::encoding::Depth,
15252        ) -> fidl::Result<()> {
15253            encoder.debug_check_bounds::<Void>(offset);
15254            encoder.write_num(0u8, offset);
15255            Ok(())
15256        }
15257    }
15258
15259    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Void {
15260        #[inline(always)]
15261        fn new_empty() -> Self {
15262            Self
15263        }
15264
15265        #[inline]
15266        unsafe fn decode(
15267            &mut self,
15268            decoder: &mut fidl::encoding::Decoder<'_, D>,
15269            offset: usize,
15270            _depth: fidl::encoding::Depth,
15271        ) -> fidl::Result<()> {
15272            decoder.debug_check_bounds::<Self>(offset);
15273            match decoder.read_num::<u8>(offset) {
15274                0 => Ok(()),
15275                _ => Err(fidl::Error::Invalid),
15276            }
15277        }
15278    }
15279
15280    impl AudioCompressedFormatCvsd {
15281        #[inline(always)]
15282        fn max_ordinal_present(&self) -> u64 {
15283            0
15284        }
15285    }
15286
15287    impl fidl::encoding::ValueTypeMarker for AudioCompressedFormatCvsd {
15288        type Borrowed<'a> = &'a Self;
15289        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
15290            value
15291        }
15292    }
15293
15294    unsafe impl fidl::encoding::TypeMarker for AudioCompressedFormatCvsd {
15295        type Owned = Self;
15296
15297        #[inline(always)]
15298        fn inline_align(_context: fidl::encoding::Context) -> usize {
15299            8
15300        }
15301
15302        #[inline(always)]
15303        fn inline_size(_context: fidl::encoding::Context) -> usize {
15304            16
15305        }
15306    }
15307
15308    unsafe impl<D: fidl::encoding::ResourceDialect>
15309        fidl::encoding::Encode<AudioCompressedFormatCvsd, D> for &AudioCompressedFormatCvsd
15310    {
15311        unsafe fn encode(
15312            self,
15313            encoder: &mut fidl::encoding::Encoder<'_, D>,
15314            offset: usize,
15315            mut depth: fidl::encoding::Depth,
15316        ) -> fidl::Result<()> {
15317            encoder.debug_check_bounds::<AudioCompressedFormatCvsd>(offset);
15318            // Vector header
15319            let max_ordinal: u64 = self.max_ordinal_present();
15320            encoder.write_num(max_ordinal, offset);
15321            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
15322            // Calling encoder.out_of_line_offset(0) is not allowed.
15323            if max_ordinal == 0 {
15324                return Ok(());
15325            }
15326            depth.increment()?;
15327            let envelope_size = 8;
15328            let bytes_len = max_ordinal as usize * envelope_size;
15329            #[allow(unused_variables)]
15330            let offset = encoder.out_of_line_offset(bytes_len);
15331            let mut _prev_end_offset: usize = 0;
15332
15333            Ok(())
15334        }
15335    }
15336
15337    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
15338        for AudioCompressedFormatCvsd
15339    {
15340        #[inline(always)]
15341        fn new_empty() -> Self {
15342            Self::default()
15343        }
15344
15345        unsafe fn decode(
15346            &mut self,
15347            decoder: &mut fidl::encoding::Decoder<'_, D>,
15348            offset: usize,
15349            mut depth: fidl::encoding::Depth,
15350        ) -> fidl::Result<()> {
15351            decoder.debug_check_bounds::<Self>(offset);
15352            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
15353                None => return Err(fidl::Error::NotNullable),
15354                Some(len) => len,
15355            };
15356            // Calling decoder.out_of_line_offset(0) is not allowed.
15357            if len == 0 {
15358                return Ok(());
15359            };
15360            depth.increment()?;
15361            let envelope_size = 8;
15362            let bytes_len = len * envelope_size;
15363            let offset = decoder.out_of_line_offset(bytes_len)?;
15364            // Decode the envelope for each type.
15365            let mut _next_ordinal_to_read = 0;
15366            let mut next_offset = offset;
15367            let end_offset = offset + bytes_len;
15368
15369            // Decode the remaining unknown envelopes.
15370            while next_offset < end_offset {
15371                _next_ordinal_to_read += 1;
15372                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15373                next_offset += envelope_size;
15374            }
15375
15376            Ok(())
15377        }
15378    }
15379
15380    impl AudioCompressedFormatLc3 {
15381        #[inline(always)]
15382        fn max_ordinal_present(&self) -> u64 {
15383            0
15384        }
15385    }
15386
15387    impl fidl::encoding::ValueTypeMarker for AudioCompressedFormatLc3 {
15388        type Borrowed<'a> = &'a Self;
15389        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
15390            value
15391        }
15392    }
15393
15394    unsafe impl fidl::encoding::TypeMarker for AudioCompressedFormatLc3 {
15395        type Owned = Self;
15396
15397        #[inline(always)]
15398        fn inline_align(_context: fidl::encoding::Context) -> usize {
15399            8
15400        }
15401
15402        #[inline(always)]
15403        fn inline_size(_context: fidl::encoding::Context) -> usize {
15404            16
15405        }
15406    }
15407
15408    unsafe impl<D: fidl::encoding::ResourceDialect>
15409        fidl::encoding::Encode<AudioCompressedFormatLc3, D> for &AudioCompressedFormatLc3
15410    {
15411        unsafe fn encode(
15412            self,
15413            encoder: &mut fidl::encoding::Encoder<'_, D>,
15414            offset: usize,
15415            mut depth: fidl::encoding::Depth,
15416        ) -> fidl::Result<()> {
15417            encoder.debug_check_bounds::<AudioCompressedFormatLc3>(offset);
15418            // Vector header
15419            let max_ordinal: u64 = self.max_ordinal_present();
15420            encoder.write_num(max_ordinal, offset);
15421            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
15422            // Calling encoder.out_of_line_offset(0) is not allowed.
15423            if max_ordinal == 0 {
15424                return Ok(());
15425            }
15426            depth.increment()?;
15427            let envelope_size = 8;
15428            let bytes_len = max_ordinal as usize * envelope_size;
15429            #[allow(unused_variables)]
15430            let offset = encoder.out_of_line_offset(bytes_len);
15431            let mut _prev_end_offset: usize = 0;
15432
15433            Ok(())
15434        }
15435    }
15436
15437    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
15438        for AudioCompressedFormatLc3
15439    {
15440        #[inline(always)]
15441        fn new_empty() -> Self {
15442            Self::default()
15443        }
15444
15445        unsafe fn decode(
15446            &mut self,
15447            decoder: &mut fidl::encoding::Decoder<'_, D>,
15448            offset: usize,
15449            mut depth: fidl::encoding::Depth,
15450        ) -> fidl::Result<()> {
15451            decoder.debug_check_bounds::<Self>(offset);
15452            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
15453                None => return Err(fidl::Error::NotNullable),
15454                Some(len) => len,
15455            };
15456            // Calling decoder.out_of_line_offset(0) is not allowed.
15457            if len == 0 {
15458                return Ok(());
15459            };
15460            depth.increment()?;
15461            let envelope_size = 8;
15462            let bytes_len = len * envelope_size;
15463            let offset = decoder.out_of_line_offset(bytes_len)?;
15464            // Decode the envelope for each type.
15465            let mut _next_ordinal_to_read = 0;
15466            let mut next_offset = offset;
15467            let end_offset = offset + bytes_len;
15468
15469            // Decode the remaining unknown envelopes.
15470            while next_offset < end_offset {
15471                _next_ordinal_to_read += 1;
15472                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15473                next_offset += envelope_size;
15474            }
15475
15476            Ok(())
15477        }
15478    }
15479
15480    impl AudioConsumerStatus {
15481        #[inline(always)]
15482        fn max_ordinal_present(&self) -> u64 {
15483            if let Some(_) = self.max_lead_time {
15484                return 4;
15485            }
15486            if let Some(_) = self.min_lead_time {
15487                return 3;
15488            }
15489            if let Some(_) = self.presentation_timeline {
15490                return 2;
15491            }
15492            if let Some(_) = self.error {
15493                return 1;
15494            }
15495            0
15496        }
15497    }
15498
15499    impl fidl::encoding::ValueTypeMarker for AudioConsumerStatus {
15500        type Borrowed<'a> = &'a Self;
15501        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
15502            value
15503        }
15504    }
15505
15506    unsafe impl fidl::encoding::TypeMarker for AudioConsumerStatus {
15507        type Owned = Self;
15508
15509        #[inline(always)]
15510        fn inline_align(_context: fidl::encoding::Context) -> usize {
15511            8
15512        }
15513
15514        #[inline(always)]
15515        fn inline_size(_context: fidl::encoding::Context) -> usize {
15516            16
15517        }
15518    }
15519
15520    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AudioConsumerStatus, D>
15521        for &AudioConsumerStatus
15522    {
15523        unsafe fn encode(
15524            self,
15525            encoder: &mut fidl::encoding::Encoder<'_, D>,
15526            offset: usize,
15527            mut depth: fidl::encoding::Depth,
15528        ) -> fidl::Result<()> {
15529            encoder.debug_check_bounds::<AudioConsumerStatus>(offset);
15530            // Vector header
15531            let max_ordinal: u64 = self.max_ordinal_present();
15532            encoder.write_num(max_ordinal, offset);
15533            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
15534            // Calling encoder.out_of_line_offset(0) is not allowed.
15535            if max_ordinal == 0 {
15536                return Ok(());
15537            }
15538            depth.increment()?;
15539            let envelope_size = 8;
15540            let bytes_len = max_ordinal as usize * envelope_size;
15541            #[allow(unused_variables)]
15542            let offset = encoder.out_of_line_offset(bytes_len);
15543            let mut _prev_end_offset: usize = 0;
15544            if 1 > max_ordinal {
15545                return Ok(());
15546            }
15547
15548            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15549            // are envelope_size bytes.
15550            let cur_offset: usize = (1 - 1) * envelope_size;
15551
15552            // Zero reserved fields.
15553            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15554
15555            // Safety:
15556            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15557            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15558            //   envelope_size bytes, there is always sufficient room.
15559            fidl::encoding::encode_in_envelope_optional::<AudioConsumerError, D>(
15560                self.error
15561                    .as_ref()
15562                    .map(<AudioConsumerError as fidl::encoding::ValueTypeMarker>::borrow),
15563                encoder,
15564                offset + cur_offset,
15565                depth,
15566            )?;
15567
15568            _prev_end_offset = cur_offset + envelope_size;
15569            if 2 > max_ordinal {
15570                return Ok(());
15571            }
15572
15573            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15574            // are envelope_size bytes.
15575            let cur_offset: usize = (2 - 1) * envelope_size;
15576
15577            // Zero reserved fields.
15578            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15579
15580            // Safety:
15581            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15582            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15583            //   envelope_size bytes, there is always sufficient room.
15584            fidl::encoding::encode_in_envelope_optional::<TimelineFunction, D>(
15585                self.presentation_timeline
15586                    .as_ref()
15587                    .map(<TimelineFunction as fidl::encoding::ValueTypeMarker>::borrow),
15588                encoder,
15589                offset + cur_offset,
15590                depth,
15591            )?;
15592
15593            _prev_end_offset = cur_offset + envelope_size;
15594            if 3 > max_ordinal {
15595                return Ok(());
15596            }
15597
15598            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15599            // are envelope_size bytes.
15600            let cur_offset: usize = (3 - 1) * envelope_size;
15601
15602            // Zero reserved fields.
15603            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15604
15605            // Safety:
15606            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15607            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15608            //   envelope_size bytes, there is always sufficient room.
15609            fidl::encoding::encode_in_envelope_optional::<u64, D>(
15610                self.min_lead_time.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
15611                encoder,
15612                offset + cur_offset,
15613                depth,
15614            )?;
15615
15616            _prev_end_offset = cur_offset + envelope_size;
15617            if 4 > max_ordinal {
15618                return Ok(());
15619            }
15620
15621            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15622            // are envelope_size bytes.
15623            let cur_offset: usize = (4 - 1) * envelope_size;
15624
15625            // Zero reserved fields.
15626            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15627
15628            // Safety:
15629            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15630            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15631            //   envelope_size bytes, there is always sufficient room.
15632            fidl::encoding::encode_in_envelope_optional::<u64, D>(
15633                self.max_lead_time.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
15634                encoder,
15635                offset + cur_offset,
15636                depth,
15637            )?;
15638
15639            _prev_end_offset = cur_offset + envelope_size;
15640
15641            Ok(())
15642        }
15643    }
15644
15645    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AudioConsumerStatus {
15646        #[inline(always)]
15647        fn new_empty() -> Self {
15648            Self::default()
15649        }
15650
15651        unsafe fn decode(
15652            &mut self,
15653            decoder: &mut fidl::encoding::Decoder<'_, D>,
15654            offset: usize,
15655            mut depth: fidl::encoding::Depth,
15656        ) -> fidl::Result<()> {
15657            decoder.debug_check_bounds::<Self>(offset);
15658            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
15659                None => return Err(fidl::Error::NotNullable),
15660                Some(len) => len,
15661            };
15662            // Calling decoder.out_of_line_offset(0) is not allowed.
15663            if len == 0 {
15664                return Ok(());
15665            };
15666            depth.increment()?;
15667            let envelope_size = 8;
15668            let bytes_len = len * envelope_size;
15669            let offset = decoder.out_of_line_offset(bytes_len)?;
15670            // Decode the envelope for each type.
15671            let mut _next_ordinal_to_read = 0;
15672            let mut next_offset = offset;
15673            let end_offset = offset + bytes_len;
15674            _next_ordinal_to_read += 1;
15675            if next_offset >= end_offset {
15676                return Ok(());
15677            }
15678
15679            // Decode unknown envelopes for gaps in ordinals.
15680            while _next_ordinal_to_read < 1 {
15681                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15682                _next_ordinal_to_read += 1;
15683                next_offset += envelope_size;
15684            }
15685
15686            let next_out_of_line = decoder.next_out_of_line();
15687            let handles_before = decoder.remaining_handles();
15688            if let Some((inlined, num_bytes, num_handles)) =
15689                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15690            {
15691                let member_inline_size =
15692                    <AudioConsumerError as fidl::encoding::TypeMarker>::inline_size(
15693                        decoder.context,
15694                    );
15695                if inlined != (member_inline_size <= 4) {
15696                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15697                }
15698                let inner_offset;
15699                let mut inner_depth = depth.clone();
15700                if inlined {
15701                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15702                    inner_offset = next_offset;
15703                } else {
15704                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15705                    inner_depth.increment()?;
15706                }
15707                let val_ref =
15708                    self.error.get_or_insert_with(|| fidl::new_empty!(AudioConsumerError, D));
15709                fidl::decode!(AudioConsumerError, D, val_ref, decoder, inner_offset, inner_depth)?;
15710                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15711                {
15712                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15713                }
15714                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15715                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15716                }
15717            }
15718
15719            next_offset += envelope_size;
15720            _next_ordinal_to_read += 1;
15721            if next_offset >= end_offset {
15722                return Ok(());
15723            }
15724
15725            // Decode unknown envelopes for gaps in ordinals.
15726            while _next_ordinal_to_read < 2 {
15727                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15728                _next_ordinal_to_read += 1;
15729                next_offset += envelope_size;
15730            }
15731
15732            let next_out_of_line = decoder.next_out_of_line();
15733            let handles_before = decoder.remaining_handles();
15734            if let Some((inlined, num_bytes, num_handles)) =
15735                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15736            {
15737                let member_inline_size =
15738                    <TimelineFunction as fidl::encoding::TypeMarker>::inline_size(decoder.context);
15739                if inlined != (member_inline_size <= 4) {
15740                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15741                }
15742                let inner_offset;
15743                let mut inner_depth = depth.clone();
15744                if inlined {
15745                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15746                    inner_offset = next_offset;
15747                } else {
15748                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15749                    inner_depth.increment()?;
15750                }
15751                let val_ref = self
15752                    .presentation_timeline
15753                    .get_or_insert_with(|| fidl::new_empty!(TimelineFunction, D));
15754                fidl::decode!(TimelineFunction, D, val_ref, decoder, inner_offset, inner_depth)?;
15755                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15756                {
15757                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15758                }
15759                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15760                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15761                }
15762            }
15763
15764            next_offset += envelope_size;
15765            _next_ordinal_to_read += 1;
15766            if next_offset >= end_offset {
15767                return Ok(());
15768            }
15769
15770            // Decode unknown envelopes for gaps in ordinals.
15771            while _next_ordinal_to_read < 3 {
15772                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15773                _next_ordinal_to_read += 1;
15774                next_offset += envelope_size;
15775            }
15776
15777            let next_out_of_line = decoder.next_out_of_line();
15778            let handles_before = decoder.remaining_handles();
15779            if let Some((inlined, num_bytes, num_handles)) =
15780                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15781            {
15782                let member_inline_size =
15783                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
15784                if inlined != (member_inline_size <= 4) {
15785                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15786                }
15787                let inner_offset;
15788                let mut inner_depth = depth.clone();
15789                if inlined {
15790                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15791                    inner_offset = next_offset;
15792                } else {
15793                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15794                    inner_depth.increment()?;
15795                }
15796                let val_ref = self.min_lead_time.get_or_insert_with(|| fidl::new_empty!(u64, D));
15797                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
15798                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15799                {
15800                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15801                }
15802                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15803                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15804                }
15805            }
15806
15807            next_offset += envelope_size;
15808            _next_ordinal_to_read += 1;
15809            if next_offset >= end_offset {
15810                return Ok(());
15811            }
15812
15813            // Decode unknown envelopes for gaps in ordinals.
15814            while _next_ordinal_to_read < 4 {
15815                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15816                _next_ordinal_to_read += 1;
15817                next_offset += envelope_size;
15818            }
15819
15820            let next_out_of_line = decoder.next_out_of_line();
15821            let handles_before = decoder.remaining_handles();
15822            if let Some((inlined, num_bytes, num_handles)) =
15823                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15824            {
15825                let member_inline_size =
15826                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
15827                if inlined != (member_inline_size <= 4) {
15828                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15829                }
15830                let inner_offset;
15831                let mut inner_depth = depth.clone();
15832                if inlined {
15833                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15834                    inner_offset = next_offset;
15835                } else {
15836                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15837                    inner_depth.increment()?;
15838                }
15839                let val_ref = self.max_lead_time.get_or_insert_with(|| fidl::new_empty!(u64, D));
15840                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
15841                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15842                {
15843                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15844                }
15845                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15846                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15847                }
15848            }
15849
15850            next_offset += envelope_size;
15851
15852            // Decode the remaining unknown envelopes.
15853            while next_offset < end_offset {
15854                _next_ordinal_to_read += 1;
15855                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15856                next_offset += envelope_size;
15857            }
15858
15859            Ok(())
15860        }
15861    }
15862
15863    impl CvsdEncoderSettings {
15864        #[inline(always)]
15865        fn max_ordinal_present(&self) -> u64 {
15866            0
15867        }
15868    }
15869
15870    impl fidl::encoding::ValueTypeMarker for CvsdEncoderSettings {
15871        type Borrowed<'a> = &'a Self;
15872        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
15873            value
15874        }
15875    }
15876
15877    unsafe impl fidl::encoding::TypeMarker for CvsdEncoderSettings {
15878        type Owned = Self;
15879
15880        #[inline(always)]
15881        fn inline_align(_context: fidl::encoding::Context) -> usize {
15882            8
15883        }
15884
15885        #[inline(always)]
15886        fn inline_size(_context: fidl::encoding::Context) -> usize {
15887            16
15888        }
15889    }
15890
15891    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CvsdEncoderSettings, D>
15892        for &CvsdEncoderSettings
15893    {
15894        unsafe fn encode(
15895            self,
15896            encoder: &mut fidl::encoding::Encoder<'_, D>,
15897            offset: usize,
15898            mut depth: fidl::encoding::Depth,
15899        ) -> fidl::Result<()> {
15900            encoder.debug_check_bounds::<CvsdEncoderSettings>(offset);
15901            // Vector header
15902            let max_ordinal: u64 = self.max_ordinal_present();
15903            encoder.write_num(max_ordinal, offset);
15904            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
15905            // Calling encoder.out_of_line_offset(0) is not allowed.
15906            if max_ordinal == 0 {
15907                return Ok(());
15908            }
15909            depth.increment()?;
15910            let envelope_size = 8;
15911            let bytes_len = max_ordinal as usize * envelope_size;
15912            #[allow(unused_variables)]
15913            let offset = encoder.out_of_line_offset(bytes_len);
15914            let mut _prev_end_offset: usize = 0;
15915
15916            Ok(())
15917        }
15918    }
15919
15920    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CvsdEncoderSettings {
15921        #[inline(always)]
15922        fn new_empty() -> Self {
15923            Self::default()
15924        }
15925
15926        unsafe fn decode(
15927            &mut self,
15928            decoder: &mut fidl::encoding::Decoder<'_, D>,
15929            offset: usize,
15930            mut depth: fidl::encoding::Depth,
15931        ) -> fidl::Result<()> {
15932            decoder.debug_check_bounds::<Self>(offset);
15933            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
15934                None => return Err(fidl::Error::NotNullable),
15935                Some(len) => len,
15936            };
15937            // Calling decoder.out_of_line_offset(0) is not allowed.
15938            if len == 0 {
15939                return Ok(());
15940            };
15941            depth.increment()?;
15942            let envelope_size = 8;
15943            let bytes_len = len * envelope_size;
15944            let offset = decoder.out_of_line_offset(bytes_len)?;
15945            // Decode the envelope for each type.
15946            let mut _next_ordinal_to_read = 0;
15947            let mut next_offset = offset;
15948            let end_offset = offset + bytes_len;
15949
15950            // Decode the remaining unknown envelopes.
15951            while next_offset < end_offset {
15952                _next_ordinal_to_read += 1;
15953                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15954                next_offset += envelope_size;
15955            }
15956
15957            Ok(())
15958        }
15959    }
15960
15961    impl DecryptedFormat {
15962        #[inline(always)]
15963        fn max_ordinal_present(&self) -> u64 {
15964            if let Some(_) = self.ignore_this_field {
15965                return 1;
15966            }
15967            0
15968        }
15969    }
15970
15971    impl fidl::encoding::ValueTypeMarker for DecryptedFormat {
15972        type Borrowed<'a> = &'a Self;
15973        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
15974            value
15975        }
15976    }
15977
15978    unsafe impl fidl::encoding::TypeMarker for DecryptedFormat {
15979        type Owned = Self;
15980
15981        #[inline(always)]
15982        fn inline_align(_context: fidl::encoding::Context) -> usize {
15983            8
15984        }
15985
15986        #[inline(always)]
15987        fn inline_size(_context: fidl::encoding::Context) -> usize {
15988            16
15989        }
15990    }
15991
15992    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DecryptedFormat, D>
15993        for &DecryptedFormat
15994    {
15995        unsafe fn encode(
15996            self,
15997            encoder: &mut fidl::encoding::Encoder<'_, D>,
15998            offset: usize,
15999            mut depth: fidl::encoding::Depth,
16000        ) -> fidl::Result<()> {
16001            encoder.debug_check_bounds::<DecryptedFormat>(offset);
16002            // Vector header
16003            let max_ordinal: u64 = self.max_ordinal_present();
16004            encoder.write_num(max_ordinal, offset);
16005            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
16006            // Calling encoder.out_of_line_offset(0) is not allowed.
16007            if max_ordinal == 0 {
16008                return Ok(());
16009            }
16010            depth.increment()?;
16011            let envelope_size = 8;
16012            let bytes_len = max_ordinal as usize * envelope_size;
16013            #[allow(unused_variables)]
16014            let offset = encoder.out_of_line_offset(bytes_len);
16015            let mut _prev_end_offset: usize = 0;
16016            if 1 > max_ordinal {
16017                return Ok(());
16018            }
16019
16020            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16021            // are envelope_size bytes.
16022            let cur_offset: usize = (1 - 1) * envelope_size;
16023
16024            // Zero reserved fields.
16025            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16026
16027            // Safety:
16028            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16029            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16030            //   envelope_size bytes, there is always sufficient room.
16031            fidl::encoding::encode_in_envelope_optional::<bool, D>(
16032                self.ignore_this_field
16033                    .as_ref()
16034                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
16035                encoder,
16036                offset + cur_offset,
16037                depth,
16038            )?;
16039
16040            _prev_end_offset = cur_offset + envelope_size;
16041
16042            Ok(())
16043        }
16044    }
16045
16046    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DecryptedFormat {
16047        #[inline(always)]
16048        fn new_empty() -> Self {
16049            Self::default()
16050        }
16051
16052        unsafe fn decode(
16053            &mut self,
16054            decoder: &mut fidl::encoding::Decoder<'_, D>,
16055            offset: usize,
16056            mut depth: fidl::encoding::Depth,
16057        ) -> fidl::Result<()> {
16058            decoder.debug_check_bounds::<Self>(offset);
16059            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
16060                None => return Err(fidl::Error::NotNullable),
16061                Some(len) => len,
16062            };
16063            // Calling decoder.out_of_line_offset(0) is not allowed.
16064            if len == 0 {
16065                return Ok(());
16066            };
16067            depth.increment()?;
16068            let envelope_size = 8;
16069            let bytes_len = len * envelope_size;
16070            let offset = decoder.out_of_line_offset(bytes_len)?;
16071            // Decode the envelope for each type.
16072            let mut _next_ordinal_to_read = 0;
16073            let mut next_offset = offset;
16074            let end_offset = offset + bytes_len;
16075            _next_ordinal_to_read += 1;
16076            if next_offset >= end_offset {
16077                return Ok(());
16078            }
16079
16080            // Decode unknown envelopes for gaps in ordinals.
16081            while _next_ordinal_to_read < 1 {
16082                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16083                _next_ordinal_to_read += 1;
16084                next_offset += envelope_size;
16085            }
16086
16087            let next_out_of_line = decoder.next_out_of_line();
16088            let handles_before = decoder.remaining_handles();
16089            if let Some((inlined, num_bytes, num_handles)) =
16090                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16091            {
16092                let member_inline_size =
16093                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16094                if inlined != (member_inline_size <= 4) {
16095                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16096                }
16097                let inner_offset;
16098                let mut inner_depth = depth.clone();
16099                if inlined {
16100                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16101                    inner_offset = next_offset;
16102                } else {
16103                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16104                    inner_depth.increment()?;
16105                }
16106                let val_ref =
16107                    self.ignore_this_field.get_or_insert_with(|| fidl::new_empty!(bool, D));
16108                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
16109                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16110                {
16111                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16112                }
16113                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16114                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16115                }
16116            }
16117
16118            next_offset += envelope_size;
16119
16120            // Decode the remaining unknown envelopes.
16121            while next_offset < end_offset {
16122                _next_ordinal_to_read += 1;
16123                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16124                next_offset += envelope_size;
16125            }
16126
16127            Ok(())
16128        }
16129    }
16130
16131    impl EncryptedFormat {
16132        #[inline(always)]
16133        fn max_ordinal_present(&self) -> u64 {
16134            if let Some(_) = self.key_id {
16135                return 8;
16136            }
16137            if let Some(_) = self.scheme {
16138                return 6;
16139            }
16140            if let Some(_) = self.pattern {
16141                return 5;
16142            }
16143            if let Some(_) = self.subsamples {
16144                return 4;
16145            }
16146            if let Some(_) = self.init_vector {
16147                return 3;
16148            }
16149            0
16150        }
16151    }
16152
16153    impl fidl::encoding::ValueTypeMarker for EncryptedFormat {
16154        type Borrowed<'a> = &'a Self;
16155        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
16156            value
16157        }
16158    }
16159
16160    unsafe impl fidl::encoding::TypeMarker for EncryptedFormat {
16161        type Owned = Self;
16162
16163        #[inline(always)]
16164        fn inline_align(_context: fidl::encoding::Context) -> usize {
16165            8
16166        }
16167
16168        #[inline(always)]
16169        fn inline_size(_context: fidl::encoding::Context) -> usize {
16170            16
16171        }
16172    }
16173
16174    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<EncryptedFormat, D>
16175        for &EncryptedFormat
16176    {
16177        unsafe fn encode(
16178            self,
16179            encoder: &mut fidl::encoding::Encoder<'_, D>,
16180            offset: usize,
16181            mut depth: fidl::encoding::Depth,
16182        ) -> fidl::Result<()> {
16183            encoder.debug_check_bounds::<EncryptedFormat>(offset);
16184            // Vector header
16185            let max_ordinal: u64 = self.max_ordinal_present();
16186            encoder.write_num(max_ordinal, offset);
16187            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
16188            // Calling encoder.out_of_line_offset(0) is not allowed.
16189            if max_ordinal == 0 {
16190                return Ok(());
16191            }
16192            depth.increment()?;
16193            let envelope_size = 8;
16194            let bytes_len = max_ordinal as usize * envelope_size;
16195            #[allow(unused_variables)]
16196            let offset = encoder.out_of_line_offset(bytes_len);
16197            let mut _prev_end_offset: usize = 0;
16198            if 3 > max_ordinal {
16199                return Ok(());
16200            }
16201
16202            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16203            // are envelope_size bytes.
16204            let cur_offset: usize = (3 - 1) * envelope_size;
16205
16206            // Zero reserved fields.
16207            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16208
16209            // Safety:
16210            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16211            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16212            //   envelope_size bytes, there is always sufficient room.
16213            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 16>, D>(
16214                self.init_vector.as_ref().map(
16215                    <fidl::encoding::Vector<u8, 16> as fidl::encoding::ValueTypeMarker>::borrow,
16216                ),
16217                encoder,
16218                offset + cur_offset,
16219                depth,
16220            )?;
16221
16222            _prev_end_offset = cur_offset + envelope_size;
16223            if 4 > max_ordinal {
16224                return Ok(());
16225            }
16226
16227            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16228            // are envelope_size bytes.
16229            let cur_offset: usize = (4 - 1) * envelope_size;
16230
16231            // Zero reserved fields.
16232            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16233
16234            // Safety:
16235            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16236            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16237            //   envelope_size bytes, there is always sufficient room.
16238            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<SubsampleEntry>, D>(
16239            self.subsamples.as_ref().map(<fidl::encoding::UnboundedVector<SubsampleEntry> as fidl::encoding::ValueTypeMarker>::borrow),
16240            encoder, offset + cur_offset, depth
16241        )?;
16242
16243            _prev_end_offset = cur_offset + envelope_size;
16244            if 5 > max_ordinal {
16245                return Ok(());
16246            }
16247
16248            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16249            // are envelope_size bytes.
16250            let cur_offset: usize = (5 - 1) * envelope_size;
16251
16252            // Zero reserved fields.
16253            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16254
16255            // Safety:
16256            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16257            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16258            //   envelope_size bytes, there is always sufficient room.
16259            fidl::encoding::encode_in_envelope_optional::<EncryptionPattern, D>(
16260                self.pattern
16261                    .as_ref()
16262                    .map(<EncryptionPattern as fidl::encoding::ValueTypeMarker>::borrow),
16263                encoder,
16264                offset + cur_offset,
16265                depth,
16266            )?;
16267
16268            _prev_end_offset = cur_offset + envelope_size;
16269            if 6 > max_ordinal {
16270                return Ok(());
16271            }
16272
16273            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16274            // are envelope_size bytes.
16275            let cur_offset: usize = (6 - 1) * envelope_size;
16276
16277            // Zero reserved fields.
16278            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16279
16280            // Safety:
16281            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16282            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16283            //   envelope_size bytes, there is always sufficient room.
16284            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedString, D>(
16285                self.scheme.as_ref().map(
16286                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
16287                ),
16288                encoder,
16289                offset + cur_offset,
16290                depth,
16291            )?;
16292
16293            _prev_end_offset = cur_offset + envelope_size;
16294            if 8 > max_ordinal {
16295                return Ok(());
16296            }
16297
16298            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16299            // are envelope_size bytes.
16300            let cur_offset: usize = (8 - 1) * envelope_size;
16301
16302            // Zero reserved fields.
16303            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16304
16305            // Safety:
16306            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16307            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16308            //   envelope_size bytes, there is always sufficient room.
16309            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 16>, D>(
16310                self.key_id.as_ref().map(
16311                    <fidl::encoding::Vector<u8, 16> as fidl::encoding::ValueTypeMarker>::borrow,
16312                ),
16313                encoder,
16314                offset + cur_offset,
16315                depth,
16316            )?;
16317
16318            _prev_end_offset = cur_offset + envelope_size;
16319
16320            Ok(())
16321        }
16322    }
16323
16324    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for EncryptedFormat {
16325        #[inline(always)]
16326        fn new_empty() -> Self {
16327            Self::default()
16328        }
16329
16330        unsafe fn decode(
16331            &mut self,
16332            decoder: &mut fidl::encoding::Decoder<'_, D>,
16333            offset: usize,
16334            mut depth: fidl::encoding::Depth,
16335        ) -> fidl::Result<()> {
16336            decoder.debug_check_bounds::<Self>(offset);
16337            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
16338                None => return Err(fidl::Error::NotNullable),
16339                Some(len) => len,
16340            };
16341            // Calling decoder.out_of_line_offset(0) is not allowed.
16342            if len == 0 {
16343                return Ok(());
16344            };
16345            depth.increment()?;
16346            let envelope_size = 8;
16347            let bytes_len = len * envelope_size;
16348            let offset = decoder.out_of_line_offset(bytes_len)?;
16349            // Decode the envelope for each type.
16350            let mut _next_ordinal_to_read = 0;
16351            let mut next_offset = offset;
16352            let end_offset = offset + bytes_len;
16353            _next_ordinal_to_read += 1;
16354            if next_offset >= end_offset {
16355                return Ok(());
16356            }
16357
16358            // Decode unknown envelopes for gaps in ordinals.
16359            while _next_ordinal_to_read < 3 {
16360                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16361                _next_ordinal_to_read += 1;
16362                next_offset += envelope_size;
16363            }
16364
16365            let next_out_of_line = decoder.next_out_of_line();
16366            let handles_before = decoder.remaining_handles();
16367            if let Some((inlined, num_bytes, num_handles)) =
16368                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16369            {
16370                let member_inline_size =
16371                    <fidl::encoding::Vector<u8, 16> as fidl::encoding::TypeMarker>::inline_size(
16372                        decoder.context,
16373                    );
16374                if inlined != (member_inline_size <= 4) {
16375                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16376                }
16377                let inner_offset;
16378                let mut inner_depth = depth.clone();
16379                if inlined {
16380                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16381                    inner_offset = next_offset;
16382                } else {
16383                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16384                    inner_depth.increment()?;
16385                }
16386                let val_ref = self
16387                    .init_vector
16388                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 16>, D));
16389                fidl::decode!(fidl::encoding::Vector<u8, 16>, D, val_ref, decoder, inner_offset, inner_depth)?;
16390                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16391                {
16392                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16393                }
16394                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16395                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16396                }
16397            }
16398
16399            next_offset += envelope_size;
16400            _next_ordinal_to_read += 1;
16401            if next_offset >= end_offset {
16402                return Ok(());
16403            }
16404
16405            // Decode unknown envelopes for gaps in ordinals.
16406            while _next_ordinal_to_read < 4 {
16407                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16408                _next_ordinal_to_read += 1;
16409                next_offset += envelope_size;
16410            }
16411
16412            let next_out_of_line = decoder.next_out_of_line();
16413            let handles_before = decoder.remaining_handles();
16414            if let Some((inlined, num_bytes, num_handles)) =
16415                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16416            {
16417                let member_inline_size = <fidl::encoding::UnboundedVector<SubsampleEntry> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16418                if inlined != (member_inline_size <= 4) {
16419                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16420                }
16421                let inner_offset;
16422                let mut inner_depth = depth.clone();
16423                if inlined {
16424                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16425                    inner_offset = next_offset;
16426                } else {
16427                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16428                    inner_depth.increment()?;
16429                }
16430                let val_ref = self.subsamples.get_or_insert_with(|| {
16431                    fidl::new_empty!(fidl::encoding::UnboundedVector<SubsampleEntry>, D)
16432                });
16433                fidl::decode!(
16434                    fidl::encoding::UnboundedVector<SubsampleEntry>,
16435                    D,
16436                    val_ref,
16437                    decoder,
16438                    inner_offset,
16439                    inner_depth
16440                )?;
16441                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16442                {
16443                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16444                }
16445                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16446                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16447                }
16448            }
16449
16450            next_offset += envelope_size;
16451            _next_ordinal_to_read += 1;
16452            if next_offset >= end_offset {
16453                return Ok(());
16454            }
16455
16456            // Decode unknown envelopes for gaps in ordinals.
16457            while _next_ordinal_to_read < 5 {
16458                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16459                _next_ordinal_to_read += 1;
16460                next_offset += envelope_size;
16461            }
16462
16463            let next_out_of_line = decoder.next_out_of_line();
16464            let handles_before = decoder.remaining_handles();
16465            if let Some((inlined, num_bytes, num_handles)) =
16466                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16467            {
16468                let member_inline_size =
16469                    <EncryptionPattern as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16470                if inlined != (member_inline_size <= 4) {
16471                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16472                }
16473                let inner_offset;
16474                let mut inner_depth = depth.clone();
16475                if inlined {
16476                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16477                    inner_offset = next_offset;
16478                } else {
16479                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16480                    inner_depth.increment()?;
16481                }
16482                let val_ref =
16483                    self.pattern.get_or_insert_with(|| fidl::new_empty!(EncryptionPattern, D));
16484                fidl::decode!(EncryptionPattern, D, val_ref, decoder, inner_offset, inner_depth)?;
16485                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16486                {
16487                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16488                }
16489                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16490                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16491                }
16492            }
16493
16494            next_offset += envelope_size;
16495            _next_ordinal_to_read += 1;
16496            if next_offset >= end_offset {
16497                return Ok(());
16498            }
16499
16500            // Decode unknown envelopes for gaps in ordinals.
16501            while _next_ordinal_to_read < 6 {
16502                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16503                _next_ordinal_to_read += 1;
16504                next_offset += envelope_size;
16505            }
16506
16507            let next_out_of_line = decoder.next_out_of_line();
16508            let handles_before = decoder.remaining_handles();
16509            if let Some((inlined, num_bytes, num_handles)) =
16510                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16511            {
16512                let member_inline_size =
16513                    <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
16514                        decoder.context,
16515                    );
16516                if inlined != (member_inline_size <= 4) {
16517                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16518                }
16519                let inner_offset;
16520                let mut inner_depth = depth.clone();
16521                if inlined {
16522                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16523                    inner_offset = next_offset;
16524                } else {
16525                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16526                    inner_depth.increment()?;
16527                }
16528                let val_ref = self
16529                    .scheme
16530                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::UnboundedString, D));
16531                fidl::decode!(
16532                    fidl::encoding::UnboundedString,
16533                    D,
16534                    val_ref,
16535                    decoder,
16536                    inner_offset,
16537                    inner_depth
16538                )?;
16539                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16540                {
16541                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16542                }
16543                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16544                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16545                }
16546            }
16547
16548            next_offset += envelope_size;
16549            _next_ordinal_to_read += 1;
16550            if next_offset >= end_offset {
16551                return Ok(());
16552            }
16553
16554            // Decode unknown envelopes for gaps in ordinals.
16555            while _next_ordinal_to_read < 8 {
16556                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16557                _next_ordinal_to_read += 1;
16558                next_offset += envelope_size;
16559            }
16560
16561            let next_out_of_line = decoder.next_out_of_line();
16562            let handles_before = decoder.remaining_handles();
16563            if let Some((inlined, num_bytes, num_handles)) =
16564                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16565            {
16566                let member_inline_size =
16567                    <fidl::encoding::Vector<u8, 16> as fidl::encoding::TypeMarker>::inline_size(
16568                        decoder.context,
16569                    );
16570                if inlined != (member_inline_size <= 4) {
16571                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16572                }
16573                let inner_offset;
16574                let mut inner_depth = depth.clone();
16575                if inlined {
16576                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16577                    inner_offset = next_offset;
16578                } else {
16579                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16580                    inner_depth.increment()?;
16581                }
16582                let val_ref = self
16583                    .key_id
16584                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 16>, D));
16585                fidl::decode!(fidl::encoding::Vector<u8, 16>, D, val_ref, decoder, inner_offset, inner_depth)?;
16586                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16587                {
16588                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16589                }
16590                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16591                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16592                }
16593            }
16594
16595            next_offset += envelope_size;
16596
16597            // Decode the remaining unknown envelopes.
16598            while next_offset < end_offset {
16599                _next_ordinal_to_read += 1;
16600                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16601                next_offset += envelope_size;
16602            }
16603
16604            Ok(())
16605        }
16606    }
16607
16608    impl FormatDetails {
16609        #[inline(always)]
16610        fn max_ordinal_present(&self) -> u64 {
16611            if let Some(_) = self.profile {
16612                return 8;
16613            }
16614            if let Some(_) = self.timebase {
16615                return 7;
16616            }
16617            if let Some(_) = self.encoder_settings {
16618                return 6;
16619            }
16620            if let Some(_) = self.pass_through_parameters {
16621                return 5;
16622            }
16623            if let Some(_) = self.domain {
16624                return 4;
16625            }
16626            if let Some(_) = self.oob_bytes {
16627                return 3;
16628            }
16629            if let Some(_) = self.mime_type {
16630                return 2;
16631            }
16632            if let Some(_) = self.format_details_version_ordinal {
16633                return 1;
16634            }
16635            0
16636        }
16637    }
16638
16639    impl fidl::encoding::ValueTypeMarker for FormatDetails {
16640        type Borrowed<'a> = &'a Self;
16641        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
16642            value
16643        }
16644    }
16645
16646    unsafe impl fidl::encoding::TypeMarker for FormatDetails {
16647        type Owned = Self;
16648
16649        #[inline(always)]
16650        fn inline_align(_context: fidl::encoding::Context) -> usize {
16651            8
16652        }
16653
16654        #[inline(always)]
16655        fn inline_size(_context: fidl::encoding::Context) -> usize {
16656            16
16657        }
16658    }
16659
16660    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FormatDetails, D>
16661        for &FormatDetails
16662    {
16663        unsafe fn encode(
16664            self,
16665            encoder: &mut fidl::encoding::Encoder<'_, D>,
16666            offset: usize,
16667            mut depth: fidl::encoding::Depth,
16668        ) -> fidl::Result<()> {
16669            encoder.debug_check_bounds::<FormatDetails>(offset);
16670            // Vector header
16671            let max_ordinal: u64 = self.max_ordinal_present();
16672            encoder.write_num(max_ordinal, offset);
16673            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
16674            // Calling encoder.out_of_line_offset(0) is not allowed.
16675            if max_ordinal == 0 {
16676                return Ok(());
16677            }
16678            depth.increment()?;
16679            let envelope_size = 8;
16680            let bytes_len = max_ordinal as usize * envelope_size;
16681            #[allow(unused_variables)]
16682            let offset = encoder.out_of_line_offset(bytes_len);
16683            let mut _prev_end_offset: usize = 0;
16684            if 1 > max_ordinal {
16685                return Ok(());
16686            }
16687
16688            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16689            // are envelope_size bytes.
16690            let cur_offset: usize = (1 - 1) * envelope_size;
16691
16692            // Zero reserved fields.
16693            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16694
16695            // Safety:
16696            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16697            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16698            //   envelope_size bytes, there is always sufficient room.
16699            fidl::encoding::encode_in_envelope_optional::<u64, D>(
16700                self.format_details_version_ordinal
16701                    .as_ref()
16702                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
16703                encoder,
16704                offset + cur_offset,
16705                depth,
16706            )?;
16707
16708            _prev_end_offset = cur_offset + envelope_size;
16709            if 2 > max_ordinal {
16710                return Ok(());
16711            }
16712
16713            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16714            // are envelope_size bytes.
16715            let cur_offset: usize = (2 - 1) * envelope_size;
16716
16717            // Zero reserved fields.
16718            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16719
16720            // Safety:
16721            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16722            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16723            //   envelope_size bytes, there is always sufficient room.
16724            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedString, D>(
16725                self.mime_type.as_ref().map(
16726                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
16727                ),
16728                encoder,
16729                offset + cur_offset,
16730                depth,
16731            )?;
16732
16733            _prev_end_offset = cur_offset + envelope_size;
16734            if 3 > max_ordinal {
16735                return Ok(());
16736            }
16737
16738            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16739            // are envelope_size bytes.
16740            let cur_offset: usize = (3 - 1) * envelope_size;
16741
16742            // Zero reserved fields.
16743            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16744
16745            // Safety:
16746            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16747            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16748            //   envelope_size bytes, there is always sufficient room.
16749            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<u8>, D>(
16750            self.oob_bytes.as_ref().map(<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow),
16751            encoder, offset + cur_offset, depth
16752        )?;
16753
16754            _prev_end_offset = cur_offset + envelope_size;
16755            if 4 > max_ordinal {
16756                return Ok(());
16757            }
16758
16759            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16760            // are envelope_size bytes.
16761            let cur_offset: usize = (4 - 1) * envelope_size;
16762
16763            // Zero reserved fields.
16764            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16765
16766            // Safety:
16767            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16768            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16769            //   envelope_size bytes, there is always sufficient room.
16770            fidl::encoding::encode_in_envelope_optional::<DomainFormat, D>(
16771                self.domain.as_ref().map(<DomainFormat as fidl::encoding::ValueTypeMarker>::borrow),
16772                encoder,
16773                offset + cur_offset,
16774                depth,
16775            )?;
16776
16777            _prev_end_offset = cur_offset + envelope_size;
16778            if 5 > max_ordinal {
16779                return Ok(());
16780            }
16781
16782            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16783            // are envelope_size bytes.
16784            let cur_offset: usize = (5 - 1) * envelope_size;
16785
16786            // Zero reserved fields.
16787            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16788
16789            // Safety:
16790            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16791            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16792            //   envelope_size bytes, there is always sufficient room.
16793            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<Parameter>, D>(
16794            self.pass_through_parameters.as_ref().map(<fidl::encoding::UnboundedVector<Parameter> as fidl::encoding::ValueTypeMarker>::borrow),
16795            encoder, offset + cur_offset, depth
16796        )?;
16797
16798            _prev_end_offset = cur_offset + envelope_size;
16799            if 6 > max_ordinal {
16800                return Ok(());
16801            }
16802
16803            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16804            // are envelope_size bytes.
16805            let cur_offset: usize = (6 - 1) * envelope_size;
16806
16807            // Zero reserved fields.
16808            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16809
16810            // Safety:
16811            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16812            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16813            //   envelope_size bytes, there is always sufficient room.
16814            fidl::encoding::encode_in_envelope_optional::<EncoderSettings, D>(
16815                self.encoder_settings
16816                    .as_ref()
16817                    .map(<EncoderSettings as fidl::encoding::ValueTypeMarker>::borrow),
16818                encoder,
16819                offset + cur_offset,
16820                depth,
16821            )?;
16822
16823            _prev_end_offset = cur_offset + envelope_size;
16824            if 7 > max_ordinal {
16825                return Ok(());
16826            }
16827
16828            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16829            // are envelope_size bytes.
16830            let cur_offset: usize = (7 - 1) * envelope_size;
16831
16832            // Zero reserved fields.
16833            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16834
16835            // Safety:
16836            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16837            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16838            //   envelope_size bytes, there is always sufficient room.
16839            fidl::encoding::encode_in_envelope_optional::<u64, D>(
16840                self.timebase.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
16841                encoder,
16842                offset + cur_offset,
16843                depth,
16844            )?;
16845
16846            _prev_end_offset = cur_offset + envelope_size;
16847            if 8 > max_ordinal {
16848                return Ok(());
16849            }
16850
16851            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16852            // are envelope_size bytes.
16853            let cur_offset: usize = (8 - 1) * envelope_size;
16854
16855            // Zero reserved fields.
16856            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16857
16858            // Safety:
16859            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16860            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16861            //   envelope_size bytes, there is always sufficient room.
16862            fidl::encoding::encode_in_envelope_optional::<CodecProfile, D>(
16863                self.profile
16864                    .as_ref()
16865                    .map(<CodecProfile as fidl::encoding::ValueTypeMarker>::borrow),
16866                encoder,
16867                offset + cur_offset,
16868                depth,
16869            )?;
16870
16871            _prev_end_offset = cur_offset + envelope_size;
16872
16873            Ok(())
16874        }
16875    }
16876
16877    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FormatDetails {
16878        #[inline(always)]
16879        fn new_empty() -> Self {
16880            Self::default()
16881        }
16882
16883        unsafe fn decode(
16884            &mut self,
16885            decoder: &mut fidl::encoding::Decoder<'_, D>,
16886            offset: usize,
16887            mut depth: fidl::encoding::Depth,
16888        ) -> fidl::Result<()> {
16889            decoder.debug_check_bounds::<Self>(offset);
16890            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
16891                None => return Err(fidl::Error::NotNullable),
16892                Some(len) => len,
16893            };
16894            // Calling decoder.out_of_line_offset(0) is not allowed.
16895            if len == 0 {
16896                return Ok(());
16897            };
16898            depth.increment()?;
16899            let envelope_size = 8;
16900            let bytes_len = len * envelope_size;
16901            let offset = decoder.out_of_line_offset(bytes_len)?;
16902            // Decode the envelope for each type.
16903            let mut _next_ordinal_to_read = 0;
16904            let mut next_offset = offset;
16905            let end_offset = offset + bytes_len;
16906            _next_ordinal_to_read += 1;
16907            if next_offset >= end_offset {
16908                return Ok(());
16909            }
16910
16911            // Decode unknown envelopes for gaps in ordinals.
16912            while _next_ordinal_to_read < 1 {
16913                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16914                _next_ordinal_to_read += 1;
16915                next_offset += envelope_size;
16916            }
16917
16918            let next_out_of_line = decoder.next_out_of_line();
16919            let handles_before = decoder.remaining_handles();
16920            if let Some((inlined, num_bytes, num_handles)) =
16921                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16922            {
16923                let member_inline_size =
16924                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16925                if inlined != (member_inline_size <= 4) {
16926                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16927                }
16928                let inner_offset;
16929                let mut inner_depth = depth.clone();
16930                if inlined {
16931                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16932                    inner_offset = next_offset;
16933                } else {
16934                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16935                    inner_depth.increment()?;
16936                }
16937                let val_ref = self
16938                    .format_details_version_ordinal
16939                    .get_or_insert_with(|| fidl::new_empty!(u64, D));
16940                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
16941                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16942                {
16943                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16944                }
16945                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16946                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16947                }
16948            }
16949
16950            next_offset += envelope_size;
16951            _next_ordinal_to_read += 1;
16952            if next_offset >= end_offset {
16953                return Ok(());
16954            }
16955
16956            // Decode unknown envelopes for gaps in ordinals.
16957            while _next_ordinal_to_read < 2 {
16958                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16959                _next_ordinal_to_read += 1;
16960                next_offset += envelope_size;
16961            }
16962
16963            let next_out_of_line = decoder.next_out_of_line();
16964            let handles_before = decoder.remaining_handles();
16965            if let Some((inlined, num_bytes, num_handles)) =
16966                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16967            {
16968                let member_inline_size =
16969                    <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
16970                        decoder.context,
16971                    );
16972                if inlined != (member_inline_size <= 4) {
16973                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16974                }
16975                let inner_offset;
16976                let mut inner_depth = depth.clone();
16977                if inlined {
16978                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16979                    inner_offset = next_offset;
16980                } else {
16981                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16982                    inner_depth.increment()?;
16983                }
16984                let val_ref = self
16985                    .mime_type
16986                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::UnboundedString, D));
16987                fidl::decode!(
16988                    fidl::encoding::UnboundedString,
16989                    D,
16990                    val_ref,
16991                    decoder,
16992                    inner_offset,
16993                    inner_depth
16994                )?;
16995                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16996                {
16997                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16998                }
16999                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17000                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17001                }
17002            }
17003
17004            next_offset += envelope_size;
17005            _next_ordinal_to_read += 1;
17006            if next_offset >= end_offset {
17007                return Ok(());
17008            }
17009
17010            // Decode unknown envelopes for gaps in ordinals.
17011            while _next_ordinal_to_read < 3 {
17012                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17013                _next_ordinal_to_read += 1;
17014                next_offset += envelope_size;
17015            }
17016
17017            let next_out_of_line = decoder.next_out_of_line();
17018            let handles_before = decoder.remaining_handles();
17019            if let Some((inlined, num_bytes, num_handles)) =
17020                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17021            {
17022                let member_inline_size = <fidl::encoding::UnboundedVector<u8> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17023                if inlined != (member_inline_size <= 4) {
17024                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17025                }
17026                let inner_offset;
17027                let mut inner_depth = depth.clone();
17028                if inlined {
17029                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17030                    inner_offset = next_offset;
17031                } else {
17032                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17033                    inner_depth.increment()?;
17034                }
17035                let val_ref = self.oob_bytes.get_or_insert_with(|| {
17036                    fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D)
17037                });
17038                fidl::decode!(
17039                    fidl::encoding::UnboundedVector<u8>,
17040                    D,
17041                    val_ref,
17042                    decoder,
17043                    inner_offset,
17044                    inner_depth
17045                )?;
17046                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17047                {
17048                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17049                }
17050                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17051                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17052                }
17053            }
17054
17055            next_offset += envelope_size;
17056            _next_ordinal_to_read += 1;
17057            if next_offset >= end_offset {
17058                return Ok(());
17059            }
17060
17061            // Decode unknown envelopes for gaps in ordinals.
17062            while _next_ordinal_to_read < 4 {
17063                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17064                _next_ordinal_to_read += 1;
17065                next_offset += envelope_size;
17066            }
17067
17068            let next_out_of_line = decoder.next_out_of_line();
17069            let handles_before = decoder.remaining_handles();
17070            if let Some((inlined, num_bytes, num_handles)) =
17071                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17072            {
17073                let member_inline_size =
17074                    <DomainFormat as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17075                if inlined != (member_inline_size <= 4) {
17076                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17077                }
17078                let inner_offset;
17079                let mut inner_depth = depth.clone();
17080                if inlined {
17081                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17082                    inner_offset = next_offset;
17083                } else {
17084                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17085                    inner_depth.increment()?;
17086                }
17087                let val_ref = self.domain.get_or_insert_with(|| fidl::new_empty!(DomainFormat, D));
17088                fidl::decode!(DomainFormat, D, val_ref, decoder, inner_offset, inner_depth)?;
17089                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17090                {
17091                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17092                }
17093                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17094                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17095                }
17096            }
17097
17098            next_offset += envelope_size;
17099            _next_ordinal_to_read += 1;
17100            if next_offset >= end_offset {
17101                return Ok(());
17102            }
17103
17104            // Decode unknown envelopes for gaps in ordinals.
17105            while _next_ordinal_to_read < 5 {
17106                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17107                _next_ordinal_to_read += 1;
17108                next_offset += envelope_size;
17109            }
17110
17111            let next_out_of_line = decoder.next_out_of_line();
17112            let handles_before = decoder.remaining_handles();
17113            if let Some((inlined, num_bytes, num_handles)) =
17114                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17115            {
17116                let member_inline_size = <fidl::encoding::UnboundedVector<Parameter> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17117                if inlined != (member_inline_size <= 4) {
17118                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17119                }
17120                let inner_offset;
17121                let mut inner_depth = depth.clone();
17122                if inlined {
17123                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17124                    inner_offset = next_offset;
17125                } else {
17126                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17127                    inner_depth.increment()?;
17128                }
17129                let val_ref = self.pass_through_parameters.get_or_insert_with(|| {
17130                    fidl::new_empty!(fidl::encoding::UnboundedVector<Parameter>, D)
17131                });
17132                fidl::decode!(
17133                    fidl::encoding::UnboundedVector<Parameter>,
17134                    D,
17135                    val_ref,
17136                    decoder,
17137                    inner_offset,
17138                    inner_depth
17139                )?;
17140                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17141                {
17142                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17143                }
17144                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17145                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17146                }
17147            }
17148
17149            next_offset += envelope_size;
17150            _next_ordinal_to_read += 1;
17151            if next_offset >= end_offset {
17152                return Ok(());
17153            }
17154
17155            // Decode unknown envelopes for gaps in ordinals.
17156            while _next_ordinal_to_read < 6 {
17157                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17158                _next_ordinal_to_read += 1;
17159                next_offset += envelope_size;
17160            }
17161
17162            let next_out_of_line = decoder.next_out_of_line();
17163            let handles_before = decoder.remaining_handles();
17164            if let Some((inlined, num_bytes, num_handles)) =
17165                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17166            {
17167                let member_inline_size =
17168                    <EncoderSettings as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17169                if inlined != (member_inline_size <= 4) {
17170                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17171                }
17172                let inner_offset;
17173                let mut inner_depth = depth.clone();
17174                if inlined {
17175                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17176                    inner_offset = next_offset;
17177                } else {
17178                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17179                    inner_depth.increment()?;
17180                }
17181                let val_ref = self
17182                    .encoder_settings
17183                    .get_or_insert_with(|| fidl::new_empty!(EncoderSettings, D));
17184                fidl::decode!(EncoderSettings, D, val_ref, decoder, inner_offset, inner_depth)?;
17185                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17186                {
17187                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17188                }
17189                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17190                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17191                }
17192            }
17193
17194            next_offset += envelope_size;
17195            _next_ordinal_to_read += 1;
17196            if next_offset >= end_offset {
17197                return Ok(());
17198            }
17199
17200            // Decode unknown envelopes for gaps in ordinals.
17201            while _next_ordinal_to_read < 7 {
17202                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17203                _next_ordinal_to_read += 1;
17204                next_offset += envelope_size;
17205            }
17206
17207            let next_out_of_line = decoder.next_out_of_line();
17208            let handles_before = decoder.remaining_handles();
17209            if let Some((inlined, num_bytes, num_handles)) =
17210                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17211            {
17212                let member_inline_size =
17213                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17214                if inlined != (member_inline_size <= 4) {
17215                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17216                }
17217                let inner_offset;
17218                let mut inner_depth = depth.clone();
17219                if inlined {
17220                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17221                    inner_offset = next_offset;
17222                } else {
17223                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17224                    inner_depth.increment()?;
17225                }
17226                let val_ref = self.timebase.get_or_insert_with(|| fidl::new_empty!(u64, D));
17227                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
17228                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17229                {
17230                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17231                }
17232                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17233                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17234                }
17235            }
17236
17237            next_offset += envelope_size;
17238            _next_ordinal_to_read += 1;
17239            if next_offset >= end_offset {
17240                return Ok(());
17241            }
17242
17243            // Decode unknown envelopes for gaps in ordinals.
17244            while _next_ordinal_to_read < 8 {
17245                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17246                _next_ordinal_to_read += 1;
17247                next_offset += envelope_size;
17248            }
17249
17250            let next_out_of_line = decoder.next_out_of_line();
17251            let handles_before = decoder.remaining_handles();
17252            if let Some((inlined, num_bytes, num_handles)) =
17253                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17254            {
17255                let member_inline_size =
17256                    <CodecProfile as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17257                if inlined != (member_inline_size <= 4) {
17258                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17259                }
17260                let inner_offset;
17261                let mut inner_depth = depth.clone();
17262                if inlined {
17263                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17264                    inner_offset = next_offset;
17265                } else {
17266                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17267                    inner_depth.increment()?;
17268                }
17269                let val_ref = self.profile.get_or_insert_with(|| fidl::new_empty!(CodecProfile, D));
17270                fidl::decode!(CodecProfile, D, val_ref, decoder, inner_offset, inner_depth)?;
17271                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17272                {
17273                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17274                }
17275                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17276                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17277                }
17278            }
17279
17280            next_offset += envelope_size;
17281
17282            // Decode the remaining unknown envelopes.
17283            while next_offset < end_offset {
17284                _next_ordinal_to_read += 1;
17285                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17286                next_offset += envelope_size;
17287            }
17288
17289            Ok(())
17290        }
17291    }
17292
17293    impl H264EncoderSettings {
17294        #[inline(always)]
17295        fn max_ordinal_present(&self) -> u64 {
17296            if let Some(_) = self.quantization_params {
17297                return 7;
17298            }
17299            if let Some(_) = self.force_key_frame {
17300                return 6;
17301            }
17302            if let Some(_) = self.min_frame_rate {
17303                return 5;
17304            }
17305            if let Some(_) = self.variable_frame_rate {
17306                return 4;
17307            }
17308            if let Some(_) = self.gop_size {
17309                return 3;
17310            }
17311            if let Some(_) = self.frame_rate {
17312                return 2;
17313            }
17314            if let Some(_) = self.bit_rate {
17315                return 1;
17316            }
17317            0
17318        }
17319    }
17320
17321    impl fidl::encoding::ValueTypeMarker for H264EncoderSettings {
17322        type Borrowed<'a> = &'a Self;
17323        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
17324            value
17325        }
17326    }
17327
17328    unsafe impl fidl::encoding::TypeMarker for H264EncoderSettings {
17329        type Owned = Self;
17330
17331        #[inline(always)]
17332        fn inline_align(_context: fidl::encoding::Context) -> usize {
17333            8
17334        }
17335
17336        #[inline(always)]
17337        fn inline_size(_context: fidl::encoding::Context) -> usize {
17338            16
17339        }
17340    }
17341
17342    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<H264EncoderSettings, D>
17343        for &H264EncoderSettings
17344    {
17345        unsafe fn encode(
17346            self,
17347            encoder: &mut fidl::encoding::Encoder<'_, D>,
17348            offset: usize,
17349            mut depth: fidl::encoding::Depth,
17350        ) -> fidl::Result<()> {
17351            encoder.debug_check_bounds::<H264EncoderSettings>(offset);
17352            // Vector header
17353            let max_ordinal: u64 = self.max_ordinal_present();
17354            encoder.write_num(max_ordinal, offset);
17355            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
17356            // Calling encoder.out_of_line_offset(0) is not allowed.
17357            if max_ordinal == 0 {
17358                return Ok(());
17359            }
17360            depth.increment()?;
17361            let envelope_size = 8;
17362            let bytes_len = max_ordinal as usize * envelope_size;
17363            #[allow(unused_variables)]
17364            let offset = encoder.out_of_line_offset(bytes_len);
17365            let mut _prev_end_offset: usize = 0;
17366            if 1 > max_ordinal {
17367                return Ok(());
17368            }
17369
17370            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17371            // are envelope_size bytes.
17372            let cur_offset: usize = (1 - 1) * envelope_size;
17373
17374            // Zero reserved fields.
17375            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17376
17377            // Safety:
17378            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17379            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17380            //   envelope_size bytes, there is always sufficient room.
17381            fidl::encoding::encode_in_envelope_optional::<u32, D>(
17382                self.bit_rate.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
17383                encoder,
17384                offset + cur_offset,
17385                depth,
17386            )?;
17387
17388            _prev_end_offset = cur_offset + envelope_size;
17389            if 2 > max_ordinal {
17390                return Ok(());
17391            }
17392
17393            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17394            // are envelope_size bytes.
17395            let cur_offset: usize = (2 - 1) * envelope_size;
17396
17397            // Zero reserved fields.
17398            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17399
17400            // Safety:
17401            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17402            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17403            //   envelope_size bytes, there is always sufficient room.
17404            fidl::encoding::encode_in_envelope_optional::<u32, D>(
17405                self.frame_rate.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
17406                encoder,
17407                offset + cur_offset,
17408                depth,
17409            )?;
17410
17411            _prev_end_offset = cur_offset + envelope_size;
17412            if 3 > max_ordinal {
17413                return Ok(());
17414            }
17415
17416            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17417            // are envelope_size bytes.
17418            let cur_offset: usize = (3 - 1) * envelope_size;
17419
17420            // Zero reserved fields.
17421            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17422
17423            // Safety:
17424            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17425            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17426            //   envelope_size bytes, there is always sufficient room.
17427            fidl::encoding::encode_in_envelope_optional::<u32, D>(
17428                self.gop_size.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
17429                encoder,
17430                offset + cur_offset,
17431                depth,
17432            )?;
17433
17434            _prev_end_offset = cur_offset + envelope_size;
17435            if 4 > max_ordinal {
17436                return Ok(());
17437            }
17438
17439            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17440            // are envelope_size bytes.
17441            let cur_offset: usize = (4 - 1) * envelope_size;
17442
17443            // Zero reserved fields.
17444            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17445
17446            // Safety:
17447            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17448            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17449            //   envelope_size bytes, there is always sufficient room.
17450            fidl::encoding::encode_in_envelope_optional::<bool, D>(
17451                self.variable_frame_rate
17452                    .as_ref()
17453                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
17454                encoder,
17455                offset + cur_offset,
17456                depth,
17457            )?;
17458
17459            _prev_end_offset = cur_offset + envelope_size;
17460            if 5 > max_ordinal {
17461                return Ok(());
17462            }
17463
17464            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17465            // are envelope_size bytes.
17466            let cur_offset: usize = (5 - 1) * envelope_size;
17467
17468            // Zero reserved fields.
17469            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17470
17471            // Safety:
17472            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17473            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17474            //   envelope_size bytes, there is always sufficient room.
17475            fidl::encoding::encode_in_envelope_optional::<u32, D>(
17476                self.min_frame_rate.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
17477                encoder,
17478                offset + cur_offset,
17479                depth,
17480            )?;
17481
17482            _prev_end_offset = cur_offset + envelope_size;
17483            if 6 > max_ordinal {
17484                return Ok(());
17485            }
17486
17487            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17488            // are envelope_size bytes.
17489            let cur_offset: usize = (6 - 1) * envelope_size;
17490
17491            // Zero reserved fields.
17492            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17493
17494            // Safety:
17495            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17496            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17497            //   envelope_size bytes, there is always sufficient room.
17498            fidl::encoding::encode_in_envelope_optional::<bool, D>(
17499                self.force_key_frame
17500                    .as_ref()
17501                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
17502                encoder,
17503                offset + cur_offset,
17504                depth,
17505            )?;
17506
17507            _prev_end_offset = cur_offset + envelope_size;
17508            if 7 > max_ordinal {
17509                return Ok(());
17510            }
17511
17512            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17513            // are envelope_size bytes.
17514            let cur_offset: usize = (7 - 1) * envelope_size;
17515
17516            // Zero reserved fields.
17517            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17518
17519            // Safety:
17520            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17521            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17522            //   envelope_size bytes, there is always sufficient room.
17523            fidl::encoding::encode_in_envelope_optional::<H264QuantizationParameters, D>(
17524                self.quantization_params
17525                    .as_ref()
17526                    .map(<H264QuantizationParameters as fidl::encoding::ValueTypeMarker>::borrow),
17527                encoder,
17528                offset + cur_offset,
17529                depth,
17530            )?;
17531
17532            _prev_end_offset = cur_offset + envelope_size;
17533
17534            Ok(())
17535        }
17536    }
17537
17538    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for H264EncoderSettings {
17539        #[inline(always)]
17540        fn new_empty() -> Self {
17541            Self::default()
17542        }
17543
17544        unsafe fn decode(
17545            &mut self,
17546            decoder: &mut fidl::encoding::Decoder<'_, D>,
17547            offset: usize,
17548            mut depth: fidl::encoding::Depth,
17549        ) -> fidl::Result<()> {
17550            decoder.debug_check_bounds::<Self>(offset);
17551            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
17552                None => return Err(fidl::Error::NotNullable),
17553                Some(len) => len,
17554            };
17555            // Calling decoder.out_of_line_offset(0) is not allowed.
17556            if len == 0 {
17557                return Ok(());
17558            };
17559            depth.increment()?;
17560            let envelope_size = 8;
17561            let bytes_len = len * envelope_size;
17562            let offset = decoder.out_of_line_offset(bytes_len)?;
17563            // Decode the envelope for each type.
17564            let mut _next_ordinal_to_read = 0;
17565            let mut next_offset = offset;
17566            let end_offset = offset + bytes_len;
17567            _next_ordinal_to_read += 1;
17568            if next_offset >= end_offset {
17569                return Ok(());
17570            }
17571
17572            // Decode unknown envelopes for gaps in ordinals.
17573            while _next_ordinal_to_read < 1 {
17574                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17575                _next_ordinal_to_read += 1;
17576                next_offset += envelope_size;
17577            }
17578
17579            let next_out_of_line = decoder.next_out_of_line();
17580            let handles_before = decoder.remaining_handles();
17581            if let Some((inlined, num_bytes, num_handles)) =
17582                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17583            {
17584                let member_inline_size =
17585                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17586                if inlined != (member_inline_size <= 4) {
17587                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17588                }
17589                let inner_offset;
17590                let mut inner_depth = depth.clone();
17591                if inlined {
17592                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17593                    inner_offset = next_offset;
17594                } else {
17595                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17596                    inner_depth.increment()?;
17597                }
17598                let val_ref = self.bit_rate.get_or_insert_with(|| fidl::new_empty!(u32, D));
17599                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
17600                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17601                {
17602                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17603                }
17604                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17605                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17606                }
17607            }
17608
17609            next_offset += envelope_size;
17610            _next_ordinal_to_read += 1;
17611            if next_offset >= end_offset {
17612                return Ok(());
17613            }
17614
17615            // Decode unknown envelopes for gaps in ordinals.
17616            while _next_ordinal_to_read < 2 {
17617                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17618                _next_ordinal_to_read += 1;
17619                next_offset += envelope_size;
17620            }
17621
17622            let next_out_of_line = decoder.next_out_of_line();
17623            let handles_before = decoder.remaining_handles();
17624            if let Some((inlined, num_bytes, num_handles)) =
17625                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17626            {
17627                let member_inline_size =
17628                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17629                if inlined != (member_inline_size <= 4) {
17630                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17631                }
17632                let inner_offset;
17633                let mut inner_depth = depth.clone();
17634                if inlined {
17635                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17636                    inner_offset = next_offset;
17637                } else {
17638                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17639                    inner_depth.increment()?;
17640                }
17641                let val_ref = self.frame_rate.get_or_insert_with(|| fidl::new_empty!(u32, D));
17642                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
17643                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17644                {
17645                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17646                }
17647                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17648                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17649                }
17650            }
17651
17652            next_offset += envelope_size;
17653            _next_ordinal_to_read += 1;
17654            if next_offset >= end_offset {
17655                return Ok(());
17656            }
17657
17658            // Decode unknown envelopes for gaps in ordinals.
17659            while _next_ordinal_to_read < 3 {
17660                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17661                _next_ordinal_to_read += 1;
17662                next_offset += envelope_size;
17663            }
17664
17665            let next_out_of_line = decoder.next_out_of_line();
17666            let handles_before = decoder.remaining_handles();
17667            if let Some((inlined, num_bytes, num_handles)) =
17668                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17669            {
17670                let member_inline_size =
17671                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17672                if inlined != (member_inline_size <= 4) {
17673                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17674                }
17675                let inner_offset;
17676                let mut inner_depth = depth.clone();
17677                if inlined {
17678                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17679                    inner_offset = next_offset;
17680                } else {
17681                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17682                    inner_depth.increment()?;
17683                }
17684                let val_ref = self.gop_size.get_or_insert_with(|| fidl::new_empty!(u32, D));
17685                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
17686                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17687                {
17688                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17689                }
17690                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17691                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17692                }
17693            }
17694
17695            next_offset += envelope_size;
17696            _next_ordinal_to_read += 1;
17697            if next_offset >= end_offset {
17698                return Ok(());
17699            }
17700
17701            // Decode unknown envelopes for gaps in ordinals.
17702            while _next_ordinal_to_read < 4 {
17703                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17704                _next_ordinal_to_read += 1;
17705                next_offset += envelope_size;
17706            }
17707
17708            let next_out_of_line = decoder.next_out_of_line();
17709            let handles_before = decoder.remaining_handles();
17710            if let Some((inlined, num_bytes, num_handles)) =
17711                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17712            {
17713                let member_inline_size =
17714                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17715                if inlined != (member_inline_size <= 4) {
17716                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17717                }
17718                let inner_offset;
17719                let mut inner_depth = depth.clone();
17720                if inlined {
17721                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17722                    inner_offset = next_offset;
17723                } else {
17724                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17725                    inner_depth.increment()?;
17726                }
17727                let val_ref =
17728                    self.variable_frame_rate.get_or_insert_with(|| fidl::new_empty!(bool, D));
17729                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
17730                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17731                {
17732                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17733                }
17734                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17735                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17736                }
17737            }
17738
17739            next_offset += envelope_size;
17740            _next_ordinal_to_read += 1;
17741            if next_offset >= end_offset {
17742                return Ok(());
17743            }
17744
17745            // Decode unknown envelopes for gaps in ordinals.
17746            while _next_ordinal_to_read < 5 {
17747                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17748                _next_ordinal_to_read += 1;
17749                next_offset += envelope_size;
17750            }
17751
17752            let next_out_of_line = decoder.next_out_of_line();
17753            let handles_before = decoder.remaining_handles();
17754            if let Some((inlined, num_bytes, num_handles)) =
17755                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17756            {
17757                let member_inline_size =
17758                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17759                if inlined != (member_inline_size <= 4) {
17760                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17761                }
17762                let inner_offset;
17763                let mut inner_depth = depth.clone();
17764                if inlined {
17765                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17766                    inner_offset = next_offset;
17767                } else {
17768                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17769                    inner_depth.increment()?;
17770                }
17771                let val_ref = self.min_frame_rate.get_or_insert_with(|| fidl::new_empty!(u32, D));
17772                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
17773                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17774                {
17775                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17776                }
17777                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17778                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17779                }
17780            }
17781
17782            next_offset += envelope_size;
17783            _next_ordinal_to_read += 1;
17784            if next_offset >= end_offset {
17785                return Ok(());
17786            }
17787
17788            // Decode unknown envelopes for gaps in ordinals.
17789            while _next_ordinal_to_read < 6 {
17790                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17791                _next_ordinal_to_read += 1;
17792                next_offset += envelope_size;
17793            }
17794
17795            let next_out_of_line = decoder.next_out_of_line();
17796            let handles_before = decoder.remaining_handles();
17797            if let Some((inlined, num_bytes, num_handles)) =
17798                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17799            {
17800                let member_inline_size =
17801                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17802                if inlined != (member_inline_size <= 4) {
17803                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17804                }
17805                let inner_offset;
17806                let mut inner_depth = depth.clone();
17807                if inlined {
17808                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17809                    inner_offset = next_offset;
17810                } else {
17811                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17812                    inner_depth.increment()?;
17813                }
17814                let val_ref = self.force_key_frame.get_or_insert_with(|| fidl::new_empty!(bool, D));
17815                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
17816                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17817                {
17818                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17819                }
17820                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17821                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17822                }
17823            }
17824
17825            next_offset += envelope_size;
17826            _next_ordinal_to_read += 1;
17827            if next_offset >= end_offset {
17828                return Ok(());
17829            }
17830
17831            // Decode unknown envelopes for gaps in ordinals.
17832            while _next_ordinal_to_read < 7 {
17833                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17834                _next_ordinal_to_read += 1;
17835                next_offset += envelope_size;
17836            }
17837
17838            let next_out_of_line = decoder.next_out_of_line();
17839            let handles_before = decoder.remaining_handles();
17840            if let Some((inlined, num_bytes, num_handles)) =
17841                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17842            {
17843                let member_inline_size =
17844                    <H264QuantizationParameters as fidl::encoding::TypeMarker>::inline_size(
17845                        decoder.context,
17846                    );
17847                if inlined != (member_inline_size <= 4) {
17848                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17849                }
17850                let inner_offset;
17851                let mut inner_depth = depth.clone();
17852                if inlined {
17853                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17854                    inner_offset = next_offset;
17855                } else {
17856                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17857                    inner_depth.increment()?;
17858                }
17859                let val_ref = self
17860                    .quantization_params
17861                    .get_or_insert_with(|| fidl::new_empty!(H264QuantizationParameters, D));
17862                fidl::decode!(
17863                    H264QuantizationParameters,
17864                    D,
17865                    val_ref,
17866                    decoder,
17867                    inner_offset,
17868                    inner_depth
17869                )?;
17870                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17871                {
17872                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17873                }
17874                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17875                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17876                }
17877            }
17878
17879            next_offset += envelope_size;
17880
17881            // Decode the remaining unknown envelopes.
17882            while next_offset < end_offset {
17883                _next_ordinal_to_read += 1;
17884                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17885                next_offset += envelope_size;
17886            }
17887
17888            Ok(())
17889        }
17890    }
17891
17892    impl H264QuantizationParameters {
17893        #[inline(always)]
17894        fn max_ordinal_present(&self) -> u64 {
17895            if let Some(_) = self.p_max {
17896                return 6;
17897            }
17898            if let Some(_) = self.p_min {
17899                return 5;
17900            }
17901            if let Some(_) = self.p_base {
17902                return 4;
17903            }
17904            if let Some(_) = self.i_max {
17905                return 3;
17906            }
17907            if let Some(_) = self.i_min {
17908                return 2;
17909            }
17910            if let Some(_) = self.i_base {
17911                return 1;
17912            }
17913            0
17914        }
17915    }
17916
17917    impl fidl::encoding::ValueTypeMarker for H264QuantizationParameters {
17918        type Borrowed<'a> = &'a Self;
17919        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
17920            value
17921        }
17922    }
17923
17924    unsafe impl fidl::encoding::TypeMarker for H264QuantizationParameters {
17925        type Owned = Self;
17926
17927        #[inline(always)]
17928        fn inline_align(_context: fidl::encoding::Context) -> usize {
17929            8
17930        }
17931
17932        #[inline(always)]
17933        fn inline_size(_context: fidl::encoding::Context) -> usize {
17934            16
17935        }
17936    }
17937
17938    unsafe impl<D: fidl::encoding::ResourceDialect>
17939        fidl::encoding::Encode<H264QuantizationParameters, D> for &H264QuantizationParameters
17940    {
17941        unsafe fn encode(
17942            self,
17943            encoder: &mut fidl::encoding::Encoder<'_, D>,
17944            offset: usize,
17945            mut depth: fidl::encoding::Depth,
17946        ) -> fidl::Result<()> {
17947            encoder.debug_check_bounds::<H264QuantizationParameters>(offset);
17948            // Vector header
17949            let max_ordinal: u64 = self.max_ordinal_present();
17950            encoder.write_num(max_ordinal, offset);
17951            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
17952            // Calling encoder.out_of_line_offset(0) is not allowed.
17953            if max_ordinal == 0 {
17954                return Ok(());
17955            }
17956            depth.increment()?;
17957            let envelope_size = 8;
17958            let bytes_len = max_ordinal as usize * envelope_size;
17959            #[allow(unused_variables)]
17960            let offset = encoder.out_of_line_offset(bytes_len);
17961            let mut _prev_end_offset: usize = 0;
17962            if 1 > max_ordinal {
17963                return Ok(());
17964            }
17965
17966            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17967            // are envelope_size bytes.
17968            let cur_offset: usize = (1 - 1) * envelope_size;
17969
17970            // Zero reserved fields.
17971            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17972
17973            // Safety:
17974            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17975            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17976            //   envelope_size bytes, there is always sufficient room.
17977            fidl::encoding::encode_in_envelope_optional::<u32, D>(
17978                self.i_base.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
17979                encoder,
17980                offset + cur_offset,
17981                depth,
17982            )?;
17983
17984            _prev_end_offset = cur_offset + envelope_size;
17985            if 2 > max_ordinal {
17986                return Ok(());
17987            }
17988
17989            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17990            // are envelope_size bytes.
17991            let cur_offset: usize = (2 - 1) * envelope_size;
17992
17993            // Zero reserved fields.
17994            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17995
17996            // Safety:
17997            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17998            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17999            //   envelope_size bytes, there is always sufficient room.
18000            fidl::encoding::encode_in_envelope_optional::<u32, D>(
18001                self.i_min.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
18002                encoder,
18003                offset + cur_offset,
18004                depth,
18005            )?;
18006
18007            _prev_end_offset = cur_offset + envelope_size;
18008            if 3 > max_ordinal {
18009                return Ok(());
18010            }
18011
18012            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18013            // are envelope_size bytes.
18014            let cur_offset: usize = (3 - 1) * envelope_size;
18015
18016            // Zero reserved fields.
18017            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18018
18019            // Safety:
18020            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18021            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18022            //   envelope_size bytes, there is always sufficient room.
18023            fidl::encoding::encode_in_envelope_optional::<u32, D>(
18024                self.i_max.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
18025                encoder,
18026                offset + cur_offset,
18027                depth,
18028            )?;
18029
18030            _prev_end_offset = cur_offset + envelope_size;
18031            if 4 > max_ordinal {
18032                return Ok(());
18033            }
18034
18035            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18036            // are envelope_size bytes.
18037            let cur_offset: usize = (4 - 1) * envelope_size;
18038
18039            // Zero reserved fields.
18040            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18041
18042            // Safety:
18043            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18044            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18045            //   envelope_size bytes, there is always sufficient room.
18046            fidl::encoding::encode_in_envelope_optional::<u32, D>(
18047                self.p_base.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
18048                encoder,
18049                offset + cur_offset,
18050                depth,
18051            )?;
18052
18053            _prev_end_offset = cur_offset + envelope_size;
18054            if 5 > max_ordinal {
18055                return Ok(());
18056            }
18057
18058            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18059            // are envelope_size bytes.
18060            let cur_offset: usize = (5 - 1) * envelope_size;
18061
18062            // Zero reserved fields.
18063            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18064
18065            // Safety:
18066            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18067            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18068            //   envelope_size bytes, there is always sufficient room.
18069            fidl::encoding::encode_in_envelope_optional::<u32, D>(
18070                self.p_min.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
18071                encoder,
18072                offset + cur_offset,
18073                depth,
18074            )?;
18075
18076            _prev_end_offset = cur_offset + envelope_size;
18077            if 6 > max_ordinal {
18078                return Ok(());
18079            }
18080
18081            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18082            // are envelope_size bytes.
18083            let cur_offset: usize = (6 - 1) * envelope_size;
18084
18085            // Zero reserved fields.
18086            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18087
18088            // Safety:
18089            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18090            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18091            //   envelope_size bytes, there is always sufficient room.
18092            fidl::encoding::encode_in_envelope_optional::<u32, D>(
18093                self.p_max.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
18094                encoder,
18095                offset + cur_offset,
18096                depth,
18097            )?;
18098
18099            _prev_end_offset = cur_offset + envelope_size;
18100
18101            Ok(())
18102        }
18103    }
18104
18105    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
18106        for H264QuantizationParameters
18107    {
18108        #[inline(always)]
18109        fn new_empty() -> Self {
18110            Self::default()
18111        }
18112
18113        unsafe fn decode(
18114            &mut self,
18115            decoder: &mut fidl::encoding::Decoder<'_, D>,
18116            offset: usize,
18117            mut depth: fidl::encoding::Depth,
18118        ) -> fidl::Result<()> {
18119            decoder.debug_check_bounds::<Self>(offset);
18120            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
18121                None => return Err(fidl::Error::NotNullable),
18122                Some(len) => len,
18123            };
18124            // Calling decoder.out_of_line_offset(0) is not allowed.
18125            if len == 0 {
18126                return Ok(());
18127            };
18128            depth.increment()?;
18129            let envelope_size = 8;
18130            let bytes_len = len * envelope_size;
18131            let offset = decoder.out_of_line_offset(bytes_len)?;
18132            // Decode the envelope for each type.
18133            let mut _next_ordinal_to_read = 0;
18134            let mut next_offset = offset;
18135            let end_offset = offset + bytes_len;
18136            _next_ordinal_to_read += 1;
18137            if next_offset >= end_offset {
18138                return Ok(());
18139            }
18140
18141            // Decode unknown envelopes for gaps in ordinals.
18142            while _next_ordinal_to_read < 1 {
18143                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18144                _next_ordinal_to_read += 1;
18145                next_offset += envelope_size;
18146            }
18147
18148            let next_out_of_line = decoder.next_out_of_line();
18149            let handles_before = decoder.remaining_handles();
18150            if let Some((inlined, num_bytes, num_handles)) =
18151                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18152            {
18153                let member_inline_size =
18154                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18155                if inlined != (member_inline_size <= 4) {
18156                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18157                }
18158                let inner_offset;
18159                let mut inner_depth = depth.clone();
18160                if inlined {
18161                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18162                    inner_offset = next_offset;
18163                } else {
18164                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18165                    inner_depth.increment()?;
18166                }
18167                let val_ref = self.i_base.get_or_insert_with(|| fidl::new_empty!(u32, D));
18168                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
18169                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18170                {
18171                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18172                }
18173                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18174                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18175                }
18176            }
18177
18178            next_offset += envelope_size;
18179            _next_ordinal_to_read += 1;
18180            if next_offset >= end_offset {
18181                return Ok(());
18182            }
18183
18184            // Decode unknown envelopes for gaps in ordinals.
18185            while _next_ordinal_to_read < 2 {
18186                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18187                _next_ordinal_to_read += 1;
18188                next_offset += envelope_size;
18189            }
18190
18191            let next_out_of_line = decoder.next_out_of_line();
18192            let handles_before = decoder.remaining_handles();
18193            if let Some((inlined, num_bytes, num_handles)) =
18194                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18195            {
18196                let member_inline_size =
18197                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18198                if inlined != (member_inline_size <= 4) {
18199                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18200                }
18201                let inner_offset;
18202                let mut inner_depth = depth.clone();
18203                if inlined {
18204                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18205                    inner_offset = next_offset;
18206                } else {
18207                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18208                    inner_depth.increment()?;
18209                }
18210                let val_ref = self.i_min.get_or_insert_with(|| fidl::new_empty!(u32, D));
18211                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
18212                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18213                {
18214                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18215                }
18216                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18217                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18218                }
18219            }
18220
18221            next_offset += envelope_size;
18222            _next_ordinal_to_read += 1;
18223            if next_offset >= end_offset {
18224                return Ok(());
18225            }
18226
18227            // Decode unknown envelopes for gaps in ordinals.
18228            while _next_ordinal_to_read < 3 {
18229                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18230                _next_ordinal_to_read += 1;
18231                next_offset += envelope_size;
18232            }
18233
18234            let next_out_of_line = decoder.next_out_of_line();
18235            let handles_before = decoder.remaining_handles();
18236            if let Some((inlined, num_bytes, num_handles)) =
18237                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18238            {
18239                let member_inline_size =
18240                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18241                if inlined != (member_inline_size <= 4) {
18242                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18243                }
18244                let inner_offset;
18245                let mut inner_depth = depth.clone();
18246                if inlined {
18247                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18248                    inner_offset = next_offset;
18249                } else {
18250                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18251                    inner_depth.increment()?;
18252                }
18253                let val_ref = self.i_max.get_or_insert_with(|| fidl::new_empty!(u32, D));
18254                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
18255                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18256                {
18257                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18258                }
18259                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18260                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18261                }
18262            }
18263
18264            next_offset += envelope_size;
18265            _next_ordinal_to_read += 1;
18266            if next_offset >= end_offset {
18267                return Ok(());
18268            }
18269
18270            // Decode unknown envelopes for gaps in ordinals.
18271            while _next_ordinal_to_read < 4 {
18272                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18273                _next_ordinal_to_read += 1;
18274                next_offset += envelope_size;
18275            }
18276
18277            let next_out_of_line = decoder.next_out_of_line();
18278            let handles_before = decoder.remaining_handles();
18279            if let Some((inlined, num_bytes, num_handles)) =
18280                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18281            {
18282                let member_inline_size =
18283                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18284                if inlined != (member_inline_size <= 4) {
18285                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18286                }
18287                let inner_offset;
18288                let mut inner_depth = depth.clone();
18289                if inlined {
18290                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18291                    inner_offset = next_offset;
18292                } else {
18293                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18294                    inner_depth.increment()?;
18295                }
18296                let val_ref = self.p_base.get_or_insert_with(|| fidl::new_empty!(u32, D));
18297                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
18298                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18299                {
18300                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18301                }
18302                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18303                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18304                }
18305            }
18306
18307            next_offset += envelope_size;
18308            _next_ordinal_to_read += 1;
18309            if next_offset >= end_offset {
18310                return Ok(());
18311            }
18312
18313            // Decode unknown envelopes for gaps in ordinals.
18314            while _next_ordinal_to_read < 5 {
18315                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18316                _next_ordinal_to_read += 1;
18317                next_offset += envelope_size;
18318            }
18319
18320            let next_out_of_line = decoder.next_out_of_line();
18321            let handles_before = decoder.remaining_handles();
18322            if let Some((inlined, num_bytes, num_handles)) =
18323                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18324            {
18325                let member_inline_size =
18326                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18327                if inlined != (member_inline_size <= 4) {
18328                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18329                }
18330                let inner_offset;
18331                let mut inner_depth = depth.clone();
18332                if inlined {
18333                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18334                    inner_offset = next_offset;
18335                } else {
18336                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18337                    inner_depth.increment()?;
18338                }
18339                let val_ref = self.p_min.get_or_insert_with(|| fidl::new_empty!(u32, D));
18340                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
18341                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18342                {
18343                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18344                }
18345                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18346                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18347                }
18348            }
18349
18350            next_offset += envelope_size;
18351            _next_ordinal_to_read += 1;
18352            if next_offset >= end_offset {
18353                return Ok(());
18354            }
18355
18356            // Decode unknown envelopes for gaps in ordinals.
18357            while _next_ordinal_to_read < 6 {
18358                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18359                _next_ordinal_to_read += 1;
18360                next_offset += envelope_size;
18361            }
18362
18363            let next_out_of_line = decoder.next_out_of_line();
18364            let handles_before = decoder.remaining_handles();
18365            if let Some((inlined, num_bytes, num_handles)) =
18366                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18367            {
18368                let member_inline_size =
18369                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18370                if inlined != (member_inline_size <= 4) {
18371                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18372                }
18373                let inner_offset;
18374                let mut inner_depth = depth.clone();
18375                if inlined {
18376                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18377                    inner_offset = next_offset;
18378                } else {
18379                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18380                    inner_depth.increment()?;
18381                }
18382                let val_ref = self.p_max.get_or_insert_with(|| fidl::new_empty!(u32, D));
18383                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
18384                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18385                {
18386                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18387                }
18388                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18389                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18390                }
18391            }
18392
18393            next_offset += envelope_size;
18394
18395            // Decode the remaining unknown envelopes.
18396            while next_offset < end_offset {
18397                _next_ordinal_to_read += 1;
18398                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18399                next_offset += envelope_size;
18400            }
18401
18402            Ok(())
18403        }
18404    }
18405
18406    impl HevcEncoderSettings {
18407        #[inline(always)]
18408        fn max_ordinal_present(&self) -> u64 {
18409            if let Some(_) = self.gop_size {
18410                return 3;
18411            }
18412            if let Some(_) = self.frame_rate {
18413                return 2;
18414            }
18415            if let Some(_) = self.bit_rate {
18416                return 1;
18417            }
18418            0
18419        }
18420    }
18421
18422    impl fidl::encoding::ValueTypeMarker for HevcEncoderSettings {
18423        type Borrowed<'a> = &'a Self;
18424        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
18425            value
18426        }
18427    }
18428
18429    unsafe impl fidl::encoding::TypeMarker for HevcEncoderSettings {
18430        type Owned = Self;
18431
18432        #[inline(always)]
18433        fn inline_align(_context: fidl::encoding::Context) -> usize {
18434            8
18435        }
18436
18437        #[inline(always)]
18438        fn inline_size(_context: fidl::encoding::Context) -> usize {
18439            16
18440        }
18441    }
18442
18443    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<HevcEncoderSettings, D>
18444        for &HevcEncoderSettings
18445    {
18446        unsafe fn encode(
18447            self,
18448            encoder: &mut fidl::encoding::Encoder<'_, D>,
18449            offset: usize,
18450            mut depth: fidl::encoding::Depth,
18451        ) -> fidl::Result<()> {
18452            encoder.debug_check_bounds::<HevcEncoderSettings>(offset);
18453            // Vector header
18454            let max_ordinal: u64 = self.max_ordinal_present();
18455            encoder.write_num(max_ordinal, offset);
18456            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
18457            // Calling encoder.out_of_line_offset(0) is not allowed.
18458            if max_ordinal == 0 {
18459                return Ok(());
18460            }
18461            depth.increment()?;
18462            let envelope_size = 8;
18463            let bytes_len = max_ordinal as usize * envelope_size;
18464            #[allow(unused_variables)]
18465            let offset = encoder.out_of_line_offset(bytes_len);
18466            let mut _prev_end_offset: usize = 0;
18467            if 1 > max_ordinal {
18468                return Ok(());
18469            }
18470
18471            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18472            // are envelope_size bytes.
18473            let cur_offset: usize = (1 - 1) * envelope_size;
18474
18475            // Zero reserved fields.
18476            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18477
18478            // Safety:
18479            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18480            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18481            //   envelope_size bytes, there is always sufficient room.
18482            fidl::encoding::encode_in_envelope_optional::<u32, D>(
18483                self.bit_rate.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
18484                encoder,
18485                offset + cur_offset,
18486                depth,
18487            )?;
18488
18489            _prev_end_offset = cur_offset + envelope_size;
18490            if 2 > max_ordinal {
18491                return Ok(());
18492            }
18493
18494            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18495            // are envelope_size bytes.
18496            let cur_offset: usize = (2 - 1) * envelope_size;
18497
18498            // Zero reserved fields.
18499            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18500
18501            // Safety:
18502            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18503            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18504            //   envelope_size bytes, there is always sufficient room.
18505            fidl::encoding::encode_in_envelope_optional::<u32, D>(
18506                self.frame_rate.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
18507                encoder,
18508                offset + cur_offset,
18509                depth,
18510            )?;
18511
18512            _prev_end_offset = cur_offset + envelope_size;
18513            if 3 > max_ordinal {
18514                return Ok(());
18515            }
18516
18517            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18518            // are envelope_size bytes.
18519            let cur_offset: usize = (3 - 1) * envelope_size;
18520
18521            // Zero reserved fields.
18522            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18523
18524            // Safety:
18525            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18526            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18527            //   envelope_size bytes, there is always sufficient room.
18528            fidl::encoding::encode_in_envelope_optional::<u32, D>(
18529                self.gop_size.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
18530                encoder,
18531                offset + cur_offset,
18532                depth,
18533            )?;
18534
18535            _prev_end_offset = cur_offset + envelope_size;
18536
18537            Ok(())
18538        }
18539    }
18540
18541    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HevcEncoderSettings {
18542        #[inline(always)]
18543        fn new_empty() -> Self {
18544            Self::default()
18545        }
18546
18547        unsafe fn decode(
18548            &mut self,
18549            decoder: &mut fidl::encoding::Decoder<'_, D>,
18550            offset: usize,
18551            mut depth: fidl::encoding::Depth,
18552        ) -> fidl::Result<()> {
18553            decoder.debug_check_bounds::<Self>(offset);
18554            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
18555                None => return Err(fidl::Error::NotNullable),
18556                Some(len) => len,
18557            };
18558            // Calling decoder.out_of_line_offset(0) is not allowed.
18559            if len == 0 {
18560                return Ok(());
18561            };
18562            depth.increment()?;
18563            let envelope_size = 8;
18564            let bytes_len = len * envelope_size;
18565            let offset = decoder.out_of_line_offset(bytes_len)?;
18566            // Decode the envelope for each type.
18567            let mut _next_ordinal_to_read = 0;
18568            let mut next_offset = offset;
18569            let end_offset = offset + bytes_len;
18570            _next_ordinal_to_read += 1;
18571            if next_offset >= end_offset {
18572                return Ok(());
18573            }
18574
18575            // Decode unknown envelopes for gaps in ordinals.
18576            while _next_ordinal_to_read < 1 {
18577                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18578                _next_ordinal_to_read += 1;
18579                next_offset += envelope_size;
18580            }
18581
18582            let next_out_of_line = decoder.next_out_of_line();
18583            let handles_before = decoder.remaining_handles();
18584            if let Some((inlined, num_bytes, num_handles)) =
18585                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18586            {
18587                let member_inline_size =
18588                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18589                if inlined != (member_inline_size <= 4) {
18590                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18591                }
18592                let inner_offset;
18593                let mut inner_depth = depth.clone();
18594                if inlined {
18595                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18596                    inner_offset = next_offset;
18597                } else {
18598                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18599                    inner_depth.increment()?;
18600                }
18601                let val_ref = self.bit_rate.get_or_insert_with(|| fidl::new_empty!(u32, D));
18602                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
18603                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18604                {
18605                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18606                }
18607                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18608                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18609                }
18610            }
18611
18612            next_offset += envelope_size;
18613            _next_ordinal_to_read += 1;
18614            if next_offset >= end_offset {
18615                return Ok(());
18616            }
18617
18618            // Decode unknown envelopes for gaps in ordinals.
18619            while _next_ordinal_to_read < 2 {
18620                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18621                _next_ordinal_to_read += 1;
18622                next_offset += envelope_size;
18623            }
18624
18625            let next_out_of_line = decoder.next_out_of_line();
18626            let handles_before = decoder.remaining_handles();
18627            if let Some((inlined, num_bytes, num_handles)) =
18628                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18629            {
18630                let member_inline_size =
18631                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18632                if inlined != (member_inline_size <= 4) {
18633                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18634                }
18635                let inner_offset;
18636                let mut inner_depth = depth.clone();
18637                if inlined {
18638                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18639                    inner_offset = next_offset;
18640                } else {
18641                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18642                    inner_depth.increment()?;
18643                }
18644                let val_ref = self.frame_rate.get_or_insert_with(|| fidl::new_empty!(u32, D));
18645                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
18646                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18647                {
18648                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18649                }
18650                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18651                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18652                }
18653            }
18654
18655            next_offset += envelope_size;
18656            _next_ordinal_to_read += 1;
18657            if next_offset >= end_offset {
18658                return Ok(());
18659            }
18660
18661            // Decode unknown envelopes for gaps in ordinals.
18662            while _next_ordinal_to_read < 3 {
18663                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18664                _next_ordinal_to_read += 1;
18665                next_offset += envelope_size;
18666            }
18667
18668            let next_out_of_line = decoder.next_out_of_line();
18669            let handles_before = decoder.remaining_handles();
18670            if let Some((inlined, num_bytes, num_handles)) =
18671                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18672            {
18673                let member_inline_size =
18674                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18675                if inlined != (member_inline_size <= 4) {
18676                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18677                }
18678                let inner_offset;
18679                let mut inner_depth = depth.clone();
18680                if inlined {
18681                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18682                    inner_offset = next_offset;
18683                } else {
18684                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18685                    inner_depth.increment()?;
18686                }
18687                let val_ref = self.gop_size.get_or_insert_with(|| fidl::new_empty!(u32, D));
18688                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
18689                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18690                {
18691                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18692                }
18693                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18694                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18695                }
18696            }
18697
18698            next_offset += envelope_size;
18699
18700            // Decode the remaining unknown envelopes.
18701            while next_offset < end_offset {
18702                _next_ordinal_to_read += 1;
18703                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18704                next_offset += envelope_size;
18705            }
18706
18707            Ok(())
18708        }
18709    }
18710
18711    impl InputAudioCapturerConfiguration {
18712        #[inline(always)]
18713        fn max_ordinal_present(&self) -> u64 {
18714            if let Some(_) = self.usage2 {
18715                return 2;
18716            }
18717            if let Some(_) = self.usage {
18718                return 1;
18719            }
18720            0
18721        }
18722    }
18723
18724    impl fidl::encoding::ValueTypeMarker for InputAudioCapturerConfiguration {
18725        type Borrowed<'a> = &'a Self;
18726        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
18727            value
18728        }
18729    }
18730
18731    unsafe impl fidl::encoding::TypeMarker for InputAudioCapturerConfiguration {
18732        type Owned = Self;
18733
18734        #[inline(always)]
18735        fn inline_align(_context: fidl::encoding::Context) -> usize {
18736            8
18737        }
18738
18739        #[inline(always)]
18740        fn inline_size(_context: fidl::encoding::Context) -> usize {
18741            16
18742        }
18743    }
18744
18745    unsafe impl<D: fidl::encoding::ResourceDialect>
18746        fidl::encoding::Encode<InputAudioCapturerConfiguration, D>
18747        for &InputAudioCapturerConfiguration
18748    {
18749        unsafe fn encode(
18750            self,
18751            encoder: &mut fidl::encoding::Encoder<'_, D>,
18752            offset: usize,
18753            mut depth: fidl::encoding::Depth,
18754        ) -> fidl::Result<()> {
18755            encoder.debug_check_bounds::<InputAudioCapturerConfiguration>(offset);
18756            // Vector header
18757            let max_ordinal: u64 = self.max_ordinal_present();
18758            encoder.write_num(max_ordinal, offset);
18759            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
18760            // Calling encoder.out_of_line_offset(0) is not allowed.
18761            if max_ordinal == 0 {
18762                return Ok(());
18763            }
18764            depth.increment()?;
18765            let envelope_size = 8;
18766            let bytes_len = max_ordinal as usize * envelope_size;
18767            #[allow(unused_variables)]
18768            let offset = encoder.out_of_line_offset(bytes_len);
18769            let mut _prev_end_offset: usize = 0;
18770            if 1 > max_ordinal {
18771                return Ok(());
18772            }
18773
18774            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18775            // are envelope_size bytes.
18776            let cur_offset: usize = (1 - 1) * envelope_size;
18777
18778            // Zero reserved fields.
18779            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18780
18781            // Safety:
18782            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18783            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18784            //   envelope_size bytes, there is always sufficient room.
18785            fidl::encoding::encode_in_envelope_optional::<AudioCaptureUsage, D>(
18786                self.usage
18787                    .as_ref()
18788                    .map(<AudioCaptureUsage as fidl::encoding::ValueTypeMarker>::borrow),
18789                encoder,
18790                offset + cur_offset,
18791                depth,
18792            )?;
18793
18794            _prev_end_offset = cur_offset + envelope_size;
18795            if 2 > max_ordinal {
18796                return Ok(());
18797            }
18798
18799            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18800            // are envelope_size bytes.
18801            let cur_offset: usize = (2 - 1) * envelope_size;
18802
18803            // Zero reserved fields.
18804            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18805
18806            // Safety:
18807            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18808            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18809            //   envelope_size bytes, there is always sufficient room.
18810            fidl::encoding::encode_in_envelope_optional::<AudioCaptureUsage2, D>(
18811                self.usage2
18812                    .as_ref()
18813                    .map(<AudioCaptureUsage2 as fidl::encoding::ValueTypeMarker>::borrow),
18814                encoder,
18815                offset + cur_offset,
18816                depth,
18817            )?;
18818
18819            _prev_end_offset = cur_offset + envelope_size;
18820
18821            Ok(())
18822        }
18823    }
18824
18825    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
18826        for InputAudioCapturerConfiguration
18827    {
18828        #[inline(always)]
18829        fn new_empty() -> Self {
18830            Self::default()
18831        }
18832
18833        unsafe fn decode(
18834            &mut self,
18835            decoder: &mut fidl::encoding::Decoder<'_, D>,
18836            offset: usize,
18837            mut depth: fidl::encoding::Depth,
18838        ) -> fidl::Result<()> {
18839            decoder.debug_check_bounds::<Self>(offset);
18840            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
18841                None => return Err(fidl::Error::NotNullable),
18842                Some(len) => len,
18843            };
18844            // Calling decoder.out_of_line_offset(0) is not allowed.
18845            if len == 0 {
18846                return Ok(());
18847            };
18848            depth.increment()?;
18849            let envelope_size = 8;
18850            let bytes_len = len * envelope_size;
18851            let offset = decoder.out_of_line_offset(bytes_len)?;
18852            // Decode the envelope for each type.
18853            let mut _next_ordinal_to_read = 0;
18854            let mut next_offset = offset;
18855            let end_offset = offset + bytes_len;
18856            _next_ordinal_to_read += 1;
18857            if next_offset >= end_offset {
18858                return Ok(());
18859            }
18860
18861            // Decode unknown envelopes for gaps in ordinals.
18862            while _next_ordinal_to_read < 1 {
18863                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18864                _next_ordinal_to_read += 1;
18865                next_offset += envelope_size;
18866            }
18867
18868            let next_out_of_line = decoder.next_out_of_line();
18869            let handles_before = decoder.remaining_handles();
18870            if let Some((inlined, num_bytes, num_handles)) =
18871                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18872            {
18873                let member_inline_size =
18874                    <AudioCaptureUsage as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18875                if inlined != (member_inline_size <= 4) {
18876                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18877                }
18878                let inner_offset;
18879                let mut inner_depth = depth.clone();
18880                if inlined {
18881                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18882                    inner_offset = next_offset;
18883                } else {
18884                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18885                    inner_depth.increment()?;
18886                }
18887                let val_ref =
18888                    self.usage.get_or_insert_with(|| fidl::new_empty!(AudioCaptureUsage, D));
18889                fidl::decode!(AudioCaptureUsage, D, val_ref, decoder, inner_offset, inner_depth)?;
18890                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18891                {
18892                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18893                }
18894                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18895                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18896                }
18897            }
18898
18899            next_offset += envelope_size;
18900            _next_ordinal_to_read += 1;
18901            if next_offset >= end_offset {
18902                return Ok(());
18903            }
18904
18905            // Decode unknown envelopes for gaps in ordinals.
18906            while _next_ordinal_to_read < 2 {
18907                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18908                _next_ordinal_to_read += 1;
18909                next_offset += envelope_size;
18910            }
18911
18912            let next_out_of_line = decoder.next_out_of_line();
18913            let handles_before = decoder.remaining_handles();
18914            if let Some((inlined, num_bytes, num_handles)) =
18915                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18916            {
18917                let member_inline_size =
18918                    <AudioCaptureUsage2 as fidl::encoding::TypeMarker>::inline_size(
18919                        decoder.context,
18920                    );
18921                if inlined != (member_inline_size <= 4) {
18922                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18923                }
18924                let inner_offset;
18925                let mut inner_depth = depth.clone();
18926                if inlined {
18927                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18928                    inner_offset = next_offset;
18929                } else {
18930                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18931                    inner_depth.increment()?;
18932                }
18933                let val_ref =
18934                    self.usage2.get_or_insert_with(|| fidl::new_empty!(AudioCaptureUsage2, D));
18935                fidl::decode!(AudioCaptureUsage2, D, val_ref, decoder, inner_offset, inner_depth)?;
18936                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18937                {
18938                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18939                }
18940                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18941                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18942                }
18943            }
18944
18945            next_offset += envelope_size;
18946
18947            // Decode the remaining unknown envelopes.
18948            while next_offset < end_offset {
18949                _next_ordinal_to_read += 1;
18950                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18951                next_offset += envelope_size;
18952            }
18953
18954            Ok(())
18955        }
18956    }
18957
18958    impl Lc3EncoderSettings {
18959        #[inline(always)]
18960        fn max_ordinal_present(&self) -> u64 {
18961            if let Some(_) = self.frame_duration {
18962                return 2;
18963            }
18964            if let Some(_) = self.nbytes {
18965                return 1;
18966            }
18967            0
18968        }
18969    }
18970
18971    impl fidl::encoding::ValueTypeMarker for Lc3EncoderSettings {
18972        type Borrowed<'a> = &'a Self;
18973        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
18974            value
18975        }
18976    }
18977
18978    unsafe impl fidl::encoding::TypeMarker for Lc3EncoderSettings {
18979        type Owned = Self;
18980
18981        #[inline(always)]
18982        fn inline_align(_context: fidl::encoding::Context) -> usize {
18983            8
18984        }
18985
18986        #[inline(always)]
18987        fn inline_size(_context: fidl::encoding::Context) -> usize {
18988            16
18989        }
18990    }
18991
18992    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Lc3EncoderSettings, D>
18993        for &Lc3EncoderSettings
18994    {
18995        unsafe fn encode(
18996            self,
18997            encoder: &mut fidl::encoding::Encoder<'_, D>,
18998            offset: usize,
18999            mut depth: fidl::encoding::Depth,
19000        ) -> fidl::Result<()> {
19001            encoder.debug_check_bounds::<Lc3EncoderSettings>(offset);
19002            // Vector header
19003            let max_ordinal: u64 = self.max_ordinal_present();
19004            encoder.write_num(max_ordinal, offset);
19005            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
19006            // Calling encoder.out_of_line_offset(0) is not allowed.
19007            if max_ordinal == 0 {
19008                return Ok(());
19009            }
19010            depth.increment()?;
19011            let envelope_size = 8;
19012            let bytes_len = max_ordinal as usize * envelope_size;
19013            #[allow(unused_variables)]
19014            let offset = encoder.out_of_line_offset(bytes_len);
19015            let mut _prev_end_offset: usize = 0;
19016            if 1 > max_ordinal {
19017                return Ok(());
19018            }
19019
19020            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
19021            // are envelope_size bytes.
19022            let cur_offset: usize = (1 - 1) * envelope_size;
19023
19024            // Zero reserved fields.
19025            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
19026
19027            // Safety:
19028            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
19029            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
19030            //   envelope_size bytes, there is always sufficient room.
19031            fidl::encoding::encode_in_envelope_optional::<u16, D>(
19032                self.nbytes.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
19033                encoder,
19034                offset + cur_offset,
19035                depth,
19036            )?;
19037
19038            _prev_end_offset = cur_offset + envelope_size;
19039            if 2 > max_ordinal {
19040                return Ok(());
19041            }
19042
19043            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
19044            // are envelope_size bytes.
19045            let cur_offset: usize = (2 - 1) * envelope_size;
19046
19047            // Zero reserved fields.
19048            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
19049
19050            // Safety:
19051            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
19052            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
19053            //   envelope_size bytes, there is always sufficient room.
19054            fidl::encoding::encode_in_envelope_optional::<Lc3FrameDuration, D>(
19055                self.frame_duration
19056                    .as_ref()
19057                    .map(<Lc3FrameDuration as fidl::encoding::ValueTypeMarker>::borrow),
19058                encoder,
19059                offset + cur_offset,
19060                depth,
19061            )?;
19062
19063            _prev_end_offset = cur_offset + envelope_size;
19064
19065            Ok(())
19066        }
19067    }
19068
19069    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Lc3EncoderSettings {
19070        #[inline(always)]
19071        fn new_empty() -> Self {
19072            Self::default()
19073        }
19074
19075        unsafe fn decode(
19076            &mut self,
19077            decoder: &mut fidl::encoding::Decoder<'_, D>,
19078            offset: usize,
19079            mut depth: fidl::encoding::Depth,
19080        ) -> fidl::Result<()> {
19081            decoder.debug_check_bounds::<Self>(offset);
19082            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
19083                None => return Err(fidl::Error::NotNullable),
19084                Some(len) => len,
19085            };
19086            // Calling decoder.out_of_line_offset(0) is not allowed.
19087            if len == 0 {
19088                return Ok(());
19089            };
19090            depth.increment()?;
19091            let envelope_size = 8;
19092            let bytes_len = len * envelope_size;
19093            let offset = decoder.out_of_line_offset(bytes_len)?;
19094            // Decode the envelope for each type.
19095            let mut _next_ordinal_to_read = 0;
19096            let mut next_offset = offset;
19097            let end_offset = offset + bytes_len;
19098            _next_ordinal_to_read += 1;
19099            if next_offset >= end_offset {
19100                return Ok(());
19101            }
19102
19103            // Decode unknown envelopes for gaps in ordinals.
19104            while _next_ordinal_to_read < 1 {
19105                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
19106                _next_ordinal_to_read += 1;
19107                next_offset += envelope_size;
19108            }
19109
19110            let next_out_of_line = decoder.next_out_of_line();
19111            let handles_before = decoder.remaining_handles();
19112            if let Some((inlined, num_bytes, num_handles)) =
19113                fidl::encoding::decode_envelope_header(decoder, next_offset)?
19114            {
19115                let member_inline_size =
19116                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
19117                if inlined != (member_inline_size <= 4) {
19118                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
19119                }
19120                let inner_offset;
19121                let mut inner_depth = depth.clone();
19122                if inlined {
19123                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
19124                    inner_offset = next_offset;
19125                } else {
19126                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
19127                    inner_depth.increment()?;
19128                }
19129                let val_ref = self.nbytes.get_or_insert_with(|| fidl::new_empty!(u16, D));
19130                fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
19131                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
19132                {
19133                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
19134                }
19135                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
19136                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
19137                }
19138            }
19139
19140            next_offset += envelope_size;
19141            _next_ordinal_to_read += 1;
19142            if next_offset >= end_offset {
19143                return Ok(());
19144            }
19145
19146            // Decode unknown envelopes for gaps in ordinals.
19147            while _next_ordinal_to_read < 2 {
19148                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
19149                _next_ordinal_to_read += 1;
19150                next_offset += envelope_size;
19151            }
19152
19153            let next_out_of_line = decoder.next_out_of_line();
19154            let handles_before = decoder.remaining_handles();
19155            if let Some((inlined, num_bytes, num_handles)) =
19156                fidl::encoding::decode_envelope_header(decoder, next_offset)?
19157            {
19158                let member_inline_size =
19159                    <Lc3FrameDuration as fidl::encoding::TypeMarker>::inline_size(decoder.context);
19160                if inlined != (member_inline_size <= 4) {
19161                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
19162                }
19163                let inner_offset;
19164                let mut inner_depth = depth.clone();
19165                if inlined {
19166                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
19167                    inner_offset = next_offset;
19168                } else {
19169                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
19170                    inner_depth.increment()?;
19171                }
19172                let val_ref = self
19173                    .frame_duration
19174                    .get_or_insert_with(|| fidl::new_empty!(Lc3FrameDuration, D));
19175                fidl::decode!(Lc3FrameDuration, D, val_ref, decoder, inner_offset, inner_depth)?;
19176                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
19177                {
19178                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
19179                }
19180                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
19181                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
19182                }
19183            }
19184
19185            next_offset += envelope_size;
19186
19187            // Decode the remaining unknown envelopes.
19188            while next_offset < end_offset {
19189                _next_ordinal_to_read += 1;
19190                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
19191                next_offset += envelope_size;
19192            }
19193
19194            Ok(())
19195        }
19196    }
19197
19198    impl LoopbackAudioCapturerConfiguration {
19199        #[inline(always)]
19200        fn max_ordinal_present(&self) -> u64 {
19201            0
19202        }
19203    }
19204
19205    impl fidl::encoding::ValueTypeMarker for LoopbackAudioCapturerConfiguration {
19206        type Borrowed<'a> = &'a Self;
19207        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
19208            value
19209        }
19210    }
19211
19212    unsafe impl fidl::encoding::TypeMarker for LoopbackAudioCapturerConfiguration {
19213        type Owned = Self;
19214
19215        #[inline(always)]
19216        fn inline_align(_context: fidl::encoding::Context) -> usize {
19217            8
19218        }
19219
19220        #[inline(always)]
19221        fn inline_size(_context: fidl::encoding::Context) -> usize {
19222            16
19223        }
19224    }
19225
19226    unsafe impl<D: fidl::encoding::ResourceDialect>
19227        fidl::encoding::Encode<LoopbackAudioCapturerConfiguration, D>
19228        for &LoopbackAudioCapturerConfiguration
19229    {
19230        unsafe fn encode(
19231            self,
19232            encoder: &mut fidl::encoding::Encoder<'_, D>,
19233            offset: usize,
19234            mut depth: fidl::encoding::Depth,
19235        ) -> fidl::Result<()> {
19236            encoder.debug_check_bounds::<LoopbackAudioCapturerConfiguration>(offset);
19237            // Vector header
19238            let max_ordinal: u64 = self.max_ordinal_present();
19239            encoder.write_num(max_ordinal, offset);
19240            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
19241            // Calling encoder.out_of_line_offset(0) is not allowed.
19242            if max_ordinal == 0 {
19243                return Ok(());
19244            }
19245            depth.increment()?;
19246            let envelope_size = 8;
19247            let bytes_len = max_ordinal as usize * envelope_size;
19248            #[allow(unused_variables)]
19249            let offset = encoder.out_of_line_offset(bytes_len);
19250            let mut _prev_end_offset: usize = 0;
19251
19252            Ok(())
19253        }
19254    }
19255
19256    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
19257        for LoopbackAudioCapturerConfiguration
19258    {
19259        #[inline(always)]
19260        fn new_empty() -> Self {
19261            Self::default()
19262        }
19263
19264        unsafe fn decode(
19265            &mut self,
19266            decoder: &mut fidl::encoding::Decoder<'_, D>,
19267            offset: usize,
19268            mut depth: fidl::encoding::Depth,
19269        ) -> fidl::Result<()> {
19270            decoder.debug_check_bounds::<Self>(offset);
19271            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
19272                None => return Err(fidl::Error::NotNullable),
19273                Some(len) => len,
19274            };
19275            // Calling decoder.out_of_line_offset(0) is not allowed.
19276            if len == 0 {
19277                return Ok(());
19278            };
19279            depth.increment()?;
19280            let envelope_size = 8;
19281            let bytes_len = len * envelope_size;
19282            let offset = decoder.out_of_line_offset(bytes_len)?;
19283            // Decode the envelope for each type.
19284            let mut _next_ordinal_to_read = 0;
19285            let mut next_offset = offset;
19286            let end_offset = offset + bytes_len;
19287
19288            // Decode the remaining unknown envelopes.
19289            while next_offset < end_offset {
19290                _next_ordinal_to_read += 1;
19291                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
19292                next_offset += envelope_size;
19293            }
19294
19295            Ok(())
19296        }
19297    }
19298
19299    impl MSbcEncoderSettings {
19300        #[inline(always)]
19301        fn max_ordinal_present(&self) -> u64 {
19302            0
19303        }
19304    }
19305
19306    impl fidl::encoding::ValueTypeMarker for MSbcEncoderSettings {
19307        type Borrowed<'a> = &'a Self;
19308        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
19309            value
19310        }
19311    }
19312
19313    unsafe impl fidl::encoding::TypeMarker for MSbcEncoderSettings {
19314        type Owned = Self;
19315
19316        #[inline(always)]
19317        fn inline_align(_context: fidl::encoding::Context) -> usize {
19318            8
19319        }
19320
19321        #[inline(always)]
19322        fn inline_size(_context: fidl::encoding::Context) -> usize {
19323            16
19324        }
19325    }
19326
19327    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MSbcEncoderSettings, D>
19328        for &MSbcEncoderSettings
19329    {
19330        unsafe fn encode(
19331            self,
19332            encoder: &mut fidl::encoding::Encoder<'_, D>,
19333            offset: usize,
19334            mut depth: fidl::encoding::Depth,
19335        ) -> fidl::Result<()> {
19336            encoder.debug_check_bounds::<MSbcEncoderSettings>(offset);
19337            // Vector header
19338            let max_ordinal: u64 = self.max_ordinal_present();
19339            encoder.write_num(max_ordinal, offset);
19340            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
19341            // Calling encoder.out_of_line_offset(0) is not allowed.
19342            if max_ordinal == 0 {
19343                return Ok(());
19344            }
19345            depth.increment()?;
19346            let envelope_size = 8;
19347            let bytes_len = max_ordinal as usize * envelope_size;
19348            #[allow(unused_variables)]
19349            let offset = encoder.out_of_line_offset(bytes_len);
19350            let mut _prev_end_offset: usize = 0;
19351
19352            Ok(())
19353        }
19354    }
19355
19356    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MSbcEncoderSettings {
19357        #[inline(always)]
19358        fn new_empty() -> Self {
19359            Self::default()
19360        }
19361
19362        unsafe fn decode(
19363            &mut self,
19364            decoder: &mut fidl::encoding::Decoder<'_, D>,
19365            offset: usize,
19366            mut depth: fidl::encoding::Depth,
19367        ) -> fidl::Result<()> {
19368            decoder.debug_check_bounds::<Self>(offset);
19369            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
19370                None => return Err(fidl::Error::NotNullable),
19371                Some(len) => len,
19372            };
19373            // Calling decoder.out_of_line_offset(0) is not allowed.
19374            if len == 0 {
19375                return Ok(());
19376            };
19377            depth.increment()?;
19378            let envelope_size = 8;
19379            let bytes_len = len * envelope_size;
19380            let offset = decoder.out_of_line_offset(bytes_len)?;
19381            // Decode the envelope for each type.
19382            let mut _next_ordinal_to_read = 0;
19383            let mut next_offset = offset;
19384            let end_offset = offset + bytes_len;
19385
19386            // Decode the remaining unknown envelopes.
19387            while next_offset < end_offset {
19388                _next_ordinal_to_read += 1;
19389                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
19390                next_offset += envelope_size;
19391            }
19392
19393            Ok(())
19394        }
19395    }
19396
19397    impl Packet {
19398        #[inline(always)]
19399        fn max_ordinal_present(&self) -> u64 {
19400            if let Some(_) = self.key_frame {
19401                return 9;
19402            }
19403            if let Some(_) = self.known_end_access_unit {
19404                return 8;
19405            }
19406            if let Some(_) = self.start_access_unit {
19407                return 7;
19408            }
19409            if let Some(_) = self.timestamp_ish {
19410                return 6;
19411            }
19412            if let Some(_) = self.valid_length_bytes {
19413                return 5;
19414            }
19415            if let Some(_) = self.start_offset {
19416                return 4;
19417            }
19418            if let Some(_) = self.stream_lifetime_ordinal {
19419                return 3;
19420            }
19421            if let Some(_) = self.buffer_index {
19422                return 2;
19423            }
19424            if let Some(_) = self.header {
19425                return 1;
19426            }
19427            0
19428        }
19429    }
19430
19431    impl fidl::encoding::ValueTypeMarker for Packet {
19432        type Borrowed<'a> = &'a Self;
19433        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
19434            value
19435        }
19436    }
19437
19438    unsafe impl fidl::encoding::TypeMarker for Packet {
19439        type Owned = Self;
19440
19441        #[inline(always)]
19442        fn inline_align(_context: fidl::encoding::Context) -> usize {
19443            8
19444        }
19445
19446        #[inline(always)]
19447        fn inline_size(_context: fidl::encoding::Context) -> usize {
19448            16
19449        }
19450    }
19451
19452    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Packet, D> for &Packet {
19453        unsafe fn encode(
19454            self,
19455            encoder: &mut fidl::encoding::Encoder<'_, D>,
19456            offset: usize,
19457            mut depth: fidl::encoding::Depth,
19458        ) -> fidl::Result<()> {
19459            encoder.debug_check_bounds::<Packet>(offset);
19460            // Vector header
19461            let max_ordinal: u64 = self.max_ordinal_present();
19462            encoder.write_num(max_ordinal, offset);
19463            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
19464            // Calling encoder.out_of_line_offset(0) is not allowed.
19465            if max_ordinal == 0 {
19466                return Ok(());
19467            }
19468            depth.increment()?;
19469            let envelope_size = 8;
19470            let bytes_len = max_ordinal as usize * envelope_size;
19471            #[allow(unused_variables)]
19472            let offset = encoder.out_of_line_offset(bytes_len);
19473            let mut _prev_end_offset: usize = 0;
19474            if 1 > max_ordinal {
19475                return Ok(());
19476            }
19477
19478            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
19479            // are envelope_size bytes.
19480            let cur_offset: usize = (1 - 1) * envelope_size;
19481
19482            // Zero reserved fields.
19483            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
19484
19485            // Safety:
19486            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
19487            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
19488            //   envelope_size bytes, there is always sufficient room.
19489            fidl::encoding::encode_in_envelope_optional::<PacketHeader, D>(
19490                self.header.as_ref().map(<PacketHeader as fidl::encoding::ValueTypeMarker>::borrow),
19491                encoder,
19492                offset + cur_offset,
19493                depth,
19494            )?;
19495
19496            _prev_end_offset = cur_offset + envelope_size;
19497            if 2 > max_ordinal {
19498                return Ok(());
19499            }
19500
19501            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
19502            // are envelope_size bytes.
19503            let cur_offset: usize = (2 - 1) * envelope_size;
19504
19505            // Zero reserved fields.
19506            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
19507
19508            // Safety:
19509            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
19510            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
19511            //   envelope_size bytes, there is always sufficient room.
19512            fidl::encoding::encode_in_envelope_optional::<u32, D>(
19513                self.buffer_index.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
19514                encoder,
19515                offset + cur_offset,
19516                depth,
19517            )?;
19518
19519            _prev_end_offset = cur_offset + envelope_size;
19520            if 3 > max_ordinal {
19521                return Ok(());
19522            }
19523
19524            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
19525            // are envelope_size bytes.
19526            let cur_offset: usize = (3 - 1) * envelope_size;
19527
19528            // Zero reserved fields.
19529            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
19530
19531            // Safety:
19532            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
19533            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
19534            //   envelope_size bytes, there is always sufficient room.
19535            fidl::encoding::encode_in_envelope_optional::<u64, D>(
19536                self.stream_lifetime_ordinal
19537                    .as_ref()
19538                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
19539                encoder,
19540                offset + cur_offset,
19541                depth,
19542            )?;
19543
19544            _prev_end_offset = cur_offset + envelope_size;
19545            if 4 > max_ordinal {
19546                return Ok(());
19547            }
19548
19549            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
19550            // are envelope_size bytes.
19551            let cur_offset: usize = (4 - 1) * envelope_size;
19552
19553            // Zero reserved fields.
19554            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
19555
19556            // Safety:
19557            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
19558            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
19559            //   envelope_size bytes, there is always sufficient room.
19560            fidl::encoding::encode_in_envelope_optional::<u32, D>(
19561                self.start_offset.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
19562                encoder,
19563                offset + cur_offset,
19564                depth,
19565            )?;
19566
19567            _prev_end_offset = cur_offset + envelope_size;
19568            if 5 > max_ordinal {
19569                return Ok(());
19570            }
19571
19572            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
19573            // are envelope_size bytes.
19574            let cur_offset: usize = (5 - 1) * envelope_size;
19575
19576            // Zero reserved fields.
19577            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
19578
19579            // Safety:
19580            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
19581            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
19582            //   envelope_size bytes, there is always sufficient room.
19583            fidl::encoding::encode_in_envelope_optional::<u32, D>(
19584                self.valid_length_bytes
19585                    .as_ref()
19586                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
19587                encoder,
19588                offset + cur_offset,
19589                depth,
19590            )?;
19591
19592            _prev_end_offset = cur_offset + envelope_size;
19593            if 6 > max_ordinal {
19594                return Ok(());
19595            }
19596
19597            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
19598            // are envelope_size bytes.
19599            let cur_offset: usize = (6 - 1) * envelope_size;
19600
19601            // Zero reserved fields.
19602            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
19603
19604            // Safety:
19605            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
19606            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
19607            //   envelope_size bytes, there is always sufficient room.
19608            fidl::encoding::encode_in_envelope_optional::<u64, D>(
19609                self.timestamp_ish.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
19610                encoder,
19611                offset + cur_offset,
19612                depth,
19613            )?;
19614
19615            _prev_end_offset = cur_offset + envelope_size;
19616            if 7 > max_ordinal {
19617                return Ok(());
19618            }
19619
19620            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
19621            // are envelope_size bytes.
19622            let cur_offset: usize = (7 - 1) * envelope_size;
19623
19624            // Zero reserved fields.
19625            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
19626
19627            // Safety:
19628            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
19629            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
19630            //   envelope_size bytes, there is always sufficient room.
19631            fidl::encoding::encode_in_envelope_optional::<bool, D>(
19632                self.start_access_unit
19633                    .as_ref()
19634                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
19635                encoder,
19636                offset + cur_offset,
19637                depth,
19638            )?;
19639
19640            _prev_end_offset = cur_offset + envelope_size;
19641            if 8 > max_ordinal {
19642                return Ok(());
19643            }
19644
19645            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
19646            // are envelope_size bytes.
19647            let cur_offset: usize = (8 - 1) * envelope_size;
19648
19649            // Zero reserved fields.
19650            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
19651
19652            // Safety:
19653            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
19654            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
19655            //   envelope_size bytes, there is always sufficient room.
19656            fidl::encoding::encode_in_envelope_optional::<bool, D>(
19657                self.known_end_access_unit
19658                    .as_ref()
19659                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
19660                encoder,
19661                offset + cur_offset,
19662                depth,
19663            )?;
19664
19665            _prev_end_offset = cur_offset + envelope_size;
19666            if 9 > max_ordinal {
19667                return Ok(());
19668            }
19669
19670            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
19671            // are envelope_size bytes.
19672            let cur_offset: usize = (9 - 1) * envelope_size;
19673
19674            // Zero reserved fields.
19675            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
19676
19677            // Safety:
19678            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
19679            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
19680            //   envelope_size bytes, there is always sufficient room.
19681            fidl::encoding::encode_in_envelope_optional::<bool, D>(
19682                self.key_frame.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
19683                encoder,
19684                offset + cur_offset,
19685                depth,
19686            )?;
19687
19688            _prev_end_offset = cur_offset + envelope_size;
19689
19690            Ok(())
19691        }
19692    }
19693
19694    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Packet {
19695        #[inline(always)]
19696        fn new_empty() -> Self {
19697            Self::default()
19698        }
19699
19700        unsafe fn decode(
19701            &mut self,
19702            decoder: &mut fidl::encoding::Decoder<'_, D>,
19703            offset: usize,
19704            mut depth: fidl::encoding::Depth,
19705        ) -> fidl::Result<()> {
19706            decoder.debug_check_bounds::<Self>(offset);
19707            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
19708                None => return Err(fidl::Error::NotNullable),
19709                Some(len) => len,
19710            };
19711            // Calling decoder.out_of_line_offset(0) is not allowed.
19712            if len == 0 {
19713                return Ok(());
19714            };
19715            depth.increment()?;
19716            let envelope_size = 8;
19717            let bytes_len = len * envelope_size;
19718            let offset = decoder.out_of_line_offset(bytes_len)?;
19719            // Decode the envelope for each type.
19720            let mut _next_ordinal_to_read = 0;
19721            let mut next_offset = offset;
19722            let end_offset = offset + bytes_len;
19723            _next_ordinal_to_read += 1;
19724            if next_offset >= end_offset {
19725                return Ok(());
19726            }
19727
19728            // Decode unknown envelopes for gaps in ordinals.
19729            while _next_ordinal_to_read < 1 {
19730                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
19731                _next_ordinal_to_read += 1;
19732                next_offset += envelope_size;
19733            }
19734
19735            let next_out_of_line = decoder.next_out_of_line();
19736            let handles_before = decoder.remaining_handles();
19737            if let Some((inlined, num_bytes, num_handles)) =
19738                fidl::encoding::decode_envelope_header(decoder, next_offset)?
19739            {
19740                let member_inline_size =
19741                    <PacketHeader as fidl::encoding::TypeMarker>::inline_size(decoder.context);
19742                if inlined != (member_inline_size <= 4) {
19743                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
19744                }
19745                let inner_offset;
19746                let mut inner_depth = depth.clone();
19747                if inlined {
19748                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
19749                    inner_offset = next_offset;
19750                } else {
19751                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
19752                    inner_depth.increment()?;
19753                }
19754                let val_ref = self.header.get_or_insert_with(|| fidl::new_empty!(PacketHeader, D));
19755                fidl::decode!(PacketHeader, D, val_ref, decoder, inner_offset, inner_depth)?;
19756                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
19757                {
19758                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
19759                }
19760                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
19761                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
19762                }
19763            }
19764
19765            next_offset += envelope_size;
19766            _next_ordinal_to_read += 1;
19767            if next_offset >= end_offset {
19768                return Ok(());
19769            }
19770
19771            // Decode unknown envelopes for gaps in ordinals.
19772            while _next_ordinal_to_read < 2 {
19773                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
19774                _next_ordinal_to_read += 1;
19775                next_offset += envelope_size;
19776            }
19777
19778            let next_out_of_line = decoder.next_out_of_line();
19779            let handles_before = decoder.remaining_handles();
19780            if let Some((inlined, num_bytes, num_handles)) =
19781                fidl::encoding::decode_envelope_header(decoder, next_offset)?
19782            {
19783                let member_inline_size =
19784                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
19785                if inlined != (member_inline_size <= 4) {
19786                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
19787                }
19788                let inner_offset;
19789                let mut inner_depth = depth.clone();
19790                if inlined {
19791                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
19792                    inner_offset = next_offset;
19793                } else {
19794                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
19795                    inner_depth.increment()?;
19796                }
19797                let val_ref = self.buffer_index.get_or_insert_with(|| fidl::new_empty!(u32, D));
19798                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
19799                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
19800                {
19801                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
19802                }
19803                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
19804                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
19805                }
19806            }
19807
19808            next_offset += envelope_size;
19809            _next_ordinal_to_read += 1;
19810            if next_offset >= end_offset {
19811                return Ok(());
19812            }
19813
19814            // Decode unknown envelopes for gaps in ordinals.
19815            while _next_ordinal_to_read < 3 {
19816                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
19817                _next_ordinal_to_read += 1;
19818                next_offset += envelope_size;
19819            }
19820
19821            let next_out_of_line = decoder.next_out_of_line();
19822            let handles_before = decoder.remaining_handles();
19823            if let Some((inlined, num_bytes, num_handles)) =
19824                fidl::encoding::decode_envelope_header(decoder, next_offset)?
19825            {
19826                let member_inline_size =
19827                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
19828                if inlined != (member_inline_size <= 4) {
19829                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
19830                }
19831                let inner_offset;
19832                let mut inner_depth = depth.clone();
19833                if inlined {
19834                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
19835                    inner_offset = next_offset;
19836                } else {
19837                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
19838                    inner_depth.increment()?;
19839                }
19840                let val_ref =
19841                    self.stream_lifetime_ordinal.get_or_insert_with(|| fidl::new_empty!(u64, D));
19842                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
19843                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
19844                {
19845                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
19846                }
19847                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
19848                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
19849                }
19850            }
19851
19852            next_offset += envelope_size;
19853            _next_ordinal_to_read += 1;
19854            if next_offset >= end_offset {
19855                return Ok(());
19856            }
19857
19858            // Decode unknown envelopes for gaps in ordinals.
19859            while _next_ordinal_to_read < 4 {
19860                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
19861                _next_ordinal_to_read += 1;
19862                next_offset += envelope_size;
19863            }
19864
19865            let next_out_of_line = decoder.next_out_of_line();
19866            let handles_before = decoder.remaining_handles();
19867            if let Some((inlined, num_bytes, num_handles)) =
19868                fidl::encoding::decode_envelope_header(decoder, next_offset)?
19869            {
19870                let member_inline_size =
19871                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
19872                if inlined != (member_inline_size <= 4) {
19873                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
19874                }
19875                let inner_offset;
19876                let mut inner_depth = depth.clone();
19877                if inlined {
19878                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
19879                    inner_offset = next_offset;
19880                } else {
19881                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
19882                    inner_depth.increment()?;
19883                }
19884                let val_ref = self.start_offset.get_or_insert_with(|| fidl::new_empty!(u32, D));
19885                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
19886                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
19887                {
19888                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
19889                }
19890                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
19891                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
19892                }
19893            }
19894
19895            next_offset += envelope_size;
19896            _next_ordinal_to_read += 1;
19897            if next_offset >= end_offset {
19898                return Ok(());
19899            }
19900
19901            // Decode unknown envelopes for gaps in ordinals.
19902            while _next_ordinal_to_read < 5 {
19903                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
19904                _next_ordinal_to_read += 1;
19905                next_offset += envelope_size;
19906            }
19907
19908            let next_out_of_line = decoder.next_out_of_line();
19909            let handles_before = decoder.remaining_handles();
19910            if let Some((inlined, num_bytes, num_handles)) =
19911                fidl::encoding::decode_envelope_header(decoder, next_offset)?
19912            {
19913                let member_inline_size =
19914                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
19915                if inlined != (member_inline_size <= 4) {
19916                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
19917                }
19918                let inner_offset;
19919                let mut inner_depth = depth.clone();
19920                if inlined {
19921                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
19922                    inner_offset = next_offset;
19923                } else {
19924                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
19925                    inner_depth.increment()?;
19926                }
19927                let val_ref =
19928                    self.valid_length_bytes.get_or_insert_with(|| fidl::new_empty!(u32, D));
19929                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
19930                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
19931                {
19932                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
19933                }
19934                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
19935                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
19936                }
19937            }
19938
19939            next_offset += envelope_size;
19940            _next_ordinal_to_read += 1;
19941            if next_offset >= end_offset {
19942                return Ok(());
19943            }
19944
19945            // Decode unknown envelopes for gaps in ordinals.
19946            while _next_ordinal_to_read < 6 {
19947                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
19948                _next_ordinal_to_read += 1;
19949                next_offset += envelope_size;
19950            }
19951
19952            let next_out_of_line = decoder.next_out_of_line();
19953            let handles_before = decoder.remaining_handles();
19954            if let Some((inlined, num_bytes, num_handles)) =
19955                fidl::encoding::decode_envelope_header(decoder, next_offset)?
19956            {
19957                let member_inline_size =
19958                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
19959                if inlined != (member_inline_size <= 4) {
19960                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
19961                }
19962                let inner_offset;
19963                let mut inner_depth = depth.clone();
19964                if inlined {
19965                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
19966                    inner_offset = next_offset;
19967                } else {
19968                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
19969                    inner_depth.increment()?;
19970                }
19971                let val_ref = self.timestamp_ish.get_or_insert_with(|| fidl::new_empty!(u64, D));
19972                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
19973                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
19974                {
19975                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
19976                }
19977                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
19978                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
19979                }
19980            }
19981
19982            next_offset += envelope_size;
19983            _next_ordinal_to_read += 1;
19984            if next_offset >= end_offset {
19985                return Ok(());
19986            }
19987
19988            // Decode unknown envelopes for gaps in ordinals.
19989            while _next_ordinal_to_read < 7 {
19990                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
19991                _next_ordinal_to_read += 1;
19992                next_offset += envelope_size;
19993            }
19994
19995            let next_out_of_line = decoder.next_out_of_line();
19996            let handles_before = decoder.remaining_handles();
19997            if let Some((inlined, num_bytes, num_handles)) =
19998                fidl::encoding::decode_envelope_header(decoder, next_offset)?
19999            {
20000                let member_inline_size =
20001                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
20002                if inlined != (member_inline_size <= 4) {
20003                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
20004                }
20005                let inner_offset;
20006                let mut inner_depth = depth.clone();
20007                if inlined {
20008                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
20009                    inner_offset = next_offset;
20010                } else {
20011                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
20012                    inner_depth.increment()?;
20013                }
20014                let val_ref =
20015                    self.start_access_unit.get_or_insert_with(|| fidl::new_empty!(bool, D));
20016                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
20017                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
20018                {
20019                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
20020                }
20021                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
20022                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
20023                }
20024            }
20025
20026            next_offset += envelope_size;
20027            _next_ordinal_to_read += 1;
20028            if next_offset >= end_offset {
20029                return Ok(());
20030            }
20031
20032            // Decode unknown envelopes for gaps in ordinals.
20033            while _next_ordinal_to_read < 8 {
20034                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
20035                _next_ordinal_to_read += 1;
20036                next_offset += envelope_size;
20037            }
20038
20039            let next_out_of_line = decoder.next_out_of_line();
20040            let handles_before = decoder.remaining_handles();
20041            if let Some((inlined, num_bytes, num_handles)) =
20042                fidl::encoding::decode_envelope_header(decoder, next_offset)?
20043            {
20044                let member_inline_size =
20045                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
20046                if inlined != (member_inline_size <= 4) {
20047                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
20048                }
20049                let inner_offset;
20050                let mut inner_depth = depth.clone();
20051                if inlined {
20052                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
20053                    inner_offset = next_offset;
20054                } else {
20055                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
20056                    inner_depth.increment()?;
20057                }
20058                let val_ref =
20059                    self.known_end_access_unit.get_or_insert_with(|| fidl::new_empty!(bool, D));
20060                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
20061                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
20062                {
20063                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
20064                }
20065                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
20066                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
20067                }
20068            }
20069
20070            next_offset += envelope_size;
20071            _next_ordinal_to_read += 1;
20072            if next_offset >= end_offset {
20073                return Ok(());
20074            }
20075
20076            // Decode unknown envelopes for gaps in ordinals.
20077            while _next_ordinal_to_read < 9 {
20078                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
20079                _next_ordinal_to_read += 1;
20080                next_offset += envelope_size;
20081            }
20082
20083            let next_out_of_line = decoder.next_out_of_line();
20084            let handles_before = decoder.remaining_handles();
20085            if let Some((inlined, num_bytes, num_handles)) =
20086                fidl::encoding::decode_envelope_header(decoder, next_offset)?
20087            {
20088                let member_inline_size =
20089                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
20090                if inlined != (member_inline_size <= 4) {
20091                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
20092                }
20093                let inner_offset;
20094                let mut inner_depth = depth.clone();
20095                if inlined {
20096                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
20097                    inner_offset = next_offset;
20098                } else {
20099                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
20100                    inner_depth.increment()?;
20101                }
20102                let val_ref = self.key_frame.get_or_insert_with(|| fidl::new_empty!(bool, D));
20103                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
20104                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
20105                {
20106                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
20107                }
20108                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
20109                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
20110                }
20111            }
20112
20113            next_offset += envelope_size;
20114
20115            // Decode the remaining unknown envelopes.
20116            while next_offset < end_offset {
20117                _next_ordinal_to_read += 1;
20118                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
20119                next_offset += envelope_size;
20120            }
20121
20122            Ok(())
20123        }
20124    }
20125
20126    impl PacketHeader {
20127        #[inline(always)]
20128        fn max_ordinal_present(&self) -> u64 {
20129            if let Some(_) = self.packet_index {
20130                return 2;
20131            }
20132            if let Some(_) = self.buffer_lifetime_ordinal {
20133                return 1;
20134            }
20135            0
20136        }
20137    }
20138
20139    impl fidl::encoding::ValueTypeMarker for PacketHeader {
20140        type Borrowed<'a> = &'a Self;
20141        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
20142            value
20143        }
20144    }
20145
20146    unsafe impl fidl::encoding::TypeMarker for PacketHeader {
20147        type Owned = Self;
20148
20149        #[inline(always)]
20150        fn inline_align(_context: fidl::encoding::Context) -> usize {
20151            8
20152        }
20153
20154        #[inline(always)]
20155        fn inline_size(_context: fidl::encoding::Context) -> usize {
20156            16
20157        }
20158    }
20159
20160    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PacketHeader, D>
20161        for &PacketHeader
20162    {
20163        unsafe fn encode(
20164            self,
20165            encoder: &mut fidl::encoding::Encoder<'_, D>,
20166            offset: usize,
20167            mut depth: fidl::encoding::Depth,
20168        ) -> fidl::Result<()> {
20169            encoder.debug_check_bounds::<PacketHeader>(offset);
20170            // Vector header
20171            let max_ordinal: u64 = self.max_ordinal_present();
20172            encoder.write_num(max_ordinal, offset);
20173            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
20174            // Calling encoder.out_of_line_offset(0) is not allowed.
20175            if max_ordinal == 0 {
20176                return Ok(());
20177            }
20178            depth.increment()?;
20179            let envelope_size = 8;
20180            let bytes_len = max_ordinal as usize * envelope_size;
20181            #[allow(unused_variables)]
20182            let offset = encoder.out_of_line_offset(bytes_len);
20183            let mut _prev_end_offset: usize = 0;
20184            if 1 > max_ordinal {
20185                return Ok(());
20186            }
20187
20188            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
20189            // are envelope_size bytes.
20190            let cur_offset: usize = (1 - 1) * envelope_size;
20191
20192            // Zero reserved fields.
20193            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
20194
20195            // Safety:
20196            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
20197            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
20198            //   envelope_size bytes, there is always sufficient room.
20199            fidl::encoding::encode_in_envelope_optional::<u64, D>(
20200                self.buffer_lifetime_ordinal
20201                    .as_ref()
20202                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
20203                encoder,
20204                offset + cur_offset,
20205                depth,
20206            )?;
20207
20208            _prev_end_offset = cur_offset + envelope_size;
20209            if 2 > max_ordinal {
20210                return Ok(());
20211            }
20212
20213            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
20214            // are envelope_size bytes.
20215            let cur_offset: usize = (2 - 1) * envelope_size;
20216
20217            // Zero reserved fields.
20218            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
20219
20220            // Safety:
20221            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
20222            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
20223            //   envelope_size bytes, there is always sufficient room.
20224            fidl::encoding::encode_in_envelope_optional::<u32, D>(
20225                self.packet_index.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
20226                encoder,
20227                offset + cur_offset,
20228                depth,
20229            )?;
20230
20231            _prev_end_offset = cur_offset + envelope_size;
20232
20233            Ok(())
20234        }
20235    }
20236
20237    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PacketHeader {
20238        #[inline(always)]
20239        fn new_empty() -> Self {
20240            Self::default()
20241        }
20242
20243        unsafe fn decode(
20244            &mut self,
20245            decoder: &mut fidl::encoding::Decoder<'_, D>,
20246            offset: usize,
20247            mut depth: fidl::encoding::Depth,
20248        ) -> fidl::Result<()> {
20249            decoder.debug_check_bounds::<Self>(offset);
20250            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
20251                None => return Err(fidl::Error::NotNullable),
20252                Some(len) => len,
20253            };
20254            // Calling decoder.out_of_line_offset(0) is not allowed.
20255            if len == 0 {
20256                return Ok(());
20257            };
20258            depth.increment()?;
20259            let envelope_size = 8;
20260            let bytes_len = len * envelope_size;
20261            let offset = decoder.out_of_line_offset(bytes_len)?;
20262            // Decode the envelope for each type.
20263            let mut _next_ordinal_to_read = 0;
20264            let mut next_offset = offset;
20265            let end_offset = offset + bytes_len;
20266            _next_ordinal_to_read += 1;
20267            if next_offset >= end_offset {
20268                return Ok(());
20269            }
20270
20271            // Decode unknown envelopes for gaps in ordinals.
20272            while _next_ordinal_to_read < 1 {
20273                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
20274                _next_ordinal_to_read += 1;
20275                next_offset += envelope_size;
20276            }
20277
20278            let next_out_of_line = decoder.next_out_of_line();
20279            let handles_before = decoder.remaining_handles();
20280            if let Some((inlined, num_bytes, num_handles)) =
20281                fidl::encoding::decode_envelope_header(decoder, next_offset)?
20282            {
20283                let member_inline_size =
20284                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
20285                if inlined != (member_inline_size <= 4) {
20286                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
20287                }
20288                let inner_offset;
20289                let mut inner_depth = depth.clone();
20290                if inlined {
20291                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
20292                    inner_offset = next_offset;
20293                } else {
20294                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
20295                    inner_depth.increment()?;
20296                }
20297                let val_ref =
20298                    self.buffer_lifetime_ordinal.get_or_insert_with(|| fidl::new_empty!(u64, D));
20299                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
20300                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
20301                {
20302                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
20303                }
20304                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
20305                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
20306                }
20307            }
20308
20309            next_offset += envelope_size;
20310            _next_ordinal_to_read += 1;
20311            if next_offset >= end_offset {
20312                return Ok(());
20313            }
20314
20315            // Decode unknown envelopes for gaps in ordinals.
20316            while _next_ordinal_to_read < 2 {
20317                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
20318                _next_ordinal_to_read += 1;
20319                next_offset += envelope_size;
20320            }
20321
20322            let next_out_of_line = decoder.next_out_of_line();
20323            let handles_before = decoder.remaining_handles();
20324            if let Some((inlined, num_bytes, num_handles)) =
20325                fidl::encoding::decode_envelope_header(decoder, next_offset)?
20326            {
20327                let member_inline_size =
20328                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
20329                if inlined != (member_inline_size <= 4) {
20330                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
20331                }
20332                let inner_offset;
20333                let mut inner_depth = depth.clone();
20334                if inlined {
20335                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
20336                    inner_offset = next_offset;
20337                } else {
20338                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
20339                    inner_depth.increment()?;
20340                }
20341                let val_ref = self.packet_index.get_or_insert_with(|| fidl::new_empty!(u32, D));
20342                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
20343                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
20344                {
20345                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
20346                }
20347                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
20348                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
20349                }
20350            }
20351
20352            next_offset += envelope_size;
20353
20354            // Decode the remaining unknown envelopes.
20355            while next_offset < end_offset {
20356                _next_ordinal_to_read += 1;
20357                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
20358                next_offset += envelope_size;
20359            }
20360
20361            Ok(())
20362        }
20363    }
20364
20365    impl StreamBufferConstraints {
20366        #[inline(always)]
20367        fn max_ordinal_present(&self) -> u64 {
20368            if let Some(_) = self.pixel_format {
20369                return 16;
20370            }
20371            if let Some(_) = self.size {
20372                return 15;
20373            }
20374            if let Some(_) = self.buffer_count_for_server_current {
20375                return 14;
20376            }
20377            if let Some(_) = self.is_physically_contiguous_required {
20378                return 13;
20379            }
20380            if let Some(_) = self.single_buffer_mode_allowed {
20381                return 12;
20382            }
20383            if let Some(_) = self.packet_count_for_client_max {
20384                return 11;
20385            }
20386            if let Some(_) = self.packet_count_for_client_min {
20387                return 10;
20388            }
20389            if let Some(_) = self.packet_count_for_server_max {
20390                return 9;
20391            }
20392            if let Some(_) = self.packet_count_for_server_recommended_max {
20393                return 8;
20394            }
20395            if let Some(_) = self.packet_count_for_server_recommended {
20396                return 7;
20397            }
20398            if let Some(_) = self.packet_count_for_server_min {
20399                return 6;
20400            }
20401            if let Some(_) = self.per_packet_buffer_bytes_max {
20402                return 5;
20403            }
20404            if let Some(_) = self.per_packet_buffer_bytes_recommended {
20405                return 4;
20406            }
20407            if let Some(_) = self.per_packet_buffer_bytes_min {
20408                return 3;
20409            }
20410            if let Some(_) = self.default_settings {
20411                return 2;
20412            }
20413            if let Some(_) = self.buffer_constraints_version_ordinal {
20414                return 1;
20415            }
20416            0
20417        }
20418    }
20419
20420    impl fidl::encoding::ValueTypeMarker for StreamBufferConstraints {
20421        type Borrowed<'a> = &'a Self;
20422        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
20423            value
20424        }
20425    }
20426
20427    unsafe impl fidl::encoding::TypeMarker for StreamBufferConstraints {
20428        type Owned = Self;
20429
20430        #[inline(always)]
20431        fn inline_align(_context: fidl::encoding::Context) -> usize {
20432            8
20433        }
20434
20435        #[inline(always)]
20436        fn inline_size(_context: fidl::encoding::Context) -> usize {
20437            16
20438        }
20439    }
20440
20441    unsafe impl<D: fidl::encoding::ResourceDialect>
20442        fidl::encoding::Encode<StreamBufferConstraints, D> for &StreamBufferConstraints
20443    {
20444        unsafe fn encode(
20445            self,
20446            encoder: &mut fidl::encoding::Encoder<'_, D>,
20447            offset: usize,
20448            mut depth: fidl::encoding::Depth,
20449        ) -> fidl::Result<()> {
20450            encoder.debug_check_bounds::<StreamBufferConstraints>(offset);
20451            // Vector header
20452            let max_ordinal: u64 = self.max_ordinal_present();
20453            encoder.write_num(max_ordinal, offset);
20454            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
20455            // Calling encoder.out_of_line_offset(0) is not allowed.
20456            if max_ordinal == 0 {
20457                return Ok(());
20458            }
20459            depth.increment()?;
20460            let envelope_size = 8;
20461            let bytes_len = max_ordinal as usize * envelope_size;
20462            #[allow(unused_variables)]
20463            let offset = encoder.out_of_line_offset(bytes_len);
20464            let mut _prev_end_offset: usize = 0;
20465            if 1 > max_ordinal {
20466                return Ok(());
20467            }
20468
20469            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
20470            // are envelope_size bytes.
20471            let cur_offset: usize = (1 - 1) * envelope_size;
20472
20473            // Zero reserved fields.
20474            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
20475
20476            // Safety:
20477            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
20478            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
20479            //   envelope_size bytes, there is always sufficient room.
20480            fidl::encoding::encode_in_envelope_optional::<u64, D>(
20481                self.buffer_constraints_version_ordinal
20482                    .as_ref()
20483                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
20484                encoder,
20485                offset + cur_offset,
20486                depth,
20487            )?;
20488
20489            _prev_end_offset = cur_offset + envelope_size;
20490            if 2 > max_ordinal {
20491                return Ok(());
20492            }
20493
20494            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
20495            // are envelope_size bytes.
20496            let cur_offset: usize = (2 - 1) * envelope_size;
20497
20498            // Zero reserved fields.
20499            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
20500
20501            // Safety:
20502            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
20503            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
20504            //   envelope_size bytes, there is always sufficient room.
20505            fidl::encoding::encode_in_envelope_optional::<StreamBufferSettings, D>(
20506                self.default_settings
20507                    .as_ref()
20508                    .map(<StreamBufferSettings as fidl::encoding::ValueTypeMarker>::borrow),
20509                encoder,
20510                offset + cur_offset,
20511                depth,
20512            )?;
20513
20514            _prev_end_offset = cur_offset + envelope_size;
20515            if 3 > max_ordinal {
20516                return Ok(());
20517            }
20518
20519            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
20520            // are envelope_size bytes.
20521            let cur_offset: usize = (3 - 1) * envelope_size;
20522
20523            // Zero reserved fields.
20524            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
20525
20526            // Safety:
20527            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
20528            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
20529            //   envelope_size bytes, there is always sufficient room.
20530            fidl::encoding::encode_in_envelope_optional::<u32, D>(
20531                self.per_packet_buffer_bytes_min
20532                    .as_ref()
20533                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
20534                encoder,
20535                offset + cur_offset,
20536                depth,
20537            )?;
20538
20539            _prev_end_offset = cur_offset + envelope_size;
20540            if 4 > max_ordinal {
20541                return Ok(());
20542            }
20543
20544            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
20545            // are envelope_size bytes.
20546            let cur_offset: usize = (4 - 1) * envelope_size;
20547
20548            // Zero reserved fields.
20549            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
20550
20551            // Safety:
20552            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
20553            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
20554            //   envelope_size bytes, there is always sufficient room.
20555            fidl::encoding::encode_in_envelope_optional::<u32, D>(
20556                self.per_packet_buffer_bytes_recommended
20557                    .as_ref()
20558                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
20559                encoder,
20560                offset + cur_offset,
20561                depth,
20562            )?;
20563
20564            _prev_end_offset = cur_offset + envelope_size;
20565            if 5 > max_ordinal {
20566                return Ok(());
20567            }
20568
20569            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
20570            // are envelope_size bytes.
20571            let cur_offset: usize = (5 - 1) * envelope_size;
20572
20573            // Zero reserved fields.
20574            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
20575
20576            // Safety:
20577            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
20578            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
20579            //   envelope_size bytes, there is always sufficient room.
20580            fidl::encoding::encode_in_envelope_optional::<u32, D>(
20581                self.per_packet_buffer_bytes_max
20582                    .as_ref()
20583                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
20584                encoder,
20585                offset + cur_offset,
20586                depth,
20587            )?;
20588
20589            _prev_end_offset = cur_offset + envelope_size;
20590            if 6 > max_ordinal {
20591                return Ok(());
20592            }
20593
20594            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
20595            // are envelope_size bytes.
20596            let cur_offset: usize = (6 - 1) * envelope_size;
20597
20598            // Zero reserved fields.
20599            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
20600
20601            // Safety:
20602            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
20603            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
20604            //   envelope_size bytes, there is always sufficient room.
20605            fidl::encoding::encode_in_envelope_optional::<u32, D>(
20606                self.packet_count_for_server_min
20607                    .as_ref()
20608                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
20609                encoder,
20610                offset + cur_offset,
20611                depth,
20612            )?;
20613
20614            _prev_end_offset = cur_offset + envelope_size;
20615            if 7 > max_ordinal {
20616                return Ok(());
20617            }
20618
20619            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
20620            // are envelope_size bytes.
20621            let cur_offset: usize = (7 - 1) * envelope_size;
20622
20623            // Zero reserved fields.
20624            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
20625
20626            // Safety:
20627            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
20628            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
20629            //   envelope_size bytes, there is always sufficient room.
20630            fidl::encoding::encode_in_envelope_optional::<u32, D>(
20631                self.packet_count_for_server_recommended
20632                    .as_ref()
20633                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
20634                encoder,
20635                offset + cur_offset,
20636                depth,
20637            )?;
20638
20639            _prev_end_offset = cur_offset + envelope_size;
20640            if 8 > max_ordinal {
20641                return Ok(());
20642            }
20643
20644            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
20645            // are envelope_size bytes.
20646            let cur_offset: usize = (8 - 1) * envelope_size;
20647
20648            // Zero reserved fields.
20649            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
20650
20651            // Safety:
20652            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
20653            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
20654            //   envelope_size bytes, there is always sufficient room.
20655            fidl::encoding::encode_in_envelope_optional::<u32, D>(
20656                self.packet_count_for_server_recommended_max
20657                    .as_ref()
20658                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
20659                encoder,
20660                offset + cur_offset,
20661                depth,
20662            )?;
20663
20664            _prev_end_offset = cur_offset + envelope_size;
20665            if 9 > max_ordinal {
20666                return Ok(());
20667            }
20668
20669            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
20670            // are envelope_size bytes.
20671            let cur_offset: usize = (9 - 1) * envelope_size;
20672
20673            // Zero reserved fields.
20674            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
20675
20676            // Safety:
20677            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
20678            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
20679            //   envelope_size bytes, there is always sufficient room.
20680            fidl::encoding::encode_in_envelope_optional::<u32, D>(
20681                self.packet_count_for_server_max
20682                    .as_ref()
20683                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
20684                encoder,
20685                offset + cur_offset,
20686                depth,
20687            )?;
20688
20689            _prev_end_offset = cur_offset + envelope_size;
20690            if 10 > max_ordinal {
20691                return Ok(());
20692            }
20693
20694            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
20695            // are envelope_size bytes.
20696            let cur_offset: usize = (10 - 1) * envelope_size;
20697
20698            // Zero reserved fields.
20699            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
20700
20701            // Safety:
20702            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
20703            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
20704            //   envelope_size bytes, there is always sufficient room.
20705            fidl::encoding::encode_in_envelope_optional::<u32, D>(
20706                self.packet_count_for_client_min
20707                    .as_ref()
20708                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
20709                encoder,
20710                offset + cur_offset,
20711                depth,
20712            )?;
20713
20714            _prev_end_offset = cur_offset + envelope_size;
20715            if 11 > max_ordinal {
20716                return Ok(());
20717            }
20718
20719            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
20720            // are envelope_size bytes.
20721            let cur_offset: usize = (11 - 1) * envelope_size;
20722
20723            // Zero reserved fields.
20724            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
20725
20726            // Safety:
20727            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
20728            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
20729            //   envelope_size bytes, there is always sufficient room.
20730            fidl::encoding::encode_in_envelope_optional::<u32, D>(
20731                self.packet_count_for_client_max
20732                    .as_ref()
20733                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
20734                encoder,
20735                offset + cur_offset,
20736                depth,
20737            )?;
20738
20739            _prev_end_offset = cur_offset + envelope_size;
20740            if 12 > max_ordinal {
20741                return Ok(());
20742            }
20743
20744            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
20745            // are envelope_size bytes.
20746            let cur_offset: usize = (12 - 1) * envelope_size;
20747
20748            // Zero reserved fields.
20749            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
20750
20751            // Safety:
20752            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
20753            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
20754            //   envelope_size bytes, there is always sufficient room.
20755            fidl::encoding::encode_in_envelope_optional::<bool, D>(
20756                self.single_buffer_mode_allowed
20757                    .as_ref()
20758                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
20759                encoder,
20760                offset + cur_offset,
20761                depth,
20762            )?;
20763
20764            _prev_end_offset = cur_offset + envelope_size;
20765            if 13 > max_ordinal {
20766                return Ok(());
20767            }
20768
20769            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
20770            // are envelope_size bytes.
20771            let cur_offset: usize = (13 - 1) * envelope_size;
20772
20773            // Zero reserved fields.
20774            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
20775
20776            // Safety:
20777            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
20778            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
20779            //   envelope_size bytes, there is always sufficient room.
20780            fidl::encoding::encode_in_envelope_optional::<bool, D>(
20781                self.is_physically_contiguous_required
20782                    .as_ref()
20783                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
20784                encoder,
20785                offset + cur_offset,
20786                depth,
20787            )?;
20788
20789            _prev_end_offset = cur_offset + envelope_size;
20790            if 14 > max_ordinal {
20791                return Ok(());
20792            }
20793
20794            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
20795            // are envelope_size bytes.
20796            let cur_offset: usize = (14 - 1) * envelope_size;
20797
20798            // Zero reserved fields.
20799            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
20800
20801            // Safety:
20802            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
20803            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
20804            //   envelope_size bytes, there is always sufficient room.
20805            fidl::encoding::encode_in_envelope_optional::<u32, D>(
20806                self.buffer_count_for_server_current
20807                    .as_ref()
20808                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
20809                encoder,
20810                offset + cur_offset,
20811                depth,
20812            )?;
20813
20814            _prev_end_offset = cur_offset + envelope_size;
20815            if 15 > max_ordinal {
20816                return Ok(());
20817            }
20818
20819            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
20820            // are envelope_size bytes.
20821            let cur_offset: usize = (15 - 1) * envelope_size;
20822
20823            // Zero reserved fields.
20824            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
20825
20826            // Safety:
20827            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
20828            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
20829            //   envelope_size bytes, there is always sufficient room.
20830            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_math_common::SizeU, D>(
20831                self.size.as_ref().map(
20832                    <fidl_fuchsia_math_common::SizeU as fidl::encoding::ValueTypeMarker>::borrow,
20833                ),
20834                encoder,
20835                offset + cur_offset,
20836                depth,
20837            )?;
20838
20839            _prev_end_offset = cur_offset + envelope_size;
20840            if 16 > max_ordinal {
20841                return Ok(());
20842            }
20843
20844            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
20845            // are envelope_size bytes.
20846            let cur_offset: usize = (16 - 1) * envelope_size;
20847
20848            // Zero reserved fields.
20849            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
20850
20851            // Safety:
20852            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
20853            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
20854            //   envelope_size bytes, there is always sufficient room.
20855            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_images2_common::PixelFormat, D>(
20856            self.pixel_format.as_ref().map(<fidl_fuchsia_images2_common::PixelFormat as fidl::encoding::ValueTypeMarker>::borrow),
20857            encoder, offset + cur_offset, depth
20858        )?;
20859
20860            _prev_end_offset = cur_offset + envelope_size;
20861
20862            Ok(())
20863        }
20864    }
20865
20866    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
20867        for StreamBufferConstraints
20868    {
20869        #[inline(always)]
20870        fn new_empty() -> Self {
20871            Self::default()
20872        }
20873
20874        unsafe fn decode(
20875            &mut self,
20876            decoder: &mut fidl::encoding::Decoder<'_, D>,
20877            offset: usize,
20878            mut depth: fidl::encoding::Depth,
20879        ) -> fidl::Result<()> {
20880            decoder.debug_check_bounds::<Self>(offset);
20881            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
20882                None => return Err(fidl::Error::NotNullable),
20883                Some(len) => len,
20884            };
20885            // Calling decoder.out_of_line_offset(0) is not allowed.
20886            if len == 0 {
20887                return Ok(());
20888            };
20889            depth.increment()?;
20890            let envelope_size = 8;
20891            let bytes_len = len * envelope_size;
20892            let offset = decoder.out_of_line_offset(bytes_len)?;
20893            // Decode the envelope for each type.
20894            let mut _next_ordinal_to_read = 0;
20895            let mut next_offset = offset;
20896            let end_offset = offset + bytes_len;
20897            _next_ordinal_to_read += 1;
20898            if next_offset >= end_offset {
20899                return Ok(());
20900            }
20901
20902            // Decode unknown envelopes for gaps in ordinals.
20903            while _next_ordinal_to_read < 1 {
20904                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
20905                _next_ordinal_to_read += 1;
20906                next_offset += envelope_size;
20907            }
20908
20909            let next_out_of_line = decoder.next_out_of_line();
20910            let handles_before = decoder.remaining_handles();
20911            if let Some((inlined, num_bytes, num_handles)) =
20912                fidl::encoding::decode_envelope_header(decoder, next_offset)?
20913            {
20914                let member_inline_size =
20915                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
20916                if inlined != (member_inline_size <= 4) {
20917                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
20918                }
20919                let inner_offset;
20920                let mut inner_depth = depth.clone();
20921                if inlined {
20922                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
20923                    inner_offset = next_offset;
20924                } else {
20925                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
20926                    inner_depth.increment()?;
20927                }
20928                let val_ref = self
20929                    .buffer_constraints_version_ordinal
20930                    .get_or_insert_with(|| fidl::new_empty!(u64, D));
20931                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
20932                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
20933                {
20934                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
20935                }
20936                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
20937                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
20938                }
20939            }
20940
20941            next_offset += envelope_size;
20942            _next_ordinal_to_read += 1;
20943            if next_offset >= end_offset {
20944                return Ok(());
20945            }
20946
20947            // Decode unknown envelopes for gaps in ordinals.
20948            while _next_ordinal_to_read < 2 {
20949                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
20950                _next_ordinal_to_read += 1;
20951                next_offset += envelope_size;
20952            }
20953
20954            let next_out_of_line = decoder.next_out_of_line();
20955            let handles_before = decoder.remaining_handles();
20956            if let Some((inlined, num_bytes, num_handles)) =
20957                fidl::encoding::decode_envelope_header(decoder, next_offset)?
20958            {
20959                let member_inline_size =
20960                    <StreamBufferSettings as fidl::encoding::TypeMarker>::inline_size(
20961                        decoder.context,
20962                    );
20963                if inlined != (member_inline_size <= 4) {
20964                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
20965                }
20966                let inner_offset;
20967                let mut inner_depth = depth.clone();
20968                if inlined {
20969                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
20970                    inner_offset = next_offset;
20971                } else {
20972                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
20973                    inner_depth.increment()?;
20974                }
20975                let val_ref = self
20976                    .default_settings
20977                    .get_or_insert_with(|| fidl::new_empty!(StreamBufferSettings, D));
20978                fidl::decode!(
20979                    StreamBufferSettings,
20980                    D,
20981                    val_ref,
20982                    decoder,
20983                    inner_offset,
20984                    inner_depth
20985                )?;
20986                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
20987                {
20988                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
20989                }
20990                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
20991                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
20992                }
20993            }
20994
20995            next_offset += envelope_size;
20996            _next_ordinal_to_read += 1;
20997            if next_offset >= end_offset {
20998                return Ok(());
20999            }
21000
21001            // Decode unknown envelopes for gaps in ordinals.
21002            while _next_ordinal_to_read < 3 {
21003                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
21004                _next_ordinal_to_read += 1;
21005                next_offset += envelope_size;
21006            }
21007
21008            let next_out_of_line = decoder.next_out_of_line();
21009            let handles_before = decoder.remaining_handles();
21010            if let Some((inlined, num_bytes, num_handles)) =
21011                fidl::encoding::decode_envelope_header(decoder, next_offset)?
21012            {
21013                let member_inline_size =
21014                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
21015                if inlined != (member_inline_size <= 4) {
21016                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
21017                }
21018                let inner_offset;
21019                let mut inner_depth = depth.clone();
21020                if inlined {
21021                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
21022                    inner_offset = next_offset;
21023                } else {
21024                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
21025                    inner_depth.increment()?;
21026                }
21027                let val_ref = self
21028                    .per_packet_buffer_bytes_min
21029                    .get_or_insert_with(|| fidl::new_empty!(u32, D));
21030                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
21031                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
21032                {
21033                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
21034                }
21035                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
21036                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
21037                }
21038            }
21039
21040            next_offset += envelope_size;
21041            _next_ordinal_to_read += 1;
21042            if next_offset >= end_offset {
21043                return Ok(());
21044            }
21045
21046            // Decode unknown envelopes for gaps in ordinals.
21047            while _next_ordinal_to_read < 4 {
21048                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
21049                _next_ordinal_to_read += 1;
21050                next_offset += envelope_size;
21051            }
21052
21053            let next_out_of_line = decoder.next_out_of_line();
21054            let handles_before = decoder.remaining_handles();
21055            if let Some((inlined, num_bytes, num_handles)) =
21056                fidl::encoding::decode_envelope_header(decoder, next_offset)?
21057            {
21058                let member_inline_size =
21059                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
21060                if inlined != (member_inline_size <= 4) {
21061                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
21062                }
21063                let inner_offset;
21064                let mut inner_depth = depth.clone();
21065                if inlined {
21066                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
21067                    inner_offset = next_offset;
21068                } else {
21069                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
21070                    inner_depth.increment()?;
21071                }
21072                let val_ref = self
21073                    .per_packet_buffer_bytes_recommended
21074                    .get_or_insert_with(|| fidl::new_empty!(u32, D));
21075                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
21076                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
21077                {
21078                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
21079                }
21080                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
21081                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
21082                }
21083            }
21084
21085            next_offset += envelope_size;
21086            _next_ordinal_to_read += 1;
21087            if next_offset >= end_offset {
21088                return Ok(());
21089            }
21090
21091            // Decode unknown envelopes for gaps in ordinals.
21092            while _next_ordinal_to_read < 5 {
21093                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
21094                _next_ordinal_to_read += 1;
21095                next_offset += envelope_size;
21096            }
21097
21098            let next_out_of_line = decoder.next_out_of_line();
21099            let handles_before = decoder.remaining_handles();
21100            if let Some((inlined, num_bytes, num_handles)) =
21101                fidl::encoding::decode_envelope_header(decoder, next_offset)?
21102            {
21103                let member_inline_size =
21104                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
21105                if inlined != (member_inline_size <= 4) {
21106                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
21107                }
21108                let inner_offset;
21109                let mut inner_depth = depth.clone();
21110                if inlined {
21111                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
21112                    inner_offset = next_offset;
21113                } else {
21114                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
21115                    inner_depth.increment()?;
21116                }
21117                let val_ref = self
21118                    .per_packet_buffer_bytes_max
21119                    .get_or_insert_with(|| fidl::new_empty!(u32, D));
21120                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
21121                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
21122                {
21123                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
21124                }
21125                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
21126                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
21127                }
21128            }
21129
21130            next_offset += envelope_size;
21131            _next_ordinal_to_read += 1;
21132            if next_offset >= end_offset {
21133                return Ok(());
21134            }
21135
21136            // Decode unknown envelopes for gaps in ordinals.
21137            while _next_ordinal_to_read < 6 {
21138                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
21139                _next_ordinal_to_read += 1;
21140                next_offset += envelope_size;
21141            }
21142
21143            let next_out_of_line = decoder.next_out_of_line();
21144            let handles_before = decoder.remaining_handles();
21145            if let Some((inlined, num_bytes, num_handles)) =
21146                fidl::encoding::decode_envelope_header(decoder, next_offset)?
21147            {
21148                let member_inline_size =
21149                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
21150                if inlined != (member_inline_size <= 4) {
21151                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
21152                }
21153                let inner_offset;
21154                let mut inner_depth = depth.clone();
21155                if inlined {
21156                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
21157                    inner_offset = next_offset;
21158                } else {
21159                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
21160                    inner_depth.increment()?;
21161                }
21162                let val_ref = self
21163                    .packet_count_for_server_min
21164                    .get_or_insert_with(|| fidl::new_empty!(u32, D));
21165                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
21166                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
21167                {
21168                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
21169                }
21170                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
21171                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
21172                }
21173            }
21174
21175            next_offset += envelope_size;
21176            _next_ordinal_to_read += 1;
21177            if next_offset >= end_offset {
21178                return Ok(());
21179            }
21180
21181            // Decode unknown envelopes for gaps in ordinals.
21182            while _next_ordinal_to_read < 7 {
21183                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
21184                _next_ordinal_to_read += 1;
21185                next_offset += envelope_size;
21186            }
21187
21188            let next_out_of_line = decoder.next_out_of_line();
21189            let handles_before = decoder.remaining_handles();
21190            if let Some((inlined, num_bytes, num_handles)) =
21191                fidl::encoding::decode_envelope_header(decoder, next_offset)?
21192            {
21193                let member_inline_size =
21194                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
21195                if inlined != (member_inline_size <= 4) {
21196                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
21197                }
21198                let inner_offset;
21199                let mut inner_depth = depth.clone();
21200                if inlined {
21201                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
21202                    inner_offset = next_offset;
21203                } else {
21204                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
21205                    inner_depth.increment()?;
21206                }
21207                let val_ref = self
21208                    .packet_count_for_server_recommended
21209                    .get_or_insert_with(|| fidl::new_empty!(u32, D));
21210                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
21211                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
21212                {
21213                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
21214                }
21215                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
21216                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
21217                }
21218            }
21219
21220            next_offset += envelope_size;
21221            _next_ordinal_to_read += 1;
21222            if next_offset >= end_offset {
21223                return Ok(());
21224            }
21225
21226            // Decode unknown envelopes for gaps in ordinals.
21227            while _next_ordinal_to_read < 8 {
21228                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
21229                _next_ordinal_to_read += 1;
21230                next_offset += envelope_size;
21231            }
21232
21233            let next_out_of_line = decoder.next_out_of_line();
21234            let handles_before = decoder.remaining_handles();
21235            if let Some((inlined, num_bytes, num_handles)) =
21236                fidl::encoding::decode_envelope_header(decoder, next_offset)?
21237            {
21238                let member_inline_size =
21239                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
21240                if inlined != (member_inline_size <= 4) {
21241                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
21242                }
21243                let inner_offset;
21244                let mut inner_depth = depth.clone();
21245                if inlined {
21246                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
21247                    inner_offset = next_offset;
21248                } else {
21249                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
21250                    inner_depth.increment()?;
21251                }
21252                let val_ref = self
21253                    .packet_count_for_server_recommended_max
21254                    .get_or_insert_with(|| fidl::new_empty!(u32, D));
21255                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
21256                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
21257                {
21258                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
21259                }
21260                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
21261                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
21262                }
21263            }
21264
21265            next_offset += envelope_size;
21266            _next_ordinal_to_read += 1;
21267            if next_offset >= end_offset {
21268                return Ok(());
21269            }
21270
21271            // Decode unknown envelopes for gaps in ordinals.
21272            while _next_ordinal_to_read < 9 {
21273                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
21274                _next_ordinal_to_read += 1;
21275                next_offset += envelope_size;
21276            }
21277
21278            let next_out_of_line = decoder.next_out_of_line();
21279            let handles_before = decoder.remaining_handles();
21280            if let Some((inlined, num_bytes, num_handles)) =
21281                fidl::encoding::decode_envelope_header(decoder, next_offset)?
21282            {
21283                let member_inline_size =
21284                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
21285                if inlined != (member_inline_size <= 4) {
21286                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
21287                }
21288                let inner_offset;
21289                let mut inner_depth = depth.clone();
21290                if inlined {
21291                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
21292                    inner_offset = next_offset;
21293                } else {
21294                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
21295                    inner_depth.increment()?;
21296                }
21297                let val_ref = self
21298                    .packet_count_for_server_max
21299                    .get_or_insert_with(|| fidl::new_empty!(u32, D));
21300                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
21301                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
21302                {
21303                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
21304                }
21305                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
21306                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
21307                }
21308            }
21309
21310            next_offset += envelope_size;
21311            _next_ordinal_to_read += 1;
21312            if next_offset >= end_offset {
21313                return Ok(());
21314            }
21315
21316            // Decode unknown envelopes for gaps in ordinals.
21317            while _next_ordinal_to_read < 10 {
21318                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
21319                _next_ordinal_to_read += 1;
21320                next_offset += envelope_size;
21321            }
21322
21323            let next_out_of_line = decoder.next_out_of_line();
21324            let handles_before = decoder.remaining_handles();
21325            if let Some((inlined, num_bytes, num_handles)) =
21326                fidl::encoding::decode_envelope_header(decoder, next_offset)?
21327            {
21328                let member_inline_size =
21329                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
21330                if inlined != (member_inline_size <= 4) {
21331                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
21332                }
21333                let inner_offset;
21334                let mut inner_depth = depth.clone();
21335                if inlined {
21336                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
21337                    inner_offset = next_offset;
21338                } else {
21339                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
21340                    inner_depth.increment()?;
21341                }
21342                let val_ref = self
21343                    .packet_count_for_client_min
21344                    .get_or_insert_with(|| fidl::new_empty!(u32, D));
21345                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
21346                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
21347                {
21348                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
21349                }
21350                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
21351                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
21352                }
21353            }
21354
21355            next_offset += envelope_size;
21356            _next_ordinal_to_read += 1;
21357            if next_offset >= end_offset {
21358                return Ok(());
21359            }
21360
21361            // Decode unknown envelopes for gaps in ordinals.
21362            while _next_ordinal_to_read < 11 {
21363                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
21364                _next_ordinal_to_read += 1;
21365                next_offset += envelope_size;
21366            }
21367
21368            let next_out_of_line = decoder.next_out_of_line();
21369            let handles_before = decoder.remaining_handles();
21370            if let Some((inlined, num_bytes, num_handles)) =
21371                fidl::encoding::decode_envelope_header(decoder, next_offset)?
21372            {
21373                let member_inline_size =
21374                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
21375                if inlined != (member_inline_size <= 4) {
21376                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
21377                }
21378                let inner_offset;
21379                let mut inner_depth = depth.clone();
21380                if inlined {
21381                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
21382                    inner_offset = next_offset;
21383                } else {
21384                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
21385                    inner_depth.increment()?;
21386                }
21387                let val_ref = self
21388                    .packet_count_for_client_max
21389                    .get_or_insert_with(|| fidl::new_empty!(u32, D));
21390                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
21391                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
21392                {
21393                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
21394                }
21395                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
21396                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
21397                }
21398            }
21399
21400            next_offset += envelope_size;
21401            _next_ordinal_to_read += 1;
21402            if next_offset >= end_offset {
21403                return Ok(());
21404            }
21405
21406            // Decode unknown envelopes for gaps in ordinals.
21407            while _next_ordinal_to_read < 12 {
21408                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
21409                _next_ordinal_to_read += 1;
21410                next_offset += envelope_size;
21411            }
21412
21413            let next_out_of_line = decoder.next_out_of_line();
21414            let handles_before = decoder.remaining_handles();
21415            if let Some((inlined, num_bytes, num_handles)) =
21416                fidl::encoding::decode_envelope_header(decoder, next_offset)?
21417            {
21418                let member_inline_size =
21419                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
21420                if inlined != (member_inline_size <= 4) {
21421                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
21422                }
21423                let inner_offset;
21424                let mut inner_depth = depth.clone();
21425                if inlined {
21426                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
21427                    inner_offset = next_offset;
21428                } else {
21429                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
21430                    inner_depth.increment()?;
21431                }
21432                let val_ref = self
21433                    .single_buffer_mode_allowed
21434                    .get_or_insert_with(|| fidl::new_empty!(bool, D));
21435                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
21436                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
21437                {
21438                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
21439                }
21440                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
21441                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
21442                }
21443            }
21444
21445            next_offset += envelope_size;
21446            _next_ordinal_to_read += 1;
21447            if next_offset >= end_offset {
21448                return Ok(());
21449            }
21450
21451            // Decode unknown envelopes for gaps in ordinals.
21452            while _next_ordinal_to_read < 13 {
21453                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
21454                _next_ordinal_to_read += 1;
21455                next_offset += envelope_size;
21456            }
21457
21458            let next_out_of_line = decoder.next_out_of_line();
21459            let handles_before = decoder.remaining_handles();
21460            if let Some((inlined, num_bytes, num_handles)) =
21461                fidl::encoding::decode_envelope_header(decoder, next_offset)?
21462            {
21463                let member_inline_size =
21464                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
21465                if inlined != (member_inline_size <= 4) {
21466                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
21467                }
21468                let inner_offset;
21469                let mut inner_depth = depth.clone();
21470                if inlined {
21471                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
21472                    inner_offset = next_offset;
21473                } else {
21474                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
21475                    inner_depth.increment()?;
21476                }
21477                let val_ref = self
21478                    .is_physically_contiguous_required
21479                    .get_or_insert_with(|| fidl::new_empty!(bool, D));
21480                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
21481                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
21482                {
21483                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
21484                }
21485                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
21486                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
21487                }
21488            }
21489
21490            next_offset += envelope_size;
21491            _next_ordinal_to_read += 1;
21492            if next_offset >= end_offset {
21493                return Ok(());
21494            }
21495
21496            // Decode unknown envelopes for gaps in ordinals.
21497            while _next_ordinal_to_read < 14 {
21498                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
21499                _next_ordinal_to_read += 1;
21500                next_offset += envelope_size;
21501            }
21502
21503            let next_out_of_line = decoder.next_out_of_line();
21504            let handles_before = decoder.remaining_handles();
21505            if let Some((inlined, num_bytes, num_handles)) =
21506                fidl::encoding::decode_envelope_header(decoder, next_offset)?
21507            {
21508                let member_inline_size =
21509                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
21510                if inlined != (member_inline_size <= 4) {
21511                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
21512                }
21513                let inner_offset;
21514                let mut inner_depth = depth.clone();
21515                if inlined {
21516                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
21517                    inner_offset = next_offset;
21518                } else {
21519                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
21520                    inner_depth.increment()?;
21521                }
21522                let val_ref = self
21523                    .buffer_count_for_server_current
21524                    .get_or_insert_with(|| fidl::new_empty!(u32, D));
21525                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
21526                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
21527                {
21528                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
21529                }
21530                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
21531                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
21532                }
21533            }
21534
21535            next_offset += envelope_size;
21536            _next_ordinal_to_read += 1;
21537            if next_offset >= end_offset {
21538                return Ok(());
21539            }
21540
21541            // Decode unknown envelopes for gaps in ordinals.
21542            while _next_ordinal_to_read < 15 {
21543                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
21544                _next_ordinal_to_read += 1;
21545                next_offset += envelope_size;
21546            }
21547
21548            let next_out_of_line = decoder.next_out_of_line();
21549            let handles_before = decoder.remaining_handles();
21550            if let Some((inlined, num_bytes, num_handles)) =
21551                fidl::encoding::decode_envelope_header(decoder, next_offset)?
21552            {
21553                let member_inline_size =
21554                    <fidl_fuchsia_math_common::SizeU as fidl::encoding::TypeMarker>::inline_size(
21555                        decoder.context,
21556                    );
21557                if inlined != (member_inline_size <= 4) {
21558                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
21559                }
21560                let inner_offset;
21561                let mut inner_depth = depth.clone();
21562                if inlined {
21563                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
21564                    inner_offset = next_offset;
21565                } else {
21566                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
21567                    inner_depth.increment()?;
21568                }
21569                let val_ref = self
21570                    .size
21571                    .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_math_common::SizeU, D));
21572                fidl::decode!(
21573                    fidl_fuchsia_math_common::SizeU,
21574                    D,
21575                    val_ref,
21576                    decoder,
21577                    inner_offset,
21578                    inner_depth
21579                )?;
21580                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
21581                {
21582                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
21583                }
21584                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
21585                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
21586                }
21587            }
21588
21589            next_offset += envelope_size;
21590            _next_ordinal_to_read += 1;
21591            if next_offset >= end_offset {
21592                return Ok(());
21593            }
21594
21595            // Decode unknown envelopes for gaps in ordinals.
21596            while _next_ordinal_to_read < 16 {
21597                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
21598                _next_ordinal_to_read += 1;
21599                next_offset += envelope_size;
21600            }
21601
21602            let next_out_of_line = decoder.next_out_of_line();
21603            let handles_before = decoder.remaining_handles();
21604            if let Some((inlined, num_bytes, num_handles)) =
21605                fidl::encoding::decode_envelope_header(decoder, next_offset)?
21606            {
21607                let member_inline_size = <fidl_fuchsia_images2_common::PixelFormat as fidl::encoding::TypeMarker>::inline_size(decoder.context);
21608                if inlined != (member_inline_size <= 4) {
21609                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
21610                }
21611                let inner_offset;
21612                let mut inner_depth = depth.clone();
21613                if inlined {
21614                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
21615                    inner_offset = next_offset;
21616                } else {
21617                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
21618                    inner_depth.increment()?;
21619                }
21620                let val_ref = self.pixel_format.get_or_insert_with(|| {
21621                    fidl::new_empty!(fidl_fuchsia_images2_common::PixelFormat, D)
21622                });
21623                fidl::decode!(
21624                    fidl_fuchsia_images2_common::PixelFormat,
21625                    D,
21626                    val_ref,
21627                    decoder,
21628                    inner_offset,
21629                    inner_depth
21630                )?;
21631                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
21632                {
21633                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
21634                }
21635                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
21636                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
21637                }
21638            }
21639
21640            next_offset += envelope_size;
21641
21642            // Decode the remaining unknown envelopes.
21643            while next_offset < end_offset {
21644                _next_ordinal_to_read += 1;
21645                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
21646                next_offset += envelope_size;
21647            }
21648
21649            Ok(())
21650        }
21651    }
21652
21653    impl StreamBufferSettings {
21654        #[inline(always)]
21655        fn max_ordinal_present(&self) -> u64 {
21656            if let Some(_) = self.single_buffer_mode {
21657                return 6;
21658            }
21659            if let Some(_) = self.per_packet_buffer_bytes {
21660                return 5;
21661            }
21662            if let Some(_) = self.packet_count_for_client {
21663                return 4;
21664            }
21665            if let Some(_) = self.packet_count_for_server {
21666                return 3;
21667            }
21668            if let Some(_) = self.buffer_constraints_version_ordinal {
21669                return 2;
21670            }
21671            if let Some(_) = self.buffer_lifetime_ordinal {
21672                return 1;
21673            }
21674            0
21675        }
21676    }
21677
21678    impl fidl::encoding::ValueTypeMarker for StreamBufferSettings {
21679        type Borrowed<'a> = &'a Self;
21680        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
21681            value
21682        }
21683    }
21684
21685    unsafe impl fidl::encoding::TypeMarker for StreamBufferSettings {
21686        type Owned = Self;
21687
21688        #[inline(always)]
21689        fn inline_align(_context: fidl::encoding::Context) -> usize {
21690            8
21691        }
21692
21693        #[inline(always)]
21694        fn inline_size(_context: fidl::encoding::Context) -> usize {
21695            16
21696        }
21697    }
21698
21699    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StreamBufferSettings, D>
21700        for &StreamBufferSettings
21701    {
21702        unsafe fn encode(
21703            self,
21704            encoder: &mut fidl::encoding::Encoder<'_, D>,
21705            offset: usize,
21706            mut depth: fidl::encoding::Depth,
21707        ) -> fidl::Result<()> {
21708            encoder.debug_check_bounds::<StreamBufferSettings>(offset);
21709            // Vector header
21710            let max_ordinal: u64 = self.max_ordinal_present();
21711            encoder.write_num(max_ordinal, offset);
21712            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
21713            // Calling encoder.out_of_line_offset(0) is not allowed.
21714            if max_ordinal == 0 {
21715                return Ok(());
21716            }
21717            depth.increment()?;
21718            let envelope_size = 8;
21719            let bytes_len = max_ordinal as usize * envelope_size;
21720            #[allow(unused_variables)]
21721            let offset = encoder.out_of_line_offset(bytes_len);
21722            let mut _prev_end_offset: usize = 0;
21723            if 1 > max_ordinal {
21724                return Ok(());
21725            }
21726
21727            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
21728            // are envelope_size bytes.
21729            let cur_offset: usize = (1 - 1) * envelope_size;
21730
21731            // Zero reserved fields.
21732            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
21733
21734            // Safety:
21735            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
21736            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
21737            //   envelope_size bytes, there is always sufficient room.
21738            fidl::encoding::encode_in_envelope_optional::<u64, D>(
21739                self.buffer_lifetime_ordinal
21740                    .as_ref()
21741                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
21742                encoder,
21743                offset + cur_offset,
21744                depth,
21745            )?;
21746
21747            _prev_end_offset = cur_offset + envelope_size;
21748            if 2 > max_ordinal {
21749                return Ok(());
21750            }
21751
21752            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
21753            // are envelope_size bytes.
21754            let cur_offset: usize = (2 - 1) * envelope_size;
21755
21756            // Zero reserved fields.
21757            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
21758
21759            // Safety:
21760            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
21761            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
21762            //   envelope_size bytes, there is always sufficient room.
21763            fidl::encoding::encode_in_envelope_optional::<u64, D>(
21764                self.buffer_constraints_version_ordinal
21765                    .as_ref()
21766                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
21767                encoder,
21768                offset + cur_offset,
21769                depth,
21770            )?;
21771
21772            _prev_end_offset = cur_offset + envelope_size;
21773            if 3 > max_ordinal {
21774                return Ok(());
21775            }
21776
21777            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
21778            // are envelope_size bytes.
21779            let cur_offset: usize = (3 - 1) * envelope_size;
21780
21781            // Zero reserved fields.
21782            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
21783
21784            // Safety:
21785            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
21786            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
21787            //   envelope_size bytes, there is always sufficient room.
21788            fidl::encoding::encode_in_envelope_optional::<u32, D>(
21789                self.packet_count_for_server
21790                    .as_ref()
21791                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
21792                encoder,
21793                offset + cur_offset,
21794                depth,
21795            )?;
21796
21797            _prev_end_offset = cur_offset + envelope_size;
21798            if 4 > max_ordinal {
21799                return Ok(());
21800            }
21801
21802            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
21803            // are envelope_size bytes.
21804            let cur_offset: usize = (4 - 1) * envelope_size;
21805
21806            // Zero reserved fields.
21807            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
21808
21809            // Safety:
21810            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
21811            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
21812            //   envelope_size bytes, there is always sufficient room.
21813            fidl::encoding::encode_in_envelope_optional::<u32, D>(
21814                self.packet_count_for_client
21815                    .as_ref()
21816                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
21817                encoder,
21818                offset + cur_offset,
21819                depth,
21820            )?;
21821
21822            _prev_end_offset = cur_offset + envelope_size;
21823            if 5 > max_ordinal {
21824                return Ok(());
21825            }
21826
21827            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
21828            // are envelope_size bytes.
21829            let cur_offset: usize = (5 - 1) * envelope_size;
21830
21831            // Zero reserved fields.
21832            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
21833
21834            // Safety:
21835            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
21836            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
21837            //   envelope_size bytes, there is always sufficient room.
21838            fidl::encoding::encode_in_envelope_optional::<u32, D>(
21839                self.per_packet_buffer_bytes
21840                    .as_ref()
21841                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
21842                encoder,
21843                offset + cur_offset,
21844                depth,
21845            )?;
21846
21847            _prev_end_offset = cur_offset + envelope_size;
21848            if 6 > max_ordinal {
21849                return Ok(());
21850            }
21851
21852            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
21853            // are envelope_size bytes.
21854            let cur_offset: usize = (6 - 1) * envelope_size;
21855
21856            // Zero reserved fields.
21857            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
21858
21859            // Safety:
21860            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
21861            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
21862            //   envelope_size bytes, there is always sufficient room.
21863            fidl::encoding::encode_in_envelope_optional::<bool, D>(
21864                self.single_buffer_mode
21865                    .as_ref()
21866                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
21867                encoder,
21868                offset + cur_offset,
21869                depth,
21870            )?;
21871
21872            _prev_end_offset = cur_offset + envelope_size;
21873
21874            Ok(())
21875        }
21876    }
21877
21878    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StreamBufferSettings {
21879        #[inline(always)]
21880        fn new_empty() -> Self {
21881            Self::default()
21882        }
21883
21884        unsafe fn decode(
21885            &mut self,
21886            decoder: &mut fidl::encoding::Decoder<'_, D>,
21887            offset: usize,
21888            mut depth: fidl::encoding::Depth,
21889        ) -> fidl::Result<()> {
21890            decoder.debug_check_bounds::<Self>(offset);
21891            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
21892                None => return Err(fidl::Error::NotNullable),
21893                Some(len) => len,
21894            };
21895            // Calling decoder.out_of_line_offset(0) is not allowed.
21896            if len == 0 {
21897                return Ok(());
21898            };
21899            depth.increment()?;
21900            let envelope_size = 8;
21901            let bytes_len = len * envelope_size;
21902            let offset = decoder.out_of_line_offset(bytes_len)?;
21903            // Decode the envelope for each type.
21904            let mut _next_ordinal_to_read = 0;
21905            let mut next_offset = offset;
21906            let end_offset = offset + bytes_len;
21907            _next_ordinal_to_read += 1;
21908            if next_offset >= end_offset {
21909                return Ok(());
21910            }
21911
21912            // Decode unknown envelopes for gaps in ordinals.
21913            while _next_ordinal_to_read < 1 {
21914                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
21915                _next_ordinal_to_read += 1;
21916                next_offset += envelope_size;
21917            }
21918
21919            let next_out_of_line = decoder.next_out_of_line();
21920            let handles_before = decoder.remaining_handles();
21921            if let Some((inlined, num_bytes, num_handles)) =
21922                fidl::encoding::decode_envelope_header(decoder, next_offset)?
21923            {
21924                let member_inline_size =
21925                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
21926                if inlined != (member_inline_size <= 4) {
21927                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
21928                }
21929                let inner_offset;
21930                let mut inner_depth = depth.clone();
21931                if inlined {
21932                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
21933                    inner_offset = next_offset;
21934                } else {
21935                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
21936                    inner_depth.increment()?;
21937                }
21938                let val_ref =
21939                    self.buffer_lifetime_ordinal.get_or_insert_with(|| fidl::new_empty!(u64, D));
21940                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
21941                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
21942                {
21943                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
21944                }
21945                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
21946                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
21947                }
21948            }
21949
21950            next_offset += envelope_size;
21951            _next_ordinal_to_read += 1;
21952            if next_offset >= end_offset {
21953                return Ok(());
21954            }
21955
21956            // Decode unknown envelopes for gaps in ordinals.
21957            while _next_ordinal_to_read < 2 {
21958                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
21959                _next_ordinal_to_read += 1;
21960                next_offset += envelope_size;
21961            }
21962
21963            let next_out_of_line = decoder.next_out_of_line();
21964            let handles_before = decoder.remaining_handles();
21965            if let Some((inlined, num_bytes, num_handles)) =
21966                fidl::encoding::decode_envelope_header(decoder, next_offset)?
21967            {
21968                let member_inline_size =
21969                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
21970                if inlined != (member_inline_size <= 4) {
21971                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
21972                }
21973                let inner_offset;
21974                let mut inner_depth = depth.clone();
21975                if inlined {
21976                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
21977                    inner_offset = next_offset;
21978                } else {
21979                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
21980                    inner_depth.increment()?;
21981                }
21982                let val_ref = self
21983                    .buffer_constraints_version_ordinal
21984                    .get_or_insert_with(|| fidl::new_empty!(u64, D));
21985                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
21986                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
21987                {
21988                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
21989                }
21990                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
21991                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
21992                }
21993            }
21994
21995            next_offset += envelope_size;
21996            _next_ordinal_to_read += 1;
21997            if next_offset >= end_offset {
21998                return Ok(());
21999            }
22000
22001            // Decode unknown envelopes for gaps in ordinals.
22002            while _next_ordinal_to_read < 3 {
22003                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
22004                _next_ordinal_to_read += 1;
22005                next_offset += envelope_size;
22006            }
22007
22008            let next_out_of_line = decoder.next_out_of_line();
22009            let handles_before = decoder.remaining_handles();
22010            if let Some((inlined, num_bytes, num_handles)) =
22011                fidl::encoding::decode_envelope_header(decoder, next_offset)?
22012            {
22013                let member_inline_size =
22014                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
22015                if inlined != (member_inline_size <= 4) {
22016                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
22017                }
22018                let inner_offset;
22019                let mut inner_depth = depth.clone();
22020                if inlined {
22021                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
22022                    inner_offset = next_offset;
22023                } else {
22024                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
22025                    inner_depth.increment()?;
22026                }
22027                let val_ref =
22028                    self.packet_count_for_server.get_or_insert_with(|| fidl::new_empty!(u32, D));
22029                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
22030                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
22031                {
22032                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
22033                }
22034                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
22035                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
22036                }
22037            }
22038
22039            next_offset += envelope_size;
22040            _next_ordinal_to_read += 1;
22041            if next_offset >= end_offset {
22042                return Ok(());
22043            }
22044
22045            // Decode unknown envelopes for gaps in ordinals.
22046            while _next_ordinal_to_read < 4 {
22047                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
22048                _next_ordinal_to_read += 1;
22049                next_offset += envelope_size;
22050            }
22051
22052            let next_out_of_line = decoder.next_out_of_line();
22053            let handles_before = decoder.remaining_handles();
22054            if let Some((inlined, num_bytes, num_handles)) =
22055                fidl::encoding::decode_envelope_header(decoder, next_offset)?
22056            {
22057                let member_inline_size =
22058                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
22059                if inlined != (member_inline_size <= 4) {
22060                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
22061                }
22062                let inner_offset;
22063                let mut inner_depth = depth.clone();
22064                if inlined {
22065                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
22066                    inner_offset = next_offset;
22067                } else {
22068                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
22069                    inner_depth.increment()?;
22070                }
22071                let val_ref =
22072                    self.packet_count_for_client.get_or_insert_with(|| fidl::new_empty!(u32, D));
22073                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
22074                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
22075                {
22076                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
22077                }
22078                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
22079                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
22080                }
22081            }
22082
22083            next_offset += envelope_size;
22084            _next_ordinal_to_read += 1;
22085            if next_offset >= end_offset {
22086                return Ok(());
22087            }
22088
22089            // Decode unknown envelopes for gaps in ordinals.
22090            while _next_ordinal_to_read < 5 {
22091                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
22092                _next_ordinal_to_read += 1;
22093                next_offset += envelope_size;
22094            }
22095
22096            let next_out_of_line = decoder.next_out_of_line();
22097            let handles_before = decoder.remaining_handles();
22098            if let Some((inlined, num_bytes, num_handles)) =
22099                fidl::encoding::decode_envelope_header(decoder, next_offset)?
22100            {
22101                let member_inline_size =
22102                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
22103                if inlined != (member_inline_size <= 4) {
22104                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
22105                }
22106                let inner_offset;
22107                let mut inner_depth = depth.clone();
22108                if inlined {
22109                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
22110                    inner_offset = next_offset;
22111                } else {
22112                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
22113                    inner_depth.increment()?;
22114                }
22115                let val_ref =
22116                    self.per_packet_buffer_bytes.get_or_insert_with(|| fidl::new_empty!(u32, D));
22117                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
22118                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
22119                {
22120                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
22121                }
22122                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
22123                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
22124                }
22125            }
22126
22127            next_offset += envelope_size;
22128            _next_ordinal_to_read += 1;
22129            if next_offset >= end_offset {
22130                return Ok(());
22131            }
22132
22133            // Decode unknown envelopes for gaps in ordinals.
22134            while _next_ordinal_to_read < 6 {
22135                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
22136                _next_ordinal_to_read += 1;
22137                next_offset += envelope_size;
22138            }
22139
22140            let next_out_of_line = decoder.next_out_of_line();
22141            let handles_before = decoder.remaining_handles();
22142            if let Some((inlined, num_bytes, num_handles)) =
22143                fidl::encoding::decode_envelope_header(decoder, next_offset)?
22144            {
22145                let member_inline_size =
22146                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
22147                if inlined != (member_inline_size <= 4) {
22148                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
22149                }
22150                let inner_offset;
22151                let mut inner_depth = depth.clone();
22152                if inlined {
22153                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
22154                    inner_offset = next_offset;
22155                } else {
22156                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
22157                    inner_depth.increment()?;
22158                }
22159                let val_ref =
22160                    self.single_buffer_mode.get_or_insert_with(|| fidl::new_empty!(bool, D));
22161                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
22162                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
22163                {
22164                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
22165                }
22166                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
22167                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
22168                }
22169            }
22170
22171            next_offset += envelope_size;
22172
22173            // Decode the remaining unknown envelopes.
22174            while next_offset < end_offset {
22175                _next_ordinal_to_read += 1;
22176                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
22177                next_offset += envelope_size;
22178            }
22179
22180            Ok(())
22181        }
22182    }
22183
22184    impl StreamOutputConstraints {
22185        #[inline(always)]
22186        fn max_ordinal_present(&self) -> u64 {
22187            if let Some(_) = self.buffer_constraints {
22188                return 3;
22189            }
22190            if let Some(_) = self.buffer_constraints_action_required {
22191                return 2;
22192            }
22193            if let Some(_) = self.stream_lifetime_ordinal {
22194                return 1;
22195            }
22196            0
22197        }
22198    }
22199
22200    impl fidl::encoding::ValueTypeMarker for StreamOutputConstraints {
22201        type Borrowed<'a> = &'a Self;
22202        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
22203            value
22204        }
22205    }
22206
22207    unsafe impl fidl::encoding::TypeMarker for StreamOutputConstraints {
22208        type Owned = Self;
22209
22210        #[inline(always)]
22211        fn inline_align(_context: fidl::encoding::Context) -> usize {
22212            8
22213        }
22214
22215        #[inline(always)]
22216        fn inline_size(_context: fidl::encoding::Context) -> usize {
22217            16
22218        }
22219    }
22220
22221    unsafe impl<D: fidl::encoding::ResourceDialect>
22222        fidl::encoding::Encode<StreamOutputConstraints, D> for &StreamOutputConstraints
22223    {
22224        unsafe fn encode(
22225            self,
22226            encoder: &mut fidl::encoding::Encoder<'_, D>,
22227            offset: usize,
22228            mut depth: fidl::encoding::Depth,
22229        ) -> fidl::Result<()> {
22230            encoder.debug_check_bounds::<StreamOutputConstraints>(offset);
22231            // Vector header
22232            let max_ordinal: u64 = self.max_ordinal_present();
22233            encoder.write_num(max_ordinal, offset);
22234            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
22235            // Calling encoder.out_of_line_offset(0) is not allowed.
22236            if max_ordinal == 0 {
22237                return Ok(());
22238            }
22239            depth.increment()?;
22240            let envelope_size = 8;
22241            let bytes_len = max_ordinal as usize * envelope_size;
22242            #[allow(unused_variables)]
22243            let offset = encoder.out_of_line_offset(bytes_len);
22244            let mut _prev_end_offset: usize = 0;
22245            if 1 > max_ordinal {
22246                return Ok(());
22247            }
22248
22249            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
22250            // are envelope_size bytes.
22251            let cur_offset: usize = (1 - 1) * envelope_size;
22252
22253            // Zero reserved fields.
22254            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
22255
22256            // Safety:
22257            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
22258            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
22259            //   envelope_size bytes, there is always sufficient room.
22260            fidl::encoding::encode_in_envelope_optional::<u64, D>(
22261                self.stream_lifetime_ordinal
22262                    .as_ref()
22263                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
22264                encoder,
22265                offset + cur_offset,
22266                depth,
22267            )?;
22268
22269            _prev_end_offset = cur_offset + envelope_size;
22270            if 2 > max_ordinal {
22271                return Ok(());
22272            }
22273
22274            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
22275            // are envelope_size bytes.
22276            let cur_offset: usize = (2 - 1) * envelope_size;
22277
22278            // Zero reserved fields.
22279            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
22280
22281            // Safety:
22282            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
22283            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
22284            //   envelope_size bytes, there is always sufficient room.
22285            fidl::encoding::encode_in_envelope_optional::<bool, D>(
22286                self.buffer_constraints_action_required
22287                    .as_ref()
22288                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
22289                encoder,
22290                offset + cur_offset,
22291                depth,
22292            )?;
22293
22294            _prev_end_offset = cur_offset + envelope_size;
22295            if 3 > max_ordinal {
22296                return Ok(());
22297            }
22298
22299            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
22300            // are envelope_size bytes.
22301            let cur_offset: usize = (3 - 1) * envelope_size;
22302
22303            // Zero reserved fields.
22304            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
22305
22306            // Safety:
22307            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
22308            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
22309            //   envelope_size bytes, there is always sufficient room.
22310            fidl::encoding::encode_in_envelope_optional::<StreamBufferConstraints, D>(
22311                self.buffer_constraints
22312                    .as_ref()
22313                    .map(<StreamBufferConstraints as fidl::encoding::ValueTypeMarker>::borrow),
22314                encoder,
22315                offset + cur_offset,
22316                depth,
22317            )?;
22318
22319            _prev_end_offset = cur_offset + envelope_size;
22320
22321            Ok(())
22322        }
22323    }
22324
22325    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
22326        for StreamOutputConstraints
22327    {
22328        #[inline(always)]
22329        fn new_empty() -> Self {
22330            Self::default()
22331        }
22332
22333        unsafe fn decode(
22334            &mut self,
22335            decoder: &mut fidl::encoding::Decoder<'_, D>,
22336            offset: usize,
22337            mut depth: fidl::encoding::Depth,
22338        ) -> fidl::Result<()> {
22339            decoder.debug_check_bounds::<Self>(offset);
22340            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
22341                None => return Err(fidl::Error::NotNullable),
22342                Some(len) => len,
22343            };
22344            // Calling decoder.out_of_line_offset(0) is not allowed.
22345            if len == 0 {
22346                return Ok(());
22347            };
22348            depth.increment()?;
22349            let envelope_size = 8;
22350            let bytes_len = len * envelope_size;
22351            let offset = decoder.out_of_line_offset(bytes_len)?;
22352            // Decode the envelope for each type.
22353            let mut _next_ordinal_to_read = 0;
22354            let mut next_offset = offset;
22355            let end_offset = offset + bytes_len;
22356            _next_ordinal_to_read += 1;
22357            if next_offset >= end_offset {
22358                return Ok(());
22359            }
22360
22361            // Decode unknown envelopes for gaps in ordinals.
22362            while _next_ordinal_to_read < 1 {
22363                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
22364                _next_ordinal_to_read += 1;
22365                next_offset += envelope_size;
22366            }
22367
22368            let next_out_of_line = decoder.next_out_of_line();
22369            let handles_before = decoder.remaining_handles();
22370            if let Some((inlined, num_bytes, num_handles)) =
22371                fidl::encoding::decode_envelope_header(decoder, next_offset)?
22372            {
22373                let member_inline_size =
22374                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
22375                if inlined != (member_inline_size <= 4) {
22376                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
22377                }
22378                let inner_offset;
22379                let mut inner_depth = depth.clone();
22380                if inlined {
22381                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
22382                    inner_offset = next_offset;
22383                } else {
22384                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
22385                    inner_depth.increment()?;
22386                }
22387                let val_ref =
22388                    self.stream_lifetime_ordinal.get_or_insert_with(|| fidl::new_empty!(u64, D));
22389                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
22390                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
22391                {
22392                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
22393                }
22394                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
22395                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
22396                }
22397            }
22398
22399            next_offset += envelope_size;
22400            _next_ordinal_to_read += 1;
22401            if next_offset >= end_offset {
22402                return Ok(());
22403            }
22404
22405            // Decode unknown envelopes for gaps in ordinals.
22406            while _next_ordinal_to_read < 2 {
22407                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
22408                _next_ordinal_to_read += 1;
22409                next_offset += envelope_size;
22410            }
22411
22412            let next_out_of_line = decoder.next_out_of_line();
22413            let handles_before = decoder.remaining_handles();
22414            if let Some((inlined, num_bytes, num_handles)) =
22415                fidl::encoding::decode_envelope_header(decoder, next_offset)?
22416            {
22417                let member_inline_size =
22418                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
22419                if inlined != (member_inline_size <= 4) {
22420                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
22421                }
22422                let inner_offset;
22423                let mut inner_depth = depth.clone();
22424                if inlined {
22425                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
22426                    inner_offset = next_offset;
22427                } else {
22428                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
22429                    inner_depth.increment()?;
22430                }
22431                let val_ref = self
22432                    .buffer_constraints_action_required
22433                    .get_or_insert_with(|| fidl::new_empty!(bool, D));
22434                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
22435                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
22436                {
22437                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
22438                }
22439                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
22440                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
22441                }
22442            }
22443
22444            next_offset += envelope_size;
22445            _next_ordinal_to_read += 1;
22446            if next_offset >= end_offset {
22447                return Ok(());
22448            }
22449
22450            // Decode unknown envelopes for gaps in ordinals.
22451            while _next_ordinal_to_read < 3 {
22452                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
22453                _next_ordinal_to_read += 1;
22454                next_offset += envelope_size;
22455            }
22456
22457            let next_out_of_line = decoder.next_out_of_line();
22458            let handles_before = decoder.remaining_handles();
22459            if let Some((inlined, num_bytes, num_handles)) =
22460                fidl::encoding::decode_envelope_header(decoder, next_offset)?
22461            {
22462                let member_inline_size =
22463                    <StreamBufferConstraints as fidl::encoding::TypeMarker>::inline_size(
22464                        decoder.context,
22465                    );
22466                if inlined != (member_inline_size <= 4) {
22467                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
22468                }
22469                let inner_offset;
22470                let mut inner_depth = depth.clone();
22471                if inlined {
22472                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
22473                    inner_offset = next_offset;
22474                } else {
22475                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
22476                    inner_depth.increment()?;
22477                }
22478                let val_ref = self
22479                    .buffer_constraints
22480                    .get_or_insert_with(|| fidl::new_empty!(StreamBufferConstraints, D));
22481                fidl::decode!(
22482                    StreamBufferConstraints,
22483                    D,
22484                    val_ref,
22485                    decoder,
22486                    inner_offset,
22487                    inner_depth
22488                )?;
22489                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
22490                {
22491                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
22492                }
22493                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
22494                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
22495                }
22496            }
22497
22498            next_offset += envelope_size;
22499
22500            // Decode the remaining unknown envelopes.
22501            while next_offset < end_offset {
22502                _next_ordinal_to_read += 1;
22503                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
22504                next_offset += envelope_size;
22505            }
22506
22507            Ok(())
22508        }
22509    }
22510
22511    impl StreamOutputFormat {
22512        #[inline(always)]
22513        fn max_ordinal_present(&self) -> u64 {
22514            if let Some(_) = self.format_details {
22515                return 2;
22516            }
22517            if let Some(_) = self.stream_lifetime_ordinal {
22518                return 1;
22519            }
22520            0
22521        }
22522    }
22523
22524    impl fidl::encoding::ValueTypeMarker for StreamOutputFormat {
22525        type Borrowed<'a> = &'a Self;
22526        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
22527            value
22528        }
22529    }
22530
22531    unsafe impl fidl::encoding::TypeMarker for StreamOutputFormat {
22532        type Owned = Self;
22533
22534        #[inline(always)]
22535        fn inline_align(_context: fidl::encoding::Context) -> usize {
22536            8
22537        }
22538
22539        #[inline(always)]
22540        fn inline_size(_context: fidl::encoding::Context) -> usize {
22541            16
22542        }
22543    }
22544
22545    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StreamOutputFormat, D>
22546        for &StreamOutputFormat
22547    {
22548        unsafe fn encode(
22549            self,
22550            encoder: &mut fidl::encoding::Encoder<'_, D>,
22551            offset: usize,
22552            mut depth: fidl::encoding::Depth,
22553        ) -> fidl::Result<()> {
22554            encoder.debug_check_bounds::<StreamOutputFormat>(offset);
22555            // Vector header
22556            let max_ordinal: u64 = self.max_ordinal_present();
22557            encoder.write_num(max_ordinal, offset);
22558            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
22559            // Calling encoder.out_of_line_offset(0) is not allowed.
22560            if max_ordinal == 0 {
22561                return Ok(());
22562            }
22563            depth.increment()?;
22564            let envelope_size = 8;
22565            let bytes_len = max_ordinal as usize * envelope_size;
22566            #[allow(unused_variables)]
22567            let offset = encoder.out_of_line_offset(bytes_len);
22568            let mut _prev_end_offset: usize = 0;
22569            if 1 > max_ordinal {
22570                return Ok(());
22571            }
22572
22573            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
22574            // are envelope_size bytes.
22575            let cur_offset: usize = (1 - 1) * envelope_size;
22576
22577            // Zero reserved fields.
22578            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
22579
22580            // Safety:
22581            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
22582            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
22583            //   envelope_size bytes, there is always sufficient room.
22584            fidl::encoding::encode_in_envelope_optional::<u64, D>(
22585                self.stream_lifetime_ordinal
22586                    .as_ref()
22587                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
22588                encoder,
22589                offset + cur_offset,
22590                depth,
22591            )?;
22592
22593            _prev_end_offset = cur_offset + envelope_size;
22594            if 2 > max_ordinal {
22595                return Ok(());
22596            }
22597
22598            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
22599            // are envelope_size bytes.
22600            let cur_offset: usize = (2 - 1) * envelope_size;
22601
22602            // Zero reserved fields.
22603            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
22604
22605            // Safety:
22606            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
22607            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
22608            //   envelope_size bytes, there is always sufficient room.
22609            fidl::encoding::encode_in_envelope_optional::<FormatDetails, D>(
22610                self.format_details
22611                    .as_ref()
22612                    .map(<FormatDetails as fidl::encoding::ValueTypeMarker>::borrow),
22613                encoder,
22614                offset + cur_offset,
22615                depth,
22616            )?;
22617
22618            _prev_end_offset = cur_offset + envelope_size;
22619
22620            Ok(())
22621        }
22622    }
22623
22624    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StreamOutputFormat {
22625        #[inline(always)]
22626        fn new_empty() -> Self {
22627            Self::default()
22628        }
22629
22630        unsafe fn decode(
22631            &mut self,
22632            decoder: &mut fidl::encoding::Decoder<'_, D>,
22633            offset: usize,
22634            mut depth: fidl::encoding::Depth,
22635        ) -> fidl::Result<()> {
22636            decoder.debug_check_bounds::<Self>(offset);
22637            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
22638                None => return Err(fidl::Error::NotNullable),
22639                Some(len) => len,
22640            };
22641            // Calling decoder.out_of_line_offset(0) is not allowed.
22642            if len == 0 {
22643                return Ok(());
22644            };
22645            depth.increment()?;
22646            let envelope_size = 8;
22647            let bytes_len = len * envelope_size;
22648            let offset = decoder.out_of_line_offset(bytes_len)?;
22649            // Decode the envelope for each type.
22650            let mut _next_ordinal_to_read = 0;
22651            let mut next_offset = offset;
22652            let end_offset = offset + bytes_len;
22653            _next_ordinal_to_read += 1;
22654            if next_offset >= end_offset {
22655                return Ok(());
22656            }
22657
22658            // Decode unknown envelopes for gaps in ordinals.
22659            while _next_ordinal_to_read < 1 {
22660                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
22661                _next_ordinal_to_read += 1;
22662                next_offset += envelope_size;
22663            }
22664
22665            let next_out_of_line = decoder.next_out_of_line();
22666            let handles_before = decoder.remaining_handles();
22667            if let Some((inlined, num_bytes, num_handles)) =
22668                fidl::encoding::decode_envelope_header(decoder, next_offset)?
22669            {
22670                let member_inline_size =
22671                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
22672                if inlined != (member_inline_size <= 4) {
22673                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
22674                }
22675                let inner_offset;
22676                let mut inner_depth = depth.clone();
22677                if inlined {
22678                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
22679                    inner_offset = next_offset;
22680                } else {
22681                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
22682                    inner_depth.increment()?;
22683                }
22684                let val_ref =
22685                    self.stream_lifetime_ordinal.get_or_insert_with(|| fidl::new_empty!(u64, D));
22686                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
22687                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
22688                {
22689                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
22690                }
22691                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
22692                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
22693                }
22694            }
22695
22696            next_offset += envelope_size;
22697            _next_ordinal_to_read += 1;
22698            if next_offset >= end_offset {
22699                return Ok(());
22700            }
22701
22702            // Decode unknown envelopes for gaps in ordinals.
22703            while _next_ordinal_to_read < 2 {
22704                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
22705                _next_ordinal_to_read += 1;
22706                next_offset += envelope_size;
22707            }
22708
22709            let next_out_of_line = decoder.next_out_of_line();
22710            let handles_before = decoder.remaining_handles();
22711            if let Some((inlined, num_bytes, num_handles)) =
22712                fidl::encoding::decode_envelope_header(decoder, next_offset)?
22713            {
22714                let member_inline_size =
22715                    <FormatDetails as fidl::encoding::TypeMarker>::inline_size(decoder.context);
22716                if inlined != (member_inline_size <= 4) {
22717                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
22718                }
22719                let inner_offset;
22720                let mut inner_depth = depth.clone();
22721                if inlined {
22722                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
22723                    inner_offset = next_offset;
22724                } else {
22725                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
22726                    inner_depth.increment()?;
22727                }
22728                let val_ref =
22729                    self.format_details.get_or_insert_with(|| fidl::new_empty!(FormatDetails, D));
22730                fidl::decode!(FormatDetails, D, val_ref, decoder, inner_offset, inner_depth)?;
22731                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
22732                {
22733                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
22734                }
22735                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
22736                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
22737                }
22738            }
22739
22740            next_offset += envelope_size;
22741
22742            // Decode the remaining unknown envelopes.
22743            while next_offset < end_offset {
22744                _next_ordinal_to_read += 1;
22745                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
22746                next_offset += envelope_size;
22747            }
22748
22749            Ok(())
22750        }
22751    }
22752
22753    impl StreamProcessorOnOutputTimestampHasNoOutputRequest {
22754        #[inline(always)]
22755        fn max_ordinal_present(&self) -> u64 {
22756            if let Some(_) = self.timestamp_ish {
22757                return 2;
22758            }
22759            if let Some(_) = self.stream_lifetime_ordinal {
22760                return 1;
22761            }
22762            0
22763        }
22764    }
22765
22766    impl fidl::encoding::ValueTypeMarker for StreamProcessorOnOutputTimestampHasNoOutputRequest {
22767        type Borrowed<'a> = &'a Self;
22768        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
22769            value
22770        }
22771    }
22772
22773    unsafe impl fidl::encoding::TypeMarker for StreamProcessorOnOutputTimestampHasNoOutputRequest {
22774        type Owned = Self;
22775
22776        #[inline(always)]
22777        fn inline_align(_context: fidl::encoding::Context) -> usize {
22778            8
22779        }
22780
22781        #[inline(always)]
22782        fn inline_size(_context: fidl::encoding::Context) -> usize {
22783            16
22784        }
22785    }
22786
22787    unsafe impl<D: fidl::encoding::ResourceDialect>
22788        fidl::encoding::Encode<StreamProcessorOnOutputTimestampHasNoOutputRequest, D>
22789        for &StreamProcessorOnOutputTimestampHasNoOutputRequest
22790    {
22791        unsafe fn encode(
22792            self,
22793            encoder: &mut fidl::encoding::Encoder<'_, D>,
22794            offset: usize,
22795            mut depth: fidl::encoding::Depth,
22796        ) -> fidl::Result<()> {
22797            encoder
22798                .debug_check_bounds::<StreamProcessorOnOutputTimestampHasNoOutputRequest>(offset);
22799            // Vector header
22800            let max_ordinal: u64 = self.max_ordinal_present();
22801            encoder.write_num(max_ordinal, offset);
22802            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
22803            // Calling encoder.out_of_line_offset(0) is not allowed.
22804            if max_ordinal == 0 {
22805                return Ok(());
22806            }
22807            depth.increment()?;
22808            let envelope_size = 8;
22809            let bytes_len = max_ordinal as usize * envelope_size;
22810            #[allow(unused_variables)]
22811            let offset = encoder.out_of_line_offset(bytes_len);
22812            let mut _prev_end_offset: usize = 0;
22813            if 1 > max_ordinal {
22814                return Ok(());
22815            }
22816
22817            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
22818            // are envelope_size bytes.
22819            let cur_offset: usize = (1 - 1) * envelope_size;
22820
22821            // Zero reserved fields.
22822            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
22823
22824            // Safety:
22825            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
22826            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
22827            //   envelope_size bytes, there is always sufficient room.
22828            fidl::encoding::encode_in_envelope_optional::<u64, D>(
22829                self.stream_lifetime_ordinal
22830                    .as_ref()
22831                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
22832                encoder,
22833                offset + cur_offset,
22834                depth,
22835            )?;
22836
22837            _prev_end_offset = cur_offset + envelope_size;
22838            if 2 > max_ordinal {
22839                return Ok(());
22840            }
22841
22842            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
22843            // are envelope_size bytes.
22844            let cur_offset: usize = (2 - 1) * envelope_size;
22845
22846            // Zero reserved fields.
22847            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
22848
22849            // Safety:
22850            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
22851            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
22852            //   envelope_size bytes, there is always sufficient room.
22853            fidl::encoding::encode_in_envelope_optional::<u64, D>(
22854                self.timestamp_ish.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
22855                encoder,
22856                offset + cur_offset,
22857                depth,
22858            )?;
22859
22860            _prev_end_offset = cur_offset + envelope_size;
22861
22862            Ok(())
22863        }
22864    }
22865
22866    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
22867        for StreamProcessorOnOutputTimestampHasNoOutputRequest
22868    {
22869        #[inline(always)]
22870        fn new_empty() -> Self {
22871            Self::default()
22872        }
22873
22874        unsafe fn decode(
22875            &mut self,
22876            decoder: &mut fidl::encoding::Decoder<'_, D>,
22877            offset: usize,
22878            mut depth: fidl::encoding::Depth,
22879        ) -> fidl::Result<()> {
22880            decoder.debug_check_bounds::<Self>(offset);
22881            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
22882                None => return Err(fidl::Error::NotNullable),
22883                Some(len) => len,
22884            };
22885            // Calling decoder.out_of_line_offset(0) is not allowed.
22886            if len == 0 {
22887                return Ok(());
22888            };
22889            depth.increment()?;
22890            let envelope_size = 8;
22891            let bytes_len = len * envelope_size;
22892            let offset = decoder.out_of_line_offset(bytes_len)?;
22893            // Decode the envelope for each type.
22894            let mut _next_ordinal_to_read = 0;
22895            let mut next_offset = offset;
22896            let end_offset = offset + bytes_len;
22897            _next_ordinal_to_read += 1;
22898            if next_offset >= end_offset {
22899                return Ok(());
22900            }
22901
22902            // Decode unknown envelopes for gaps in ordinals.
22903            while _next_ordinal_to_read < 1 {
22904                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
22905                _next_ordinal_to_read += 1;
22906                next_offset += envelope_size;
22907            }
22908
22909            let next_out_of_line = decoder.next_out_of_line();
22910            let handles_before = decoder.remaining_handles();
22911            if let Some((inlined, num_bytes, num_handles)) =
22912                fidl::encoding::decode_envelope_header(decoder, next_offset)?
22913            {
22914                let member_inline_size =
22915                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
22916                if inlined != (member_inline_size <= 4) {
22917                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
22918                }
22919                let inner_offset;
22920                let mut inner_depth = depth.clone();
22921                if inlined {
22922                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
22923                    inner_offset = next_offset;
22924                } else {
22925                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
22926                    inner_depth.increment()?;
22927                }
22928                let val_ref =
22929                    self.stream_lifetime_ordinal.get_or_insert_with(|| fidl::new_empty!(u64, D));
22930                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
22931                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
22932                {
22933                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
22934                }
22935                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
22936                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
22937                }
22938            }
22939
22940            next_offset += envelope_size;
22941            _next_ordinal_to_read += 1;
22942            if next_offset >= end_offset {
22943                return Ok(());
22944            }
22945
22946            // Decode unknown envelopes for gaps in ordinals.
22947            while _next_ordinal_to_read < 2 {
22948                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
22949                _next_ordinal_to_read += 1;
22950                next_offset += envelope_size;
22951            }
22952
22953            let next_out_of_line = decoder.next_out_of_line();
22954            let handles_before = decoder.remaining_handles();
22955            if let Some((inlined, num_bytes, num_handles)) =
22956                fidl::encoding::decode_envelope_header(decoder, next_offset)?
22957            {
22958                let member_inline_size =
22959                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
22960                if inlined != (member_inline_size <= 4) {
22961                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
22962                }
22963                let inner_offset;
22964                let mut inner_depth = depth.clone();
22965                if inlined {
22966                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
22967                    inner_offset = next_offset;
22968                } else {
22969                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
22970                    inner_depth.increment()?;
22971                }
22972                let val_ref = self.timestamp_ish.get_or_insert_with(|| fidl::new_empty!(u64, D));
22973                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
22974                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
22975                {
22976                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
22977                }
22978                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
22979                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
22980                }
22981            }
22982
22983            next_offset += envelope_size;
22984
22985            // Decode the remaining unknown envelopes.
22986            while next_offset < end_offset {
22987                _next_ordinal_to_read += 1;
22988                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
22989                next_offset += envelope_size;
22990            }
22991
22992            Ok(())
22993        }
22994    }
22995
22996    impl UsageStateDucked {
22997        #[inline(always)]
22998        fn max_ordinal_present(&self) -> u64 {
22999            0
23000        }
23001    }
23002
23003    impl fidl::encoding::ValueTypeMarker for UsageStateDucked {
23004        type Borrowed<'a> = &'a Self;
23005        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
23006            value
23007        }
23008    }
23009
23010    unsafe impl fidl::encoding::TypeMarker for UsageStateDucked {
23011        type Owned = Self;
23012
23013        #[inline(always)]
23014        fn inline_align(_context: fidl::encoding::Context) -> usize {
23015            8
23016        }
23017
23018        #[inline(always)]
23019        fn inline_size(_context: fidl::encoding::Context) -> usize {
23020            16
23021        }
23022    }
23023
23024    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<UsageStateDucked, D>
23025        for &UsageStateDucked
23026    {
23027        unsafe fn encode(
23028            self,
23029            encoder: &mut fidl::encoding::Encoder<'_, D>,
23030            offset: usize,
23031            mut depth: fidl::encoding::Depth,
23032        ) -> fidl::Result<()> {
23033            encoder.debug_check_bounds::<UsageStateDucked>(offset);
23034            // Vector header
23035            let max_ordinal: u64 = self.max_ordinal_present();
23036            encoder.write_num(max_ordinal, offset);
23037            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
23038            // Calling encoder.out_of_line_offset(0) is not allowed.
23039            if max_ordinal == 0 {
23040                return Ok(());
23041            }
23042            depth.increment()?;
23043            let envelope_size = 8;
23044            let bytes_len = max_ordinal as usize * envelope_size;
23045            #[allow(unused_variables)]
23046            let offset = encoder.out_of_line_offset(bytes_len);
23047            let mut _prev_end_offset: usize = 0;
23048
23049            Ok(())
23050        }
23051    }
23052
23053    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for UsageStateDucked {
23054        #[inline(always)]
23055        fn new_empty() -> Self {
23056            Self::default()
23057        }
23058
23059        unsafe fn decode(
23060            &mut self,
23061            decoder: &mut fidl::encoding::Decoder<'_, D>,
23062            offset: usize,
23063            mut depth: fidl::encoding::Depth,
23064        ) -> fidl::Result<()> {
23065            decoder.debug_check_bounds::<Self>(offset);
23066            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
23067                None => return Err(fidl::Error::NotNullable),
23068                Some(len) => len,
23069            };
23070            // Calling decoder.out_of_line_offset(0) is not allowed.
23071            if len == 0 {
23072                return Ok(());
23073            };
23074            depth.increment()?;
23075            let envelope_size = 8;
23076            let bytes_len = len * envelope_size;
23077            let offset = decoder.out_of_line_offset(bytes_len)?;
23078            // Decode the envelope for each type.
23079            let mut _next_ordinal_to_read = 0;
23080            let mut next_offset = offset;
23081            let end_offset = offset + bytes_len;
23082
23083            // Decode the remaining unknown envelopes.
23084            while next_offset < end_offset {
23085                _next_ordinal_to_read += 1;
23086                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
23087                next_offset += envelope_size;
23088            }
23089
23090            Ok(())
23091        }
23092    }
23093
23094    impl UsageStateMuted {
23095        #[inline(always)]
23096        fn max_ordinal_present(&self) -> u64 {
23097            0
23098        }
23099    }
23100
23101    impl fidl::encoding::ValueTypeMarker for UsageStateMuted {
23102        type Borrowed<'a> = &'a Self;
23103        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
23104            value
23105        }
23106    }
23107
23108    unsafe impl fidl::encoding::TypeMarker for UsageStateMuted {
23109        type Owned = Self;
23110
23111        #[inline(always)]
23112        fn inline_align(_context: fidl::encoding::Context) -> usize {
23113            8
23114        }
23115
23116        #[inline(always)]
23117        fn inline_size(_context: fidl::encoding::Context) -> usize {
23118            16
23119        }
23120    }
23121
23122    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<UsageStateMuted, D>
23123        for &UsageStateMuted
23124    {
23125        unsafe fn encode(
23126            self,
23127            encoder: &mut fidl::encoding::Encoder<'_, D>,
23128            offset: usize,
23129            mut depth: fidl::encoding::Depth,
23130        ) -> fidl::Result<()> {
23131            encoder.debug_check_bounds::<UsageStateMuted>(offset);
23132            // Vector header
23133            let max_ordinal: u64 = self.max_ordinal_present();
23134            encoder.write_num(max_ordinal, offset);
23135            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
23136            // Calling encoder.out_of_line_offset(0) is not allowed.
23137            if max_ordinal == 0 {
23138                return Ok(());
23139            }
23140            depth.increment()?;
23141            let envelope_size = 8;
23142            let bytes_len = max_ordinal as usize * envelope_size;
23143            #[allow(unused_variables)]
23144            let offset = encoder.out_of_line_offset(bytes_len);
23145            let mut _prev_end_offset: usize = 0;
23146
23147            Ok(())
23148        }
23149    }
23150
23151    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for UsageStateMuted {
23152        #[inline(always)]
23153        fn new_empty() -> Self {
23154            Self::default()
23155        }
23156
23157        unsafe fn decode(
23158            &mut self,
23159            decoder: &mut fidl::encoding::Decoder<'_, D>,
23160            offset: usize,
23161            mut depth: fidl::encoding::Depth,
23162        ) -> fidl::Result<()> {
23163            decoder.debug_check_bounds::<Self>(offset);
23164            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
23165                None => return Err(fidl::Error::NotNullable),
23166                Some(len) => len,
23167            };
23168            // Calling decoder.out_of_line_offset(0) is not allowed.
23169            if len == 0 {
23170                return Ok(());
23171            };
23172            depth.increment()?;
23173            let envelope_size = 8;
23174            let bytes_len = len * envelope_size;
23175            let offset = decoder.out_of_line_offset(bytes_len)?;
23176            // Decode the envelope for each type.
23177            let mut _next_ordinal_to_read = 0;
23178            let mut next_offset = offset;
23179            let end_offset = offset + bytes_len;
23180
23181            // Decode the remaining unknown envelopes.
23182            while next_offset < end_offset {
23183                _next_ordinal_to_read += 1;
23184                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
23185                next_offset += envelope_size;
23186            }
23187
23188            Ok(())
23189        }
23190    }
23191
23192    impl UsageStateUnadjusted {
23193        #[inline(always)]
23194        fn max_ordinal_present(&self) -> u64 {
23195            0
23196        }
23197    }
23198
23199    impl fidl::encoding::ValueTypeMarker for UsageStateUnadjusted {
23200        type Borrowed<'a> = &'a Self;
23201        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
23202            value
23203        }
23204    }
23205
23206    unsafe impl fidl::encoding::TypeMarker for UsageStateUnadjusted {
23207        type Owned = Self;
23208
23209        #[inline(always)]
23210        fn inline_align(_context: fidl::encoding::Context) -> usize {
23211            8
23212        }
23213
23214        #[inline(always)]
23215        fn inline_size(_context: fidl::encoding::Context) -> usize {
23216            16
23217        }
23218    }
23219
23220    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<UsageStateUnadjusted, D>
23221        for &UsageStateUnadjusted
23222    {
23223        unsafe fn encode(
23224            self,
23225            encoder: &mut fidl::encoding::Encoder<'_, D>,
23226            offset: usize,
23227            mut depth: fidl::encoding::Depth,
23228        ) -> fidl::Result<()> {
23229            encoder.debug_check_bounds::<UsageStateUnadjusted>(offset);
23230            // Vector header
23231            let max_ordinal: u64 = self.max_ordinal_present();
23232            encoder.write_num(max_ordinal, offset);
23233            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
23234            // Calling encoder.out_of_line_offset(0) is not allowed.
23235            if max_ordinal == 0 {
23236                return Ok(());
23237            }
23238            depth.increment()?;
23239            let envelope_size = 8;
23240            let bytes_len = max_ordinal as usize * envelope_size;
23241            #[allow(unused_variables)]
23242            let offset = encoder.out_of_line_offset(bytes_len);
23243            let mut _prev_end_offset: usize = 0;
23244
23245            Ok(())
23246        }
23247    }
23248
23249    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for UsageStateUnadjusted {
23250        #[inline(always)]
23251        fn new_empty() -> Self {
23252            Self::default()
23253        }
23254
23255        unsafe fn decode(
23256            &mut self,
23257            decoder: &mut fidl::encoding::Decoder<'_, D>,
23258            offset: usize,
23259            mut depth: fidl::encoding::Depth,
23260        ) -> fidl::Result<()> {
23261            decoder.debug_check_bounds::<Self>(offset);
23262            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
23263                None => return Err(fidl::Error::NotNullable),
23264                Some(len) => len,
23265            };
23266            // Calling decoder.out_of_line_offset(0) is not allowed.
23267            if len == 0 {
23268                return Ok(());
23269            };
23270            depth.increment()?;
23271            let envelope_size = 8;
23272            let bytes_len = len * envelope_size;
23273            let offset = decoder.out_of_line_offset(bytes_len)?;
23274            // Decode the envelope for each type.
23275            let mut _next_ordinal_to_read = 0;
23276            let mut next_offset = offset;
23277            let end_offset = offset + bytes_len;
23278
23279            // Decode the remaining unknown envelopes.
23280            while next_offset < end_offset {
23281                _next_ordinal_to_read += 1;
23282                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
23283                next_offset += envelope_size;
23284            }
23285
23286            Ok(())
23287        }
23288    }
23289
23290    impl fidl::encoding::ValueTypeMarker for AacBitRate {
23291        type Borrowed<'a> = &'a Self;
23292        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
23293            value
23294        }
23295    }
23296
23297    unsafe impl fidl::encoding::TypeMarker for AacBitRate {
23298        type Owned = Self;
23299
23300        #[inline(always)]
23301        fn inline_align(_context: fidl::encoding::Context) -> usize {
23302            8
23303        }
23304
23305        #[inline(always)]
23306        fn inline_size(_context: fidl::encoding::Context) -> usize {
23307            16
23308        }
23309    }
23310
23311    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AacBitRate, D>
23312        for &AacBitRate
23313    {
23314        #[inline]
23315        unsafe fn encode(
23316            self,
23317            encoder: &mut fidl::encoding::Encoder<'_, D>,
23318            offset: usize,
23319            _depth: fidl::encoding::Depth,
23320        ) -> fidl::Result<()> {
23321            encoder.debug_check_bounds::<AacBitRate>(offset);
23322            encoder.write_num::<u64>(self.ordinal(), offset);
23323            match self {
23324                AacBitRate::Constant(ref val) => {
23325                    fidl::encoding::encode_in_envelope::<AacConstantBitRate, D>(
23326                        <AacConstantBitRate as fidl::encoding::ValueTypeMarker>::borrow(val),
23327                        encoder,
23328                        offset + 8,
23329                        _depth,
23330                    )
23331                }
23332                AacBitRate::Variable(ref val) => {
23333                    fidl::encoding::encode_in_envelope::<AacVariableBitRate, D>(
23334                        <AacVariableBitRate as fidl::encoding::ValueTypeMarker>::borrow(val),
23335                        encoder,
23336                        offset + 8,
23337                        _depth,
23338                    )
23339                }
23340            }
23341        }
23342    }
23343
23344    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AacBitRate {
23345        #[inline(always)]
23346        fn new_empty() -> Self {
23347            Self::Constant(fidl::new_empty!(AacConstantBitRate, D))
23348        }
23349
23350        #[inline]
23351        unsafe fn decode(
23352            &mut self,
23353            decoder: &mut fidl::encoding::Decoder<'_, D>,
23354            offset: usize,
23355            mut depth: fidl::encoding::Depth,
23356        ) -> fidl::Result<()> {
23357            decoder.debug_check_bounds::<Self>(offset);
23358            #[allow(unused_variables)]
23359            let next_out_of_line = decoder.next_out_of_line();
23360            let handles_before = decoder.remaining_handles();
23361            let (ordinal, inlined, num_bytes, num_handles) =
23362                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
23363
23364            let member_inline_size = match ordinal {
23365                1 => {
23366                    <AacConstantBitRate as fidl::encoding::TypeMarker>::inline_size(decoder.context)
23367                }
23368                2 => {
23369                    <AacVariableBitRate as fidl::encoding::TypeMarker>::inline_size(decoder.context)
23370                }
23371                _ => return Err(fidl::Error::UnknownUnionTag),
23372            };
23373
23374            if inlined != (member_inline_size <= 4) {
23375                return Err(fidl::Error::InvalidInlineBitInEnvelope);
23376            }
23377            let _inner_offset;
23378            if inlined {
23379                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
23380                _inner_offset = offset + 8;
23381            } else {
23382                depth.increment()?;
23383                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
23384            }
23385            match ordinal {
23386                1 => {
23387                    #[allow(irrefutable_let_patterns)]
23388                    if let AacBitRate::Constant(_) = self {
23389                        // Do nothing, read the value into the object
23390                    } else {
23391                        // Initialize `self` to the right variant
23392                        *self = AacBitRate::Constant(fidl::new_empty!(AacConstantBitRate, D));
23393                    }
23394                    #[allow(irrefutable_let_patterns)]
23395                    if let AacBitRate::Constant(ref mut val) = self {
23396                        fidl::decode!(AacConstantBitRate, D, val, decoder, _inner_offset, depth)?;
23397                    } else {
23398                        unreachable!()
23399                    }
23400                }
23401                2 => {
23402                    #[allow(irrefutable_let_patterns)]
23403                    if let AacBitRate::Variable(_) = self {
23404                        // Do nothing, read the value into the object
23405                    } else {
23406                        // Initialize `self` to the right variant
23407                        *self = AacBitRate::Variable(fidl::new_empty!(AacVariableBitRate, D));
23408                    }
23409                    #[allow(irrefutable_let_patterns)]
23410                    if let AacBitRate::Variable(ref mut val) = self {
23411                        fidl::decode!(AacVariableBitRate, D, val, decoder, _inner_offset, depth)?;
23412                    } else {
23413                        unreachable!()
23414                    }
23415                }
23416                ordinal => panic!("unexpected ordinal {:?}", ordinal),
23417            }
23418            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
23419                return Err(fidl::Error::InvalidNumBytesInEnvelope);
23420            }
23421            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
23422                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
23423            }
23424            Ok(())
23425        }
23426    }
23427
23428    impl fidl::encoding::ValueTypeMarker for AacTransport {
23429        type Borrowed<'a> = &'a Self;
23430        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
23431            value
23432        }
23433    }
23434
23435    unsafe impl fidl::encoding::TypeMarker for AacTransport {
23436        type Owned = Self;
23437
23438        #[inline(always)]
23439        fn inline_align(_context: fidl::encoding::Context) -> usize {
23440            8
23441        }
23442
23443        #[inline(always)]
23444        fn inline_size(_context: fidl::encoding::Context) -> usize {
23445            16
23446        }
23447    }
23448
23449    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AacTransport, D>
23450        for &AacTransport
23451    {
23452        #[inline]
23453        unsafe fn encode(
23454            self,
23455            encoder: &mut fidl::encoding::Encoder<'_, D>,
23456            offset: usize,
23457            _depth: fidl::encoding::Depth,
23458        ) -> fidl::Result<()> {
23459            encoder.debug_check_bounds::<AacTransport>(offset);
23460            encoder.write_num::<u64>(self.ordinal(), offset);
23461            match self {
23462                AacTransport::Raw(ref val) => {
23463                    fidl::encoding::encode_in_envelope::<AacTransportRaw, D>(
23464                        <AacTransportRaw as fidl::encoding::ValueTypeMarker>::borrow(val),
23465                        encoder,
23466                        offset + 8,
23467                        _depth,
23468                    )
23469                }
23470                AacTransport::Latm(ref val) => {
23471                    fidl::encoding::encode_in_envelope::<AacTransportLatm, D>(
23472                        <AacTransportLatm as fidl::encoding::ValueTypeMarker>::borrow(val),
23473                        encoder,
23474                        offset + 8,
23475                        _depth,
23476                    )
23477                }
23478                AacTransport::Adts(ref val) => {
23479                    fidl::encoding::encode_in_envelope::<AacTransportAdts, D>(
23480                        <AacTransportAdts as fidl::encoding::ValueTypeMarker>::borrow(val),
23481                        encoder,
23482                        offset + 8,
23483                        _depth,
23484                    )
23485                }
23486                AacTransport::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
23487            }
23488        }
23489    }
23490
23491    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AacTransport {
23492        #[inline(always)]
23493        fn new_empty() -> Self {
23494            Self::__SourceBreaking { unknown_ordinal: 0 }
23495        }
23496
23497        #[inline]
23498        unsafe fn decode(
23499            &mut self,
23500            decoder: &mut fidl::encoding::Decoder<'_, D>,
23501            offset: usize,
23502            mut depth: fidl::encoding::Depth,
23503        ) -> fidl::Result<()> {
23504            decoder.debug_check_bounds::<Self>(offset);
23505            #[allow(unused_variables)]
23506            let next_out_of_line = decoder.next_out_of_line();
23507            let handles_before = decoder.remaining_handles();
23508            let (ordinal, inlined, num_bytes, num_handles) =
23509                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
23510
23511            let member_inline_size = match ordinal {
23512                1 => <AacTransportRaw as fidl::encoding::TypeMarker>::inline_size(decoder.context),
23513                2 => <AacTransportLatm as fidl::encoding::TypeMarker>::inline_size(decoder.context),
23514                3 => <AacTransportAdts as fidl::encoding::TypeMarker>::inline_size(decoder.context),
23515                0 => return Err(fidl::Error::UnknownUnionTag),
23516                _ => num_bytes as usize,
23517            };
23518
23519            if inlined != (member_inline_size <= 4) {
23520                return Err(fidl::Error::InvalidInlineBitInEnvelope);
23521            }
23522            let _inner_offset;
23523            if inlined {
23524                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
23525                _inner_offset = offset + 8;
23526            } else {
23527                depth.increment()?;
23528                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
23529            }
23530            match ordinal {
23531                1 => {
23532                    #[allow(irrefutable_let_patterns)]
23533                    if let AacTransport::Raw(_) = self {
23534                        // Do nothing, read the value into the object
23535                    } else {
23536                        // Initialize `self` to the right variant
23537                        *self = AacTransport::Raw(fidl::new_empty!(AacTransportRaw, D));
23538                    }
23539                    #[allow(irrefutable_let_patterns)]
23540                    if let AacTransport::Raw(ref mut val) = self {
23541                        fidl::decode!(AacTransportRaw, D, val, decoder, _inner_offset, depth)?;
23542                    } else {
23543                        unreachable!()
23544                    }
23545                }
23546                2 => {
23547                    #[allow(irrefutable_let_patterns)]
23548                    if let AacTransport::Latm(_) = self {
23549                        // Do nothing, read the value into the object
23550                    } else {
23551                        // Initialize `self` to the right variant
23552                        *self = AacTransport::Latm(fidl::new_empty!(AacTransportLatm, D));
23553                    }
23554                    #[allow(irrefutable_let_patterns)]
23555                    if let AacTransport::Latm(ref mut val) = self {
23556                        fidl::decode!(AacTransportLatm, D, val, decoder, _inner_offset, depth)?;
23557                    } else {
23558                        unreachable!()
23559                    }
23560                }
23561                3 => {
23562                    #[allow(irrefutable_let_patterns)]
23563                    if let AacTransport::Adts(_) = self {
23564                        // Do nothing, read the value into the object
23565                    } else {
23566                        // Initialize `self` to the right variant
23567                        *self = AacTransport::Adts(fidl::new_empty!(AacTransportAdts, D));
23568                    }
23569                    #[allow(irrefutable_let_patterns)]
23570                    if let AacTransport::Adts(ref mut val) = self {
23571                        fidl::decode!(AacTransportAdts, D, val, decoder, _inner_offset, depth)?;
23572                    } else {
23573                        unreachable!()
23574                    }
23575                }
23576                #[allow(deprecated)]
23577                ordinal => {
23578                    for _ in 0..num_handles {
23579                        decoder.drop_next_handle()?;
23580                    }
23581                    *self = AacTransport::__SourceBreaking { unknown_ordinal: ordinal };
23582                }
23583            }
23584            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
23585                return Err(fidl::Error::InvalidNumBytesInEnvelope);
23586            }
23587            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
23588                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
23589            }
23590            Ok(())
23591        }
23592    }
23593
23594    impl fidl::encoding::ValueTypeMarker for AudioCapturerConfiguration {
23595        type Borrowed<'a> = &'a Self;
23596        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
23597            value
23598        }
23599    }
23600
23601    unsafe impl fidl::encoding::TypeMarker for AudioCapturerConfiguration {
23602        type Owned = Self;
23603
23604        #[inline(always)]
23605        fn inline_align(_context: fidl::encoding::Context) -> usize {
23606            8
23607        }
23608
23609        #[inline(always)]
23610        fn inline_size(_context: fidl::encoding::Context) -> usize {
23611            16
23612        }
23613    }
23614
23615    unsafe impl<D: fidl::encoding::ResourceDialect>
23616        fidl::encoding::Encode<AudioCapturerConfiguration, D> for &AudioCapturerConfiguration
23617    {
23618        #[inline]
23619        unsafe fn encode(
23620            self,
23621            encoder: &mut fidl::encoding::Encoder<'_, D>,
23622            offset: usize,
23623            _depth: fidl::encoding::Depth,
23624        ) -> fidl::Result<()> {
23625            encoder.debug_check_bounds::<AudioCapturerConfiguration>(offset);
23626            encoder.write_num::<u64>(self.ordinal(), offset);
23627            match self {
23628                AudioCapturerConfiguration::Loopback(ref val) => fidl::encoding::encode_in_envelope::<
23629                    LoopbackAudioCapturerConfiguration,
23630                    D,
23631                >(
23632                    <LoopbackAudioCapturerConfiguration as fidl::encoding::ValueTypeMarker>::borrow(
23633                        val,
23634                    ),
23635                    encoder,
23636                    offset + 8,
23637                    _depth,
23638                ),
23639                AudioCapturerConfiguration::Input(ref val) => fidl::encoding::encode_in_envelope::<
23640                    InputAudioCapturerConfiguration,
23641                    D,
23642                >(
23643                    <InputAudioCapturerConfiguration as fidl::encoding::ValueTypeMarker>::borrow(
23644                        val,
23645                    ),
23646                    encoder,
23647                    offset + 8,
23648                    _depth,
23649                ),
23650            }
23651        }
23652    }
23653
23654    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
23655        for AudioCapturerConfiguration
23656    {
23657        #[inline(always)]
23658        fn new_empty() -> Self {
23659            Self::Loopback(fidl::new_empty!(LoopbackAudioCapturerConfiguration, D))
23660        }
23661
23662        #[inline]
23663        unsafe fn decode(
23664            &mut self,
23665            decoder: &mut fidl::encoding::Decoder<'_, D>,
23666            offset: usize,
23667            mut depth: fidl::encoding::Depth,
23668        ) -> fidl::Result<()> {
23669            decoder.debug_check_bounds::<Self>(offset);
23670            #[allow(unused_variables)]
23671            let next_out_of_line = decoder.next_out_of_line();
23672            let handles_before = decoder.remaining_handles();
23673            let (ordinal, inlined, num_bytes, num_handles) =
23674                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
23675
23676            let member_inline_size = match ordinal {
23677                1 => {
23678                    <LoopbackAudioCapturerConfiguration as fidl::encoding::TypeMarker>::inline_size(
23679                        decoder.context,
23680                    )
23681                }
23682                2 => <InputAudioCapturerConfiguration as fidl::encoding::TypeMarker>::inline_size(
23683                    decoder.context,
23684                ),
23685                _ => return Err(fidl::Error::UnknownUnionTag),
23686            };
23687
23688            if inlined != (member_inline_size <= 4) {
23689                return Err(fidl::Error::InvalidInlineBitInEnvelope);
23690            }
23691            let _inner_offset;
23692            if inlined {
23693                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
23694                _inner_offset = offset + 8;
23695            } else {
23696                depth.increment()?;
23697                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
23698            }
23699            match ordinal {
23700                1 => {
23701                    #[allow(irrefutable_let_patterns)]
23702                    if let AudioCapturerConfiguration::Loopback(_) = self {
23703                        // Do nothing, read the value into the object
23704                    } else {
23705                        // Initialize `self` to the right variant
23706                        *self = AudioCapturerConfiguration::Loopback(fidl::new_empty!(
23707                            LoopbackAudioCapturerConfiguration,
23708                            D
23709                        ));
23710                    }
23711                    #[allow(irrefutable_let_patterns)]
23712                    if let AudioCapturerConfiguration::Loopback(ref mut val) = self {
23713                        fidl::decode!(
23714                            LoopbackAudioCapturerConfiguration,
23715                            D,
23716                            val,
23717                            decoder,
23718                            _inner_offset,
23719                            depth
23720                        )?;
23721                    } else {
23722                        unreachable!()
23723                    }
23724                }
23725                2 => {
23726                    #[allow(irrefutable_let_patterns)]
23727                    if let AudioCapturerConfiguration::Input(_) = self {
23728                        // Do nothing, read the value into the object
23729                    } else {
23730                        // Initialize `self` to the right variant
23731                        *self = AudioCapturerConfiguration::Input(fidl::new_empty!(
23732                            InputAudioCapturerConfiguration,
23733                            D
23734                        ));
23735                    }
23736                    #[allow(irrefutable_let_patterns)]
23737                    if let AudioCapturerConfiguration::Input(ref mut val) = self {
23738                        fidl::decode!(
23739                            InputAudioCapturerConfiguration,
23740                            D,
23741                            val,
23742                            decoder,
23743                            _inner_offset,
23744                            depth
23745                        )?;
23746                    } else {
23747                        unreachable!()
23748                    }
23749                }
23750                ordinal => panic!("unexpected ordinal {:?}", ordinal),
23751            }
23752            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
23753                return Err(fidl::Error::InvalidNumBytesInEnvelope);
23754            }
23755            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
23756                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
23757            }
23758            Ok(())
23759        }
23760    }
23761
23762    impl fidl::encoding::ValueTypeMarker for AudioCompressedFormat {
23763        type Borrowed<'a> = &'a Self;
23764        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
23765            value
23766        }
23767    }
23768
23769    unsafe impl fidl::encoding::TypeMarker for AudioCompressedFormat {
23770        type Owned = Self;
23771
23772        #[inline(always)]
23773        fn inline_align(_context: fidl::encoding::Context) -> usize {
23774            8
23775        }
23776
23777        #[inline(always)]
23778        fn inline_size(_context: fidl::encoding::Context) -> usize {
23779            16
23780        }
23781    }
23782
23783    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AudioCompressedFormat, D>
23784        for &AudioCompressedFormat
23785    {
23786        #[inline]
23787        unsafe fn encode(
23788            self,
23789            encoder: &mut fidl::encoding::Encoder<'_, D>,
23790            offset: usize,
23791            _depth: fidl::encoding::Depth,
23792        ) -> fidl::Result<()> {
23793            encoder.debug_check_bounds::<AudioCompressedFormat>(offset);
23794            encoder.write_num::<u64>(self.ordinal(), offset);
23795            match self {
23796                AudioCompressedFormat::Aac(ref val) => {
23797                    fidl::encoding::encode_in_envelope::<AudioCompressedFormatAac, D>(
23798                        <AudioCompressedFormatAac as fidl::encoding::ValueTypeMarker>::borrow(val),
23799                        encoder,
23800                        offset + 8,
23801                        _depth,
23802                    )
23803                }
23804                AudioCompressedFormat::Sbc(ref val) => {
23805                    fidl::encoding::encode_in_envelope::<AudioCompressedFormatSbc, D>(
23806                        <AudioCompressedFormatSbc as fidl::encoding::ValueTypeMarker>::borrow(val),
23807                        encoder,
23808                        offset + 8,
23809                        _depth,
23810                    )
23811                }
23812                AudioCompressedFormat::Cvsd(ref val) => {
23813                    fidl::encoding::encode_in_envelope::<AudioCompressedFormatCvsd, D>(
23814                        <AudioCompressedFormatCvsd as fidl::encoding::ValueTypeMarker>::borrow(val),
23815                        encoder,
23816                        offset + 8,
23817                        _depth,
23818                    )
23819                }
23820                AudioCompressedFormat::Lc3(ref val) => {
23821                    fidl::encoding::encode_in_envelope::<AudioCompressedFormatLc3, D>(
23822                        <AudioCompressedFormatLc3 as fidl::encoding::ValueTypeMarker>::borrow(val),
23823                        encoder,
23824                        offset + 8,
23825                        _depth,
23826                    )
23827                }
23828                AudioCompressedFormat::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
23829            }
23830        }
23831    }
23832
23833    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AudioCompressedFormat {
23834        #[inline(always)]
23835        fn new_empty() -> Self {
23836            Self::__SourceBreaking { unknown_ordinal: 0 }
23837        }
23838
23839        #[inline]
23840        unsafe fn decode(
23841            &mut self,
23842            decoder: &mut fidl::encoding::Decoder<'_, D>,
23843            offset: usize,
23844            mut depth: fidl::encoding::Depth,
23845        ) -> fidl::Result<()> {
23846            decoder.debug_check_bounds::<Self>(offset);
23847            #[allow(unused_variables)]
23848            let next_out_of_line = decoder.next_out_of_line();
23849            let handles_before = decoder.remaining_handles();
23850            let (ordinal, inlined, num_bytes, num_handles) =
23851                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
23852
23853            let member_inline_size = match ordinal {
23854                1 => <AudioCompressedFormatAac as fidl::encoding::TypeMarker>::inline_size(
23855                    decoder.context,
23856                ),
23857                2 => <AudioCompressedFormatSbc as fidl::encoding::TypeMarker>::inline_size(
23858                    decoder.context,
23859                ),
23860                3 => <AudioCompressedFormatCvsd as fidl::encoding::TypeMarker>::inline_size(
23861                    decoder.context,
23862                ),
23863                4 => <AudioCompressedFormatLc3 as fidl::encoding::TypeMarker>::inline_size(
23864                    decoder.context,
23865                ),
23866                0 => return Err(fidl::Error::UnknownUnionTag),
23867                _ => num_bytes as usize,
23868            };
23869
23870            if inlined != (member_inline_size <= 4) {
23871                return Err(fidl::Error::InvalidInlineBitInEnvelope);
23872            }
23873            let _inner_offset;
23874            if inlined {
23875                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
23876                _inner_offset = offset + 8;
23877            } else {
23878                depth.increment()?;
23879                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
23880            }
23881            match ordinal {
23882                1 => {
23883                    #[allow(irrefutable_let_patterns)]
23884                    if let AudioCompressedFormat::Aac(_) = self {
23885                        // Do nothing, read the value into the object
23886                    } else {
23887                        // Initialize `self` to the right variant
23888                        *self = AudioCompressedFormat::Aac(fidl::new_empty!(
23889                            AudioCompressedFormatAac,
23890                            D
23891                        ));
23892                    }
23893                    #[allow(irrefutable_let_patterns)]
23894                    if let AudioCompressedFormat::Aac(ref mut val) = self {
23895                        fidl::decode!(
23896                            AudioCompressedFormatAac,
23897                            D,
23898                            val,
23899                            decoder,
23900                            _inner_offset,
23901                            depth
23902                        )?;
23903                    } else {
23904                        unreachable!()
23905                    }
23906                }
23907                2 => {
23908                    #[allow(irrefutable_let_patterns)]
23909                    if let AudioCompressedFormat::Sbc(_) = self {
23910                        // Do nothing, read the value into the object
23911                    } else {
23912                        // Initialize `self` to the right variant
23913                        *self = AudioCompressedFormat::Sbc(fidl::new_empty!(
23914                            AudioCompressedFormatSbc,
23915                            D
23916                        ));
23917                    }
23918                    #[allow(irrefutable_let_patterns)]
23919                    if let AudioCompressedFormat::Sbc(ref mut val) = self {
23920                        fidl::decode!(
23921                            AudioCompressedFormatSbc,
23922                            D,
23923                            val,
23924                            decoder,
23925                            _inner_offset,
23926                            depth
23927                        )?;
23928                    } else {
23929                        unreachable!()
23930                    }
23931                }
23932                3 => {
23933                    #[allow(irrefutable_let_patterns)]
23934                    if let AudioCompressedFormat::Cvsd(_) = self {
23935                        // Do nothing, read the value into the object
23936                    } else {
23937                        // Initialize `self` to the right variant
23938                        *self = AudioCompressedFormat::Cvsd(fidl::new_empty!(
23939                            AudioCompressedFormatCvsd,
23940                            D
23941                        ));
23942                    }
23943                    #[allow(irrefutable_let_patterns)]
23944                    if let AudioCompressedFormat::Cvsd(ref mut val) = self {
23945                        fidl::decode!(
23946                            AudioCompressedFormatCvsd,
23947                            D,
23948                            val,
23949                            decoder,
23950                            _inner_offset,
23951                            depth
23952                        )?;
23953                    } else {
23954                        unreachable!()
23955                    }
23956                }
23957                4 => {
23958                    #[allow(irrefutable_let_patterns)]
23959                    if let AudioCompressedFormat::Lc3(_) = self {
23960                        // Do nothing, read the value into the object
23961                    } else {
23962                        // Initialize `self` to the right variant
23963                        *self = AudioCompressedFormat::Lc3(fidl::new_empty!(
23964                            AudioCompressedFormatLc3,
23965                            D
23966                        ));
23967                    }
23968                    #[allow(irrefutable_let_patterns)]
23969                    if let AudioCompressedFormat::Lc3(ref mut val) = self {
23970                        fidl::decode!(
23971                            AudioCompressedFormatLc3,
23972                            D,
23973                            val,
23974                            decoder,
23975                            _inner_offset,
23976                            depth
23977                        )?;
23978                    } else {
23979                        unreachable!()
23980                    }
23981                }
23982                #[allow(deprecated)]
23983                ordinal => {
23984                    for _ in 0..num_handles {
23985                        decoder.drop_next_handle()?;
23986                    }
23987                    *self = AudioCompressedFormat::__SourceBreaking { unknown_ordinal: ordinal };
23988                }
23989            }
23990            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
23991                return Err(fidl::Error::InvalidNumBytesInEnvelope);
23992            }
23993            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
23994                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
23995            }
23996            Ok(())
23997        }
23998    }
23999
24000    impl fidl::encoding::ValueTypeMarker for AudioConsumerError {
24001        type Borrowed<'a> = &'a Self;
24002        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
24003            value
24004        }
24005    }
24006
24007    unsafe impl fidl::encoding::TypeMarker for AudioConsumerError {
24008        type Owned = Self;
24009
24010        #[inline(always)]
24011        fn inline_align(_context: fidl::encoding::Context) -> usize {
24012            8
24013        }
24014
24015        #[inline(always)]
24016        fn inline_size(_context: fidl::encoding::Context) -> usize {
24017            16
24018        }
24019    }
24020
24021    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AudioConsumerError, D>
24022        for &AudioConsumerError
24023    {
24024        #[inline]
24025        unsafe fn encode(
24026            self,
24027            encoder: &mut fidl::encoding::Encoder<'_, D>,
24028            offset: usize,
24029            _depth: fidl::encoding::Depth,
24030        ) -> fidl::Result<()> {
24031            encoder.debug_check_bounds::<AudioConsumerError>(offset);
24032            encoder.write_num::<u64>(self.ordinal(), offset);
24033            match self {
24034                AudioConsumerError::PlaceHolder(ref val) => {
24035                    fidl::encoding::encode_in_envelope::<Void, D>(
24036                        <Void as fidl::encoding::ValueTypeMarker>::borrow(val),
24037                        encoder,
24038                        offset + 8,
24039                        _depth,
24040                    )
24041                }
24042            }
24043        }
24044    }
24045
24046    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AudioConsumerError {
24047        #[inline(always)]
24048        fn new_empty() -> Self {
24049            Self::PlaceHolder(fidl::new_empty!(Void, D))
24050        }
24051
24052        #[inline]
24053        unsafe fn decode(
24054            &mut self,
24055            decoder: &mut fidl::encoding::Decoder<'_, D>,
24056            offset: usize,
24057            mut depth: fidl::encoding::Depth,
24058        ) -> fidl::Result<()> {
24059            decoder.debug_check_bounds::<Self>(offset);
24060            #[allow(unused_variables)]
24061            let next_out_of_line = decoder.next_out_of_line();
24062            let handles_before = decoder.remaining_handles();
24063            let (ordinal, inlined, num_bytes, num_handles) =
24064                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
24065
24066            let member_inline_size = match ordinal {
24067                1 => <Void as fidl::encoding::TypeMarker>::inline_size(decoder.context),
24068                _ => return Err(fidl::Error::UnknownUnionTag),
24069            };
24070
24071            if inlined != (member_inline_size <= 4) {
24072                return Err(fidl::Error::InvalidInlineBitInEnvelope);
24073            }
24074            let _inner_offset;
24075            if inlined {
24076                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
24077                _inner_offset = offset + 8;
24078            } else {
24079                depth.increment()?;
24080                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
24081            }
24082            match ordinal {
24083                1 => {
24084                    #[allow(irrefutable_let_patterns)]
24085                    if let AudioConsumerError::PlaceHolder(_) = self {
24086                        // Do nothing, read the value into the object
24087                    } else {
24088                        // Initialize `self` to the right variant
24089                        *self = AudioConsumerError::PlaceHolder(fidl::new_empty!(Void, D));
24090                    }
24091                    #[allow(irrefutable_let_patterns)]
24092                    if let AudioConsumerError::PlaceHolder(ref mut val) = self {
24093                        fidl::decode!(Void, D, val, decoder, _inner_offset, depth)?;
24094                    } else {
24095                        unreachable!()
24096                    }
24097                }
24098                ordinal => panic!("unexpected ordinal {:?}", ordinal),
24099            }
24100            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
24101                return Err(fidl::Error::InvalidNumBytesInEnvelope);
24102            }
24103            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
24104                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
24105            }
24106            Ok(())
24107        }
24108    }
24109
24110    impl fidl::encoding::ValueTypeMarker for AudioFormat {
24111        type Borrowed<'a> = &'a Self;
24112        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
24113            value
24114        }
24115    }
24116
24117    unsafe impl fidl::encoding::TypeMarker for AudioFormat {
24118        type Owned = Self;
24119
24120        #[inline(always)]
24121        fn inline_align(_context: fidl::encoding::Context) -> usize {
24122            8
24123        }
24124
24125        #[inline(always)]
24126        fn inline_size(_context: fidl::encoding::Context) -> usize {
24127            16
24128        }
24129    }
24130
24131    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AudioFormat, D>
24132        for &AudioFormat
24133    {
24134        #[inline]
24135        unsafe fn encode(
24136            self,
24137            encoder: &mut fidl::encoding::Encoder<'_, D>,
24138            offset: usize,
24139            _depth: fidl::encoding::Depth,
24140        ) -> fidl::Result<()> {
24141            encoder.debug_check_bounds::<AudioFormat>(offset);
24142            encoder.write_num::<u64>(self.ordinal(), offset);
24143            match self {
24144                AudioFormat::Compressed(ref val) => {
24145                    fidl::encoding::encode_in_envelope::<AudioCompressedFormat, D>(
24146                        <AudioCompressedFormat as fidl::encoding::ValueTypeMarker>::borrow(val),
24147                        encoder,
24148                        offset + 8,
24149                        _depth,
24150                    )
24151                }
24152                AudioFormat::Uncompressed(ref val) => {
24153                    fidl::encoding::encode_in_envelope::<AudioUncompressedFormat, D>(
24154                        <AudioUncompressedFormat as fidl::encoding::ValueTypeMarker>::borrow(val),
24155                        encoder,
24156                        offset + 8,
24157                        _depth,
24158                    )
24159                }
24160            }
24161        }
24162    }
24163
24164    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AudioFormat {
24165        #[inline(always)]
24166        fn new_empty() -> Self {
24167            Self::Compressed(fidl::new_empty!(AudioCompressedFormat, D))
24168        }
24169
24170        #[inline]
24171        unsafe fn decode(
24172            &mut self,
24173            decoder: &mut fidl::encoding::Decoder<'_, D>,
24174            offset: usize,
24175            mut depth: fidl::encoding::Depth,
24176        ) -> fidl::Result<()> {
24177            decoder.debug_check_bounds::<Self>(offset);
24178            #[allow(unused_variables)]
24179            let next_out_of_line = decoder.next_out_of_line();
24180            let handles_before = decoder.remaining_handles();
24181            let (ordinal, inlined, num_bytes, num_handles) =
24182                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
24183
24184            let member_inline_size = match ordinal {
24185                1 => <AudioCompressedFormat as fidl::encoding::TypeMarker>::inline_size(
24186                    decoder.context,
24187                ),
24188                2 => <AudioUncompressedFormat as fidl::encoding::TypeMarker>::inline_size(
24189                    decoder.context,
24190                ),
24191                _ => return Err(fidl::Error::UnknownUnionTag),
24192            };
24193
24194            if inlined != (member_inline_size <= 4) {
24195                return Err(fidl::Error::InvalidInlineBitInEnvelope);
24196            }
24197            let _inner_offset;
24198            if inlined {
24199                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
24200                _inner_offset = offset + 8;
24201            } else {
24202                depth.increment()?;
24203                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
24204            }
24205            match ordinal {
24206                1 => {
24207                    #[allow(irrefutable_let_patterns)]
24208                    if let AudioFormat::Compressed(_) = self {
24209                        // Do nothing, read the value into the object
24210                    } else {
24211                        // Initialize `self` to the right variant
24212                        *self = AudioFormat::Compressed(fidl::new_empty!(AudioCompressedFormat, D));
24213                    }
24214                    #[allow(irrefutable_let_patterns)]
24215                    if let AudioFormat::Compressed(ref mut val) = self {
24216                        fidl::decode!(
24217                            AudioCompressedFormat,
24218                            D,
24219                            val,
24220                            decoder,
24221                            _inner_offset,
24222                            depth
24223                        )?;
24224                    } else {
24225                        unreachable!()
24226                    }
24227                }
24228                2 => {
24229                    #[allow(irrefutable_let_patterns)]
24230                    if let AudioFormat::Uncompressed(_) = self {
24231                        // Do nothing, read the value into the object
24232                    } else {
24233                        // Initialize `self` to the right variant
24234                        *self =
24235                            AudioFormat::Uncompressed(fidl::new_empty!(AudioUncompressedFormat, D));
24236                    }
24237                    #[allow(irrefutable_let_patterns)]
24238                    if let AudioFormat::Uncompressed(ref mut val) = self {
24239                        fidl::decode!(
24240                            AudioUncompressedFormat,
24241                            D,
24242                            val,
24243                            decoder,
24244                            _inner_offset,
24245                            depth
24246                        )?;
24247                    } else {
24248                        unreachable!()
24249                    }
24250                }
24251                ordinal => panic!("unexpected ordinal {:?}", ordinal),
24252            }
24253            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
24254                return Err(fidl::Error::InvalidNumBytesInEnvelope);
24255            }
24256            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
24257                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
24258            }
24259            Ok(())
24260        }
24261    }
24262
24263    impl fidl::encoding::ValueTypeMarker for AudioUncompressedFormat {
24264        type Borrowed<'a> = &'a Self;
24265        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
24266            value
24267        }
24268    }
24269
24270    unsafe impl fidl::encoding::TypeMarker for AudioUncompressedFormat {
24271        type Owned = Self;
24272
24273        #[inline(always)]
24274        fn inline_align(_context: fidl::encoding::Context) -> usize {
24275            8
24276        }
24277
24278        #[inline(always)]
24279        fn inline_size(_context: fidl::encoding::Context) -> usize {
24280            16
24281        }
24282    }
24283
24284    unsafe impl<D: fidl::encoding::ResourceDialect>
24285        fidl::encoding::Encode<AudioUncompressedFormat, D> for &AudioUncompressedFormat
24286    {
24287        #[inline]
24288        unsafe fn encode(
24289            self,
24290            encoder: &mut fidl::encoding::Encoder<'_, D>,
24291            offset: usize,
24292            _depth: fidl::encoding::Depth,
24293        ) -> fidl::Result<()> {
24294            encoder.debug_check_bounds::<AudioUncompressedFormat>(offset);
24295            encoder.write_num::<u64>(self.ordinal(), offset);
24296            match self {
24297                AudioUncompressedFormat::Pcm(ref val) => {
24298                    fidl::encoding::encode_in_envelope::<PcmFormat, D>(
24299                        <PcmFormat as fidl::encoding::ValueTypeMarker>::borrow(val),
24300                        encoder,
24301                        offset + 8,
24302                        _depth,
24303                    )
24304                }
24305            }
24306        }
24307    }
24308
24309    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
24310        for AudioUncompressedFormat
24311    {
24312        #[inline(always)]
24313        fn new_empty() -> Self {
24314            Self::Pcm(fidl::new_empty!(PcmFormat, D))
24315        }
24316
24317        #[inline]
24318        unsafe fn decode(
24319            &mut self,
24320            decoder: &mut fidl::encoding::Decoder<'_, D>,
24321            offset: usize,
24322            mut depth: fidl::encoding::Depth,
24323        ) -> fidl::Result<()> {
24324            decoder.debug_check_bounds::<Self>(offset);
24325            #[allow(unused_variables)]
24326            let next_out_of_line = decoder.next_out_of_line();
24327            let handles_before = decoder.remaining_handles();
24328            let (ordinal, inlined, num_bytes, num_handles) =
24329                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
24330
24331            let member_inline_size = match ordinal {
24332                1 => <PcmFormat as fidl::encoding::TypeMarker>::inline_size(decoder.context),
24333                _ => return Err(fidl::Error::UnknownUnionTag),
24334            };
24335
24336            if inlined != (member_inline_size <= 4) {
24337                return Err(fidl::Error::InvalidInlineBitInEnvelope);
24338            }
24339            let _inner_offset;
24340            if inlined {
24341                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
24342                _inner_offset = offset + 8;
24343            } else {
24344                depth.increment()?;
24345                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
24346            }
24347            match ordinal {
24348                1 => {
24349                    #[allow(irrefutable_let_patterns)]
24350                    if let AudioUncompressedFormat::Pcm(_) = self {
24351                        // Do nothing, read the value into the object
24352                    } else {
24353                        // Initialize `self` to the right variant
24354                        *self = AudioUncompressedFormat::Pcm(fidl::new_empty!(PcmFormat, D));
24355                    }
24356                    #[allow(irrefutable_let_patterns)]
24357                    if let AudioUncompressedFormat::Pcm(ref mut val) = self {
24358                        fidl::decode!(PcmFormat, D, val, decoder, _inner_offset, depth)?;
24359                    } else {
24360                        unreachable!()
24361                    }
24362                }
24363                ordinal => panic!("unexpected ordinal {:?}", ordinal),
24364            }
24365            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
24366                return Err(fidl::Error::InvalidNumBytesInEnvelope);
24367            }
24368            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
24369                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
24370            }
24371            Ok(())
24372        }
24373    }
24374
24375    impl fidl::encoding::ValueTypeMarker for CryptoFormat {
24376        type Borrowed<'a> = &'a Self;
24377        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
24378            value
24379        }
24380    }
24381
24382    unsafe impl fidl::encoding::TypeMarker for CryptoFormat {
24383        type Owned = Self;
24384
24385        #[inline(always)]
24386        fn inline_align(_context: fidl::encoding::Context) -> usize {
24387            8
24388        }
24389
24390        #[inline(always)]
24391        fn inline_size(_context: fidl::encoding::Context) -> usize {
24392            16
24393        }
24394    }
24395
24396    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CryptoFormat, D>
24397        for &CryptoFormat
24398    {
24399        #[inline]
24400        unsafe fn encode(
24401            self,
24402            encoder: &mut fidl::encoding::Encoder<'_, D>,
24403            offset: usize,
24404            _depth: fidl::encoding::Depth,
24405        ) -> fidl::Result<()> {
24406            encoder.debug_check_bounds::<CryptoFormat>(offset);
24407            encoder.write_num::<u64>(self.ordinal(), offset);
24408            match self {
24409                CryptoFormat::Encrypted(ref val) => {
24410                    fidl::encoding::encode_in_envelope::<EncryptedFormat, D>(
24411                        <EncryptedFormat as fidl::encoding::ValueTypeMarker>::borrow(val),
24412                        encoder,
24413                        offset + 8,
24414                        _depth,
24415                    )
24416                }
24417                CryptoFormat::Decrypted(ref val) => {
24418                    fidl::encoding::encode_in_envelope::<DecryptedFormat, D>(
24419                        <DecryptedFormat as fidl::encoding::ValueTypeMarker>::borrow(val),
24420                        encoder,
24421                        offset + 8,
24422                        _depth,
24423                    )
24424                }
24425                CryptoFormat::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
24426            }
24427        }
24428    }
24429
24430    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CryptoFormat {
24431        #[inline(always)]
24432        fn new_empty() -> Self {
24433            Self::__SourceBreaking { unknown_ordinal: 0 }
24434        }
24435
24436        #[inline]
24437        unsafe fn decode(
24438            &mut self,
24439            decoder: &mut fidl::encoding::Decoder<'_, D>,
24440            offset: usize,
24441            mut depth: fidl::encoding::Depth,
24442        ) -> fidl::Result<()> {
24443            decoder.debug_check_bounds::<Self>(offset);
24444            #[allow(unused_variables)]
24445            let next_out_of_line = decoder.next_out_of_line();
24446            let handles_before = decoder.remaining_handles();
24447            let (ordinal, inlined, num_bytes, num_handles) =
24448                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
24449
24450            let member_inline_size = match ordinal {
24451                1 => <EncryptedFormat as fidl::encoding::TypeMarker>::inline_size(decoder.context),
24452                2 => <DecryptedFormat as fidl::encoding::TypeMarker>::inline_size(decoder.context),
24453                0 => return Err(fidl::Error::UnknownUnionTag),
24454                _ => num_bytes as usize,
24455            };
24456
24457            if inlined != (member_inline_size <= 4) {
24458                return Err(fidl::Error::InvalidInlineBitInEnvelope);
24459            }
24460            let _inner_offset;
24461            if inlined {
24462                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
24463                _inner_offset = offset + 8;
24464            } else {
24465                depth.increment()?;
24466                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
24467            }
24468            match ordinal {
24469                1 => {
24470                    #[allow(irrefutable_let_patterns)]
24471                    if let CryptoFormat::Encrypted(_) = self {
24472                        // Do nothing, read the value into the object
24473                    } else {
24474                        // Initialize `self` to the right variant
24475                        *self = CryptoFormat::Encrypted(fidl::new_empty!(EncryptedFormat, D));
24476                    }
24477                    #[allow(irrefutable_let_patterns)]
24478                    if let CryptoFormat::Encrypted(ref mut val) = self {
24479                        fidl::decode!(EncryptedFormat, D, val, decoder, _inner_offset, depth)?;
24480                    } else {
24481                        unreachable!()
24482                    }
24483                }
24484                2 => {
24485                    #[allow(irrefutable_let_patterns)]
24486                    if let CryptoFormat::Decrypted(_) = self {
24487                        // Do nothing, read the value into the object
24488                    } else {
24489                        // Initialize `self` to the right variant
24490                        *self = CryptoFormat::Decrypted(fidl::new_empty!(DecryptedFormat, D));
24491                    }
24492                    #[allow(irrefutable_let_patterns)]
24493                    if let CryptoFormat::Decrypted(ref mut val) = self {
24494                        fidl::decode!(DecryptedFormat, D, val, decoder, _inner_offset, depth)?;
24495                    } else {
24496                        unreachable!()
24497                    }
24498                }
24499                #[allow(deprecated)]
24500                ordinal => {
24501                    for _ in 0..num_handles {
24502                        decoder.drop_next_handle()?;
24503                    }
24504                    *self = CryptoFormat::__SourceBreaking { unknown_ordinal: ordinal };
24505                }
24506            }
24507            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
24508                return Err(fidl::Error::InvalidNumBytesInEnvelope);
24509            }
24510            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
24511                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
24512            }
24513            Ok(())
24514        }
24515    }
24516
24517    impl fidl::encoding::ValueTypeMarker for DomainFormat {
24518        type Borrowed<'a> = &'a Self;
24519        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
24520            value
24521        }
24522    }
24523
24524    unsafe impl fidl::encoding::TypeMarker for DomainFormat {
24525        type Owned = Self;
24526
24527        #[inline(always)]
24528        fn inline_align(_context: fidl::encoding::Context) -> usize {
24529            8
24530        }
24531
24532        #[inline(always)]
24533        fn inline_size(_context: fidl::encoding::Context) -> usize {
24534            16
24535        }
24536    }
24537
24538    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DomainFormat, D>
24539        for &DomainFormat
24540    {
24541        #[inline]
24542        unsafe fn encode(
24543            self,
24544            encoder: &mut fidl::encoding::Encoder<'_, D>,
24545            offset: usize,
24546            _depth: fidl::encoding::Depth,
24547        ) -> fidl::Result<()> {
24548            encoder.debug_check_bounds::<DomainFormat>(offset);
24549            encoder.write_num::<u64>(self.ordinal(), offset);
24550            match self {
24551                DomainFormat::Audio(ref val) => {
24552                    fidl::encoding::encode_in_envelope::<AudioFormat, D>(
24553                        <AudioFormat as fidl::encoding::ValueTypeMarker>::borrow(val),
24554                        encoder,
24555                        offset + 8,
24556                        _depth,
24557                    )
24558                }
24559                DomainFormat::Video(ref val) => {
24560                    fidl::encoding::encode_in_envelope::<VideoFormat, D>(
24561                        <VideoFormat as fidl::encoding::ValueTypeMarker>::borrow(val),
24562                        encoder,
24563                        offset + 8,
24564                        _depth,
24565                    )
24566                }
24567                DomainFormat::Crypto(ref val) => {
24568                    fidl::encoding::encode_in_envelope::<CryptoFormat, D>(
24569                        <CryptoFormat as fidl::encoding::ValueTypeMarker>::borrow(val),
24570                        encoder,
24571                        offset + 8,
24572                        _depth,
24573                    )
24574                }
24575            }
24576        }
24577    }
24578
24579    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DomainFormat {
24580        #[inline(always)]
24581        fn new_empty() -> Self {
24582            Self::Audio(fidl::new_empty!(AudioFormat, D))
24583        }
24584
24585        #[inline]
24586        unsafe fn decode(
24587            &mut self,
24588            decoder: &mut fidl::encoding::Decoder<'_, D>,
24589            offset: usize,
24590            mut depth: fidl::encoding::Depth,
24591        ) -> fidl::Result<()> {
24592            decoder.debug_check_bounds::<Self>(offset);
24593            #[allow(unused_variables)]
24594            let next_out_of_line = decoder.next_out_of_line();
24595            let handles_before = decoder.remaining_handles();
24596            let (ordinal, inlined, num_bytes, num_handles) =
24597                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
24598
24599            let member_inline_size = match ordinal {
24600                1 => <AudioFormat as fidl::encoding::TypeMarker>::inline_size(decoder.context),
24601                2 => <VideoFormat as fidl::encoding::TypeMarker>::inline_size(decoder.context),
24602                3 => <CryptoFormat as fidl::encoding::TypeMarker>::inline_size(decoder.context),
24603                _ => return Err(fidl::Error::UnknownUnionTag),
24604            };
24605
24606            if inlined != (member_inline_size <= 4) {
24607                return Err(fidl::Error::InvalidInlineBitInEnvelope);
24608            }
24609            let _inner_offset;
24610            if inlined {
24611                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
24612                _inner_offset = offset + 8;
24613            } else {
24614                depth.increment()?;
24615                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
24616            }
24617            match ordinal {
24618                1 => {
24619                    #[allow(irrefutable_let_patterns)]
24620                    if let DomainFormat::Audio(_) = self {
24621                        // Do nothing, read the value into the object
24622                    } else {
24623                        // Initialize `self` to the right variant
24624                        *self = DomainFormat::Audio(fidl::new_empty!(AudioFormat, D));
24625                    }
24626                    #[allow(irrefutable_let_patterns)]
24627                    if let DomainFormat::Audio(ref mut val) = self {
24628                        fidl::decode!(AudioFormat, D, val, decoder, _inner_offset, depth)?;
24629                    } else {
24630                        unreachable!()
24631                    }
24632                }
24633                2 => {
24634                    #[allow(irrefutable_let_patterns)]
24635                    if let DomainFormat::Video(_) = self {
24636                        // Do nothing, read the value into the object
24637                    } else {
24638                        // Initialize `self` to the right variant
24639                        *self = DomainFormat::Video(fidl::new_empty!(VideoFormat, D));
24640                    }
24641                    #[allow(irrefutable_let_patterns)]
24642                    if let DomainFormat::Video(ref mut val) = self {
24643                        fidl::decode!(VideoFormat, D, val, decoder, _inner_offset, depth)?;
24644                    } else {
24645                        unreachable!()
24646                    }
24647                }
24648                3 => {
24649                    #[allow(irrefutable_let_patterns)]
24650                    if let DomainFormat::Crypto(_) = self {
24651                        // Do nothing, read the value into the object
24652                    } else {
24653                        // Initialize `self` to the right variant
24654                        *self = DomainFormat::Crypto(fidl::new_empty!(CryptoFormat, D));
24655                    }
24656                    #[allow(irrefutable_let_patterns)]
24657                    if let DomainFormat::Crypto(ref mut val) = self {
24658                        fidl::decode!(CryptoFormat, D, val, decoder, _inner_offset, depth)?;
24659                    } else {
24660                        unreachable!()
24661                    }
24662                }
24663                ordinal => panic!("unexpected ordinal {:?}", ordinal),
24664            }
24665            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
24666                return Err(fidl::Error::InvalidNumBytesInEnvelope);
24667            }
24668            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
24669                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
24670            }
24671            Ok(())
24672        }
24673    }
24674
24675    impl fidl::encoding::ValueTypeMarker for EncoderSettings {
24676        type Borrowed<'a> = &'a Self;
24677        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
24678            value
24679        }
24680    }
24681
24682    unsafe impl fidl::encoding::TypeMarker for EncoderSettings {
24683        type Owned = Self;
24684
24685        #[inline(always)]
24686        fn inline_align(_context: fidl::encoding::Context) -> usize {
24687            8
24688        }
24689
24690        #[inline(always)]
24691        fn inline_size(_context: fidl::encoding::Context) -> usize {
24692            16
24693        }
24694    }
24695
24696    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<EncoderSettings, D>
24697        for &EncoderSettings
24698    {
24699        #[inline]
24700        unsafe fn encode(
24701            self,
24702            encoder: &mut fidl::encoding::Encoder<'_, D>,
24703            offset: usize,
24704            _depth: fidl::encoding::Depth,
24705        ) -> fidl::Result<()> {
24706            encoder.debug_check_bounds::<EncoderSettings>(offset);
24707            encoder.write_num::<u64>(self.ordinal(), offset);
24708            match self {
24709                EncoderSettings::Sbc(ref val) => {
24710                    fidl::encoding::encode_in_envelope::<SbcEncoderSettings, D>(
24711                        <SbcEncoderSettings as fidl::encoding::ValueTypeMarker>::borrow(val),
24712                        encoder,
24713                        offset + 8,
24714                        _depth,
24715                    )
24716                }
24717                EncoderSettings::Aac(ref val) => {
24718                    fidl::encoding::encode_in_envelope::<AacEncoderSettings, D>(
24719                        <AacEncoderSettings as fidl::encoding::ValueTypeMarker>::borrow(val),
24720                        encoder,
24721                        offset + 8,
24722                        _depth,
24723                    )
24724                }
24725                EncoderSettings::H264(ref val) => {
24726                    fidl::encoding::encode_in_envelope::<H264EncoderSettings, D>(
24727                        <H264EncoderSettings as fidl::encoding::ValueTypeMarker>::borrow(val),
24728                        encoder,
24729                        offset + 8,
24730                        _depth,
24731                    )
24732                }
24733                EncoderSettings::Hevc(ref val) => {
24734                    fidl::encoding::encode_in_envelope::<HevcEncoderSettings, D>(
24735                        <HevcEncoderSettings as fidl::encoding::ValueTypeMarker>::borrow(val),
24736                        encoder,
24737                        offset + 8,
24738                        _depth,
24739                    )
24740                }
24741                EncoderSettings::Cvsd(ref val) => {
24742                    fidl::encoding::encode_in_envelope::<CvsdEncoderSettings, D>(
24743                        <CvsdEncoderSettings as fidl::encoding::ValueTypeMarker>::borrow(val),
24744                        encoder,
24745                        offset + 8,
24746                        _depth,
24747                    )
24748                }
24749                EncoderSettings::Lc3(ref val) => {
24750                    fidl::encoding::encode_in_envelope::<Lc3EncoderSettings, D>(
24751                        <Lc3EncoderSettings as fidl::encoding::ValueTypeMarker>::borrow(val),
24752                        encoder,
24753                        offset + 8,
24754                        _depth,
24755                    )
24756                }
24757                EncoderSettings::Msbc(ref val) => {
24758                    fidl::encoding::encode_in_envelope::<MSbcEncoderSettings, D>(
24759                        <MSbcEncoderSettings as fidl::encoding::ValueTypeMarker>::borrow(val),
24760                        encoder,
24761                        offset + 8,
24762                        _depth,
24763                    )
24764                }
24765                EncoderSettings::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
24766            }
24767        }
24768    }
24769
24770    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for EncoderSettings {
24771        #[inline(always)]
24772        fn new_empty() -> Self {
24773            Self::__SourceBreaking { unknown_ordinal: 0 }
24774        }
24775
24776        #[inline]
24777        unsafe fn decode(
24778            &mut self,
24779            decoder: &mut fidl::encoding::Decoder<'_, D>,
24780            offset: usize,
24781            mut depth: fidl::encoding::Depth,
24782        ) -> fidl::Result<()> {
24783            decoder.debug_check_bounds::<Self>(offset);
24784            #[allow(unused_variables)]
24785            let next_out_of_line = decoder.next_out_of_line();
24786            let handles_before = decoder.remaining_handles();
24787            let (ordinal, inlined, num_bytes, num_handles) =
24788                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
24789
24790            let member_inline_size = match ordinal {
24791                1 => {
24792                    <SbcEncoderSettings as fidl::encoding::TypeMarker>::inline_size(decoder.context)
24793                }
24794                2 => {
24795                    <AacEncoderSettings as fidl::encoding::TypeMarker>::inline_size(decoder.context)
24796                }
24797                3 => <H264EncoderSettings as fidl::encoding::TypeMarker>::inline_size(
24798                    decoder.context,
24799                ),
24800                4 => <HevcEncoderSettings as fidl::encoding::TypeMarker>::inline_size(
24801                    decoder.context,
24802                ),
24803                5 => <CvsdEncoderSettings as fidl::encoding::TypeMarker>::inline_size(
24804                    decoder.context,
24805                ),
24806                6 => {
24807                    <Lc3EncoderSettings as fidl::encoding::TypeMarker>::inline_size(decoder.context)
24808                }
24809                7 => <MSbcEncoderSettings as fidl::encoding::TypeMarker>::inline_size(
24810                    decoder.context,
24811                ),
24812                0 => return Err(fidl::Error::UnknownUnionTag),
24813                _ => num_bytes as usize,
24814            };
24815
24816            if inlined != (member_inline_size <= 4) {
24817                return Err(fidl::Error::InvalidInlineBitInEnvelope);
24818            }
24819            let _inner_offset;
24820            if inlined {
24821                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
24822                _inner_offset = offset + 8;
24823            } else {
24824                depth.increment()?;
24825                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
24826            }
24827            match ordinal {
24828                1 => {
24829                    #[allow(irrefutable_let_patterns)]
24830                    if let EncoderSettings::Sbc(_) = self {
24831                        // Do nothing, read the value into the object
24832                    } else {
24833                        // Initialize `self` to the right variant
24834                        *self = EncoderSettings::Sbc(fidl::new_empty!(SbcEncoderSettings, D));
24835                    }
24836                    #[allow(irrefutable_let_patterns)]
24837                    if let EncoderSettings::Sbc(ref mut val) = self {
24838                        fidl::decode!(SbcEncoderSettings, D, val, decoder, _inner_offset, depth)?;
24839                    } else {
24840                        unreachable!()
24841                    }
24842                }
24843                2 => {
24844                    #[allow(irrefutable_let_patterns)]
24845                    if let EncoderSettings::Aac(_) = self {
24846                        // Do nothing, read the value into the object
24847                    } else {
24848                        // Initialize `self` to the right variant
24849                        *self = EncoderSettings::Aac(fidl::new_empty!(AacEncoderSettings, D));
24850                    }
24851                    #[allow(irrefutable_let_patterns)]
24852                    if let EncoderSettings::Aac(ref mut val) = self {
24853                        fidl::decode!(AacEncoderSettings, D, val, decoder, _inner_offset, depth)?;
24854                    } else {
24855                        unreachable!()
24856                    }
24857                }
24858                3 => {
24859                    #[allow(irrefutable_let_patterns)]
24860                    if let EncoderSettings::H264(_) = self {
24861                        // Do nothing, read the value into the object
24862                    } else {
24863                        // Initialize `self` to the right variant
24864                        *self = EncoderSettings::H264(fidl::new_empty!(H264EncoderSettings, D));
24865                    }
24866                    #[allow(irrefutable_let_patterns)]
24867                    if let EncoderSettings::H264(ref mut val) = self {
24868                        fidl::decode!(H264EncoderSettings, D, val, decoder, _inner_offset, depth)?;
24869                    } else {
24870                        unreachable!()
24871                    }
24872                }
24873                4 => {
24874                    #[allow(irrefutable_let_patterns)]
24875                    if let EncoderSettings::Hevc(_) = self {
24876                        // Do nothing, read the value into the object
24877                    } else {
24878                        // Initialize `self` to the right variant
24879                        *self = EncoderSettings::Hevc(fidl::new_empty!(HevcEncoderSettings, D));
24880                    }
24881                    #[allow(irrefutable_let_patterns)]
24882                    if let EncoderSettings::Hevc(ref mut val) = self {
24883                        fidl::decode!(HevcEncoderSettings, D, val, decoder, _inner_offset, depth)?;
24884                    } else {
24885                        unreachable!()
24886                    }
24887                }
24888                5 => {
24889                    #[allow(irrefutable_let_patterns)]
24890                    if let EncoderSettings::Cvsd(_) = self {
24891                        // Do nothing, read the value into the object
24892                    } else {
24893                        // Initialize `self` to the right variant
24894                        *self = EncoderSettings::Cvsd(fidl::new_empty!(CvsdEncoderSettings, D));
24895                    }
24896                    #[allow(irrefutable_let_patterns)]
24897                    if let EncoderSettings::Cvsd(ref mut val) = self {
24898                        fidl::decode!(CvsdEncoderSettings, D, val, decoder, _inner_offset, depth)?;
24899                    } else {
24900                        unreachable!()
24901                    }
24902                }
24903                6 => {
24904                    #[allow(irrefutable_let_patterns)]
24905                    if let EncoderSettings::Lc3(_) = self {
24906                        // Do nothing, read the value into the object
24907                    } else {
24908                        // Initialize `self` to the right variant
24909                        *self = EncoderSettings::Lc3(fidl::new_empty!(Lc3EncoderSettings, D));
24910                    }
24911                    #[allow(irrefutable_let_patterns)]
24912                    if let EncoderSettings::Lc3(ref mut val) = self {
24913                        fidl::decode!(Lc3EncoderSettings, D, val, decoder, _inner_offset, depth)?;
24914                    } else {
24915                        unreachable!()
24916                    }
24917                }
24918                7 => {
24919                    #[allow(irrefutable_let_patterns)]
24920                    if let EncoderSettings::Msbc(_) = self {
24921                        // Do nothing, read the value into the object
24922                    } else {
24923                        // Initialize `self` to the right variant
24924                        *self = EncoderSettings::Msbc(fidl::new_empty!(MSbcEncoderSettings, D));
24925                    }
24926                    #[allow(irrefutable_let_patterns)]
24927                    if let EncoderSettings::Msbc(ref mut val) = self {
24928                        fidl::decode!(MSbcEncoderSettings, D, val, decoder, _inner_offset, depth)?;
24929                    } else {
24930                        unreachable!()
24931                    }
24932                }
24933                #[allow(deprecated)]
24934                ordinal => {
24935                    for _ in 0..num_handles {
24936                        decoder.drop_next_handle()?;
24937                    }
24938                    *self = EncoderSettings::__SourceBreaking { unknown_ordinal: ordinal };
24939                }
24940            }
24941            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
24942                return Err(fidl::Error::InvalidNumBytesInEnvelope);
24943            }
24944            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
24945                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
24946            }
24947            Ok(())
24948        }
24949    }
24950
24951    impl fidl::encoding::ValueTypeMarker for MediumSpecificStreamType {
24952        type Borrowed<'a> = &'a Self;
24953        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
24954            value
24955        }
24956    }
24957
24958    unsafe impl fidl::encoding::TypeMarker for MediumSpecificStreamType {
24959        type Owned = Self;
24960
24961        #[inline(always)]
24962        fn inline_align(_context: fidl::encoding::Context) -> usize {
24963            8
24964        }
24965
24966        #[inline(always)]
24967        fn inline_size(_context: fidl::encoding::Context) -> usize {
24968            16
24969        }
24970    }
24971
24972    unsafe impl<D: fidl::encoding::ResourceDialect>
24973        fidl::encoding::Encode<MediumSpecificStreamType, D> for &MediumSpecificStreamType
24974    {
24975        #[inline]
24976        unsafe fn encode(
24977            self,
24978            encoder: &mut fidl::encoding::Encoder<'_, D>,
24979            offset: usize,
24980            _depth: fidl::encoding::Depth,
24981        ) -> fidl::Result<()> {
24982            encoder.debug_check_bounds::<MediumSpecificStreamType>(offset);
24983            encoder.write_num::<u64>(self.ordinal(), offset);
24984            match self {
24985                MediumSpecificStreamType::Audio(ref val) => {
24986                    fidl::encoding::encode_in_envelope::<AudioStreamType, D>(
24987                        <AudioStreamType as fidl::encoding::ValueTypeMarker>::borrow(val),
24988                        encoder,
24989                        offset + 8,
24990                        _depth,
24991                    )
24992                }
24993                MediumSpecificStreamType::Video(ref val) => {
24994                    fidl::encoding::encode_in_envelope::<VideoStreamType, D>(
24995                        <VideoStreamType as fidl::encoding::ValueTypeMarker>::borrow(val),
24996                        encoder,
24997                        offset + 8,
24998                        _depth,
24999                    )
25000                }
25001                MediumSpecificStreamType::Text(ref val) => {
25002                    fidl::encoding::encode_in_envelope::<TextStreamType, D>(
25003                        <TextStreamType as fidl::encoding::ValueTypeMarker>::borrow(val),
25004                        encoder,
25005                        offset + 8,
25006                        _depth,
25007                    )
25008                }
25009                MediumSpecificStreamType::Subpicture(ref val) => {
25010                    fidl::encoding::encode_in_envelope::<SubpictureStreamType, D>(
25011                        <SubpictureStreamType as fidl::encoding::ValueTypeMarker>::borrow(val),
25012                        encoder,
25013                        offset + 8,
25014                        _depth,
25015                    )
25016                }
25017            }
25018        }
25019    }
25020
25021    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
25022        for MediumSpecificStreamType
25023    {
25024        #[inline(always)]
25025        fn new_empty() -> Self {
25026            Self::Audio(fidl::new_empty!(AudioStreamType, D))
25027        }
25028
25029        #[inline]
25030        unsafe fn decode(
25031            &mut self,
25032            decoder: &mut fidl::encoding::Decoder<'_, D>,
25033            offset: usize,
25034            mut depth: fidl::encoding::Depth,
25035        ) -> fidl::Result<()> {
25036            decoder.debug_check_bounds::<Self>(offset);
25037            #[allow(unused_variables)]
25038            let next_out_of_line = decoder.next_out_of_line();
25039            let handles_before = decoder.remaining_handles();
25040            let (ordinal, inlined, num_bytes, num_handles) =
25041                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
25042
25043            let member_inline_size = match ordinal {
25044                1 => <AudioStreamType as fidl::encoding::TypeMarker>::inline_size(decoder.context),
25045                2 => <VideoStreamType as fidl::encoding::TypeMarker>::inline_size(decoder.context),
25046                3 => <TextStreamType as fidl::encoding::TypeMarker>::inline_size(decoder.context),
25047                4 => <SubpictureStreamType as fidl::encoding::TypeMarker>::inline_size(
25048                    decoder.context,
25049                ),
25050                _ => return Err(fidl::Error::UnknownUnionTag),
25051            };
25052
25053            if inlined != (member_inline_size <= 4) {
25054                return Err(fidl::Error::InvalidInlineBitInEnvelope);
25055            }
25056            let _inner_offset;
25057            if inlined {
25058                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
25059                _inner_offset = offset + 8;
25060            } else {
25061                depth.increment()?;
25062                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
25063            }
25064            match ordinal {
25065                1 => {
25066                    #[allow(irrefutable_let_patterns)]
25067                    if let MediumSpecificStreamType::Audio(_) = self {
25068                        // Do nothing, read the value into the object
25069                    } else {
25070                        // Initialize `self` to the right variant
25071                        *self =
25072                            MediumSpecificStreamType::Audio(fidl::new_empty!(AudioStreamType, D));
25073                    }
25074                    #[allow(irrefutable_let_patterns)]
25075                    if let MediumSpecificStreamType::Audio(ref mut val) = self {
25076                        fidl::decode!(AudioStreamType, D, val, decoder, _inner_offset, depth)?;
25077                    } else {
25078                        unreachable!()
25079                    }
25080                }
25081                2 => {
25082                    #[allow(irrefutable_let_patterns)]
25083                    if let MediumSpecificStreamType::Video(_) = self {
25084                        // Do nothing, read the value into the object
25085                    } else {
25086                        // Initialize `self` to the right variant
25087                        *self =
25088                            MediumSpecificStreamType::Video(fidl::new_empty!(VideoStreamType, D));
25089                    }
25090                    #[allow(irrefutable_let_patterns)]
25091                    if let MediumSpecificStreamType::Video(ref mut val) = self {
25092                        fidl::decode!(VideoStreamType, D, val, decoder, _inner_offset, depth)?;
25093                    } else {
25094                        unreachable!()
25095                    }
25096                }
25097                3 => {
25098                    #[allow(irrefutable_let_patterns)]
25099                    if let MediumSpecificStreamType::Text(_) = self {
25100                        // Do nothing, read the value into the object
25101                    } else {
25102                        // Initialize `self` to the right variant
25103                        *self = MediumSpecificStreamType::Text(fidl::new_empty!(TextStreamType, D));
25104                    }
25105                    #[allow(irrefutable_let_patterns)]
25106                    if let MediumSpecificStreamType::Text(ref mut val) = self {
25107                        fidl::decode!(TextStreamType, D, val, decoder, _inner_offset, depth)?;
25108                    } else {
25109                        unreachable!()
25110                    }
25111                }
25112                4 => {
25113                    #[allow(irrefutable_let_patterns)]
25114                    if let MediumSpecificStreamType::Subpicture(_) = self {
25115                        // Do nothing, read the value into the object
25116                    } else {
25117                        // Initialize `self` to the right variant
25118                        *self = MediumSpecificStreamType::Subpicture(fidl::new_empty!(
25119                            SubpictureStreamType,
25120                            D
25121                        ));
25122                    }
25123                    #[allow(irrefutable_let_patterns)]
25124                    if let MediumSpecificStreamType::Subpicture(ref mut val) = self {
25125                        fidl::decode!(SubpictureStreamType, D, val, decoder, _inner_offset, depth)?;
25126                    } else {
25127                        unreachable!()
25128                    }
25129                }
25130                ordinal => panic!("unexpected ordinal {:?}", ordinal),
25131            }
25132            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
25133                return Err(fidl::Error::InvalidNumBytesInEnvelope);
25134            }
25135            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
25136                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
25137            }
25138            Ok(())
25139        }
25140    }
25141
25142    impl fidl::encoding::ValueTypeMarker for Usage {
25143        type Borrowed<'a> = &'a Self;
25144        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
25145            value
25146        }
25147    }
25148
25149    unsafe impl fidl::encoding::TypeMarker for Usage {
25150        type Owned = Self;
25151
25152        #[inline(always)]
25153        fn inline_align(_context: fidl::encoding::Context) -> usize {
25154            8
25155        }
25156
25157        #[inline(always)]
25158        fn inline_size(_context: fidl::encoding::Context) -> usize {
25159            16
25160        }
25161    }
25162
25163    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Usage, D> for &Usage {
25164        #[inline]
25165        unsafe fn encode(
25166            self,
25167            encoder: &mut fidl::encoding::Encoder<'_, D>,
25168            offset: usize,
25169            _depth: fidl::encoding::Depth,
25170        ) -> fidl::Result<()> {
25171            encoder.debug_check_bounds::<Usage>(offset);
25172            encoder.write_num::<u64>(self.ordinal(), offset);
25173            match self {
25174                Usage::RenderUsage(ref val) => {
25175                    fidl::encoding::encode_in_envelope::<AudioRenderUsage, D>(
25176                        <AudioRenderUsage as fidl::encoding::ValueTypeMarker>::borrow(val),
25177                        encoder,
25178                        offset + 8,
25179                        _depth,
25180                    )
25181                }
25182                Usage::CaptureUsage(ref val) => {
25183                    fidl::encoding::encode_in_envelope::<AudioCaptureUsage, D>(
25184                        <AudioCaptureUsage as fidl::encoding::ValueTypeMarker>::borrow(val),
25185                        encoder,
25186                        offset + 8,
25187                        _depth,
25188                    )
25189                }
25190            }
25191        }
25192    }
25193
25194    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Usage {
25195        #[inline(always)]
25196        fn new_empty() -> Self {
25197            Self::RenderUsage(fidl::new_empty!(AudioRenderUsage, D))
25198        }
25199
25200        #[inline]
25201        unsafe fn decode(
25202            &mut self,
25203            decoder: &mut fidl::encoding::Decoder<'_, D>,
25204            offset: usize,
25205            mut depth: fidl::encoding::Depth,
25206        ) -> fidl::Result<()> {
25207            decoder.debug_check_bounds::<Self>(offset);
25208            #[allow(unused_variables)]
25209            let next_out_of_line = decoder.next_out_of_line();
25210            let handles_before = decoder.remaining_handles();
25211            let (ordinal, inlined, num_bytes, num_handles) =
25212                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
25213
25214            let member_inline_size = match ordinal {
25215                1 => <AudioRenderUsage as fidl::encoding::TypeMarker>::inline_size(decoder.context),
25216                2 => {
25217                    <AudioCaptureUsage as fidl::encoding::TypeMarker>::inline_size(decoder.context)
25218                }
25219                _ => return Err(fidl::Error::UnknownUnionTag),
25220            };
25221
25222            if inlined != (member_inline_size <= 4) {
25223                return Err(fidl::Error::InvalidInlineBitInEnvelope);
25224            }
25225            let _inner_offset;
25226            if inlined {
25227                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
25228                _inner_offset = offset + 8;
25229            } else {
25230                depth.increment()?;
25231                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
25232            }
25233            match ordinal {
25234                1 => {
25235                    #[allow(irrefutable_let_patterns)]
25236                    if let Usage::RenderUsage(_) = self {
25237                        // Do nothing, read the value into the object
25238                    } else {
25239                        // Initialize `self` to the right variant
25240                        *self = Usage::RenderUsage(fidl::new_empty!(AudioRenderUsage, D));
25241                    }
25242                    #[allow(irrefutable_let_patterns)]
25243                    if let Usage::RenderUsage(ref mut val) = self {
25244                        fidl::decode!(AudioRenderUsage, D, val, decoder, _inner_offset, depth)?;
25245                    } else {
25246                        unreachable!()
25247                    }
25248                }
25249                2 => {
25250                    #[allow(irrefutable_let_patterns)]
25251                    if let Usage::CaptureUsage(_) = self {
25252                        // Do nothing, read the value into the object
25253                    } else {
25254                        // Initialize `self` to the right variant
25255                        *self = Usage::CaptureUsage(fidl::new_empty!(AudioCaptureUsage, D));
25256                    }
25257                    #[allow(irrefutable_let_patterns)]
25258                    if let Usage::CaptureUsage(ref mut val) = self {
25259                        fidl::decode!(AudioCaptureUsage, D, val, decoder, _inner_offset, depth)?;
25260                    } else {
25261                        unreachable!()
25262                    }
25263                }
25264                ordinal => panic!("unexpected ordinal {:?}", ordinal),
25265            }
25266            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
25267                return Err(fidl::Error::InvalidNumBytesInEnvelope);
25268            }
25269            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
25270                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
25271            }
25272            Ok(())
25273        }
25274    }
25275
25276    impl fidl::encoding::ValueTypeMarker for Usage2 {
25277        type Borrowed<'a> = &'a Self;
25278        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
25279            value
25280        }
25281    }
25282
25283    unsafe impl fidl::encoding::TypeMarker for Usage2 {
25284        type Owned = Self;
25285
25286        #[inline(always)]
25287        fn inline_align(_context: fidl::encoding::Context) -> usize {
25288            8
25289        }
25290
25291        #[inline(always)]
25292        fn inline_size(_context: fidl::encoding::Context) -> usize {
25293            16
25294        }
25295    }
25296
25297    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Usage2, D> for &Usage2 {
25298        #[inline]
25299        unsafe fn encode(
25300            self,
25301            encoder: &mut fidl::encoding::Encoder<'_, D>,
25302            offset: usize,
25303            _depth: fidl::encoding::Depth,
25304        ) -> fidl::Result<()> {
25305            encoder.debug_check_bounds::<Usage2>(offset);
25306            encoder.write_num::<u64>(self.ordinal(), offset);
25307            match self {
25308                Usage2::RenderUsage(ref val) => {
25309                    fidl::encoding::encode_in_envelope::<AudioRenderUsage2, D>(
25310                        <AudioRenderUsage2 as fidl::encoding::ValueTypeMarker>::borrow(val),
25311                        encoder,
25312                        offset + 8,
25313                        _depth,
25314                    )
25315                }
25316                Usage2::CaptureUsage(ref val) => {
25317                    fidl::encoding::encode_in_envelope::<AudioCaptureUsage2, D>(
25318                        <AudioCaptureUsage2 as fidl::encoding::ValueTypeMarker>::borrow(val),
25319                        encoder,
25320                        offset + 8,
25321                        _depth,
25322                    )
25323                }
25324                Usage2::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
25325            }
25326        }
25327    }
25328
25329    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Usage2 {
25330        #[inline(always)]
25331        fn new_empty() -> Self {
25332            Self::__SourceBreaking { unknown_ordinal: 0 }
25333        }
25334
25335        #[inline]
25336        unsafe fn decode(
25337            &mut self,
25338            decoder: &mut fidl::encoding::Decoder<'_, D>,
25339            offset: usize,
25340            mut depth: fidl::encoding::Depth,
25341        ) -> fidl::Result<()> {
25342            decoder.debug_check_bounds::<Self>(offset);
25343            #[allow(unused_variables)]
25344            let next_out_of_line = decoder.next_out_of_line();
25345            let handles_before = decoder.remaining_handles();
25346            let (ordinal, inlined, num_bytes, num_handles) =
25347                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
25348
25349            let member_inline_size = match ordinal {
25350                1 => {
25351                    <AudioRenderUsage2 as fidl::encoding::TypeMarker>::inline_size(decoder.context)
25352                }
25353                2 => {
25354                    <AudioCaptureUsage2 as fidl::encoding::TypeMarker>::inline_size(decoder.context)
25355                }
25356                0 => return Err(fidl::Error::UnknownUnionTag),
25357                _ => num_bytes as usize,
25358            };
25359
25360            if inlined != (member_inline_size <= 4) {
25361                return Err(fidl::Error::InvalidInlineBitInEnvelope);
25362            }
25363            let _inner_offset;
25364            if inlined {
25365                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
25366                _inner_offset = offset + 8;
25367            } else {
25368                depth.increment()?;
25369                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
25370            }
25371            match ordinal {
25372                1 => {
25373                    #[allow(irrefutable_let_patterns)]
25374                    if let Usage2::RenderUsage(_) = self {
25375                        // Do nothing, read the value into the object
25376                    } else {
25377                        // Initialize `self` to the right variant
25378                        *self = Usage2::RenderUsage(fidl::new_empty!(AudioRenderUsage2, D));
25379                    }
25380                    #[allow(irrefutable_let_patterns)]
25381                    if let Usage2::RenderUsage(ref mut val) = self {
25382                        fidl::decode!(AudioRenderUsage2, D, val, decoder, _inner_offset, depth)?;
25383                    } else {
25384                        unreachable!()
25385                    }
25386                }
25387                2 => {
25388                    #[allow(irrefutable_let_patterns)]
25389                    if let Usage2::CaptureUsage(_) = self {
25390                        // Do nothing, read the value into the object
25391                    } else {
25392                        // Initialize `self` to the right variant
25393                        *self = Usage2::CaptureUsage(fidl::new_empty!(AudioCaptureUsage2, D));
25394                    }
25395                    #[allow(irrefutable_let_patterns)]
25396                    if let Usage2::CaptureUsage(ref mut val) = self {
25397                        fidl::decode!(AudioCaptureUsage2, D, val, decoder, _inner_offset, depth)?;
25398                    } else {
25399                        unreachable!()
25400                    }
25401                }
25402                #[allow(deprecated)]
25403                ordinal => {
25404                    for _ in 0..num_handles {
25405                        decoder.drop_next_handle()?;
25406                    }
25407                    *self = Usage2::__SourceBreaking { unknown_ordinal: ordinal };
25408                }
25409            }
25410            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
25411                return Err(fidl::Error::InvalidNumBytesInEnvelope);
25412            }
25413            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
25414                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
25415            }
25416            Ok(())
25417        }
25418    }
25419
25420    impl fidl::encoding::ValueTypeMarker for UsageState {
25421        type Borrowed<'a> = &'a Self;
25422        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
25423            value
25424        }
25425    }
25426
25427    unsafe impl fidl::encoding::TypeMarker for UsageState {
25428        type Owned = Self;
25429
25430        #[inline(always)]
25431        fn inline_align(_context: fidl::encoding::Context) -> usize {
25432            8
25433        }
25434
25435        #[inline(always)]
25436        fn inline_size(_context: fidl::encoding::Context) -> usize {
25437            16
25438        }
25439    }
25440
25441    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<UsageState, D>
25442        for &UsageState
25443    {
25444        #[inline]
25445        unsafe fn encode(
25446            self,
25447            encoder: &mut fidl::encoding::Encoder<'_, D>,
25448            offset: usize,
25449            _depth: fidl::encoding::Depth,
25450        ) -> fidl::Result<()> {
25451            encoder.debug_check_bounds::<UsageState>(offset);
25452            encoder.write_num::<u64>(self.ordinal(), offset);
25453            match self {
25454                UsageState::Unadjusted(ref val) => {
25455                    fidl::encoding::encode_in_envelope::<UsageStateUnadjusted, D>(
25456                        <UsageStateUnadjusted as fidl::encoding::ValueTypeMarker>::borrow(val),
25457                        encoder,
25458                        offset + 8,
25459                        _depth,
25460                    )
25461                }
25462                UsageState::Ducked(ref val) => {
25463                    fidl::encoding::encode_in_envelope::<UsageStateDucked, D>(
25464                        <UsageStateDucked as fidl::encoding::ValueTypeMarker>::borrow(val),
25465                        encoder,
25466                        offset + 8,
25467                        _depth,
25468                    )
25469                }
25470                UsageState::Muted(ref val) => {
25471                    fidl::encoding::encode_in_envelope::<UsageStateMuted, D>(
25472                        <UsageStateMuted as fidl::encoding::ValueTypeMarker>::borrow(val),
25473                        encoder,
25474                        offset + 8,
25475                        _depth,
25476                    )
25477                }
25478                UsageState::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
25479            }
25480        }
25481    }
25482
25483    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for UsageState {
25484        #[inline(always)]
25485        fn new_empty() -> Self {
25486            Self::__SourceBreaking { unknown_ordinal: 0 }
25487        }
25488
25489        #[inline]
25490        unsafe fn decode(
25491            &mut self,
25492            decoder: &mut fidl::encoding::Decoder<'_, D>,
25493            offset: usize,
25494            mut depth: fidl::encoding::Depth,
25495        ) -> fidl::Result<()> {
25496            decoder.debug_check_bounds::<Self>(offset);
25497            #[allow(unused_variables)]
25498            let next_out_of_line = decoder.next_out_of_line();
25499            let handles_before = decoder.remaining_handles();
25500            let (ordinal, inlined, num_bytes, num_handles) =
25501                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
25502
25503            let member_inline_size = match ordinal {
25504                1 => <UsageStateUnadjusted as fidl::encoding::TypeMarker>::inline_size(
25505                    decoder.context,
25506                ),
25507                2 => <UsageStateDucked as fidl::encoding::TypeMarker>::inline_size(decoder.context),
25508                3 => <UsageStateMuted as fidl::encoding::TypeMarker>::inline_size(decoder.context),
25509                0 => return Err(fidl::Error::UnknownUnionTag),
25510                _ => num_bytes as usize,
25511            };
25512
25513            if inlined != (member_inline_size <= 4) {
25514                return Err(fidl::Error::InvalidInlineBitInEnvelope);
25515            }
25516            let _inner_offset;
25517            if inlined {
25518                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
25519                _inner_offset = offset + 8;
25520            } else {
25521                depth.increment()?;
25522                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
25523            }
25524            match ordinal {
25525                1 => {
25526                    #[allow(irrefutable_let_patterns)]
25527                    if let UsageState::Unadjusted(_) = self {
25528                        // Do nothing, read the value into the object
25529                    } else {
25530                        // Initialize `self` to the right variant
25531                        *self = UsageState::Unadjusted(fidl::new_empty!(UsageStateUnadjusted, D));
25532                    }
25533                    #[allow(irrefutable_let_patterns)]
25534                    if let UsageState::Unadjusted(ref mut val) = self {
25535                        fidl::decode!(UsageStateUnadjusted, D, val, decoder, _inner_offset, depth)?;
25536                    } else {
25537                        unreachable!()
25538                    }
25539                }
25540                2 => {
25541                    #[allow(irrefutable_let_patterns)]
25542                    if let UsageState::Ducked(_) = self {
25543                        // Do nothing, read the value into the object
25544                    } else {
25545                        // Initialize `self` to the right variant
25546                        *self = UsageState::Ducked(fidl::new_empty!(UsageStateDucked, D));
25547                    }
25548                    #[allow(irrefutable_let_patterns)]
25549                    if let UsageState::Ducked(ref mut val) = self {
25550                        fidl::decode!(UsageStateDucked, D, val, decoder, _inner_offset, depth)?;
25551                    } else {
25552                        unreachable!()
25553                    }
25554                }
25555                3 => {
25556                    #[allow(irrefutable_let_patterns)]
25557                    if let UsageState::Muted(_) = self {
25558                        // Do nothing, read the value into the object
25559                    } else {
25560                        // Initialize `self` to the right variant
25561                        *self = UsageState::Muted(fidl::new_empty!(UsageStateMuted, D));
25562                    }
25563                    #[allow(irrefutable_let_patterns)]
25564                    if let UsageState::Muted(ref mut val) = self {
25565                        fidl::decode!(UsageStateMuted, D, val, decoder, _inner_offset, depth)?;
25566                    } else {
25567                        unreachable!()
25568                    }
25569                }
25570                #[allow(deprecated)]
25571                ordinal => {
25572                    for _ in 0..num_handles {
25573                        decoder.drop_next_handle()?;
25574                    }
25575                    *self = UsageState::__SourceBreaking { unknown_ordinal: ordinal };
25576                }
25577            }
25578            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
25579                return Err(fidl::Error::InvalidNumBytesInEnvelope);
25580            }
25581            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
25582                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
25583            }
25584            Ok(())
25585        }
25586    }
25587
25588    impl fidl::encoding::ValueTypeMarker for Value {
25589        type Borrowed<'a> = &'a Self;
25590        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
25591            value
25592        }
25593    }
25594
25595    unsafe impl fidl::encoding::TypeMarker for Value {
25596        type Owned = Self;
25597
25598        #[inline(always)]
25599        fn inline_align(_context: fidl::encoding::Context) -> usize {
25600            8
25601        }
25602
25603        #[inline(always)]
25604        fn inline_size(_context: fidl::encoding::Context) -> usize {
25605            16
25606        }
25607    }
25608
25609    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Value, D> for &Value {
25610        #[inline]
25611        unsafe fn encode(
25612            self,
25613            encoder: &mut fidl::encoding::Encoder<'_, D>,
25614            offset: usize,
25615            _depth: fidl::encoding::Depth,
25616        ) -> fidl::Result<()> {
25617            encoder.debug_check_bounds::<Value>(offset);
25618            encoder.write_num::<u64>(self.ordinal(), offset);
25619            match self {
25620            Value::BoolValue(ref val) => {
25621                fidl::encoding::encode_in_envelope::<bool, D>(
25622                    <bool as fidl::encoding::ValueTypeMarker>::borrow(val),
25623                    encoder, offset + 8, _depth
25624                )
25625            }
25626            Value::Uint64Value(ref val) => {
25627                fidl::encoding::encode_in_envelope::<u64, D>(
25628                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(val),
25629                    encoder, offset + 8, _depth
25630                )
25631            }
25632            Value::Int64Value(ref val) => {
25633                fidl::encoding::encode_in_envelope::<i64, D>(
25634                    <i64 as fidl::encoding::ValueTypeMarker>::borrow(val),
25635                    encoder, offset + 8, _depth
25636                )
25637            }
25638            Value::StringValue(ref val) => {
25639                fidl::encoding::encode_in_envelope::<fidl::encoding::UnboundedString, D>(
25640                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(val),
25641                    encoder, offset + 8, _depth
25642                )
25643            }
25644            Value::BytesValue(ref val) => {
25645                fidl::encoding::encode_in_envelope::<fidl::encoding::UnboundedVector<u8>, D>(
25646                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(val),
25647                    encoder, offset + 8, _depth
25648                )
25649            }
25650        }
25651        }
25652    }
25653
25654    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Value {
25655        #[inline(always)]
25656        fn new_empty() -> Self {
25657            Self::BoolValue(fidl::new_empty!(bool, D))
25658        }
25659
25660        #[inline]
25661        unsafe fn decode(
25662            &mut self,
25663            decoder: &mut fidl::encoding::Decoder<'_, D>,
25664            offset: usize,
25665            mut depth: fidl::encoding::Depth,
25666        ) -> fidl::Result<()> {
25667            decoder.debug_check_bounds::<Self>(offset);
25668            #[allow(unused_variables)]
25669            let next_out_of_line = decoder.next_out_of_line();
25670            let handles_before = decoder.remaining_handles();
25671            let (ordinal, inlined, num_bytes, num_handles) =
25672                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
25673
25674            let member_inline_size = match ordinal {
25675                1 => <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context),
25676                2 => <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
25677                3 => <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
25678                4 => <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
25679                    decoder.context,
25680                ),
25681                5 => {
25682                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::TypeMarker>::inline_size(
25683                        decoder.context,
25684                    )
25685                }
25686                _ => return Err(fidl::Error::UnknownUnionTag),
25687            };
25688
25689            if inlined != (member_inline_size <= 4) {
25690                return Err(fidl::Error::InvalidInlineBitInEnvelope);
25691            }
25692            let _inner_offset;
25693            if inlined {
25694                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
25695                _inner_offset = offset + 8;
25696            } else {
25697                depth.increment()?;
25698                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
25699            }
25700            match ordinal {
25701                1 => {
25702                    #[allow(irrefutable_let_patterns)]
25703                    if let Value::BoolValue(_) = self {
25704                        // Do nothing, read the value into the object
25705                    } else {
25706                        // Initialize `self` to the right variant
25707                        *self = Value::BoolValue(fidl::new_empty!(bool, D));
25708                    }
25709                    #[allow(irrefutable_let_patterns)]
25710                    if let Value::BoolValue(ref mut val) = self {
25711                        fidl::decode!(bool, D, val, decoder, _inner_offset, depth)?;
25712                    } else {
25713                        unreachable!()
25714                    }
25715                }
25716                2 => {
25717                    #[allow(irrefutable_let_patterns)]
25718                    if let Value::Uint64Value(_) = self {
25719                        // Do nothing, read the value into the object
25720                    } else {
25721                        // Initialize `self` to the right variant
25722                        *self = Value::Uint64Value(fidl::new_empty!(u64, D));
25723                    }
25724                    #[allow(irrefutable_let_patterns)]
25725                    if let Value::Uint64Value(ref mut val) = self {
25726                        fidl::decode!(u64, D, val, decoder, _inner_offset, depth)?;
25727                    } else {
25728                        unreachable!()
25729                    }
25730                }
25731                3 => {
25732                    #[allow(irrefutable_let_patterns)]
25733                    if let Value::Int64Value(_) = self {
25734                        // Do nothing, read the value into the object
25735                    } else {
25736                        // Initialize `self` to the right variant
25737                        *self = Value::Int64Value(fidl::new_empty!(i64, D));
25738                    }
25739                    #[allow(irrefutable_let_patterns)]
25740                    if let Value::Int64Value(ref mut val) = self {
25741                        fidl::decode!(i64, D, val, decoder, _inner_offset, depth)?;
25742                    } else {
25743                        unreachable!()
25744                    }
25745                }
25746                4 => {
25747                    #[allow(irrefutable_let_patterns)]
25748                    if let Value::StringValue(_) = self {
25749                        // Do nothing, read the value into the object
25750                    } else {
25751                        // Initialize `self` to the right variant
25752                        *self = Value::StringValue(fidl::new_empty!(
25753                            fidl::encoding::UnboundedString,
25754                            D
25755                        ));
25756                    }
25757                    #[allow(irrefutable_let_patterns)]
25758                    if let Value::StringValue(ref mut val) = self {
25759                        fidl::decode!(
25760                            fidl::encoding::UnboundedString,
25761                            D,
25762                            val,
25763                            decoder,
25764                            _inner_offset,
25765                            depth
25766                        )?;
25767                    } else {
25768                        unreachable!()
25769                    }
25770                }
25771                5 => {
25772                    #[allow(irrefutable_let_patterns)]
25773                    if let Value::BytesValue(_) = self {
25774                        // Do nothing, read the value into the object
25775                    } else {
25776                        // Initialize `self` to the right variant
25777                        *self = Value::BytesValue(fidl::new_empty!(
25778                            fidl::encoding::UnboundedVector<u8>,
25779                            D
25780                        ));
25781                    }
25782                    #[allow(irrefutable_let_patterns)]
25783                    if let Value::BytesValue(ref mut val) = self {
25784                        fidl::decode!(
25785                            fidl::encoding::UnboundedVector<u8>,
25786                            D,
25787                            val,
25788                            decoder,
25789                            _inner_offset,
25790                            depth
25791                        )?;
25792                    } else {
25793                        unreachable!()
25794                    }
25795                }
25796                ordinal => panic!("unexpected ordinal {:?}", ordinal),
25797            }
25798            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
25799                return Err(fidl::Error::InvalidNumBytesInEnvelope);
25800            }
25801            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
25802                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
25803            }
25804            Ok(())
25805        }
25806    }
25807
25808    impl fidl::encoding::ValueTypeMarker for VideoCompressedFormat {
25809        type Borrowed<'a> = &'a Self;
25810        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
25811            value
25812        }
25813    }
25814
25815    unsafe impl fidl::encoding::TypeMarker for VideoCompressedFormat {
25816        type Owned = Self;
25817
25818        #[inline(always)]
25819        fn inline_align(_context: fidl::encoding::Context) -> usize {
25820            8
25821        }
25822
25823        #[inline(always)]
25824        fn inline_size(_context: fidl::encoding::Context) -> usize {
25825            16
25826        }
25827    }
25828
25829    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<VideoCompressedFormat, D>
25830        for &VideoCompressedFormat
25831    {
25832        #[inline]
25833        unsafe fn encode(
25834            self,
25835            encoder: &mut fidl::encoding::Encoder<'_, D>,
25836            offset: usize,
25837            _depth: fidl::encoding::Depth,
25838        ) -> fidl::Result<()> {
25839            encoder.debug_check_bounds::<VideoCompressedFormat>(offset);
25840            encoder.write_num::<u64>(self.ordinal(), offset);
25841            match self {
25842                VideoCompressedFormat::TempFieldTodoRemove(ref val) => {
25843                    fidl::encoding::encode_in_envelope::<u32, D>(
25844                        <u32 as fidl::encoding::ValueTypeMarker>::borrow(val),
25845                        encoder,
25846                        offset + 8,
25847                        _depth,
25848                    )
25849                }
25850            }
25851        }
25852    }
25853
25854    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VideoCompressedFormat {
25855        #[inline(always)]
25856        fn new_empty() -> Self {
25857            Self::TempFieldTodoRemove(fidl::new_empty!(u32, D))
25858        }
25859
25860        #[inline]
25861        unsafe fn decode(
25862            &mut self,
25863            decoder: &mut fidl::encoding::Decoder<'_, D>,
25864            offset: usize,
25865            mut depth: fidl::encoding::Depth,
25866        ) -> fidl::Result<()> {
25867            decoder.debug_check_bounds::<Self>(offset);
25868            #[allow(unused_variables)]
25869            let next_out_of_line = decoder.next_out_of_line();
25870            let handles_before = decoder.remaining_handles();
25871            let (ordinal, inlined, num_bytes, num_handles) =
25872                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
25873
25874            let member_inline_size = match ordinal {
25875                1 => <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
25876                _ => return Err(fidl::Error::UnknownUnionTag),
25877            };
25878
25879            if inlined != (member_inline_size <= 4) {
25880                return Err(fidl::Error::InvalidInlineBitInEnvelope);
25881            }
25882            let _inner_offset;
25883            if inlined {
25884                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
25885                _inner_offset = offset + 8;
25886            } else {
25887                depth.increment()?;
25888                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
25889            }
25890            match ordinal {
25891                1 => {
25892                    #[allow(irrefutable_let_patterns)]
25893                    if let VideoCompressedFormat::TempFieldTodoRemove(_) = self {
25894                        // Do nothing, read the value into the object
25895                    } else {
25896                        // Initialize `self` to the right variant
25897                        *self =
25898                            VideoCompressedFormat::TempFieldTodoRemove(fidl::new_empty!(u32, D));
25899                    }
25900                    #[allow(irrefutable_let_patterns)]
25901                    if let VideoCompressedFormat::TempFieldTodoRemove(ref mut val) = self {
25902                        fidl::decode!(u32, D, val, decoder, _inner_offset, depth)?;
25903                    } else {
25904                        unreachable!()
25905                    }
25906                }
25907                ordinal => panic!("unexpected ordinal {:?}", ordinal),
25908            }
25909            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
25910                return Err(fidl::Error::InvalidNumBytesInEnvelope);
25911            }
25912            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
25913                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
25914            }
25915            Ok(())
25916        }
25917    }
25918
25919    impl fidl::encoding::ValueTypeMarker for VideoFormat {
25920        type Borrowed<'a> = &'a Self;
25921        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
25922            value
25923        }
25924    }
25925
25926    unsafe impl fidl::encoding::TypeMarker for VideoFormat {
25927        type Owned = Self;
25928
25929        #[inline(always)]
25930        fn inline_align(_context: fidl::encoding::Context) -> usize {
25931            8
25932        }
25933
25934        #[inline(always)]
25935        fn inline_size(_context: fidl::encoding::Context) -> usize {
25936            16
25937        }
25938    }
25939
25940    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<VideoFormat, D>
25941        for &VideoFormat
25942    {
25943        #[inline]
25944        unsafe fn encode(
25945            self,
25946            encoder: &mut fidl::encoding::Encoder<'_, D>,
25947            offset: usize,
25948            _depth: fidl::encoding::Depth,
25949        ) -> fidl::Result<()> {
25950            encoder.debug_check_bounds::<VideoFormat>(offset);
25951            encoder.write_num::<u64>(self.ordinal(), offset);
25952            match self {
25953                VideoFormat::Compressed(ref val) => {
25954                    fidl::encoding::encode_in_envelope::<VideoCompressedFormat, D>(
25955                        <VideoCompressedFormat as fidl::encoding::ValueTypeMarker>::borrow(val),
25956                        encoder,
25957                        offset + 8,
25958                        _depth,
25959                    )
25960                }
25961                VideoFormat::Uncompressed(ref val) => {
25962                    fidl::encoding::encode_in_envelope::<VideoUncompressedFormat, D>(
25963                        <VideoUncompressedFormat as fidl::encoding::ValueTypeMarker>::borrow(val),
25964                        encoder,
25965                        offset + 8,
25966                        _depth,
25967                    )
25968                }
25969            }
25970        }
25971    }
25972
25973    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VideoFormat {
25974        #[inline(always)]
25975        fn new_empty() -> Self {
25976            Self::Compressed(fidl::new_empty!(VideoCompressedFormat, D))
25977        }
25978
25979        #[inline]
25980        unsafe fn decode(
25981            &mut self,
25982            decoder: &mut fidl::encoding::Decoder<'_, D>,
25983            offset: usize,
25984            mut depth: fidl::encoding::Depth,
25985        ) -> fidl::Result<()> {
25986            decoder.debug_check_bounds::<Self>(offset);
25987            #[allow(unused_variables)]
25988            let next_out_of_line = decoder.next_out_of_line();
25989            let handles_before = decoder.remaining_handles();
25990            let (ordinal, inlined, num_bytes, num_handles) =
25991                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
25992
25993            let member_inline_size = match ordinal {
25994                1 => <VideoCompressedFormat as fidl::encoding::TypeMarker>::inline_size(
25995                    decoder.context,
25996                ),
25997                2 => <VideoUncompressedFormat as fidl::encoding::TypeMarker>::inline_size(
25998                    decoder.context,
25999                ),
26000                _ => return Err(fidl::Error::UnknownUnionTag),
26001            };
26002
26003            if inlined != (member_inline_size <= 4) {
26004                return Err(fidl::Error::InvalidInlineBitInEnvelope);
26005            }
26006            let _inner_offset;
26007            if inlined {
26008                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
26009                _inner_offset = offset + 8;
26010            } else {
26011                depth.increment()?;
26012                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
26013            }
26014            match ordinal {
26015                1 => {
26016                    #[allow(irrefutable_let_patterns)]
26017                    if let VideoFormat::Compressed(_) = self {
26018                        // Do nothing, read the value into the object
26019                    } else {
26020                        // Initialize `self` to the right variant
26021                        *self = VideoFormat::Compressed(fidl::new_empty!(VideoCompressedFormat, D));
26022                    }
26023                    #[allow(irrefutable_let_patterns)]
26024                    if let VideoFormat::Compressed(ref mut val) = self {
26025                        fidl::decode!(
26026                            VideoCompressedFormat,
26027                            D,
26028                            val,
26029                            decoder,
26030                            _inner_offset,
26031                            depth
26032                        )?;
26033                    } else {
26034                        unreachable!()
26035                    }
26036                }
26037                2 => {
26038                    #[allow(irrefutable_let_patterns)]
26039                    if let VideoFormat::Uncompressed(_) = self {
26040                        // Do nothing, read the value into the object
26041                    } else {
26042                        // Initialize `self` to the right variant
26043                        *self =
26044                            VideoFormat::Uncompressed(fidl::new_empty!(VideoUncompressedFormat, D));
26045                    }
26046                    #[allow(irrefutable_let_patterns)]
26047                    if let VideoFormat::Uncompressed(ref mut val) = self {
26048                        fidl::decode!(
26049                            VideoUncompressedFormat,
26050                            D,
26051                            val,
26052                            decoder,
26053                            _inner_offset,
26054                            depth
26055                        )?;
26056                    } else {
26057                        unreachable!()
26058                    }
26059                }
26060                ordinal => panic!("unexpected ordinal {:?}", ordinal),
26061            }
26062            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
26063                return Err(fidl::Error::InvalidNumBytesInEnvelope);
26064            }
26065            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
26066                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
26067            }
26068            Ok(())
26069        }
26070    }
26071}