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 CODEC_FACTORY_CODEC_LIST_SIZE_MAX: u32 = 256;
16
17pub const CODEC_FACTORY_LIFETIME_TRACKING_EVENTPAIR_PER_CREATE_MAX: u32 = 16;
21
22pub const CODEC_FACTORY_MAX_MIME_TYPE_LENGTH: u32 = 256;
24
25#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
26#[repr(u32)]
27pub enum CodecType {
28 Decoder = 0,
29 Encoder = 1,
30}
31
32impl CodecType {
33 #[inline]
34 pub fn from_primitive(prim: u32) -> Option<Self> {
35 match prim {
36 0 => Some(Self::Decoder),
37 1 => Some(Self::Encoder),
38 _ => None,
39 }
40 }
41
42 #[inline]
43 pub const fn into_primitive(self) -> u32 {
44 self as u32
45 }
46}
47
48#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
55#[repr(u32)]
56pub enum SecureMemoryMode {
57 Off = 0,
58 On = 1,
59}
60
61impl SecureMemoryMode {
62 #[inline]
63 pub fn from_primitive(prim: u32) -> Option<Self> {
64 match prim {
65 0 => Some(Self::Off),
66 1 => Some(Self::On),
67 _ => None,
68 }
69 }
70
71 #[inline]
72 pub const fn into_primitive(self) -> u32 {
73 self as u32
74 }
75}
76
77#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
98pub struct CodecDescription {
99 pub codec_type: CodecType,
101 pub mime_type: String,
104 pub can_stream_bytes_input: bool,
108 pub can_find_start: bool,
109 pub can_re_sync: bool,
110 pub will_report_all_detected_errors: bool,
111 pub is_hw: bool,
112 pub split_header_handling: bool,
113}
114
115impl fidl::Persistable for CodecDescription {}
116
117#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
118pub struct CodecFactoryOnCodecListRequest {
119 pub codecs: Vec<CodecDescription>,
120}
121
122impl fidl::Persistable for CodecFactoryOnCodecListRequest {}
123
124#[derive(Clone, Debug, Default, PartialEq)]
125pub struct CodecFactoryGetDetailedCodecDescriptionsResponse {
126 pub codecs: Option<Vec<DetailedCodecDescription>>,
127 #[doc(hidden)]
128 pub __source_breaking: fidl::marker::SourceBreaking,
129}
130
131impl fidl::Persistable for CodecFactoryGetDetailedCodecDescriptionsResponse {}
132
133#[derive(Clone, Debug, Default, PartialEq)]
134pub struct CreateDecoderParams {
135 pub input_details: Option<fidl_fuchsia_media__common::FormatDetails>,
147 pub promise_separate_access_units_on_input: Option<bool>,
160 pub require_can_stream_bytes_input: Option<bool>,
183 pub require_can_find_start: Option<bool>,
194 pub require_can_re_sync: Option<bool>,
205 pub require_report_all_detected_errors: Option<bool>,
238 pub require_hw: Option<bool>,
243 pub permit_lack_of_split_header_handling: Option<bool>,
274 pub secure_output_mode: Option<SecureMemoryMode>,
282 pub secure_input_mode: Option<SecureMemoryMode>,
290 pub require_sw: Option<bool>,
299 #[doc(hidden)]
300 pub __source_breaking: fidl::marker::SourceBreaking,
301}
302
303impl fidl::Persistable for CreateDecoderParams {}
304
305#[derive(Clone, Debug, Default, PartialEq)]
307pub struct CreateEncoderParams {
308 pub input_details: Option<fidl_fuchsia_media__common::FormatDetails>,
315 pub require_hw: Option<bool>,
319 #[doc(hidden)]
320 pub __source_breaking: fidl::marker::SourceBreaking,
321}
322
323impl fidl::Persistable for CreateEncoderParams {}
324
325#[derive(Clone, Debug, Default, PartialEq)]
343pub struct DecoderProfileDescription {
344 pub profile: Option<fidl_fuchsia_media__common::CodecProfile>,
347 pub min_image_size: Option<fidl_fuchsia_math__common::SizeU>,
354 pub max_image_size: Option<fidl_fuchsia_math__common::SizeU>,
367 pub allow_encryption: Option<bool>,
376 pub require_encryption: Option<bool>,
386 pub allow_input_protection: Option<bool>,
391 pub require_input_protection: Option<bool>,
403 pub can_stream_bytes_input: Option<bool>,
444 pub can_find_start: Option<bool>,
455 pub can_re_sync: Option<bool>,
459 pub will_report_all_detected_errors: Option<bool>,
467 pub split_header_handling: Option<bool>,
501 #[doc(hidden)]
502 pub __source_breaking: fidl::marker::SourceBreaking,
503}
504
505impl fidl::Persistable for DecoderProfileDescription {}
506
507#[derive(Clone, Debug, Default, PartialEq)]
517pub struct DetailedCodecDescription {
518 pub codec_type: Option<CodecType>,
520 pub mime_type: Option<String>,
523 pub is_hw: Option<bool>,
525 pub profile_descriptions: Option<ProfileDescriptions>,
528 #[doc(hidden)]
529 pub __source_breaking: fidl::marker::SourceBreaking,
530}
531
532impl fidl::Persistable for DetailedCodecDescription {}
533
534#[derive(Clone, Debug, Default, PartialEq)]
535pub struct EncoderProfileDescription {
536 pub profile: Option<fidl_fuchsia_media__common::CodecProfile>,
537 #[doc(hidden)]
538 pub __source_breaking: fidl::marker::SourceBreaking,
539}
540
541impl fidl::Persistable for EncoderProfileDescription {}
542
543#[derive(Clone, Debug, PartialEq)]
544pub enum ProfileDescriptions {
545 DecoderProfileDescriptions(Vec<DecoderProfileDescription>),
551 EncoderProfileDescriptions(Vec<EncoderProfileDescription>),
552}
553
554impl ProfileDescriptions {
555 #[inline]
556 pub fn ordinal(&self) -> u64 {
557 match *self {
558 Self::DecoderProfileDescriptions(_) => 1,
559 Self::EncoderProfileDescriptions(_) => 2,
560 }
561 }
562}
563
564impl fidl::Persistable for ProfileDescriptions {}
565
566mod internal {
567 use super::*;
568 unsafe impl fidl::encoding::TypeMarker for CodecType {
569 type Owned = Self;
570
571 #[inline(always)]
572 fn inline_align(_context: fidl::encoding::Context) -> usize {
573 std::mem::align_of::<u32>()
574 }
575
576 #[inline(always)]
577 fn inline_size(_context: fidl::encoding::Context) -> usize {
578 std::mem::size_of::<u32>()
579 }
580
581 #[inline(always)]
582 fn encode_is_copy() -> bool {
583 true
584 }
585
586 #[inline(always)]
587 fn decode_is_copy() -> bool {
588 false
589 }
590 }
591
592 impl fidl::encoding::ValueTypeMarker for CodecType {
593 type Borrowed<'a> = Self;
594 #[inline(always)]
595 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
596 *value
597 }
598 }
599
600 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for CodecType {
601 #[inline]
602 unsafe fn encode(
603 self,
604 encoder: &mut fidl::encoding::Encoder<'_, D>,
605 offset: usize,
606 _depth: fidl::encoding::Depth,
607 ) -> fidl::Result<()> {
608 encoder.debug_check_bounds::<Self>(offset);
609 encoder.write_num(self.into_primitive(), offset);
610 Ok(())
611 }
612 }
613
614 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CodecType {
615 #[inline(always)]
616 fn new_empty() -> Self {
617 Self::Decoder
618 }
619
620 #[inline]
621 unsafe fn decode(
622 &mut self,
623 decoder: &mut fidl::encoding::Decoder<'_, D>,
624 offset: usize,
625 _depth: fidl::encoding::Depth,
626 ) -> fidl::Result<()> {
627 decoder.debug_check_bounds::<Self>(offset);
628 let prim = decoder.read_num::<u32>(offset);
629
630 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
631 Ok(())
632 }
633 }
634 unsafe impl fidl::encoding::TypeMarker for SecureMemoryMode {
635 type Owned = Self;
636
637 #[inline(always)]
638 fn inline_align(_context: fidl::encoding::Context) -> usize {
639 std::mem::align_of::<u32>()
640 }
641
642 #[inline(always)]
643 fn inline_size(_context: fidl::encoding::Context) -> usize {
644 std::mem::size_of::<u32>()
645 }
646
647 #[inline(always)]
648 fn encode_is_copy() -> bool {
649 true
650 }
651
652 #[inline(always)]
653 fn decode_is_copy() -> bool {
654 false
655 }
656 }
657
658 impl fidl::encoding::ValueTypeMarker for SecureMemoryMode {
659 type Borrowed<'a> = Self;
660 #[inline(always)]
661 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
662 *value
663 }
664 }
665
666 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
667 for SecureMemoryMode
668 {
669 #[inline]
670 unsafe fn encode(
671 self,
672 encoder: &mut fidl::encoding::Encoder<'_, D>,
673 offset: usize,
674 _depth: fidl::encoding::Depth,
675 ) -> fidl::Result<()> {
676 encoder.debug_check_bounds::<Self>(offset);
677 encoder.write_num(self.into_primitive(), offset);
678 Ok(())
679 }
680 }
681
682 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SecureMemoryMode {
683 #[inline(always)]
684 fn new_empty() -> Self {
685 Self::Off
686 }
687
688 #[inline]
689 unsafe fn decode(
690 &mut self,
691 decoder: &mut fidl::encoding::Decoder<'_, D>,
692 offset: usize,
693 _depth: fidl::encoding::Depth,
694 ) -> fidl::Result<()> {
695 decoder.debug_check_bounds::<Self>(offset);
696 let prim = decoder.read_num::<u32>(offset);
697
698 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
699 Ok(())
700 }
701 }
702
703 impl fidl::encoding::ValueTypeMarker for CodecDescription {
704 type Borrowed<'a> = &'a Self;
705 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
706 value
707 }
708 }
709
710 unsafe impl fidl::encoding::TypeMarker for CodecDescription {
711 type Owned = Self;
712
713 #[inline(always)]
714 fn inline_align(_context: fidl::encoding::Context) -> usize {
715 8
716 }
717
718 #[inline(always)]
719 fn inline_size(_context: fidl::encoding::Context) -> usize {
720 32
721 }
722 }
723
724 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CodecDescription, D>
725 for &CodecDescription
726 {
727 #[inline]
728 unsafe fn encode(
729 self,
730 encoder: &mut fidl::encoding::Encoder<'_, D>,
731 offset: usize,
732 _depth: fidl::encoding::Depth,
733 ) -> fidl::Result<()> {
734 encoder.debug_check_bounds::<CodecDescription>(offset);
735 fidl::encoding::Encode::<CodecDescription, D>::encode(
737 (
738 <CodecType as fidl::encoding::ValueTypeMarker>::borrow(&self.codec_type),
739 <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
740 &self.mime_type,
741 ),
742 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.can_stream_bytes_input),
743 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.can_find_start),
744 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.can_re_sync),
745 <bool as fidl::encoding::ValueTypeMarker>::borrow(
746 &self.will_report_all_detected_errors,
747 ),
748 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.is_hw),
749 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.split_header_handling),
750 ),
751 encoder,
752 offset,
753 _depth,
754 )
755 }
756 }
757 unsafe impl<
758 D: fidl::encoding::ResourceDialect,
759 T0: fidl::encoding::Encode<CodecType, D>,
760 T1: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
761 T2: fidl::encoding::Encode<bool, D>,
762 T3: fidl::encoding::Encode<bool, D>,
763 T4: fidl::encoding::Encode<bool, D>,
764 T5: fidl::encoding::Encode<bool, D>,
765 T6: fidl::encoding::Encode<bool, D>,
766 T7: fidl::encoding::Encode<bool, D>,
767 > fidl::encoding::Encode<CodecDescription, D> for (T0, T1, T2, T3, T4, T5, T6, T7)
768 {
769 #[inline]
770 unsafe fn encode(
771 self,
772 encoder: &mut fidl::encoding::Encoder<'_, D>,
773 offset: usize,
774 depth: fidl::encoding::Depth,
775 ) -> fidl::Result<()> {
776 encoder.debug_check_bounds::<CodecDescription>(offset);
777 unsafe {
780 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
781 (ptr as *mut u64).write_unaligned(0);
782 }
783 unsafe {
784 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
785 (ptr as *mut u64).write_unaligned(0);
786 }
787 self.0.encode(encoder, offset + 0, depth)?;
789 self.1.encode(encoder, offset + 8, depth)?;
790 self.2.encode(encoder, offset + 24, depth)?;
791 self.3.encode(encoder, offset + 25, depth)?;
792 self.4.encode(encoder, offset + 26, depth)?;
793 self.5.encode(encoder, offset + 27, depth)?;
794 self.6.encode(encoder, offset + 28, depth)?;
795 self.7.encode(encoder, offset + 29, depth)?;
796 Ok(())
797 }
798 }
799
800 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CodecDescription {
801 #[inline(always)]
802 fn new_empty() -> Self {
803 Self {
804 codec_type: fidl::new_empty!(CodecType, D),
805 mime_type: fidl::new_empty!(fidl::encoding::BoundedString<256>, D),
806 can_stream_bytes_input: fidl::new_empty!(bool, D),
807 can_find_start: fidl::new_empty!(bool, D),
808 can_re_sync: fidl::new_empty!(bool, D),
809 will_report_all_detected_errors: fidl::new_empty!(bool, D),
810 is_hw: fidl::new_empty!(bool, D),
811 split_header_handling: fidl::new_empty!(bool, D),
812 }
813 }
814
815 #[inline]
816 unsafe fn decode(
817 &mut self,
818 decoder: &mut fidl::encoding::Decoder<'_, D>,
819 offset: usize,
820 _depth: fidl::encoding::Depth,
821 ) -> fidl::Result<()> {
822 decoder.debug_check_bounds::<Self>(offset);
823 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
825 let padval = unsafe { (ptr as *const u64).read_unaligned() };
826 let mask = 0xffffffff00000000u64;
827 let maskedval = padval & mask;
828 if maskedval != 0 {
829 return Err(fidl::Error::NonZeroPadding {
830 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
831 });
832 }
833 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
834 let padval = unsafe { (ptr as *const u64).read_unaligned() };
835 let mask = 0xffff000000000000u64;
836 let maskedval = padval & mask;
837 if maskedval != 0 {
838 return Err(fidl::Error::NonZeroPadding {
839 padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
840 });
841 }
842 fidl::decode!(CodecType, D, &mut self.codec_type, decoder, offset + 0, _depth)?;
843 fidl::decode!(
844 fidl::encoding::BoundedString<256>,
845 D,
846 &mut self.mime_type,
847 decoder,
848 offset + 8,
849 _depth
850 )?;
851 fidl::decode!(bool, D, &mut self.can_stream_bytes_input, decoder, offset + 24, _depth)?;
852 fidl::decode!(bool, D, &mut self.can_find_start, decoder, offset + 25, _depth)?;
853 fidl::decode!(bool, D, &mut self.can_re_sync, decoder, offset + 26, _depth)?;
854 fidl::decode!(
855 bool,
856 D,
857 &mut self.will_report_all_detected_errors,
858 decoder,
859 offset + 27,
860 _depth
861 )?;
862 fidl::decode!(bool, D, &mut self.is_hw, decoder, offset + 28, _depth)?;
863 fidl::decode!(bool, D, &mut self.split_header_handling, decoder, offset + 29, _depth)?;
864 Ok(())
865 }
866 }
867
868 impl fidl::encoding::ValueTypeMarker for CodecFactoryOnCodecListRequest {
869 type Borrowed<'a> = &'a Self;
870 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
871 value
872 }
873 }
874
875 unsafe impl fidl::encoding::TypeMarker for CodecFactoryOnCodecListRequest {
876 type Owned = Self;
877
878 #[inline(always)]
879 fn inline_align(_context: fidl::encoding::Context) -> usize {
880 8
881 }
882
883 #[inline(always)]
884 fn inline_size(_context: fidl::encoding::Context) -> usize {
885 16
886 }
887 }
888
889 unsafe impl<D: fidl::encoding::ResourceDialect>
890 fidl::encoding::Encode<CodecFactoryOnCodecListRequest, D>
891 for &CodecFactoryOnCodecListRequest
892 {
893 #[inline]
894 unsafe fn encode(
895 self,
896 encoder: &mut fidl::encoding::Encoder<'_, D>,
897 offset: usize,
898 _depth: fidl::encoding::Depth,
899 ) -> fidl::Result<()> {
900 encoder.debug_check_bounds::<CodecFactoryOnCodecListRequest>(offset);
901 fidl::encoding::Encode::<CodecFactoryOnCodecListRequest, D>::encode(
903 (
904 <fidl::encoding::Vector<CodecDescription, 256> as fidl::encoding::ValueTypeMarker>::borrow(&self.codecs),
905 ),
906 encoder, offset, _depth
907 )
908 }
909 }
910 unsafe impl<
911 D: fidl::encoding::ResourceDialect,
912 T0: fidl::encoding::Encode<fidl::encoding::Vector<CodecDescription, 256>, D>,
913 > fidl::encoding::Encode<CodecFactoryOnCodecListRequest, D> for (T0,)
914 {
915 #[inline]
916 unsafe fn encode(
917 self,
918 encoder: &mut fidl::encoding::Encoder<'_, D>,
919 offset: usize,
920 depth: fidl::encoding::Depth,
921 ) -> fidl::Result<()> {
922 encoder.debug_check_bounds::<CodecFactoryOnCodecListRequest>(offset);
923 self.0.encode(encoder, offset + 0, depth)?;
927 Ok(())
928 }
929 }
930
931 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
932 for CodecFactoryOnCodecListRequest
933 {
934 #[inline(always)]
935 fn new_empty() -> Self {
936 Self { codecs: fidl::new_empty!(fidl::encoding::Vector<CodecDescription, 256>, D) }
937 }
938
939 #[inline]
940 unsafe fn decode(
941 &mut self,
942 decoder: &mut fidl::encoding::Decoder<'_, D>,
943 offset: usize,
944 _depth: fidl::encoding::Depth,
945 ) -> fidl::Result<()> {
946 decoder.debug_check_bounds::<Self>(offset);
947 fidl::decode!(fidl::encoding::Vector<CodecDescription, 256>, D, &mut self.codecs, decoder, offset + 0, _depth)?;
949 Ok(())
950 }
951 }
952
953 impl CodecFactoryGetDetailedCodecDescriptionsResponse {
954 #[inline(always)]
955 fn max_ordinal_present(&self) -> u64 {
956 if let Some(_) = self.codecs {
957 return 1;
958 }
959 0
960 }
961 }
962
963 impl fidl::encoding::ValueTypeMarker for CodecFactoryGetDetailedCodecDescriptionsResponse {
964 type Borrowed<'a> = &'a Self;
965 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
966 value
967 }
968 }
969
970 unsafe impl fidl::encoding::TypeMarker for CodecFactoryGetDetailedCodecDescriptionsResponse {
971 type Owned = Self;
972
973 #[inline(always)]
974 fn inline_align(_context: fidl::encoding::Context) -> usize {
975 8
976 }
977
978 #[inline(always)]
979 fn inline_size(_context: fidl::encoding::Context) -> usize {
980 16
981 }
982 }
983
984 unsafe impl<D: fidl::encoding::ResourceDialect>
985 fidl::encoding::Encode<CodecFactoryGetDetailedCodecDescriptionsResponse, D>
986 for &CodecFactoryGetDetailedCodecDescriptionsResponse
987 {
988 unsafe fn encode(
989 self,
990 encoder: &mut fidl::encoding::Encoder<'_, D>,
991 offset: usize,
992 mut depth: fidl::encoding::Depth,
993 ) -> fidl::Result<()> {
994 encoder.debug_check_bounds::<CodecFactoryGetDetailedCodecDescriptionsResponse>(offset);
995 let max_ordinal: u64 = self.max_ordinal_present();
997 encoder.write_num(max_ordinal, offset);
998 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
999 if max_ordinal == 0 {
1001 return Ok(());
1002 }
1003 depth.increment()?;
1004 let envelope_size = 8;
1005 let bytes_len = max_ordinal as usize * envelope_size;
1006 #[allow(unused_variables)]
1007 let offset = encoder.out_of_line_offset(bytes_len);
1008 let mut _prev_end_offset: usize = 0;
1009 if 1 > max_ordinal {
1010 return Ok(());
1011 }
1012
1013 let cur_offset: usize = (1 - 1) * envelope_size;
1016
1017 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1019
1020 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<DetailedCodecDescription, 256>, D>(
1025 self.codecs.as_ref().map(<fidl::encoding::Vector<DetailedCodecDescription, 256> as fidl::encoding::ValueTypeMarker>::borrow),
1026 encoder, offset + cur_offset, depth
1027 )?;
1028
1029 _prev_end_offset = cur_offset + envelope_size;
1030
1031 Ok(())
1032 }
1033 }
1034
1035 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1036 for CodecFactoryGetDetailedCodecDescriptionsResponse
1037 {
1038 #[inline(always)]
1039 fn new_empty() -> Self {
1040 Self::default()
1041 }
1042
1043 unsafe fn decode(
1044 &mut self,
1045 decoder: &mut fidl::encoding::Decoder<'_, D>,
1046 offset: usize,
1047 mut depth: fidl::encoding::Depth,
1048 ) -> fidl::Result<()> {
1049 decoder.debug_check_bounds::<Self>(offset);
1050 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1051 None => return Err(fidl::Error::NotNullable),
1052 Some(len) => len,
1053 };
1054 if len == 0 {
1056 return Ok(());
1057 };
1058 depth.increment()?;
1059 let envelope_size = 8;
1060 let bytes_len = len * envelope_size;
1061 let offset = decoder.out_of_line_offset(bytes_len)?;
1062 let mut _next_ordinal_to_read = 0;
1064 let mut next_offset = offset;
1065 let end_offset = offset + bytes_len;
1066 _next_ordinal_to_read += 1;
1067 if next_offset >= end_offset {
1068 return Ok(());
1069 }
1070
1071 while _next_ordinal_to_read < 1 {
1073 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1074 _next_ordinal_to_read += 1;
1075 next_offset += envelope_size;
1076 }
1077
1078 let next_out_of_line = decoder.next_out_of_line();
1079 let handles_before = decoder.remaining_handles();
1080 if let Some((inlined, num_bytes, num_handles)) =
1081 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1082 {
1083 let member_inline_size = <fidl::encoding::Vector<DetailedCodecDescription, 256> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1084 if inlined != (member_inline_size <= 4) {
1085 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1086 }
1087 let inner_offset;
1088 let mut inner_depth = depth.clone();
1089 if inlined {
1090 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1091 inner_offset = next_offset;
1092 } else {
1093 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1094 inner_depth.increment()?;
1095 }
1096 let val_ref = self.codecs.get_or_insert_with(
1097 || fidl::new_empty!(fidl::encoding::Vector<DetailedCodecDescription, 256>, D),
1098 );
1099 fidl::decode!(fidl::encoding::Vector<DetailedCodecDescription, 256>, D, val_ref, decoder, inner_offset, inner_depth)?;
1100 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1101 {
1102 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1103 }
1104 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1105 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1106 }
1107 }
1108
1109 next_offset += envelope_size;
1110
1111 while next_offset < end_offset {
1113 _next_ordinal_to_read += 1;
1114 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1115 next_offset += envelope_size;
1116 }
1117
1118 Ok(())
1119 }
1120 }
1121
1122 impl CreateDecoderParams {
1123 #[inline(always)]
1124 fn max_ordinal_present(&self) -> u64 {
1125 if let Some(_) = self.require_sw {
1126 return 11;
1127 }
1128 if let Some(_) = self.secure_input_mode {
1129 return 10;
1130 }
1131 if let Some(_) = self.secure_output_mode {
1132 return 9;
1133 }
1134 if let Some(_) = self.permit_lack_of_split_header_handling {
1135 return 8;
1136 }
1137 if let Some(_) = self.require_hw {
1138 return 7;
1139 }
1140 if let Some(_) = self.require_report_all_detected_errors {
1141 return 6;
1142 }
1143 if let Some(_) = self.require_can_re_sync {
1144 return 5;
1145 }
1146 if let Some(_) = self.require_can_find_start {
1147 return 4;
1148 }
1149 if let Some(_) = self.require_can_stream_bytes_input {
1150 return 3;
1151 }
1152 if let Some(_) = self.promise_separate_access_units_on_input {
1153 return 2;
1154 }
1155 if let Some(_) = self.input_details {
1156 return 1;
1157 }
1158 0
1159 }
1160 }
1161
1162 impl fidl::encoding::ValueTypeMarker for CreateDecoderParams {
1163 type Borrowed<'a> = &'a Self;
1164 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1165 value
1166 }
1167 }
1168
1169 unsafe impl fidl::encoding::TypeMarker for CreateDecoderParams {
1170 type Owned = Self;
1171
1172 #[inline(always)]
1173 fn inline_align(_context: fidl::encoding::Context) -> usize {
1174 8
1175 }
1176
1177 #[inline(always)]
1178 fn inline_size(_context: fidl::encoding::Context) -> usize {
1179 16
1180 }
1181 }
1182
1183 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CreateDecoderParams, D>
1184 for &CreateDecoderParams
1185 {
1186 unsafe fn encode(
1187 self,
1188 encoder: &mut fidl::encoding::Encoder<'_, D>,
1189 offset: usize,
1190 mut depth: fidl::encoding::Depth,
1191 ) -> fidl::Result<()> {
1192 encoder.debug_check_bounds::<CreateDecoderParams>(offset);
1193 let max_ordinal: u64 = self.max_ordinal_present();
1195 encoder.write_num(max_ordinal, offset);
1196 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1197 if max_ordinal == 0 {
1199 return Ok(());
1200 }
1201 depth.increment()?;
1202 let envelope_size = 8;
1203 let bytes_len = max_ordinal as usize * envelope_size;
1204 #[allow(unused_variables)]
1205 let offset = encoder.out_of_line_offset(bytes_len);
1206 let mut _prev_end_offset: usize = 0;
1207 if 1 > max_ordinal {
1208 return Ok(());
1209 }
1210
1211 let cur_offset: usize = (1 - 1) * envelope_size;
1214
1215 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1217
1218 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_media__common::FormatDetails, D>(
1223 self.input_details.as_ref().map(<fidl_fuchsia_media__common::FormatDetails as fidl::encoding::ValueTypeMarker>::borrow),
1224 encoder, offset + cur_offset, depth
1225 )?;
1226
1227 _prev_end_offset = cur_offset + envelope_size;
1228 if 2 > max_ordinal {
1229 return Ok(());
1230 }
1231
1232 let cur_offset: usize = (2 - 1) * envelope_size;
1235
1236 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1238
1239 fidl::encoding::encode_in_envelope_optional::<bool, D>(
1244 self.promise_separate_access_units_on_input
1245 .as_ref()
1246 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1247 encoder,
1248 offset + cur_offset,
1249 depth,
1250 )?;
1251
1252 _prev_end_offset = cur_offset + envelope_size;
1253 if 3 > max_ordinal {
1254 return Ok(());
1255 }
1256
1257 let cur_offset: usize = (3 - 1) * envelope_size;
1260
1261 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1263
1264 fidl::encoding::encode_in_envelope_optional::<bool, D>(
1269 self.require_can_stream_bytes_input
1270 .as_ref()
1271 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1272 encoder,
1273 offset + cur_offset,
1274 depth,
1275 )?;
1276
1277 _prev_end_offset = cur_offset + envelope_size;
1278 if 4 > max_ordinal {
1279 return Ok(());
1280 }
1281
1282 let cur_offset: usize = (4 - 1) * envelope_size;
1285
1286 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1288
1289 fidl::encoding::encode_in_envelope_optional::<bool, D>(
1294 self.require_can_find_start
1295 .as_ref()
1296 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1297 encoder,
1298 offset + cur_offset,
1299 depth,
1300 )?;
1301
1302 _prev_end_offset = cur_offset + envelope_size;
1303 if 5 > max_ordinal {
1304 return Ok(());
1305 }
1306
1307 let cur_offset: usize = (5 - 1) * envelope_size;
1310
1311 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1313
1314 fidl::encoding::encode_in_envelope_optional::<bool, D>(
1319 self.require_can_re_sync
1320 .as_ref()
1321 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1322 encoder,
1323 offset + cur_offset,
1324 depth,
1325 )?;
1326
1327 _prev_end_offset = cur_offset + envelope_size;
1328 if 6 > max_ordinal {
1329 return Ok(());
1330 }
1331
1332 let cur_offset: usize = (6 - 1) * envelope_size;
1335
1336 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1338
1339 fidl::encoding::encode_in_envelope_optional::<bool, D>(
1344 self.require_report_all_detected_errors
1345 .as_ref()
1346 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1347 encoder,
1348 offset + cur_offset,
1349 depth,
1350 )?;
1351
1352 _prev_end_offset = cur_offset + envelope_size;
1353 if 7 > max_ordinal {
1354 return Ok(());
1355 }
1356
1357 let cur_offset: usize = (7 - 1) * envelope_size;
1360
1361 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1363
1364 fidl::encoding::encode_in_envelope_optional::<bool, D>(
1369 self.require_hw.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1370 encoder,
1371 offset + cur_offset,
1372 depth,
1373 )?;
1374
1375 _prev_end_offset = cur_offset + envelope_size;
1376 if 8 > max_ordinal {
1377 return Ok(());
1378 }
1379
1380 let cur_offset: usize = (8 - 1) * envelope_size;
1383
1384 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1386
1387 fidl::encoding::encode_in_envelope_optional::<bool, D>(
1392 self.permit_lack_of_split_header_handling
1393 .as_ref()
1394 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1395 encoder,
1396 offset + cur_offset,
1397 depth,
1398 )?;
1399
1400 _prev_end_offset = cur_offset + envelope_size;
1401 if 9 > max_ordinal {
1402 return Ok(());
1403 }
1404
1405 let cur_offset: usize = (9 - 1) * envelope_size;
1408
1409 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1411
1412 fidl::encoding::encode_in_envelope_optional::<SecureMemoryMode, D>(
1417 self.secure_output_mode
1418 .as_ref()
1419 .map(<SecureMemoryMode as fidl::encoding::ValueTypeMarker>::borrow),
1420 encoder,
1421 offset + cur_offset,
1422 depth,
1423 )?;
1424
1425 _prev_end_offset = cur_offset + envelope_size;
1426 if 10 > max_ordinal {
1427 return Ok(());
1428 }
1429
1430 let cur_offset: usize = (10 - 1) * envelope_size;
1433
1434 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1436
1437 fidl::encoding::encode_in_envelope_optional::<SecureMemoryMode, D>(
1442 self.secure_input_mode
1443 .as_ref()
1444 .map(<SecureMemoryMode as fidl::encoding::ValueTypeMarker>::borrow),
1445 encoder,
1446 offset + cur_offset,
1447 depth,
1448 )?;
1449
1450 _prev_end_offset = cur_offset + envelope_size;
1451 if 11 > max_ordinal {
1452 return Ok(());
1453 }
1454
1455 let cur_offset: usize = (11 - 1) * envelope_size;
1458
1459 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1461
1462 fidl::encoding::encode_in_envelope_optional::<bool, D>(
1467 self.require_sw.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1468 encoder,
1469 offset + cur_offset,
1470 depth,
1471 )?;
1472
1473 _prev_end_offset = cur_offset + envelope_size;
1474
1475 Ok(())
1476 }
1477 }
1478
1479 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CreateDecoderParams {
1480 #[inline(always)]
1481 fn new_empty() -> Self {
1482 Self::default()
1483 }
1484
1485 unsafe fn decode(
1486 &mut self,
1487 decoder: &mut fidl::encoding::Decoder<'_, D>,
1488 offset: usize,
1489 mut depth: fidl::encoding::Depth,
1490 ) -> fidl::Result<()> {
1491 decoder.debug_check_bounds::<Self>(offset);
1492 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1493 None => return Err(fidl::Error::NotNullable),
1494 Some(len) => len,
1495 };
1496 if len == 0 {
1498 return Ok(());
1499 };
1500 depth.increment()?;
1501 let envelope_size = 8;
1502 let bytes_len = len * envelope_size;
1503 let offset = decoder.out_of_line_offset(bytes_len)?;
1504 let mut _next_ordinal_to_read = 0;
1506 let mut next_offset = offset;
1507 let end_offset = offset + bytes_len;
1508 _next_ordinal_to_read += 1;
1509 if next_offset >= end_offset {
1510 return Ok(());
1511 }
1512
1513 while _next_ordinal_to_read < 1 {
1515 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1516 _next_ordinal_to_read += 1;
1517 next_offset += envelope_size;
1518 }
1519
1520 let next_out_of_line = decoder.next_out_of_line();
1521 let handles_before = decoder.remaining_handles();
1522 if let Some((inlined, num_bytes, num_handles)) =
1523 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1524 {
1525 let member_inline_size = <fidl_fuchsia_media__common::FormatDetails as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1526 if inlined != (member_inline_size <= 4) {
1527 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1528 }
1529 let inner_offset;
1530 let mut inner_depth = depth.clone();
1531 if inlined {
1532 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1533 inner_offset = next_offset;
1534 } else {
1535 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1536 inner_depth.increment()?;
1537 }
1538 let val_ref = self.input_details.get_or_insert_with(|| {
1539 fidl::new_empty!(fidl_fuchsia_media__common::FormatDetails, D)
1540 });
1541 fidl::decode!(
1542 fidl_fuchsia_media__common::FormatDetails,
1543 D,
1544 val_ref,
1545 decoder,
1546 inner_offset,
1547 inner_depth
1548 )?;
1549 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1550 {
1551 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1552 }
1553 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1554 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1555 }
1556 }
1557
1558 next_offset += envelope_size;
1559 _next_ordinal_to_read += 1;
1560 if next_offset >= end_offset {
1561 return Ok(());
1562 }
1563
1564 while _next_ordinal_to_read < 2 {
1566 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1567 _next_ordinal_to_read += 1;
1568 next_offset += envelope_size;
1569 }
1570
1571 let next_out_of_line = decoder.next_out_of_line();
1572 let handles_before = decoder.remaining_handles();
1573 if let Some((inlined, num_bytes, num_handles)) =
1574 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1575 {
1576 let member_inline_size =
1577 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1578 if inlined != (member_inline_size <= 4) {
1579 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1580 }
1581 let inner_offset;
1582 let mut inner_depth = depth.clone();
1583 if inlined {
1584 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1585 inner_offset = next_offset;
1586 } else {
1587 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1588 inner_depth.increment()?;
1589 }
1590 let val_ref = self
1591 .promise_separate_access_units_on_input
1592 .get_or_insert_with(|| fidl::new_empty!(bool, D));
1593 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
1594 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1595 {
1596 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1597 }
1598 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1599 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1600 }
1601 }
1602
1603 next_offset += envelope_size;
1604 _next_ordinal_to_read += 1;
1605 if next_offset >= end_offset {
1606 return Ok(());
1607 }
1608
1609 while _next_ordinal_to_read < 3 {
1611 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1612 _next_ordinal_to_read += 1;
1613 next_offset += envelope_size;
1614 }
1615
1616 let next_out_of_line = decoder.next_out_of_line();
1617 let handles_before = decoder.remaining_handles();
1618 if let Some((inlined, num_bytes, num_handles)) =
1619 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1620 {
1621 let member_inline_size =
1622 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1623 if inlined != (member_inline_size <= 4) {
1624 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1625 }
1626 let inner_offset;
1627 let mut inner_depth = depth.clone();
1628 if inlined {
1629 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1630 inner_offset = next_offset;
1631 } else {
1632 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1633 inner_depth.increment()?;
1634 }
1635 let val_ref = self
1636 .require_can_stream_bytes_input
1637 .get_or_insert_with(|| fidl::new_empty!(bool, D));
1638 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
1639 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1640 {
1641 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1642 }
1643 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1644 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1645 }
1646 }
1647
1648 next_offset += envelope_size;
1649 _next_ordinal_to_read += 1;
1650 if next_offset >= end_offset {
1651 return Ok(());
1652 }
1653
1654 while _next_ordinal_to_read < 4 {
1656 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1657 _next_ordinal_to_read += 1;
1658 next_offset += envelope_size;
1659 }
1660
1661 let next_out_of_line = decoder.next_out_of_line();
1662 let handles_before = decoder.remaining_handles();
1663 if let Some((inlined, num_bytes, num_handles)) =
1664 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1665 {
1666 let member_inline_size =
1667 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1668 if inlined != (member_inline_size <= 4) {
1669 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1670 }
1671 let inner_offset;
1672 let mut inner_depth = depth.clone();
1673 if inlined {
1674 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1675 inner_offset = next_offset;
1676 } else {
1677 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1678 inner_depth.increment()?;
1679 }
1680 let val_ref =
1681 self.require_can_find_start.get_or_insert_with(|| fidl::new_empty!(bool, D));
1682 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
1683 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1684 {
1685 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1686 }
1687 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1688 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1689 }
1690 }
1691
1692 next_offset += envelope_size;
1693 _next_ordinal_to_read += 1;
1694 if next_offset >= end_offset {
1695 return Ok(());
1696 }
1697
1698 while _next_ordinal_to_read < 5 {
1700 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1701 _next_ordinal_to_read += 1;
1702 next_offset += envelope_size;
1703 }
1704
1705 let next_out_of_line = decoder.next_out_of_line();
1706 let handles_before = decoder.remaining_handles();
1707 if let Some((inlined, num_bytes, num_handles)) =
1708 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1709 {
1710 let member_inline_size =
1711 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1712 if inlined != (member_inline_size <= 4) {
1713 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1714 }
1715 let inner_offset;
1716 let mut inner_depth = depth.clone();
1717 if inlined {
1718 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1719 inner_offset = next_offset;
1720 } else {
1721 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1722 inner_depth.increment()?;
1723 }
1724 let val_ref =
1725 self.require_can_re_sync.get_or_insert_with(|| fidl::new_empty!(bool, D));
1726 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
1727 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1728 {
1729 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1730 }
1731 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1732 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1733 }
1734 }
1735
1736 next_offset += envelope_size;
1737 _next_ordinal_to_read += 1;
1738 if next_offset >= end_offset {
1739 return Ok(());
1740 }
1741
1742 while _next_ordinal_to_read < 6 {
1744 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1745 _next_ordinal_to_read += 1;
1746 next_offset += envelope_size;
1747 }
1748
1749 let next_out_of_line = decoder.next_out_of_line();
1750 let handles_before = decoder.remaining_handles();
1751 if let Some((inlined, num_bytes, num_handles)) =
1752 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1753 {
1754 let member_inline_size =
1755 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1756 if inlined != (member_inline_size <= 4) {
1757 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1758 }
1759 let inner_offset;
1760 let mut inner_depth = depth.clone();
1761 if inlined {
1762 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1763 inner_offset = next_offset;
1764 } else {
1765 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1766 inner_depth.increment()?;
1767 }
1768 let val_ref = self
1769 .require_report_all_detected_errors
1770 .get_or_insert_with(|| fidl::new_empty!(bool, D));
1771 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
1772 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1773 {
1774 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1775 }
1776 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1777 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1778 }
1779 }
1780
1781 next_offset += envelope_size;
1782 _next_ordinal_to_read += 1;
1783 if next_offset >= end_offset {
1784 return Ok(());
1785 }
1786
1787 while _next_ordinal_to_read < 7 {
1789 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1790 _next_ordinal_to_read += 1;
1791 next_offset += envelope_size;
1792 }
1793
1794 let next_out_of_line = decoder.next_out_of_line();
1795 let handles_before = decoder.remaining_handles();
1796 if let Some((inlined, num_bytes, num_handles)) =
1797 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1798 {
1799 let member_inline_size =
1800 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1801 if inlined != (member_inline_size <= 4) {
1802 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1803 }
1804 let inner_offset;
1805 let mut inner_depth = depth.clone();
1806 if inlined {
1807 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1808 inner_offset = next_offset;
1809 } else {
1810 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1811 inner_depth.increment()?;
1812 }
1813 let val_ref = self.require_hw.get_or_insert_with(|| fidl::new_empty!(bool, D));
1814 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
1815 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1816 {
1817 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1818 }
1819 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1820 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1821 }
1822 }
1823
1824 next_offset += envelope_size;
1825 _next_ordinal_to_read += 1;
1826 if next_offset >= end_offset {
1827 return Ok(());
1828 }
1829
1830 while _next_ordinal_to_read < 8 {
1832 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1833 _next_ordinal_to_read += 1;
1834 next_offset += envelope_size;
1835 }
1836
1837 let next_out_of_line = decoder.next_out_of_line();
1838 let handles_before = decoder.remaining_handles();
1839 if let Some((inlined, num_bytes, num_handles)) =
1840 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1841 {
1842 let member_inline_size =
1843 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1844 if inlined != (member_inline_size <= 4) {
1845 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1846 }
1847 let inner_offset;
1848 let mut inner_depth = depth.clone();
1849 if inlined {
1850 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1851 inner_offset = next_offset;
1852 } else {
1853 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1854 inner_depth.increment()?;
1855 }
1856 let val_ref = self
1857 .permit_lack_of_split_header_handling
1858 .get_or_insert_with(|| fidl::new_empty!(bool, D));
1859 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
1860 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1861 {
1862 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1863 }
1864 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1865 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1866 }
1867 }
1868
1869 next_offset += envelope_size;
1870 _next_ordinal_to_read += 1;
1871 if next_offset >= end_offset {
1872 return Ok(());
1873 }
1874
1875 while _next_ordinal_to_read < 9 {
1877 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1878 _next_ordinal_to_read += 1;
1879 next_offset += envelope_size;
1880 }
1881
1882 let next_out_of_line = decoder.next_out_of_line();
1883 let handles_before = decoder.remaining_handles();
1884 if let Some((inlined, num_bytes, num_handles)) =
1885 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1886 {
1887 let member_inline_size =
1888 <SecureMemoryMode as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1889 if inlined != (member_inline_size <= 4) {
1890 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1891 }
1892 let inner_offset;
1893 let mut inner_depth = depth.clone();
1894 if inlined {
1895 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1896 inner_offset = next_offset;
1897 } else {
1898 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1899 inner_depth.increment()?;
1900 }
1901 let val_ref = self
1902 .secure_output_mode
1903 .get_or_insert_with(|| fidl::new_empty!(SecureMemoryMode, D));
1904 fidl::decode!(SecureMemoryMode, D, val_ref, decoder, inner_offset, inner_depth)?;
1905 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1906 {
1907 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1908 }
1909 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1910 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1911 }
1912 }
1913
1914 next_offset += envelope_size;
1915 _next_ordinal_to_read += 1;
1916 if next_offset >= end_offset {
1917 return Ok(());
1918 }
1919
1920 while _next_ordinal_to_read < 10 {
1922 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1923 _next_ordinal_to_read += 1;
1924 next_offset += envelope_size;
1925 }
1926
1927 let next_out_of_line = decoder.next_out_of_line();
1928 let handles_before = decoder.remaining_handles();
1929 if let Some((inlined, num_bytes, num_handles)) =
1930 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1931 {
1932 let member_inline_size =
1933 <SecureMemoryMode as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1934 if inlined != (member_inline_size <= 4) {
1935 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1936 }
1937 let inner_offset;
1938 let mut inner_depth = depth.clone();
1939 if inlined {
1940 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1941 inner_offset = next_offset;
1942 } else {
1943 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1944 inner_depth.increment()?;
1945 }
1946 let val_ref = self
1947 .secure_input_mode
1948 .get_or_insert_with(|| fidl::new_empty!(SecureMemoryMode, D));
1949 fidl::decode!(SecureMemoryMode, D, val_ref, decoder, inner_offset, inner_depth)?;
1950 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1951 {
1952 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1953 }
1954 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1955 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1956 }
1957 }
1958
1959 next_offset += envelope_size;
1960 _next_ordinal_to_read += 1;
1961 if next_offset >= end_offset {
1962 return Ok(());
1963 }
1964
1965 while _next_ordinal_to_read < 11 {
1967 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1968 _next_ordinal_to_read += 1;
1969 next_offset += envelope_size;
1970 }
1971
1972 let next_out_of_line = decoder.next_out_of_line();
1973 let handles_before = decoder.remaining_handles();
1974 if let Some((inlined, num_bytes, num_handles)) =
1975 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1976 {
1977 let member_inline_size =
1978 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1979 if inlined != (member_inline_size <= 4) {
1980 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1981 }
1982 let inner_offset;
1983 let mut inner_depth = depth.clone();
1984 if inlined {
1985 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1986 inner_offset = next_offset;
1987 } else {
1988 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1989 inner_depth.increment()?;
1990 }
1991 let val_ref = self.require_sw.get_or_insert_with(|| fidl::new_empty!(bool, D));
1992 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
1993 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1994 {
1995 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1996 }
1997 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1998 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1999 }
2000 }
2001
2002 next_offset += envelope_size;
2003
2004 while next_offset < end_offset {
2006 _next_ordinal_to_read += 1;
2007 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2008 next_offset += envelope_size;
2009 }
2010
2011 Ok(())
2012 }
2013 }
2014
2015 impl CreateEncoderParams {
2016 #[inline(always)]
2017 fn max_ordinal_present(&self) -> u64 {
2018 if let Some(_) = self.require_hw {
2019 return 2;
2020 }
2021 if let Some(_) = self.input_details {
2022 return 1;
2023 }
2024 0
2025 }
2026 }
2027
2028 impl fidl::encoding::ValueTypeMarker for CreateEncoderParams {
2029 type Borrowed<'a> = &'a Self;
2030 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2031 value
2032 }
2033 }
2034
2035 unsafe impl fidl::encoding::TypeMarker for CreateEncoderParams {
2036 type Owned = Self;
2037
2038 #[inline(always)]
2039 fn inline_align(_context: fidl::encoding::Context) -> usize {
2040 8
2041 }
2042
2043 #[inline(always)]
2044 fn inline_size(_context: fidl::encoding::Context) -> usize {
2045 16
2046 }
2047 }
2048
2049 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CreateEncoderParams, D>
2050 for &CreateEncoderParams
2051 {
2052 unsafe fn encode(
2053 self,
2054 encoder: &mut fidl::encoding::Encoder<'_, D>,
2055 offset: usize,
2056 mut depth: fidl::encoding::Depth,
2057 ) -> fidl::Result<()> {
2058 encoder.debug_check_bounds::<CreateEncoderParams>(offset);
2059 let max_ordinal: u64 = self.max_ordinal_present();
2061 encoder.write_num(max_ordinal, offset);
2062 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2063 if max_ordinal == 0 {
2065 return Ok(());
2066 }
2067 depth.increment()?;
2068 let envelope_size = 8;
2069 let bytes_len = max_ordinal as usize * envelope_size;
2070 #[allow(unused_variables)]
2071 let offset = encoder.out_of_line_offset(bytes_len);
2072 let mut _prev_end_offset: usize = 0;
2073 if 1 > max_ordinal {
2074 return Ok(());
2075 }
2076
2077 let cur_offset: usize = (1 - 1) * envelope_size;
2080
2081 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2083
2084 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_media__common::FormatDetails, D>(
2089 self.input_details.as_ref().map(<fidl_fuchsia_media__common::FormatDetails as fidl::encoding::ValueTypeMarker>::borrow),
2090 encoder, offset + cur_offset, depth
2091 )?;
2092
2093 _prev_end_offset = cur_offset + envelope_size;
2094 if 2 > max_ordinal {
2095 return Ok(());
2096 }
2097
2098 let cur_offset: usize = (2 - 1) * envelope_size;
2101
2102 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2104
2105 fidl::encoding::encode_in_envelope_optional::<bool, D>(
2110 self.require_hw.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2111 encoder,
2112 offset + cur_offset,
2113 depth,
2114 )?;
2115
2116 _prev_end_offset = cur_offset + envelope_size;
2117
2118 Ok(())
2119 }
2120 }
2121
2122 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CreateEncoderParams {
2123 #[inline(always)]
2124 fn new_empty() -> Self {
2125 Self::default()
2126 }
2127
2128 unsafe fn decode(
2129 &mut self,
2130 decoder: &mut fidl::encoding::Decoder<'_, D>,
2131 offset: usize,
2132 mut depth: fidl::encoding::Depth,
2133 ) -> fidl::Result<()> {
2134 decoder.debug_check_bounds::<Self>(offset);
2135 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2136 None => return Err(fidl::Error::NotNullable),
2137 Some(len) => len,
2138 };
2139 if len == 0 {
2141 return Ok(());
2142 };
2143 depth.increment()?;
2144 let envelope_size = 8;
2145 let bytes_len = len * envelope_size;
2146 let offset = decoder.out_of_line_offset(bytes_len)?;
2147 let mut _next_ordinal_to_read = 0;
2149 let mut next_offset = offset;
2150 let end_offset = offset + bytes_len;
2151 _next_ordinal_to_read += 1;
2152 if next_offset >= end_offset {
2153 return Ok(());
2154 }
2155
2156 while _next_ordinal_to_read < 1 {
2158 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2159 _next_ordinal_to_read += 1;
2160 next_offset += envelope_size;
2161 }
2162
2163 let next_out_of_line = decoder.next_out_of_line();
2164 let handles_before = decoder.remaining_handles();
2165 if let Some((inlined, num_bytes, num_handles)) =
2166 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2167 {
2168 let member_inline_size = <fidl_fuchsia_media__common::FormatDetails as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2169 if inlined != (member_inline_size <= 4) {
2170 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2171 }
2172 let inner_offset;
2173 let mut inner_depth = depth.clone();
2174 if inlined {
2175 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2176 inner_offset = next_offset;
2177 } else {
2178 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2179 inner_depth.increment()?;
2180 }
2181 let val_ref = self.input_details.get_or_insert_with(|| {
2182 fidl::new_empty!(fidl_fuchsia_media__common::FormatDetails, D)
2183 });
2184 fidl::decode!(
2185 fidl_fuchsia_media__common::FormatDetails,
2186 D,
2187 val_ref,
2188 decoder,
2189 inner_offset,
2190 inner_depth
2191 )?;
2192 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2193 {
2194 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2195 }
2196 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2197 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2198 }
2199 }
2200
2201 next_offset += envelope_size;
2202 _next_ordinal_to_read += 1;
2203 if next_offset >= end_offset {
2204 return Ok(());
2205 }
2206
2207 while _next_ordinal_to_read < 2 {
2209 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2210 _next_ordinal_to_read += 1;
2211 next_offset += envelope_size;
2212 }
2213
2214 let next_out_of_line = decoder.next_out_of_line();
2215 let handles_before = decoder.remaining_handles();
2216 if let Some((inlined, num_bytes, num_handles)) =
2217 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2218 {
2219 let member_inline_size =
2220 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2221 if inlined != (member_inline_size <= 4) {
2222 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2223 }
2224 let inner_offset;
2225 let mut inner_depth = depth.clone();
2226 if inlined {
2227 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2228 inner_offset = next_offset;
2229 } else {
2230 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2231 inner_depth.increment()?;
2232 }
2233 let val_ref = self.require_hw.get_or_insert_with(|| fidl::new_empty!(bool, D));
2234 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
2235 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2236 {
2237 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2238 }
2239 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2240 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2241 }
2242 }
2243
2244 next_offset += envelope_size;
2245
2246 while next_offset < end_offset {
2248 _next_ordinal_to_read += 1;
2249 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2250 next_offset += envelope_size;
2251 }
2252
2253 Ok(())
2254 }
2255 }
2256
2257 impl DecoderProfileDescription {
2258 #[inline(always)]
2259 fn max_ordinal_present(&self) -> u64 {
2260 if let Some(_) = self.split_header_handling {
2261 return 12;
2262 }
2263 if let Some(_) = self.will_report_all_detected_errors {
2264 return 11;
2265 }
2266 if let Some(_) = self.can_re_sync {
2267 return 10;
2268 }
2269 if let Some(_) = self.can_find_start {
2270 return 9;
2271 }
2272 if let Some(_) = self.can_stream_bytes_input {
2273 return 8;
2274 }
2275 if let Some(_) = self.require_input_protection {
2276 return 7;
2277 }
2278 if let Some(_) = self.allow_input_protection {
2279 return 6;
2280 }
2281 if let Some(_) = self.require_encryption {
2282 return 5;
2283 }
2284 if let Some(_) = self.allow_encryption {
2285 return 4;
2286 }
2287 if let Some(_) = self.max_image_size {
2288 return 3;
2289 }
2290 if let Some(_) = self.min_image_size {
2291 return 2;
2292 }
2293 if let Some(_) = self.profile {
2294 return 1;
2295 }
2296 0
2297 }
2298 }
2299
2300 impl fidl::encoding::ValueTypeMarker for DecoderProfileDescription {
2301 type Borrowed<'a> = &'a Self;
2302 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2303 value
2304 }
2305 }
2306
2307 unsafe impl fidl::encoding::TypeMarker for DecoderProfileDescription {
2308 type Owned = Self;
2309
2310 #[inline(always)]
2311 fn inline_align(_context: fidl::encoding::Context) -> usize {
2312 8
2313 }
2314
2315 #[inline(always)]
2316 fn inline_size(_context: fidl::encoding::Context) -> usize {
2317 16
2318 }
2319 }
2320
2321 unsafe impl<D: fidl::encoding::ResourceDialect>
2322 fidl::encoding::Encode<DecoderProfileDescription, D> for &DecoderProfileDescription
2323 {
2324 unsafe fn encode(
2325 self,
2326 encoder: &mut fidl::encoding::Encoder<'_, D>,
2327 offset: usize,
2328 mut depth: fidl::encoding::Depth,
2329 ) -> fidl::Result<()> {
2330 encoder.debug_check_bounds::<DecoderProfileDescription>(offset);
2331 let max_ordinal: u64 = self.max_ordinal_present();
2333 encoder.write_num(max_ordinal, offset);
2334 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2335 if max_ordinal == 0 {
2337 return Ok(());
2338 }
2339 depth.increment()?;
2340 let envelope_size = 8;
2341 let bytes_len = max_ordinal as usize * envelope_size;
2342 #[allow(unused_variables)]
2343 let offset = encoder.out_of_line_offset(bytes_len);
2344 let mut _prev_end_offset: usize = 0;
2345 if 1 > max_ordinal {
2346 return Ok(());
2347 }
2348
2349 let cur_offset: usize = (1 - 1) * envelope_size;
2352
2353 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2355
2356 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_media__common::CodecProfile, D>(
2361 self.profile.as_ref().map(<fidl_fuchsia_media__common::CodecProfile as fidl::encoding::ValueTypeMarker>::borrow),
2362 encoder, offset + cur_offset, depth
2363 )?;
2364
2365 _prev_end_offset = cur_offset + envelope_size;
2366 if 2 > max_ordinal {
2367 return Ok(());
2368 }
2369
2370 let cur_offset: usize = (2 - 1) * envelope_size;
2373
2374 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2376
2377 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_math__common::SizeU, D>(
2382 self.min_image_size.as_ref().map(
2383 <fidl_fuchsia_math__common::SizeU as fidl::encoding::ValueTypeMarker>::borrow,
2384 ),
2385 encoder,
2386 offset + cur_offset,
2387 depth,
2388 )?;
2389
2390 _prev_end_offset = cur_offset + envelope_size;
2391 if 3 > max_ordinal {
2392 return Ok(());
2393 }
2394
2395 let cur_offset: usize = (3 - 1) * envelope_size;
2398
2399 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2401
2402 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_math__common::SizeU, D>(
2407 self.max_image_size.as_ref().map(
2408 <fidl_fuchsia_math__common::SizeU as fidl::encoding::ValueTypeMarker>::borrow,
2409 ),
2410 encoder,
2411 offset + cur_offset,
2412 depth,
2413 )?;
2414
2415 _prev_end_offset = cur_offset + envelope_size;
2416 if 4 > max_ordinal {
2417 return Ok(());
2418 }
2419
2420 let cur_offset: usize = (4 - 1) * envelope_size;
2423
2424 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2426
2427 fidl::encoding::encode_in_envelope_optional::<bool, D>(
2432 self.allow_encryption
2433 .as_ref()
2434 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2435 encoder,
2436 offset + cur_offset,
2437 depth,
2438 )?;
2439
2440 _prev_end_offset = cur_offset + envelope_size;
2441 if 5 > max_ordinal {
2442 return Ok(());
2443 }
2444
2445 let cur_offset: usize = (5 - 1) * envelope_size;
2448
2449 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2451
2452 fidl::encoding::encode_in_envelope_optional::<bool, D>(
2457 self.require_encryption
2458 .as_ref()
2459 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2460 encoder,
2461 offset + cur_offset,
2462 depth,
2463 )?;
2464
2465 _prev_end_offset = cur_offset + envelope_size;
2466 if 6 > max_ordinal {
2467 return Ok(());
2468 }
2469
2470 let cur_offset: usize = (6 - 1) * envelope_size;
2473
2474 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2476
2477 fidl::encoding::encode_in_envelope_optional::<bool, D>(
2482 self.allow_input_protection
2483 .as_ref()
2484 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2485 encoder,
2486 offset + cur_offset,
2487 depth,
2488 )?;
2489
2490 _prev_end_offset = cur_offset + envelope_size;
2491 if 7 > max_ordinal {
2492 return Ok(());
2493 }
2494
2495 let cur_offset: usize = (7 - 1) * envelope_size;
2498
2499 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2501
2502 fidl::encoding::encode_in_envelope_optional::<bool, D>(
2507 self.require_input_protection
2508 .as_ref()
2509 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2510 encoder,
2511 offset + cur_offset,
2512 depth,
2513 )?;
2514
2515 _prev_end_offset = cur_offset + envelope_size;
2516 if 8 > max_ordinal {
2517 return Ok(());
2518 }
2519
2520 let cur_offset: usize = (8 - 1) * envelope_size;
2523
2524 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2526
2527 fidl::encoding::encode_in_envelope_optional::<bool, D>(
2532 self.can_stream_bytes_input
2533 .as_ref()
2534 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2535 encoder,
2536 offset + cur_offset,
2537 depth,
2538 )?;
2539
2540 _prev_end_offset = cur_offset + envelope_size;
2541 if 9 > max_ordinal {
2542 return Ok(());
2543 }
2544
2545 let cur_offset: usize = (9 - 1) * envelope_size;
2548
2549 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2551
2552 fidl::encoding::encode_in_envelope_optional::<bool, D>(
2557 self.can_find_start.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2558 encoder,
2559 offset + cur_offset,
2560 depth,
2561 )?;
2562
2563 _prev_end_offset = cur_offset + envelope_size;
2564 if 10 > max_ordinal {
2565 return Ok(());
2566 }
2567
2568 let cur_offset: usize = (10 - 1) * envelope_size;
2571
2572 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2574
2575 fidl::encoding::encode_in_envelope_optional::<bool, D>(
2580 self.can_re_sync.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2581 encoder,
2582 offset + cur_offset,
2583 depth,
2584 )?;
2585
2586 _prev_end_offset = cur_offset + envelope_size;
2587 if 11 > max_ordinal {
2588 return Ok(());
2589 }
2590
2591 let cur_offset: usize = (11 - 1) * envelope_size;
2594
2595 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2597
2598 fidl::encoding::encode_in_envelope_optional::<bool, D>(
2603 self.will_report_all_detected_errors
2604 .as_ref()
2605 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2606 encoder,
2607 offset + cur_offset,
2608 depth,
2609 )?;
2610
2611 _prev_end_offset = cur_offset + envelope_size;
2612 if 12 > max_ordinal {
2613 return Ok(());
2614 }
2615
2616 let cur_offset: usize = (12 - 1) * envelope_size;
2619
2620 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2622
2623 fidl::encoding::encode_in_envelope_optional::<bool, D>(
2628 self.split_header_handling
2629 .as_ref()
2630 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2631 encoder,
2632 offset + cur_offset,
2633 depth,
2634 )?;
2635
2636 _prev_end_offset = cur_offset + envelope_size;
2637
2638 Ok(())
2639 }
2640 }
2641
2642 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2643 for DecoderProfileDescription
2644 {
2645 #[inline(always)]
2646 fn new_empty() -> Self {
2647 Self::default()
2648 }
2649
2650 unsafe fn decode(
2651 &mut self,
2652 decoder: &mut fidl::encoding::Decoder<'_, D>,
2653 offset: usize,
2654 mut depth: fidl::encoding::Depth,
2655 ) -> fidl::Result<()> {
2656 decoder.debug_check_bounds::<Self>(offset);
2657 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2658 None => return Err(fidl::Error::NotNullable),
2659 Some(len) => len,
2660 };
2661 if len == 0 {
2663 return Ok(());
2664 };
2665 depth.increment()?;
2666 let envelope_size = 8;
2667 let bytes_len = len * envelope_size;
2668 let offset = decoder.out_of_line_offset(bytes_len)?;
2669 let mut _next_ordinal_to_read = 0;
2671 let mut next_offset = offset;
2672 let end_offset = offset + bytes_len;
2673 _next_ordinal_to_read += 1;
2674 if next_offset >= end_offset {
2675 return Ok(());
2676 }
2677
2678 while _next_ordinal_to_read < 1 {
2680 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2681 _next_ordinal_to_read += 1;
2682 next_offset += envelope_size;
2683 }
2684
2685 let next_out_of_line = decoder.next_out_of_line();
2686 let handles_before = decoder.remaining_handles();
2687 if let Some((inlined, num_bytes, num_handles)) =
2688 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2689 {
2690 let member_inline_size = <fidl_fuchsia_media__common::CodecProfile as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2691 if inlined != (member_inline_size <= 4) {
2692 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2693 }
2694 let inner_offset;
2695 let mut inner_depth = depth.clone();
2696 if inlined {
2697 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2698 inner_offset = next_offset;
2699 } else {
2700 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2701 inner_depth.increment()?;
2702 }
2703 let val_ref = self.profile.get_or_insert_with(|| {
2704 fidl::new_empty!(fidl_fuchsia_media__common::CodecProfile, D)
2705 });
2706 fidl::decode!(
2707 fidl_fuchsia_media__common::CodecProfile,
2708 D,
2709 val_ref,
2710 decoder,
2711 inner_offset,
2712 inner_depth
2713 )?;
2714 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2715 {
2716 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2717 }
2718 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2719 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2720 }
2721 }
2722
2723 next_offset += envelope_size;
2724 _next_ordinal_to_read += 1;
2725 if next_offset >= end_offset {
2726 return Ok(());
2727 }
2728
2729 while _next_ordinal_to_read < 2 {
2731 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2732 _next_ordinal_to_read += 1;
2733 next_offset += envelope_size;
2734 }
2735
2736 let next_out_of_line = decoder.next_out_of_line();
2737 let handles_before = decoder.remaining_handles();
2738 if let Some((inlined, num_bytes, num_handles)) =
2739 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2740 {
2741 let member_inline_size =
2742 <fidl_fuchsia_math__common::SizeU as fidl::encoding::TypeMarker>::inline_size(
2743 decoder.context,
2744 );
2745 if inlined != (member_inline_size <= 4) {
2746 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2747 }
2748 let inner_offset;
2749 let mut inner_depth = depth.clone();
2750 if inlined {
2751 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2752 inner_offset = next_offset;
2753 } else {
2754 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2755 inner_depth.increment()?;
2756 }
2757 let val_ref = self
2758 .min_image_size
2759 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_math__common::SizeU, D));
2760 fidl::decode!(
2761 fidl_fuchsia_math__common::SizeU,
2762 D,
2763 val_ref,
2764 decoder,
2765 inner_offset,
2766 inner_depth
2767 )?;
2768 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2769 {
2770 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2771 }
2772 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2773 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2774 }
2775 }
2776
2777 next_offset += envelope_size;
2778 _next_ordinal_to_read += 1;
2779 if next_offset >= end_offset {
2780 return Ok(());
2781 }
2782
2783 while _next_ordinal_to_read < 3 {
2785 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2786 _next_ordinal_to_read += 1;
2787 next_offset += envelope_size;
2788 }
2789
2790 let next_out_of_line = decoder.next_out_of_line();
2791 let handles_before = decoder.remaining_handles();
2792 if let Some((inlined, num_bytes, num_handles)) =
2793 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2794 {
2795 let member_inline_size =
2796 <fidl_fuchsia_math__common::SizeU as fidl::encoding::TypeMarker>::inline_size(
2797 decoder.context,
2798 );
2799 if inlined != (member_inline_size <= 4) {
2800 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2801 }
2802 let inner_offset;
2803 let mut inner_depth = depth.clone();
2804 if inlined {
2805 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2806 inner_offset = next_offset;
2807 } else {
2808 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2809 inner_depth.increment()?;
2810 }
2811 let val_ref = self
2812 .max_image_size
2813 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_math__common::SizeU, D));
2814 fidl::decode!(
2815 fidl_fuchsia_math__common::SizeU,
2816 D,
2817 val_ref,
2818 decoder,
2819 inner_offset,
2820 inner_depth
2821 )?;
2822 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2823 {
2824 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2825 }
2826 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2827 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2828 }
2829 }
2830
2831 next_offset += envelope_size;
2832 _next_ordinal_to_read += 1;
2833 if next_offset >= end_offset {
2834 return Ok(());
2835 }
2836
2837 while _next_ordinal_to_read < 4 {
2839 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2840 _next_ordinal_to_read += 1;
2841 next_offset += envelope_size;
2842 }
2843
2844 let next_out_of_line = decoder.next_out_of_line();
2845 let handles_before = decoder.remaining_handles();
2846 if let Some((inlined, num_bytes, num_handles)) =
2847 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2848 {
2849 let member_inline_size =
2850 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2851 if inlined != (member_inline_size <= 4) {
2852 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2853 }
2854 let inner_offset;
2855 let mut inner_depth = depth.clone();
2856 if inlined {
2857 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2858 inner_offset = next_offset;
2859 } else {
2860 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2861 inner_depth.increment()?;
2862 }
2863 let val_ref =
2864 self.allow_encryption.get_or_insert_with(|| fidl::new_empty!(bool, D));
2865 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
2866 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2867 {
2868 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2869 }
2870 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2871 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2872 }
2873 }
2874
2875 next_offset += envelope_size;
2876 _next_ordinal_to_read += 1;
2877 if next_offset >= end_offset {
2878 return Ok(());
2879 }
2880
2881 while _next_ordinal_to_read < 5 {
2883 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2884 _next_ordinal_to_read += 1;
2885 next_offset += envelope_size;
2886 }
2887
2888 let next_out_of_line = decoder.next_out_of_line();
2889 let handles_before = decoder.remaining_handles();
2890 if let Some((inlined, num_bytes, num_handles)) =
2891 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2892 {
2893 let member_inline_size =
2894 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2895 if inlined != (member_inline_size <= 4) {
2896 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2897 }
2898 let inner_offset;
2899 let mut inner_depth = depth.clone();
2900 if inlined {
2901 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2902 inner_offset = next_offset;
2903 } else {
2904 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2905 inner_depth.increment()?;
2906 }
2907 let val_ref =
2908 self.require_encryption.get_or_insert_with(|| fidl::new_empty!(bool, D));
2909 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
2910 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2911 {
2912 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2913 }
2914 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2915 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2916 }
2917 }
2918
2919 next_offset += envelope_size;
2920 _next_ordinal_to_read += 1;
2921 if next_offset >= end_offset {
2922 return Ok(());
2923 }
2924
2925 while _next_ordinal_to_read < 6 {
2927 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2928 _next_ordinal_to_read += 1;
2929 next_offset += envelope_size;
2930 }
2931
2932 let next_out_of_line = decoder.next_out_of_line();
2933 let handles_before = decoder.remaining_handles();
2934 if let Some((inlined, num_bytes, num_handles)) =
2935 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2936 {
2937 let member_inline_size =
2938 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2939 if inlined != (member_inline_size <= 4) {
2940 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2941 }
2942 let inner_offset;
2943 let mut inner_depth = depth.clone();
2944 if inlined {
2945 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2946 inner_offset = next_offset;
2947 } else {
2948 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2949 inner_depth.increment()?;
2950 }
2951 let val_ref =
2952 self.allow_input_protection.get_or_insert_with(|| fidl::new_empty!(bool, D));
2953 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
2954 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2955 {
2956 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2957 }
2958 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2959 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2960 }
2961 }
2962
2963 next_offset += envelope_size;
2964 _next_ordinal_to_read += 1;
2965 if next_offset >= end_offset {
2966 return Ok(());
2967 }
2968
2969 while _next_ordinal_to_read < 7 {
2971 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2972 _next_ordinal_to_read += 1;
2973 next_offset += envelope_size;
2974 }
2975
2976 let next_out_of_line = decoder.next_out_of_line();
2977 let handles_before = decoder.remaining_handles();
2978 if let Some((inlined, num_bytes, num_handles)) =
2979 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2980 {
2981 let member_inline_size =
2982 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2983 if inlined != (member_inline_size <= 4) {
2984 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2985 }
2986 let inner_offset;
2987 let mut inner_depth = depth.clone();
2988 if inlined {
2989 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2990 inner_offset = next_offset;
2991 } else {
2992 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2993 inner_depth.increment()?;
2994 }
2995 let val_ref =
2996 self.require_input_protection.get_or_insert_with(|| fidl::new_empty!(bool, D));
2997 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
2998 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2999 {
3000 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3001 }
3002 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3003 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3004 }
3005 }
3006
3007 next_offset += envelope_size;
3008 _next_ordinal_to_read += 1;
3009 if next_offset >= end_offset {
3010 return Ok(());
3011 }
3012
3013 while _next_ordinal_to_read < 8 {
3015 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3016 _next_ordinal_to_read += 1;
3017 next_offset += envelope_size;
3018 }
3019
3020 let next_out_of_line = decoder.next_out_of_line();
3021 let handles_before = decoder.remaining_handles();
3022 if let Some((inlined, num_bytes, num_handles)) =
3023 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3024 {
3025 let member_inline_size =
3026 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3027 if inlined != (member_inline_size <= 4) {
3028 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3029 }
3030 let inner_offset;
3031 let mut inner_depth = depth.clone();
3032 if inlined {
3033 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3034 inner_offset = next_offset;
3035 } else {
3036 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3037 inner_depth.increment()?;
3038 }
3039 let val_ref =
3040 self.can_stream_bytes_input.get_or_insert_with(|| fidl::new_empty!(bool, D));
3041 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
3042 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3043 {
3044 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3045 }
3046 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3047 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3048 }
3049 }
3050
3051 next_offset += envelope_size;
3052 _next_ordinal_to_read += 1;
3053 if next_offset >= end_offset {
3054 return Ok(());
3055 }
3056
3057 while _next_ordinal_to_read < 9 {
3059 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3060 _next_ordinal_to_read += 1;
3061 next_offset += envelope_size;
3062 }
3063
3064 let next_out_of_line = decoder.next_out_of_line();
3065 let handles_before = decoder.remaining_handles();
3066 if let Some((inlined, num_bytes, num_handles)) =
3067 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3068 {
3069 let member_inline_size =
3070 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3071 if inlined != (member_inline_size <= 4) {
3072 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3073 }
3074 let inner_offset;
3075 let mut inner_depth = depth.clone();
3076 if inlined {
3077 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3078 inner_offset = next_offset;
3079 } else {
3080 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3081 inner_depth.increment()?;
3082 }
3083 let val_ref = self.can_find_start.get_or_insert_with(|| fidl::new_empty!(bool, D));
3084 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
3085 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3086 {
3087 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3088 }
3089 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3090 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3091 }
3092 }
3093
3094 next_offset += envelope_size;
3095 _next_ordinal_to_read += 1;
3096 if next_offset >= end_offset {
3097 return Ok(());
3098 }
3099
3100 while _next_ordinal_to_read < 10 {
3102 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3103 _next_ordinal_to_read += 1;
3104 next_offset += envelope_size;
3105 }
3106
3107 let next_out_of_line = decoder.next_out_of_line();
3108 let handles_before = decoder.remaining_handles();
3109 if let Some((inlined, num_bytes, num_handles)) =
3110 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3111 {
3112 let member_inline_size =
3113 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3114 if inlined != (member_inline_size <= 4) {
3115 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3116 }
3117 let inner_offset;
3118 let mut inner_depth = depth.clone();
3119 if inlined {
3120 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3121 inner_offset = next_offset;
3122 } else {
3123 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3124 inner_depth.increment()?;
3125 }
3126 let val_ref = self.can_re_sync.get_or_insert_with(|| fidl::new_empty!(bool, D));
3127 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
3128 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3129 {
3130 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3131 }
3132 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3133 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3134 }
3135 }
3136
3137 next_offset += envelope_size;
3138 _next_ordinal_to_read += 1;
3139 if next_offset >= end_offset {
3140 return Ok(());
3141 }
3142
3143 while _next_ordinal_to_read < 11 {
3145 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3146 _next_ordinal_to_read += 1;
3147 next_offset += envelope_size;
3148 }
3149
3150 let next_out_of_line = decoder.next_out_of_line();
3151 let handles_before = decoder.remaining_handles();
3152 if let Some((inlined, num_bytes, num_handles)) =
3153 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3154 {
3155 let member_inline_size =
3156 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3157 if inlined != (member_inline_size <= 4) {
3158 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3159 }
3160 let inner_offset;
3161 let mut inner_depth = depth.clone();
3162 if inlined {
3163 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3164 inner_offset = next_offset;
3165 } else {
3166 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3167 inner_depth.increment()?;
3168 }
3169 let val_ref = self
3170 .will_report_all_detected_errors
3171 .get_or_insert_with(|| fidl::new_empty!(bool, D));
3172 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
3173 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3174 {
3175 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3176 }
3177 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3178 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3179 }
3180 }
3181
3182 next_offset += envelope_size;
3183 _next_ordinal_to_read += 1;
3184 if next_offset >= end_offset {
3185 return Ok(());
3186 }
3187
3188 while _next_ordinal_to_read < 12 {
3190 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3191 _next_ordinal_to_read += 1;
3192 next_offset += envelope_size;
3193 }
3194
3195 let next_out_of_line = decoder.next_out_of_line();
3196 let handles_before = decoder.remaining_handles();
3197 if let Some((inlined, num_bytes, num_handles)) =
3198 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3199 {
3200 let member_inline_size =
3201 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3202 if inlined != (member_inline_size <= 4) {
3203 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3204 }
3205 let inner_offset;
3206 let mut inner_depth = depth.clone();
3207 if inlined {
3208 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3209 inner_offset = next_offset;
3210 } else {
3211 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3212 inner_depth.increment()?;
3213 }
3214 let val_ref =
3215 self.split_header_handling.get_or_insert_with(|| fidl::new_empty!(bool, D));
3216 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
3217 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3218 {
3219 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3220 }
3221 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3222 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3223 }
3224 }
3225
3226 next_offset += envelope_size;
3227
3228 while next_offset < end_offset {
3230 _next_ordinal_to_read += 1;
3231 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3232 next_offset += envelope_size;
3233 }
3234
3235 Ok(())
3236 }
3237 }
3238
3239 impl DetailedCodecDescription {
3240 #[inline(always)]
3241 fn max_ordinal_present(&self) -> u64 {
3242 if let Some(_) = self.profile_descriptions {
3243 return 4;
3244 }
3245 if let Some(_) = self.is_hw {
3246 return 3;
3247 }
3248 if let Some(_) = self.mime_type {
3249 return 2;
3250 }
3251 if let Some(_) = self.codec_type {
3252 return 1;
3253 }
3254 0
3255 }
3256 }
3257
3258 impl fidl::encoding::ValueTypeMarker for DetailedCodecDescription {
3259 type Borrowed<'a> = &'a Self;
3260 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3261 value
3262 }
3263 }
3264
3265 unsafe impl fidl::encoding::TypeMarker for DetailedCodecDescription {
3266 type Owned = Self;
3267
3268 #[inline(always)]
3269 fn inline_align(_context: fidl::encoding::Context) -> usize {
3270 8
3271 }
3272
3273 #[inline(always)]
3274 fn inline_size(_context: fidl::encoding::Context) -> usize {
3275 16
3276 }
3277 }
3278
3279 unsafe impl<D: fidl::encoding::ResourceDialect>
3280 fidl::encoding::Encode<DetailedCodecDescription, D> for &DetailedCodecDescription
3281 {
3282 unsafe fn encode(
3283 self,
3284 encoder: &mut fidl::encoding::Encoder<'_, D>,
3285 offset: usize,
3286 mut depth: fidl::encoding::Depth,
3287 ) -> fidl::Result<()> {
3288 encoder.debug_check_bounds::<DetailedCodecDescription>(offset);
3289 let max_ordinal: u64 = self.max_ordinal_present();
3291 encoder.write_num(max_ordinal, offset);
3292 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3293 if max_ordinal == 0 {
3295 return Ok(());
3296 }
3297 depth.increment()?;
3298 let envelope_size = 8;
3299 let bytes_len = max_ordinal as usize * envelope_size;
3300 #[allow(unused_variables)]
3301 let offset = encoder.out_of_line_offset(bytes_len);
3302 let mut _prev_end_offset: usize = 0;
3303 if 1 > max_ordinal {
3304 return Ok(());
3305 }
3306
3307 let cur_offset: usize = (1 - 1) * envelope_size;
3310
3311 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3313
3314 fidl::encoding::encode_in_envelope_optional::<CodecType, D>(
3319 self.codec_type
3320 .as_ref()
3321 .map(<CodecType as fidl::encoding::ValueTypeMarker>::borrow),
3322 encoder,
3323 offset + cur_offset,
3324 depth,
3325 )?;
3326
3327 _prev_end_offset = cur_offset + envelope_size;
3328 if 2 > max_ordinal {
3329 return Ok(());
3330 }
3331
3332 let cur_offset: usize = (2 - 1) * envelope_size;
3335
3336 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3338
3339 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<256>, D>(
3344 self.mime_type.as_ref().map(
3345 <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow,
3346 ),
3347 encoder,
3348 offset + cur_offset,
3349 depth,
3350 )?;
3351
3352 _prev_end_offset = cur_offset + envelope_size;
3353 if 3 > max_ordinal {
3354 return Ok(());
3355 }
3356
3357 let cur_offset: usize = (3 - 1) * envelope_size;
3360
3361 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3363
3364 fidl::encoding::encode_in_envelope_optional::<bool, D>(
3369 self.is_hw.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
3370 encoder,
3371 offset + cur_offset,
3372 depth,
3373 )?;
3374
3375 _prev_end_offset = cur_offset + envelope_size;
3376 if 4 > max_ordinal {
3377 return Ok(());
3378 }
3379
3380 let cur_offset: usize = (4 - 1) * envelope_size;
3383
3384 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3386
3387 fidl::encoding::encode_in_envelope_optional::<ProfileDescriptions, D>(
3392 self.profile_descriptions
3393 .as_ref()
3394 .map(<ProfileDescriptions as fidl::encoding::ValueTypeMarker>::borrow),
3395 encoder,
3396 offset + cur_offset,
3397 depth,
3398 )?;
3399
3400 _prev_end_offset = cur_offset + envelope_size;
3401
3402 Ok(())
3403 }
3404 }
3405
3406 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3407 for DetailedCodecDescription
3408 {
3409 #[inline(always)]
3410 fn new_empty() -> Self {
3411 Self::default()
3412 }
3413
3414 unsafe fn decode(
3415 &mut self,
3416 decoder: &mut fidl::encoding::Decoder<'_, D>,
3417 offset: usize,
3418 mut depth: fidl::encoding::Depth,
3419 ) -> fidl::Result<()> {
3420 decoder.debug_check_bounds::<Self>(offset);
3421 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3422 None => return Err(fidl::Error::NotNullable),
3423 Some(len) => len,
3424 };
3425 if len == 0 {
3427 return Ok(());
3428 };
3429 depth.increment()?;
3430 let envelope_size = 8;
3431 let bytes_len = len * envelope_size;
3432 let offset = decoder.out_of_line_offset(bytes_len)?;
3433 let mut _next_ordinal_to_read = 0;
3435 let mut next_offset = offset;
3436 let end_offset = offset + bytes_len;
3437 _next_ordinal_to_read += 1;
3438 if next_offset >= end_offset {
3439 return Ok(());
3440 }
3441
3442 while _next_ordinal_to_read < 1 {
3444 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3445 _next_ordinal_to_read += 1;
3446 next_offset += envelope_size;
3447 }
3448
3449 let next_out_of_line = decoder.next_out_of_line();
3450 let handles_before = decoder.remaining_handles();
3451 if let Some((inlined, num_bytes, num_handles)) =
3452 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3453 {
3454 let member_inline_size =
3455 <CodecType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3456 if inlined != (member_inline_size <= 4) {
3457 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3458 }
3459 let inner_offset;
3460 let mut inner_depth = depth.clone();
3461 if inlined {
3462 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3463 inner_offset = next_offset;
3464 } else {
3465 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3466 inner_depth.increment()?;
3467 }
3468 let val_ref = self.codec_type.get_or_insert_with(|| fidl::new_empty!(CodecType, D));
3469 fidl::decode!(CodecType, D, val_ref, decoder, inner_offset, inner_depth)?;
3470 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3471 {
3472 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3473 }
3474 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3475 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3476 }
3477 }
3478
3479 next_offset += envelope_size;
3480 _next_ordinal_to_read += 1;
3481 if next_offset >= end_offset {
3482 return Ok(());
3483 }
3484
3485 while _next_ordinal_to_read < 2 {
3487 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3488 _next_ordinal_to_read += 1;
3489 next_offset += envelope_size;
3490 }
3491
3492 let next_out_of_line = decoder.next_out_of_line();
3493 let handles_before = decoder.remaining_handles();
3494 if let Some((inlined, num_bytes, num_handles)) =
3495 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3496 {
3497 let member_inline_size =
3498 <fidl::encoding::BoundedString<256> as fidl::encoding::TypeMarker>::inline_size(
3499 decoder.context,
3500 );
3501 if inlined != (member_inline_size <= 4) {
3502 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3503 }
3504 let inner_offset;
3505 let mut inner_depth = depth.clone();
3506 if inlined {
3507 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3508 inner_offset = next_offset;
3509 } else {
3510 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3511 inner_depth.increment()?;
3512 }
3513 let val_ref = self
3514 .mime_type
3515 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<256>, D));
3516 fidl::decode!(
3517 fidl::encoding::BoundedString<256>,
3518 D,
3519 val_ref,
3520 decoder,
3521 inner_offset,
3522 inner_depth
3523 )?;
3524 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3525 {
3526 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3527 }
3528 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3529 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3530 }
3531 }
3532
3533 next_offset += envelope_size;
3534 _next_ordinal_to_read += 1;
3535 if next_offset >= end_offset {
3536 return Ok(());
3537 }
3538
3539 while _next_ordinal_to_read < 3 {
3541 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3542 _next_ordinal_to_read += 1;
3543 next_offset += envelope_size;
3544 }
3545
3546 let next_out_of_line = decoder.next_out_of_line();
3547 let handles_before = decoder.remaining_handles();
3548 if let Some((inlined, num_bytes, num_handles)) =
3549 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3550 {
3551 let member_inline_size =
3552 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3553 if inlined != (member_inline_size <= 4) {
3554 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3555 }
3556 let inner_offset;
3557 let mut inner_depth = depth.clone();
3558 if inlined {
3559 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3560 inner_offset = next_offset;
3561 } else {
3562 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3563 inner_depth.increment()?;
3564 }
3565 let val_ref = self.is_hw.get_or_insert_with(|| fidl::new_empty!(bool, D));
3566 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
3567 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3568 {
3569 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3570 }
3571 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3572 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3573 }
3574 }
3575
3576 next_offset += envelope_size;
3577 _next_ordinal_to_read += 1;
3578 if next_offset >= end_offset {
3579 return Ok(());
3580 }
3581
3582 while _next_ordinal_to_read < 4 {
3584 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3585 _next_ordinal_to_read += 1;
3586 next_offset += envelope_size;
3587 }
3588
3589 let next_out_of_line = decoder.next_out_of_line();
3590 let handles_before = decoder.remaining_handles();
3591 if let Some((inlined, num_bytes, num_handles)) =
3592 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3593 {
3594 let member_inline_size =
3595 <ProfileDescriptions as fidl::encoding::TypeMarker>::inline_size(
3596 decoder.context,
3597 );
3598 if inlined != (member_inline_size <= 4) {
3599 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3600 }
3601 let inner_offset;
3602 let mut inner_depth = depth.clone();
3603 if inlined {
3604 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3605 inner_offset = next_offset;
3606 } else {
3607 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3608 inner_depth.increment()?;
3609 }
3610 let val_ref = self
3611 .profile_descriptions
3612 .get_or_insert_with(|| fidl::new_empty!(ProfileDescriptions, D));
3613 fidl::decode!(ProfileDescriptions, D, val_ref, decoder, inner_offset, inner_depth)?;
3614 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3615 {
3616 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3617 }
3618 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3619 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3620 }
3621 }
3622
3623 next_offset += envelope_size;
3624
3625 while next_offset < end_offset {
3627 _next_ordinal_to_read += 1;
3628 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3629 next_offset += envelope_size;
3630 }
3631
3632 Ok(())
3633 }
3634 }
3635
3636 impl EncoderProfileDescription {
3637 #[inline(always)]
3638 fn max_ordinal_present(&self) -> u64 {
3639 if let Some(_) = self.profile {
3640 return 1;
3641 }
3642 0
3643 }
3644 }
3645
3646 impl fidl::encoding::ValueTypeMarker for EncoderProfileDescription {
3647 type Borrowed<'a> = &'a Self;
3648 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3649 value
3650 }
3651 }
3652
3653 unsafe impl fidl::encoding::TypeMarker for EncoderProfileDescription {
3654 type Owned = Self;
3655
3656 #[inline(always)]
3657 fn inline_align(_context: fidl::encoding::Context) -> usize {
3658 8
3659 }
3660
3661 #[inline(always)]
3662 fn inline_size(_context: fidl::encoding::Context) -> usize {
3663 16
3664 }
3665 }
3666
3667 unsafe impl<D: fidl::encoding::ResourceDialect>
3668 fidl::encoding::Encode<EncoderProfileDescription, D> for &EncoderProfileDescription
3669 {
3670 unsafe fn encode(
3671 self,
3672 encoder: &mut fidl::encoding::Encoder<'_, D>,
3673 offset: usize,
3674 mut depth: fidl::encoding::Depth,
3675 ) -> fidl::Result<()> {
3676 encoder.debug_check_bounds::<EncoderProfileDescription>(offset);
3677 let max_ordinal: u64 = self.max_ordinal_present();
3679 encoder.write_num(max_ordinal, offset);
3680 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3681 if max_ordinal == 0 {
3683 return Ok(());
3684 }
3685 depth.increment()?;
3686 let envelope_size = 8;
3687 let bytes_len = max_ordinal as usize * envelope_size;
3688 #[allow(unused_variables)]
3689 let offset = encoder.out_of_line_offset(bytes_len);
3690 let mut _prev_end_offset: usize = 0;
3691 if 1 > max_ordinal {
3692 return Ok(());
3693 }
3694
3695 let cur_offset: usize = (1 - 1) * envelope_size;
3698
3699 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3701
3702 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_media__common::CodecProfile, D>(
3707 self.profile.as_ref().map(<fidl_fuchsia_media__common::CodecProfile as fidl::encoding::ValueTypeMarker>::borrow),
3708 encoder, offset + cur_offset, depth
3709 )?;
3710
3711 _prev_end_offset = cur_offset + envelope_size;
3712
3713 Ok(())
3714 }
3715 }
3716
3717 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3718 for EncoderProfileDescription
3719 {
3720 #[inline(always)]
3721 fn new_empty() -> Self {
3722 Self::default()
3723 }
3724
3725 unsafe fn decode(
3726 &mut self,
3727 decoder: &mut fidl::encoding::Decoder<'_, D>,
3728 offset: usize,
3729 mut depth: fidl::encoding::Depth,
3730 ) -> fidl::Result<()> {
3731 decoder.debug_check_bounds::<Self>(offset);
3732 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3733 None => return Err(fidl::Error::NotNullable),
3734 Some(len) => len,
3735 };
3736 if len == 0 {
3738 return Ok(());
3739 };
3740 depth.increment()?;
3741 let envelope_size = 8;
3742 let bytes_len = len * envelope_size;
3743 let offset = decoder.out_of_line_offset(bytes_len)?;
3744 let mut _next_ordinal_to_read = 0;
3746 let mut next_offset = offset;
3747 let end_offset = offset + bytes_len;
3748 _next_ordinal_to_read += 1;
3749 if next_offset >= end_offset {
3750 return Ok(());
3751 }
3752
3753 while _next_ordinal_to_read < 1 {
3755 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3756 _next_ordinal_to_read += 1;
3757 next_offset += envelope_size;
3758 }
3759
3760 let next_out_of_line = decoder.next_out_of_line();
3761 let handles_before = decoder.remaining_handles();
3762 if let Some((inlined, num_bytes, num_handles)) =
3763 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3764 {
3765 let member_inline_size = <fidl_fuchsia_media__common::CodecProfile as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3766 if inlined != (member_inline_size <= 4) {
3767 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3768 }
3769 let inner_offset;
3770 let mut inner_depth = depth.clone();
3771 if inlined {
3772 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3773 inner_offset = next_offset;
3774 } else {
3775 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3776 inner_depth.increment()?;
3777 }
3778 let val_ref = self.profile.get_or_insert_with(|| {
3779 fidl::new_empty!(fidl_fuchsia_media__common::CodecProfile, D)
3780 });
3781 fidl::decode!(
3782 fidl_fuchsia_media__common::CodecProfile,
3783 D,
3784 val_ref,
3785 decoder,
3786 inner_offset,
3787 inner_depth
3788 )?;
3789 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3790 {
3791 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3792 }
3793 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3794 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3795 }
3796 }
3797
3798 next_offset += envelope_size;
3799
3800 while next_offset < end_offset {
3802 _next_ordinal_to_read += 1;
3803 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3804 next_offset += envelope_size;
3805 }
3806
3807 Ok(())
3808 }
3809 }
3810
3811 impl fidl::encoding::ValueTypeMarker for ProfileDescriptions {
3812 type Borrowed<'a> = &'a Self;
3813 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3814 value
3815 }
3816 }
3817
3818 unsafe impl fidl::encoding::TypeMarker for ProfileDescriptions {
3819 type Owned = Self;
3820
3821 #[inline(always)]
3822 fn inline_align(_context: fidl::encoding::Context) -> usize {
3823 8
3824 }
3825
3826 #[inline(always)]
3827 fn inline_size(_context: fidl::encoding::Context) -> usize {
3828 16
3829 }
3830 }
3831
3832 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ProfileDescriptions, D>
3833 for &ProfileDescriptions
3834 {
3835 #[inline]
3836 unsafe fn encode(
3837 self,
3838 encoder: &mut fidl::encoding::Encoder<'_, D>,
3839 offset: usize,
3840 _depth: fidl::encoding::Depth,
3841 ) -> fidl::Result<()> {
3842 encoder.debug_check_bounds::<ProfileDescriptions>(offset);
3843 encoder.write_num::<u64>(self.ordinal(), offset);
3844 match self {
3845 ProfileDescriptions::DecoderProfileDescriptions(ref val) => {
3846 fidl::encoding::encode_in_envelope::<fidl::encoding::Vector<DecoderProfileDescription, 256>, D>(
3847 <fidl::encoding::Vector<DecoderProfileDescription, 256> as fidl::encoding::ValueTypeMarker>::borrow(val),
3848 encoder, offset + 8, _depth
3849 )
3850 }
3851 ProfileDescriptions::EncoderProfileDescriptions(ref val) => {
3852 fidl::encoding::encode_in_envelope::<fidl::encoding::Vector<EncoderProfileDescription, 256>, D>(
3853 <fidl::encoding::Vector<EncoderProfileDescription, 256> as fidl::encoding::ValueTypeMarker>::borrow(val),
3854 encoder, offset + 8, _depth
3855 )
3856 }
3857 }
3858 }
3859 }
3860
3861 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ProfileDescriptions {
3862 #[inline(always)]
3863 fn new_empty() -> Self {
3864 Self::DecoderProfileDescriptions(
3865 fidl::new_empty!(fidl::encoding::Vector<DecoderProfileDescription, 256>, D),
3866 )
3867 }
3868
3869 #[inline]
3870 unsafe fn decode(
3871 &mut self,
3872 decoder: &mut fidl::encoding::Decoder<'_, D>,
3873 offset: usize,
3874 mut depth: fidl::encoding::Depth,
3875 ) -> fidl::Result<()> {
3876 decoder.debug_check_bounds::<Self>(offset);
3877 #[allow(unused_variables)]
3878 let next_out_of_line = decoder.next_out_of_line();
3879 let handles_before = decoder.remaining_handles();
3880 let (ordinal, inlined, num_bytes, num_handles) =
3881 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
3882
3883 let member_inline_size = match ordinal {
3884 1 => <fidl::encoding::Vector<DecoderProfileDescription, 256> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3885 2 => <fidl::encoding::Vector<EncoderProfileDescription, 256> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3886 _ => return Err(fidl::Error::UnknownUnionTag),
3887 };
3888
3889 if inlined != (member_inline_size <= 4) {
3890 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3891 }
3892 let _inner_offset;
3893 if inlined {
3894 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
3895 _inner_offset = offset + 8;
3896 } else {
3897 depth.increment()?;
3898 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3899 }
3900 match ordinal {
3901 1 => {
3902 #[allow(irrefutable_let_patterns)]
3903 if let ProfileDescriptions::DecoderProfileDescriptions(_) = self {
3904 } else {
3906 *self = ProfileDescriptions::DecoderProfileDescriptions(
3908 fidl::new_empty!(fidl::encoding::Vector<DecoderProfileDescription, 256>, D),
3909 );
3910 }
3911 #[allow(irrefutable_let_patterns)]
3912 if let ProfileDescriptions::DecoderProfileDescriptions(ref mut val) = self {
3913 fidl::decode!(fidl::encoding::Vector<DecoderProfileDescription, 256>, D, val, decoder, _inner_offset, depth)?;
3914 } else {
3915 unreachable!()
3916 }
3917 }
3918 2 => {
3919 #[allow(irrefutable_let_patterns)]
3920 if let ProfileDescriptions::EncoderProfileDescriptions(_) = self {
3921 } else {
3923 *self = ProfileDescriptions::EncoderProfileDescriptions(
3925 fidl::new_empty!(fidl::encoding::Vector<EncoderProfileDescription, 256>, D),
3926 );
3927 }
3928 #[allow(irrefutable_let_patterns)]
3929 if let ProfileDescriptions::EncoderProfileDescriptions(ref mut val) = self {
3930 fidl::decode!(fidl::encoding::Vector<EncoderProfileDescription, 256>, D, val, decoder, _inner_offset, depth)?;
3931 } else {
3932 unreachable!()
3933 }
3934 }
3935 ordinal => panic!("unexpected ordinal {:?}", ordinal),
3936 }
3937 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
3938 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3939 }
3940 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3941 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3942 }
3943 Ok(())
3944 }
3945 }
3946}