fidl_fuchsia_mediacodec_common/
fidl_fuchsia_mediacodec_common.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11/// Constrain the length of the vector indicated via `OnCodecList`, and constrain the max items in
12/// any vector within the response from `GetDetailedCodecDescriptions`.  The overall enforced limit
13/// for codec caps information is the max channel message size however, since nested vectors each of
14/// max size could otherwise exceed the max channel message size.
15pub const CODEC_FACTORY_CODEC_LIST_SIZE_MAX: u32 = 256;
16
17/// More than this many calls to AttachLifetimeTracking()
18/// without a Create{X}() call will result in CodecFactory channel closing from
19/// the server end.
20pub const CODEC_FACTORY_LIFETIME_TRACKING_EVENTPAIR_PER_CREATE_MAX: u32 = 16;
21
22/// Constrain the mime_type to a size that won't cause problems.
23pub 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    #[deprecated = "Strict enums should not use `is_unknown`"]
48    #[inline]
49    pub fn is_unknown(&self) -> bool {
50        false
51    }
52}
53
54/// Whether buffers need to be secure.  If not specified, the default is OFF.
55///
56/// This enum may have additional values added later; code handling this type
57/// should be written with this in mind.  For example, in C++, having a
58/// "default" case in any switch statement on this type will avoid compilation
59/// warnings/errors when a new value is added.
60#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
61#[repr(u32)]
62pub enum SecureMemoryMode {
63    Off = 0,
64    On = 1,
65}
66
67impl SecureMemoryMode {
68    #[inline]
69    pub fn from_primitive(prim: u32) -> Option<Self> {
70        match prim {
71            0 => Some(Self::Off),
72            1 => Some(Self::On),
73            _ => None,
74        }
75    }
76
77    #[inline]
78    pub const fn into_primitive(self) -> u32 {
79        self as u32
80    }
81
82    #[deprecated = "Strict enums should not use `is_unknown`"]
83    #[inline]
84    pub fn is_unknown(&self) -> bool {
85        false
86    }
87}
88
89/// Deprecated.
90///
91/// Rather than listening for OnCodecList, clients needing codec information prior to just
92/// requesting a codec with CodecFactory.CreateDecoder or CodecFactory.CreateEncoder should instead
93/// use GetDetailedCodecDescriptions to get the DetailedCodecDescription table instead, which has
94/// per-profile-entry equivalents of all these fields.  Clients with no real need for codec
95/// information prior to requesting a codec can call CodecFactory.CreateDecoder or
96/// CodecFactory.CreateEncoder with relevant requirements set in that request, and then
97/// StreamProcessor.Sync to see if a codec was actually created successfully.
98///
99/// In contrast to OnCodecList which uses FIDL structs (due to ordering of historical events),
100/// GetDetailedCodecDescriptions uses FIDL tables so is not expected to need to be deprecated, since
101/// we can add new table fields as needed, and gradually deprecate old table fields if appropriate,
102/// without deprecating the whole thing.
103///
104/// Per-codec servers do not need to fill out this struct or send OnCodecList, as the main
105/// CodecFactory will construct the OnCodecList info from the GetDetailedCodecDescriptions info, so
106/// that each codec can (optionally) stop sending OnCodecList immediately, rather than having to
107/// wait for all clients to stop listening to OnCodecList, which may take a while.  All codecs _do_
108/// need to implement GetDetailedCodecDescriptions however.
109#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
110pub struct CodecDescription {
111    /// Decoder or encoder.
112    pub codec_type: CodecType,
113    /// The mime type of the compressed format.  For decoders this is the mime
114    /// type of the input.  For encoders, this is the mime type of the output.
115    pub mime_type: String,
116    /// For each of these fields, the default is the most-capable setting, but
117    /// if a codec doesn't support the most-capable behavior, then the codec
118    /// must override the default.
119    pub can_stream_bytes_input: bool,
120    pub can_find_start: bool,
121    pub can_re_sync: bool,
122    pub will_report_all_detected_errors: bool,
123    pub is_hw: bool,
124    pub split_header_handling: bool,
125}
126
127impl fidl::Persistable for CodecDescription {}
128
129#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
130pub struct CodecFactoryOnCodecListRequest {
131    pub codecs: Vec<CodecDescription>,
132}
133
134impl fidl::Persistable for CodecFactoryOnCodecListRequest {}
135
136#[derive(Clone, Debug, Default, PartialEq)]
137pub struct CodecFactoryGetDetailedCodecDescriptionsResponse {
138    pub codecs: Option<Vec<DetailedCodecDescription>>,
139    #[doc(hidden)]
140    pub __source_breaking: fidl::marker::SourceBreaking,
141}
142
143impl fidl::Persistable for CodecFactoryGetDetailedCodecDescriptionsResponse {}
144
145#[derive(Clone, Debug, Default, PartialEq)]
146pub struct CreateDecoderParams {
147    /// Input mime type for a decoder.
148    ///
149    /// The recognized mime types for now:
150    /// video/h264
151    /// video/vp9
152    /// audio/aac
153    ///   input_details.oob_bytes must be an AudioSpecificConfig() as defined
154    ///   by AAC spec.
155    /// audio/sbc
156    ///   input_details.oob_bytes must be Codec Specific Information Elements
157    ///   for SBC as defined by the A2DP spec.
158    pub input_details: Option<fidl_fuchsia_media::FormatDetails>,
159    /// This must be true in order for the client to be permitted to put a
160    /// timestamp on an input packet, which is in turn required to get any
161    /// timestamps on any output packets.
162    ///
163    /// It is always legal to provide separate Access Units (henceforth AUs) to a
164    /// decoder, but this boolean must be true for a decoder to accept and
165    /// propagate timestamp values.
166    ///
167    /// This must be true when creating a video encoder, or the CodecFactory
168    /// channel will close.
169    ///
170    /// If not set, interpreted as false.
171    pub promise_separate_access_units_on_input: Option<bool>,
172    /// Require that the selected codec be capable of accepting input where
173    /// AUs are not separated into separate packets.
174    ///
175    /// This does not imply that the decoder can find the start of the first AU;
176    /// for that see require_can_find_start.  This does not imply that the decoder
177    /// can re-sync on its own if the stream data is damaged; for that see
178    /// require_can_re_sync.
179    ///
180    /// If both promise_separate_access_units_on_input and
181    /// require_can_stream_bytes_input are true, the CodecFactory channel will
182    /// close.
183    ///
184    /// If this is false, the client must feed separate AUs on the fuchsia.ui.input.  This
185    /// must be false for a video encoder, and if true the CodecFactory channel
186    /// will close.
187    ///
188    /// Unless a client demands a decoder capable of taking concatenated AUs
189    /// (require_can_stream_bytes_input true), the client must feed a decoder
190    /// separate AUs.  This means the client cannot have parts of two separate AUs
191    /// in the same packet, unless require_can_stream_bytes_input is true.
192    ///
193    /// If not set, interpreted as false.
194    pub require_can_stream_bytes_input: Option<bool>,
195    /// A decoder is allowed to be capable of streaming bytes but not capable of
196    /// searching for the start of the first usable AU.  To require both, set both
197    /// require_can_stream_bytes_input and require_can_find_start.  Setting
198    /// require_can_find_start without require_can_stream_bytes_input is invalid.
199    ///
200    /// With require_can_stream_bytes_input true but require_can_find_start false,
201    /// the client must start the first packet with the start of an AU, but can
202    /// send a stream of bytes after that.
203    ///
204    /// If not set, interpreted as false.
205    pub require_can_find_start: Option<bool>,
206    /// On problematic input data, all decoders are expected to at least be able to
207    /// close the channel rather than getting stuck in a failed and/or broken
208    /// state.
209    ///
210    /// A decoder returned from a request with require_can_re_sync is potentially
211    /// able to handle damaged input without closing the Codec channel.  Such a
212    /// Codec is encouraged, but not required, to also satisfy requirements of
213    /// require_report_all_detected_errors.
214    ///
215    /// If not set, interpreted as false.
216    pub require_can_re_sync: Option<bool>,
217    /// Sometimes a client would rather fail an overall use of a decoder than fail
218    /// to notice data corruption.  For such scenarios, the client can specify
219    /// require_report_all_detected_errors.  For any codec returned from a
220    /// request with require_report_all_detected_errors set, on detection of
221    /// any input data corruption the codec will report in one or more of these
222    /// ways:
223    ///   * closing the Codec channel
224    ///   * OnStreamFailed()
225    ///   * error_detected_before
226    ///   * error_detected_during
227    ///
228    /// If false, a codec may silently skip past corrupted input data.
229    ///
230    /// No decoder can detect all corruption, because some corruption can look like
231    /// valid stream data.  This requirement is only to request a codec that
232    /// is written to attempt to detect _and report_ input stream corruption.
233    ///
234    /// This flag is not intended to be 100% bulletproof.  If a client needs robust
235    /// assurance that _all_ detectable stream corruption is _always_ detected,
236    /// this flag is not enough of a guarantee to achieve that.  Since some stream
237    /// corruption is inherently non-detectable in any case, such a client should
238    /// consider using stronger techniques upstream to ensure that corruption can
239    /// be detected with the needed probability very close to 1.
240    ///
241    /// This flag being true doesn't imply anything about whether the codec will
242    /// discard damaged data vs. producing corresponding damaged output.  Only that
243    /// the codec will set error_detected_* bools to true when appropriate.
244    ///
245    /// Regardless of this setting, not all timestamp_ish values provided on input
246    /// are guaranteed to show up on output.
247    ///
248    /// If not set, interpreted as false.
249    pub require_report_all_detected_errors: Option<bool>,
250    /// If true, require that the returned codec is HW-accelerated.  See also
251    /// `require_sw`.
252    ///
253    /// If not set, interpreted as false.
254    pub require_hw: Option<bool>,
255    /// permit_lack_of_split_header_handling
256    ///
257    /// This field is a temporary field that will be going away.
258    ///
259    /// TODO(dustingreen): Remove this field once we're down to zero codecs with
260    /// problems handling split headers.
261    ///
262    /// By default, a Codec instance is required to handle "split headers", meaning
263    /// that a client is allowed to deliver parts of an AU one byte at a time,
264    /// including parts near the beginning of the AU, and the codec is required to
265    /// tolerate and handle that properly.  However, unfortunately not all codecs
266    /// properly support split headers.  If a client is willing to permit such a
267    /// codec to be used, the client can set this to true.  Clients are not
268    /// encouraged to set this, but setting it may be necessary to find a codec for
269    /// some formats _for now_.  If a client sets this to true, the client should
270    /// deliver data of each AU with many contiguous non-split bytes from the start
271    /// of each AU.  The client is not strictly required to deliver one AU at a
272    /// time, only to ensure that either all the AU bytes are in a single packet or
273    /// that many bytes at the start of each AU are in a single packet.
274    ///
275    /// The specification for how a client should use this and how a client should
276    /// behave if setting this to true is intentionally vague, because lack of
277    /// support for header splitting is not ideal, and is expected to be
278    /// temporary, and all codecs should handle split headers in the long run.
279    /// The main intent of this field is to avoid giving an innocent client using
280    /// default value of false here a codec that can't properly handle split
281    /// headers.  This is not an attempt at a mechanism to fully work around a
282    /// codec that doesn't handle split headers.
283    ///
284    /// If not set, interpreted as false.
285    pub permit_lack_of_split_header_handling: Option<bool>,
286    /// If set to ON, the decoder must support secure buffers on output, and
287    /// must reject non-secure buffers on output.
288    ///
289    /// If set to OFF or not set, the created decoder will reject secure buffers
290    /// on output by closing the StreamProcessor channel.
291    ///
292    /// If secure_input_mode ON, secure_output_mode must also be ON.
293    pub secure_output_mode: Option<SecureMemoryMode>,
294    /// If set to ON, the decoder must support secure buffers on input and must
295    /// reject non-secure buffers on input.
296    ///
297    /// If set to OFF or not set, the created decoder will reject secure buffers
298    /// on input by closing the StreamProcessor channel.
299    ///
300    /// If secure_input_mode ON, secure_output_mode must also be ON.
301    pub secure_input_mode: Option<SecureMemoryMode>,
302    /// If true, require that the returned codec is entirely SW-based, not
303    /// HW-accelerated (other than possibly using vector CPU instructions).
304    /// This can be useful for testing purposes or other special scenarios, but
305    /// is not recommended for performance-sensitive scenarios.  Also, some
306    /// builds may lack a SW-based decoder for some formats.  See also
307    /// `require_hw`.
308    ///
309    /// If not set, interpreted as false.
310    pub require_sw: Option<bool>,
311    #[doc(hidden)]
312    pub __source_breaking: fidl::marker::SourceBreaking,
313}
314
315impl fidl::Persistable for CreateDecoderParams {}
316
317/// Parameters used to request an encoder.
318#[derive(Clone, Debug, Default, PartialEq)]
319pub struct CreateEncoderParams {
320    /// The format of the uncompressed input data.
321    ///
322    /// This field should be a raw mime_type (e.g. 'video/raw') and uncompressed
323    /// format details for the encoder to use when reading buffers.
324    ///
325    /// To be elibigible an encoder must support the input format.
326    pub input_details: Option<fidl_fuchsia_media::FormatDetails>,
327    /// If true, require that the returned codec is HW-accelerated.
328    ///
329    /// If not set, interpreted as false.
330    pub require_hw: Option<bool>,
331    #[doc(hidden)]
332    pub __source_breaking: fidl::marker::SourceBreaking,
333}
334
335impl fidl::Persistable for CreateEncoderParams {}
336
337/// Specification of the supported parameters of a given video decoder.
338///
339/// Fields in this table with the same name as fields in CodecDescription have the same meaning as
340/// the fields in the CodecDescription struct when the corresponding field in this table is set.
341///
342/// When a corresponding field is un-set, each of these fields is interpreted according to the
343/// corresponding doc comment on the field in this table (doc comments on fields in the
344/// CodecDescription struct re. struct field defaults are not relevant to the interpretation of
345/// un-set fields of this table).
346///
347/// For video decoders, the following is always required:
348///   * Handling split input payload (distinct from split header), when an input frame is too large
349///     for a single input buffer.  The next portion (possibly the remainder) of the timstamped
350///     input chunk is delivered in the next input packet.
351///
352/// For audio decoders, the following is always required:
353///   * Concatenation of multiple compressed audio chunks via the input is always permitted.
354#[derive(Clone, Debug, Default, PartialEq)]
355pub struct DecoderProfileDescription {
356    /// The codec profile that this decoder supports. If the client wants to use this
357    /// profile, the requirements specified in this table must be adhered to.
358    pub profile: Option<fidl_fuchsia_media::CodecProfile>,
359    /// The minimum image size this decoder supports for the given |profile|.
360    /// Decoders must set this field, and this field must specify a size that is
361    /// >= the min size defined for the profile in the codec spec.
362    ///
363    /// This size refers to the pixel layout in memory, not the display_rect which can be smaller
364    /// than the fuchsia.Images2.ImageFormat.size / fuchsia.sysmem.ImageFormat2.coded_width/height.
365    pub min_image_size: Option<fidl_fuchsia_math::SizeU>,
366    /// The maximum image size this decoder supports for the given |profile|.
367    ///
368    /// Decoders must set this field, and this field must specify a size that is <= the max size
369    /// defined for the profile in the codec spec.
370    ///
371    /// This size refers to the pixel layout in memory, not the display_rect which can be smaller
372    /// than the fuchsia.Images2.ImageFormat.size / fuchsia.sysmem.ImageFormat2.coded_width/height.
373    ///
374    /// By setting this field, a decoder is not required to fail to decode a stream that specifies a
375    /// size that is larger than the profile of the stream would normally allow. The decoder may or
376    /// may not fail to decode a stream which is not a listed profile or not within the size bounds
377    /// of a listed profile.
378    pub max_image_size: Option<fidl_fuchsia_math::SizeU>,
379    /// This |profile| entry can apply to encrypted input data. If require_encryption is false or
380    /// unset, this |profile| entry can also apply to unencrypted input data.
381    ///
382    /// This will be un-set (even when allow_input_protection or require_input_protection are true)
383    /// until Fuchsia supports decryption as part of decode (in contrast to it being a separate step
384    /// involving protected memory in between).  When allow_encryption is false/un-set but
385    /// allow_input_protection is true, a client setting up DRM decode should set up decryption as a
386    /// separate step prior to decode with protected memory in between the decrypt and decode.
387    pub allow_encryption: Option<bool>,
388    /// This |profile| entry applies only when input data is encrypted.  This |profile| entry does
389    /// not apply for unencrypted input data.  Un-set is interepted as false.
390    ///
391    /// If this is set to true and there is no profile with require_encryption false in the same
392    /// DetailedCodecDescription, then this decoder only supports encrypted input.
393    ///
394    /// This will be un-set until Fuchsia supports decryption as part of decode (even when
395    /// allow_input_protection or require_input_protection are true).  See also allow_encryption,
396    /// allow_input_protection, require_input_protection.
397    pub require_encryption: Option<bool>,
398    /// This |profile| entry can apply when input data delivered via protected memory.  Whether to
399    /// protect input and which protected "heap" to use (if protecting input) is determined during
400    /// sysmem constraints aggregation and via DRM mechanisms.  See also require_input_protection,
401    /// allow_encryption, require_encryption.
402    pub allow_input_protection: Option<bool>,
403    /// This |profile| entry applies only when input data is delivered via protected memory. Whether
404    /// to protect input and which protected "heap" to use (if protecting input) is determined
405    /// during sysmem constraints aggregation, and by separate DRM mechanisms.
406    ///
407    /// If this is set to true and there is no profile with require_input_protection false in the
408    /// same DetailedCodecDescription, then this decoder only supports protected input.
409    ///
410    /// Output protection is negotiated separately during output buffer constraints aggregation in
411    /// sysmem, and via DRM mechanisms.
412    ///
413    /// See also allow_input_protection, allow_encryption, require_encryption.
414    pub require_input_protection: Option<bool>,
415    /// If set to true, the decoder can handle an input chunk payload (containing compressed data)
416    /// that's split across a packet boundary (between header and payload, or between payload
417    /// bytes), and the decoder can also handle more than one input chunk containing compressed
418    /// input data in a single input packet. See also split_header_handling to determine if the
419    /// decoder can also handle split headers.
420    ///
421    /// Un-set means false.
422    ///
423    /// While this field always indicates whether it's ok to split an input chunk across a packet
424    /// boundary or not, and this field being set always implies it's ok to have a single input
425    /// packet with bytes from more than one input chunk including when the input chunks contain
426    /// compressed input data, there is some additional somewhat-subtle meaning that differs between
427    /// video and audio decoders.
428    ///
429    /// Audio decoders are always required to permit more than one input chunk in a single input
430    /// packet, including mulitple input chunks which each contain compressed input data (not just
431    /// prepended "context" headers), regardless of this field being set or unset.  For audio
432    /// decoders, this field only indicates whether splitting an input chunk across packets is
433    /// allowed.
434    ///
435    /// Audio decoders shouldn't set split_header_handling to true unless they also set
436    /// can_stream_bytes_input to true, since allowing splitting header bytes is meaningless unless
437    /// it's allowed to split an input chunk.
438    ///
439    /// For video decoders, if this field is un-set or false, the decoder may not be able to handle
440    /// bytes of more than one input chunk in a single input packet.  However, for all decoders
441    /// (both video and audio) it's always ok for preceding "context" headers such as the h264 SPS
442    /// and PPS headers to be in the same input packet as the following input chunk containing
443    /// compressed input data such as an h264 slice (for example).  A video decoder is always
444    /// required to permit continuation of an input chunk in the next packet, with the split between
445    /// header byte and compressed input data byte or between two compressed input data bytes (but
446    /// not necessarily between two header bytes; see also split_header_handling).
447    ///
448    /// It's expected to be fairly common for a decoder to set can_stream_bytes_input to true, but
449    /// leave split_header_handling un-set or set split_header_handling to false, due to parsing
450    /// limitations in the HW, FW, or driver.  Decoders which set can_stream_bytes_input false or
451    /// leave can_stream_bytes_input un-set may be forcing input data to be re-packed in some
452    /// scenarios.  Profiles which set allow_encryption are encouraged to also set
453    /// can_stream_bytes_input if feasible, as re-packing input data can be more difficult in some
454    /// scenarios involving encryption.
455    pub can_stream_bytes_input: Option<bool>,
456    /// If set to true, the decoder can scan forward at the start of a stream to find the start of
457    /// the first fully-present input chunk, even if the input data starts at a byte that's in the
458    /// middle of a chunk.
459    ///
460    /// For both video and audio decoders, setting this field to true also indicates the ability to
461    /// handle (skip or only partly use) any input chunks that are not possible to decode (or not
462    /// possible to fully decode) due to lack of referenced prior data.
463    ///
464    /// If un-set or false, the decoder may not be able to scan forward to sync up with the input
465    /// stream unless the input stream starts with the beginning of a suitable chunk.
466    pub can_find_start: Option<bool>,
467    /// If set to true, the decoder can resynchronize with the input stream (eventually) despite a
468    /// missing input chunk, and can handle partial input chunks without failing the stream or the
469    /// StreamProcessor control connection.
470    pub can_re_sync: Option<bool>,
471    /// If set to true, the decoder makes efforts to indicate partial or detected-as-missing or
472    /// detected-as-corrupt input chunks by setting error_detected_before and/or
473    /// error_detected_during as appropriate.  Even when this field is set to true, it is worth
474    /// noting that in general it is not possible for a decoder to detect all possible data
475    /// corruptions, as codecs generally aren't inclined to include error detection bits within the
476    /// stream.  This is not a replacment for a real (as in robust with high probability against
477    /// random bit flips and bit insertion/deletion) data integrity check.
478    pub will_report_all_detected_errors: Option<bool>,
479    /// If set to true, the decoder can handle the bytes of any header being split across packet
480    /// boundaries.  If false or un-set, the decoder requires all header bytes of a header to be
481    /// within the same packet.
482    ///
483    /// Starting a new packet at the spec-defined boundary between two headers that are officially
484    /// in separate input chunks is always permitted.
485    ///
486    /// For purposes of this field, headers like the h264 SPS and PPS headers are considered
487    /// separate input chunks, and so such headers that have their own input chunk can be delivered
488    /// in a separate packet regardless of the setting of this field, and a subsequent h264 slice
489    /// header can be in yet another packet.
490    ///
491    /// It is always permissible regardless of the setting of this field for "context" headers (such
492    /// as h264 SPS and PPS headers) to be delivered in the same packet as the subsequent chunk
493    /// which conveys compressed image data (such as an h264 slice).
494    ///
495    /// Splitting a single header between codec_oob_bytes and the stream data is never supported (as
496    /// in, never to be relied on by clients), not even when this field is set to true.
497    ///
498    /// See also can_stream_bytes_input.
499    ///
500    /// Video decoders with can_stream_bytes_input true but split_header_handling false can handle
501    /// continuing an chunk in the next packet when split between header and payload or between
502    /// payload bytes, and can handle bytes of more than one input chunk in a single input packet,
503    /// but cannot handle splitting a header across packets. Video decoders with
504    /// can_stream_bytes_input false and split_header_handling true cannot tolerate bytes of more
505    /// than one input chunk in a single packet, but can tolerate continuation of an input chunk in
506    /// a following packet regardless of where the split occurs (such as in the middle of an h264
507    /// SPS, PPS, or slice header).
508    ///
509    /// Audio decoders shouldn't set split_header_handling to true unless they also set
510    /// can_stream_bytes_input to true, since for an audio decoder, allowing splitting header bytes
511    /// is meaningless (for audio decoders) unless also allowing splitting an input chunk.
512    pub split_header_handling: Option<bool>,
513    #[doc(hidden)]
514    pub __source_breaking: fidl::marker::SourceBreaking,
515}
516
517impl fidl::Persistable for DecoderProfileDescription {}
518
519/// Clients needing codec information prior to just requesting a codec with
520/// CodecFactory.CreateDecoder or CodecFactory.CreateEncoder should use GetDetailedCodecDescriptions
521/// to get this table, which has details re. the codec and the profile entries supported by the
522/// codec.
523///
524/// Clients with no real need for codec information prior to requesting a codec can simply use
525/// CodecFactory.CreateDecoder or CodecFactory.CreateEncoder with relevant requirements set in that
526/// request, and then call StreamProcessor.Sync (round trip) to see if a codec was created
527/// successfully.
528#[derive(Clone, Debug, Default, PartialEq)]
529pub struct DetailedCodecDescription {
530    /// Decoder or encoder.
531    pub codec_type: Option<CodecType>,
532    /// The mime type of the compressed format.  For decoders this is the mime
533    /// type of the input.  For encoders, this is the mime type of the output.
534    pub mime_type: Option<String>,
535    /// If this decoder/encoder uses underlying hardware to perform its operations.
536    pub is_hw: Option<bool>,
537    /// A list of profile descriptions that describe what codec profiles this
538    /// encoder/decoder supports along with requirements for using each profile.
539    pub profile_descriptions: Option<ProfileDescriptions>,
540    #[doc(hidden)]
541    pub __source_breaking: fidl::marker::SourceBreaking,
542}
543
544impl fidl::Persistable for DetailedCodecDescription {}
545
546#[derive(Clone, Debug, Default, PartialEq)]
547pub struct EncoderProfileDescription {
548    pub profile: Option<fidl_fuchsia_media::CodecProfile>,
549    #[doc(hidden)]
550    pub __source_breaking: fidl::marker::SourceBreaking,
551}
552
553impl fidl::Persistable for EncoderProfileDescription {}
554
555#[derive(Clone, Debug, PartialEq)]
556pub enum ProfileDescriptions {
557    /// A list of |DecoderProfileDescription| that describe what codec profiles this
558    /// decoder supports along with requirements that must be adhered to if the client
559    /// is to use the decoder. The CodecFactory guarantees to the client that each
560    /// |DecoderProfileDescription| within |decoder_profile_descriptions| will have an
561    /// unique |profile|.
562    DecoderProfileDescriptions(Vec<DecoderProfileDescription>),
563    EncoderProfileDescriptions(Vec<EncoderProfileDescription>),
564}
565
566impl ProfileDescriptions {
567    #[inline]
568    pub fn ordinal(&self) -> u64 {
569        match *self {
570            Self::DecoderProfileDescriptions(_) => 1,
571            Self::EncoderProfileDescriptions(_) => 2,
572        }
573    }
574
575    #[deprecated = "Strict unions should not use `is_unknown`"]
576    #[inline]
577    pub fn is_unknown(&self) -> bool {
578        false
579    }
580}
581
582impl fidl::Persistable for ProfileDescriptions {}
583
584mod internal {
585    use super::*;
586    unsafe impl fidl::encoding::TypeMarker for CodecType {
587        type Owned = Self;
588
589        #[inline(always)]
590        fn inline_align(_context: fidl::encoding::Context) -> usize {
591            std::mem::align_of::<u32>()
592        }
593
594        #[inline(always)]
595        fn inline_size(_context: fidl::encoding::Context) -> usize {
596            std::mem::size_of::<u32>()
597        }
598
599        #[inline(always)]
600        fn encode_is_copy() -> bool {
601            true
602        }
603
604        #[inline(always)]
605        fn decode_is_copy() -> bool {
606            false
607        }
608    }
609
610    impl fidl::encoding::ValueTypeMarker for CodecType {
611        type Borrowed<'a> = Self;
612        #[inline(always)]
613        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
614            *value
615        }
616    }
617
618    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for CodecType {
619        #[inline]
620        unsafe fn encode(
621            self,
622            encoder: &mut fidl::encoding::Encoder<'_, D>,
623            offset: usize,
624            _depth: fidl::encoding::Depth,
625        ) -> fidl::Result<()> {
626            encoder.debug_check_bounds::<Self>(offset);
627            encoder.write_num(self.into_primitive(), offset);
628            Ok(())
629        }
630    }
631
632    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CodecType {
633        #[inline(always)]
634        fn new_empty() -> Self {
635            Self::Decoder
636        }
637
638        #[inline]
639        unsafe fn decode(
640            &mut self,
641            decoder: &mut fidl::encoding::Decoder<'_, D>,
642            offset: usize,
643            _depth: fidl::encoding::Depth,
644        ) -> fidl::Result<()> {
645            decoder.debug_check_bounds::<Self>(offset);
646            let prim = decoder.read_num::<u32>(offset);
647
648            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
649            Ok(())
650        }
651    }
652    unsafe impl fidl::encoding::TypeMarker for SecureMemoryMode {
653        type Owned = Self;
654
655        #[inline(always)]
656        fn inline_align(_context: fidl::encoding::Context) -> usize {
657            std::mem::align_of::<u32>()
658        }
659
660        #[inline(always)]
661        fn inline_size(_context: fidl::encoding::Context) -> usize {
662            std::mem::size_of::<u32>()
663        }
664
665        #[inline(always)]
666        fn encode_is_copy() -> bool {
667            true
668        }
669
670        #[inline(always)]
671        fn decode_is_copy() -> bool {
672            false
673        }
674    }
675
676    impl fidl::encoding::ValueTypeMarker for SecureMemoryMode {
677        type Borrowed<'a> = Self;
678        #[inline(always)]
679        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
680            *value
681        }
682    }
683
684    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
685        for SecureMemoryMode
686    {
687        #[inline]
688        unsafe fn encode(
689            self,
690            encoder: &mut fidl::encoding::Encoder<'_, D>,
691            offset: usize,
692            _depth: fidl::encoding::Depth,
693        ) -> fidl::Result<()> {
694            encoder.debug_check_bounds::<Self>(offset);
695            encoder.write_num(self.into_primitive(), offset);
696            Ok(())
697        }
698    }
699
700    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SecureMemoryMode {
701        #[inline(always)]
702        fn new_empty() -> Self {
703            Self::Off
704        }
705
706        #[inline]
707        unsafe fn decode(
708            &mut self,
709            decoder: &mut fidl::encoding::Decoder<'_, D>,
710            offset: usize,
711            _depth: fidl::encoding::Depth,
712        ) -> fidl::Result<()> {
713            decoder.debug_check_bounds::<Self>(offset);
714            let prim = decoder.read_num::<u32>(offset);
715
716            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
717            Ok(())
718        }
719    }
720
721    impl fidl::encoding::ValueTypeMarker for CodecDescription {
722        type Borrowed<'a> = &'a Self;
723        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
724            value
725        }
726    }
727
728    unsafe impl fidl::encoding::TypeMarker for CodecDescription {
729        type Owned = Self;
730
731        #[inline(always)]
732        fn inline_align(_context: fidl::encoding::Context) -> usize {
733            8
734        }
735
736        #[inline(always)]
737        fn inline_size(_context: fidl::encoding::Context) -> usize {
738            32
739        }
740    }
741
742    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CodecDescription, D>
743        for &CodecDescription
744    {
745        #[inline]
746        unsafe fn encode(
747            self,
748            encoder: &mut fidl::encoding::Encoder<'_, D>,
749            offset: usize,
750            _depth: fidl::encoding::Depth,
751        ) -> fidl::Result<()> {
752            encoder.debug_check_bounds::<CodecDescription>(offset);
753            // Delegate to tuple encoding.
754            fidl::encoding::Encode::<CodecDescription, D>::encode(
755                (
756                    <CodecType as fidl::encoding::ValueTypeMarker>::borrow(&self.codec_type),
757                    <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
758                        &self.mime_type,
759                    ),
760                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.can_stream_bytes_input),
761                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.can_find_start),
762                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.can_re_sync),
763                    <bool as fidl::encoding::ValueTypeMarker>::borrow(
764                        &self.will_report_all_detected_errors,
765                    ),
766                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.is_hw),
767                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.split_header_handling),
768                ),
769                encoder,
770                offset,
771                _depth,
772            )
773        }
774    }
775    unsafe impl<
776            D: fidl::encoding::ResourceDialect,
777            T0: fidl::encoding::Encode<CodecType, D>,
778            T1: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
779            T2: fidl::encoding::Encode<bool, D>,
780            T3: fidl::encoding::Encode<bool, D>,
781            T4: fidl::encoding::Encode<bool, D>,
782            T5: fidl::encoding::Encode<bool, D>,
783            T6: fidl::encoding::Encode<bool, D>,
784            T7: fidl::encoding::Encode<bool, D>,
785        > fidl::encoding::Encode<CodecDescription, D> for (T0, T1, T2, T3, T4, T5, T6, T7)
786    {
787        #[inline]
788        unsafe fn encode(
789            self,
790            encoder: &mut fidl::encoding::Encoder<'_, D>,
791            offset: usize,
792            depth: fidl::encoding::Depth,
793        ) -> fidl::Result<()> {
794            encoder.debug_check_bounds::<CodecDescription>(offset);
795            // Zero out padding regions. There's no need to apply masks
796            // because the unmasked parts will be overwritten by fields.
797            unsafe {
798                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
799                (ptr as *mut u64).write_unaligned(0);
800            }
801            unsafe {
802                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
803                (ptr as *mut u64).write_unaligned(0);
804            }
805            // Write the fields.
806            self.0.encode(encoder, offset + 0, depth)?;
807            self.1.encode(encoder, offset + 8, depth)?;
808            self.2.encode(encoder, offset + 24, depth)?;
809            self.3.encode(encoder, offset + 25, depth)?;
810            self.4.encode(encoder, offset + 26, depth)?;
811            self.5.encode(encoder, offset + 27, depth)?;
812            self.6.encode(encoder, offset + 28, depth)?;
813            self.7.encode(encoder, offset + 29, depth)?;
814            Ok(())
815        }
816    }
817
818    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CodecDescription {
819        #[inline(always)]
820        fn new_empty() -> Self {
821            Self {
822                codec_type: fidl::new_empty!(CodecType, D),
823                mime_type: fidl::new_empty!(fidl::encoding::BoundedString<256>, D),
824                can_stream_bytes_input: fidl::new_empty!(bool, D),
825                can_find_start: fidl::new_empty!(bool, D),
826                can_re_sync: fidl::new_empty!(bool, D),
827                will_report_all_detected_errors: fidl::new_empty!(bool, D),
828                is_hw: fidl::new_empty!(bool, D),
829                split_header_handling: fidl::new_empty!(bool, D),
830            }
831        }
832
833        #[inline]
834        unsafe fn decode(
835            &mut self,
836            decoder: &mut fidl::encoding::Decoder<'_, D>,
837            offset: usize,
838            _depth: fidl::encoding::Depth,
839        ) -> fidl::Result<()> {
840            decoder.debug_check_bounds::<Self>(offset);
841            // Verify that padding bytes are zero.
842            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
843            let padval = unsafe { (ptr as *const u64).read_unaligned() };
844            let mask = 0xffffffff00000000u64;
845            let maskedval = padval & mask;
846            if maskedval != 0 {
847                return Err(fidl::Error::NonZeroPadding {
848                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
849                });
850            }
851            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
852            let padval = unsafe { (ptr as *const u64).read_unaligned() };
853            let mask = 0xffff000000000000u64;
854            let maskedval = padval & mask;
855            if maskedval != 0 {
856                return Err(fidl::Error::NonZeroPadding {
857                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
858                });
859            }
860            fidl::decode!(CodecType, D, &mut self.codec_type, decoder, offset + 0, _depth)?;
861            fidl::decode!(
862                fidl::encoding::BoundedString<256>,
863                D,
864                &mut self.mime_type,
865                decoder,
866                offset + 8,
867                _depth
868            )?;
869            fidl::decode!(bool, D, &mut self.can_stream_bytes_input, decoder, offset + 24, _depth)?;
870            fidl::decode!(bool, D, &mut self.can_find_start, decoder, offset + 25, _depth)?;
871            fidl::decode!(bool, D, &mut self.can_re_sync, decoder, offset + 26, _depth)?;
872            fidl::decode!(
873                bool,
874                D,
875                &mut self.will_report_all_detected_errors,
876                decoder,
877                offset + 27,
878                _depth
879            )?;
880            fidl::decode!(bool, D, &mut self.is_hw, decoder, offset + 28, _depth)?;
881            fidl::decode!(bool, D, &mut self.split_header_handling, decoder, offset + 29, _depth)?;
882            Ok(())
883        }
884    }
885
886    impl fidl::encoding::ValueTypeMarker for CodecFactoryOnCodecListRequest {
887        type Borrowed<'a> = &'a Self;
888        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
889            value
890        }
891    }
892
893    unsafe impl fidl::encoding::TypeMarker for CodecFactoryOnCodecListRequest {
894        type Owned = Self;
895
896        #[inline(always)]
897        fn inline_align(_context: fidl::encoding::Context) -> usize {
898            8
899        }
900
901        #[inline(always)]
902        fn inline_size(_context: fidl::encoding::Context) -> usize {
903            16
904        }
905    }
906
907    unsafe impl<D: fidl::encoding::ResourceDialect>
908        fidl::encoding::Encode<CodecFactoryOnCodecListRequest, D>
909        for &CodecFactoryOnCodecListRequest
910    {
911        #[inline]
912        unsafe fn encode(
913            self,
914            encoder: &mut fidl::encoding::Encoder<'_, D>,
915            offset: usize,
916            _depth: fidl::encoding::Depth,
917        ) -> fidl::Result<()> {
918            encoder.debug_check_bounds::<CodecFactoryOnCodecListRequest>(offset);
919            // Delegate to tuple encoding.
920            fidl::encoding::Encode::<CodecFactoryOnCodecListRequest, D>::encode(
921                (
922                    <fidl::encoding::Vector<CodecDescription, 256> as fidl::encoding::ValueTypeMarker>::borrow(&self.codecs),
923                ),
924                encoder, offset, _depth
925            )
926        }
927    }
928    unsafe impl<
929            D: fidl::encoding::ResourceDialect,
930            T0: fidl::encoding::Encode<fidl::encoding::Vector<CodecDescription, 256>, D>,
931        > fidl::encoding::Encode<CodecFactoryOnCodecListRequest, D> for (T0,)
932    {
933        #[inline]
934        unsafe fn encode(
935            self,
936            encoder: &mut fidl::encoding::Encoder<'_, D>,
937            offset: usize,
938            depth: fidl::encoding::Depth,
939        ) -> fidl::Result<()> {
940            encoder.debug_check_bounds::<CodecFactoryOnCodecListRequest>(offset);
941            // Zero out padding regions. There's no need to apply masks
942            // because the unmasked parts will be overwritten by fields.
943            // Write the fields.
944            self.0.encode(encoder, offset + 0, depth)?;
945            Ok(())
946        }
947    }
948
949    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
950        for CodecFactoryOnCodecListRequest
951    {
952        #[inline(always)]
953        fn new_empty() -> Self {
954            Self { codecs: fidl::new_empty!(fidl::encoding::Vector<CodecDescription, 256>, D) }
955        }
956
957        #[inline]
958        unsafe fn decode(
959            &mut self,
960            decoder: &mut fidl::encoding::Decoder<'_, D>,
961            offset: usize,
962            _depth: fidl::encoding::Depth,
963        ) -> fidl::Result<()> {
964            decoder.debug_check_bounds::<Self>(offset);
965            // Verify that padding bytes are zero.
966            fidl::decode!(fidl::encoding::Vector<CodecDescription, 256>, D, &mut self.codecs, decoder, offset + 0, _depth)?;
967            Ok(())
968        }
969    }
970
971    impl CodecFactoryGetDetailedCodecDescriptionsResponse {
972        #[inline(always)]
973        fn max_ordinal_present(&self) -> u64 {
974            if let Some(_) = self.codecs {
975                return 1;
976            }
977            0
978        }
979    }
980
981    impl fidl::encoding::ValueTypeMarker for CodecFactoryGetDetailedCodecDescriptionsResponse {
982        type Borrowed<'a> = &'a Self;
983        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
984            value
985        }
986    }
987
988    unsafe impl fidl::encoding::TypeMarker for CodecFactoryGetDetailedCodecDescriptionsResponse {
989        type Owned = Self;
990
991        #[inline(always)]
992        fn inline_align(_context: fidl::encoding::Context) -> usize {
993            8
994        }
995
996        #[inline(always)]
997        fn inline_size(_context: fidl::encoding::Context) -> usize {
998            16
999        }
1000    }
1001
1002    unsafe impl<D: fidl::encoding::ResourceDialect>
1003        fidl::encoding::Encode<CodecFactoryGetDetailedCodecDescriptionsResponse, D>
1004        for &CodecFactoryGetDetailedCodecDescriptionsResponse
1005    {
1006        unsafe fn encode(
1007            self,
1008            encoder: &mut fidl::encoding::Encoder<'_, D>,
1009            offset: usize,
1010            mut depth: fidl::encoding::Depth,
1011        ) -> fidl::Result<()> {
1012            encoder.debug_check_bounds::<CodecFactoryGetDetailedCodecDescriptionsResponse>(offset);
1013            // Vector header
1014            let max_ordinal: u64 = self.max_ordinal_present();
1015            encoder.write_num(max_ordinal, offset);
1016            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1017            // Calling encoder.out_of_line_offset(0) is not allowed.
1018            if max_ordinal == 0 {
1019                return Ok(());
1020            }
1021            depth.increment()?;
1022            let envelope_size = 8;
1023            let bytes_len = max_ordinal as usize * envelope_size;
1024            #[allow(unused_variables)]
1025            let offset = encoder.out_of_line_offset(bytes_len);
1026            let mut _prev_end_offset: usize = 0;
1027            if 1 > max_ordinal {
1028                return Ok(());
1029            }
1030
1031            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1032            // are envelope_size bytes.
1033            let cur_offset: usize = (1 - 1) * envelope_size;
1034
1035            // Zero reserved fields.
1036            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1037
1038            // Safety:
1039            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1040            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1041            //   envelope_size bytes, there is always sufficient room.
1042            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<DetailedCodecDescription, 256>, D>(
1043            self.codecs.as_ref().map(<fidl::encoding::Vector<DetailedCodecDescription, 256> as fidl::encoding::ValueTypeMarker>::borrow),
1044            encoder, offset + cur_offset, depth
1045        )?;
1046
1047            _prev_end_offset = cur_offset + envelope_size;
1048
1049            Ok(())
1050        }
1051    }
1052
1053    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1054        for CodecFactoryGetDetailedCodecDescriptionsResponse
1055    {
1056        #[inline(always)]
1057        fn new_empty() -> Self {
1058            Self::default()
1059        }
1060
1061        unsafe fn decode(
1062            &mut self,
1063            decoder: &mut fidl::encoding::Decoder<'_, D>,
1064            offset: usize,
1065            mut depth: fidl::encoding::Depth,
1066        ) -> fidl::Result<()> {
1067            decoder.debug_check_bounds::<Self>(offset);
1068            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1069                None => return Err(fidl::Error::NotNullable),
1070                Some(len) => len,
1071            };
1072            // Calling decoder.out_of_line_offset(0) is not allowed.
1073            if len == 0 {
1074                return Ok(());
1075            };
1076            depth.increment()?;
1077            let envelope_size = 8;
1078            let bytes_len = len * envelope_size;
1079            let offset = decoder.out_of_line_offset(bytes_len)?;
1080            // Decode the envelope for each type.
1081            let mut _next_ordinal_to_read = 0;
1082            let mut next_offset = offset;
1083            let end_offset = offset + bytes_len;
1084            _next_ordinal_to_read += 1;
1085            if next_offset >= end_offset {
1086                return Ok(());
1087            }
1088
1089            // Decode unknown envelopes for gaps in ordinals.
1090            while _next_ordinal_to_read < 1 {
1091                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1092                _next_ordinal_to_read += 1;
1093                next_offset += envelope_size;
1094            }
1095
1096            let next_out_of_line = decoder.next_out_of_line();
1097            let handles_before = decoder.remaining_handles();
1098            if let Some((inlined, num_bytes, num_handles)) =
1099                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1100            {
1101                let member_inline_size = <fidl::encoding::Vector<DetailedCodecDescription, 256> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1102                if inlined != (member_inline_size <= 4) {
1103                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1104                }
1105                let inner_offset;
1106                let mut inner_depth = depth.clone();
1107                if inlined {
1108                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1109                    inner_offset = next_offset;
1110                } else {
1111                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1112                    inner_depth.increment()?;
1113                }
1114                let val_ref = self.codecs.get_or_insert_with(
1115                    || fidl::new_empty!(fidl::encoding::Vector<DetailedCodecDescription, 256>, D),
1116                );
1117                fidl::decode!(fidl::encoding::Vector<DetailedCodecDescription, 256>, D, val_ref, decoder, inner_offset, inner_depth)?;
1118                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1119                {
1120                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1121                }
1122                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1123                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1124                }
1125            }
1126
1127            next_offset += envelope_size;
1128
1129            // Decode the remaining unknown envelopes.
1130            while next_offset < end_offset {
1131                _next_ordinal_to_read += 1;
1132                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1133                next_offset += envelope_size;
1134            }
1135
1136            Ok(())
1137        }
1138    }
1139
1140    impl CreateDecoderParams {
1141        #[inline(always)]
1142        fn max_ordinal_present(&self) -> u64 {
1143            if let Some(_) = self.require_sw {
1144                return 11;
1145            }
1146            if let Some(_) = self.secure_input_mode {
1147                return 10;
1148            }
1149            if let Some(_) = self.secure_output_mode {
1150                return 9;
1151            }
1152            if let Some(_) = self.permit_lack_of_split_header_handling {
1153                return 8;
1154            }
1155            if let Some(_) = self.require_hw {
1156                return 7;
1157            }
1158            if let Some(_) = self.require_report_all_detected_errors {
1159                return 6;
1160            }
1161            if let Some(_) = self.require_can_re_sync {
1162                return 5;
1163            }
1164            if let Some(_) = self.require_can_find_start {
1165                return 4;
1166            }
1167            if let Some(_) = self.require_can_stream_bytes_input {
1168                return 3;
1169            }
1170            if let Some(_) = self.promise_separate_access_units_on_input {
1171                return 2;
1172            }
1173            if let Some(_) = self.input_details {
1174                return 1;
1175            }
1176            0
1177        }
1178    }
1179
1180    impl fidl::encoding::ValueTypeMarker for CreateDecoderParams {
1181        type Borrowed<'a> = &'a Self;
1182        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1183            value
1184        }
1185    }
1186
1187    unsafe impl fidl::encoding::TypeMarker for CreateDecoderParams {
1188        type Owned = Self;
1189
1190        #[inline(always)]
1191        fn inline_align(_context: fidl::encoding::Context) -> usize {
1192            8
1193        }
1194
1195        #[inline(always)]
1196        fn inline_size(_context: fidl::encoding::Context) -> usize {
1197            16
1198        }
1199    }
1200
1201    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CreateDecoderParams, D>
1202        for &CreateDecoderParams
1203    {
1204        unsafe fn encode(
1205            self,
1206            encoder: &mut fidl::encoding::Encoder<'_, D>,
1207            offset: usize,
1208            mut depth: fidl::encoding::Depth,
1209        ) -> fidl::Result<()> {
1210            encoder.debug_check_bounds::<CreateDecoderParams>(offset);
1211            // Vector header
1212            let max_ordinal: u64 = self.max_ordinal_present();
1213            encoder.write_num(max_ordinal, offset);
1214            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1215            // Calling encoder.out_of_line_offset(0) is not allowed.
1216            if max_ordinal == 0 {
1217                return Ok(());
1218            }
1219            depth.increment()?;
1220            let envelope_size = 8;
1221            let bytes_len = max_ordinal as usize * envelope_size;
1222            #[allow(unused_variables)]
1223            let offset = encoder.out_of_line_offset(bytes_len);
1224            let mut _prev_end_offset: usize = 0;
1225            if 1 > max_ordinal {
1226                return Ok(());
1227            }
1228
1229            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1230            // are envelope_size bytes.
1231            let cur_offset: usize = (1 - 1) * envelope_size;
1232
1233            // Zero reserved fields.
1234            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1235
1236            // Safety:
1237            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1238            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1239            //   envelope_size bytes, there is always sufficient room.
1240            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_media::FormatDetails, D>(
1241                self.input_details.as_ref().map(
1242                    <fidl_fuchsia_media::FormatDetails as fidl::encoding::ValueTypeMarker>::borrow,
1243                ),
1244                encoder,
1245                offset + cur_offset,
1246                depth,
1247            )?;
1248
1249            _prev_end_offset = cur_offset + envelope_size;
1250            if 2 > max_ordinal {
1251                return Ok(());
1252            }
1253
1254            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1255            // are envelope_size bytes.
1256            let cur_offset: usize = (2 - 1) * envelope_size;
1257
1258            // Zero reserved fields.
1259            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1260
1261            // Safety:
1262            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1263            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1264            //   envelope_size bytes, there is always sufficient room.
1265            fidl::encoding::encode_in_envelope_optional::<bool, D>(
1266                self.promise_separate_access_units_on_input
1267                    .as_ref()
1268                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1269                encoder,
1270                offset + cur_offset,
1271                depth,
1272            )?;
1273
1274            _prev_end_offset = cur_offset + envelope_size;
1275            if 3 > max_ordinal {
1276                return Ok(());
1277            }
1278
1279            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1280            // are envelope_size bytes.
1281            let cur_offset: usize = (3 - 1) * envelope_size;
1282
1283            // Zero reserved fields.
1284            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1285
1286            // Safety:
1287            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1288            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1289            //   envelope_size bytes, there is always sufficient room.
1290            fidl::encoding::encode_in_envelope_optional::<bool, D>(
1291                self.require_can_stream_bytes_input
1292                    .as_ref()
1293                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1294                encoder,
1295                offset + cur_offset,
1296                depth,
1297            )?;
1298
1299            _prev_end_offset = cur_offset + envelope_size;
1300            if 4 > max_ordinal {
1301                return Ok(());
1302            }
1303
1304            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1305            // are envelope_size bytes.
1306            let cur_offset: usize = (4 - 1) * envelope_size;
1307
1308            // Zero reserved fields.
1309            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1310
1311            // Safety:
1312            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1313            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1314            //   envelope_size bytes, there is always sufficient room.
1315            fidl::encoding::encode_in_envelope_optional::<bool, D>(
1316                self.require_can_find_start
1317                    .as_ref()
1318                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1319                encoder,
1320                offset + cur_offset,
1321                depth,
1322            )?;
1323
1324            _prev_end_offset = cur_offset + envelope_size;
1325            if 5 > max_ordinal {
1326                return Ok(());
1327            }
1328
1329            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1330            // are envelope_size bytes.
1331            let cur_offset: usize = (5 - 1) * envelope_size;
1332
1333            // Zero reserved fields.
1334            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1335
1336            // Safety:
1337            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1338            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1339            //   envelope_size bytes, there is always sufficient room.
1340            fidl::encoding::encode_in_envelope_optional::<bool, D>(
1341                self.require_can_re_sync
1342                    .as_ref()
1343                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1344                encoder,
1345                offset + cur_offset,
1346                depth,
1347            )?;
1348
1349            _prev_end_offset = cur_offset + envelope_size;
1350            if 6 > max_ordinal {
1351                return Ok(());
1352            }
1353
1354            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1355            // are envelope_size bytes.
1356            let cur_offset: usize = (6 - 1) * envelope_size;
1357
1358            // Zero reserved fields.
1359            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1360
1361            // Safety:
1362            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1363            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1364            //   envelope_size bytes, there is always sufficient room.
1365            fidl::encoding::encode_in_envelope_optional::<bool, D>(
1366                self.require_report_all_detected_errors
1367                    .as_ref()
1368                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1369                encoder,
1370                offset + cur_offset,
1371                depth,
1372            )?;
1373
1374            _prev_end_offset = cur_offset + envelope_size;
1375            if 7 > max_ordinal {
1376                return Ok(());
1377            }
1378
1379            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1380            // are envelope_size bytes.
1381            let cur_offset: usize = (7 - 1) * envelope_size;
1382
1383            // Zero reserved fields.
1384            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1385
1386            // Safety:
1387            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1388            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1389            //   envelope_size bytes, there is always sufficient room.
1390            fidl::encoding::encode_in_envelope_optional::<bool, D>(
1391                self.require_hw.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1392                encoder,
1393                offset + cur_offset,
1394                depth,
1395            )?;
1396
1397            _prev_end_offset = cur_offset + envelope_size;
1398            if 8 > max_ordinal {
1399                return Ok(());
1400            }
1401
1402            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1403            // are envelope_size bytes.
1404            let cur_offset: usize = (8 - 1) * envelope_size;
1405
1406            // Zero reserved fields.
1407            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1408
1409            // Safety:
1410            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1411            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1412            //   envelope_size bytes, there is always sufficient room.
1413            fidl::encoding::encode_in_envelope_optional::<bool, D>(
1414                self.permit_lack_of_split_header_handling
1415                    .as_ref()
1416                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1417                encoder,
1418                offset + cur_offset,
1419                depth,
1420            )?;
1421
1422            _prev_end_offset = cur_offset + envelope_size;
1423            if 9 > max_ordinal {
1424                return Ok(());
1425            }
1426
1427            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1428            // are envelope_size bytes.
1429            let cur_offset: usize = (9 - 1) * envelope_size;
1430
1431            // Zero reserved fields.
1432            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1433
1434            // Safety:
1435            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1436            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1437            //   envelope_size bytes, there is always sufficient room.
1438            fidl::encoding::encode_in_envelope_optional::<SecureMemoryMode, D>(
1439                self.secure_output_mode
1440                    .as_ref()
1441                    .map(<SecureMemoryMode as fidl::encoding::ValueTypeMarker>::borrow),
1442                encoder,
1443                offset + cur_offset,
1444                depth,
1445            )?;
1446
1447            _prev_end_offset = cur_offset + envelope_size;
1448            if 10 > max_ordinal {
1449                return Ok(());
1450            }
1451
1452            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1453            // are envelope_size bytes.
1454            let cur_offset: usize = (10 - 1) * envelope_size;
1455
1456            // Zero reserved fields.
1457            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1458
1459            // Safety:
1460            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1461            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1462            //   envelope_size bytes, there is always sufficient room.
1463            fidl::encoding::encode_in_envelope_optional::<SecureMemoryMode, D>(
1464                self.secure_input_mode
1465                    .as_ref()
1466                    .map(<SecureMemoryMode as fidl::encoding::ValueTypeMarker>::borrow),
1467                encoder,
1468                offset + cur_offset,
1469                depth,
1470            )?;
1471
1472            _prev_end_offset = cur_offset + envelope_size;
1473            if 11 > max_ordinal {
1474                return Ok(());
1475            }
1476
1477            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1478            // are envelope_size bytes.
1479            let cur_offset: usize = (11 - 1) * envelope_size;
1480
1481            // Zero reserved fields.
1482            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1483
1484            // Safety:
1485            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1486            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1487            //   envelope_size bytes, there is always sufficient room.
1488            fidl::encoding::encode_in_envelope_optional::<bool, D>(
1489                self.require_sw.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1490                encoder,
1491                offset + cur_offset,
1492                depth,
1493            )?;
1494
1495            _prev_end_offset = cur_offset + envelope_size;
1496
1497            Ok(())
1498        }
1499    }
1500
1501    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CreateDecoderParams {
1502        #[inline(always)]
1503        fn new_empty() -> Self {
1504            Self::default()
1505        }
1506
1507        unsafe fn decode(
1508            &mut self,
1509            decoder: &mut fidl::encoding::Decoder<'_, D>,
1510            offset: usize,
1511            mut depth: fidl::encoding::Depth,
1512        ) -> fidl::Result<()> {
1513            decoder.debug_check_bounds::<Self>(offset);
1514            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1515                None => return Err(fidl::Error::NotNullable),
1516                Some(len) => len,
1517            };
1518            // Calling decoder.out_of_line_offset(0) is not allowed.
1519            if len == 0 {
1520                return Ok(());
1521            };
1522            depth.increment()?;
1523            let envelope_size = 8;
1524            let bytes_len = len * envelope_size;
1525            let offset = decoder.out_of_line_offset(bytes_len)?;
1526            // Decode the envelope for each type.
1527            let mut _next_ordinal_to_read = 0;
1528            let mut next_offset = offset;
1529            let end_offset = offset + bytes_len;
1530            _next_ordinal_to_read += 1;
1531            if next_offset >= end_offset {
1532                return Ok(());
1533            }
1534
1535            // Decode unknown envelopes for gaps in ordinals.
1536            while _next_ordinal_to_read < 1 {
1537                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1538                _next_ordinal_to_read += 1;
1539                next_offset += envelope_size;
1540            }
1541
1542            let next_out_of_line = decoder.next_out_of_line();
1543            let handles_before = decoder.remaining_handles();
1544            if let Some((inlined, num_bytes, num_handles)) =
1545                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1546            {
1547                let member_inline_size =
1548                    <fidl_fuchsia_media::FormatDetails as fidl::encoding::TypeMarker>::inline_size(
1549                        decoder.context,
1550                    );
1551                if inlined != (member_inline_size <= 4) {
1552                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1553                }
1554                let inner_offset;
1555                let mut inner_depth = depth.clone();
1556                if inlined {
1557                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1558                    inner_offset = next_offset;
1559                } else {
1560                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1561                    inner_depth.increment()?;
1562                }
1563                let val_ref = self
1564                    .input_details
1565                    .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_media::FormatDetails, D));
1566                fidl::decode!(
1567                    fidl_fuchsia_media::FormatDetails,
1568                    D,
1569                    val_ref,
1570                    decoder,
1571                    inner_offset,
1572                    inner_depth
1573                )?;
1574                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1575                {
1576                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1577                }
1578                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1579                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1580                }
1581            }
1582
1583            next_offset += envelope_size;
1584            _next_ordinal_to_read += 1;
1585            if next_offset >= end_offset {
1586                return Ok(());
1587            }
1588
1589            // Decode unknown envelopes for gaps in ordinals.
1590            while _next_ordinal_to_read < 2 {
1591                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1592                _next_ordinal_to_read += 1;
1593                next_offset += envelope_size;
1594            }
1595
1596            let next_out_of_line = decoder.next_out_of_line();
1597            let handles_before = decoder.remaining_handles();
1598            if let Some((inlined, num_bytes, num_handles)) =
1599                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1600            {
1601                let member_inline_size =
1602                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1603                if inlined != (member_inline_size <= 4) {
1604                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1605                }
1606                let inner_offset;
1607                let mut inner_depth = depth.clone();
1608                if inlined {
1609                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1610                    inner_offset = next_offset;
1611                } else {
1612                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1613                    inner_depth.increment()?;
1614                }
1615                let val_ref = self
1616                    .promise_separate_access_units_on_input
1617                    .get_or_insert_with(|| fidl::new_empty!(bool, D));
1618                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
1619                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1620                {
1621                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1622                }
1623                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1624                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1625                }
1626            }
1627
1628            next_offset += envelope_size;
1629            _next_ordinal_to_read += 1;
1630            if next_offset >= end_offset {
1631                return Ok(());
1632            }
1633
1634            // Decode unknown envelopes for gaps in ordinals.
1635            while _next_ordinal_to_read < 3 {
1636                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1637                _next_ordinal_to_read += 1;
1638                next_offset += envelope_size;
1639            }
1640
1641            let next_out_of_line = decoder.next_out_of_line();
1642            let handles_before = decoder.remaining_handles();
1643            if let Some((inlined, num_bytes, num_handles)) =
1644                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1645            {
1646                let member_inline_size =
1647                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1648                if inlined != (member_inline_size <= 4) {
1649                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1650                }
1651                let inner_offset;
1652                let mut inner_depth = depth.clone();
1653                if inlined {
1654                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1655                    inner_offset = next_offset;
1656                } else {
1657                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1658                    inner_depth.increment()?;
1659                }
1660                let val_ref = self
1661                    .require_can_stream_bytes_input
1662                    .get_or_insert_with(|| fidl::new_empty!(bool, D));
1663                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
1664                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1665                {
1666                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1667                }
1668                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1669                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1670                }
1671            }
1672
1673            next_offset += envelope_size;
1674            _next_ordinal_to_read += 1;
1675            if next_offset >= end_offset {
1676                return Ok(());
1677            }
1678
1679            // Decode unknown envelopes for gaps in ordinals.
1680            while _next_ordinal_to_read < 4 {
1681                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1682                _next_ordinal_to_read += 1;
1683                next_offset += envelope_size;
1684            }
1685
1686            let next_out_of_line = decoder.next_out_of_line();
1687            let handles_before = decoder.remaining_handles();
1688            if let Some((inlined, num_bytes, num_handles)) =
1689                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1690            {
1691                let member_inline_size =
1692                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1693                if inlined != (member_inline_size <= 4) {
1694                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1695                }
1696                let inner_offset;
1697                let mut inner_depth = depth.clone();
1698                if inlined {
1699                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1700                    inner_offset = next_offset;
1701                } else {
1702                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1703                    inner_depth.increment()?;
1704                }
1705                let val_ref =
1706                    self.require_can_find_start.get_or_insert_with(|| fidl::new_empty!(bool, D));
1707                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
1708                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1709                {
1710                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1711                }
1712                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1713                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1714                }
1715            }
1716
1717            next_offset += envelope_size;
1718            _next_ordinal_to_read += 1;
1719            if next_offset >= end_offset {
1720                return Ok(());
1721            }
1722
1723            // Decode unknown envelopes for gaps in ordinals.
1724            while _next_ordinal_to_read < 5 {
1725                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1726                _next_ordinal_to_read += 1;
1727                next_offset += envelope_size;
1728            }
1729
1730            let next_out_of_line = decoder.next_out_of_line();
1731            let handles_before = decoder.remaining_handles();
1732            if let Some((inlined, num_bytes, num_handles)) =
1733                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1734            {
1735                let member_inline_size =
1736                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1737                if inlined != (member_inline_size <= 4) {
1738                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1739                }
1740                let inner_offset;
1741                let mut inner_depth = depth.clone();
1742                if inlined {
1743                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1744                    inner_offset = next_offset;
1745                } else {
1746                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1747                    inner_depth.increment()?;
1748                }
1749                let val_ref =
1750                    self.require_can_re_sync.get_or_insert_with(|| fidl::new_empty!(bool, D));
1751                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
1752                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1753                {
1754                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1755                }
1756                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1757                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1758                }
1759            }
1760
1761            next_offset += envelope_size;
1762            _next_ordinal_to_read += 1;
1763            if next_offset >= end_offset {
1764                return Ok(());
1765            }
1766
1767            // Decode unknown envelopes for gaps in ordinals.
1768            while _next_ordinal_to_read < 6 {
1769                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1770                _next_ordinal_to_read += 1;
1771                next_offset += envelope_size;
1772            }
1773
1774            let next_out_of_line = decoder.next_out_of_line();
1775            let handles_before = decoder.remaining_handles();
1776            if let Some((inlined, num_bytes, num_handles)) =
1777                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1778            {
1779                let member_inline_size =
1780                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1781                if inlined != (member_inline_size <= 4) {
1782                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1783                }
1784                let inner_offset;
1785                let mut inner_depth = depth.clone();
1786                if inlined {
1787                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1788                    inner_offset = next_offset;
1789                } else {
1790                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1791                    inner_depth.increment()?;
1792                }
1793                let val_ref = self
1794                    .require_report_all_detected_errors
1795                    .get_or_insert_with(|| fidl::new_empty!(bool, D));
1796                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
1797                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1798                {
1799                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1800                }
1801                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1802                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1803                }
1804            }
1805
1806            next_offset += envelope_size;
1807            _next_ordinal_to_read += 1;
1808            if next_offset >= end_offset {
1809                return Ok(());
1810            }
1811
1812            // Decode unknown envelopes for gaps in ordinals.
1813            while _next_ordinal_to_read < 7 {
1814                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1815                _next_ordinal_to_read += 1;
1816                next_offset += envelope_size;
1817            }
1818
1819            let next_out_of_line = decoder.next_out_of_line();
1820            let handles_before = decoder.remaining_handles();
1821            if let Some((inlined, num_bytes, num_handles)) =
1822                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1823            {
1824                let member_inline_size =
1825                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1826                if inlined != (member_inline_size <= 4) {
1827                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1828                }
1829                let inner_offset;
1830                let mut inner_depth = depth.clone();
1831                if inlined {
1832                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1833                    inner_offset = next_offset;
1834                } else {
1835                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1836                    inner_depth.increment()?;
1837                }
1838                let val_ref = self.require_hw.get_or_insert_with(|| fidl::new_empty!(bool, D));
1839                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
1840                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1841                {
1842                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1843                }
1844                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1845                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1846                }
1847            }
1848
1849            next_offset += envelope_size;
1850            _next_ordinal_to_read += 1;
1851            if next_offset >= end_offset {
1852                return Ok(());
1853            }
1854
1855            // Decode unknown envelopes for gaps in ordinals.
1856            while _next_ordinal_to_read < 8 {
1857                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1858                _next_ordinal_to_read += 1;
1859                next_offset += envelope_size;
1860            }
1861
1862            let next_out_of_line = decoder.next_out_of_line();
1863            let handles_before = decoder.remaining_handles();
1864            if let Some((inlined, num_bytes, num_handles)) =
1865                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1866            {
1867                let member_inline_size =
1868                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1869                if inlined != (member_inline_size <= 4) {
1870                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1871                }
1872                let inner_offset;
1873                let mut inner_depth = depth.clone();
1874                if inlined {
1875                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1876                    inner_offset = next_offset;
1877                } else {
1878                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1879                    inner_depth.increment()?;
1880                }
1881                let val_ref = self
1882                    .permit_lack_of_split_header_handling
1883                    .get_or_insert_with(|| fidl::new_empty!(bool, D));
1884                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
1885                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1886                {
1887                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1888                }
1889                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1890                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1891                }
1892            }
1893
1894            next_offset += envelope_size;
1895            _next_ordinal_to_read += 1;
1896            if next_offset >= end_offset {
1897                return Ok(());
1898            }
1899
1900            // Decode unknown envelopes for gaps in ordinals.
1901            while _next_ordinal_to_read < 9 {
1902                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1903                _next_ordinal_to_read += 1;
1904                next_offset += envelope_size;
1905            }
1906
1907            let next_out_of_line = decoder.next_out_of_line();
1908            let handles_before = decoder.remaining_handles();
1909            if let Some((inlined, num_bytes, num_handles)) =
1910                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1911            {
1912                let member_inline_size =
1913                    <SecureMemoryMode as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1914                if inlined != (member_inline_size <= 4) {
1915                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1916                }
1917                let inner_offset;
1918                let mut inner_depth = depth.clone();
1919                if inlined {
1920                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1921                    inner_offset = next_offset;
1922                } else {
1923                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1924                    inner_depth.increment()?;
1925                }
1926                let val_ref = self
1927                    .secure_output_mode
1928                    .get_or_insert_with(|| fidl::new_empty!(SecureMemoryMode, D));
1929                fidl::decode!(SecureMemoryMode, D, val_ref, decoder, inner_offset, inner_depth)?;
1930                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1931                {
1932                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1933                }
1934                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1935                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1936                }
1937            }
1938
1939            next_offset += envelope_size;
1940            _next_ordinal_to_read += 1;
1941            if next_offset >= end_offset {
1942                return Ok(());
1943            }
1944
1945            // Decode unknown envelopes for gaps in ordinals.
1946            while _next_ordinal_to_read < 10 {
1947                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1948                _next_ordinal_to_read += 1;
1949                next_offset += envelope_size;
1950            }
1951
1952            let next_out_of_line = decoder.next_out_of_line();
1953            let handles_before = decoder.remaining_handles();
1954            if let Some((inlined, num_bytes, num_handles)) =
1955                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1956            {
1957                let member_inline_size =
1958                    <SecureMemoryMode as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1959                if inlined != (member_inline_size <= 4) {
1960                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1961                }
1962                let inner_offset;
1963                let mut inner_depth = depth.clone();
1964                if inlined {
1965                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1966                    inner_offset = next_offset;
1967                } else {
1968                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1969                    inner_depth.increment()?;
1970                }
1971                let val_ref = self
1972                    .secure_input_mode
1973                    .get_or_insert_with(|| fidl::new_empty!(SecureMemoryMode, D));
1974                fidl::decode!(SecureMemoryMode, D, val_ref, decoder, inner_offset, inner_depth)?;
1975                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1976                {
1977                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1978                }
1979                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1980                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1981                }
1982            }
1983
1984            next_offset += envelope_size;
1985            _next_ordinal_to_read += 1;
1986            if next_offset >= end_offset {
1987                return Ok(());
1988            }
1989
1990            // Decode unknown envelopes for gaps in ordinals.
1991            while _next_ordinal_to_read < 11 {
1992                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1993                _next_ordinal_to_read += 1;
1994                next_offset += envelope_size;
1995            }
1996
1997            let next_out_of_line = decoder.next_out_of_line();
1998            let handles_before = decoder.remaining_handles();
1999            if let Some((inlined, num_bytes, num_handles)) =
2000                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2001            {
2002                let member_inline_size =
2003                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2004                if inlined != (member_inline_size <= 4) {
2005                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2006                }
2007                let inner_offset;
2008                let mut inner_depth = depth.clone();
2009                if inlined {
2010                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2011                    inner_offset = next_offset;
2012                } else {
2013                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2014                    inner_depth.increment()?;
2015                }
2016                let val_ref = self.require_sw.get_or_insert_with(|| fidl::new_empty!(bool, D));
2017                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
2018                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2019                {
2020                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2021                }
2022                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2023                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2024                }
2025            }
2026
2027            next_offset += envelope_size;
2028
2029            // Decode the remaining unknown envelopes.
2030            while next_offset < end_offset {
2031                _next_ordinal_to_read += 1;
2032                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2033                next_offset += envelope_size;
2034            }
2035
2036            Ok(())
2037        }
2038    }
2039
2040    impl CreateEncoderParams {
2041        #[inline(always)]
2042        fn max_ordinal_present(&self) -> u64 {
2043            if let Some(_) = self.require_hw {
2044                return 2;
2045            }
2046            if let Some(_) = self.input_details {
2047                return 1;
2048            }
2049            0
2050        }
2051    }
2052
2053    impl fidl::encoding::ValueTypeMarker for CreateEncoderParams {
2054        type Borrowed<'a> = &'a Self;
2055        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2056            value
2057        }
2058    }
2059
2060    unsafe impl fidl::encoding::TypeMarker for CreateEncoderParams {
2061        type Owned = Self;
2062
2063        #[inline(always)]
2064        fn inline_align(_context: fidl::encoding::Context) -> usize {
2065            8
2066        }
2067
2068        #[inline(always)]
2069        fn inline_size(_context: fidl::encoding::Context) -> usize {
2070            16
2071        }
2072    }
2073
2074    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CreateEncoderParams, D>
2075        for &CreateEncoderParams
2076    {
2077        unsafe fn encode(
2078            self,
2079            encoder: &mut fidl::encoding::Encoder<'_, D>,
2080            offset: usize,
2081            mut depth: fidl::encoding::Depth,
2082        ) -> fidl::Result<()> {
2083            encoder.debug_check_bounds::<CreateEncoderParams>(offset);
2084            // Vector header
2085            let max_ordinal: u64 = self.max_ordinal_present();
2086            encoder.write_num(max_ordinal, offset);
2087            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2088            // Calling encoder.out_of_line_offset(0) is not allowed.
2089            if max_ordinal == 0 {
2090                return Ok(());
2091            }
2092            depth.increment()?;
2093            let envelope_size = 8;
2094            let bytes_len = max_ordinal as usize * envelope_size;
2095            #[allow(unused_variables)]
2096            let offset = encoder.out_of_line_offset(bytes_len);
2097            let mut _prev_end_offset: usize = 0;
2098            if 1 > max_ordinal {
2099                return Ok(());
2100            }
2101
2102            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2103            // are envelope_size bytes.
2104            let cur_offset: usize = (1 - 1) * envelope_size;
2105
2106            // Zero reserved fields.
2107            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2108
2109            // Safety:
2110            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2111            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2112            //   envelope_size bytes, there is always sufficient room.
2113            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_media::FormatDetails, D>(
2114                self.input_details.as_ref().map(
2115                    <fidl_fuchsia_media::FormatDetails as fidl::encoding::ValueTypeMarker>::borrow,
2116                ),
2117                encoder,
2118                offset + cur_offset,
2119                depth,
2120            )?;
2121
2122            _prev_end_offset = cur_offset + envelope_size;
2123            if 2 > max_ordinal {
2124                return Ok(());
2125            }
2126
2127            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2128            // are envelope_size bytes.
2129            let cur_offset: usize = (2 - 1) * envelope_size;
2130
2131            // Zero reserved fields.
2132            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2133
2134            // Safety:
2135            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2136            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2137            //   envelope_size bytes, there is always sufficient room.
2138            fidl::encoding::encode_in_envelope_optional::<bool, D>(
2139                self.require_hw.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2140                encoder,
2141                offset + cur_offset,
2142                depth,
2143            )?;
2144
2145            _prev_end_offset = cur_offset + envelope_size;
2146
2147            Ok(())
2148        }
2149    }
2150
2151    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CreateEncoderParams {
2152        #[inline(always)]
2153        fn new_empty() -> Self {
2154            Self::default()
2155        }
2156
2157        unsafe fn decode(
2158            &mut self,
2159            decoder: &mut fidl::encoding::Decoder<'_, D>,
2160            offset: usize,
2161            mut depth: fidl::encoding::Depth,
2162        ) -> fidl::Result<()> {
2163            decoder.debug_check_bounds::<Self>(offset);
2164            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2165                None => return Err(fidl::Error::NotNullable),
2166                Some(len) => len,
2167            };
2168            // Calling decoder.out_of_line_offset(0) is not allowed.
2169            if len == 0 {
2170                return Ok(());
2171            };
2172            depth.increment()?;
2173            let envelope_size = 8;
2174            let bytes_len = len * envelope_size;
2175            let offset = decoder.out_of_line_offset(bytes_len)?;
2176            // Decode the envelope for each type.
2177            let mut _next_ordinal_to_read = 0;
2178            let mut next_offset = offset;
2179            let end_offset = offset + bytes_len;
2180            _next_ordinal_to_read += 1;
2181            if next_offset >= end_offset {
2182                return Ok(());
2183            }
2184
2185            // Decode unknown envelopes for gaps in ordinals.
2186            while _next_ordinal_to_read < 1 {
2187                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2188                _next_ordinal_to_read += 1;
2189                next_offset += envelope_size;
2190            }
2191
2192            let next_out_of_line = decoder.next_out_of_line();
2193            let handles_before = decoder.remaining_handles();
2194            if let Some((inlined, num_bytes, num_handles)) =
2195                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2196            {
2197                let member_inline_size =
2198                    <fidl_fuchsia_media::FormatDetails as fidl::encoding::TypeMarker>::inline_size(
2199                        decoder.context,
2200                    );
2201                if inlined != (member_inline_size <= 4) {
2202                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2203                }
2204                let inner_offset;
2205                let mut inner_depth = depth.clone();
2206                if inlined {
2207                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2208                    inner_offset = next_offset;
2209                } else {
2210                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2211                    inner_depth.increment()?;
2212                }
2213                let val_ref = self
2214                    .input_details
2215                    .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_media::FormatDetails, D));
2216                fidl::decode!(
2217                    fidl_fuchsia_media::FormatDetails,
2218                    D,
2219                    val_ref,
2220                    decoder,
2221                    inner_offset,
2222                    inner_depth
2223                )?;
2224                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2225                {
2226                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2227                }
2228                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2229                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2230                }
2231            }
2232
2233            next_offset += envelope_size;
2234            _next_ordinal_to_read += 1;
2235            if next_offset >= end_offset {
2236                return Ok(());
2237            }
2238
2239            // Decode unknown envelopes for gaps in ordinals.
2240            while _next_ordinal_to_read < 2 {
2241                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2242                _next_ordinal_to_read += 1;
2243                next_offset += envelope_size;
2244            }
2245
2246            let next_out_of_line = decoder.next_out_of_line();
2247            let handles_before = decoder.remaining_handles();
2248            if let Some((inlined, num_bytes, num_handles)) =
2249                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2250            {
2251                let member_inline_size =
2252                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2253                if inlined != (member_inline_size <= 4) {
2254                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2255                }
2256                let inner_offset;
2257                let mut inner_depth = depth.clone();
2258                if inlined {
2259                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2260                    inner_offset = next_offset;
2261                } else {
2262                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2263                    inner_depth.increment()?;
2264                }
2265                let val_ref = self.require_hw.get_or_insert_with(|| fidl::new_empty!(bool, D));
2266                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
2267                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2268                {
2269                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2270                }
2271                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2272                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2273                }
2274            }
2275
2276            next_offset += envelope_size;
2277
2278            // Decode the remaining unknown envelopes.
2279            while next_offset < end_offset {
2280                _next_ordinal_to_read += 1;
2281                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2282                next_offset += envelope_size;
2283            }
2284
2285            Ok(())
2286        }
2287    }
2288
2289    impl DecoderProfileDescription {
2290        #[inline(always)]
2291        fn max_ordinal_present(&self) -> u64 {
2292            if let Some(_) = self.split_header_handling {
2293                return 12;
2294            }
2295            if let Some(_) = self.will_report_all_detected_errors {
2296                return 11;
2297            }
2298            if let Some(_) = self.can_re_sync {
2299                return 10;
2300            }
2301            if let Some(_) = self.can_find_start {
2302                return 9;
2303            }
2304            if let Some(_) = self.can_stream_bytes_input {
2305                return 8;
2306            }
2307            if let Some(_) = self.require_input_protection {
2308                return 7;
2309            }
2310            if let Some(_) = self.allow_input_protection {
2311                return 6;
2312            }
2313            if let Some(_) = self.require_encryption {
2314                return 5;
2315            }
2316            if let Some(_) = self.allow_encryption {
2317                return 4;
2318            }
2319            if let Some(_) = self.max_image_size {
2320                return 3;
2321            }
2322            if let Some(_) = self.min_image_size {
2323                return 2;
2324            }
2325            if let Some(_) = self.profile {
2326                return 1;
2327            }
2328            0
2329        }
2330    }
2331
2332    impl fidl::encoding::ValueTypeMarker for DecoderProfileDescription {
2333        type Borrowed<'a> = &'a Self;
2334        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2335            value
2336        }
2337    }
2338
2339    unsafe impl fidl::encoding::TypeMarker for DecoderProfileDescription {
2340        type Owned = Self;
2341
2342        #[inline(always)]
2343        fn inline_align(_context: fidl::encoding::Context) -> usize {
2344            8
2345        }
2346
2347        #[inline(always)]
2348        fn inline_size(_context: fidl::encoding::Context) -> usize {
2349            16
2350        }
2351    }
2352
2353    unsafe impl<D: fidl::encoding::ResourceDialect>
2354        fidl::encoding::Encode<DecoderProfileDescription, D> for &DecoderProfileDescription
2355    {
2356        unsafe fn encode(
2357            self,
2358            encoder: &mut fidl::encoding::Encoder<'_, D>,
2359            offset: usize,
2360            mut depth: fidl::encoding::Depth,
2361        ) -> fidl::Result<()> {
2362            encoder.debug_check_bounds::<DecoderProfileDescription>(offset);
2363            // Vector header
2364            let max_ordinal: u64 = self.max_ordinal_present();
2365            encoder.write_num(max_ordinal, offset);
2366            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2367            // Calling encoder.out_of_line_offset(0) is not allowed.
2368            if max_ordinal == 0 {
2369                return Ok(());
2370            }
2371            depth.increment()?;
2372            let envelope_size = 8;
2373            let bytes_len = max_ordinal as usize * envelope_size;
2374            #[allow(unused_variables)]
2375            let offset = encoder.out_of_line_offset(bytes_len);
2376            let mut _prev_end_offset: usize = 0;
2377            if 1 > max_ordinal {
2378                return Ok(());
2379            }
2380
2381            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2382            // are envelope_size bytes.
2383            let cur_offset: usize = (1 - 1) * envelope_size;
2384
2385            // Zero reserved fields.
2386            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2387
2388            // Safety:
2389            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2390            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2391            //   envelope_size bytes, there is always sufficient room.
2392            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_media::CodecProfile, D>(
2393                self.profile.as_ref().map(
2394                    <fidl_fuchsia_media::CodecProfile as fidl::encoding::ValueTypeMarker>::borrow,
2395                ),
2396                encoder,
2397                offset + cur_offset,
2398                depth,
2399            )?;
2400
2401            _prev_end_offset = cur_offset + envelope_size;
2402            if 2 > max_ordinal {
2403                return Ok(());
2404            }
2405
2406            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2407            // are envelope_size bytes.
2408            let cur_offset: usize = (2 - 1) * envelope_size;
2409
2410            // Zero reserved fields.
2411            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2412
2413            // Safety:
2414            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2415            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2416            //   envelope_size bytes, there is always sufficient room.
2417            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_math::SizeU, D>(
2418                self.min_image_size
2419                    .as_ref()
2420                    .map(<fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow),
2421                encoder,
2422                offset + cur_offset,
2423                depth,
2424            )?;
2425
2426            _prev_end_offset = cur_offset + envelope_size;
2427            if 3 > max_ordinal {
2428                return Ok(());
2429            }
2430
2431            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2432            // are envelope_size bytes.
2433            let cur_offset: usize = (3 - 1) * envelope_size;
2434
2435            // Zero reserved fields.
2436            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2437
2438            // Safety:
2439            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2440            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2441            //   envelope_size bytes, there is always sufficient room.
2442            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_math::SizeU, D>(
2443                self.max_image_size
2444                    .as_ref()
2445                    .map(<fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow),
2446                encoder,
2447                offset + cur_offset,
2448                depth,
2449            )?;
2450
2451            _prev_end_offset = cur_offset + envelope_size;
2452            if 4 > max_ordinal {
2453                return Ok(());
2454            }
2455
2456            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2457            // are envelope_size bytes.
2458            let cur_offset: usize = (4 - 1) * envelope_size;
2459
2460            // Zero reserved fields.
2461            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2462
2463            // Safety:
2464            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2465            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2466            //   envelope_size bytes, there is always sufficient room.
2467            fidl::encoding::encode_in_envelope_optional::<bool, D>(
2468                self.allow_encryption
2469                    .as_ref()
2470                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2471                encoder,
2472                offset + cur_offset,
2473                depth,
2474            )?;
2475
2476            _prev_end_offset = cur_offset + envelope_size;
2477            if 5 > max_ordinal {
2478                return Ok(());
2479            }
2480
2481            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2482            // are envelope_size bytes.
2483            let cur_offset: usize = (5 - 1) * envelope_size;
2484
2485            // Zero reserved fields.
2486            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2487
2488            // Safety:
2489            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2490            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2491            //   envelope_size bytes, there is always sufficient room.
2492            fidl::encoding::encode_in_envelope_optional::<bool, D>(
2493                self.require_encryption
2494                    .as_ref()
2495                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2496                encoder,
2497                offset + cur_offset,
2498                depth,
2499            )?;
2500
2501            _prev_end_offset = cur_offset + envelope_size;
2502            if 6 > max_ordinal {
2503                return Ok(());
2504            }
2505
2506            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2507            // are envelope_size bytes.
2508            let cur_offset: usize = (6 - 1) * envelope_size;
2509
2510            // Zero reserved fields.
2511            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2512
2513            // Safety:
2514            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2515            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2516            //   envelope_size bytes, there is always sufficient room.
2517            fidl::encoding::encode_in_envelope_optional::<bool, D>(
2518                self.allow_input_protection
2519                    .as_ref()
2520                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2521                encoder,
2522                offset + cur_offset,
2523                depth,
2524            )?;
2525
2526            _prev_end_offset = cur_offset + envelope_size;
2527            if 7 > max_ordinal {
2528                return Ok(());
2529            }
2530
2531            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2532            // are envelope_size bytes.
2533            let cur_offset: usize = (7 - 1) * envelope_size;
2534
2535            // Zero reserved fields.
2536            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2537
2538            // Safety:
2539            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2540            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2541            //   envelope_size bytes, there is always sufficient room.
2542            fidl::encoding::encode_in_envelope_optional::<bool, D>(
2543                self.require_input_protection
2544                    .as_ref()
2545                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2546                encoder,
2547                offset + cur_offset,
2548                depth,
2549            )?;
2550
2551            _prev_end_offset = cur_offset + envelope_size;
2552            if 8 > max_ordinal {
2553                return Ok(());
2554            }
2555
2556            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2557            // are envelope_size bytes.
2558            let cur_offset: usize = (8 - 1) * envelope_size;
2559
2560            // Zero reserved fields.
2561            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2562
2563            // Safety:
2564            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2565            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2566            //   envelope_size bytes, there is always sufficient room.
2567            fidl::encoding::encode_in_envelope_optional::<bool, D>(
2568                self.can_stream_bytes_input
2569                    .as_ref()
2570                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2571                encoder,
2572                offset + cur_offset,
2573                depth,
2574            )?;
2575
2576            _prev_end_offset = cur_offset + envelope_size;
2577            if 9 > max_ordinal {
2578                return Ok(());
2579            }
2580
2581            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2582            // are envelope_size bytes.
2583            let cur_offset: usize = (9 - 1) * envelope_size;
2584
2585            // Zero reserved fields.
2586            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2587
2588            // Safety:
2589            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2590            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2591            //   envelope_size bytes, there is always sufficient room.
2592            fidl::encoding::encode_in_envelope_optional::<bool, D>(
2593                self.can_find_start.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2594                encoder,
2595                offset + cur_offset,
2596                depth,
2597            )?;
2598
2599            _prev_end_offset = cur_offset + envelope_size;
2600            if 10 > max_ordinal {
2601                return Ok(());
2602            }
2603
2604            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2605            // are envelope_size bytes.
2606            let cur_offset: usize = (10 - 1) * envelope_size;
2607
2608            // Zero reserved fields.
2609            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2610
2611            // Safety:
2612            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2613            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2614            //   envelope_size bytes, there is always sufficient room.
2615            fidl::encoding::encode_in_envelope_optional::<bool, D>(
2616                self.can_re_sync.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2617                encoder,
2618                offset + cur_offset,
2619                depth,
2620            )?;
2621
2622            _prev_end_offset = cur_offset + envelope_size;
2623            if 11 > max_ordinal {
2624                return Ok(());
2625            }
2626
2627            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2628            // are envelope_size bytes.
2629            let cur_offset: usize = (11 - 1) * envelope_size;
2630
2631            // Zero reserved fields.
2632            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2633
2634            // Safety:
2635            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2636            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2637            //   envelope_size bytes, there is always sufficient room.
2638            fidl::encoding::encode_in_envelope_optional::<bool, D>(
2639                self.will_report_all_detected_errors
2640                    .as_ref()
2641                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2642                encoder,
2643                offset + cur_offset,
2644                depth,
2645            )?;
2646
2647            _prev_end_offset = cur_offset + envelope_size;
2648            if 12 > max_ordinal {
2649                return Ok(());
2650            }
2651
2652            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2653            // are envelope_size bytes.
2654            let cur_offset: usize = (12 - 1) * envelope_size;
2655
2656            // Zero reserved fields.
2657            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2658
2659            // Safety:
2660            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2661            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2662            //   envelope_size bytes, there is always sufficient room.
2663            fidl::encoding::encode_in_envelope_optional::<bool, D>(
2664                self.split_header_handling
2665                    .as_ref()
2666                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2667                encoder,
2668                offset + cur_offset,
2669                depth,
2670            )?;
2671
2672            _prev_end_offset = cur_offset + envelope_size;
2673
2674            Ok(())
2675        }
2676    }
2677
2678    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2679        for DecoderProfileDescription
2680    {
2681        #[inline(always)]
2682        fn new_empty() -> Self {
2683            Self::default()
2684        }
2685
2686        unsafe fn decode(
2687            &mut self,
2688            decoder: &mut fidl::encoding::Decoder<'_, D>,
2689            offset: usize,
2690            mut depth: fidl::encoding::Depth,
2691        ) -> fidl::Result<()> {
2692            decoder.debug_check_bounds::<Self>(offset);
2693            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2694                None => return Err(fidl::Error::NotNullable),
2695                Some(len) => len,
2696            };
2697            // Calling decoder.out_of_line_offset(0) is not allowed.
2698            if len == 0 {
2699                return Ok(());
2700            };
2701            depth.increment()?;
2702            let envelope_size = 8;
2703            let bytes_len = len * envelope_size;
2704            let offset = decoder.out_of_line_offset(bytes_len)?;
2705            // Decode the envelope for each type.
2706            let mut _next_ordinal_to_read = 0;
2707            let mut next_offset = offset;
2708            let end_offset = offset + bytes_len;
2709            _next_ordinal_to_read += 1;
2710            if next_offset >= end_offset {
2711                return Ok(());
2712            }
2713
2714            // Decode unknown envelopes for gaps in ordinals.
2715            while _next_ordinal_to_read < 1 {
2716                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2717                _next_ordinal_to_read += 1;
2718                next_offset += envelope_size;
2719            }
2720
2721            let next_out_of_line = decoder.next_out_of_line();
2722            let handles_before = decoder.remaining_handles();
2723            if let Some((inlined, num_bytes, num_handles)) =
2724                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2725            {
2726                let member_inline_size =
2727                    <fidl_fuchsia_media::CodecProfile as fidl::encoding::TypeMarker>::inline_size(
2728                        decoder.context,
2729                    );
2730                if inlined != (member_inline_size <= 4) {
2731                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2732                }
2733                let inner_offset;
2734                let mut inner_depth = depth.clone();
2735                if inlined {
2736                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2737                    inner_offset = next_offset;
2738                } else {
2739                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2740                    inner_depth.increment()?;
2741                }
2742                let val_ref = self
2743                    .profile
2744                    .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_media::CodecProfile, D));
2745                fidl::decode!(
2746                    fidl_fuchsia_media::CodecProfile,
2747                    D,
2748                    val_ref,
2749                    decoder,
2750                    inner_offset,
2751                    inner_depth
2752                )?;
2753                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2754                {
2755                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2756                }
2757                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2758                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2759                }
2760            }
2761
2762            next_offset += envelope_size;
2763            _next_ordinal_to_read += 1;
2764            if next_offset >= end_offset {
2765                return Ok(());
2766            }
2767
2768            // Decode unknown envelopes for gaps in ordinals.
2769            while _next_ordinal_to_read < 2 {
2770                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2771                _next_ordinal_to_read += 1;
2772                next_offset += envelope_size;
2773            }
2774
2775            let next_out_of_line = decoder.next_out_of_line();
2776            let handles_before = decoder.remaining_handles();
2777            if let Some((inlined, num_bytes, num_handles)) =
2778                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2779            {
2780                let member_inline_size =
2781                    <fidl_fuchsia_math::SizeU as fidl::encoding::TypeMarker>::inline_size(
2782                        decoder.context,
2783                    );
2784                if inlined != (member_inline_size <= 4) {
2785                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2786                }
2787                let inner_offset;
2788                let mut inner_depth = depth.clone();
2789                if inlined {
2790                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2791                    inner_offset = next_offset;
2792                } else {
2793                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2794                    inner_depth.increment()?;
2795                }
2796                let val_ref = self
2797                    .min_image_size
2798                    .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_math::SizeU, D));
2799                fidl::decode!(
2800                    fidl_fuchsia_math::SizeU,
2801                    D,
2802                    val_ref,
2803                    decoder,
2804                    inner_offset,
2805                    inner_depth
2806                )?;
2807                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2808                {
2809                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2810                }
2811                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2812                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2813                }
2814            }
2815
2816            next_offset += envelope_size;
2817            _next_ordinal_to_read += 1;
2818            if next_offset >= end_offset {
2819                return Ok(());
2820            }
2821
2822            // Decode unknown envelopes for gaps in ordinals.
2823            while _next_ordinal_to_read < 3 {
2824                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2825                _next_ordinal_to_read += 1;
2826                next_offset += envelope_size;
2827            }
2828
2829            let next_out_of_line = decoder.next_out_of_line();
2830            let handles_before = decoder.remaining_handles();
2831            if let Some((inlined, num_bytes, num_handles)) =
2832                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2833            {
2834                let member_inline_size =
2835                    <fidl_fuchsia_math::SizeU as fidl::encoding::TypeMarker>::inline_size(
2836                        decoder.context,
2837                    );
2838                if inlined != (member_inline_size <= 4) {
2839                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2840                }
2841                let inner_offset;
2842                let mut inner_depth = depth.clone();
2843                if inlined {
2844                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2845                    inner_offset = next_offset;
2846                } else {
2847                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2848                    inner_depth.increment()?;
2849                }
2850                let val_ref = self
2851                    .max_image_size
2852                    .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_math::SizeU, D));
2853                fidl::decode!(
2854                    fidl_fuchsia_math::SizeU,
2855                    D,
2856                    val_ref,
2857                    decoder,
2858                    inner_offset,
2859                    inner_depth
2860                )?;
2861                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2862                {
2863                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2864                }
2865                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2866                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2867                }
2868            }
2869
2870            next_offset += envelope_size;
2871            _next_ordinal_to_read += 1;
2872            if next_offset >= end_offset {
2873                return Ok(());
2874            }
2875
2876            // Decode unknown envelopes for gaps in ordinals.
2877            while _next_ordinal_to_read < 4 {
2878                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2879                _next_ordinal_to_read += 1;
2880                next_offset += envelope_size;
2881            }
2882
2883            let next_out_of_line = decoder.next_out_of_line();
2884            let handles_before = decoder.remaining_handles();
2885            if let Some((inlined, num_bytes, num_handles)) =
2886                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2887            {
2888                let member_inline_size =
2889                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2890                if inlined != (member_inline_size <= 4) {
2891                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2892                }
2893                let inner_offset;
2894                let mut inner_depth = depth.clone();
2895                if inlined {
2896                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2897                    inner_offset = next_offset;
2898                } else {
2899                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2900                    inner_depth.increment()?;
2901                }
2902                let val_ref =
2903                    self.allow_encryption.get_or_insert_with(|| fidl::new_empty!(bool, D));
2904                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
2905                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2906                {
2907                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2908                }
2909                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2910                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2911                }
2912            }
2913
2914            next_offset += envelope_size;
2915            _next_ordinal_to_read += 1;
2916            if next_offset >= end_offset {
2917                return Ok(());
2918            }
2919
2920            // Decode unknown envelopes for gaps in ordinals.
2921            while _next_ordinal_to_read < 5 {
2922                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2923                _next_ordinal_to_read += 1;
2924                next_offset += envelope_size;
2925            }
2926
2927            let next_out_of_line = decoder.next_out_of_line();
2928            let handles_before = decoder.remaining_handles();
2929            if let Some((inlined, num_bytes, num_handles)) =
2930                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2931            {
2932                let member_inline_size =
2933                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2934                if inlined != (member_inline_size <= 4) {
2935                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2936                }
2937                let inner_offset;
2938                let mut inner_depth = depth.clone();
2939                if inlined {
2940                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2941                    inner_offset = next_offset;
2942                } else {
2943                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2944                    inner_depth.increment()?;
2945                }
2946                let val_ref =
2947                    self.require_encryption.get_or_insert_with(|| fidl::new_empty!(bool, D));
2948                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
2949                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2950                {
2951                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2952                }
2953                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2954                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2955                }
2956            }
2957
2958            next_offset += envelope_size;
2959            _next_ordinal_to_read += 1;
2960            if next_offset >= end_offset {
2961                return Ok(());
2962            }
2963
2964            // Decode unknown envelopes for gaps in ordinals.
2965            while _next_ordinal_to_read < 6 {
2966                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2967                _next_ordinal_to_read += 1;
2968                next_offset += envelope_size;
2969            }
2970
2971            let next_out_of_line = decoder.next_out_of_line();
2972            let handles_before = decoder.remaining_handles();
2973            if let Some((inlined, num_bytes, num_handles)) =
2974                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2975            {
2976                let member_inline_size =
2977                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2978                if inlined != (member_inline_size <= 4) {
2979                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2980                }
2981                let inner_offset;
2982                let mut inner_depth = depth.clone();
2983                if inlined {
2984                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2985                    inner_offset = next_offset;
2986                } else {
2987                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2988                    inner_depth.increment()?;
2989                }
2990                let val_ref =
2991                    self.allow_input_protection.get_or_insert_with(|| fidl::new_empty!(bool, D));
2992                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
2993                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2994                {
2995                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2996                }
2997                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2998                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2999                }
3000            }
3001
3002            next_offset += envelope_size;
3003            _next_ordinal_to_read += 1;
3004            if next_offset >= end_offset {
3005                return Ok(());
3006            }
3007
3008            // Decode unknown envelopes for gaps in ordinals.
3009            while _next_ordinal_to_read < 7 {
3010                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3011                _next_ordinal_to_read += 1;
3012                next_offset += envelope_size;
3013            }
3014
3015            let next_out_of_line = decoder.next_out_of_line();
3016            let handles_before = decoder.remaining_handles();
3017            if let Some((inlined, num_bytes, num_handles)) =
3018                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3019            {
3020                let member_inline_size =
3021                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3022                if inlined != (member_inline_size <= 4) {
3023                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3024                }
3025                let inner_offset;
3026                let mut inner_depth = depth.clone();
3027                if inlined {
3028                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3029                    inner_offset = next_offset;
3030                } else {
3031                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3032                    inner_depth.increment()?;
3033                }
3034                let val_ref =
3035                    self.require_input_protection.get_or_insert_with(|| fidl::new_empty!(bool, D));
3036                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
3037                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3038                {
3039                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3040                }
3041                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3042                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3043                }
3044            }
3045
3046            next_offset += envelope_size;
3047            _next_ordinal_to_read += 1;
3048            if next_offset >= end_offset {
3049                return Ok(());
3050            }
3051
3052            // Decode unknown envelopes for gaps in ordinals.
3053            while _next_ordinal_to_read < 8 {
3054                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3055                _next_ordinal_to_read += 1;
3056                next_offset += envelope_size;
3057            }
3058
3059            let next_out_of_line = decoder.next_out_of_line();
3060            let handles_before = decoder.remaining_handles();
3061            if let Some((inlined, num_bytes, num_handles)) =
3062                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3063            {
3064                let member_inline_size =
3065                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3066                if inlined != (member_inline_size <= 4) {
3067                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3068                }
3069                let inner_offset;
3070                let mut inner_depth = depth.clone();
3071                if inlined {
3072                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3073                    inner_offset = next_offset;
3074                } else {
3075                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3076                    inner_depth.increment()?;
3077                }
3078                let val_ref =
3079                    self.can_stream_bytes_input.get_or_insert_with(|| fidl::new_empty!(bool, D));
3080                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
3081                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3082                {
3083                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3084                }
3085                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3086                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3087                }
3088            }
3089
3090            next_offset += envelope_size;
3091            _next_ordinal_to_read += 1;
3092            if next_offset >= end_offset {
3093                return Ok(());
3094            }
3095
3096            // Decode unknown envelopes for gaps in ordinals.
3097            while _next_ordinal_to_read < 9 {
3098                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3099                _next_ordinal_to_read += 1;
3100                next_offset += envelope_size;
3101            }
3102
3103            let next_out_of_line = decoder.next_out_of_line();
3104            let handles_before = decoder.remaining_handles();
3105            if let Some((inlined, num_bytes, num_handles)) =
3106                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3107            {
3108                let member_inline_size =
3109                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3110                if inlined != (member_inline_size <= 4) {
3111                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3112                }
3113                let inner_offset;
3114                let mut inner_depth = depth.clone();
3115                if inlined {
3116                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3117                    inner_offset = next_offset;
3118                } else {
3119                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3120                    inner_depth.increment()?;
3121                }
3122                let val_ref = self.can_find_start.get_or_insert_with(|| fidl::new_empty!(bool, D));
3123                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
3124                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3125                {
3126                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3127                }
3128                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3129                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3130                }
3131            }
3132
3133            next_offset += envelope_size;
3134            _next_ordinal_to_read += 1;
3135            if next_offset >= end_offset {
3136                return Ok(());
3137            }
3138
3139            // Decode unknown envelopes for gaps in ordinals.
3140            while _next_ordinal_to_read < 10 {
3141                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3142                _next_ordinal_to_read += 1;
3143                next_offset += envelope_size;
3144            }
3145
3146            let next_out_of_line = decoder.next_out_of_line();
3147            let handles_before = decoder.remaining_handles();
3148            if let Some((inlined, num_bytes, num_handles)) =
3149                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3150            {
3151                let member_inline_size =
3152                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3153                if inlined != (member_inline_size <= 4) {
3154                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3155                }
3156                let inner_offset;
3157                let mut inner_depth = depth.clone();
3158                if inlined {
3159                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3160                    inner_offset = next_offset;
3161                } else {
3162                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3163                    inner_depth.increment()?;
3164                }
3165                let val_ref = self.can_re_sync.get_or_insert_with(|| fidl::new_empty!(bool, D));
3166                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
3167                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3168                {
3169                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3170                }
3171                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3172                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3173                }
3174            }
3175
3176            next_offset += envelope_size;
3177            _next_ordinal_to_read += 1;
3178            if next_offset >= end_offset {
3179                return Ok(());
3180            }
3181
3182            // Decode unknown envelopes for gaps in ordinals.
3183            while _next_ordinal_to_read < 11 {
3184                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3185                _next_ordinal_to_read += 1;
3186                next_offset += envelope_size;
3187            }
3188
3189            let next_out_of_line = decoder.next_out_of_line();
3190            let handles_before = decoder.remaining_handles();
3191            if let Some((inlined, num_bytes, num_handles)) =
3192                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3193            {
3194                let member_inline_size =
3195                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3196                if inlined != (member_inline_size <= 4) {
3197                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3198                }
3199                let inner_offset;
3200                let mut inner_depth = depth.clone();
3201                if inlined {
3202                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3203                    inner_offset = next_offset;
3204                } else {
3205                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3206                    inner_depth.increment()?;
3207                }
3208                let val_ref = self
3209                    .will_report_all_detected_errors
3210                    .get_or_insert_with(|| fidl::new_empty!(bool, D));
3211                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
3212                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3213                {
3214                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3215                }
3216                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3217                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3218                }
3219            }
3220
3221            next_offset += envelope_size;
3222            _next_ordinal_to_read += 1;
3223            if next_offset >= end_offset {
3224                return Ok(());
3225            }
3226
3227            // Decode unknown envelopes for gaps in ordinals.
3228            while _next_ordinal_to_read < 12 {
3229                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3230                _next_ordinal_to_read += 1;
3231                next_offset += envelope_size;
3232            }
3233
3234            let next_out_of_line = decoder.next_out_of_line();
3235            let handles_before = decoder.remaining_handles();
3236            if let Some((inlined, num_bytes, num_handles)) =
3237                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3238            {
3239                let member_inline_size =
3240                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3241                if inlined != (member_inline_size <= 4) {
3242                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3243                }
3244                let inner_offset;
3245                let mut inner_depth = depth.clone();
3246                if inlined {
3247                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3248                    inner_offset = next_offset;
3249                } else {
3250                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3251                    inner_depth.increment()?;
3252                }
3253                let val_ref =
3254                    self.split_header_handling.get_or_insert_with(|| fidl::new_empty!(bool, D));
3255                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
3256                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3257                {
3258                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3259                }
3260                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3261                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3262                }
3263            }
3264
3265            next_offset += envelope_size;
3266
3267            // Decode the remaining unknown envelopes.
3268            while next_offset < end_offset {
3269                _next_ordinal_to_read += 1;
3270                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3271                next_offset += envelope_size;
3272            }
3273
3274            Ok(())
3275        }
3276    }
3277
3278    impl DetailedCodecDescription {
3279        #[inline(always)]
3280        fn max_ordinal_present(&self) -> u64 {
3281            if let Some(_) = self.profile_descriptions {
3282                return 4;
3283            }
3284            if let Some(_) = self.is_hw {
3285                return 3;
3286            }
3287            if let Some(_) = self.mime_type {
3288                return 2;
3289            }
3290            if let Some(_) = self.codec_type {
3291                return 1;
3292            }
3293            0
3294        }
3295    }
3296
3297    impl fidl::encoding::ValueTypeMarker for DetailedCodecDescription {
3298        type Borrowed<'a> = &'a Self;
3299        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3300            value
3301        }
3302    }
3303
3304    unsafe impl fidl::encoding::TypeMarker for DetailedCodecDescription {
3305        type Owned = Self;
3306
3307        #[inline(always)]
3308        fn inline_align(_context: fidl::encoding::Context) -> usize {
3309            8
3310        }
3311
3312        #[inline(always)]
3313        fn inline_size(_context: fidl::encoding::Context) -> usize {
3314            16
3315        }
3316    }
3317
3318    unsafe impl<D: fidl::encoding::ResourceDialect>
3319        fidl::encoding::Encode<DetailedCodecDescription, D> for &DetailedCodecDescription
3320    {
3321        unsafe fn encode(
3322            self,
3323            encoder: &mut fidl::encoding::Encoder<'_, D>,
3324            offset: usize,
3325            mut depth: fidl::encoding::Depth,
3326        ) -> fidl::Result<()> {
3327            encoder.debug_check_bounds::<DetailedCodecDescription>(offset);
3328            // Vector header
3329            let max_ordinal: u64 = self.max_ordinal_present();
3330            encoder.write_num(max_ordinal, offset);
3331            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3332            // Calling encoder.out_of_line_offset(0) is not allowed.
3333            if max_ordinal == 0 {
3334                return Ok(());
3335            }
3336            depth.increment()?;
3337            let envelope_size = 8;
3338            let bytes_len = max_ordinal as usize * envelope_size;
3339            #[allow(unused_variables)]
3340            let offset = encoder.out_of_line_offset(bytes_len);
3341            let mut _prev_end_offset: usize = 0;
3342            if 1 > max_ordinal {
3343                return Ok(());
3344            }
3345
3346            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3347            // are envelope_size bytes.
3348            let cur_offset: usize = (1 - 1) * envelope_size;
3349
3350            // Zero reserved fields.
3351            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3352
3353            // Safety:
3354            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3355            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3356            //   envelope_size bytes, there is always sufficient room.
3357            fidl::encoding::encode_in_envelope_optional::<CodecType, D>(
3358                self.codec_type
3359                    .as_ref()
3360                    .map(<CodecType as fidl::encoding::ValueTypeMarker>::borrow),
3361                encoder,
3362                offset + cur_offset,
3363                depth,
3364            )?;
3365
3366            _prev_end_offset = cur_offset + envelope_size;
3367            if 2 > max_ordinal {
3368                return Ok(());
3369            }
3370
3371            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3372            // are envelope_size bytes.
3373            let cur_offset: usize = (2 - 1) * envelope_size;
3374
3375            // Zero reserved fields.
3376            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3377
3378            // Safety:
3379            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3380            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3381            //   envelope_size bytes, there is always sufficient room.
3382            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<256>, D>(
3383                self.mime_type.as_ref().map(
3384                    <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow,
3385                ),
3386                encoder,
3387                offset + cur_offset,
3388                depth,
3389            )?;
3390
3391            _prev_end_offset = cur_offset + envelope_size;
3392            if 3 > max_ordinal {
3393                return Ok(());
3394            }
3395
3396            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3397            // are envelope_size bytes.
3398            let cur_offset: usize = (3 - 1) * envelope_size;
3399
3400            // Zero reserved fields.
3401            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3402
3403            // Safety:
3404            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3405            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3406            //   envelope_size bytes, there is always sufficient room.
3407            fidl::encoding::encode_in_envelope_optional::<bool, D>(
3408                self.is_hw.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
3409                encoder,
3410                offset + cur_offset,
3411                depth,
3412            )?;
3413
3414            _prev_end_offset = cur_offset + envelope_size;
3415            if 4 > max_ordinal {
3416                return Ok(());
3417            }
3418
3419            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3420            // are envelope_size bytes.
3421            let cur_offset: usize = (4 - 1) * envelope_size;
3422
3423            // Zero reserved fields.
3424            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3425
3426            // Safety:
3427            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3428            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3429            //   envelope_size bytes, there is always sufficient room.
3430            fidl::encoding::encode_in_envelope_optional::<ProfileDescriptions, D>(
3431                self.profile_descriptions
3432                    .as_ref()
3433                    .map(<ProfileDescriptions as fidl::encoding::ValueTypeMarker>::borrow),
3434                encoder,
3435                offset + cur_offset,
3436                depth,
3437            )?;
3438
3439            _prev_end_offset = cur_offset + envelope_size;
3440
3441            Ok(())
3442        }
3443    }
3444
3445    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3446        for DetailedCodecDescription
3447    {
3448        #[inline(always)]
3449        fn new_empty() -> Self {
3450            Self::default()
3451        }
3452
3453        unsafe fn decode(
3454            &mut self,
3455            decoder: &mut fidl::encoding::Decoder<'_, D>,
3456            offset: usize,
3457            mut depth: fidl::encoding::Depth,
3458        ) -> fidl::Result<()> {
3459            decoder.debug_check_bounds::<Self>(offset);
3460            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3461                None => return Err(fidl::Error::NotNullable),
3462                Some(len) => len,
3463            };
3464            // Calling decoder.out_of_line_offset(0) is not allowed.
3465            if len == 0 {
3466                return Ok(());
3467            };
3468            depth.increment()?;
3469            let envelope_size = 8;
3470            let bytes_len = len * envelope_size;
3471            let offset = decoder.out_of_line_offset(bytes_len)?;
3472            // Decode the envelope for each type.
3473            let mut _next_ordinal_to_read = 0;
3474            let mut next_offset = offset;
3475            let end_offset = offset + bytes_len;
3476            _next_ordinal_to_read += 1;
3477            if next_offset >= end_offset {
3478                return Ok(());
3479            }
3480
3481            // Decode unknown envelopes for gaps in ordinals.
3482            while _next_ordinal_to_read < 1 {
3483                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3484                _next_ordinal_to_read += 1;
3485                next_offset += envelope_size;
3486            }
3487
3488            let next_out_of_line = decoder.next_out_of_line();
3489            let handles_before = decoder.remaining_handles();
3490            if let Some((inlined, num_bytes, num_handles)) =
3491                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3492            {
3493                let member_inline_size =
3494                    <CodecType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3495                if inlined != (member_inline_size <= 4) {
3496                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3497                }
3498                let inner_offset;
3499                let mut inner_depth = depth.clone();
3500                if inlined {
3501                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3502                    inner_offset = next_offset;
3503                } else {
3504                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3505                    inner_depth.increment()?;
3506                }
3507                let val_ref = self.codec_type.get_or_insert_with(|| fidl::new_empty!(CodecType, D));
3508                fidl::decode!(CodecType, D, val_ref, decoder, inner_offset, inner_depth)?;
3509                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3510                {
3511                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3512                }
3513                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3514                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3515                }
3516            }
3517
3518            next_offset += envelope_size;
3519            _next_ordinal_to_read += 1;
3520            if next_offset >= end_offset {
3521                return Ok(());
3522            }
3523
3524            // Decode unknown envelopes for gaps in ordinals.
3525            while _next_ordinal_to_read < 2 {
3526                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3527                _next_ordinal_to_read += 1;
3528                next_offset += envelope_size;
3529            }
3530
3531            let next_out_of_line = decoder.next_out_of_line();
3532            let handles_before = decoder.remaining_handles();
3533            if let Some((inlined, num_bytes, num_handles)) =
3534                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3535            {
3536                let member_inline_size =
3537                    <fidl::encoding::BoundedString<256> as fidl::encoding::TypeMarker>::inline_size(
3538                        decoder.context,
3539                    );
3540                if inlined != (member_inline_size <= 4) {
3541                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3542                }
3543                let inner_offset;
3544                let mut inner_depth = depth.clone();
3545                if inlined {
3546                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3547                    inner_offset = next_offset;
3548                } else {
3549                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3550                    inner_depth.increment()?;
3551                }
3552                let val_ref = self
3553                    .mime_type
3554                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<256>, D));
3555                fidl::decode!(
3556                    fidl::encoding::BoundedString<256>,
3557                    D,
3558                    val_ref,
3559                    decoder,
3560                    inner_offset,
3561                    inner_depth
3562                )?;
3563                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3564                {
3565                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3566                }
3567                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3568                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3569                }
3570            }
3571
3572            next_offset += envelope_size;
3573            _next_ordinal_to_read += 1;
3574            if next_offset >= end_offset {
3575                return Ok(());
3576            }
3577
3578            // Decode unknown envelopes for gaps in ordinals.
3579            while _next_ordinal_to_read < 3 {
3580                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3581                _next_ordinal_to_read += 1;
3582                next_offset += envelope_size;
3583            }
3584
3585            let next_out_of_line = decoder.next_out_of_line();
3586            let handles_before = decoder.remaining_handles();
3587            if let Some((inlined, num_bytes, num_handles)) =
3588                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3589            {
3590                let member_inline_size =
3591                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3592                if inlined != (member_inline_size <= 4) {
3593                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3594                }
3595                let inner_offset;
3596                let mut inner_depth = depth.clone();
3597                if inlined {
3598                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3599                    inner_offset = next_offset;
3600                } else {
3601                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3602                    inner_depth.increment()?;
3603                }
3604                let val_ref = self.is_hw.get_or_insert_with(|| fidl::new_empty!(bool, D));
3605                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
3606                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3607                {
3608                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3609                }
3610                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3611                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3612                }
3613            }
3614
3615            next_offset += envelope_size;
3616            _next_ordinal_to_read += 1;
3617            if next_offset >= end_offset {
3618                return Ok(());
3619            }
3620
3621            // Decode unknown envelopes for gaps in ordinals.
3622            while _next_ordinal_to_read < 4 {
3623                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3624                _next_ordinal_to_read += 1;
3625                next_offset += envelope_size;
3626            }
3627
3628            let next_out_of_line = decoder.next_out_of_line();
3629            let handles_before = decoder.remaining_handles();
3630            if let Some((inlined, num_bytes, num_handles)) =
3631                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3632            {
3633                let member_inline_size =
3634                    <ProfileDescriptions as fidl::encoding::TypeMarker>::inline_size(
3635                        decoder.context,
3636                    );
3637                if inlined != (member_inline_size <= 4) {
3638                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3639                }
3640                let inner_offset;
3641                let mut inner_depth = depth.clone();
3642                if inlined {
3643                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3644                    inner_offset = next_offset;
3645                } else {
3646                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3647                    inner_depth.increment()?;
3648                }
3649                let val_ref = self
3650                    .profile_descriptions
3651                    .get_or_insert_with(|| fidl::new_empty!(ProfileDescriptions, D));
3652                fidl::decode!(ProfileDescriptions, D, val_ref, decoder, inner_offset, inner_depth)?;
3653                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3654                {
3655                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3656                }
3657                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3658                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3659                }
3660            }
3661
3662            next_offset += envelope_size;
3663
3664            // Decode the remaining unknown envelopes.
3665            while next_offset < end_offset {
3666                _next_ordinal_to_read += 1;
3667                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3668                next_offset += envelope_size;
3669            }
3670
3671            Ok(())
3672        }
3673    }
3674
3675    impl EncoderProfileDescription {
3676        #[inline(always)]
3677        fn max_ordinal_present(&self) -> u64 {
3678            if let Some(_) = self.profile {
3679                return 1;
3680            }
3681            0
3682        }
3683    }
3684
3685    impl fidl::encoding::ValueTypeMarker for EncoderProfileDescription {
3686        type Borrowed<'a> = &'a Self;
3687        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3688            value
3689        }
3690    }
3691
3692    unsafe impl fidl::encoding::TypeMarker for EncoderProfileDescription {
3693        type Owned = Self;
3694
3695        #[inline(always)]
3696        fn inline_align(_context: fidl::encoding::Context) -> usize {
3697            8
3698        }
3699
3700        #[inline(always)]
3701        fn inline_size(_context: fidl::encoding::Context) -> usize {
3702            16
3703        }
3704    }
3705
3706    unsafe impl<D: fidl::encoding::ResourceDialect>
3707        fidl::encoding::Encode<EncoderProfileDescription, D> for &EncoderProfileDescription
3708    {
3709        unsafe fn encode(
3710            self,
3711            encoder: &mut fidl::encoding::Encoder<'_, D>,
3712            offset: usize,
3713            mut depth: fidl::encoding::Depth,
3714        ) -> fidl::Result<()> {
3715            encoder.debug_check_bounds::<EncoderProfileDescription>(offset);
3716            // Vector header
3717            let max_ordinal: u64 = self.max_ordinal_present();
3718            encoder.write_num(max_ordinal, offset);
3719            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3720            // Calling encoder.out_of_line_offset(0) is not allowed.
3721            if max_ordinal == 0 {
3722                return Ok(());
3723            }
3724            depth.increment()?;
3725            let envelope_size = 8;
3726            let bytes_len = max_ordinal as usize * envelope_size;
3727            #[allow(unused_variables)]
3728            let offset = encoder.out_of_line_offset(bytes_len);
3729            let mut _prev_end_offset: usize = 0;
3730            if 1 > max_ordinal {
3731                return Ok(());
3732            }
3733
3734            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3735            // are envelope_size bytes.
3736            let cur_offset: usize = (1 - 1) * envelope_size;
3737
3738            // Zero reserved fields.
3739            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3740
3741            // Safety:
3742            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3743            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3744            //   envelope_size bytes, there is always sufficient room.
3745            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_media::CodecProfile, D>(
3746                self.profile.as_ref().map(
3747                    <fidl_fuchsia_media::CodecProfile as fidl::encoding::ValueTypeMarker>::borrow,
3748                ),
3749                encoder,
3750                offset + cur_offset,
3751                depth,
3752            )?;
3753
3754            _prev_end_offset = cur_offset + envelope_size;
3755
3756            Ok(())
3757        }
3758    }
3759
3760    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3761        for EncoderProfileDescription
3762    {
3763        #[inline(always)]
3764        fn new_empty() -> Self {
3765            Self::default()
3766        }
3767
3768        unsafe fn decode(
3769            &mut self,
3770            decoder: &mut fidl::encoding::Decoder<'_, D>,
3771            offset: usize,
3772            mut depth: fidl::encoding::Depth,
3773        ) -> fidl::Result<()> {
3774            decoder.debug_check_bounds::<Self>(offset);
3775            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3776                None => return Err(fidl::Error::NotNullable),
3777                Some(len) => len,
3778            };
3779            // Calling decoder.out_of_line_offset(0) is not allowed.
3780            if len == 0 {
3781                return Ok(());
3782            };
3783            depth.increment()?;
3784            let envelope_size = 8;
3785            let bytes_len = len * envelope_size;
3786            let offset = decoder.out_of_line_offset(bytes_len)?;
3787            // Decode the envelope for each type.
3788            let mut _next_ordinal_to_read = 0;
3789            let mut next_offset = offset;
3790            let end_offset = offset + bytes_len;
3791            _next_ordinal_to_read += 1;
3792            if next_offset >= end_offset {
3793                return Ok(());
3794            }
3795
3796            // Decode unknown envelopes for gaps in ordinals.
3797            while _next_ordinal_to_read < 1 {
3798                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3799                _next_ordinal_to_read += 1;
3800                next_offset += envelope_size;
3801            }
3802
3803            let next_out_of_line = decoder.next_out_of_line();
3804            let handles_before = decoder.remaining_handles();
3805            if let Some((inlined, num_bytes, num_handles)) =
3806                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3807            {
3808                let member_inline_size =
3809                    <fidl_fuchsia_media::CodecProfile as fidl::encoding::TypeMarker>::inline_size(
3810                        decoder.context,
3811                    );
3812                if inlined != (member_inline_size <= 4) {
3813                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3814                }
3815                let inner_offset;
3816                let mut inner_depth = depth.clone();
3817                if inlined {
3818                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3819                    inner_offset = next_offset;
3820                } else {
3821                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3822                    inner_depth.increment()?;
3823                }
3824                let val_ref = self
3825                    .profile
3826                    .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_media::CodecProfile, D));
3827                fidl::decode!(
3828                    fidl_fuchsia_media::CodecProfile,
3829                    D,
3830                    val_ref,
3831                    decoder,
3832                    inner_offset,
3833                    inner_depth
3834                )?;
3835                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3836                {
3837                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3838                }
3839                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3840                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3841                }
3842            }
3843
3844            next_offset += envelope_size;
3845
3846            // Decode the remaining unknown envelopes.
3847            while next_offset < end_offset {
3848                _next_ordinal_to_read += 1;
3849                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3850                next_offset += envelope_size;
3851            }
3852
3853            Ok(())
3854        }
3855    }
3856
3857    impl fidl::encoding::ValueTypeMarker for ProfileDescriptions {
3858        type Borrowed<'a> = &'a Self;
3859        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3860            value
3861        }
3862    }
3863
3864    unsafe impl fidl::encoding::TypeMarker for ProfileDescriptions {
3865        type Owned = Self;
3866
3867        #[inline(always)]
3868        fn inline_align(_context: fidl::encoding::Context) -> usize {
3869            8
3870        }
3871
3872        #[inline(always)]
3873        fn inline_size(_context: fidl::encoding::Context) -> usize {
3874            16
3875        }
3876    }
3877
3878    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ProfileDescriptions, D>
3879        for &ProfileDescriptions
3880    {
3881        #[inline]
3882        unsafe fn encode(
3883            self,
3884            encoder: &mut fidl::encoding::Encoder<'_, D>,
3885            offset: usize,
3886            _depth: fidl::encoding::Depth,
3887        ) -> fidl::Result<()> {
3888            encoder.debug_check_bounds::<ProfileDescriptions>(offset);
3889            encoder.write_num::<u64>(self.ordinal(), offset);
3890            match self {
3891            ProfileDescriptions::DecoderProfileDescriptions(ref val) => {
3892                fidl::encoding::encode_in_envelope::<fidl::encoding::Vector<DecoderProfileDescription, 256>, D>(
3893                    <fidl::encoding::Vector<DecoderProfileDescription, 256> as fidl::encoding::ValueTypeMarker>::borrow(val),
3894                    encoder, offset + 8, _depth
3895                )
3896            }
3897            ProfileDescriptions::EncoderProfileDescriptions(ref val) => {
3898                fidl::encoding::encode_in_envelope::<fidl::encoding::Vector<EncoderProfileDescription, 256>, D>(
3899                    <fidl::encoding::Vector<EncoderProfileDescription, 256> as fidl::encoding::ValueTypeMarker>::borrow(val),
3900                    encoder, offset + 8, _depth
3901                )
3902            }
3903        }
3904        }
3905    }
3906
3907    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ProfileDescriptions {
3908        #[inline(always)]
3909        fn new_empty() -> Self {
3910            Self::DecoderProfileDescriptions(
3911                fidl::new_empty!(fidl::encoding::Vector<DecoderProfileDescription, 256>, D),
3912            )
3913        }
3914
3915        #[inline]
3916        unsafe fn decode(
3917            &mut self,
3918            decoder: &mut fidl::encoding::Decoder<'_, D>,
3919            offset: usize,
3920            mut depth: fidl::encoding::Depth,
3921        ) -> fidl::Result<()> {
3922            decoder.debug_check_bounds::<Self>(offset);
3923            #[allow(unused_variables)]
3924            let next_out_of_line = decoder.next_out_of_line();
3925            let handles_before = decoder.remaining_handles();
3926            let (ordinal, inlined, num_bytes, num_handles) =
3927                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
3928
3929            let member_inline_size = match ordinal {
3930            1 => <fidl::encoding::Vector<DecoderProfileDescription, 256> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3931            2 => <fidl::encoding::Vector<EncoderProfileDescription, 256> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3932            _ => return Err(fidl::Error::UnknownUnionTag),
3933        };
3934
3935            if inlined != (member_inline_size <= 4) {
3936                return Err(fidl::Error::InvalidInlineBitInEnvelope);
3937            }
3938            let _inner_offset;
3939            if inlined {
3940                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
3941                _inner_offset = offset + 8;
3942            } else {
3943                depth.increment()?;
3944                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3945            }
3946            match ordinal {
3947                1 => {
3948                    #[allow(irrefutable_let_patterns)]
3949                    if let ProfileDescriptions::DecoderProfileDescriptions(_) = self {
3950                        // Do nothing, read the value into the object
3951                    } else {
3952                        // Initialize `self` to the right variant
3953                        *self = ProfileDescriptions::DecoderProfileDescriptions(
3954                            fidl::new_empty!(fidl::encoding::Vector<DecoderProfileDescription, 256>, D),
3955                        );
3956                    }
3957                    #[allow(irrefutable_let_patterns)]
3958                    if let ProfileDescriptions::DecoderProfileDescriptions(ref mut val) = self {
3959                        fidl::decode!(fidl::encoding::Vector<DecoderProfileDescription, 256>, D, val, decoder, _inner_offset, depth)?;
3960                    } else {
3961                        unreachable!()
3962                    }
3963                }
3964                2 => {
3965                    #[allow(irrefutable_let_patterns)]
3966                    if let ProfileDescriptions::EncoderProfileDescriptions(_) = self {
3967                        // Do nothing, read the value into the object
3968                    } else {
3969                        // Initialize `self` to the right variant
3970                        *self = ProfileDescriptions::EncoderProfileDescriptions(
3971                            fidl::new_empty!(fidl::encoding::Vector<EncoderProfileDescription, 256>, D),
3972                        );
3973                    }
3974                    #[allow(irrefutable_let_patterns)]
3975                    if let ProfileDescriptions::EncoderProfileDescriptions(ref mut val) = self {
3976                        fidl::decode!(fidl::encoding::Vector<EncoderProfileDescription, 256>, D, val, decoder, _inner_offset, depth)?;
3977                    } else {
3978                        unreachable!()
3979                    }
3980                }
3981                ordinal => panic!("unexpected ordinal {:?}", ordinal),
3982            }
3983            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
3984                return Err(fidl::Error::InvalidNumBytesInEnvelope);
3985            }
3986            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3987                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3988            }
3989            Ok(())
3990        }
3991    }
3992}