fidl_fuchsia_mediacodec__common/
fidl_fuchsia_mediacodec__common.rs

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