1#![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
11pub const MAX_COMPRESSION_PARAMETERS_SIZE: u64 = 32768;
13
14bitflags! {
15 #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
17 pub struct PacketFlags: u32 {
18 const DROP_AFTER_DECODE = 1;
21 }
22}
23
24impl PacketFlags {
25 #[inline(always)]
26 pub fn from_bits_allow_unknown(bits: u32) -> Self {
27 Self::from_bits_retain(bits)
28 }
29
30 #[inline(always)]
31 pub fn has_unknown_bits(&self) -> bool {
32 self.get_unknown_bits() != 0
33 }
34
35 #[inline(always)]
36 pub fn get_unknown_bits(&self) -> u32 {
37 self.bits() & !Self::all().bits()
38 }
39}
40
41#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
43pub enum ChannelConfig {
44 Mono,
46 Stereo,
48 Quad,
50 Surround3,
52 Surround4,
54 Surround51,
56 #[doc(hidden)]
57 __SourceBreaking { unknown_ordinal: u32 },
58}
59
60#[macro_export]
62macro_rules! ChannelConfigUnknown {
63 () => {
64 _
65 };
66}
67
68impl ChannelConfig {
69 #[inline]
70 pub fn from_primitive(prim: u32) -> Option<Self> {
71 match prim {
72 1 => Some(Self::Mono),
73 2 => Some(Self::Stereo),
74 3 => Some(Self::Quad),
75 4 => Some(Self::Surround3),
76 5 => Some(Self::Surround4),
77 6 => Some(Self::Surround51),
78 _ => None,
79 }
80 }
81
82 #[inline]
83 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
84 match prim {
85 1 => Self::Mono,
86 2 => Self::Stereo,
87 3 => Self::Quad,
88 4 => Self::Surround3,
89 5 => Self::Surround4,
90 6 => Self::Surround51,
91 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
92 }
93 }
94
95 #[inline]
96 pub fn unknown() -> Self {
97 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
98 }
99
100 #[inline]
101 pub const fn into_primitive(self) -> u32 {
102 match self {
103 Self::Mono => 1,
104 Self::Stereo => 2,
105 Self::Quad => 3,
106 Self::Surround3 => 4,
107 Self::Surround4 => 5,
108 Self::Surround51 => 6,
109 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
110 }
111 }
112
113 #[inline]
114 pub fn is_unknown(&self) -> bool {
115 match self {
116 Self::__SourceBreaking { unknown_ordinal: _ } => true,
117 _ => false,
118 }
119 }
120}
121
122#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
123pub enum CompressionType {
124 None,
125 Aac,
126 Aaclatm,
127 Amrnb,
128 Amrwb,
129 Aptx,
130 Flac,
131 Gsmms,
132 Mp3,
133 Pcmalaw,
134 Pcmmulaw,
135 Sbc,
136 Vorbis,
137 Opus,
138 #[doc(hidden)]
139 __SourceBreaking {
140 unknown_ordinal: u32,
141 },
142}
143
144#[macro_export]
146macro_rules! CompressionTypeUnknown {
147 () => {
148 _
149 };
150}
151
152impl CompressionType {
153 #[inline]
154 pub fn from_primitive(prim: u32) -> Option<Self> {
155 match prim {
156 0 => Some(Self::None),
157 1 => Some(Self::Aac),
158 2 => Some(Self::Aaclatm),
159 3 => Some(Self::Amrnb),
160 4 => Some(Self::Amrwb),
161 5 => Some(Self::Aptx),
162 6 => Some(Self::Flac),
163 7 => Some(Self::Gsmms),
164 8 => Some(Self::Mp3),
165 9 => Some(Self::Pcmalaw),
166 10 => Some(Self::Pcmmulaw),
167 11 => Some(Self::Sbc),
168 12 => Some(Self::Vorbis),
169 13 => Some(Self::Opus),
170 _ => None,
171 }
172 }
173
174 #[inline]
175 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
176 match prim {
177 0 => Self::None,
178 1 => Self::Aac,
179 2 => Self::Aaclatm,
180 3 => Self::Amrnb,
181 4 => Self::Amrwb,
182 5 => Self::Aptx,
183 6 => Self::Flac,
184 7 => Self::Gsmms,
185 8 => Self::Mp3,
186 9 => Self::Pcmalaw,
187 10 => Self::Pcmmulaw,
188 11 => Self::Sbc,
189 12 => Self::Vorbis,
190 13 => Self::Opus,
191 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
192 }
193 }
194
195 #[inline]
196 pub fn unknown() -> Self {
197 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
198 }
199
200 #[inline]
201 pub const fn into_primitive(self) -> u32 {
202 match self {
203 Self::None => 0,
204 Self::Aac => 1,
205 Self::Aaclatm => 2,
206 Self::Amrnb => 3,
207 Self::Amrwb => 4,
208 Self::Aptx => 5,
209 Self::Flac => 6,
210 Self::Gsmms => 7,
211 Self::Mp3 => 8,
212 Self::Pcmalaw => 9,
213 Self::Pcmmulaw => 10,
214 Self::Sbc => 11,
215 Self::Vorbis => 12,
216 Self::Opus => 13,
217 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
218 }
219 }
220
221 #[inline]
222 pub fn is_unknown(&self) -> bool {
223 match self {
224 Self::__SourceBreaking { unknown_ordinal: _ } => true,
225 _ => false,
226 }
227 }
228}
229
230#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
232pub enum GainError {
233 MissingRequiredField,
235 UnsupportedOption,
239 #[doc(hidden)]
240 __SourceBreaking { unknown_ordinal: u32 },
241}
242
243#[macro_export]
245macro_rules! GainErrorUnknown {
246 () => {
247 _
248 };
249}
250
251impl GainError {
252 #[inline]
253 pub fn from_primitive(prim: u32) -> Option<Self> {
254 match prim {
255 1 => Some(Self::MissingRequiredField),
256 2 => Some(Self::UnsupportedOption),
257 _ => None,
258 }
259 }
260
261 #[inline]
262 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
263 match prim {
264 1 => Self::MissingRequiredField,
265 2 => Self::UnsupportedOption,
266 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
267 }
268 }
269
270 #[inline]
271 pub fn unknown() -> Self {
272 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
273 }
274
275 #[inline]
276 pub const fn into_primitive(self) -> u32 {
277 match self {
278 Self::MissingRequiredField => 1,
279 Self::UnsupportedOption => 2,
280 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
281 }
282 }
283
284 #[inline]
285 pub fn is_unknown(&self) -> bool {
286 match self {
287 Self::__SourceBreaking { unknown_ordinal: _ } => true,
288 _ => false,
289 }
290 }
291}
292
293#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
295pub enum SampleType {
296 Uint8,
297 Int16,
298 Int32,
299 Float32,
300 Float64,
301 #[doc(hidden)]
302 __SourceBreaking {
303 unknown_ordinal: u32,
304 },
305}
306
307#[macro_export]
309macro_rules! SampleTypeUnknown {
310 () => {
311 _
312 };
313}
314
315impl SampleType {
316 #[inline]
317 pub fn from_primitive(prim: u32) -> Option<Self> {
318 match prim {
319 1 => Some(Self::Uint8),
320 2 => Some(Self::Int16),
321 3 => Some(Self::Int32),
322 4 => Some(Self::Float32),
323 5 => Some(Self::Float64),
324 _ => None,
325 }
326 }
327
328 #[inline]
329 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
330 match prim {
331 1 => Self::Uint8,
332 2 => Self::Int16,
333 3 => Self::Int32,
334 4 => Self::Float32,
335 5 => Self::Float64,
336 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
337 }
338 }
339
340 #[inline]
341 pub fn unknown() -> Self {
342 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
343 }
344
345 #[inline]
346 pub const fn into_primitive(self) -> u32 {
347 match self {
348 Self::Uint8 => 1,
349 Self::Int16 => 2,
350 Self::Int32 => 3,
351 Self::Float32 => 4,
352 Self::Float64 => 5,
353 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
354 }
355 }
356
357 #[inline]
358 pub fn is_unknown(&self) -> bool {
359 match self {
360 Self::__SourceBreaking { unknown_ordinal: _ } => true,
361 _ => false,
362 }
363 }
364}
365
366#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
367pub struct UnspecifiedBestEffort;
368
369impl fidl::Persistable for UnspecifiedBestEffort {}
370
371#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
372pub struct UnspecifiedContinuous;
373
374impl fidl::Persistable for UnspecifiedContinuous {}
375
376#[derive(Clone, Debug, Default, PartialEq)]
378pub struct Compression {
379 pub type_: Option<CompressionType>,
381 pub oob_parameters: Option<Vec<u8>>,
386 #[doc(hidden)]
387 pub __source_breaking: fidl::marker::SourceBreaking,
388}
389
390impl fidl::Persistable for Compression {}
391
392#[derive(Clone, Debug, Default, PartialEq)]
393pub struct DelayWatcherWatchDelayRequest {
394 #[doc(hidden)]
395 pub __source_breaking: fidl::marker::SourceBreaking,
396}
397
398impl fidl::Persistable for DelayWatcherWatchDelayRequest {}
399
400#[derive(Clone, Debug, Default, PartialEq)]
401pub struct DelayWatcherWatchDelayResponse {
402 pub delay: Option<i64>,
404 #[doc(hidden)]
405 pub __source_breaking: fidl::marker::SourceBreaking,
406}
407
408impl fidl::Persistable for DelayWatcherWatchDelayResponse {}
409
410#[derive(Clone, Debug, Default, PartialEq)]
414pub struct Format {
415 pub sample_type: Option<SampleType>,
417 pub channel_count: Option<u32>,
419 pub frames_per_second: Option<u32>,
421 pub channel_layout: Option<ChannelLayout>,
423 #[doc(hidden)]
424 pub __source_breaking: fidl::marker::SourceBreaking,
425}
426
427impl fidl::Persistable for Format {}
428
429#[derive(Clone, Debug, Default, PartialEq)]
430pub struct GainControlSetGainRequest {
431 pub how: Option<GainUpdateMethod>,
435 pub when: Option<fidl_fuchsia_media2::RealTime>,
439 #[doc(hidden)]
440 pub __source_breaking: fidl::marker::SourceBreaking,
441}
442
443impl fidl::Persistable for GainControlSetGainRequest {}
444
445#[derive(Clone, Debug, Default, PartialEq)]
446pub struct GainControlSetMuteRequest {
447 pub muted: Option<bool>,
451 pub when: Option<fidl_fuchsia_media2::RealTime>,
455 #[doc(hidden)]
456 pub __source_breaking: fidl::marker::SourceBreaking,
457}
458
459impl fidl::Persistable for GainControlSetMuteRequest {}
460
461#[derive(Clone, Debug, Default, PartialEq)]
462pub struct GainControlSetGainResponse {
463 #[doc(hidden)]
464 pub __source_breaking: fidl::marker::SourceBreaking,
465}
466
467impl fidl::Persistable for GainControlSetGainResponse {}
468
469#[derive(Clone, Debug, Default, PartialEq)]
470pub struct GainControlSetMuteResponse {
471 #[doc(hidden)]
472 pub __source_breaking: fidl::marker::SourceBreaking,
473}
474
475impl fidl::Persistable for GainControlSetMuteResponse {}
476
477#[derive(Clone, Debug, Default, PartialEq)]
479pub struct Packet {
480 pub payload: Option<fidl_fuchsia_media2::PayloadRange>,
482 pub timestamp: Option<Timestamp>,
485 pub capture_timestamp: Option<i64>,
488 pub flags: Option<PacketFlags>,
490 pub front_frames_to_drop: Option<u32>,
494 pub back_frames_to_drop: Option<u32>,
498 pub encryption_properties: Option<fidl_fuchsia_drm::PacketEncryptionProperties>,
501 #[doc(hidden)]
502 pub __source_breaking: fidl::marker::SourceBreaking,
503}
504
505impl fidl::Persistable for Packet {}
506
507#[derive(Clone, Debug, Default, PartialEq)]
521pub struct RampFunctionLinearSlope {
522 #[doc(hidden)]
523 pub __source_breaking: fidl::marker::SourceBreaking,
524}
525
526impl fidl::Persistable for RampFunctionLinearSlope {}
527
528#[derive(Clone, Debug, Default, PartialEq)]
532pub struct RampedGain {
533 pub target_gain_db: Option<f32>,
534 pub duration: Option<i64>,
535 pub function: Option<RampFunction>,
536 #[doc(hidden)]
537 pub __source_breaking: fidl::marker::SourceBreaking,
538}
539
540impl fidl::Persistable for RampedGain {}
541
542#[derive(Clone, Debug, Default, PartialEq)]
543pub struct StreamSinkOnWillCloseRequest {
544 pub reason: Option<fidl_fuchsia_media2::ConsumerClosedReason>,
546 #[doc(hidden)]
547 pub __source_breaking: fidl::marker::SourceBreaking,
548}
549
550impl fidl::Persistable for StreamSinkOnWillCloseRequest {}
551
552#[derive(Clone, Debug, Default, PartialEq)]
553pub struct StreamSinkStartSegmentRequest {
554 pub segment_id: Option<i64>,
557 #[doc(hidden)]
558 pub __source_breaking: fidl::marker::SourceBreaking,
559}
560
561impl fidl::Persistable for StreamSinkStartSegmentRequest {}
562
563#[derive(Clone, Debug, Default, PartialEq)]
564pub struct StreamSinkWillCloseRequest {
565 pub reason: Option<fidl_fuchsia_media2::ProducerClosedReason>,
567 #[doc(hidden)]
568 pub __source_breaking: fidl::marker::SourceBreaking,
569}
570
571impl fidl::Persistable for StreamSinkWillCloseRequest {}
572
573#[derive(Clone, Debug)]
575pub enum ChannelLayout {
576 Config(ChannelConfig),
579 #[doc(hidden)]
580 __SourceBreaking { unknown_ordinal: u64 },
581}
582
583#[macro_export]
585macro_rules! ChannelLayoutUnknown {
586 () => {
587 _
588 };
589}
590
591impl PartialEq for ChannelLayout {
593 fn eq(&self, other: &Self) -> bool {
594 match (self, other) {
595 (Self::Config(x), Self::Config(y)) => *x == *y,
596 _ => false,
597 }
598 }
599}
600
601impl ChannelLayout {
602 #[inline]
603 pub fn ordinal(&self) -> u64 {
604 match *self {
605 Self::Config(_) => 1,
606 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
607 }
608 }
609
610 #[inline]
611 pub fn unknown_variant_for_testing() -> Self {
612 Self::__SourceBreaking { unknown_ordinal: 0 }
613 }
614
615 #[inline]
616 pub fn is_unknown(&self) -> bool {
617 match self {
618 Self::__SourceBreaking { .. } => true,
619 _ => false,
620 }
621 }
622}
623
624impl fidl::Persistable for ChannelLayout {}
625
626#[derive(Clone, Debug)]
628pub enum GainUpdateMethod {
629 GainDb(f32),
631 Ramped(RampedGain),
633 #[doc(hidden)]
634 __SourceBreaking { unknown_ordinal: u64 },
635}
636
637#[macro_export]
639macro_rules! GainUpdateMethodUnknown {
640 () => {
641 _
642 };
643}
644
645impl PartialEq for GainUpdateMethod {
647 fn eq(&self, other: &Self) -> bool {
648 match (self, other) {
649 (Self::GainDb(x), Self::GainDb(y)) => *x == *y,
650 (Self::Ramped(x), Self::Ramped(y)) => *x == *y,
651 _ => false,
652 }
653 }
654}
655
656impl GainUpdateMethod {
657 #[inline]
658 pub fn ordinal(&self) -> u64 {
659 match *self {
660 Self::GainDb(_) => 1,
661 Self::Ramped(_) => 2,
662 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
663 }
664 }
665
666 #[inline]
667 pub fn unknown_variant_for_testing() -> Self {
668 Self::__SourceBreaking { unknown_ordinal: 0 }
669 }
670
671 #[inline]
672 pub fn is_unknown(&self) -> bool {
673 match self {
674 Self::__SourceBreaking { .. } => true,
675 _ => false,
676 }
677 }
678}
679
680impl fidl::Persistable for GainUpdateMethod {}
681
682#[derive(Clone, Debug)]
684pub enum RampFunction {
685 LinearSlope(RampFunctionLinearSlope),
686 #[doc(hidden)]
687 __SourceBreaking {
688 unknown_ordinal: u64,
689 },
690}
691
692#[macro_export]
694macro_rules! RampFunctionUnknown {
695 () => {
696 _
697 };
698}
699
700impl PartialEq for RampFunction {
702 fn eq(&self, other: &Self) -> bool {
703 match (self, other) {
704 (Self::LinearSlope(x), Self::LinearSlope(y)) => *x == *y,
705 _ => false,
706 }
707 }
708}
709
710impl RampFunction {
711 #[inline]
712 pub fn ordinal(&self) -> u64 {
713 match *self {
714 Self::LinearSlope(_) => 1,
715 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
716 }
717 }
718
719 #[inline]
720 pub fn unknown_variant_for_testing() -> Self {
721 Self::__SourceBreaking { unknown_ordinal: 0 }
722 }
723
724 #[inline]
725 pub fn is_unknown(&self) -> bool {
726 match self {
727 Self::__SourceBreaking { .. } => true,
728 _ => false,
729 }
730 }
731}
732
733impl fidl::Persistable for RampFunction {}
734
735#[derive(Clone, Debug)]
737pub enum Timestamp {
738 Specified(i64),
741 UnspecifiedContinuous(UnspecifiedContinuous),
749 UnspecifiedBestEffort(UnspecifiedBestEffort),
756 #[doc(hidden)]
757 __SourceBreaking { unknown_ordinal: u64 },
758}
759
760#[macro_export]
762macro_rules! TimestampUnknown {
763 () => {
764 _
765 };
766}
767
768impl PartialEq for Timestamp {
770 fn eq(&self, other: &Self) -> bool {
771 match (self, other) {
772 (Self::Specified(x), Self::Specified(y)) => *x == *y,
773 (Self::UnspecifiedContinuous(x), Self::UnspecifiedContinuous(y)) => *x == *y,
774 (Self::UnspecifiedBestEffort(x), Self::UnspecifiedBestEffort(y)) => *x == *y,
775 _ => false,
776 }
777 }
778}
779
780impl Timestamp {
781 #[inline]
782 pub fn ordinal(&self) -> u64 {
783 match *self {
784 Self::Specified(_) => 1,
785 Self::UnspecifiedContinuous(_) => 2,
786 Self::UnspecifiedBestEffort(_) => 3,
787 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
788 }
789 }
790
791 #[inline]
792 pub fn unknown_variant_for_testing() -> Self {
793 Self::__SourceBreaking { unknown_ordinal: 0 }
794 }
795
796 #[inline]
797 pub fn is_unknown(&self) -> bool {
798 match self {
799 Self::__SourceBreaking { .. } => true,
800 _ => false,
801 }
802 }
803}
804
805impl fidl::Persistable for Timestamp {}
806
807mod internal {
808 use super::*;
809 unsafe impl fidl::encoding::TypeMarker for PacketFlags {
810 type Owned = Self;
811
812 #[inline(always)]
813 fn inline_align(_context: fidl::encoding::Context) -> usize {
814 4
815 }
816
817 #[inline(always)]
818 fn inline_size(_context: fidl::encoding::Context) -> usize {
819 4
820 }
821 }
822
823 impl fidl::encoding::ValueTypeMarker for PacketFlags {
824 type Borrowed<'a> = Self;
825 #[inline(always)]
826 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
827 *value
828 }
829 }
830
831 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for PacketFlags {
832 #[inline]
833 unsafe fn encode(
834 self,
835 encoder: &mut fidl::encoding::Encoder<'_, D>,
836 offset: usize,
837 _depth: fidl::encoding::Depth,
838 ) -> fidl::Result<()> {
839 encoder.debug_check_bounds::<Self>(offset);
840 encoder.write_num(self.bits(), offset);
841 Ok(())
842 }
843 }
844
845 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PacketFlags {
846 #[inline(always)]
847 fn new_empty() -> Self {
848 Self::empty()
849 }
850
851 #[inline]
852 unsafe fn decode(
853 &mut self,
854 decoder: &mut fidl::encoding::Decoder<'_, D>,
855 offset: usize,
856 _depth: fidl::encoding::Depth,
857 ) -> fidl::Result<()> {
858 decoder.debug_check_bounds::<Self>(offset);
859 let prim = decoder.read_num::<u32>(offset);
860 *self = Self::from_bits_allow_unknown(prim);
861 Ok(())
862 }
863 }
864 unsafe impl fidl::encoding::TypeMarker for ChannelConfig {
865 type Owned = Self;
866
867 #[inline(always)]
868 fn inline_align(_context: fidl::encoding::Context) -> usize {
869 std::mem::align_of::<u32>()
870 }
871
872 #[inline(always)]
873 fn inline_size(_context: fidl::encoding::Context) -> usize {
874 std::mem::size_of::<u32>()
875 }
876
877 #[inline(always)]
878 fn encode_is_copy() -> bool {
879 false
880 }
881
882 #[inline(always)]
883 fn decode_is_copy() -> bool {
884 false
885 }
886 }
887
888 impl fidl::encoding::ValueTypeMarker for ChannelConfig {
889 type Borrowed<'a> = Self;
890 #[inline(always)]
891 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
892 *value
893 }
894 }
895
896 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ChannelConfig {
897 #[inline]
898 unsafe fn encode(
899 self,
900 encoder: &mut fidl::encoding::Encoder<'_, D>,
901 offset: usize,
902 _depth: fidl::encoding::Depth,
903 ) -> fidl::Result<()> {
904 encoder.debug_check_bounds::<Self>(offset);
905 encoder.write_num(self.into_primitive(), offset);
906 Ok(())
907 }
908 }
909
910 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ChannelConfig {
911 #[inline(always)]
912 fn new_empty() -> Self {
913 Self::unknown()
914 }
915
916 #[inline]
917 unsafe fn decode(
918 &mut self,
919 decoder: &mut fidl::encoding::Decoder<'_, D>,
920 offset: usize,
921 _depth: fidl::encoding::Depth,
922 ) -> fidl::Result<()> {
923 decoder.debug_check_bounds::<Self>(offset);
924 let prim = decoder.read_num::<u32>(offset);
925
926 *self = Self::from_primitive_allow_unknown(prim);
927 Ok(())
928 }
929 }
930 unsafe impl fidl::encoding::TypeMarker for CompressionType {
931 type Owned = Self;
932
933 #[inline(always)]
934 fn inline_align(_context: fidl::encoding::Context) -> usize {
935 std::mem::align_of::<u32>()
936 }
937
938 #[inline(always)]
939 fn inline_size(_context: fidl::encoding::Context) -> usize {
940 std::mem::size_of::<u32>()
941 }
942
943 #[inline(always)]
944 fn encode_is_copy() -> bool {
945 false
946 }
947
948 #[inline(always)]
949 fn decode_is_copy() -> bool {
950 false
951 }
952 }
953
954 impl fidl::encoding::ValueTypeMarker for CompressionType {
955 type Borrowed<'a> = Self;
956 #[inline(always)]
957 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
958 *value
959 }
960 }
961
962 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
963 for CompressionType
964 {
965 #[inline]
966 unsafe fn encode(
967 self,
968 encoder: &mut fidl::encoding::Encoder<'_, D>,
969 offset: usize,
970 _depth: fidl::encoding::Depth,
971 ) -> fidl::Result<()> {
972 encoder.debug_check_bounds::<Self>(offset);
973 encoder.write_num(self.into_primitive(), offset);
974 Ok(())
975 }
976 }
977
978 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CompressionType {
979 #[inline(always)]
980 fn new_empty() -> Self {
981 Self::unknown()
982 }
983
984 #[inline]
985 unsafe fn decode(
986 &mut self,
987 decoder: &mut fidl::encoding::Decoder<'_, D>,
988 offset: usize,
989 _depth: fidl::encoding::Depth,
990 ) -> fidl::Result<()> {
991 decoder.debug_check_bounds::<Self>(offset);
992 let prim = decoder.read_num::<u32>(offset);
993
994 *self = Self::from_primitive_allow_unknown(prim);
995 Ok(())
996 }
997 }
998 unsafe impl fidl::encoding::TypeMarker for GainError {
999 type Owned = Self;
1000
1001 #[inline(always)]
1002 fn inline_align(_context: fidl::encoding::Context) -> usize {
1003 std::mem::align_of::<u32>()
1004 }
1005
1006 #[inline(always)]
1007 fn inline_size(_context: fidl::encoding::Context) -> usize {
1008 std::mem::size_of::<u32>()
1009 }
1010
1011 #[inline(always)]
1012 fn encode_is_copy() -> bool {
1013 false
1014 }
1015
1016 #[inline(always)]
1017 fn decode_is_copy() -> bool {
1018 false
1019 }
1020 }
1021
1022 impl fidl::encoding::ValueTypeMarker for GainError {
1023 type Borrowed<'a> = Self;
1024 #[inline(always)]
1025 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1026 *value
1027 }
1028 }
1029
1030 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for GainError {
1031 #[inline]
1032 unsafe fn encode(
1033 self,
1034 encoder: &mut fidl::encoding::Encoder<'_, D>,
1035 offset: usize,
1036 _depth: fidl::encoding::Depth,
1037 ) -> fidl::Result<()> {
1038 encoder.debug_check_bounds::<Self>(offset);
1039 encoder.write_num(self.into_primitive(), offset);
1040 Ok(())
1041 }
1042 }
1043
1044 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for GainError {
1045 #[inline(always)]
1046 fn new_empty() -> Self {
1047 Self::unknown()
1048 }
1049
1050 #[inline]
1051 unsafe fn decode(
1052 &mut self,
1053 decoder: &mut fidl::encoding::Decoder<'_, D>,
1054 offset: usize,
1055 _depth: fidl::encoding::Depth,
1056 ) -> fidl::Result<()> {
1057 decoder.debug_check_bounds::<Self>(offset);
1058 let prim = decoder.read_num::<u32>(offset);
1059
1060 *self = Self::from_primitive_allow_unknown(prim);
1061 Ok(())
1062 }
1063 }
1064 unsafe impl fidl::encoding::TypeMarker for SampleType {
1065 type Owned = Self;
1066
1067 #[inline(always)]
1068 fn inline_align(_context: fidl::encoding::Context) -> usize {
1069 std::mem::align_of::<u32>()
1070 }
1071
1072 #[inline(always)]
1073 fn inline_size(_context: fidl::encoding::Context) -> usize {
1074 std::mem::size_of::<u32>()
1075 }
1076
1077 #[inline(always)]
1078 fn encode_is_copy() -> bool {
1079 false
1080 }
1081
1082 #[inline(always)]
1083 fn decode_is_copy() -> bool {
1084 false
1085 }
1086 }
1087
1088 impl fidl::encoding::ValueTypeMarker for SampleType {
1089 type Borrowed<'a> = Self;
1090 #[inline(always)]
1091 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1092 *value
1093 }
1094 }
1095
1096 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for SampleType {
1097 #[inline]
1098 unsafe fn encode(
1099 self,
1100 encoder: &mut fidl::encoding::Encoder<'_, D>,
1101 offset: usize,
1102 _depth: fidl::encoding::Depth,
1103 ) -> fidl::Result<()> {
1104 encoder.debug_check_bounds::<Self>(offset);
1105 encoder.write_num(self.into_primitive(), offset);
1106 Ok(())
1107 }
1108 }
1109
1110 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SampleType {
1111 #[inline(always)]
1112 fn new_empty() -> Self {
1113 Self::unknown()
1114 }
1115
1116 #[inline]
1117 unsafe fn decode(
1118 &mut self,
1119 decoder: &mut fidl::encoding::Decoder<'_, D>,
1120 offset: usize,
1121 _depth: fidl::encoding::Depth,
1122 ) -> fidl::Result<()> {
1123 decoder.debug_check_bounds::<Self>(offset);
1124 let prim = decoder.read_num::<u32>(offset);
1125
1126 *self = Self::from_primitive_allow_unknown(prim);
1127 Ok(())
1128 }
1129 }
1130
1131 impl fidl::encoding::ValueTypeMarker for UnspecifiedBestEffort {
1132 type Borrowed<'a> = &'a Self;
1133 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1134 value
1135 }
1136 }
1137
1138 unsafe impl fidl::encoding::TypeMarker for UnspecifiedBestEffort {
1139 type Owned = Self;
1140
1141 #[inline(always)]
1142 fn inline_align(_context: fidl::encoding::Context) -> usize {
1143 1
1144 }
1145
1146 #[inline(always)]
1147 fn inline_size(_context: fidl::encoding::Context) -> usize {
1148 1
1149 }
1150 }
1151
1152 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<UnspecifiedBestEffort, D>
1153 for &UnspecifiedBestEffort
1154 {
1155 #[inline]
1156 unsafe fn encode(
1157 self,
1158 encoder: &mut fidl::encoding::Encoder<'_, D>,
1159 offset: usize,
1160 _depth: fidl::encoding::Depth,
1161 ) -> fidl::Result<()> {
1162 encoder.debug_check_bounds::<UnspecifiedBestEffort>(offset);
1163 encoder.write_num(0u8, offset);
1164 Ok(())
1165 }
1166 }
1167
1168 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for UnspecifiedBestEffort {
1169 #[inline(always)]
1170 fn new_empty() -> Self {
1171 Self
1172 }
1173
1174 #[inline]
1175 unsafe fn decode(
1176 &mut self,
1177 decoder: &mut fidl::encoding::Decoder<'_, D>,
1178 offset: usize,
1179 _depth: fidl::encoding::Depth,
1180 ) -> fidl::Result<()> {
1181 decoder.debug_check_bounds::<Self>(offset);
1182 match decoder.read_num::<u8>(offset) {
1183 0 => Ok(()),
1184 _ => Err(fidl::Error::Invalid),
1185 }
1186 }
1187 }
1188
1189 impl fidl::encoding::ValueTypeMarker for UnspecifiedContinuous {
1190 type Borrowed<'a> = &'a Self;
1191 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1192 value
1193 }
1194 }
1195
1196 unsafe impl fidl::encoding::TypeMarker for UnspecifiedContinuous {
1197 type Owned = Self;
1198
1199 #[inline(always)]
1200 fn inline_align(_context: fidl::encoding::Context) -> usize {
1201 1
1202 }
1203
1204 #[inline(always)]
1205 fn inline_size(_context: fidl::encoding::Context) -> usize {
1206 1
1207 }
1208 }
1209
1210 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<UnspecifiedContinuous, D>
1211 for &UnspecifiedContinuous
1212 {
1213 #[inline]
1214 unsafe fn encode(
1215 self,
1216 encoder: &mut fidl::encoding::Encoder<'_, D>,
1217 offset: usize,
1218 _depth: fidl::encoding::Depth,
1219 ) -> fidl::Result<()> {
1220 encoder.debug_check_bounds::<UnspecifiedContinuous>(offset);
1221 encoder.write_num(0u8, offset);
1222 Ok(())
1223 }
1224 }
1225
1226 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for UnspecifiedContinuous {
1227 #[inline(always)]
1228 fn new_empty() -> Self {
1229 Self
1230 }
1231
1232 #[inline]
1233 unsafe fn decode(
1234 &mut self,
1235 decoder: &mut fidl::encoding::Decoder<'_, D>,
1236 offset: usize,
1237 _depth: fidl::encoding::Depth,
1238 ) -> fidl::Result<()> {
1239 decoder.debug_check_bounds::<Self>(offset);
1240 match decoder.read_num::<u8>(offset) {
1241 0 => Ok(()),
1242 _ => Err(fidl::Error::Invalid),
1243 }
1244 }
1245 }
1246
1247 impl Compression {
1248 #[inline(always)]
1249 fn max_ordinal_present(&self) -> u64 {
1250 if let Some(_) = self.oob_parameters {
1251 return 2;
1252 }
1253 if let Some(_) = self.type_ {
1254 return 1;
1255 }
1256 0
1257 }
1258 }
1259
1260 impl fidl::encoding::ValueTypeMarker for Compression {
1261 type Borrowed<'a> = &'a Self;
1262 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1263 value
1264 }
1265 }
1266
1267 unsafe impl fidl::encoding::TypeMarker for Compression {
1268 type Owned = Self;
1269
1270 #[inline(always)]
1271 fn inline_align(_context: fidl::encoding::Context) -> usize {
1272 8
1273 }
1274
1275 #[inline(always)]
1276 fn inline_size(_context: fidl::encoding::Context) -> usize {
1277 16
1278 }
1279 }
1280
1281 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Compression, D>
1282 for &Compression
1283 {
1284 unsafe fn encode(
1285 self,
1286 encoder: &mut fidl::encoding::Encoder<'_, D>,
1287 offset: usize,
1288 mut depth: fidl::encoding::Depth,
1289 ) -> fidl::Result<()> {
1290 encoder.debug_check_bounds::<Compression>(offset);
1291 let max_ordinal: u64 = self.max_ordinal_present();
1293 encoder.write_num(max_ordinal, offset);
1294 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1295 if max_ordinal == 0 {
1297 return Ok(());
1298 }
1299 depth.increment()?;
1300 let envelope_size = 8;
1301 let bytes_len = max_ordinal as usize * envelope_size;
1302 #[allow(unused_variables)]
1303 let offset = encoder.out_of_line_offset(bytes_len);
1304 let mut _prev_end_offset: usize = 0;
1305 if 1 > max_ordinal {
1306 return Ok(());
1307 }
1308
1309 let cur_offset: usize = (1 - 1) * envelope_size;
1312
1313 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1315
1316 fidl::encoding::encode_in_envelope_optional::<CompressionType, D>(
1321 self.type_
1322 .as_ref()
1323 .map(<CompressionType as fidl::encoding::ValueTypeMarker>::borrow),
1324 encoder,
1325 offset + cur_offset,
1326 depth,
1327 )?;
1328
1329 _prev_end_offset = cur_offset + envelope_size;
1330 if 2 > max_ordinal {
1331 return Ok(());
1332 }
1333
1334 let cur_offset: usize = (2 - 1) * envelope_size;
1337
1338 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1340
1341 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 32768>, D>(
1346 self.oob_parameters.as_ref().map(
1347 <fidl::encoding::Vector<u8, 32768> as fidl::encoding::ValueTypeMarker>::borrow,
1348 ),
1349 encoder,
1350 offset + cur_offset,
1351 depth,
1352 )?;
1353
1354 _prev_end_offset = cur_offset + envelope_size;
1355
1356 Ok(())
1357 }
1358 }
1359
1360 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Compression {
1361 #[inline(always)]
1362 fn new_empty() -> Self {
1363 Self::default()
1364 }
1365
1366 unsafe fn decode(
1367 &mut self,
1368 decoder: &mut fidl::encoding::Decoder<'_, D>,
1369 offset: usize,
1370 mut depth: fidl::encoding::Depth,
1371 ) -> fidl::Result<()> {
1372 decoder.debug_check_bounds::<Self>(offset);
1373 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1374 None => return Err(fidl::Error::NotNullable),
1375 Some(len) => len,
1376 };
1377 if len == 0 {
1379 return Ok(());
1380 };
1381 depth.increment()?;
1382 let envelope_size = 8;
1383 let bytes_len = len * envelope_size;
1384 let offset = decoder.out_of_line_offset(bytes_len)?;
1385 let mut _next_ordinal_to_read = 0;
1387 let mut next_offset = offset;
1388 let end_offset = offset + bytes_len;
1389 _next_ordinal_to_read += 1;
1390 if next_offset >= end_offset {
1391 return Ok(());
1392 }
1393
1394 while _next_ordinal_to_read < 1 {
1396 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1397 _next_ordinal_to_read += 1;
1398 next_offset += envelope_size;
1399 }
1400
1401 let next_out_of_line = decoder.next_out_of_line();
1402 let handles_before = decoder.remaining_handles();
1403 if let Some((inlined, num_bytes, num_handles)) =
1404 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1405 {
1406 let member_inline_size =
1407 <CompressionType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1408 if inlined != (member_inline_size <= 4) {
1409 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1410 }
1411 let inner_offset;
1412 let mut inner_depth = depth.clone();
1413 if inlined {
1414 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1415 inner_offset = next_offset;
1416 } else {
1417 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1418 inner_depth.increment()?;
1419 }
1420 let val_ref =
1421 self.type_.get_or_insert_with(|| fidl::new_empty!(CompressionType, D));
1422 fidl::decode!(CompressionType, D, val_ref, decoder, inner_offset, inner_depth)?;
1423 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1424 {
1425 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1426 }
1427 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1428 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1429 }
1430 }
1431
1432 next_offset += envelope_size;
1433 _next_ordinal_to_read += 1;
1434 if next_offset >= end_offset {
1435 return Ok(());
1436 }
1437
1438 while _next_ordinal_to_read < 2 {
1440 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1441 _next_ordinal_to_read += 1;
1442 next_offset += envelope_size;
1443 }
1444
1445 let next_out_of_line = decoder.next_out_of_line();
1446 let handles_before = decoder.remaining_handles();
1447 if let Some((inlined, num_bytes, num_handles)) =
1448 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1449 {
1450 let member_inline_size =
1451 <fidl::encoding::Vector<u8, 32768> as fidl::encoding::TypeMarker>::inline_size(
1452 decoder.context,
1453 );
1454 if inlined != (member_inline_size <= 4) {
1455 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1456 }
1457 let inner_offset;
1458 let mut inner_depth = depth.clone();
1459 if inlined {
1460 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1461 inner_offset = next_offset;
1462 } else {
1463 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1464 inner_depth.increment()?;
1465 }
1466 let val_ref = self
1467 .oob_parameters
1468 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 32768>, D));
1469 fidl::decode!(fidl::encoding::Vector<u8, 32768>, D, val_ref, decoder, inner_offset, inner_depth)?;
1470 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1471 {
1472 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1473 }
1474 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1475 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1476 }
1477 }
1478
1479 next_offset += envelope_size;
1480
1481 while next_offset < end_offset {
1483 _next_ordinal_to_read += 1;
1484 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1485 next_offset += envelope_size;
1486 }
1487
1488 Ok(())
1489 }
1490 }
1491
1492 impl DelayWatcherWatchDelayRequest {
1493 #[inline(always)]
1494 fn max_ordinal_present(&self) -> u64 {
1495 0
1496 }
1497 }
1498
1499 impl fidl::encoding::ValueTypeMarker for DelayWatcherWatchDelayRequest {
1500 type Borrowed<'a> = &'a Self;
1501 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1502 value
1503 }
1504 }
1505
1506 unsafe impl fidl::encoding::TypeMarker for DelayWatcherWatchDelayRequest {
1507 type Owned = Self;
1508
1509 #[inline(always)]
1510 fn inline_align(_context: fidl::encoding::Context) -> usize {
1511 8
1512 }
1513
1514 #[inline(always)]
1515 fn inline_size(_context: fidl::encoding::Context) -> usize {
1516 16
1517 }
1518 }
1519
1520 unsafe impl<D: fidl::encoding::ResourceDialect>
1521 fidl::encoding::Encode<DelayWatcherWatchDelayRequest, D>
1522 for &DelayWatcherWatchDelayRequest
1523 {
1524 unsafe fn encode(
1525 self,
1526 encoder: &mut fidl::encoding::Encoder<'_, D>,
1527 offset: usize,
1528 mut depth: fidl::encoding::Depth,
1529 ) -> fidl::Result<()> {
1530 encoder.debug_check_bounds::<DelayWatcherWatchDelayRequest>(offset);
1531 let max_ordinal: u64 = self.max_ordinal_present();
1533 encoder.write_num(max_ordinal, offset);
1534 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1535 if max_ordinal == 0 {
1537 return Ok(());
1538 }
1539 depth.increment()?;
1540 let envelope_size = 8;
1541 let bytes_len = max_ordinal as usize * envelope_size;
1542 #[allow(unused_variables)]
1543 let offset = encoder.out_of_line_offset(bytes_len);
1544 let mut _prev_end_offset: usize = 0;
1545
1546 Ok(())
1547 }
1548 }
1549
1550 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1551 for DelayWatcherWatchDelayRequest
1552 {
1553 #[inline(always)]
1554 fn new_empty() -> Self {
1555 Self::default()
1556 }
1557
1558 unsafe fn decode(
1559 &mut self,
1560 decoder: &mut fidl::encoding::Decoder<'_, D>,
1561 offset: usize,
1562 mut depth: fidl::encoding::Depth,
1563 ) -> fidl::Result<()> {
1564 decoder.debug_check_bounds::<Self>(offset);
1565 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1566 None => return Err(fidl::Error::NotNullable),
1567 Some(len) => len,
1568 };
1569 if len == 0 {
1571 return Ok(());
1572 };
1573 depth.increment()?;
1574 let envelope_size = 8;
1575 let bytes_len = len * envelope_size;
1576 let offset = decoder.out_of_line_offset(bytes_len)?;
1577 let mut _next_ordinal_to_read = 0;
1579 let mut next_offset = offset;
1580 let end_offset = offset + bytes_len;
1581
1582 while next_offset < end_offset {
1584 _next_ordinal_to_read += 1;
1585 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1586 next_offset += envelope_size;
1587 }
1588
1589 Ok(())
1590 }
1591 }
1592
1593 impl DelayWatcherWatchDelayResponse {
1594 #[inline(always)]
1595 fn max_ordinal_present(&self) -> u64 {
1596 if let Some(_) = self.delay {
1597 return 1;
1598 }
1599 0
1600 }
1601 }
1602
1603 impl fidl::encoding::ValueTypeMarker for DelayWatcherWatchDelayResponse {
1604 type Borrowed<'a> = &'a Self;
1605 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1606 value
1607 }
1608 }
1609
1610 unsafe impl fidl::encoding::TypeMarker for DelayWatcherWatchDelayResponse {
1611 type Owned = Self;
1612
1613 #[inline(always)]
1614 fn inline_align(_context: fidl::encoding::Context) -> usize {
1615 8
1616 }
1617
1618 #[inline(always)]
1619 fn inline_size(_context: fidl::encoding::Context) -> usize {
1620 16
1621 }
1622 }
1623
1624 unsafe impl<D: fidl::encoding::ResourceDialect>
1625 fidl::encoding::Encode<DelayWatcherWatchDelayResponse, D>
1626 for &DelayWatcherWatchDelayResponse
1627 {
1628 unsafe fn encode(
1629 self,
1630 encoder: &mut fidl::encoding::Encoder<'_, D>,
1631 offset: usize,
1632 mut depth: fidl::encoding::Depth,
1633 ) -> fidl::Result<()> {
1634 encoder.debug_check_bounds::<DelayWatcherWatchDelayResponse>(offset);
1635 let max_ordinal: u64 = self.max_ordinal_present();
1637 encoder.write_num(max_ordinal, offset);
1638 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1639 if max_ordinal == 0 {
1641 return Ok(());
1642 }
1643 depth.increment()?;
1644 let envelope_size = 8;
1645 let bytes_len = max_ordinal as usize * envelope_size;
1646 #[allow(unused_variables)]
1647 let offset = encoder.out_of_line_offset(bytes_len);
1648 let mut _prev_end_offset: usize = 0;
1649 if 1 > max_ordinal {
1650 return Ok(());
1651 }
1652
1653 let cur_offset: usize = (1 - 1) * envelope_size;
1656
1657 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1659
1660 fidl::encoding::encode_in_envelope_optional::<i64, D>(
1665 self.delay.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
1666 encoder,
1667 offset + cur_offset,
1668 depth,
1669 )?;
1670
1671 _prev_end_offset = cur_offset + envelope_size;
1672
1673 Ok(())
1674 }
1675 }
1676
1677 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1678 for DelayWatcherWatchDelayResponse
1679 {
1680 #[inline(always)]
1681 fn new_empty() -> Self {
1682 Self::default()
1683 }
1684
1685 unsafe fn decode(
1686 &mut self,
1687 decoder: &mut fidl::encoding::Decoder<'_, D>,
1688 offset: usize,
1689 mut depth: fidl::encoding::Depth,
1690 ) -> fidl::Result<()> {
1691 decoder.debug_check_bounds::<Self>(offset);
1692 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1693 None => return Err(fidl::Error::NotNullable),
1694 Some(len) => len,
1695 };
1696 if len == 0 {
1698 return Ok(());
1699 };
1700 depth.increment()?;
1701 let envelope_size = 8;
1702 let bytes_len = len * envelope_size;
1703 let offset = decoder.out_of_line_offset(bytes_len)?;
1704 let mut _next_ordinal_to_read = 0;
1706 let mut next_offset = offset;
1707 let end_offset = offset + bytes_len;
1708 _next_ordinal_to_read += 1;
1709 if next_offset >= end_offset {
1710 return Ok(());
1711 }
1712
1713 while _next_ordinal_to_read < 1 {
1715 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1716 _next_ordinal_to_read += 1;
1717 next_offset += envelope_size;
1718 }
1719
1720 let next_out_of_line = decoder.next_out_of_line();
1721 let handles_before = decoder.remaining_handles();
1722 if let Some((inlined, num_bytes, num_handles)) =
1723 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1724 {
1725 let member_inline_size =
1726 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1727 if inlined != (member_inline_size <= 4) {
1728 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1729 }
1730 let inner_offset;
1731 let mut inner_depth = depth.clone();
1732 if inlined {
1733 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1734 inner_offset = next_offset;
1735 } else {
1736 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1737 inner_depth.increment()?;
1738 }
1739 let val_ref = self.delay.get_or_insert_with(|| fidl::new_empty!(i64, D));
1740 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
1741 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1742 {
1743 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1744 }
1745 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1746 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1747 }
1748 }
1749
1750 next_offset += envelope_size;
1751
1752 while next_offset < end_offset {
1754 _next_ordinal_to_read += 1;
1755 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1756 next_offset += envelope_size;
1757 }
1758
1759 Ok(())
1760 }
1761 }
1762
1763 impl Format {
1764 #[inline(always)]
1765 fn max_ordinal_present(&self) -> u64 {
1766 if let Some(_) = self.channel_layout {
1767 return 4;
1768 }
1769 if let Some(_) = self.frames_per_second {
1770 return 3;
1771 }
1772 if let Some(_) = self.channel_count {
1773 return 2;
1774 }
1775 if let Some(_) = self.sample_type {
1776 return 1;
1777 }
1778 0
1779 }
1780 }
1781
1782 impl fidl::encoding::ValueTypeMarker for Format {
1783 type Borrowed<'a> = &'a Self;
1784 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1785 value
1786 }
1787 }
1788
1789 unsafe impl fidl::encoding::TypeMarker for Format {
1790 type Owned = Self;
1791
1792 #[inline(always)]
1793 fn inline_align(_context: fidl::encoding::Context) -> usize {
1794 8
1795 }
1796
1797 #[inline(always)]
1798 fn inline_size(_context: fidl::encoding::Context) -> usize {
1799 16
1800 }
1801 }
1802
1803 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Format, D> for &Format {
1804 unsafe fn encode(
1805 self,
1806 encoder: &mut fidl::encoding::Encoder<'_, D>,
1807 offset: usize,
1808 mut depth: fidl::encoding::Depth,
1809 ) -> fidl::Result<()> {
1810 encoder.debug_check_bounds::<Format>(offset);
1811 let max_ordinal: u64 = self.max_ordinal_present();
1813 encoder.write_num(max_ordinal, offset);
1814 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1815 if max_ordinal == 0 {
1817 return Ok(());
1818 }
1819 depth.increment()?;
1820 let envelope_size = 8;
1821 let bytes_len = max_ordinal as usize * envelope_size;
1822 #[allow(unused_variables)]
1823 let offset = encoder.out_of_line_offset(bytes_len);
1824 let mut _prev_end_offset: usize = 0;
1825 if 1 > max_ordinal {
1826 return Ok(());
1827 }
1828
1829 let cur_offset: usize = (1 - 1) * envelope_size;
1832
1833 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1835
1836 fidl::encoding::encode_in_envelope_optional::<SampleType, D>(
1841 self.sample_type
1842 .as_ref()
1843 .map(<SampleType as fidl::encoding::ValueTypeMarker>::borrow),
1844 encoder,
1845 offset + cur_offset,
1846 depth,
1847 )?;
1848
1849 _prev_end_offset = cur_offset + envelope_size;
1850 if 2 > max_ordinal {
1851 return Ok(());
1852 }
1853
1854 let cur_offset: usize = (2 - 1) * envelope_size;
1857
1858 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1860
1861 fidl::encoding::encode_in_envelope_optional::<u32, D>(
1866 self.channel_count.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
1867 encoder,
1868 offset + cur_offset,
1869 depth,
1870 )?;
1871
1872 _prev_end_offset = cur_offset + envelope_size;
1873 if 3 > max_ordinal {
1874 return Ok(());
1875 }
1876
1877 let cur_offset: usize = (3 - 1) * envelope_size;
1880
1881 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1883
1884 fidl::encoding::encode_in_envelope_optional::<u32, D>(
1889 self.frames_per_second
1890 .as_ref()
1891 .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
1892 encoder,
1893 offset + cur_offset,
1894 depth,
1895 )?;
1896
1897 _prev_end_offset = cur_offset + envelope_size;
1898 if 4 > max_ordinal {
1899 return Ok(());
1900 }
1901
1902 let cur_offset: usize = (4 - 1) * envelope_size;
1905
1906 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1908
1909 fidl::encoding::encode_in_envelope_optional::<ChannelLayout, D>(
1914 self.channel_layout
1915 .as_ref()
1916 .map(<ChannelLayout as fidl::encoding::ValueTypeMarker>::borrow),
1917 encoder,
1918 offset + cur_offset,
1919 depth,
1920 )?;
1921
1922 _prev_end_offset = cur_offset + envelope_size;
1923
1924 Ok(())
1925 }
1926 }
1927
1928 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Format {
1929 #[inline(always)]
1930 fn new_empty() -> Self {
1931 Self::default()
1932 }
1933
1934 unsafe fn decode(
1935 &mut self,
1936 decoder: &mut fidl::encoding::Decoder<'_, D>,
1937 offset: usize,
1938 mut depth: fidl::encoding::Depth,
1939 ) -> fidl::Result<()> {
1940 decoder.debug_check_bounds::<Self>(offset);
1941 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1942 None => return Err(fidl::Error::NotNullable),
1943 Some(len) => len,
1944 };
1945 if len == 0 {
1947 return Ok(());
1948 };
1949 depth.increment()?;
1950 let envelope_size = 8;
1951 let bytes_len = len * envelope_size;
1952 let offset = decoder.out_of_line_offset(bytes_len)?;
1953 let mut _next_ordinal_to_read = 0;
1955 let mut next_offset = offset;
1956 let end_offset = offset + bytes_len;
1957 _next_ordinal_to_read += 1;
1958 if next_offset >= end_offset {
1959 return Ok(());
1960 }
1961
1962 while _next_ordinal_to_read < 1 {
1964 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1965 _next_ordinal_to_read += 1;
1966 next_offset += envelope_size;
1967 }
1968
1969 let next_out_of_line = decoder.next_out_of_line();
1970 let handles_before = decoder.remaining_handles();
1971 if let Some((inlined, num_bytes, num_handles)) =
1972 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1973 {
1974 let member_inline_size =
1975 <SampleType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1976 if inlined != (member_inline_size <= 4) {
1977 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1978 }
1979 let inner_offset;
1980 let mut inner_depth = depth.clone();
1981 if inlined {
1982 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1983 inner_offset = next_offset;
1984 } else {
1985 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1986 inner_depth.increment()?;
1987 }
1988 let val_ref =
1989 self.sample_type.get_or_insert_with(|| fidl::new_empty!(SampleType, D));
1990 fidl::decode!(SampleType, D, val_ref, decoder, inner_offset, inner_depth)?;
1991 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1992 {
1993 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1994 }
1995 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1996 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1997 }
1998 }
1999
2000 next_offset += envelope_size;
2001 _next_ordinal_to_read += 1;
2002 if next_offset >= end_offset {
2003 return Ok(());
2004 }
2005
2006 while _next_ordinal_to_read < 2 {
2008 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2009 _next_ordinal_to_read += 1;
2010 next_offset += envelope_size;
2011 }
2012
2013 let next_out_of_line = decoder.next_out_of_line();
2014 let handles_before = decoder.remaining_handles();
2015 if let Some((inlined, num_bytes, num_handles)) =
2016 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2017 {
2018 let member_inline_size =
2019 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2020 if inlined != (member_inline_size <= 4) {
2021 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2022 }
2023 let inner_offset;
2024 let mut inner_depth = depth.clone();
2025 if inlined {
2026 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2027 inner_offset = next_offset;
2028 } else {
2029 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2030 inner_depth.increment()?;
2031 }
2032 let val_ref = self.channel_count.get_or_insert_with(|| fidl::new_empty!(u32, D));
2033 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
2034 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2035 {
2036 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2037 }
2038 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2039 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2040 }
2041 }
2042
2043 next_offset += envelope_size;
2044 _next_ordinal_to_read += 1;
2045 if next_offset >= end_offset {
2046 return Ok(());
2047 }
2048
2049 while _next_ordinal_to_read < 3 {
2051 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2052 _next_ordinal_to_read += 1;
2053 next_offset += envelope_size;
2054 }
2055
2056 let next_out_of_line = decoder.next_out_of_line();
2057 let handles_before = decoder.remaining_handles();
2058 if let Some((inlined, num_bytes, num_handles)) =
2059 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2060 {
2061 let member_inline_size =
2062 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2063 if inlined != (member_inline_size <= 4) {
2064 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2065 }
2066 let inner_offset;
2067 let mut inner_depth = depth.clone();
2068 if inlined {
2069 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2070 inner_offset = next_offset;
2071 } else {
2072 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2073 inner_depth.increment()?;
2074 }
2075 let val_ref =
2076 self.frames_per_second.get_or_insert_with(|| fidl::new_empty!(u32, D));
2077 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
2078 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2079 {
2080 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2081 }
2082 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2083 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2084 }
2085 }
2086
2087 next_offset += envelope_size;
2088 _next_ordinal_to_read += 1;
2089 if next_offset >= end_offset {
2090 return Ok(());
2091 }
2092
2093 while _next_ordinal_to_read < 4 {
2095 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2096 _next_ordinal_to_read += 1;
2097 next_offset += envelope_size;
2098 }
2099
2100 let next_out_of_line = decoder.next_out_of_line();
2101 let handles_before = decoder.remaining_handles();
2102 if let Some((inlined, num_bytes, num_handles)) =
2103 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2104 {
2105 let member_inline_size =
2106 <ChannelLayout as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2107 if inlined != (member_inline_size <= 4) {
2108 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2109 }
2110 let inner_offset;
2111 let mut inner_depth = depth.clone();
2112 if inlined {
2113 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2114 inner_offset = next_offset;
2115 } else {
2116 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2117 inner_depth.increment()?;
2118 }
2119 let val_ref =
2120 self.channel_layout.get_or_insert_with(|| fidl::new_empty!(ChannelLayout, D));
2121 fidl::decode!(ChannelLayout, D, val_ref, decoder, inner_offset, inner_depth)?;
2122 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2123 {
2124 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2125 }
2126 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2127 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2128 }
2129 }
2130
2131 next_offset += envelope_size;
2132
2133 while next_offset < end_offset {
2135 _next_ordinal_to_read += 1;
2136 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2137 next_offset += envelope_size;
2138 }
2139
2140 Ok(())
2141 }
2142 }
2143
2144 impl GainControlSetGainRequest {
2145 #[inline(always)]
2146 fn max_ordinal_present(&self) -> u64 {
2147 if let Some(_) = self.when {
2148 return 2;
2149 }
2150 if let Some(_) = self.how {
2151 return 1;
2152 }
2153 0
2154 }
2155 }
2156
2157 impl fidl::encoding::ValueTypeMarker for GainControlSetGainRequest {
2158 type Borrowed<'a> = &'a Self;
2159 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2160 value
2161 }
2162 }
2163
2164 unsafe impl fidl::encoding::TypeMarker for GainControlSetGainRequest {
2165 type Owned = Self;
2166
2167 #[inline(always)]
2168 fn inline_align(_context: fidl::encoding::Context) -> usize {
2169 8
2170 }
2171
2172 #[inline(always)]
2173 fn inline_size(_context: fidl::encoding::Context) -> usize {
2174 16
2175 }
2176 }
2177
2178 unsafe impl<D: fidl::encoding::ResourceDialect>
2179 fidl::encoding::Encode<GainControlSetGainRequest, D> for &GainControlSetGainRequest
2180 {
2181 unsafe fn encode(
2182 self,
2183 encoder: &mut fidl::encoding::Encoder<'_, D>,
2184 offset: usize,
2185 mut depth: fidl::encoding::Depth,
2186 ) -> fidl::Result<()> {
2187 encoder.debug_check_bounds::<GainControlSetGainRequest>(offset);
2188 let max_ordinal: u64 = self.max_ordinal_present();
2190 encoder.write_num(max_ordinal, offset);
2191 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2192 if max_ordinal == 0 {
2194 return Ok(());
2195 }
2196 depth.increment()?;
2197 let envelope_size = 8;
2198 let bytes_len = max_ordinal as usize * envelope_size;
2199 #[allow(unused_variables)]
2200 let offset = encoder.out_of_line_offset(bytes_len);
2201 let mut _prev_end_offset: usize = 0;
2202 if 1 > max_ordinal {
2203 return Ok(());
2204 }
2205
2206 let cur_offset: usize = (1 - 1) * envelope_size;
2209
2210 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2212
2213 fidl::encoding::encode_in_envelope_optional::<GainUpdateMethod, D>(
2218 self.how
2219 .as_ref()
2220 .map(<GainUpdateMethod as fidl::encoding::ValueTypeMarker>::borrow),
2221 encoder,
2222 offset + cur_offset,
2223 depth,
2224 )?;
2225
2226 _prev_end_offset = cur_offset + envelope_size;
2227 if 2 > max_ordinal {
2228 return Ok(());
2229 }
2230
2231 let cur_offset: usize = (2 - 1) * envelope_size;
2234
2235 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2237
2238 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_media2::RealTime, D>(
2243 self.when.as_ref().map(
2244 <fidl_fuchsia_media2::RealTime as fidl::encoding::ValueTypeMarker>::borrow,
2245 ),
2246 encoder,
2247 offset + cur_offset,
2248 depth,
2249 )?;
2250
2251 _prev_end_offset = cur_offset + envelope_size;
2252
2253 Ok(())
2254 }
2255 }
2256
2257 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2258 for GainControlSetGainRequest
2259 {
2260 #[inline(always)]
2261 fn new_empty() -> Self {
2262 Self::default()
2263 }
2264
2265 unsafe fn decode(
2266 &mut self,
2267 decoder: &mut fidl::encoding::Decoder<'_, D>,
2268 offset: usize,
2269 mut depth: fidl::encoding::Depth,
2270 ) -> fidl::Result<()> {
2271 decoder.debug_check_bounds::<Self>(offset);
2272 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2273 None => return Err(fidl::Error::NotNullable),
2274 Some(len) => len,
2275 };
2276 if len == 0 {
2278 return Ok(());
2279 };
2280 depth.increment()?;
2281 let envelope_size = 8;
2282 let bytes_len = len * envelope_size;
2283 let offset = decoder.out_of_line_offset(bytes_len)?;
2284 let mut _next_ordinal_to_read = 0;
2286 let mut next_offset = offset;
2287 let end_offset = offset + bytes_len;
2288 _next_ordinal_to_read += 1;
2289 if next_offset >= end_offset {
2290 return Ok(());
2291 }
2292
2293 while _next_ordinal_to_read < 1 {
2295 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2296 _next_ordinal_to_read += 1;
2297 next_offset += envelope_size;
2298 }
2299
2300 let next_out_of_line = decoder.next_out_of_line();
2301 let handles_before = decoder.remaining_handles();
2302 if let Some((inlined, num_bytes, num_handles)) =
2303 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2304 {
2305 let member_inline_size =
2306 <GainUpdateMethod as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2307 if inlined != (member_inline_size <= 4) {
2308 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2309 }
2310 let inner_offset;
2311 let mut inner_depth = depth.clone();
2312 if inlined {
2313 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2314 inner_offset = next_offset;
2315 } else {
2316 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2317 inner_depth.increment()?;
2318 }
2319 let val_ref = self.how.get_or_insert_with(|| fidl::new_empty!(GainUpdateMethod, D));
2320 fidl::decode!(GainUpdateMethod, D, val_ref, decoder, inner_offset, inner_depth)?;
2321 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2322 {
2323 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2324 }
2325 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2326 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2327 }
2328 }
2329
2330 next_offset += envelope_size;
2331 _next_ordinal_to_read += 1;
2332 if next_offset >= end_offset {
2333 return Ok(());
2334 }
2335
2336 while _next_ordinal_to_read < 2 {
2338 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2339 _next_ordinal_to_read += 1;
2340 next_offset += envelope_size;
2341 }
2342
2343 let next_out_of_line = decoder.next_out_of_line();
2344 let handles_before = decoder.remaining_handles();
2345 if let Some((inlined, num_bytes, num_handles)) =
2346 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2347 {
2348 let member_inline_size =
2349 <fidl_fuchsia_media2::RealTime as fidl::encoding::TypeMarker>::inline_size(
2350 decoder.context,
2351 );
2352 if inlined != (member_inline_size <= 4) {
2353 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2354 }
2355 let inner_offset;
2356 let mut inner_depth = depth.clone();
2357 if inlined {
2358 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2359 inner_offset = next_offset;
2360 } else {
2361 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2362 inner_depth.increment()?;
2363 }
2364 let val_ref = self
2365 .when
2366 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_media2::RealTime, D));
2367 fidl::decode!(
2368 fidl_fuchsia_media2::RealTime,
2369 D,
2370 val_ref,
2371 decoder,
2372 inner_offset,
2373 inner_depth
2374 )?;
2375 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2376 {
2377 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2378 }
2379 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2380 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2381 }
2382 }
2383
2384 next_offset += envelope_size;
2385
2386 while next_offset < end_offset {
2388 _next_ordinal_to_read += 1;
2389 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2390 next_offset += envelope_size;
2391 }
2392
2393 Ok(())
2394 }
2395 }
2396
2397 impl GainControlSetMuteRequest {
2398 #[inline(always)]
2399 fn max_ordinal_present(&self) -> u64 {
2400 if let Some(_) = self.when {
2401 return 2;
2402 }
2403 if let Some(_) = self.muted {
2404 return 1;
2405 }
2406 0
2407 }
2408 }
2409
2410 impl fidl::encoding::ValueTypeMarker for GainControlSetMuteRequest {
2411 type Borrowed<'a> = &'a Self;
2412 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2413 value
2414 }
2415 }
2416
2417 unsafe impl fidl::encoding::TypeMarker for GainControlSetMuteRequest {
2418 type Owned = Self;
2419
2420 #[inline(always)]
2421 fn inline_align(_context: fidl::encoding::Context) -> usize {
2422 8
2423 }
2424
2425 #[inline(always)]
2426 fn inline_size(_context: fidl::encoding::Context) -> usize {
2427 16
2428 }
2429 }
2430
2431 unsafe impl<D: fidl::encoding::ResourceDialect>
2432 fidl::encoding::Encode<GainControlSetMuteRequest, D> for &GainControlSetMuteRequest
2433 {
2434 unsafe fn encode(
2435 self,
2436 encoder: &mut fidl::encoding::Encoder<'_, D>,
2437 offset: usize,
2438 mut depth: fidl::encoding::Depth,
2439 ) -> fidl::Result<()> {
2440 encoder.debug_check_bounds::<GainControlSetMuteRequest>(offset);
2441 let max_ordinal: u64 = self.max_ordinal_present();
2443 encoder.write_num(max_ordinal, offset);
2444 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2445 if max_ordinal == 0 {
2447 return Ok(());
2448 }
2449 depth.increment()?;
2450 let envelope_size = 8;
2451 let bytes_len = max_ordinal as usize * envelope_size;
2452 #[allow(unused_variables)]
2453 let offset = encoder.out_of_line_offset(bytes_len);
2454 let mut _prev_end_offset: usize = 0;
2455 if 1 > max_ordinal {
2456 return Ok(());
2457 }
2458
2459 let cur_offset: usize = (1 - 1) * envelope_size;
2462
2463 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2465
2466 fidl::encoding::encode_in_envelope_optional::<bool, D>(
2471 self.muted.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2472 encoder,
2473 offset + cur_offset,
2474 depth,
2475 )?;
2476
2477 _prev_end_offset = cur_offset + envelope_size;
2478 if 2 > max_ordinal {
2479 return Ok(());
2480 }
2481
2482 let cur_offset: usize = (2 - 1) * envelope_size;
2485
2486 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2488
2489 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_media2::RealTime, D>(
2494 self.when.as_ref().map(
2495 <fidl_fuchsia_media2::RealTime as fidl::encoding::ValueTypeMarker>::borrow,
2496 ),
2497 encoder,
2498 offset + cur_offset,
2499 depth,
2500 )?;
2501
2502 _prev_end_offset = cur_offset + envelope_size;
2503
2504 Ok(())
2505 }
2506 }
2507
2508 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2509 for GainControlSetMuteRequest
2510 {
2511 #[inline(always)]
2512 fn new_empty() -> Self {
2513 Self::default()
2514 }
2515
2516 unsafe fn decode(
2517 &mut self,
2518 decoder: &mut fidl::encoding::Decoder<'_, D>,
2519 offset: usize,
2520 mut depth: fidl::encoding::Depth,
2521 ) -> fidl::Result<()> {
2522 decoder.debug_check_bounds::<Self>(offset);
2523 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2524 None => return Err(fidl::Error::NotNullable),
2525 Some(len) => len,
2526 };
2527 if len == 0 {
2529 return Ok(());
2530 };
2531 depth.increment()?;
2532 let envelope_size = 8;
2533 let bytes_len = len * envelope_size;
2534 let offset = decoder.out_of_line_offset(bytes_len)?;
2535 let mut _next_ordinal_to_read = 0;
2537 let mut next_offset = offset;
2538 let end_offset = offset + bytes_len;
2539 _next_ordinal_to_read += 1;
2540 if next_offset >= end_offset {
2541 return Ok(());
2542 }
2543
2544 while _next_ordinal_to_read < 1 {
2546 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2547 _next_ordinal_to_read += 1;
2548 next_offset += envelope_size;
2549 }
2550
2551 let next_out_of_line = decoder.next_out_of_line();
2552 let handles_before = decoder.remaining_handles();
2553 if let Some((inlined, num_bytes, num_handles)) =
2554 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2555 {
2556 let member_inline_size =
2557 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2558 if inlined != (member_inline_size <= 4) {
2559 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2560 }
2561 let inner_offset;
2562 let mut inner_depth = depth.clone();
2563 if inlined {
2564 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2565 inner_offset = next_offset;
2566 } else {
2567 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2568 inner_depth.increment()?;
2569 }
2570 let val_ref = self.muted.get_or_insert_with(|| fidl::new_empty!(bool, D));
2571 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
2572 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2573 {
2574 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2575 }
2576 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2577 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2578 }
2579 }
2580
2581 next_offset += envelope_size;
2582 _next_ordinal_to_read += 1;
2583 if next_offset >= end_offset {
2584 return Ok(());
2585 }
2586
2587 while _next_ordinal_to_read < 2 {
2589 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2590 _next_ordinal_to_read += 1;
2591 next_offset += envelope_size;
2592 }
2593
2594 let next_out_of_line = decoder.next_out_of_line();
2595 let handles_before = decoder.remaining_handles();
2596 if let Some((inlined, num_bytes, num_handles)) =
2597 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2598 {
2599 let member_inline_size =
2600 <fidl_fuchsia_media2::RealTime as fidl::encoding::TypeMarker>::inline_size(
2601 decoder.context,
2602 );
2603 if inlined != (member_inline_size <= 4) {
2604 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2605 }
2606 let inner_offset;
2607 let mut inner_depth = depth.clone();
2608 if inlined {
2609 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2610 inner_offset = next_offset;
2611 } else {
2612 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2613 inner_depth.increment()?;
2614 }
2615 let val_ref = self
2616 .when
2617 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_media2::RealTime, D));
2618 fidl::decode!(
2619 fidl_fuchsia_media2::RealTime,
2620 D,
2621 val_ref,
2622 decoder,
2623 inner_offset,
2624 inner_depth
2625 )?;
2626 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2627 {
2628 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2629 }
2630 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2631 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2632 }
2633 }
2634
2635 next_offset += envelope_size;
2636
2637 while next_offset < end_offset {
2639 _next_ordinal_to_read += 1;
2640 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2641 next_offset += envelope_size;
2642 }
2643
2644 Ok(())
2645 }
2646 }
2647
2648 impl GainControlSetGainResponse {
2649 #[inline(always)]
2650 fn max_ordinal_present(&self) -> u64 {
2651 0
2652 }
2653 }
2654
2655 impl fidl::encoding::ValueTypeMarker for GainControlSetGainResponse {
2656 type Borrowed<'a> = &'a Self;
2657 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2658 value
2659 }
2660 }
2661
2662 unsafe impl fidl::encoding::TypeMarker for GainControlSetGainResponse {
2663 type Owned = Self;
2664
2665 #[inline(always)]
2666 fn inline_align(_context: fidl::encoding::Context) -> usize {
2667 8
2668 }
2669
2670 #[inline(always)]
2671 fn inline_size(_context: fidl::encoding::Context) -> usize {
2672 16
2673 }
2674 }
2675
2676 unsafe impl<D: fidl::encoding::ResourceDialect>
2677 fidl::encoding::Encode<GainControlSetGainResponse, D> for &GainControlSetGainResponse
2678 {
2679 unsafe fn encode(
2680 self,
2681 encoder: &mut fidl::encoding::Encoder<'_, D>,
2682 offset: usize,
2683 mut depth: fidl::encoding::Depth,
2684 ) -> fidl::Result<()> {
2685 encoder.debug_check_bounds::<GainControlSetGainResponse>(offset);
2686 let max_ordinal: u64 = self.max_ordinal_present();
2688 encoder.write_num(max_ordinal, offset);
2689 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2690 if max_ordinal == 0 {
2692 return Ok(());
2693 }
2694 depth.increment()?;
2695 let envelope_size = 8;
2696 let bytes_len = max_ordinal as usize * envelope_size;
2697 #[allow(unused_variables)]
2698 let offset = encoder.out_of_line_offset(bytes_len);
2699 let mut _prev_end_offset: usize = 0;
2700
2701 Ok(())
2702 }
2703 }
2704
2705 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2706 for GainControlSetGainResponse
2707 {
2708 #[inline(always)]
2709 fn new_empty() -> Self {
2710 Self::default()
2711 }
2712
2713 unsafe fn decode(
2714 &mut self,
2715 decoder: &mut fidl::encoding::Decoder<'_, D>,
2716 offset: usize,
2717 mut depth: fidl::encoding::Depth,
2718 ) -> fidl::Result<()> {
2719 decoder.debug_check_bounds::<Self>(offset);
2720 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2721 None => return Err(fidl::Error::NotNullable),
2722 Some(len) => len,
2723 };
2724 if len == 0 {
2726 return Ok(());
2727 };
2728 depth.increment()?;
2729 let envelope_size = 8;
2730 let bytes_len = len * envelope_size;
2731 let offset = decoder.out_of_line_offset(bytes_len)?;
2732 let mut _next_ordinal_to_read = 0;
2734 let mut next_offset = offset;
2735 let end_offset = offset + bytes_len;
2736
2737 while next_offset < end_offset {
2739 _next_ordinal_to_read += 1;
2740 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2741 next_offset += envelope_size;
2742 }
2743
2744 Ok(())
2745 }
2746 }
2747
2748 impl GainControlSetMuteResponse {
2749 #[inline(always)]
2750 fn max_ordinal_present(&self) -> u64 {
2751 0
2752 }
2753 }
2754
2755 impl fidl::encoding::ValueTypeMarker for GainControlSetMuteResponse {
2756 type Borrowed<'a> = &'a Self;
2757 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2758 value
2759 }
2760 }
2761
2762 unsafe impl fidl::encoding::TypeMarker for GainControlSetMuteResponse {
2763 type Owned = Self;
2764
2765 #[inline(always)]
2766 fn inline_align(_context: fidl::encoding::Context) -> usize {
2767 8
2768 }
2769
2770 #[inline(always)]
2771 fn inline_size(_context: fidl::encoding::Context) -> usize {
2772 16
2773 }
2774 }
2775
2776 unsafe impl<D: fidl::encoding::ResourceDialect>
2777 fidl::encoding::Encode<GainControlSetMuteResponse, D> for &GainControlSetMuteResponse
2778 {
2779 unsafe fn encode(
2780 self,
2781 encoder: &mut fidl::encoding::Encoder<'_, D>,
2782 offset: usize,
2783 mut depth: fidl::encoding::Depth,
2784 ) -> fidl::Result<()> {
2785 encoder.debug_check_bounds::<GainControlSetMuteResponse>(offset);
2786 let max_ordinal: u64 = self.max_ordinal_present();
2788 encoder.write_num(max_ordinal, offset);
2789 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2790 if max_ordinal == 0 {
2792 return Ok(());
2793 }
2794 depth.increment()?;
2795 let envelope_size = 8;
2796 let bytes_len = max_ordinal as usize * envelope_size;
2797 #[allow(unused_variables)]
2798 let offset = encoder.out_of_line_offset(bytes_len);
2799 let mut _prev_end_offset: usize = 0;
2800
2801 Ok(())
2802 }
2803 }
2804
2805 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2806 for GainControlSetMuteResponse
2807 {
2808 #[inline(always)]
2809 fn new_empty() -> Self {
2810 Self::default()
2811 }
2812
2813 unsafe fn decode(
2814 &mut self,
2815 decoder: &mut fidl::encoding::Decoder<'_, D>,
2816 offset: usize,
2817 mut depth: fidl::encoding::Depth,
2818 ) -> fidl::Result<()> {
2819 decoder.debug_check_bounds::<Self>(offset);
2820 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2821 None => return Err(fidl::Error::NotNullable),
2822 Some(len) => len,
2823 };
2824 if len == 0 {
2826 return Ok(());
2827 };
2828 depth.increment()?;
2829 let envelope_size = 8;
2830 let bytes_len = len * envelope_size;
2831 let offset = decoder.out_of_line_offset(bytes_len)?;
2832 let mut _next_ordinal_to_read = 0;
2834 let mut next_offset = offset;
2835 let end_offset = offset + bytes_len;
2836
2837 while next_offset < end_offset {
2839 _next_ordinal_to_read += 1;
2840 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2841 next_offset += envelope_size;
2842 }
2843
2844 Ok(())
2845 }
2846 }
2847
2848 impl Packet {
2849 #[inline(always)]
2850 fn max_ordinal_present(&self) -> u64 {
2851 if let Some(_) = self.encryption_properties {
2852 return 7;
2853 }
2854 if let Some(_) = self.back_frames_to_drop {
2855 return 6;
2856 }
2857 if let Some(_) = self.front_frames_to_drop {
2858 return 5;
2859 }
2860 if let Some(_) = self.flags {
2861 return 4;
2862 }
2863 if let Some(_) = self.capture_timestamp {
2864 return 3;
2865 }
2866 if let Some(_) = self.timestamp {
2867 return 2;
2868 }
2869 if let Some(_) = self.payload {
2870 return 1;
2871 }
2872 0
2873 }
2874 }
2875
2876 impl fidl::encoding::ValueTypeMarker for Packet {
2877 type Borrowed<'a> = &'a Self;
2878 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2879 value
2880 }
2881 }
2882
2883 unsafe impl fidl::encoding::TypeMarker for Packet {
2884 type Owned = Self;
2885
2886 #[inline(always)]
2887 fn inline_align(_context: fidl::encoding::Context) -> usize {
2888 8
2889 }
2890
2891 #[inline(always)]
2892 fn inline_size(_context: fidl::encoding::Context) -> usize {
2893 16
2894 }
2895 }
2896
2897 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Packet, D> for &Packet {
2898 unsafe fn encode(
2899 self,
2900 encoder: &mut fidl::encoding::Encoder<'_, D>,
2901 offset: usize,
2902 mut depth: fidl::encoding::Depth,
2903 ) -> fidl::Result<()> {
2904 encoder.debug_check_bounds::<Packet>(offset);
2905 let max_ordinal: u64 = self.max_ordinal_present();
2907 encoder.write_num(max_ordinal, offset);
2908 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2909 if max_ordinal == 0 {
2911 return Ok(());
2912 }
2913 depth.increment()?;
2914 let envelope_size = 8;
2915 let bytes_len = max_ordinal as usize * envelope_size;
2916 #[allow(unused_variables)]
2917 let offset = encoder.out_of_line_offset(bytes_len);
2918 let mut _prev_end_offset: usize = 0;
2919 if 1 > max_ordinal {
2920 return Ok(());
2921 }
2922
2923 let cur_offset: usize = (1 - 1) * envelope_size;
2926
2927 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2929
2930 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_media2::PayloadRange, D>(
2935 self.payload.as_ref().map(
2936 <fidl_fuchsia_media2::PayloadRange as fidl::encoding::ValueTypeMarker>::borrow,
2937 ),
2938 encoder,
2939 offset + cur_offset,
2940 depth,
2941 )?;
2942
2943 _prev_end_offset = cur_offset + envelope_size;
2944 if 2 > max_ordinal {
2945 return Ok(());
2946 }
2947
2948 let cur_offset: usize = (2 - 1) * envelope_size;
2951
2952 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2954
2955 fidl::encoding::encode_in_envelope_optional::<Timestamp, D>(
2960 self.timestamp.as_ref().map(<Timestamp as fidl::encoding::ValueTypeMarker>::borrow),
2961 encoder,
2962 offset + cur_offset,
2963 depth,
2964 )?;
2965
2966 _prev_end_offset = cur_offset + envelope_size;
2967 if 3 > max_ordinal {
2968 return Ok(());
2969 }
2970
2971 let cur_offset: usize = (3 - 1) * envelope_size;
2974
2975 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2977
2978 fidl::encoding::encode_in_envelope_optional::<i64, D>(
2983 self.capture_timestamp
2984 .as_ref()
2985 .map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
2986 encoder,
2987 offset + cur_offset,
2988 depth,
2989 )?;
2990
2991 _prev_end_offset = cur_offset + envelope_size;
2992 if 4 > max_ordinal {
2993 return Ok(());
2994 }
2995
2996 let cur_offset: usize = (4 - 1) * envelope_size;
2999
3000 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3002
3003 fidl::encoding::encode_in_envelope_optional::<PacketFlags, D>(
3008 self.flags.as_ref().map(<PacketFlags as fidl::encoding::ValueTypeMarker>::borrow),
3009 encoder,
3010 offset + cur_offset,
3011 depth,
3012 )?;
3013
3014 _prev_end_offset = cur_offset + envelope_size;
3015 if 5 > max_ordinal {
3016 return Ok(());
3017 }
3018
3019 let cur_offset: usize = (5 - 1) * envelope_size;
3022
3023 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3025
3026 fidl::encoding::encode_in_envelope_optional::<u32, D>(
3031 self.front_frames_to_drop
3032 .as_ref()
3033 .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3034 encoder,
3035 offset + cur_offset,
3036 depth,
3037 )?;
3038
3039 _prev_end_offset = cur_offset + envelope_size;
3040 if 6 > max_ordinal {
3041 return Ok(());
3042 }
3043
3044 let cur_offset: usize = (6 - 1) * envelope_size;
3047
3048 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3050
3051 fidl::encoding::encode_in_envelope_optional::<u32, D>(
3056 self.back_frames_to_drop
3057 .as_ref()
3058 .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3059 encoder,
3060 offset + cur_offset,
3061 depth,
3062 )?;
3063
3064 _prev_end_offset = cur_offset + envelope_size;
3065 if 7 > max_ordinal {
3066 return Ok(());
3067 }
3068
3069 let cur_offset: usize = (7 - 1) * envelope_size;
3072
3073 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3075
3076 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_drm::PacketEncryptionProperties, D>(
3081 self.encryption_properties.as_ref().map(<fidl_fuchsia_drm::PacketEncryptionProperties as fidl::encoding::ValueTypeMarker>::borrow),
3082 encoder, offset + cur_offset, depth
3083 )?;
3084
3085 _prev_end_offset = cur_offset + envelope_size;
3086
3087 Ok(())
3088 }
3089 }
3090
3091 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Packet {
3092 #[inline(always)]
3093 fn new_empty() -> Self {
3094 Self::default()
3095 }
3096
3097 unsafe fn decode(
3098 &mut self,
3099 decoder: &mut fidl::encoding::Decoder<'_, D>,
3100 offset: usize,
3101 mut depth: fidl::encoding::Depth,
3102 ) -> fidl::Result<()> {
3103 decoder.debug_check_bounds::<Self>(offset);
3104 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3105 None => return Err(fidl::Error::NotNullable),
3106 Some(len) => len,
3107 };
3108 if len == 0 {
3110 return Ok(());
3111 };
3112 depth.increment()?;
3113 let envelope_size = 8;
3114 let bytes_len = len * envelope_size;
3115 let offset = decoder.out_of_line_offset(bytes_len)?;
3116 let mut _next_ordinal_to_read = 0;
3118 let mut next_offset = offset;
3119 let end_offset = offset + bytes_len;
3120 _next_ordinal_to_read += 1;
3121 if next_offset >= end_offset {
3122 return Ok(());
3123 }
3124
3125 while _next_ordinal_to_read < 1 {
3127 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3128 _next_ordinal_to_read += 1;
3129 next_offset += envelope_size;
3130 }
3131
3132 let next_out_of_line = decoder.next_out_of_line();
3133 let handles_before = decoder.remaining_handles();
3134 if let Some((inlined, num_bytes, num_handles)) =
3135 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3136 {
3137 let member_inline_size =
3138 <fidl_fuchsia_media2::PayloadRange as fidl::encoding::TypeMarker>::inline_size(
3139 decoder.context,
3140 );
3141 if inlined != (member_inline_size <= 4) {
3142 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3143 }
3144 let inner_offset;
3145 let mut inner_depth = depth.clone();
3146 if inlined {
3147 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3148 inner_offset = next_offset;
3149 } else {
3150 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3151 inner_depth.increment()?;
3152 }
3153 let val_ref = self
3154 .payload
3155 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_media2::PayloadRange, D));
3156 fidl::decode!(
3157 fidl_fuchsia_media2::PayloadRange,
3158 D,
3159 val_ref,
3160 decoder,
3161 inner_offset,
3162 inner_depth
3163 )?;
3164 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3165 {
3166 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3167 }
3168 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3169 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3170 }
3171 }
3172
3173 next_offset += envelope_size;
3174 _next_ordinal_to_read += 1;
3175 if next_offset >= end_offset {
3176 return Ok(());
3177 }
3178
3179 while _next_ordinal_to_read < 2 {
3181 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3182 _next_ordinal_to_read += 1;
3183 next_offset += envelope_size;
3184 }
3185
3186 let next_out_of_line = decoder.next_out_of_line();
3187 let handles_before = decoder.remaining_handles();
3188 if let Some((inlined, num_bytes, num_handles)) =
3189 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3190 {
3191 let member_inline_size =
3192 <Timestamp as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3193 if inlined != (member_inline_size <= 4) {
3194 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3195 }
3196 let inner_offset;
3197 let mut inner_depth = depth.clone();
3198 if inlined {
3199 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3200 inner_offset = next_offset;
3201 } else {
3202 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3203 inner_depth.increment()?;
3204 }
3205 let val_ref = self.timestamp.get_or_insert_with(|| fidl::new_empty!(Timestamp, D));
3206 fidl::decode!(Timestamp, D, val_ref, decoder, inner_offset, inner_depth)?;
3207 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3208 {
3209 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3210 }
3211 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3212 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3213 }
3214 }
3215
3216 next_offset += envelope_size;
3217 _next_ordinal_to_read += 1;
3218 if next_offset >= end_offset {
3219 return Ok(());
3220 }
3221
3222 while _next_ordinal_to_read < 3 {
3224 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3225 _next_ordinal_to_read += 1;
3226 next_offset += envelope_size;
3227 }
3228
3229 let next_out_of_line = decoder.next_out_of_line();
3230 let handles_before = decoder.remaining_handles();
3231 if let Some((inlined, num_bytes, num_handles)) =
3232 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3233 {
3234 let member_inline_size =
3235 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3236 if inlined != (member_inline_size <= 4) {
3237 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3238 }
3239 let inner_offset;
3240 let mut inner_depth = depth.clone();
3241 if inlined {
3242 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3243 inner_offset = next_offset;
3244 } else {
3245 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3246 inner_depth.increment()?;
3247 }
3248 let val_ref =
3249 self.capture_timestamp.get_or_insert_with(|| fidl::new_empty!(i64, D));
3250 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
3251 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3252 {
3253 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3254 }
3255 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3256 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3257 }
3258 }
3259
3260 next_offset += envelope_size;
3261 _next_ordinal_to_read += 1;
3262 if next_offset >= end_offset {
3263 return Ok(());
3264 }
3265
3266 while _next_ordinal_to_read < 4 {
3268 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3269 _next_ordinal_to_read += 1;
3270 next_offset += envelope_size;
3271 }
3272
3273 let next_out_of_line = decoder.next_out_of_line();
3274 let handles_before = decoder.remaining_handles();
3275 if let Some((inlined, num_bytes, num_handles)) =
3276 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3277 {
3278 let member_inline_size =
3279 <PacketFlags as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3280 if inlined != (member_inline_size <= 4) {
3281 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3282 }
3283 let inner_offset;
3284 let mut inner_depth = depth.clone();
3285 if inlined {
3286 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3287 inner_offset = next_offset;
3288 } else {
3289 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3290 inner_depth.increment()?;
3291 }
3292 let val_ref = self.flags.get_or_insert_with(|| fidl::new_empty!(PacketFlags, D));
3293 fidl::decode!(PacketFlags, D, val_ref, decoder, inner_offset, inner_depth)?;
3294 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3295 {
3296 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3297 }
3298 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3299 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3300 }
3301 }
3302
3303 next_offset += envelope_size;
3304 _next_ordinal_to_read += 1;
3305 if next_offset >= end_offset {
3306 return Ok(());
3307 }
3308
3309 while _next_ordinal_to_read < 5 {
3311 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3312 _next_ordinal_to_read += 1;
3313 next_offset += envelope_size;
3314 }
3315
3316 let next_out_of_line = decoder.next_out_of_line();
3317 let handles_before = decoder.remaining_handles();
3318 if let Some((inlined, num_bytes, num_handles)) =
3319 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3320 {
3321 let member_inline_size =
3322 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3323 if inlined != (member_inline_size <= 4) {
3324 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3325 }
3326 let inner_offset;
3327 let mut inner_depth = depth.clone();
3328 if inlined {
3329 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3330 inner_offset = next_offset;
3331 } else {
3332 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3333 inner_depth.increment()?;
3334 }
3335 let val_ref =
3336 self.front_frames_to_drop.get_or_insert_with(|| fidl::new_empty!(u32, D));
3337 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
3338 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3339 {
3340 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3341 }
3342 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3343 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3344 }
3345 }
3346
3347 next_offset += envelope_size;
3348 _next_ordinal_to_read += 1;
3349 if next_offset >= end_offset {
3350 return Ok(());
3351 }
3352
3353 while _next_ordinal_to_read < 6 {
3355 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3356 _next_ordinal_to_read += 1;
3357 next_offset += envelope_size;
3358 }
3359
3360 let next_out_of_line = decoder.next_out_of_line();
3361 let handles_before = decoder.remaining_handles();
3362 if let Some((inlined, num_bytes, num_handles)) =
3363 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3364 {
3365 let member_inline_size =
3366 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3367 if inlined != (member_inline_size <= 4) {
3368 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3369 }
3370 let inner_offset;
3371 let mut inner_depth = depth.clone();
3372 if inlined {
3373 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3374 inner_offset = next_offset;
3375 } else {
3376 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3377 inner_depth.increment()?;
3378 }
3379 let val_ref =
3380 self.back_frames_to_drop.get_or_insert_with(|| fidl::new_empty!(u32, D));
3381 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
3382 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3383 {
3384 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3385 }
3386 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3387 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3388 }
3389 }
3390
3391 next_offset += envelope_size;
3392 _next_ordinal_to_read += 1;
3393 if next_offset >= end_offset {
3394 return Ok(());
3395 }
3396
3397 while _next_ordinal_to_read < 7 {
3399 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3400 _next_ordinal_to_read += 1;
3401 next_offset += envelope_size;
3402 }
3403
3404 let next_out_of_line = decoder.next_out_of_line();
3405 let handles_before = decoder.remaining_handles();
3406 if let Some((inlined, num_bytes, num_handles)) =
3407 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3408 {
3409 let member_inline_size = <fidl_fuchsia_drm::PacketEncryptionProperties as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3410 if inlined != (member_inline_size <= 4) {
3411 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3412 }
3413 let inner_offset;
3414 let mut inner_depth = depth.clone();
3415 if inlined {
3416 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3417 inner_offset = next_offset;
3418 } else {
3419 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3420 inner_depth.increment()?;
3421 }
3422 let val_ref = self.encryption_properties.get_or_insert_with(|| {
3423 fidl::new_empty!(fidl_fuchsia_drm::PacketEncryptionProperties, D)
3424 });
3425 fidl::decode!(
3426 fidl_fuchsia_drm::PacketEncryptionProperties,
3427 D,
3428 val_ref,
3429 decoder,
3430 inner_offset,
3431 inner_depth
3432 )?;
3433 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3434 {
3435 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3436 }
3437 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3438 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3439 }
3440 }
3441
3442 next_offset += envelope_size;
3443
3444 while next_offset < end_offset {
3446 _next_ordinal_to_read += 1;
3447 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3448 next_offset += envelope_size;
3449 }
3450
3451 Ok(())
3452 }
3453 }
3454
3455 impl RampFunctionLinearSlope {
3456 #[inline(always)]
3457 fn max_ordinal_present(&self) -> u64 {
3458 0
3459 }
3460 }
3461
3462 impl fidl::encoding::ValueTypeMarker for RampFunctionLinearSlope {
3463 type Borrowed<'a> = &'a Self;
3464 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3465 value
3466 }
3467 }
3468
3469 unsafe impl fidl::encoding::TypeMarker for RampFunctionLinearSlope {
3470 type Owned = Self;
3471
3472 #[inline(always)]
3473 fn inline_align(_context: fidl::encoding::Context) -> usize {
3474 8
3475 }
3476
3477 #[inline(always)]
3478 fn inline_size(_context: fidl::encoding::Context) -> usize {
3479 16
3480 }
3481 }
3482
3483 unsafe impl<D: fidl::encoding::ResourceDialect>
3484 fidl::encoding::Encode<RampFunctionLinearSlope, D> for &RampFunctionLinearSlope
3485 {
3486 unsafe fn encode(
3487 self,
3488 encoder: &mut fidl::encoding::Encoder<'_, D>,
3489 offset: usize,
3490 mut depth: fidl::encoding::Depth,
3491 ) -> fidl::Result<()> {
3492 encoder.debug_check_bounds::<RampFunctionLinearSlope>(offset);
3493 let max_ordinal: u64 = self.max_ordinal_present();
3495 encoder.write_num(max_ordinal, offset);
3496 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3497 if max_ordinal == 0 {
3499 return Ok(());
3500 }
3501 depth.increment()?;
3502 let envelope_size = 8;
3503 let bytes_len = max_ordinal as usize * envelope_size;
3504 #[allow(unused_variables)]
3505 let offset = encoder.out_of_line_offset(bytes_len);
3506 let mut _prev_end_offset: usize = 0;
3507
3508 Ok(())
3509 }
3510 }
3511
3512 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3513 for RampFunctionLinearSlope
3514 {
3515 #[inline(always)]
3516 fn new_empty() -> Self {
3517 Self::default()
3518 }
3519
3520 unsafe fn decode(
3521 &mut self,
3522 decoder: &mut fidl::encoding::Decoder<'_, D>,
3523 offset: usize,
3524 mut depth: fidl::encoding::Depth,
3525 ) -> fidl::Result<()> {
3526 decoder.debug_check_bounds::<Self>(offset);
3527 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3528 None => return Err(fidl::Error::NotNullable),
3529 Some(len) => len,
3530 };
3531 if len == 0 {
3533 return Ok(());
3534 };
3535 depth.increment()?;
3536 let envelope_size = 8;
3537 let bytes_len = len * envelope_size;
3538 let offset = decoder.out_of_line_offset(bytes_len)?;
3539 let mut _next_ordinal_to_read = 0;
3541 let mut next_offset = offset;
3542 let end_offset = offset + bytes_len;
3543
3544 while next_offset < end_offset {
3546 _next_ordinal_to_read += 1;
3547 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3548 next_offset += envelope_size;
3549 }
3550
3551 Ok(())
3552 }
3553 }
3554
3555 impl RampedGain {
3556 #[inline(always)]
3557 fn max_ordinal_present(&self) -> u64 {
3558 if let Some(_) = self.function {
3559 return 3;
3560 }
3561 if let Some(_) = self.duration {
3562 return 2;
3563 }
3564 if let Some(_) = self.target_gain_db {
3565 return 1;
3566 }
3567 0
3568 }
3569 }
3570
3571 impl fidl::encoding::ValueTypeMarker for RampedGain {
3572 type Borrowed<'a> = &'a Self;
3573 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3574 value
3575 }
3576 }
3577
3578 unsafe impl fidl::encoding::TypeMarker for RampedGain {
3579 type Owned = Self;
3580
3581 #[inline(always)]
3582 fn inline_align(_context: fidl::encoding::Context) -> usize {
3583 8
3584 }
3585
3586 #[inline(always)]
3587 fn inline_size(_context: fidl::encoding::Context) -> usize {
3588 16
3589 }
3590 }
3591
3592 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RampedGain, D>
3593 for &RampedGain
3594 {
3595 unsafe fn encode(
3596 self,
3597 encoder: &mut fidl::encoding::Encoder<'_, D>,
3598 offset: usize,
3599 mut depth: fidl::encoding::Depth,
3600 ) -> fidl::Result<()> {
3601 encoder.debug_check_bounds::<RampedGain>(offset);
3602 let max_ordinal: u64 = self.max_ordinal_present();
3604 encoder.write_num(max_ordinal, offset);
3605 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3606 if max_ordinal == 0 {
3608 return Ok(());
3609 }
3610 depth.increment()?;
3611 let envelope_size = 8;
3612 let bytes_len = max_ordinal as usize * envelope_size;
3613 #[allow(unused_variables)]
3614 let offset = encoder.out_of_line_offset(bytes_len);
3615 let mut _prev_end_offset: usize = 0;
3616 if 1 > max_ordinal {
3617 return Ok(());
3618 }
3619
3620 let cur_offset: usize = (1 - 1) * envelope_size;
3623
3624 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3626
3627 fidl::encoding::encode_in_envelope_optional::<f32, D>(
3632 self.target_gain_db.as_ref().map(<f32 as fidl::encoding::ValueTypeMarker>::borrow),
3633 encoder,
3634 offset + cur_offset,
3635 depth,
3636 )?;
3637
3638 _prev_end_offset = cur_offset + envelope_size;
3639 if 2 > max_ordinal {
3640 return Ok(());
3641 }
3642
3643 let cur_offset: usize = (2 - 1) * envelope_size;
3646
3647 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3649
3650 fidl::encoding::encode_in_envelope_optional::<i64, D>(
3655 self.duration.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
3656 encoder,
3657 offset + cur_offset,
3658 depth,
3659 )?;
3660
3661 _prev_end_offset = cur_offset + envelope_size;
3662 if 3 > max_ordinal {
3663 return Ok(());
3664 }
3665
3666 let cur_offset: usize = (3 - 1) * envelope_size;
3669
3670 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3672
3673 fidl::encoding::encode_in_envelope_optional::<RampFunction, D>(
3678 self.function
3679 .as_ref()
3680 .map(<RampFunction as fidl::encoding::ValueTypeMarker>::borrow),
3681 encoder,
3682 offset + cur_offset,
3683 depth,
3684 )?;
3685
3686 _prev_end_offset = cur_offset + envelope_size;
3687
3688 Ok(())
3689 }
3690 }
3691
3692 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RampedGain {
3693 #[inline(always)]
3694 fn new_empty() -> Self {
3695 Self::default()
3696 }
3697
3698 unsafe fn decode(
3699 &mut self,
3700 decoder: &mut fidl::encoding::Decoder<'_, D>,
3701 offset: usize,
3702 mut depth: fidl::encoding::Depth,
3703 ) -> fidl::Result<()> {
3704 decoder.debug_check_bounds::<Self>(offset);
3705 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3706 None => return Err(fidl::Error::NotNullable),
3707 Some(len) => len,
3708 };
3709 if len == 0 {
3711 return Ok(());
3712 };
3713 depth.increment()?;
3714 let envelope_size = 8;
3715 let bytes_len = len * envelope_size;
3716 let offset = decoder.out_of_line_offset(bytes_len)?;
3717 let mut _next_ordinal_to_read = 0;
3719 let mut next_offset = offset;
3720 let end_offset = offset + bytes_len;
3721 _next_ordinal_to_read += 1;
3722 if next_offset >= end_offset {
3723 return Ok(());
3724 }
3725
3726 while _next_ordinal_to_read < 1 {
3728 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3729 _next_ordinal_to_read += 1;
3730 next_offset += envelope_size;
3731 }
3732
3733 let next_out_of_line = decoder.next_out_of_line();
3734 let handles_before = decoder.remaining_handles();
3735 if let Some((inlined, num_bytes, num_handles)) =
3736 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3737 {
3738 let member_inline_size =
3739 <f32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3740 if inlined != (member_inline_size <= 4) {
3741 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3742 }
3743 let inner_offset;
3744 let mut inner_depth = depth.clone();
3745 if inlined {
3746 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3747 inner_offset = next_offset;
3748 } else {
3749 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3750 inner_depth.increment()?;
3751 }
3752 let val_ref = self.target_gain_db.get_or_insert_with(|| fidl::new_empty!(f32, D));
3753 fidl::decode!(f32, D, val_ref, decoder, inner_offset, inner_depth)?;
3754 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3755 {
3756 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3757 }
3758 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3759 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3760 }
3761 }
3762
3763 next_offset += envelope_size;
3764 _next_ordinal_to_read += 1;
3765 if next_offset >= end_offset {
3766 return Ok(());
3767 }
3768
3769 while _next_ordinal_to_read < 2 {
3771 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3772 _next_ordinal_to_read += 1;
3773 next_offset += envelope_size;
3774 }
3775
3776 let next_out_of_line = decoder.next_out_of_line();
3777 let handles_before = decoder.remaining_handles();
3778 if let Some((inlined, num_bytes, num_handles)) =
3779 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3780 {
3781 let member_inline_size =
3782 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3783 if inlined != (member_inline_size <= 4) {
3784 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3785 }
3786 let inner_offset;
3787 let mut inner_depth = depth.clone();
3788 if inlined {
3789 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3790 inner_offset = next_offset;
3791 } else {
3792 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3793 inner_depth.increment()?;
3794 }
3795 let val_ref = self.duration.get_or_insert_with(|| fidl::new_empty!(i64, D));
3796 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
3797 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3798 {
3799 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3800 }
3801 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3802 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3803 }
3804 }
3805
3806 next_offset += envelope_size;
3807 _next_ordinal_to_read += 1;
3808 if next_offset >= end_offset {
3809 return Ok(());
3810 }
3811
3812 while _next_ordinal_to_read < 3 {
3814 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3815 _next_ordinal_to_read += 1;
3816 next_offset += envelope_size;
3817 }
3818
3819 let next_out_of_line = decoder.next_out_of_line();
3820 let handles_before = decoder.remaining_handles();
3821 if let Some((inlined, num_bytes, num_handles)) =
3822 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3823 {
3824 let member_inline_size =
3825 <RampFunction as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3826 if inlined != (member_inline_size <= 4) {
3827 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3828 }
3829 let inner_offset;
3830 let mut inner_depth = depth.clone();
3831 if inlined {
3832 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3833 inner_offset = next_offset;
3834 } else {
3835 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3836 inner_depth.increment()?;
3837 }
3838 let val_ref =
3839 self.function.get_or_insert_with(|| fidl::new_empty!(RampFunction, D));
3840 fidl::decode!(RampFunction, D, val_ref, decoder, inner_offset, inner_depth)?;
3841 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3842 {
3843 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3844 }
3845 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3846 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3847 }
3848 }
3849
3850 next_offset += envelope_size;
3851
3852 while next_offset < end_offset {
3854 _next_ordinal_to_read += 1;
3855 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3856 next_offset += envelope_size;
3857 }
3858
3859 Ok(())
3860 }
3861 }
3862
3863 impl StreamSinkOnWillCloseRequest {
3864 #[inline(always)]
3865 fn max_ordinal_present(&self) -> u64 {
3866 if let Some(_) = self.reason {
3867 return 1;
3868 }
3869 0
3870 }
3871 }
3872
3873 impl fidl::encoding::ValueTypeMarker for StreamSinkOnWillCloseRequest {
3874 type Borrowed<'a> = &'a Self;
3875 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3876 value
3877 }
3878 }
3879
3880 unsafe impl fidl::encoding::TypeMarker for StreamSinkOnWillCloseRequest {
3881 type Owned = Self;
3882
3883 #[inline(always)]
3884 fn inline_align(_context: fidl::encoding::Context) -> usize {
3885 8
3886 }
3887
3888 #[inline(always)]
3889 fn inline_size(_context: fidl::encoding::Context) -> usize {
3890 16
3891 }
3892 }
3893
3894 unsafe impl<D: fidl::encoding::ResourceDialect>
3895 fidl::encoding::Encode<StreamSinkOnWillCloseRequest, D> for &StreamSinkOnWillCloseRequest
3896 {
3897 unsafe fn encode(
3898 self,
3899 encoder: &mut fidl::encoding::Encoder<'_, D>,
3900 offset: usize,
3901 mut depth: fidl::encoding::Depth,
3902 ) -> fidl::Result<()> {
3903 encoder.debug_check_bounds::<StreamSinkOnWillCloseRequest>(offset);
3904 let max_ordinal: u64 = self.max_ordinal_present();
3906 encoder.write_num(max_ordinal, offset);
3907 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3908 if max_ordinal == 0 {
3910 return Ok(());
3911 }
3912 depth.increment()?;
3913 let envelope_size = 8;
3914 let bytes_len = max_ordinal as usize * envelope_size;
3915 #[allow(unused_variables)]
3916 let offset = encoder.out_of_line_offset(bytes_len);
3917 let mut _prev_end_offset: usize = 0;
3918 if 1 > max_ordinal {
3919 return Ok(());
3920 }
3921
3922 let cur_offset: usize = (1 - 1) * envelope_size;
3925
3926 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3928
3929 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_media2::ConsumerClosedReason, D>(
3934 self.reason.as_ref().map(<fidl_fuchsia_media2::ConsumerClosedReason as fidl::encoding::ValueTypeMarker>::borrow),
3935 encoder, offset + cur_offset, depth
3936 )?;
3937
3938 _prev_end_offset = cur_offset + envelope_size;
3939
3940 Ok(())
3941 }
3942 }
3943
3944 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3945 for StreamSinkOnWillCloseRequest
3946 {
3947 #[inline(always)]
3948 fn new_empty() -> Self {
3949 Self::default()
3950 }
3951
3952 unsafe fn decode(
3953 &mut self,
3954 decoder: &mut fidl::encoding::Decoder<'_, D>,
3955 offset: usize,
3956 mut depth: fidl::encoding::Depth,
3957 ) -> fidl::Result<()> {
3958 decoder.debug_check_bounds::<Self>(offset);
3959 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3960 None => return Err(fidl::Error::NotNullable),
3961 Some(len) => len,
3962 };
3963 if len == 0 {
3965 return Ok(());
3966 };
3967 depth.increment()?;
3968 let envelope_size = 8;
3969 let bytes_len = len * envelope_size;
3970 let offset = decoder.out_of_line_offset(bytes_len)?;
3971 let mut _next_ordinal_to_read = 0;
3973 let mut next_offset = offset;
3974 let end_offset = offset + bytes_len;
3975 _next_ordinal_to_read += 1;
3976 if next_offset >= end_offset {
3977 return Ok(());
3978 }
3979
3980 while _next_ordinal_to_read < 1 {
3982 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3983 _next_ordinal_to_read += 1;
3984 next_offset += envelope_size;
3985 }
3986
3987 let next_out_of_line = decoder.next_out_of_line();
3988 let handles_before = decoder.remaining_handles();
3989 if let Some((inlined, num_bytes, num_handles)) =
3990 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3991 {
3992 let member_inline_size = <fidl_fuchsia_media2::ConsumerClosedReason as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3993 if inlined != (member_inline_size <= 4) {
3994 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3995 }
3996 let inner_offset;
3997 let mut inner_depth = depth.clone();
3998 if inlined {
3999 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4000 inner_offset = next_offset;
4001 } else {
4002 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4003 inner_depth.increment()?;
4004 }
4005 let val_ref = self.reason.get_or_insert_with(|| {
4006 fidl::new_empty!(fidl_fuchsia_media2::ConsumerClosedReason, D)
4007 });
4008 fidl::decode!(
4009 fidl_fuchsia_media2::ConsumerClosedReason,
4010 D,
4011 val_ref,
4012 decoder,
4013 inner_offset,
4014 inner_depth
4015 )?;
4016 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4017 {
4018 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4019 }
4020 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4021 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4022 }
4023 }
4024
4025 next_offset += envelope_size;
4026
4027 while next_offset < end_offset {
4029 _next_ordinal_to_read += 1;
4030 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4031 next_offset += envelope_size;
4032 }
4033
4034 Ok(())
4035 }
4036 }
4037
4038 impl StreamSinkStartSegmentRequest {
4039 #[inline(always)]
4040 fn max_ordinal_present(&self) -> u64 {
4041 if let Some(_) = self.segment_id {
4042 return 1;
4043 }
4044 0
4045 }
4046 }
4047
4048 impl fidl::encoding::ValueTypeMarker for StreamSinkStartSegmentRequest {
4049 type Borrowed<'a> = &'a Self;
4050 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4051 value
4052 }
4053 }
4054
4055 unsafe impl fidl::encoding::TypeMarker for StreamSinkStartSegmentRequest {
4056 type Owned = Self;
4057
4058 #[inline(always)]
4059 fn inline_align(_context: fidl::encoding::Context) -> usize {
4060 8
4061 }
4062
4063 #[inline(always)]
4064 fn inline_size(_context: fidl::encoding::Context) -> usize {
4065 16
4066 }
4067 }
4068
4069 unsafe impl<D: fidl::encoding::ResourceDialect>
4070 fidl::encoding::Encode<StreamSinkStartSegmentRequest, D>
4071 for &StreamSinkStartSegmentRequest
4072 {
4073 unsafe fn encode(
4074 self,
4075 encoder: &mut fidl::encoding::Encoder<'_, D>,
4076 offset: usize,
4077 mut depth: fidl::encoding::Depth,
4078 ) -> fidl::Result<()> {
4079 encoder.debug_check_bounds::<StreamSinkStartSegmentRequest>(offset);
4080 let max_ordinal: u64 = self.max_ordinal_present();
4082 encoder.write_num(max_ordinal, offset);
4083 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4084 if max_ordinal == 0 {
4086 return Ok(());
4087 }
4088 depth.increment()?;
4089 let envelope_size = 8;
4090 let bytes_len = max_ordinal as usize * envelope_size;
4091 #[allow(unused_variables)]
4092 let offset = encoder.out_of_line_offset(bytes_len);
4093 let mut _prev_end_offset: usize = 0;
4094 if 1 > max_ordinal {
4095 return Ok(());
4096 }
4097
4098 let cur_offset: usize = (1 - 1) * envelope_size;
4101
4102 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4104
4105 fidl::encoding::encode_in_envelope_optional::<i64, D>(
4110 self.segment_id.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
4111 encoder,
4112 offset + cur_offset,
4113 depth,
4114 )?;
4115
4116 _prev_end_offset = cur_offset + envelope_size;
4117
4118 Ok(())
4119 }
4120 }
4121
4122 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4123 for StreamSinkStartSegmentRequest
4124 {
4125 #[inline(always)]
4126 fn new_empty() -> Self {
4127 Self::default()
4128 }
4129
4130 unsafe fn decode(
4131 &mut self,
4132 decoder: &mut fidl::encoding::Decoder<'_, D>,
4133 offset: usize,
4134 mut depth: fidl::encoding::Depth,
4135 ) -> fidl::Result<()> {
4136 decoder.debug_check_bounds::<Self>(offset);
4137 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4138 None => return Err(fidl::Error::NotNullable),
4139 Some(len) => len,
4140 };
4141 if len == 0 {
4143 return Ok(());
4144 };
4145 depth.increment()?;
4146 let envelope_size = 8;
4147 let bytes_len = len * envelope_size;
4148 let offset = decoder.out_of_line_offset(bytes_len)?;
4149 let mut _next_ordinal_to_read = 0;
4151 let mut next_offset = offset;
4152 let end_offset = offset + bytes_len;
4153 _next_ordinal_to_read += 1;
4154 if next_offset >= end_offset {
4155 return Ok(());
4156 }
4157
4158 while _next_ordinal_to_read < 1 {
4160 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4161 _next_ordinal_to_read += 1;
4162 next_offset += envelope_size;
4163 }
4164
4165 let next_out_of_line = decoder.next_out_of_line();
4166 let handles_before = decoder.remaining_handles();
4167 if let Some((inlined, num_bytes, num_handles)) =
4168 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4169 {
4170 let member_inline_size =
4171 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4172 if inlined != (member_inline_size <= 4) {
4173 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4174 }
4175 let inner_offset;
4176 let mut inner_depth = depth.clone();
4177 if inlined {
4178 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4179 inner_offset = next_offset;
4180 } else {
4181 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4182 inner_depth.increment()?;
4183 }
4184 let val_ref = self.segment_id.get_or_insert_with(|| fidl::new_empty!(i64, D));
4185 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
4186 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4187 {
4188 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4189 }
4190 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4191 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4192 }
4193 }
4194
4195 next_offset += envelope_size;
4196
4197 while next_offset < end_offset {
4199 _next_ordinal_to_read += 1;
4200 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4201 next_offset += envelope_size;
4202 }
4203
4204 Ok(())
4205 }
4206 }
4207
4208 impl StreamSinkWillCloseRequest {
4209 #[inline(always)]
4210 fn max_ordinal_present(&self) -> u64 {
4211 if let Some(_) = self.reason {
4212 return 1;
4213 }
4214 0
4215 }
4216 }
4217
4218 impl fidl::encoding::ValueTypeMarker for StreamSinkWillCloseRequest {
4219 type Borrowed<'a> = &'a Self;
4220 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4221 value
4222 }
4223 }
4224
4225 unsafe impl fidl::encoding::TypeMarker for StreamSinkWillCloseRequest {
4226 type Owned = Self;
4227
4228 #[inline(always)]
4229 fn inline_align(_context: fidl::encoding::Context) -> usize {
4230 8
4231 }
4232
4233 #[inline(always)]
4234 fn inline_size(_context: fidl::encoding::Context) -> usize {
4235 16
4236 }
4237 }
4238
4239 unsafe impl<D: fidl::encoding::ResourceDialect>
4240 fidl::encoding::Encode<StreamSinkWillCloseRequest, D> for &StreamSinkWillCloseRequest
4241 {
4242 unsafe fn encode(
4243 self,
4244 encoder: &mut fidl::encoding::Encoder<'_, D>,
4245 offset: usize,
4246 mut depth: fidl::encoding::Depth,
4247 ) -> fidl::Result<()> {
4248 encoder.debug_check_bounds::<StreamSinkWillCloseRequest>(offset);
4249 let max_ordinal: u64 = self.max_ordinal_present();
4251 encoder.write_num(max_ordinal, offset);
4252 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4253 if max_ordinal == 0 {
4255 return Ok(());
4256 }
4257 depth.increment()?;
4258 let envelope_size = 8;
4259 let bytes_len = max_ordinal as usize * envelope_size;
4260 #[allow(unused_variables)]
4261 let offset = encoder.out_of_line_offset(bytes_len);
4262 let mut _prev_end_offset: usize = 0;
4263 if 1 > max_ordinal {
4264 return Ok(());
4265 }
4266
4267 let cur_offset: usize = (1 - 1) * envelope_size;
4270
4271 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4273
4274 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_media2::ProducerClosedReason, D>(
4279 self.reason.as_ref().map(<fidl_fuchsia_media2::ProducerClosedReason as fidl::encoding::ValueTypeMarker>::borrow),
4280 encoder, offset + cur_offset, depth
4281 )?;
4282
4283 _prev_end_offset = cur_offset + envelope_size;
4284
4285 Ok(())
4286 }
4287 }
4288
4289 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4290 for StreamSinkWillCloseRequest
4291 {
4292 #[inline(always)]
4293 fn new_empty() -> Self {
4294 Self::default()
4295 }
4296
4297 unsafe fn decode(
4298 &mut self,
4299 decoder: &mut fidl::encoding::Decoder<'_, D>,
4300 offset: usize,
4301 mut depth: fidl::encoding::Depth,
4302 ) -> fidl::Result<()> {
4303 decoder.debug_check_bounds::<Self>(offset);
4304 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4305 None => return Err(fidl::Error::NotNullable),
4306 Some(len) => len,
4307 };
4308 if len == 0 {
4310 return Ok(());
4311 };
4312 depth.increment()?;
4313 let envelope_size = 8;
4314 let bytes_len = len * envelope_size;
4315 let offset = decoder.out_of_line_offset(bytes_len)?;
4316 let mut _next_ordinal_to_read = 0;
4318 let mut next_offset = offset;
4319 let end_offset = offset + bytes_len;
4320 _next_ordinal_to_read += 1;
4321 if next_offset >= end_offset {
4322 return Ok(());
4323 }
4324
4325 while _next_ordinal_to_read < 1 {
4327 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4328 _next_ordinal_to_read += 1;
4329 next_offset += envelope_size;
4330 }
4331
4332 let next_out_of_line = decoder.next_out_of_line();
4333 let handles_before = decoder.remaining_handles();
4334 if let Some((inlined, num_bytes, num_handles)) =
4335 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4336 {
4337 let member_inline_size = <fidl_fuchsia_media2::ProducerClosedReason as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4338 if inlined != (member_inline_size <= 4) {
4339 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4340 }
4341 let inner_offset;
4342 let mut inner_depth = depth.clone();
4343 if inlined {
4344 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4345 inner_offset = next_offset;
4346 } else {
4347 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4348 inner_depth.increment()?;
4349 }
4350 let val_ref = self.reason.get_or_insert_with(|| {
4351 fidl::new_empty!(fidl_fuchsia_media2::ProducerClosedReason, D)
4352 });
4353 fidl::decode!(
4354 fidl_fuchsia_media2::ProducerClosedReason,
4355 D,
4356 val_ref,
4357 decoder,
4358 inner_offset,
4359 inner_depth
4360 )?;
4361 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4362 {
4363 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4364 }
4365 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4366 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4367 }
4368 }
4369
4370 next_offset += envelope_size;
4371
4372 while next_offset < end_offset {
4374 _next_ordinal_to_read += 1;
4375 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4376 next_offset += envelope_size;
4377 }
4378
4379 Ok(())
4380 }
4381 }
4382
4383 impl fidl::encoding::ValueTypeMarker for ChannelLayout {
4384 type Borrowed<'a> = &'a Self;
4385 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4386 value
4387 }
4388 }
4389
4390 unsafe impl fidl::encoding::TypeMarker for ChannelLayout {
4391 type Owned = Self;
4392
4393 #[inline(always)]
4394 fn inline_align(_context: fidl::encoding::Context) -> usize {
4395 8
4396 }
4397
4398 #[inline(always)]
4399 fn inline_size(_context: fidl::encoding::Context) -> usize {
4400 16
4401 }
4402 }
4403
4404 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ChannelLayout, D>
4405 for &ChannelLayout
4406 {
4407 #[inline]
4408 unsafe fn encode(
4409 self,
4410 encoder: &mut fidl::encoding::Encoder<'_, D>,
4411 offset: usize,
4412 _depth: fidl::encoding::Depth,
4413 ) -> fidl::Result<()> {
4414 encoder.debug_check_bounds::<ChannelLayout>(offset);
4415 encoder.write_num::<u64>(self.ordinal(), offset);
4416 match self {
4417 ChannelLayout::Config(ref val) => {
4418 fidl::encoding::encode_in_envelope::<ChannelConfig, D>(
4419 <ChannelConfig as fidl::encoding::ValueTypeMarker>::borrow(val),
4420 encoder,
4421 offset + 8,
4422 _depth,
4423 )
4424 }
4425 ChannelLayout::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
4426 }
4427 }
4428 }
4429
4430 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ChannelLayout {
4431 #[inline(always)]
4432 fn new_empty() -> Self {
4433 Self::__SourceBreaking { unknown_ordinal: 0 }
4434 }
4435
4436 #[inline]
4437 unsafe fn decode(
4438 &mut self,
4439 decoder: &mut fidl::encoding::Decoder<'_, D>,
4440 offset: usize,
4441 mut depth: fidl::encoding::Depth,
4442 ) -> fidl::Result<()> {
4443 decoder.debug_check_bounds::<Self>(offset);
4444 #[allow(unused_variables)]
4445 let next_out_of_line = decoder.next_out_of_line();
4446 let handles_before = decoder.remaining_handles();
4447 let (ordinal, inlined, num_bytes, num_handles) =
4448 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
4449
4450 let member_inline_size = match ordinal {
4451 1 => <ChannelConfig as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4452 0 => return Err(fidl::Error::UnknownUnionTag),
4453 _ => num_bytes as usize,
4454 };
4455
4456 if inlined != (member_inline_size <= 4) {
4457 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4458 }
4459 let _inner_offset;
4460 if inlined {
4461 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
4462 _inner_offset = offset + 8;
4463 } else {
4464 depth.increment()?;
4465 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4466 }
4467 match ordinal {
4468 1 => {
4469 #[allow(irrefutable_let_patterns)]
4470 if let ChannelLayout::Config(_) = self {
4471 } else {
4473 *self = ChannelLayout::Config(fidl::new_empty!(ChannelConfig, D));
4475 }
4476 #[allow(irrefutable_let_patterns)]
4477 if let ChannelLayout::Config(ref mut val) = self {
4478 fidl::decode!(ChannelConfig, D, val, decoder, _inner_offset, depth)?;
4479 } else {
4480 unreachable!()
4481 }
4482 }
4483 #[allow(deprecated)]
4484 ordinal => {
4485 for _ in 0..num_handles {
4486 decoder.drop_next_handle()?;
4487 }
4488 *self = ChannelLayout::__SourceBreaking { unknown_ordinal: ordinal };
4489 }
4490 }
4491 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
4492 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4493 }
4494 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4495 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4496 }
4497 Ok(())
4498 }
4499 }
4500
4501 impl fidl::encoding::ValueTypeMarker for GainUpdateMethod {
4502 type Borrowed<'a> = &'a Self;
4503 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4504 value
4505 }
4506 }
4507
4508 unsafe impl fidl::encoding::TypeMarker for GainUpdateMethod {
4509 type Owned = Self;
4510
4511 #[inline(always)]
4512 fn inline_align(_context: fidl::encoding::Context) -> usize {
4513 8
4514 }
4515
4516 #[inline(always)]
4517 fn inline_size(_context: fidl::encoding::Context) -> usize {
4518 16
4519 }
4520 }
4521
4522 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<GainUpdateMethod, D>
4523 for &GainUpdateMethod
4524 {
4525 #[inline]
4526 unsafe fn encode(
4527 self,
4528 encoder: &mut fidl::encoding::Encoder<'_, D>,
4529 offset: usize,
4530 _depth: fidl::encoding::Depth,
4531 ) -> fidl::Result<()> {
4532 encoder.debug_check_bounds::<GainUpdateMethod>(offset);
4533 encoder.write_num::<u64>(self.ordinal(), offset);
4534 match self {
4535 GainUpdateMethod::GainDb(ref val) => fidl::encoding::encode_in_envelope::<f32, D>(
4536 <f32 as fidl::encoding::ValueTypeMarker>::borrow(val),
4537 encoder,
4538 offset + 8,
4539 _depth,
4540 ),
4541 GainUpdateMethod::Ramped(ref val) => {
4542 fidl::encoding::encode_in_envelope::<RampedGain, D>(
4543 <RampedGain as fidl::encoding::ValueTypeMarker>::borrow(val),
4544 encoder,
4545 offset + 8,
4546 _depth,
4547 )
4548 }
4549 GainUpdateMethod::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
4550 }
4551 }
4552 }
4553
4554 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for GainUpdateMethod {
4555 #[inline(always)]
4556 fn new_empty() -> Self {
4557 Self::__SourceBreaking { unknown_ordinal: 0 }
4558 }
4559
4560 #[inline]
4561 unsafe fn decode(
4562 &mut self,
4563 decoder: &mut fidl::encoding::Decoder<'_, D>,
4564 offset: usize,
4565 mut depth: fidl::encoding::Depth,
4566 ) -> fidl::Result<()> {
4567 decoder.debug_check_bounds::<Self>(offset);
4568 #[allow(unused_variables)]
4569 let next_out_of_line = decoder.next_out_of_line();
4570 let handles_before = decoder.remaining_handles();
4571 let (ordinal, inlined, num_bytes, num_handles) =
4572 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
4573
4574 let member_inline_size = match ordinal {
4575 1 => <f32 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4576 2 => <RampedGain as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4577 0 => return Err(fidl::Error::UnknownUnionTag),
4578 _ => num_bytes as usize,
4579 };
4580
4581 if inlined != (member_inline_size <= 4) {
4582 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4583 }
4584 let _inner_offset;
4585 if inlined {
4586 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
4587 _inner_offset = offset + 8;
4588 } else {
4589 depth.increment()?;
4590 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4591 }
4592 match ordinal {
4593 1 => {
4594 #[allow(irrefutable_let_patterns)]
4595 if let GainUpdateMethod::GainDb(_) = self {
4596 } else {
4598 *self = GainUpdateMethod::GainDb(fidl::new_empty!(f32, D));
4600 }
4601 #[allow(irrefutable_let_patterns)]
4602 if let GainUpdateMethod::GainDb(ref mut val) = self {
4603 fidl::decode!(f32, D, val, decoder, _inner_offset, depth)?;
4604 } else {
4605 unreachable!()
4606 }
4607 }
4608 2 => {
4609 #[allow(irrefutable_let_patterns)]
4610 if let GainUpdateMethod::Ramped(_) = self {
4611 } else {
4613 *self = GainUpdateMethod::Ramped(fidl::new_empty!(RampedGain, D));
4615 }
4616 #[allow(irrefutable_let_patterns)]
4617 if let GainUpdateMethod::Ramped(ref mut val) = self {
4618 fidl::decode!(RampedGain, D, val, decoder, _inner_offset, depth)?;
4619 } else {
4620 unreachable!()
4621 }
4622 }
4623 #[allow(deprecated)]
4624 ordinal => {
4625 for _ in 0..num_handles {
4626 decoder.drop_next_handle()?;
4627 }
4628 *self = GainUpdateMethod::__SourceBreaking { unknown_ordinal: ordinal };
4629 }
4630 }
4631 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
4632 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4633 }
4634 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4635 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4636 }
4637 Ok(())
4638 }
4639 }
4640
4641 impl fidl::encoding::ValueTypeMarker for RampFunction {
4642 type Borrowed<'a> = &'a Self;
4643 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4644 value
4645 }
4646 }
4647
4648 unsafe impl fidl::encoding::TypeMarker for RampFunction {
4649 type Owned = Self;
4650
4651 #[inline(always)]
4652 fn inline_align(_context: fidl::encoding::Context) -> usize {
4653 8
4654 }
4655
4656 #[inline(always)]
4657 fn inline_size(_context: fidl::encoding::Context) -> usize {
4658 16
4659 }
4660 }
4661
4662 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RampFunction, D>
4663 for &RampFunction
4664 {
4665 #[inline]
4666 unsafe fn encode(
4667 self,
4668 encoder: &mut fidl::encoding::Encoder<'_, D>,
4669 offset: usize,
4670 _depth: fidl::encoding::Depth,
4671 ) -> fidl::Result<()> {
4672 encoder.debug_check_bounds::<RampFunction>(offset);
4673 encoder.write_num::<u64>(self.ordinal(), offset);
4674 match self {
4675 RampFunction::LinearSlope(ref val) => {
4676 fidl::encoding::encode_in_envelope::<RampFunctionLinearSlope, D>(
4677 <RampFunctionLinearSlope as fidl::encoding::ValueTypeMarker>::borrow(val),
4678 encoder,
4679 offset + 8,
4680 _depth,
4681 )
4682 }
4683 RampFunction::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
4684 }
4685 }
4686 }
4687
4688 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RampFunction {
4689 #[inline(always)]
4690 fn new_empty() -> Self {
4691 Self::__SourceBreaking { unknown_ordinal: 0 }
4692 }
4693
4694 #[inline]
4695 unsafe fn decode(
4696 &mut self,
4697 decoder: &mut fidl::encoding::Decoder<'_, D>,
4698 offset: usize,
4699 mut depth: fidl::encoding::Depth,
4700 ) -> fidl::Result<()> {
4701 decoder.debug_check_bounds::<Self>(offset);
4702 #[allow(unused_variables)]
4703 let next_out_of_line = decoder.next_out_of_line();
4704 let handles_before = decoder.remaining_handles();
4705 let (ordinal, inlined, num_bytes, num_handles) =
4706 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
4707
4708 let member_inline_size = match ordinal {
4709 1 => <RampFunctionLinearSlope as fidl::encoding::TypeMarker>::inline_size(
4710 decoder.context,
4711 ),
4712 0 => return Err(fidl::Error::UnknownUnionTag),
4713 _ => num_bytes as usize,
4714 };
4715
4716 if inlined != (member_inline_size <= 4) {
4717 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4718 }
4719 let _inner_offset;
4720 if inlined {
4721 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
4722 _inner_offset = offset + 8;
4723 } else {
4724 depth.increment()?;
4725 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4726 }
4727 match ordinal {
4728 1 => {
4729 #[allow(irrefutable_let_patterns)]
4730 if let RampFunction::LinearSlope(_) = self {
4731 } else {
4733 *self =
4735 RampFunction::LinearSlope(fidl::new_empty!(RampFunctionLinearSlope, D));
4736 }
4737 #[allow(irrefutable_let_patterns)]
4738 if let RampFunction::LinearSlope(ref mut val) = self {
4739 fidl::decode!(
4740 RampFunctionLinearSlope,
4741 D,
4742 val,
4743 decoder,
4744 _inner_offset,
4745 depth
4746 )?;
4747 } else {
4748 unreachable!()
4749 }
4750 }
4751 #[allow(deprecated)]
4752 ordinal => {
4753 for _ in 0..num_handles {
4754 decoder.drop_next_handle()?;
4755 }
4756 *self = RampFunction::__SourceBreaking { unknown_ordinal: ordinal };
4757 }
4758 }
4759 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
4760 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4761 }
4762 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4763 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4764 }
4765 Ok(())
4766 }
4767 }
4768
4769 impl fidl::encoding::ValueTypeMarker for Timestamp {
4770 type Borrowed<'a> = &'a Self;
4771 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4772 value
4773 }
4774 }
4775
4776 unsafe impl fidl::encoding::TypeMarker for Timestamp {
4777 type Owned = Self;
4778
4779 #[inline(always)]
4780 fn inline_align(_context: fidl::encoding::Context) -> usize {
4781 8
4782 }
4783
4784 #[inline(always)]
4785 fn inline_size(_context: fidl::encoding::Context) -> usize {
4786 16
4787 }
4788 }
4789
4790 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Timestamp, D>
4791 for &Timestamp
4792 {
4793 #[inline]
4794 unsafe fn encode(
4795 self,
4796 encoder: &mut fidl::encoding::Encoder<'_, D>,
4797 offset: usize,
4798 _depth: fidl::encoding::Depth,
4799 ) -> fidl::Result<()> {
4800 encoder.debug_check_bounds::<Timestamp>(offset);
4801 encoder.write_num::<u64>(self.ordinal(), offset);
4802 match self {
4803 Timestamp::Specified(ref val) => fidl::encoding::encode_in_envelope::<i64, D>(
4804 <i64 as fidl::encoding::ValueTypeMarker>::borrow(val),
4805 encoder,
4806 offset + 8,
4807 _depth,
4808 ),
4809 Timestamp::UnspecifiedContinuous(ref val) => {
4810 fidl::encoding::encode_in_envelope::<UnspecifiedContinuous, D>(
4811 <UnspecifiedContinuous as fidl::encoding::ValueTypeMarker>::borrow(val),
4812 encoder,
4813 offset + 8,
4814 _depth,
4815 )
4816 }
4817 Timestamp::UnspecifiedBestEffort(ref val) => {
4818 fidl::encoding::encode_in_envelope::<UnspecifiedBestEffort, D>(
4819 <UnspecifiedBestEffort as fidl::encoding::ValueTypeMarker>::borrow(val),
4820 encoder,
4821 offset + 8,
4822 _depth,
4823 )
4824 }
4825 Timestamp::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
4826 }
4827 }
4828 }
4829
4830 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Timestamp {
4831 #[inline(always)]
4832 fn new_empty() -> Self {
4833 Self::__SourceBreaking { unknown_ordinal: 0 }
4834 }
4835
4836 #[inline]
4837 unsafe fn decode(
4838 &mut self,
4839 decoder: &mut fidl::encoding::Decoder<'_, D>,
4840 offset: usize,
4841 mut depth: fidl::encoding::Depth,
4842 ) -> fidl::Result<()> {
4843 decoder.debug_check_bounds::<Self>(offset);
4844 #[allow(unused_variables)]
4845 let next_out_of_line = decoder.next_out_of_line();
4846 let handles_before = decoder.remaining_handles();
4847 let (ordinal, inlined, num_bytes, num_handles) =
4848 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
4849
4850 let member_inline_size = match ordinal {
4851 1 => <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4852 2 => <UnspecifiedContinuous as fidl::encoding::TypeMarker>::inline_size(
4853 decoder.context,
4854 ),
4855 3 => <UnspecifiedBestEffort as fidl::encoding::TypeMarker>::inline_size(
4856 decoder.context,
4857 ),
4858 0 => return Err(fidl::Error::UnknownUnionTag),
4859 _ => num_bytes as usize,
4860 };
4861
4862 if inlined != (member_inline_size <= 4) {
4863 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4864 }
4865 let _inner_offset;
4866 if inlined {
4867 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
4868 _inner_offset = offset + 8;
4869 } else {
4870 depth.increment()?;
4871 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4872 }
4873 match ordinal {
4874 1 => {
4875 #[allow(irrefutable_let_patterns)]
4876 if let Timestamp::Specified(_) = self {
4877 } else {
4879 *self = Timestamp::Specified(fidl::new_empty!(i64, D));
4881 }
4882 #[allow(irrefutable_let_patterns)]
4883 if let Timestamp::Specified(ref mut val) = self {
4884 fidl::decode!(i64, D, val, decoder, _inner_offset, depth)?;
4885 } else {
4886 unreachable!()
4887 }
4888 }
4889 2 => {
4890 #[allow(irrefutable_let_patterns)]
4891 if let Timestamp::UnspecifiedContinuous(_) = self {
4892 } else {
4894 *self = Timestamp::UnspecifiedContinuous(fidl::new_empty!(
4896 UnspecifiedContinuous,
4897 D
4898 ));
4899 }
4900 #[allow(irrefutable_let_patterns)]
4901 if let Timestamp::UnspecifiedContinuous(ref mut val) = self {
4902 fidl::decode!(
4903 UnspecifiedContinuous,
4904 D,
4905 val,
4906 decoder,
4907 _inner_offset,
4908 depth
4909 )?;
4910 } else {
4911 unreachable!()
4912 }
4913 }
4914 3 => {
4915 #[allow(irrefutable_let_patterns)]
4916 if let Timestamp::UnspecifiedBestEffort(_) = self {
4917 } else {
4919 *self = Timestamp::UnspecifiedBestEffort(fidl::new_empty!(
4921 UnspecifiedBestEffort,
4922 D
4923 ));
4924 }
4925 #[allow(irrefutable_let_patterns)]
4926 if let Timestamp::UnspecifiedBestEffort(ref mut val) = self {
4927 fidl::decode!(
4928 UnspecifiedBestEffort,
4929 D,
4930 val,
4931 decoder,
4932 _inner_offset,
4933 depth
4934 )?;
4935 } else {
4936 unreachable!()
4937 }
4938 }
4939 #[allow(deprecated)]
4940 ordinal => {
4941 for _ in 0..num_handles {
4942 decoder.drop_next_handle()?;
4943 }
4944 *self = Timestamp::__SourceBreaking { unknown_ordinal: ordinal };
4945 }
4946 }
4947 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
4948 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4949 }
4950 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4951 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4952 }
4953 Ok(())
4954 }
4955 }
4956}