Skip to main content

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