fidl_fuchsia_media_sessions2__common/
fidl_fuchsia_media_sessions2__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/// A domain identifies the ecosystem in which the session takes place.
12///
13/// Domains should take the form of
14///
15///    `domain://<unique name for protocol>.version`
16///
17/// The `|` symbol is reserved and should not be used in a domain string.
18pub type Domain = String;
19
20pub type SessionId = u64;
21
22bitflags! {
23    #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
24    pub struct PlayerCapabilityFlags: u32 {
25        /// If set, the player can `Play()`.
26        const PLAY = 1;
27        /// If set, the player can `Pause()`.
28        const PAUSE = 4;
29        /// If set, the player can `Seek()`.
30        const SEEK = 8;
31        /// If set, the player can `SkipForward()`.
32        const SKIP_FORWARD = 16;
33        /// If set, the player can `SkipReverse()`.
34        const SKIP_REVERSE = 32;
35        /// If set, the player can shuffle media.
36        const SHUFFLE = 64;
37        const CHANGE_TO_NEXT_ITEM = 128;
38        const CHANGE_TO_PREV_ITEM = 256;
39        /// If set, the player can `BindGainControl()`.
40        const HAS_GAIN_CONTROL = 512;
41        /// If set, the player can repeat groups.
42        const REPEAT_GROUPS = 1024;
43        /// If set, the player can repeat single media items.
44        const REPEAT_SINGLE = 2048;
45        /// If set, the player can accept playback rate changes.
46        const SET_PLAYBACK_RATE = 4096;
47    }
48}
49
50impl PlayerCapabilityFlags {}
51
52/// The type of content playing back, which should be set to the largest
53/// applicable value.
54#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
55#[repr(u32)]
56pub enum ContentType {
57    /// Content does not qualify for any of the other values.
58    Other = 1,
59    /// Audio-only content that does not qualify as music.
60    Audio = 2,
61    /// Video-only or audio-video content that does not qualify as a TV show or a movie.
62    Video = 3,
63    /// Audio-only content generally recognized as music.
64    Music = 4,
65    /// Audio-video content that is part of a television or streaming series.
66    TvShow = 5,
67    /// Audio-video content consisting of a feature film.
68    Movie = 6,
69}
70
71impl ContentType {
72    #[inline]
73    pub fn from_primitive(prim: u32) -> Option<Self> {
74        match prim {
75            1 => Some(Self::Other),
76            2 => Some(Self::Audio),
77            3 => Some(Self::Video),
78            4 => Some(Self::Music),
79            5 => Some(Self::TvShow),
80            6 => Some(Self::Movie),
81            _ => None,
82        }
83    }
84
85    #[inline]
86    pub const fn into_primitive(self) -> u32 {
87        self as u32
88    }
89}
90
91#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
92#[repr(u32)]
93pub enum Error {
94    Other = 1,
95}
96
97impl Error {
98    #[inline]
99    pub fn from_primitive(prim: u32) -> Option<Self> {
100        match prim {
101            1 => Some(Self::Other),
102            _ => None,
103        }
104    }
105
106    #[inline]
107    pub const fn into_primitive(self) -> u32 {
108        self as u32
109    }
110}
111
112/// The behavior enforced on the player when it is
113/// interrupted, such as by an alarm.
114///
115/// Interruptions are detected using the player's usage.
116///
117/// By default the interruption behavior is `NONE`.
118#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
119#[repr(u32)]
120pub enum InterruptionBehavior {
121    /// Interruptions have no effect on the player
122    /// and it may continue in spite of reduced audibility.
123    None = 0,
124    /// With this behavior, when playback is interrupted, the player
125    /// will be paused until the interruption is over, so the user
126    /// does not miss any content.
127    Pause = 1,
128}
129
130impl InterruptionBehavior {
131    #[inline]
132    pub fn from_primitive(prim: u32) -> Option<Self> {
133        match prim {
134            0 => Some(Self::None),
135            1 => Some(Self::Pause),
136            _ => None,
137        }
138    }
139
140    #[inline]
141    pub const fn into_primitive(self) -> u32 {
142        self as u32
143    }
144}
145
146#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
147#[repr(u32)]
148pub enum MediaImageType {
149    /// Artwork for the playing media.
150    Artwork = 0,
151    /// An icon for the source of the playing media (e.g. the player or
152    /// streaming service).
153    SourceIcon = 1,
154}
155
156impl MediaImageType {
157    #[inline]
158    pub fn from_primitive(prim: u32) -> Option<Self> {
159        match prim {
160            0 => Some(Self::Artwork),
161            1 => Some(Self::SourceIcon),
162            _ => None,
163        }
164    }
165
166    #[inline]
167    pub const fn into_primitive(self) -> u32 {
168        self as u32
169    }
170}
171
172/// State of a media player.
173#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
174#[repr(u32)]
175pub enum PlayerState {
176    /// The initial state of a session if there is no associated media.
177    Idle = 0,
178    /// The player is playing.
179    Playing = 1,
180    /// The player is paused.
181    Paused = 2,
182    /// The player would be playing, but is temporarily paused for buffering.
183    Buffering = 3,
184    /// The player cannot recover from this state and will close.
185    Error = 4,
186}
187
188impl PlayerState {
189    #[inline]
190    pub fn from_primitive(prim: u32) -> Option<Self> {
191        match prim {
192            0 => Some(Self::Idle),
193            1 => Some(Self::Playing),
194            2 => Some(Self::Paused),
195            3 => Some(Self::Buffering),
196            4 => Some(Self::Error),
197            _ => None,
198        }
199    }
200
201    #[inline]
202    pub const fn into_primitive(self) -> u32 {
203        self as u32
204    }
205}
206
207/// Modes of repeating playback of the current media.
208#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
209#[repr(u32)]
210pub enum RepeatMode {
211    /// No repeat.
212    Off = 0,
213    /// Repeat the relevant group of media (e.g. playlist).
214    Group = 1,
215    /// Repeat the currently playing media.
216    Single = 2,
217}
218
219impl RepeatMode {
220    #[inline]
221    pub fn from_primitive(prim: u32) -> Option<Self> {
222        match prim {
223            0 => Some(Self::Off),
224            1 => Some(Self::Group),
225            2 => Some(Self::Single),
226            _ => None,
227        }
228    }
229
230    #[inline]
231    pub const fn into_primitive(self) -> u32 {
232        self as u32
233    }
234}
235
236/// A variant of an image at a specific size.
237#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
238pub struct ImageSizeVariant {
239    pub url: String,
240    pub width: u32,
241    pub height: u32,
242}
243
244impl fidl::Persistable for ImageSizeVariant {}
245
246#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
247#[repr(C)]
248pub struct PlayerControlSeekRequest {
249    pub position: i64,
250}
251
252impl fidl::Persistable for PlayerControlSeekRequest {}
253
254#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
255pub struct PlayerControlSetPlaybackRateRequest {
256    pub playback_rate: f32,
257}
258
259impl fidl::Persistable for PlayerControlSetPlaybackRateRequest {}
260
261#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
262pub struct PlayerControlSetRepeatModeRequest {
263    pub repeat_mode: RepeatMode,
264}
265
266impl fidl::Persistable for PlayerControlSetRepeatModeRequest {}
267
268#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
269pub struct PlayerControlSetShuffleModeRequest {
270    pub shuffle_on: bool,
271}
272
273impl fidl::Persistable for PlayerControlSetShuffleModeRequest {}
274
275#[derive(Clone, Debug, PartialEq)]
276pub struct PlayerWatchInfoChangeResponse {
277    pub player_info_delta: PlayerInfoDelta,
278}
279
280impl fidl::Persistable for PlayerWatchInfoChangeResponse {}
281
282#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
283#[repr(C)]
284pub struct PublisherPublishResponse {
285    pub session_id: u64,
286}
287
288impl fidl::Persistable for PublisherPublishResponse {}
289
290#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
291#[repr(C)]
292pub struct SessionControlSeekRequest {
293    pub position: i64,
294}
295
296impl fidl::Persistable for SessionControlSeekRequest {}
297
298#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
299pub struct SessionControlSetPlaybackRateRequest {
300    pub playback_rate: f32,
301}
302
303impl fidl::Persistable for SessionControlSetPlaybackRateRequest {}
304
305#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
306pub struct SessionControlSetRepeatModeRequest {
307    pub repeat_mode: RepeatMode,
308}
309
310impl fidl::Persistable for SessionControlSetRepeatModeRequest {}
311
312#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
313pub struct SessionControlSetShuffleModeRequest {
314    pub shuffle_on: bool,
315}
316
317impl fidl::Persistable for SessionControlSetShuffleModeRequest {}
318
319#[derive(Clone, Debug, PartialEq)]
320pub struct SessionControlWatchStatusResponse {
321    pub session_info_delta: SessionInfoDelta,
322}
323
324impl fidl::Persistable for SessionControlWatchStatusResponse {}
325
326#[derive(Clone, Debug, PartialEq)]
327pub struct SessionObserverWatchStatusResponse {
328    pub session_info_delta: SessionInfoDelta,
329}
330
331impl fidl::Persistable for SessionObserverWatchStatusResponse {}
332
333#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
334#[repr(C)]
335pub struct SessionsWatcherSessionRemovedRequest {
336    pub session_id: u64,
337}
338
339impl fidl::Persistable for SessionsWatcherSessionRemovedRequest {}
340
341#[derive(Clone, Debug, PartialEq)]
342pub struct SessionsWatcherSessionUpdatedRequest {
343    pub session_id: u64,
344    pub session_info_delta: SessionInfoDelta,
345}
346
347impl fidl::Persistable for SessionsWatcherSessionUpdatedRequest {}
348
349/// An image for playing media.
350#[derive(Clone, Debug, Default, PartialEq)]
351pub struct MediaImage {
352    pub image_type: Option<MediaImageType>,
353    /// Available variants of the image.
354    pub sizes: Option<Vec<ImageSizeVariant>>,
355    #[doc(hidden)]
356    pub __source_breaking: fidl::marker::SourceBreaking,
357}
358
359impl fidl::Persistable for MediaImage {}
360
361/// Describes the capabilities of a player.
362#[derive(Clone, Debug, Default, PartialEq)]
363pub struct PlayerCapabilities {
364    /// Indicates which capabilities are supported by the player. See `PlayerControl` for
365    /// details.
366    pub flags: Option<PlayerCapabilityFlags>,
367    #[doc(hidden)]
368    pub __source_breaking: fidl::marker::SourceBreaking,
369}
370
371impl fidl::Persistable for PlayerCapabilities {}
372
373/// When emitted, fields that have changed should be set.
374/// The first emission to a new client should be a snapshot.
375#[derive(Clone, Debug, Default, PartialEq)]
376pub struct PlayerInfoDelta {
377    /// Whether the entry point for the media into our device network is the
378    /// local machine; this should be true if this is the device streaming
379    /// from a music service, but false or omitted if this machine is just
380    /// receiving an audio stream to act as a speaker.
381    ///
382    /// If omitted, the value is unchanged. Initially, this value is `true`.
383    pub local: Option<bool>,
384    /// The status of the player.
385    ///
386    /// If omitted, all constituent values are unchanged. If a field within `PlayerStatus` is
387    /// omitted, its value is unchanged. Initial values are indicated for each field in
388    /// `player_status`.
389    pub player_status: Option<PlayerStatus>,
390    /// The metadata of the playing media.
391    ///
392    /// If omitted, the metadata is unchanged. Initially, there is no metadata.
393    pub metadata: Option<fidl_fuchsia_media__common::Metadata>,
394    /// The images associated with the playing media.
395    ///
396    /// If omitted, the media images are unchanged. An empty
397    /// vector indicates that there are no media images, which is also the initial state.
398    pub media_images: Option<Vec<MediaImage>>,
399    /// The capabilities of the player.
400    ///
401    /// If omitted, the capabilities are unchanged. Initially, the player is assumed to have no
402    /// capabilities.
403    pub player_capabilities: Option<PlayerCapabilities>,
404    /// The behavior the player would like to engage in when interrupted
405    /// by something, such as an alarm.
406    ///
407    /// If omitted, the behavior is unchanged. Initially, the value is `NONE`.
408    pub interruption_behavior: Option<InterruptionBehavior>,
409    #[doc(hidden)]
410    pub __source_breaking: fidl::marker::SourceBreaking,
411}
412
413impl fidl::Persistable for PlayerInfoDelta {}
414
415/// All information required by the media session registry service to
416/// register a player so that clients may observe its status and control
417/// it.
418#[derive(Clone, Debug, Default, PartialEq)]
419pub struct PlayerRegistration {
420    /// The domain on which the player exists. Unset if it is the native
421    /// Fuchsia domain.
422    pub domain: Option<String>,
423    /// The usage of the player's audio output. Either 'usage' or 'usage2'
424    /// may be set, but not both. If neither is set, this is assumed to be MEDIA.
425    pub usage: Option<fidl_fuchsia_media__common::AudioRenderUsage>,
426    /// The usage of the player's audio output. Either 'usage' or 'usage2'
427    /// may be set, but not both. If neither is set, this is assumed to be MEDIA.
428    pub usage2: Option<fidl_fuchsia_media__common::AudioRenderUsage2>,
429    #[doc(hidden)]
430    pub __source_breaking: fidl::marker::SourceBreaking,
431}
432
433impl fidl::Persistable for PlayerRegistration {}
434
435/// Status of a media player.
436#[derive(Clone, Debug, Default, PartialEq)]
437pub struct PlayerStatus {
438    /// Total duration of playing media.
439    ///
440    /// If this value is omitted, the duration is unknown, not applicable or unchanged. Initially,
441    /// the duration is assumed to be unknown.
442    pub duration: Option<i64>,
443    /// State of the player.
444    ///
445    /// If this field is omitted, the value is unchanged. Initially, the value is `IDLE`.
446    pub player_state: Option<PlayerState>,
447    /// A playback function that describes the position and rate of
448    /// play through the media as a function of `CLOCK_MONOTONIC`.
449    ///
450    /// If this field is omitted, the value is unchanged. Initially, `reference_delta` is 1 and
451    /// the remaining constituent fields are 0.
452    pub timeline_function: Option<fidl_fuchsia_media__common::TimelineFunction>,
453    /// Repeat mode of the player.
454    ///
455    /// If this field is omitted, the value is unchanged. Initially, the value is `NONE`.
456    pub repeat_mode: Option<RepeatMode>,
457    /// Shuffle mode of the player.
458    ///
459    /// If this field is omitted, the value is unchanged. Initially, the value is false.
460    pub shuffle_on: Option<bool>,
461    /// The type of content playing back.
462    ///
463    /// If this field is omitted, the value is unchanged. Initially, the value is `OTHER`.
464    pub content_type: Option<ContentType>,
465    /// An error the player may have encountered.
466    ///
467    /// This field is omitted unless there is an error. Once an error is indicated, it cannot
468    /// be rescinded.
469    pub error: Option<Error>,
470    /// Whether the playing media is live (such as television or a live stream).
471    ///
472    /// If this field is omitted, the value is unchanged. Initially, the value is false.
473    pub is_live: Option<bool>,
474    #[doc(hidden)]
475    pub __source_breaking: fidl::marker::SourceBreaking,
476}
477
478impl fidl::Persistable for PlayerStatus {}
479
480/// SessionInfoDelta holds a description of a media session.
481#[derive(Clone, Debug, Default, PartialEq)]
482pub struct SessionInfoDelta {
483    /// The domain on which the session takes place. A domain identifies a set of
484    /// mutually compatible media targets and sessions; sessions on a domain may
485    /// be played back on targets of the same domain.
486    ///
487    /// This field is always present.
488    pub domain: Option<String>,
489    /// Whether the source of the media playback is on this device.
490    ///
491    /// This field is present only if known.
492    pub is_local: Option<bool>,
493    /// If this is `true`, the playback is taking place local to the device.
494    /// Playing on the device speaker is local, playing on a remote speaker
495    /// is not. This is only set when the session is playing back; a paused
496    /// session is not active.
497    ///
498    /// This field is always present.
499    pub is_locally_active: Option<bool>,
500    /// The status of the player.
501    ///
502    /// This field is always present.
503    pub player_status: Option<PlayerStatus>,
504    /// Metadata describing the media session.
505    ///
506    /// This field is always present.
507    pub metadata: Option<fidl_fuchsia_media__common::Metadata>,
508    /// Images associated with the media or its source.
509    ///
510    /// This field is always present.
511    pub media_images: Option<Vec<MediaImage>>,
512    /// The capabilities the player of the media implements.
513    ///
514    /// This field is always present.
515    pub player_capabilities: Option<PlayerCapabilities>,
516    #[doc(hidden)]
517    pub __source_breaking: fidl::marker::SourceBreaking,
518}
519
520impl fidl::Persistable for SessionInfoDelta {}
521
522/// Options that specify which sessions are watched when watching the collection.
523///
524/// The watched set is the set of sessions which satisfies all options.
525#[derive(Clone, Debug, Default, PartialEq)]
526pub struct WatchOptions {
527    /// Watch only the active session. Watches all if not set.
528    pub only_active: Option<bool>,
529    /// Watch only sessions with these allowlisted ids. Watches all if not set.
530    pub allowed_sessions: Option<Vec<u64>>,
531    #[doc(hidden)]
532    pub __source_breaking: fidl::marker::SourceBreaking,
533}
534
535impl fidl::Persistable for WatchOptions {}
536
537pub mod active_session_ordinals {
538    pub const WATCH_ACTIVE_SESSION: u64 = 0xc072168d525fff8;
539}
540
541pub mod discovery_ordinals {
542    pub const WATCH_SESSIONS: u64 = 0x4231b30d98dcd2fe;
543    pub const CONNECT_TO_SESSION: u64 = 0x37da54e09f63ca3d;
544}
545
546pub mod observer_discovery_ordinals {
547    pub const WATCH_SESSIONS: u64 = 0x3d95eaa20624a1fe;
548    pub const CONNECT_TO_SESSION: u64 = 0x2c9b99aacfaac87a;
549}
550
551pub mod player_ordinals {
552    pub const PLAY: u64 = 0x164120d5bdb26f8e;
553    pub const PAUSE: u64 = 0x1536d16f202ece1;
554    pub const STOP: u64 = 0x1946e5fc6c2362ae;
555    pub const SEEK: u64 = 0x4e7237d293e22125;
556    pub const SKIP_FORWARD: u64 = 0x6ee04477076dac1b;
557    pub const SKIP_REVERSE: u64 = 0xa4e05644ce33a28;
558    pub const NEXT_ITEM: u64 = 0x73307b32e35ff260;
559    pub const PREV_ITEM: u64 = 0x680444f03a759a3c;
560    pub const SET_PLAYBACK_RATE: u64 = 0x3831b8b161e1bccf;
561    pub const SET_REPEAT_MODE: u64 = 0x21b9b1b17b7f01c2;
562    pub const SET_SHUFFLE_MODE: u64 = 0x7451a349ddb543c;
563    pub const BIND_VOLUME_CONTROL: u64 = 0x11d61e878cf808bc;
564    pub const WATCH_INFO_CHANGE: u64 = 0x69196e240c62a732;
565}
566
567pub mod player_control_ordinals {
568    pub const PLAY: u64 = 0x164120d5bdb26f8e;
569    pub const PAUSE: u64 = 0x1536d16f202ece1;
570    pub const STOP: u64 = 0x1946e5fc6c2362ae;
571    pub const SEEK: u64 = 0x4e7237d293e22125;
572    pub const SKIP_FORWARD: u64 = 0x6ee04477076dac1b;
573    pub const SKIP_REVERSE: u64 = 0xa4e05644ce33a28;
574    pub const NEXT_ITEM: u64 = 0x73307b32e35ff260;
575    pub const PREV_ITEM: u64 = 0x680444f03a759a3c;
576    pub const SET_PLAYBACK_RATE: u64 = 0x3831b8b161e1bccf;
577    pub const SET_REPEAT_MODE: u64 = 0x21b9b1b17b7f01c2;
578    pub const SET_SHUFFLE_MODE: u64 = 0x7451a349ddb543c;
579    pub const BIND_VOLUME_CONTROL: u64 = 0x11d61e878cf808bc;
580}
581
582pub mod publisher_ordinals {
583    pub const PUBLISH: u64 = 0x2e4a501ede5a1ad3;
584}
585
586pub mod session_control_ordinals {
587    pub const PLAY: u64 = 0x43c91c558f7b2946;
588    pub const PAUSE: u64 = 0x4e2d75c91ff7d22d;
589    pub const STOP: u64 = 0x53da6661beb2e817;
590    pub const SEEK: u64 = 0x380280556aba53d4;
591    pub const SKIP_FORWARD: u64 = 0x3674bb00f0f12079;
592    pub const SKIP_REVERSE: u64 = 0x5edc786c1a6b087c;
593    pub const NEXT_ITEM: u64 = 0x13cab0e8bc316138;
594    pub const PREV_ITEM: u64 = 0x7f7150e8bd6082cc;
595    pub const SET_PLAYBACK_RATE: u64 = 0x3e382e2b70c5121d;
596    pub const SET_REPEAT_MODE: u64 = 0x29381bedf7f29e5;
597    pub const SET_SHUFFLE_MODE: u64 = 0x34d8d4c0f35e89e;
598    pub const BIND_VOLUME_CONTROL: u64 = 0x1e3c091a08e88710;
599    pub const WATCH_STATUS: u64 = 0x4ce5727251eb4b74;
600}
601
602pub mod session_observer_ordinals {
603    pub const WATCH_STATUS: u64 = 0x24618b709ca18f4d;
604}
605
606pub mod sessions_watcher_ordinals {
607    pub const SESSION_UPDATED: u64 = 0x47d25ef93c58c2d9;
608    pub const SESSION_REMOVED: u64 = 0x407556ecd5a2400e;
609}
610
611mod internal {
612    use super::*;
613    unsafe impl fidl::encoding::TypeMarker for PlayerCapabilityFlags {
614        type Owned = Self;
615
616        #[inline(always)]
617        fn inline_align(_context: fidl::encoding::Context) -> usize {
618            4
619        }
620
621        #[inline(always)]
622        fn inline_size(_context: fidl::encoding::Context) -> usize {
623            4
624        }
625    }
626
627    impl fidl::encoding::ValueTypeMarker for PlayerCapabilityFlags {
628        type Borrowed<'a> = Self;
629        #[inline(always)]
630        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
631            *value
632        }
633    }
634
635    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
636        for PlayerCapabilityFlags
637    {
638        #[inline]
639        unsafe fn encode(
640            self,
641            encoder: &mut fidl::encoding::Encoder<'_, D>,
642            offset: usize,
643            _depth: fidl::encoding::Depth,
644        ) -> fidl::Result<()> {
645            encoder.debug_check_bounds::<Self>(offset);
646            if self.bits() & Self::all().bits() != self.bits() {
647                return Err(fidl::Error::InvalidBitsValue);
648            }
649            encoder.write_num(self.bits(), offset);
650            Ok(())
651        }
652    }
653
654    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PlayerCapabilityFlags {
655        #[inline(always)]
656        fn new_empty() -> Self {
657            Self::empty()
658        }
659
660        #[inline]
661        unsafe fn decode(
662            &mut self,
663            decoder: &mut fidl::encoding::Decoder<'_, D>,
664            offset: usize,
665            _depth: fidl::encoding::Depth,
666        ) -> fidl::Result<()> {
667            decoder.debug_check_bounds::<Self>(offset);
668            let prim = decoder.read_num::<u32>(offset);
669            *self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
670            Ok(())
671        }
672    }
673    unsafe impl fidl::encoding::TypeMarker for ContentType {
674        type Owned = Self;
675
676        #[inline(always)]
677        fn inline_align(_context: fidl::encoding::Context) -> usize {
678            std::mem::align_of::<u32>()
679        }
680
681        #[inline(always)]
682        fn inline_size(_context: fidl::encoding::Context) -> usize {
683            std::mem::size_of::<u32>()
684        }
685
686        #[inline(always)]
687        fn encode_is_copy() -> bool {
688            true
689        }
690
691        #[inline(always)]
692        fn decode_is_copy() -> bool {
693            false
694        }
695    }
696
697    impl fidl::encoding::ValueTypeMarker for ContentType {
698        type Borrowed<'a> = Self;
699        #[inline(always)]
700        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
701            *value
702        }
703    }
704
705    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ContentType {
706        #[inline]
707        unsafe fn encode(
708            self,
709            encoder: &mut fidl::encoding::Encoder<'_, D>,
710            offset: usize,
711            _depth: fidl::encoding::Depth,
712        ) -> fidl::Result<()> {
713            encoder.debug_check_bounds::<Self>(offset);
714            encoder.write_num(self.into_primitive(), offset);
715            Ok(())
716        }
717    }
718
719    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ContentType {
720        #[inline(always)]
721        fn new_empty() -> Self {
722            Self::Other
723        }
724
725        #[inline]
726        unsafe fn decode(
727            &mut self,
728            decoder: &mut fidl::encoding::Decoder<'_, D>,
729            offset: usize,
730            _depth: fidl::encoding::Depth,
731        ) -> fidl::Result<()> {
732            decoder.debug_check_bounds::<Self>(offset);
733            let prim = decoder.read_num::<u32>(offset);
734
735            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
736            Ok(())
737        }
738    }
739    unsafe impl fidl::encoding::TypeMarker for Error {
740        type Owned = Self;
741
742        #[inline(always)]
743        fn inline_align(_context: fidl::encoding::Context) -> usize {
744            std::mem::align_of::<u32>()
745        }
746
747        #[inline(always)]
748        fn inline_size(_context: fidl::encoding::Context) -> usize {
749            std::mem::size_of::<u32>()
750        }
751
752        #[inline(always)]
753        fn encode_is_copy() -> bool {
754            true
755        }
756
757        #[inline(always)]
758        fn decode_is_copy() -> bool {
759            false
760        }
761    }
762
763    impl fidl::encoding::ValueTypeMarker for Error {
764        type Borrowed<'a> = Self;
765        #[inline(always)]
766        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
767            *value
768        }
769    }
770
771    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Error {
772        #[inline]
773        unsafe fn encode(
774            self,
775            encoder: &mut fidl::encoding::Encoder<'_, D>,
776            offset: usize,
777            _depth: fidl::encoding::Depth,
778        ) -> fidl::Result<()> {
779            encoder.debug_check_bounds::<Self>(offset);
780            encoder.write_num(self.into_primitive(), offset);
781            Ok(())
782        }
783    }
784
785    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Error {
786        #[inline(always)]
787        fn new_empty() -> Self {
788            Self::Other
789        }
790
791        #[inline]
792        unsafe fn decode(
793            &mut self,
794            decoder: &mut fidl::encoding::Decoder<'_, D>,
795            offset: usize,
796            _depth: fidl::encoding::Depth,
797        ) -> fidl::Result<()> {
798            decoder.debug_check_bounds::<Self>(offset);
799            let prim = decoder.read_num::<u32>(offset);
800
801            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
802            Ok(())
803        }
804    }
805    unsafe impl fidl::encoding::TypeMarker for InterruptionBehavior {
806        type Owned = Self;
807
808        #[inline(always)]
809        fn inline_align(_context: fidl::encoding::Context) -> usize {
810            std::mem::align_of::<u32>()
811        }
812
813        #[inline(always)]
814        fn inline_size(_context: fidl::encoding::Context) -> usize {
815            std::mem::size_of::<u32>()
816        }
817
818        #[inline(always)]
819        fn encode_is_copy() -> bool {
820            true
821        }
822
823        #[inline(always)]
824        fn decode_is_copy() -> bool {
825            false
826        }
827    }
828
829    impl fidl::encoding::ValueTypeMarker for InterruptionBehavior {
830        type Borrowed<'a> = Self;
831        #[inline(always)]
832        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
833            *value
834        }
835    }
836
837    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
838        for InterruptionBehavior
839    {
840        #[inline]
841        unsafe fn encode(
842            self,
843            encoder: &mut fidl::encoding::Encoder<'_, D>,
844            offset: usize,
845            _depth: fidl::encoding::Depth,
846        ) -> fidl::Result<()> {
847            encoder.debug_check_bounds::<Self>(offset);
848            encoder.write_num(self.into_primitive(), offset);
849            Ok(())
850        }
851    }
852
853    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InterruptionBehavior {
854        #[inline(always)]
855        fn new_empty() -> Self {
856            Self::None
857        }
858
859        #[inline]
860        unsafe fn decode(
861            &mut self,
862            decoder: &mut fidl::encoding::Decoder<'_, D>,
863            offset: usize,
864            _depth: fidl::encoding::Depth,
865        ) -> fidl::Result<()> {
866            decoder.debug_check_bounds::<Self>(offset);
867            let prim = decoder.read_num::<u32>(offset);
868
869            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
870            Ok(())
871        }
872    }
873    unsafe impl fidl::encoding::TypeMarker for MediaImageType {
874        type Owned = Self;
875
876        #[inline(always)]
877        fn inline_align(_context: fidl::encoding::Context) -> usize {
878            std::mem::align_of::<u32>()
879        }
880
881        #[inline(always)]
882        fn inline_size(_context: fidl::encoding::Context) -> usize {
883            std::mem::size_of::<u32>()
884        }
885
886        #[inline(always)]
887        fn encode_is_copy() -> bool {
888            true
889        }
890
891        #[inline(always)]
892        fn decode_is_copy() -> bool {
893            false
894        }
895    }
896
897    impl fidl::encoding::ValueTypeMarker for MediaImageType {
898        type Borrowed<'a> = Self;
899        #[inline(always)]
900        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
901            *value
902        }
903    }
904
905    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for MediaImageType {
906        #[inline]
907        unsafe fn encode(
908            self,
909            encoder: &mut fidl::encoding::Encoder<'_, D>,
910            offset: usize,
911            _depth: fidl::encoding::Depth,
912        ) -> fidl::Result<()> {
913            encoder.debug_check_bounds::<Self>(offset);
914            encoder.write_num(self.into_primitive(), offset);
915            Ok(())
916        }
917    }
918
919    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MediaImageType {
920        #[inline(always)]
921        fn new_empty() -> Self {
922            Self::Artwork
923        }
924
925        #[inline]
926        unsafe fn decode(
927            &mut self,
928            decoder: &mut fidl::encoding::Decoder<'_, D>,
929            offset: usize,
930            _depth: fidl::encoding::Depth,
931        ) -> fidl::Result<()> {
932            decoder.debug_check_bounds::<Self>(offset);
933            let prim = decoder.read_num::<u32>(offset);
934
935            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
936            Ok(())
937        }
938    }
939    unsafe impl fidl::encoding::TypeMarker for PlayerState {
940        type Owned = Self;
941
942        #[inline(always)]
943        fn inline_align(_context: fidl::encoding::Context) -> usize {
944            std::mem::align_of::<u32>()
945        }
946
947        #[inline(always)]
948        fn inline_size(_context: fidl::encoding::Context) -> usize {
949            std::mem::size_of::<u32>()
950        }
951
952        #[inline(always)]
953        fn encode_is_copy() -> bool {
954            true
955        }
956
957        #[inline(always)]
958        fn decode_is_copy() -> bool {
959            false
960        }
961    }
962
963    impl fidl::encoding::ValueTypeMarker for PlayerState {
964        type Borrowed<'a> = Self;
965        #[inline(always)]
966        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
967            *value
968        }
969    }
970
971    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for PlayerState {
972        #[inline]
973        unsafe fn encode(
974            self,
975            encoder: &mut fidl::encoding::Encoder<'_, D>,
976            offset: usize,
977            _depth: fidl::encoding::Depth,
978        ) -> fidl::Result<()> {
979            encoder.debug_check_bounds::<Self>(offset);
980            encoder.write_num(self.into_primitive(), offset);
981            Ok(())
982        }
983    }
984
985    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PlayerState {
986        #[inline(always)]
987        fn new_empty() -> Self {
988            Self::Idle
989        }
990
991        #[inline]
992        unsafe fn decode(
993            &mut self,
994            decoder: &mut fidl::encoding::Decoder<'_, D>,
995            offset: usize,
996            _depth: fidl::encoding::Depth,
997        ) -> fidl::Result<()> {
998            decoder.debug_check_bounds::<Self>(offset);
999            let prim = decoder.read_num::<u32>(offset);
1000
1001            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1002            Ok(())
1003        }
1004    }
1005    unsafe impl fidl::encoding::TypeMarker for RepeatMode {
1006        type Owned = Self;
1007
1008        #[inline(always)]
1009        fn inline_align(_context: fidl::encoding::Context) -> usize {
1010            std::mem::align_of::<u32>()
1011        }
1012
1013        #[inline(always)]
1014        fn inline_size(_context: fidl::encoding::Context) -> usize {
1015            std::mem::size_of::<u32>()
1016        }
1017
1018        #[inline(always)]
1019        fn encode_is_copy() -> bool {
1020            true
1021        }
1022
1023        #[inline(always)]
1024        fn decode_is_copy() -> bool {
1025            false
1026        }
1027    }
1028
1029    impl fidl::encoding::ValueTypeMarker for RepeatMode {
1030        type Borrowed<'a> = Self;
1031        #[inline(always)]
1032        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1033            *value
1034        }
1035    }
1036
1037    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for RepeatMode {
1038        #[inline]
1039        unsafe fn encode(
1040            self,
1041            encoder: &mut fidl::encoding::Encoder<'_, D>,
1042            offset: usize,
1043            _depth: fidl::encoding::Depth,
1044        ) -> fidl::Result<()> {
1045            encoder.debug_check_bounds::<Self>(offset);
1046            encoder.write_num(self.into_primitive(), offset);
1047            Ok(())
1048        }
1049    }
1050
1051    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RepeatMode {
1052        #[inline(always)]
1053        fn new_empty() -> Self {
1054            Self::Off
1055        }
1056
1057        #[inline]
1058        unsafe fn decode(
1059            &mut self,
1060            decoder: &mut fidl::encoding::Decoder<'_, D>,
1061            offset: usize,
1062            _depth: fidl::encoding::Depth,
1063        ) -> fidl::Result<()> {
1064            decoder.debug_check_bounds::<Self>(offset);
1065            let prim = decoder.read_num::<u32>(offset);
1066
1067            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1068            Ok(())
1069        }
1070    }
1071
1072    impl fidl::encoding::ValueTypeMarker for ImageSizeVariant {
1073        type Borrowed<'a> = &'a Self;
1074        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1075            value
1076        }
1077    }
1078
1079    unsafe impl fidl::encoding::TypeMarker for ImageSizeVariant {
1080        type Owned = Self;
1081
1082        #[inline(always)]
1083        fn inline_align(_context: fidl::encoding::Context) -> usize {
1084            8
1085        }
1086
1087        #[inline(always)]
1088        fn inline_size(_context: fidl::encoding::Context) -> usize {
1089            24
1090        }
1091    }
1092
1093    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ImageSizeVariant, D>
1094        for &ImageSizeVariant
1095    {
1096        #[inline]
1097        unsafe fn encode(
1098            self,
1099            encoder: &mut fidl::encoding::Encoder<'_, D>,
1100            offset: usize,
1101            _depth: fidl::encoding::Depth,
1102        ) -> fidl::Result<()> {
1103            encoder.debug_check_bounds::<ImageSizeVariant>(offset);
1104            // Delegate to tuple encoding.
1105            fidl::encoding::Encode::<ImageSizeVariant, D>::encode(
1106                (
1107                    <fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(&self.url),
1108                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.width),
1109                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.height),
1110                ),
1111                encoder, offset, _depth
1112            )
1113        }
1114    }
1115    unsafe impl<
1116        D: fidl::encoding::ResourceDialect,
1117        T0: fidl::encoding::Encode<fidl::encoding::BoundedString<4096>, D>,
1118        T1: fidl::encoding::Encode<u32, D>,
1119        T2: fidl::encoding::Encode<u32, D>,
1120    > fidl::encoding::Encode<ImageSizeVariant, D> for (T0, T1, T2)
1121    {
1122        #[inline]
1123        unsafe fn encode(
1124            self,
1125            encoder: &mut fidl::encoding::Encoder<'_, D>,
1126            offset: usize,
1127            depth: fidl::encoding::Depth,
1128        ) -> fidl::Result<()> {
1129            encoder.debug_check_bounds::<ImageSizeVariant>(offset);
1130            // Zero out padding regions. There's no need to apply masks
1131            // because the unmasked parts will be overwritten by fields.
1132            // Write the fields.
1133            self.0.encode(encoder, offset + 0, depth)?;
1134            self.1.encode(encoder, offset + 16, depth)?;
1135            self.2.encode(encoder, offset + 20, depth)?;
1136            Ok(())
1137        }
1138    }
1139
1140    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ImageSizeVariant {
1141        #[inline(always)]
1142        fn new_empty() -> Self {
1143            Self {
1144                url: fidl::new_empty!(fidl::encoding::BoundedString<4096>, D),
1145                width: fidl::new_empty!(u32, D),
1146                height: fidl::new_empty!(u32, D),
1147            }
1148        }
1149
1150        #[inline]
1151        unsafe fn decode(
1152            &mut self,
1153            decoder: &mut fidl::encoding::Decoder<'_, D>,
1154            offset: usize,
1155            _depth: fidl::encoding::Depth,
1156        ) -> fidl::Result<()> {
1157            decoder.debug_check_bounds::<Self>(offset);
1158            // Verify that padding bytes are zero.
1159            fidl::decode!(
1160                fidl::encoding::BoundedString<4096>,
1161                D,
1162                &mut self.url,
1163                decoder,
1164                offset + 0,
1165                _depth
1166            )?;
1167            fidl::decode!(u32, D, &mut self.width, decoder, offset + 16, _depth)?;
1168            fidl::decode!(u32, D, &mut self.height, decoder, offset + 20, _depth)?;
1169            Ok(())
1170        }
1171    }
1172
1173    impl fidl::encoding::ValueTypeMarker for PlayerControlSeekRequest {
1174        type Borrowed<'a> = &'a Self;
1175        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1176            value
1177        }
1178    }
1179
1180    unsafe impl fidl::encoding::TypeMarker for PlayerControlSeekRequest {
1181        type Owned = Self;
1182
1183        #[inline(always)]
1184        fn inline_align(_context: fidl::encoding::Context) -> usize {
1185            8
1186        }
1187
1188        #[inline(always)]
1189        fn inline_size(_context: fidl::encoding::Context) -> usize {
1190            8
1191        }
1192        #[inline(always)]
1193        fn encode_is_copy() -> bool {
1194            true
1195        }
1196
1197        #[inline(always)]
1198        fn decode_is_copy() -> bool {
1199            true
1200        }
1201    }
1202
1203    unsafe impl<D: fidl::encoding::ResourceDialect>
1204        fidl::encoding::Encode<PlayerControlSeekRequest, D> for &PlayerControlSeekRequest
1205    {
1206        #[inline]
1207        unsafe fn encode(
1208            self,
1209            encoder: &mut fidl::encoding::Encoder<'_, D>,
1210            offset: usize,
1211            _depth: fidl::encoding::Depth,
1212        ) -> fidl::Result<()> {
1213            encoder.debug_check_bounds::<PlayerControlSeekRequest>(offset);
1214            unsafe {
1215                // Copy the object into the buffer.
1216                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1217                (buf_ptr as *mut PlayerControlSeekRequest)
1218                    .write_unaligned((self as *const PlayerControlSeekRequest).read());
1219                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1220                // done second because the memcpy will write garbage to these bytes.
1221            }
1222            Ok(())
1223        }
1224    }
1225    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i64, D>>
1226        fidl::encoding::Encode<PlayerControlSeekRequest, D> for (T0,)
1227    {
1228        #[inline]
1229        unsafe fn encode(
1230            self,
1231            encoder: &mut fidl::encoding::Encoder<'_, D>,
1232            offset: usize,
1233            depth: fidl::encoding::Depth,
1234        ) -> fidl::Result<()> {
1235            encoder.debug_check_bounds::<PlayerControlSeekRequest>(offset);
1236            // Zero out padding regions. There's no need to apply masks
1237            // because the unmasked parts will be overwritten by fields.
1238            // Write the fields.
1239            self.0.encode(encoder, offset + 0, depth)?;
1240            Ok(())
1241        }
1242    }
1243
1244    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1245        for PlayerControlSeekRequest
1246    {
1247        #[inline(always)]
1248        fn new_empty() -> Self {
1249            Self { position: fidl::new_empty!(i64, D) }
1250        }
1251
1252        #[inline]
1253        unsafe fn decode(
1254            &mut self,
1255            decoder: &mut fidl::encoding::Decoder<'_, D>,
1256            offset: usize,
1257            _depth: fidl::encoding::Depth,
1258        ) -> fidl::Result<()> {
1259            decoder.debug_check_bounds::<Self>(offset);
1260            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1261            // Verify that padding bytes are zero.
1262            // Copy from the buffer into the object.
1263            unsafe {
1264                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
1265            }
1266            Ok(())
1267        }
1268    }
1269
1270    impl fidl::encoding::ValueTypeMarker for PlayerControlSetPlaybackRateRequest {
1271        type Borrowed<'a> = &'a Self;
1272        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1273            value
1274        }
1275    }
1276
1277    unsafe impl fidl::encoding::TypeMarker for PlayerControlSetPlaybackRateRequest {
1278        type Owned = Self;
1279
1280        #[inline(always)]
1281        fn inline_align(_context: fidl::encoding::Context) -> usize {
1282            4
1283        }
1284
1285        #[inline(always)]
1286        fn inline_size(_context: fidl::encoding::Context) -> usize {
1287            4
1288        }
1289    }
1290
1291    unsafe impl<D: fidl::encoding::ResourceDialect>
1292        fidl::encoding::Encode<PlayerControlSetPlaybackRateRequest, D>
1293        for &PlayerControlSetPlaybackRateRequest
1294    {
1295        #[inline]
1296        unsafe fn encode(
1297            self,
1298            encoder: &mut fidl::encoding::Encoder<'_, D>,
1299            offset: usize,
1300            _depth: fidl::encoding::Depth,
1301        ) -> fidl::Result<()> {
1302            encoder.debug_check_bounds::<PlayerControlSetPlaybackRateRequest>(offset);
1303            // Delegate to tuple encoding.
1304            fidl::encoding::Encode::<PlayerControlSetPlaybackRateRequest, D>::encode(
1305                (<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.playback_rate),),
1306                encoder,
1307                offset,
1308                _depth,
1309            )
1310        }
1311    }
1312    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f32, D>>
1313        fidl::encoding::Encode<PlayerControlSetPlaybackRateRequest, D> for (T0,)
1314    {
1315        #[inline]
1316        unsafe fn encode(
1317            self,
1318            encoder: &mut fidl::encoding::Encoder<'_, D>,
1319            offset: usize,
1320            depth: fidl::encoding::Depth,
1321        ) -> fidl::Result<()> {
1322            encoder.debug_check_bounds::<PlayerControlSetPlaybackRateRequest>(offset);
1323            // Zero out padding regions. There's no need to apply masks
1324            // because the unmasked parts will be overwritten by fields.
1325            // Write the fields.
1326            self.0.encode(encoder, offset + 0, depth)?;
1327            Ok(())
1328        }
1329    }
1330
1331    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1332        for PlayerControlSetPlaybackRateRequest
1333    {
1334        #[inline(always)]
1335        fn new_empty() -> Self {
1336            Self { playback_rate: fidl::new_empty!(f32, D) }
1337        }
1338
1339        #[inline]
1340        unsafe fn decode(
1341            &mut self,
1342            decoder: &mut fidl::encoding::Decoder<'_, D>,
1343            offset: usize,
1344            _depth: fidl::encoding::Depth,
1345        ) -> fidl::Result<()> {
1346            decoder.debug_check_bounds::<Self>(offset);
1347            // Verify that padding bytes are zero.
1348            fidl::decode!(f32, D, &mut self.playback_rate, decoder, offset + 0, _depth)?;
1349            Ok(())
1350        }
1351    }
1352
1353    impl fidl::encoding::ValueTypeMarker for PlayerControlSetRepeatModeRequest {
1354        type Borrowed<'a> = &'a Self;
1355        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1356            value
1357        }
1358    }
1359
1360    unsafe impl fidl::encoding::TypeMarker for PlayerControlSetRepeatModeRequest {
1361        type Owned = Self;
1362
1363        #[inline(always)]
1364        fn inline_align(_context: fidl::encoding::Context) -> usize {
1365            4
1366        }
1367
1368        #[inline(always)]
1369        fn inline_size(_context: fidl::encoding::Context) -> usize {
1370            4
1371        }
1372    }
1373
1374    unsafe impl<D: fidl::encoding::ResourceDialect>
1375        fidl::encoding::Encode<PlayerControlSetRepeatModeRequest, D>
1376        for &PlayerControlSetRepeatModeRequest
1377    {
1378        #[inline]
1379        unsafe fn encode(
1380            self,
1381            encoder: &mut fidl::encoding::Encoder<'_, D>,
1382            offset: usize,
1383            _depth: fidl::encoding::Depth,
1384        ) -> fidl::Result<()> {
1385            encoder.debug_check_bounds::<PlayerControlSetRepeatModeRequest>(offset);
1386            // Delegate to tuple encoding.
1387            fidl::encoding::Encode::<PlayerControlSetRepeatModeRequest, D>::encode(
1388                (<RepeatMode as fidl::encoding::ValueTypeMarker>::borrow(&self.repeat_mode),),
1389                encoder,
1390                offset,
1391                _depth,
1392            )
1393        }
1394    }
1395    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<RepeatMode, D>>
1396        fidl::encoding::Encode<PlayerControlSetRepeatModeRequest, D> for (T0,)
1397    {
1398        #[inline]
1399        unsafe fn encode(
1400            self,
1401            encoder: &mut fidl::encoding::Encoder<'_, D>,
1402            offset: usize,
1403            depth: fidl::encoding::Depth,
1404        ) -> fidl::Result<()> {
1405            encoder.debug_check_bounds::<PlayerControlSetRepeatModeRequest>(offset);
1406            // Zero out padding regions. There's no need to apply masks
1407            // because the unmasked parts will be overwritten by fields.
1408            // Write the fields.
1409            self.0.encode(encoder, offset + 0, depth)?;
1410            Ok(())
1411        }
1412    }
1413
1414    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1415        for PlayerControlSetRepeatModeRequest
1416    {
1417        #[inline(always)]
1418        fn new_empty() -> Self {
1419            Self { repeat_mode: fidl::new_empty!(RepeatMode, D) }
1420        }
1421
1422        #[inline]
1423        unsafe fn decode(
1424            &mut self,
1425            decoder: &mut fidl::encoding::Decoder<'_, D>,
1426            offset: usize,
1427            _depth: fidl::encoding::Depth,
1428        ) -> fidl::Result<()> {
1429            decoder.debug_check_bounds::<Self>(offset);
1430            // Verify that padding bytes are zero.
1431            fidl::decode!(RepeatMode, D, &mut self.repeat_mode, decoder, offset + 0, _depth)?;
1432            Ok(())
1433        }
1434    }
1435
1436    impl fidl::encoding::ValueTypeMarker for PlayerControlSetShuffleModeRequest {
1437        type Borrowed<'a> = &'a Self;
1438        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1439            value
1440        }
1441    }
1442
1443    unsafe impl fidl::encoding::TypeMarker for PlayerControlSetShuffleModeRequest {
1444        type Owned = Self;
1445
1446        #[inline(always)]
1447        fn inline_align(_context: fidl::encoding::Context) -> usize {
1448            1
1449        }
1450
1451        #[inline(always)]
1452        fn inline_size(_context: fidl::encoding::Context) -> usize {
1453            1
1454        }
1455    }
1456
1457    unsafe impl<D: fidl::encoding::ResourceDialect>
1458        fidl::encoding::Encode<PlayerControlSetShuffleModeRequest, D>
1459        for &PlayerControlSetShuffleModeRequest
1460    {
1461        #[inline]
1462        unsafe fn encode(
1463            self,
1464            encoder: &mut fidl::encoding::Encoder<'_, D>,
1465            offset: usize,
1466            _depth: fidl::encoding::Depth,
1467        ) -> fidl::Result<()> {
1468            encoder.debug_check_bounds::<PlayerControlSetShuffleModeRequest>(offset);
1469            // Delegate to tuple encoding.
1470            fidl::encoding::Encode::<PlayerControlSetShuffleModeRequest, D>::encode(
1471                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.shuffle_on),),
1472                encoder,
1473                offset,
1474                _depth,
1475            )
1476        }
1477    }
1478    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
1479        fidl::encoding::Encode<PlayerControlSetShuffleModeRequest, D> for (T0,)
1480    {
1481        #[inline]
1482        unsafe fn encode(
1483            self,
1484            encoder: &mut fidl::encoding::Encoder<'_, D>,
1485            offset: usize,
1486            depth: fidl::encoding::Depth,
1487        ) -> fidl::Result<()> {
1488            encoder.debug_check_bounds::<PlayerControlSetShuffleModeRequest>(offset);
1489            // Zero out padding regions. There's no need to apply masks
1490            // because the unmasked parts will be overwritten by fields.
1491            // Write the fields.
1492            self.0.encode(encoder, offset + 0, depth)?;
1493            Ok(())
1494        }
1495    }
1496
1497    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1498        for PlayerControlSetShuffleModeRequest
1499    {
1500        #[inline(always)]
1501        fn new_empty() -> Self {
1502            Self { shuffle_on: fidl::new_empty!(bool, D) }
1503        }
1504
1505        #[inline]
1506        unsafe fn decode(
1507            &mut self,
1508            decoder: &mut fidl::encoding::Decoder<'_, D>,
1509            offset: usize,
1510            _depth: fidl::encoding::Depth,
1511        ) -> fidl::Result<()> {
1512            decoder.debug_check_bounds::<Self>(offset);
1513            // Verify that padding bytes are zero.
1514            fidl::decode!(bool, D, &mut self.shuffle_on, decoder, offset + 0, _depth)?;
1515            Ok(())
1516        }
1517    }
1518
1519    impl fidl::encoding::ValueTypeMarker for PlayerWatchInfoChangeResponse {
1520        type Borrowed<'a> = &'a Self;
1521        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1522            value
1523        }
1524    }
1525
1526    unsafe impl fidl::encoding::TypeMarker for PlayerWatchInfoChangeResponse {
1527        type Owned = Self;
1528
1529        #[inline(always)]
1530        fn inline_align(_context: fidl::encoding::Context) -> usize {
1531            8
1532        }
1533
1534        #[inline(always)]
1535        fn inline_size(_context: fidl::encoding::Context) -> usize {
1536            16
1537        }
1538    }
1539
1540    unsafe impl<D: fidl::encoding::ResourceDialect>
1541        fidl::encoding::Encode<PlayerWatchInfoChangeResponse, D>
1542        for &PlayerWatchInfoChangeResponse
1543    {
1544        #[inline]
1545        unsafe fn encode(
1546            self,
1547            encoder: &mut fidl::encoding::Encoder<'_, D>,
1548            offset: usize,
1549            _depth: fidl::encoding::Depth,
1550        ) -> fidl::Result<()> {
1551            encoder.debug_check_bounds::<PlayerWatchInfoChangeResponse>(offset);
1552            // Delegate to tuple encoding.
1553            fidl::encoding::Encode::<PlayerWatchInfoChangeResponse, D>::encode(
1554                (<PlayerInfoDelta as fidl::encoding::ValueTypeMarker>::borrow(
1555                    &self.player_info_delta,
1556                ),),
1557                encoder,
1558                offset,
1559                _depth,
1560            )
1561        }
1562    }
1563    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PlayerInfoDelta, D>>
1564        fidl::encoding::Encode<PlayerWatchInfoChangeResponse, D> for (T0,)
1565    {
1566        #[inline]
1567        unsafe fn encode(
1568            self,
1569            encoder: &mut fidl::encoding::Encoder<'_, D>,
1570            offset: usize,
1571            depth: fidl::encoding::Depth,
1572        ) -> fidl::Result<()> {
1573            encoder.debug_check_bounds::<PlayerWatchInfoChangeResponse>(offset);
1574            // Zero out padding regions. There's no need to apply masks
1575            // because the unmasked parts will be overwritten by fields.
1576            // Write the fields.
1577            self.0.encode(encoder, offset + 0, depth)?;
1578            Ok(())
1579        }
1580    }
1581
1582    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1583        for PlayerWatchInfoChangeResponse
1584    {
1585        #[inline(always)]
1586        fn new_empty() -> Self {
1587            Self { player_info_delta: fidl::new_empty!(PlayerInfoDelta, D) }
1588        }
1589
1590        #[inline]
1591        unsafe fn decode(
1592            &mut self,
1593            decoder: &mut fidl::encoding::Decoder<'_, D>,
1594            offset: usize,
1595            _depth: fidl::encoding::Depth,
1596        ) -> fidl::Result<()> {
1597            decoder.debug_check_bounds::<Self>(offset);
1598            // Verify that padding bytes are zero.
1599            fidl::decode!(
1600                PlayerInfoDelta,
1601                D,
1602                &mut self.player_info_delta,
1603                decoder,
1604                offset + 0,
1605                _depth
1606            )?;
1607            Ok(())
1608        }
1609    }
1610
1611    impl fidl::encoding::ValueTypeMarker for PublisherPublishResponse {
1612        type Borrowed<'a> = &'a Self;
1613        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1614            value
1615        }
1616    }
1617
1618    unsafe impl fidl::encoding::TypeMarker for PublisherPublishResponse {
1619        type Owned = Self;
1620
1621        #[inline(always)]
1622        fn inline_align(_context: fidl::encoding::Context) -> usize {
1623            8
1624        }
1625
1626        #[inline(always)]
1627        fn inline_size(_context: fidl::encoding::Context) -> usize {
1628            8
1629        }
1630        #[inline(always)]
1631        fn encode_is_copy() -> bool {
1632            true
1633        }
1634
1635        #[inline(always)]
1636        fn decode_is_copy() -> bool {
1637            true
1638        }
1639    }
1640
1641    unsafe impl<D: fidl::encoding::ResourceDialect>
1642        fidl::encoding::Encode<PublisherPublishResponse, D> for &PublisherPublishResponse
1643    {
1644        #[inline]
1645        unsafe fn encode(
1646            self,
1647            encoder: &mut fidl::encoding::Encoder<'_, D>,
1648            offset: usize,
1649            _depth: fidl::encoding::Depth,
1650        ) -> fidl::Result<()> {
1651            encoder.debug_check_bounds::<PublisherPublishResponse>(offset);
1652            unsafe {
1653                // Copy the object into the buffer.
1654                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1655                (buf_ptr as *mut PublisherPublishResponse)
1656                    .write_unaligned((self as *const PublisherPublishResponse).read());
1657                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1658                // done second because the memcpy will write garbage to these bytes.
1659            }
1660            Ok(())
1661        }
1662    }
1663    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
1664        fidl::encoding::Encode<PublisherPublishResponse, D> for (T0,)
1665    {
1666        #[inline]
1667        unsafe fn encode(
1668            self,
1669            encoder: &mut fidl::encoding::Encoder<'_, D>,
1670            offset: usize,
1671            depth: fidl::encoding::Depth,
1672        ) -> fidl::Result<()> {
1673            encoder.debug_check_bounds::<PublisherPublishResponse>(offset);
1674            // Zero out padding regions. There's no need to apply masks
1675            // because the unmasked parts will be overwritten by fields.
1676            // Write the fields.
1677            self.0.encode(encoder, offset + 0, depth)?;
1678            Ok(())
1679        }
1680    }
1681
1682    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1683        for PublisherPublishResponse
1684    {
1685        #[inline(always)]
1686        fn new_empty() -> Self {
1687            Self { session_id: fidl::new_empty!(u64, D) }
1688        }
1689
1690        #[inline]
1691        unsafe fn decode(
1692            &mut self,
1693            decoder: &mut fidl::encoding::Decoder<'_, D>,
1694            offset: usize,
1695            _depth: fidl::encoding::Depth,
1696        ) -> fidl::Result<()> {
1697            decoder.debug_check_bounds::<Self>(offset);
1698            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1699            // Verify that padding bytes are zero.
1700            // Copy from the buffer into the object.
1701            unsafe {
1702                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
1703            }
1704            Ok(())
1705        }
1706    }
1707
1708    impl fidl::encoding::ValueTypeMarker for SessionControlSeekRequest {
1709        type Borrowed<'a> = &'a Self;
1710        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1711            value
1712        }
1713    }
1714
1715    unsafe impl fidl::encoding::TypeMarker for SessionControlSeekRequest {
1716        type Owned = Self;
1717
1718        #[inline(always)]
1719        fn inline_align(_context: fidl::encoding::Context) -> usize {
1720            8
1721        }
1722
1723        #[inline(always)]
1724        fn inline_size(_context: fidl::encoding::Context) -> usize {
1725            8
1726        }
1727        #[inline(always)]
1728        fn encode_is_copy() -> bool {
1729            true
1730        }
1731
1732        #[inline(always)]
1733        fn decode_is_copy() -> bool {
1734            true
1735        }
1736    }
1737
1738    unsafe impl<D: fidl::encoding::ResourceDialect>
1739        fidl::encoding::Encode<SessionControlSeekRequest, D> for &SessionControlSeekRequest
1740    {
1741        #[inline]
1742        unsafe fn encode(
1743            self,
1744            encoder: &mut fidl::encoding::Encoder<'_, D>,
1745            offset: usize,
1746            _depth: fidl::encoding::Depth,
1747        ) -> fidl::Result<()> {
1748            encoder.debug_check_bounds::<SessionControlSeekRequest>(offset);
1749            unsafe {
1750                // Copy the object into the buffer.
1751                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1752                (buf_ptr as *mut SessionControlSeekRequest)
1753                    .write_unaligned((self as *const SessionControlSeekRequest).read());
1754                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1755                // done second because the memcpy will write garbage to these bytes.
1756            }
1757            Ok(())
1758        }
1759    }
1760    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i64, D>>
1761        fidl::encoding::Encode<SessionControlSeekRequest, D> for (T0,)
1762    {
1763        #[inline]
1764        unsafe fn encode(
1765            self,
1766            encoder: &mut fidl::encoding::Encoder<'_, D>,
1767            offset: usize,
1768            depth: fidl::encoding::Depth,
1769        ) -> fidl::Result<()> {
1770            encoder.debug_check_bounds::<SessionControlSeekRequest>(offset);
1771            // Zero out padding regions. There's no need to apply masks
1772            // because the unmasked parts will be overwritten by fields.
1773            // Write the fields.
1774            self.0.encode(encoder, offset + 0, depth)?;
1775            Ok(())
1776        }
1777    }
1778
1779    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1780        for SessionControlSeekRequest
1781    {
1782        #[inline(always)]
1783        fn new_empty() -> Self {
1784            Self { position: fidl::new_empty!(i64, D) }
1785        }
1786
1787        #[inline]
1788        unsafe fn decode(
1789            &mut self,
1790            decoder: &mut fidl::encoding::Decoder<'_, D>,
1791            offset: usize,
1792            _depth: fidl::encoding::Depth,
1793        ) -> fidl::Result<()> {
1794            decoder.debug_check_bounds::<Self>(offset);
1795            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1796            // Verify that padding bytes are zero.
1797            // Copy from the buffer into the object.
1798            unsafe {
1799                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
1800            }
1801            Ok(())
1802        }
1803    }
1804
1805    impl fidl::encoding::ValueTypeMarker for SessionControlSetPlaybackRateRequest {
1806        type Borrowed<'a> = &'a Self;
1807        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1808            value
1809        }
1810    }
1811
1812    unsafe impl fidl::encoding::TypeMarker for SessionControlSetPlaybackRateRequest {
1813        type Owned = Self;
1814
1815        #[inline(always)]
1816        fn inline_align(_context: fidl::encoding::Context) -> usize {
1817            4
1818        }
1819
1820        #[inline(always)]
1821        fn inline_size(_context: fidl::encoding::Context) -> usize {
1822            4
1823        }
1824    }
1825
1826    unsafe impl<D: fidl::encoding::ResourceDialect>
1827        fidl::encoding::Encode<SessionControlSetPlaybackRateRequest, D>
1828        for &SessionControlSetPlaybackRateRequest
1829    {
1830        #[inline]
1831        unsafe fn encode(
1832            self,
1833            encoder: &mut fidl::encoding::Encoder<'_, D>,
1834            offset: usize,
1835            _depth: fidl::encoding::Depth,
1836        ) -> fidl::Result<()> {
1837            encoder.debug_check_bounds::<SessionControlSetPlaybackRateRequest>(offset);
1838            // Delegate to tuple encoding.
1839            fidl::encoding::Encode::<SessionControlSetPlaybackRateRequest, D>::encode(
1840                (<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.playback_rate),),
1841                encoder,
1842                offset,
1843                _depth,
1844            )
1845        }
1846    }
1847    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f32, D>>
1848        fidl::encoding::Encode<SessionControlSetPlaybackRateRequest, D> for (T0,)
1849    {
1850        #[inline]
1851        unsafe fn encode(
1852            self,
1853            encoder: &mut fidl::encoding::Encoder<'_, D>,
1854            offset: usize,
1855            depth: fidl::encoding::Depth,
1856        ) -> fidl::Result<()> {
1857            encoder.debug_check_bounds::<SessionControlSetPlaybackRateRequest>(offset);
1858            // Zero out padding regions. There's no need to apply masks
1859            // because the unmasked parts will be overwritten by fields.
1860            // Write the fields.
1861            self.0.encode(encoder, offset + 0, depth)?;
1862            Ok(())
1863        }
1864    }
1865
1866    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1867        for SessionControlSetPlaybackRateRequest
1868    {
1869        #[inline(always)]
1870        fn new_empty() -> Self {
1871            Self { playback_rate: fidl::new_empty!(f32, D) }
1872        }
1873
1874        #[inline]
1875        unsafe fn decode(
1876            &mut self,
1877            decoder: &mut fidl::encoding::Decoder<'_, D>,
1878            offset: usize,
1879            _depth: fidl::encoding::Depth,
1880        ) -> fidl::Result<()> {
1881            decoder.debug_check_bounds::<Self>(offset);
1882            // Verify that padding bytes are zero.
1883            fidl::decode!(f32, D, &mut self.playback_rate, decoder, offset + 0, _depth)?;
1884            Ok(())
1885        }
1886    }
1887
1888    impl fidl::encoding::ValueTypeMarker for SessionControlSetRepeatModeRequest {
1889        type Borrowed<'a> = &'a Self;
1890        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1891            value
1892        }
1893    }
1894
1895    unsafe impl fidl::encoding::TypeMarker for SessionControlSetRepeatModeRequest {
1896        type Owned = Self;
1897
1898        #[inline(always)]
1899        fn inline_align(_context: fidl::encoding::Context) -> usize {
1900            4
1901        }
1902
1903        #[inline(always)]
1904        fn inline_size(_context: fidl::encoding::Context) -> usize {
1905            4
1906        }
1907    }
1908
1909    unsafe impl<D: fidl::encoding::ResourceDialect>
1910        fidl::encoding::Encode<SessionControlSetRepeatModeRequest, D>
1911        for &SessionControlSetRepeatModeRequest
1912    {
1913        #[inline]
1914        unsafe fn encode(
1915            self,
1916            encoder: &mut fidl::encoding::Encoder<'_, D>,
1917            offset: usize,
1918            _depth: fidl::encoding::Depth,
1919        ) -> fidl::Result<()> {
1920            encoder.debug_check_bounds::<SessionControlSetRepeatModeRequest>(offset);
1921            // Delegate to tuple encoding.
1922            fidl::encoding::Encode::<SessionControlSetRepeatModeRequest, D>::encode(
1923                (<RepeatMode as fidl::encoding::ValueTypeMarker>::borrow(&self.repeat_mode),),
1924                encoder,
1925                offset,
1926                _depth,
1927            )
1928        }
1929    }
1930    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<RepeatMode, D>>
1931        fidl::encoding::Encode<SessionControlSetRepeatModeRequest, D> for (T0,)
1932    {
1933        #[inline]
1934        unsafe fn encode(
1935            self,
1936            encoder: &mut fidl::encoding::Encoder<'_, D>,
1937            offset: usize,
1938            depth: fidl::encoding::Depth,
1939        ) -> fidl::Result<()> {
1940            encoder.debug_check_bounds::<SessionControlSetRepeatModeRequest>(offset);
1941            // Zero out padding regions. There's no need to apply masks
1942            // because the unmasked parts will be overwritten by fields.
1943            // Write the fields.
1944            self.0.encode(encoder, offset + 0, depth)?;
1945            Ok(())
1946        }
1947    }
1948
1949    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1950        for SessionControlSetRepeatModeRequest
1951    {
1952        #[inline(always)]
1953        fn new_empty() -> Self {
1954            Self { repeat_mode: fidl::new_empty!(RepeatMode, D) }
1955        }
1956
1957        #[inline]
1958        unsafe fn decode(
1959            &mut self,
1960            decoder: &mut fidl::encoding::Decoder<'_, D>,
1961            offset: usize,
1962            _depth: fidl::encoding::Depth,
1963        ) -> fidl::Result<()> {
1964            decoder.debug_check_bounds::<Self>(offset);
1965            // Verify that padding bytes are zero.
1966            fidl::decode!(RepeatMode, D, &mut self.repeat_mode, decoder, offset + 0, _depth)?;
1967            Ok(())
1968        }
1969    }
1970
1971    impl fidl::encoding::ValueTypeMarker for SessionControlSetShuffleModeRequest {
1972        type Borrowed<'a> = &'a Self;
1973        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1974            value
1975        }
1976    }
1977
1978    unsafe impl fidl::encoding::TypeMarker for SessionControlSetShuffleModeRequest {
1979        type Owned = Self;
1980
1981        #[inline(always)]
1982        fn inline_align(_context: fidl::encoding::Context) -> usize {
1983            1
1984        }
1985
1986        #[inline(always)]
1987        fn inline_size(_context: fidl::encoding::Context) -> usize {
1988            1
1989        }
1990    }
1991
1992    unsafe impl<D: fidl::encoding::ResourceDialect>
1993        fidl::encoding::Encode<SessionControlSetShuffleModeRequest, D>
1994        for &SessionControlSetShuffleModeRequest
1995    {
1996        #[inline]
1997        unsafe fn encode(
1998            self,
1999            encoder: &mut fidl::encoding::Encoder<'_, D>,
2000            offset: usize,
2001            _depth: fidl::encoding::Depth,
2002        ) -> fidl::Result<()> {
2003            encoder.debug_check_bounds::<SessionControlSetShuffleModeRequest>(offset);
2004            // Delegate to tuple encoding.
2005            fidl::encoding::Encode::<SessionControlSetShuffleModeRequest, D>::encode(
2006                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.shuffle_on),),
2007                encoder,
2008                offset,
2009                _depth,
2010            )
2011        }
2012    }
2013    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
2014        fidl::encoding::Encode<SessionControlSetShuffleModeRequest, D> for (T0,)
2015    {
2016        #[inline]
2017        unsafe fn encode(
2018            self,
2019            encoder: &mut fidl::encoding::Encoder<'_, D>,
2020            offset: usize,
2021            depth: fidl::encoding::Depth,
2022        ) -> fidl::Result<()> {
2023            encoder.debug_check_bounds::<SessionControlSetShuffleModeRequest>(offset);
2024            // Zero out padding regions. There's no need to apply masks
2025            // because the unmasked parts will be overwritten by fields.
2026            // Write the fields.
2027            self.0.encode(encoder, offset + 0, depth)?;
2028            Ok(())
2029        }
2030    }
2031
2032    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2033        for SessionControlSetShuffleModeRequest
2034    {
2035        #[inline(always)]
2036        fn new_empty() -> Self {
2037            Self { shuffle_on: fidl::new_empty!(bool, D) }
2038        }
2039
2040        #[inline]
2041        unsafe fn decode(
2042            &mut self,
2043            decoder: &mut fidl::encoding::Decoder<'_, D>,
2044            offset: usize,
2045            _depth: fidl::encoding::Depth,
2046        ) -> fidl::Result<()> {
2047            decoder.debug_check_bounds::<Self>(offset);
2048            // Verify that padding bytes are zero.
2049            fidl::decode!(bool, D, &mut self.shuffle_on, decoder, offset + 0, _depth)?;
2050            Ok(())
2051        }
2052    }
2053
2054    impl fidl::encoding::ValueTypeMarker for SessionControlWatchStatusResponse {
2055        type Borrowed<'a> = &'a Self;
2056        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2057            value
2058        }
2059    }
2060
2061    unsafe impl fidl::encoding::TypeMarker for SessionControlWatchStatusResponse {
2062        type Owned = Self;
2063
2064        #[inline(always)]
2065        fn inline_align(_context: fidl::encoding::Context) -> usize {
2066            8
2067        }
2068
2069        #[inline(always)]
2070        fn inline_size(_context: fidl::encoding::Context) -> usize {
2071            16
2072        }
2073    }
2074
2075    unsafe impl<D: fidl::encoding::ResourceDialect>
2076        fidl::encoding::Encode<SessionControlWatchStatusResponse, D>
2077        for &SessionControlWatchStatusResponse
2078    {
2079        #[inline]
2080        unsafe fn encode(
2081            self,
2082            encoder: &mut fidl::encoding::Encoder<'_, D>,
2083            offset: usize,
2084            _depth: fidl::encoding::Depth,
2085        ) -> fidl::Result<()> {
2086            encoder.debug_check_bounds::<SessionControlWatchStatusResponse>(offset);
2087            // Delegate to tuple encoding.
2088            fidl::encoding::Encode::<SessionControlWatchStatusResponse, D>::encode(
2089                (<SessionInfoDelta as fidl::encoding::ValueTypeMarker>::borrow(
2090                    &self.session_info_delta,
2091                ),),
2092                encoder,
2093                offset,
2094                _depth,
2095            )
2096        }
2097    }
2098    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<SessionInfoDelta, D>>
2099        fidl::encoding::Encode<SessionControlWatchStatusResponse, D> for (T0,)
2100    {
2101        #[inline]
2102        unsafe fn encode(
2103            self,
2104            encoder: &mut fidl::encoding::Encoder<'_, D>,
2105            offset: usize,
2106            depth: fidl::encoding::Depth,
2107        ) -> fidl::Result<()> {
2108            encoder.debug_check_bounds::<SessionControlWatchStatusResponse>(offset);
2109            // Zero out padding regions. There's no need to apply masks
2110            // because the unmasked parts will be overwritten by fields.
2111            // Write the fields.
2112            self.0.encode(encoder, offset + 0, depth)?;
2113            Ok(())
2114        }
2115    }
2116
2117    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2118        for SessionControlWatchStatusResponse
2119    {
2120        #[inline(always)]
2121        fn new_empty() -> Self {
2122            Self { session_info_delta: fidl::new_empty!(SessionInfoDelta, D) }
2123        }
2124
2125        #[inline]
2126        unsafe fn decode(
2127            &mut self,
2128            decoder: &mut fidl::encoding::Decoder<'_, D>,
2129            offset: usize,
2130            _depth: fidl::encoding::Depth,
2131        ) -> fidl::Result<()> {
2132            decoder.debug_check_bounds::<Self>(offset);
2133            // Verify that padding bytes are zero.
2134            fidl::decode!(
2135                SessionInfoDelta,
2136                D,
2137                &mut self.session_info_delta,
2138                decoder,
2139                offset + 0,
2140                _depth
2141            )?;
2142            Ok(())
2143        }
2144    }
2145
2146    impl fidl::encoding::ValueTypeMarker for SessionObserverWatchStatusResponse {
2147        type Borrowed<'a> = &'a Self;
2148        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2149            value
2150        }
2151    }
2152
2153    unsafe impl fidl::encoding::TypeMarker for SessionObserverWatchStatusResponse {
2154        type Owned = Self;
2155
2156        #[inline(always)]
2157        fn inline_align(_context: fidl::encoding::Context) -> usize {
2158            8
2159        }
2160
2161        #[inline(always)]
2162        fn inline_size(_context: fidl::encoding::Context) -> usize {
2163            16
2164        }
2165    }
2166
2167    unsafe impl<D: fidl::encoding::ResourceDialect>
2168        fidl::encoding::Encode<SessionObserverWatchStatusResponse, D>
2169        for &SessionObserverWatchStatusResponse
2170    {
2171        #[inline]
2172        unsafe fn encode(
2173            self,
2174            encoder: &mut fidl::encoding::Encoder<'_, D>,
2175            offset: usize,
2176            _depth: fidl::encoding::Depth,
2177        ) -> fidl::Result<()> {
2178            encoder.debug_check_bounds::<SessionObserverWatchStatusResponse>(offset);
2179            // Delegate to tuple encoding.
2180            fidl::encoding::Encode::<SessionObserverWatchStatusResponse, D>::encode(
2181                (<SessionInfoDelta as fidl::encoding::ValueTypeMarker>::borrow(
2182                    &self.session_info_delta,
2183                ),),
2184                encoder,
2185                offset,
2186                _depth,
2187            )
2188        }
2189    }
2190    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<SessionInfoDelta, D>>
2191        fidl::encoding::Encode<SessionObserverWatchStatusResponse, D> for (T0,)
2192    {
2193        #[inline]
2194        unsafe fn encode(
2195            self,
2196            encoder: &mut fidl::encoding::Encoder<'_, D>,
2197            offset: usize,
2198            depth: fidl::encoding::Depth,
2199        ) -> fidl::Result<()> {
2200            encoder.debug_check_bounds::<SessionObserverWatchStatusResponse>(offset);
2201            // Zero out padding regions. There's no need to apply masks
2202            // because the unmasked parts will be overwritten by fields.
2203            // Write the fields.
2204            self.0.encode(encoder, offset + 0, depth)?;
2205            Ok(())
2206        }
2207    }
2208
2209    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2210        for SessionObserverWatchStatusResponse
2211    {
2212        #[inline(always)]
2213        fn new_empty() -> Self {
2214            Self { session_info_delta: fidl::new_empty!(SessionInfoDelta, D) }
2215        }
2216
2217        #[inline]
2218        unsafe fn decode(
2219            &mut self,
2220            decoder: &mut fidl::encoding::Decoder<'_, D>,
2221            offset: usize,
2222            _depth: fidl::encoding::Depth,
2223        ) -> fidl::Result<()> {
2224            decoder.debug_check_bounds::<Self>(offset);
2225            // Verify that padding bytes are zero.
2226            fidl::decode!(
2227                SessionInfoDelta,
2228                D,
2229                &mut self.session_info_delta,
2230                decoder,
2231                offset + 0,
2232                _depth
2233            )?;
2234            Ok(())
2235        }
2236    }
2237
2238    impl fidl::encoding::ValueTypeMarker for SessionsWatcherSessionRemovedRequest {
2239        type Borrowed<'a> = &'a Self;
2240        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2241            value
2242        }
2243    }
2244
2245    unsafe impl fidl::encoding::TypeMarker for SessionsWatcherSessionRemovedRequest {
2246        type Owned = Self;
2247
2248        #[inline(always)]
2249        fn inline_align(_context: fidl::encoding::Context) -> usize {
2250            8
2251        }
2252
2253        #[inline(always)]
2254        fn inline_size(_context: fidl::encoding::Context) -> usize {
2255            8
2256        }
2257        #[inline(always)]
2258        fn encode_is_copy() -> bool {
2259            true
2260        }
2261
2262        #[inline(always)]
2263        fn decode_is_copy() -> bool {
2264            true
2265        }
2266    }
2267
2268    unsafe impl<D: fidl::encoding::ResourceDialect>
2269        fidl::encoding::Encode<SessionsWatcherSessionRemovedRequest, D>
2270        for &SessionsWatcherSessionRemovedRequest
2271    {
2272        #[inline]
2273        unsafe fn encode(
2274            self,
2275            encoder: &mut fidl::encoding::Encoder<'_, D>,
2276            offset: usize,
2277            _depth: fidl::encoding::Depth,
2278        ) -> fidl::Result<()> {
2279            encoder.debug_check_bounds::<SessionsWatcherSessionRemovedRequest>(offset);
2280            unsafe {
2281                // Copy the object into the buffer.
2282                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2283                (buf_ptr as *mut SessionsWatcherSessionRemovedRequest)
2284                    .write_unaligned((self as *const SessionsWatcherSessionRemovedRequest).read());
2285                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2286                // done second because the memcpy will write garbage to these bytes.
2287            }
2288            Ok(())
2289        }
2290    }
2291    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
2292        fidl::encoding::Encode<SessionsWatcherSessionRemovedRequest, D> for (T0,)
2293    {
2294        #[inline]
2295        unsafe fn encode(
2296            self,
2297            encoder: &mut fidl::encoding::Encoder<'_, D>,
2298            offset: usize,
2299            depth: fidl::encoding::Depth,
2300        ) -> fidl::Result<()> {
2301            encoder.debug_check_bounds::<SessionsWatcherSessionRemovedRequest>(offset);
2302            // Zero out padding regions. There's no need to apply masks
2303            // because the unmasked parts will be overwritten by fields.
2304            // Write the fields.
2305            self.0.encode(encoder, offset + 0, depth)?;
2306            Ok(())
2307        }
2308    }
2309
2310    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2311        for SessionsWatcherSessionRemovedRequest
2312    {
2313        #[inline(always)]
2314        fn new_empty() -> Self {
2315            Self { session_id: fidl::new_empty!(u64, D) }
2316        }
2317
2318        #[inline]
2319        unsafe fn decode(
2320            &mut self,
2321            decoder: &mut fidl::encoding::Decoder<'_, D>,
2322            offset: usize,
2323            _depth: fidl::encoding::Depth,
2324        ) -> fidl::Result<()> {
2325            decoder.debug_check_bounds::<Self>(offset);
2326            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2327            // Verify that padding bytes are zero.
2328            // Copy from the buffer into the object.
2329            unsafe {
2330                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
2331            }
2332            Ok(())
2333        }
2334    }
2335
2336    impl fidl::encoding::ValueTypeMarker for SessionsWatcherSessionUpdatedRequest {
2337        type Borrowed<'a> = &'a Self;
2338        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2339            value
2340        }
2341    }
2342
2343    unsafe impl fidl::encoding::TypeMarker for SessionsWatcherSessionUpdatedRequest {
2344        type Owned = Self;
2345
2346        #[inline(always)]
2347        fn inline_align(_context: fidl::encoding::Context) -> usize {
2348            8
2349        }
2350
2351        #[inline(always)]
2352        fn inline_size(_context: fidl::encoding::Context) -> usize {
2353            24
2354        }
2355    }
2356
2357    unsafe impl<D: fidl::encoding::ResourceDialect>
2358        fidl::encoding::Encode<SessionsWatcherSessionUpdatedRequest, D>
2359        for &SessionsWatcherSessionUpdatedRequest
2360    {
2361        #[inline]
2362        unsafe fn encode(
2363            self,
2364            encoder: &mut fidl::encoding::Encoder<'_, D>,
2365            offset: usize,
2366            _depth: fidl::encoding::Depth,
2367        ) -> fidl::Result<()> {
2368            encoder.debug_check_bounds::<SessionsWatcherSessionUpdatedRequest>(offset);
2369            // Delegate to tuple encoding.
2370            fidl::encoding::Encode::<SessionsWatcherSessionUpdatedRequest, D>::encode(
2371                (
2372                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.session_id),
2373                    <SessionInfoDelta as fidl::encoding::ValueTypeMarker>::borrow(
2374                        &self.session_info_delta,
2375                    ),
2376                ),
2377                encoder,
2378                offset,
2379                _depth,
2380            )
2381        }
2382    }
2383    unsafe impl<
2384        D: fidl::encoding::ResourceDialect,
2385        T0: fidl::encoding::Encode<u64, D>,
2386        T1: fidl::encoding::Encode<SessionInfoDelta, D>,
2387    > fidl::encoding::Encode<SessionsWatcherSessionUpdatedRequest, D> for (T0, T1)
2388    {
2389        #[inline]
2390        unsafe fn encode(
2391            self,
2392            encoder: &mut fidl::encoding::Encoder<'_, D>,
2393            offset: usize,
2394            depth: fidl::encoding::Depth,
2395        ) -> fidl::Result<()> {
2396            encoder.debug_check_bounds::<SessionsWatcherSessionUpdatedRequest>(offset);
2397            // Zero out padding regions. There's no need to apply masks
2398            // because the unmasked parts will be overwritten by fields.
2399            // Write the fields.
2400            self.0.encode(encoder, offset + 0, depth)?;
2401            self.1.encode(encoder, offset + 8, depth)?;
2402            Ok(())
2403        }
2404    }
2405
2406    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2407        for SessionsWatcherSessionUpdatedRequest
2408    {
2409        #[inline(always)]
2410        fn new_empty() -> Self {
2411            Self {
2412                session_id: fidl::new_empty!(u64, D),
2413                session_info_delta: fidl::new_empty!(SessionInfoDelta, D),
2414            }
2415        }
2416
2417        #[inline]
2418        unsafe fn decode(
2419            &mut self,
2420            decoder: &mut fidl::encoding::Decoder<'_, D>,
2421            offset: usize,
2422            _depth: fidl::encoding::Depth,
2423        ) -> fidl::Result<()> {
2424            decoder.debug_check_bounds::<Self>(offset);
2425            // Verify that padding bytes are zero.
2426            fidl::decode!(u64, D, &mut self.session_id, decoder, offset + 0, _depth)?;
2427            fidl::decode!(
2428                SessionInfoDelta,
2429                D,
2430                &mut self.session_info_delta,
2431                decoder,
2432                offset + 8,
2433                _depth
2434            )?;
2435            Ok(())
2436        }
2437    }
2438
2439    impl MediaImage {
2440        #[inline(always)]
2441        fn max_ordinal_present(&self) -> u64 {
2442            if let Some(_) = self.sizes {
2443                return 2;
2444            }
2445            if let Some(_) = self.image_type {
2446                return 1;
2447            }
2448            0
2449        }
2450    }
2451
2452    impl fidl::encoding::ValueTypeMarker for MediaImage {
2453        type Borrowed<'a> = &'a Self;
2454        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2455            value
2456        }
2457    }
2458
2459    unsafe impl fidl::encoding::TypeMarker for MediaImage {
2460        type Owned = Self;
2461
2462        #[inline(always)]
2463        fn inline_align(_context: fidl::encoding::Context) -> usize {
2464            8
2465        }
2466
2467        #[inline(always)]
2468        fn inline_size(_context: fidl::encoding::Context) -> usize {
2469            16
2470        }
2471    }
2472
2473    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MediaImage, D>
2474        for &MediaImage
2475    {
2476        unsafe fn encode(
2477            self,
2478            encoder: &mut fidl::encoding::Encoder<'_, D>,
2479            offset: usize,
2480            mut depth: fidl::encoding::Depth,
2481        ) -> fidl::Result<()> {
2482            encoder.debug_check_bounds::<MediaImage>(offset);
2483            // Vector header
2484            let max_ordinal: u64 = self.max_ordinal_present();
2485            encoder.write_num(max_ordinal, offset);
2486            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2487            // Calling encoder.out_of_line_offset(0) is not allowed.
2488            if max_ordinal == 0 {
2489                return Ok(());
2490            }
2491            depth.increment()?;
2492            let envelope_size = 8;
2493            let bytes_len = max_ordinal as usize * envelope_size;
2494            #[allow(unused_variables)]
2495            let offset = encoder.out_of_line_offset(bytes_len);
2496            let mut _prev_end_offset: usize = 0;
2497            if 1 > max_ordinal {
2498                return Ok(());
2499            }
2500
2501            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2502            // are envelope_size bytes.
2503            let cur_offset: usize = (1 - 1) * envelope_size;
2504
2505            // Zero reserved fields.
2506            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2507
2508            // Safety:
2509            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2510            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2511            //   envelope_size bytes, there is always sufficient room.
2512            fidl::encoding::encode_in_envelope_optional::<MediaImageType, D>(
2513                self.image_type
2514                    .as_ref()
2515                    .map(<MediaImageType as fidl::encoding::ValueTypeMarker>::borrow),
2516                encoder,
2517                offset + cur_offset,
2518                depth,
2519            )?;
2520
2521            _prev_end_offset = cur_offset + envelope_size;
2522            if 2 > max_ordinal {
2523                return Ok(());
2524            }
2525
2526            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2527            // are envelope_size bytes.
2528            let cur_offset: usize = (2 - 1) * envelope_size;
2529
2530            // Zero reserved fields.
2531            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2532
2533            // Safety:
2534            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2535            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2536            //   envelope_size bytes, there is always sufficient room.
2537            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ImageSizeVariant, 16>, D>(
2538            self.sizes.as_ref().map(<fidl::encoding::Vector<ImageSizeVariant, 16> as fidl::encoding::ValueTypeMarker>::borrow),
2539            encoder, offset + cur_offset, depth
2540        )?;
2541
2542            _prev_end_offset = cur_offset + envelope_size;
2543
2544            Ok(())
2545        }
2546    }
2547
2548    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MediaImage {
2549        #[inline(always)]
2550        fn new_empty() -> Self {
2551            Self::default()
2552        }
2553
2554        unsafe fn decode(
2555            &mut self,
2556            decoder: &mut fidl::encoding::Decoder<'_, D>,
2557            offset: usize,
2558            mut depth: fidl::encoding::Depth,
2559        ) -> fidl::Result<()> {
2560            decoder.debug_check_bounds::<Self>(offset);
2561            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2562                None => return Err(fidl::Error::NotNullable),
2563                Some(len) => len,
2564            };
2565            // Calling decoder.out_of_line_offset(0) is not allowed.
2566            if len == 0 {
2567                return Ok(());
2568            };
2569            depth.increment()?;
2570            let envelope_size = 8;
2571            let bytes_len = len * envelope_size;
2572            let offset = decoder.out_of_line_offset(bytes_len)?;
2573            // Decode the envelope for each type.
2574            let mut _next_ordinal_to_read = 0;
2575            let mut next_offset = offset;
2576            let end_offset = offset + bytes_len;
2577            _next_ordinal_to_read += 1;
2578            if next_offset >= end_offset {
2579                return Ok(());
2580            }
2581
2582            // Decode unknown envelopes for gaps in ordinals.
2583            while _next_ordinal_to_read < 1 {
2584                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2585                _next_ordinal_to_read += 1;
2586                next_offset += envelope_size;
2587            }
2588
2589            let next_out_of_line = decoder.next_out_of_line();
2590            let handles_before = decoder.remaining_handles();
2591            if let Some((inlined, num_bytes, num_handles)) =
2592                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2593            {
2594                let member_inline_size =
2595                    <MediaImageType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2596                if inlined != (member_inline_size <= 4) {
2597                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2598                }
2599                let inner_offset;
2600                let mut inner_depth = depth.clone();
2601                if inlined {
2602                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2603                    inner_offset = next_offset;
2604                } else {
2605                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2606                    inner_depth.increment()?;
2607                }
2608                let val_ref =
2609                    self.image_type.get_or_insert_with(|| fidl::new_empty!(MediaImageType, D));
2610                fidl::decode!(MediaImageType, D, val_ref, decoder, inner_offset, inner_depth)?;
2611                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2612                {
2613                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2614                }
2615                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2616                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2617                }
2618            }
2619
2620            next_offset += envelope_size;
2621            _next_ordinal_to_read += 1;
2622            if next_offset >= end_offset {
2623                return Ok(());
2624            }
2625
2626            // Decode unknown envelopes for gaps in ordinals.
2627            while _next_ordinal_to_read < 2 {
2628                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2629                _next_ordinal_to_read += 1;
2630                next_offset += envelope_size;
2631            }
2632
2633            let next_out_of_line = decoder.next_out_of_line();
2634            let handles_before = decoder.remaining_handles();
2635            if let Some((inlined, num_bytes, num_handles)) =
2636                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2637            {
2638                let member_inline_size = <fidl::encoding::Vector<ImageSizeVariant, 16> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2639                if inlined != (member_inline_size <= 4) {
2640                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2641                }
2642                let inner_offset;
2643                let mut inner_depth = depth.clone();
2644                if inlined {
2645                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2646                    inner_offset = next_offset;
2647                } else {
2648                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2649                    inner_depth.increment()?;
2650                }
2651                let val_ref = self.sizes.get_or_insert_with(
2652                    || fidl::new_empty!(fidl::encoding::Vector<ImageSizeVariant, 16>, D),
2653                );
2654                fidl::decode!(fidl::encoding::Vector<ImageSizeVariant, 16>, D, val_ref, decoder, inner_offset, inner_depth)?;
2655                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2656                {
2657                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2658                }
2659                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2660                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2661                }
2662            }
2663
2664            next_offset += envelope_size;
2665
2666            // Decode the remaining unknown envelopes.
2667            while next_offset < end_offset {
2668                _next_ordinal_to_read += 1;
2669                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2670                next_offset += envelope_size;
2671            }
2672
2673            Ok(())
2674        }
2675    }
2676
2677    impl PlayerCapabilities {
2678        #[inline(always)]
2679        fn max_ordinal_present(&self) -> u64 {
2680            if let Some(_) = self.flags {
2681                return 1;
2682            }
2683            0
2684        }
2685    }
2686
2687    impl fidl::encoding::ValueTypeMarker for PlayerCapabilities {
2688        type Borrowed<'a> = &'a Self;
2689        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2690            value
2691        }
2692    }
2693
2694    unsafe impl fidl::encoding::TypeMarker for PlayerCapabilities {
2695        type Owned = Self;
2696
2697        #[inline(always)]
2698        fn inline_align(_context: fidl::encoding::Context) -> usize {
2699            8
2700        }
2701
2702        #[inline(always)]
2703        fn inline_size(_context: fidl::encoding::Context) -> usize {
2704            16
2705        }
2706    }
2707
2708    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PlayerCapabilities, D>
2709        for &PlayerCapabilities
2710    {
2711        unsafe fn encode(
2712            self,
2713            encoder: &mut fidl::encoding::Encoder<'_, D>,
2714            offset: usize,
2715            mut depth: fidl::encoding::Depth,
2716        ) -> fidl::Result<()> {
2717            encoder.debug_check_bounds::<PlayerCapabilities>(offset);
2718            // Vector header
2719            let max_ordinal: u64 = self.max_ordinal_present();
2720            encoder.write_num(max_ordinal, offset);
2721            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2722            // Calling encoder.out_of_line_offset(0) is not allowed.
2723            if max_ordinal == 0 {
2724                return Ok(());
2725            }
2726            depth.increment()?;
2727            let envelope_size = 8;
2728            let bytes_len = max_ordinal as usize * envelope_size;
2729            #[allow(unused_variables)]
2730            let offset = encoder.out_of_line_offset(bytes_len);
2731            let mut _prev_end_offset: usize = 0;
2732            if 1 > max_ordinal {
2733                return Ok(());
2734            }
2735
2736            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2737            // are envelope_size bytes.
2738            let cur_offset: usize = (1 - 1) * envelope_size;
2739
2740            // Zero reserved fields.
2741            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2742
2743            // Safety:
2744            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2745            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2746            //   envelope_size bytes, there is always sufficient room.
2747            fidl::encoding::encode_in_envelope_optional::<PlayerCapabilityFlags, D>(
2748                self.flags
2749                    .as_ref()
2750                    .map(<PlayerCapabilityFlags as fidl::encoding::ValueTypeMarker>::borrow),
2751                encoder,
2752                offset + cur_offset,
2753                depth,
2754            )?;
2755
2756            _prev_end_offset = cur_offset + envelope_size;
2757
2758            Ok(())
2759        }
2760    }
2761
2762    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PlayerCapabilities {
2763        #[inline(always)]
2764        fn new_empty() -> Self {
2765            Self::default()
2766        }
2767
2768        unsafe fn decode(
2769            &mut self,
2770            decoder: &mut fidl::encoding::Decoder<'_, D>,
2771            offset: usize,
2772            mut depth: fidl::encoding::Depth,
2773        ) -> fidl::Result<()> {
2774            decoder.debug_check_bounds::<Self>(offset);
2775            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2776                None => return Err(fidl::Error::NotNullable),
2777                Some(len) => len,
2778            };
2779            // Calling decoder.out_of_line_offset(0) is not allowed.
2780            if len == 0 {
2781                return Ok(());
2782            };
2783            depth.increment()?;
2784            let envelope_size = 8;
2785            let bytes_len = len * envelope_size;
2786            let offset = decoder.out_of_line_offset(bytes_len)?;
2787            // Decode the envelope for each type.
2788            let mut _next_ordinal_to_read = 0;
2789            let mut next_offset = offset;
2790            let end_offset = offset + bytes_len;
2791            _next_ordinal_to_read += 1;
2792            if next_offset >= end_offset {
2793                return Ok(());
2794            }
2795
2796            // Decode unknown envelopes for gaps in ordinals.
2797            while _next_ordinal_to_read < 1 {
2798                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2799                _next_ordinal_to_read += 1;
2800                next_offset += envelope_size;
2801            }
2802
2803            let next_out_of_line = decoder.next_out_of_line();
2804            let handles_before = decoder.remaining_handles();
2805            if let Some((inlined, num_bytes, num_handles)) =
2806                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2807            {
2808                let member_inline_size =
2809                    <PlayerCapabilityFlags as fidl::encoding::TypeMarker>::inline_size(
2810                        decoder.context,
2811                    );
2812                if inlined != (member_inline_size <= 4) {
2813                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2814                }
2815                let inner_offset;
2816                let mut inner_depth = depth.clone();
2817                if inlined {
2818                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2819                    inner_offset = next_offset;
2820                } else {
2821                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2822                    inner_depth.increment()?;
2823                }
2824                let val_ref =
2825                    self.flags.get_or_insert_with(|| fidl::new_empty!(PlayerCapabilityFlags, D));
2826                fidl::decode!(
2827                    PlayerCapabilityFlags,
2828                    D,
2829                    val_ref,
2830                    decoder,
2831                    inner_offset,
2832                    inner_depth
2833                )?;
2834                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2835                {
2836                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2837                }
2838                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2839                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2840                }
2841            }
2842
2843            next_offset += envelope_size;
2844
2845            // Decode the remaining unknown envelopes.
2846            while next_offset < end_offset {
2847                _next_ordinal_to_read += 1;
2848                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2849                next_offset += envelope_size;
2850            }
2851
2852            Ok(())
2853        }
2854    }
2855
2856    impl PlayerInfoDelta {
2857        #[inline(always)]
2858        fn max_ordinal_present(&self) -> u64 {
2859            if let Some(_) = self.interruption_behavior {
2860                return 6;
2861            }
2862            if let Some(_) = self.player_capabilities {
2863                return 5;
2864            }
2865            if let Some(_) = self.media_images {
2866                return 4;
2867            }
2868            if let Some(_) = self.metadata {
2869                return 3;
2870            }
2871            if let Some(_) = self.player_status {
2872                return 2;
2873            }
2874            if let Some(_) = self.local {
2875                return 1;
2876            }
2877            0
2878        }
2879    }
2880
2881    impl fidl::encoding::ValueTypeMarker for PlayerInfoDelta {
2882        type Borrowed<'a> = &'a Self;
2883        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2884            value
2885        }
2886    }
2887
2888    unsafe impl fidl::encoding::TypeMarker for PlayerInfoDelta {
2889        type Owned = Self;
2890
2891        #[inline(always)]
2892        fn inline_align(_context: fidl::encoding::Context) -> usize {
2893            8
2894        }
2895
2896        #[inline(always)]
2897        fn inline_size(_context: fidl::encoding::Context) -> usize {
2898            16
2899        }
2900    }
2901
2902    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PlayerInfoDelta, D>
2903        for &PlayerInfoDelta
2904    {
2905        unsafe fn encode(
2906            self,
2907            encoder: &mut fidl::encoding::Encoder<'_, D>,
2908            offset: usize,
2909            mut depth: fidl::encoding::Depth,
2910        ) -> fidl::Result<()> {
2911            encoder.debug_check_bounds::<PlayerInfoDelta>(offset);
2912            // Vector header
2913            let max_ordinal: u64 = self.max_ordinal_present();
2914            encoder.write_num(max_ordinal, offset);
2915            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2916            // Calling encoder.out_of_line_offset(0) is not allowed.
2917            if max_ordinal == 0 {
2918                return Ok(());
2919            }
2920            depth.increment()?;
2921            let envelope_size = 8;
2922            let bytes_len = max_ordinal as usize * envelope_size;
2923            #[allow(unused_variables)]
2924            let offset = encoder.out_of_line_offset(bytes_len);
2925            let mut _prev_end_offset: usize = 0;
2926            if 1 > max_ordinal {
2927                return Ok(());
2928            }
2929
2930            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2931            // are envelope_size bytes.
2932            let cur_offset: usize = (1 - 1) * envelope_size;
2933
2934            // Zero reserved fields.
2935            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2936
2937            // Safety:
2938            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2939            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2940            //   envelope_size bytes, there is always sufficient room.
2941            fidl::encoding::encode_in_envelope_optional::<bool, D>(
2942                self.local.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2943                encoder,
2944                offset + cur_offset,
2945                depth,
2946            )?;
2947
2948            _prev_end_offset = cur_offset + envelope_size;
2949            if 2 > max_ordinal {
2950                return Ok(());
2951            }
2952
2953            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2954            // are envelope_size bytes.
2955            let cur_offset: usize = (2 - 1) * envelope_size;
2956
2957            // Zero reserved fields.
2958            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2959
2960            // Safety:
2961            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2962            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2963            //   envelope_size bytes, there is always sufficient room.
2964            fidl::encoding::encode_in_envelope_optional::<PlayerStatus, D>(
2965                self.player_status
2966                    .as_ref()
2967                    .map(<PlayerStatus as fidl::encoding::ValueTypeMarker>::borrow),
2968                encoder,
2969                offset + cur_offset,
2970                depth,
2971            )?;
2972
2973            _prev_end_offset = cur_offset + envelope_size;
2974            if 3 > max_ordinal {
2975                return Ok(());
2976            }
2977
2978            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2979            // are envelope_size bytes.
2980            let cur_offset: usize = (3 - 1) * envelope_size;
2981
2982            // Zero reserved fields.
2983            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2984
2985            // Safety:
2986            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2987            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2988            //   envelope_size bytes, there is always sufficient room.
2989            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_media__common::Metadata, D>(
2990            self.metadata.as_ref().map(<fidl_fuchsia_media__common::Metadata as fidl::encoding::ValueTypeMarker>::borrow),
2991            encoder, offset + cur_offset, depth
2992        )?;
2993
2994            _prev_end_offset = cur_offset + envelope_size;
2995            if 4 > max_ordinal {
2996                return Ok(());
2997            }
2998
2999            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3000            // are envelope_size bytes.
3001            let cur_offset: usize = (4 - 1) * envelope_size;
3002
3003            // Zero reserved fields.
3004            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3005
3006            // Safety:
3007            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3008            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3009            //   envelope_size bytes, there is always sufficient room.
3010            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<MediaImage, 16>, D>(
3011            self.media_images.as_ref().map(<fidl::encoding::Vector<MediaImage, 16> as fidl::encoding::ValueTypeMarker>::borrow),
3012            encoder, offset + cur_offset, depth
3013        )?;
3014
3015            _prev_end_offset = cur_offset + envelope_size;
3016            if 5 > max_ordinal {
3017                return Ok(());
3018            }
3019
3020            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3021            // are envelope_size bytes.
3022            let cur_offset: usize = (5 - 1) * envelope_size;
3023
3024            // Zero reserved fields.
3025            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3026
3027            // Safety:
3028            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3029            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3030            //   envelope_size bytes, there is always sufficient room.
3031            fidl::encoding::encode_in_envelope_optional::<PlayerCapabilities, D>(
3032                self.player_capabilities
3033                    .as_ref()
3034                    .map(<PlayerCapabilities as fidl::encoding::ValueTypeMarker>::borrow),
3035                encoder,
3036                offset + cur_offset,
3037                depth,
3038            )?;
3039
3040            _prev_end_offset = cur_offset + envelope_size;
3041            if 6 > max_ordinal {
3042                return Ok(());
3043            }
3044
3045            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3046            // are envelope_size bytes.
3047            let cur_offset: usize = (6 - 1) * envelope_size;
3048
3049            // Zero reserved fields.
3050            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3051
3052            // Safety:
3053            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3054            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3055            //   envelope_size bytes, there is always sufficient room.
3056            fidl::encoding::encode_in_envelope_optional::<InterruptionBehavior, D>(
3057                self.interruption_behavior
3058                    .as_ref()
3059                    .map(<InterruptionBehavior as fidl::encoding::ValueTypeMarker>::borrow),
3060                encoder,
3061                offset + cur_offset,
3062                depth,
3063            )?;
3064
3065            _prev_end_offset = cur_offset + envelope_size;
3066
3067            Ok(())
3068        }
3069    }
3070
3071    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PlayerInfoDelta {
3072        #[inline(always)]
3073        fn new_empty() -> Self {
3074            Self::default()
3075        }
3076
3077        unsafe fn decode(
3078            &mut self,
3079            decoder: &mut fidl::encoding::Decoder<'_, D>,
3080            offset: usize,
3081            mut depth: fidl::encoding::Depth,
3082        ) -> fidl::Result<()> {
3083            decoder.debug_check_bounds::<Self>(offset);
3084            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3085                None => return Err(fidl::Error::NotNullable),
3086                Some(len) => len,
3087            };
3088            // Calling decoder.out_of_line_offset(0) is not allowed.
3089            if len == 0 {
3090                return Ok(());
3091            };
3092            depth.increment()?;
3093            let envelope_size = 8;
3094            let bytes_len = len * envelope_size;
3095            let offset = decoder.out_of_line_offset(bytes_len)?;
3096            // Decode the envelope for each type.
3097            let mut _next_ordinal_to_read = 0;
3098            let mut next_offset = offset;
3099            let end_offset = offset + bytes_len;
3100            _next_ordinal_to_read += 1;
3101            if next_offset >= end_offset {
3102                return Ok(());
3103            }
3104
3105            // Decode unknown envelopes for gaps in ordinals.
3106            while _next_ordinal_to_read < 1 {
3107                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3108                _next_ordinal_to_read += 1;
3109                next_offset += envelope_size;
3110            }
3111
3112            let next_out_of_line = decoder.next_out_of_line();
3113            let handles_before = decoder.remaining_handles();
3114            if let Some((inlined, num_bytes, num_handles)) =
3115                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3116            {
3117                let member_inline_size =
3118                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3119                if inlined != (member_inline_size <= 4) {
3120                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3121                }
3122                let inner_offset;
3123                let mut inner_depth = depth.clone();
3124                if inlined {
3125                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3126                    inner_offset = next_offset;
3127                } else {
3128                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3129                    inner_depth.increment()?;
3130                }
3131                let val_ref = self.local.get_or_insert_with(|| fidl::new_empty!(bool, D));
3132                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
3133                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3134                {
3135                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3136                }
3137                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3138                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3139                }
3140            }
3141
3142            next_offset += envelope_size;
3143            _next_ordinal_to_read += 1;
3144            if next_offset >= end_offset {
3145                return Ok(());
3146            }
3147
3148            // Decode unknown envelopes for gaps in ordinals.
3149            while _next_ordinal_to_read < 2 {
3150                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3151                _next_ordinal_to_read += 1;
3152                next_offset += envelope_size;
3153            }
3154
3155            let next_out_of_line = decoder.next_out_of_line();
3156            let handles_before = decoder.remaining_handles();
3157            if let Some((inlined, num_bytes, num_handles)) =
3158                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3159            {
3160                let member_inline_size =
3161                    <PlayerStatus as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3162                if inlined != (member_inline_size <= 4) {
3163                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3164                }
3165                let inner_offset;
3166                let mut inner_depth = depth.clone();
3167                if inlined {
3168                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3169                    inner_offset = next_offset;
3170                } else {
3171                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3172                    inner_depth.increment()?;
3173                }
3174                let val_ref =
3175                    self.player_status.get_or_insert_with(|| fidl::new_empty!(PlayerStatus, D));
3176                fidl::decode!(PlayerStatus, D, val_ref, decoder, inner_offset, inner_depth)?;
3177                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3178                {
3179                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3180                }
3181                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3182                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3183                }
3184            }
3185
3186            next_offset += envelope_size;
3187            _next_ordinal_to_read += 1;
3188            if next_offset >= end_offset {
3189                return Ok(());
3190            }
3191
3192            // Decode unknown envelopes for gaps in ordinals.
3193            while _next_ordinal_to_read < 3 {
3194                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3195                _next_ordinal_to_read += 1;
3196                next_offset += envelope_size;
3197            }
3198
3199            let next_out_of_line = decoder.next_out_of_line();
3200            let handles_before = decoder.remaining_handles();
3201            if let Some((inlined, num_bytes, num_handles)) =
3202                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3203            {
3204                let member_inline_size = <fidl_fuchsia_media__common::Metadata as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3205                if inlined != (member_inline_size <= 4) {
3206                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3207                }
3208                let inner_offset;
3209                let mut inner_depth = depth.clone();
3210                if inlined {
3211                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3212                    inner_offset = next_offset;
3213                } else {
3214                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3215                    inner_depth.increment()?;
3216                }
3217                let val_ref = self.metadata.get_or_insert_with(|| {
3218                    fidl::new_empty!(fidl_fuchsia_media__common::Metadata, D)
3219                });
3220                fidl::decode!(
3221                    fidl_fuchsia_media__common::Metadata,
3222                    D,
3223                    val_ref,
3224                    decoder,
3225                    inner_offset,
3226                    inner_depth
3227                )?;
3228                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3229                {
3230                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3231                }
3232                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3233                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3234                }
3235            }
3236
3237            next_offset += envelope_size;
3238            _next_ordinal_to_read += 1;
3239            if next_offset >= end_offset {
3240                return Ok(());
3241            }
3242
3243            // Decode unknown envelopes for gaps in ordinals.
3244            while _next_ordinal_to_read < 4 {
3245                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3246                _next_ordinal_to_read += 1;
3247                next_offset += envelope_size;
3248            }
3249
3250            let next_out_of_line = decoder.next_out_of_line();
3251            let handles_before = decoder.remaining_handles();
3252            if let Some((inlined, num_bytes, num_handles)) =
3253                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3254            {
3255                let member_inline_size = <fidl::encoding::Vector<MediaImage, 16> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3256                if inlined != (member_inline_size <= 4) {
3257                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3258                }
3259                let inner_offset;
3260                let mut inner_depth = depth.clone();
3261                if inlined {
3262                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3263                    inner_offset = next_offset;
3264                } else {
3265                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3266                    inner_depth.increment()?;
3267                }
3268                let val_ref = self.media_images.get_or_insert_with(
3269                    || fidl::new_empty!(fidl::encoding::Vector<MediaImage, 16>, D),
3270                );
3271                fidl::decode!(fidl::encoding::Vector<MediaImage, 16>, D, val_ref, decoder, inner_offset, inner_depth)?;
3272                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3273                {
3274                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3275                }
3276                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3277                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3278                }
3279            }
3280
3281            next_offset += envelope_size;
3282            _next_ordinal_to_read += 1;
3283            if next_offset >= end_offset {
3284                return Ok(());
3285            }
3286
3287            // Decode unknown envelopes for gaps in ordinals.
3288            while _next_ordinal_to_read < 5 {
3289                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3290                _next_ordinal_to_read += 1;
3291                next_offset += envelope_size;
3292            }
3293
3294            let next_out_of_line = decoder.next_out_of_line();
3295            let handles_before = decoder.remaining_handles();
3296            if let Some((inlined, num_bytes, num_handles)) =
3297                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3298            {
3299                let member_inline_size =
3300                    <PlayerCapabilities as fidl::encoding::TypeMarker>::inline_size(
3301                        decoder.context,
3302                    );
3303                if inlined != (member_inline_size <= 4) {
3304                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3305                }
3306                let inner_offset;
3307                let mut inner_depth = depth.clone();
3308                if inlined {
3309                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3310                    inner_offset = next_offset;
3311                } else {
3312                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3313                    inner_depth.increment()?;
3314                }
3315                let val_ref = self
3316                    .player_capabilities
3317                    .get_or_insert_with(|| fidl::new_empty!(PlayerCapabilities, D));
3318                fidl::decode!(PlayerCapabilities, D, val_ref, decoder, inner_offset, inner_depth)?;
3319                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3320                {
3321                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3322                }
3323                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3324                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3325                }
3326            }
3327
3328            next_offset += envelope_size;
3329            _next_ordinal_to_read += 1;
3330            if next_offset >= end_offset {
3331                return Ok(());
3332            }
3333
3334            // Decode unknown envelopes for gaps in ordinals.
3335            while _next_ordinal_to_read < 6 {
3336                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3337                _next_ordinal_to_read += 1;
3338                next_offset += envelope_size;
3339            }
3340
3341            let next_out_of_line = decoder.next_out_of_line();
3342            let handles_before = decoder.remaining_handles();
3343            if let Some((inlined, num_bytes, num_handles)) =
3344                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3345            {
3346                let member_inline_size =
3347                    <InterruptionBehavior as fidl::encoding::TypeMarker>::inline_size(
3348                        decoder.context,
3349                    );
3350                if inlined != (member_inline_size <= 4) {
3351                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3352                }
3353                let inner_offset;
3354                let mut inner_depth = depth.clone();
3355                if inlined {
3356                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3357                    inner_offset = next_offset;
3358                } else {
3359                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3360                    inner_depth.increment()?;
3361                }
3362                let val_ref = self
3363                    .interruption_behavior
3364                    .get_or_insert_with(|| fidl::new_empty!(InterruptionBehavior, D));
3365                fidl::decode!(
3366                    InterruptionBehavior,
3367                    D,
3368                    val_ref,
3369                    decoder,
3370                    inner_offset,
3371                    inner_depth
3372                )?;
3373                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3374                {
3375                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3376                }
3377                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3378                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3379                }
3380            }
3381
3382            next_offset += envelope_size;
3383
3384            // Decode the remaining unknown envelopes.
3385            while next_offset < end_offset {
3386                _next_ordinal_to_read += 1;
3387                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3388                next_offset += envelope_size;
3389            }
3390
3391            Ok(())
3392        }
3393    }
3394
3395    impl PlayerRegistration {
3396        #[inline(always)]
3397        fn max_ordinal_present(&self) -> u64 {
3398            if let Some(_) = self.usage2 {
3399                return 3;
3400            }
3401            if let Some(_) = self.usage {
3402                return 2;
3403            }
3404            if let Some(_) = self.domain {
3405                return 1;
3406            }
3407            0
3408        }
3409    }
3410
3411    impl fidl::encoding::ValueTypeMarker for PlayerRegistration {
3412        type Borrowed<'a> = &'a Self;
3413        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3414            value
3415        }
3416    }
3417
3418    unsafe impl fidl::encoding::TypeMarker for PlayerRegistration {
3419        type Owned = Self;
3420
3421        #[inline(always)]
3422        fn inline_align(_context: fidl::encoding::Context) -> usize {
3423            8
3424        }
3425
3426        #[inline(always)]
3427        fn inline_size(_context: fidl::encoding::Context) -> usize {
3428            16
3429        }
3430    }
3431
3432    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PlayerRegistration, D>
3433        for &PlayerRegistration
3434    {
3435        unsafe fn encode(
3436            self,
3437            encoder: &mut fidl::encoding::Encoder<'_, D>,
3438            offset: usize,
3439            mut depth: fidl::encoding::Depth,
3440        ) -> fidl::Result<()> {
3441            encoder.debug_check_bounds::<PlayerRegistration>(offset);
3442            // Vector header
3443            let max_ordinal: u64 = self.max_ordinal_present();
3444            encoder.write_num(max_ordinal, offset);
3445            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3446            // Calling encoder.out_of_line_offset(0) is not allowed.
3447            if max_ordinal == 0 {
3448                return Ok(());
3449            }
3450            depth.increment()?;
3451            let envelope_size = 8;
3452            let bytes_len = max_ordinal as usize * envelope_size;
3453            #[allow(unused_variables)]
3454            let offset = encoder.out_of_line_offset(bytes_len);
3455            let mut _prev_end_offset: usize = 0;
3456            if 1 > max_ordinal {
3457                return Ok(());
3458            }
3459
3460            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3461            // are envelope_size bytes.
3462            let cur_offset: usize = (1 - 1) * envelope_size;
3463
3464            // Zero reserved fields.
3465            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3466
3467            // Safety:
3468            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3469            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3470            //   envelope_size bytes, there is always sufficient room.
3471            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<1000>, D>(
3472            self.domain.as_ref().map(<fidl::encoding::BoundedString<1000> as fidl::encoding::ValueTypeMarker>::borrow),
3473            encoder, offset + cur_offset, depth
3474        )?;
3475
3476            _prev_end_offset = cur_offset + envelope_size;
3477            if 2 > max_ordinal {
3478                return Ok(());
3479            }
3480
3481            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3482            // are envelope_size bytes.
3483            let cur_offset: usize = (2 - 1) * envelope_size;
3484
3485            // Zero reserved fields.
3486            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3487
3488            // Safety:
3489            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3490            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3491            //   envelope_size bytes, there is always sufficient room.
3492            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_media__common::AudioRenderUsage, D>(
3493            self.usage.as_ref().map(<fidl_fuchsia_media__common::AudioRenderUsage as fidl::encoding::ValueTypeMarker>::borrow),
3494            encoder, offset + cur_offset, depth
3495        )?;
3496
3497            _prev_end_offset = cur_offset + envelope_size;
3498            if 3 > max_ordinal {
3499                return Ok(());
3500            }
3501
3502            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3503            // are envelope_size bytes.
3504            let cur_offset: usize = (3 - 1) * envelope_size;
3505
3506            // Zero reserved fields.
3507            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3508
3509            // Safety:
3510            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3511            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3512            //   envelope_size bytes, there is always sufficient room.
3513            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_media__common::AudioRenderUsage2, D>(
3514            self.usage2.as_ref().map(<fidl_fuchsia_media__common::AudioRenderUsage2 as fidl::encoding::ValueTypeMarker>::borrow),
3515            encoder, offset + cur_offset, depth
3516        )?;
3517
3518            _prev_end_offset = cur_offset + envelope_size;
3519
3520            Ok(())
3521        }
3522    }
3523
3524    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PlayerRegistration {
3525        #[inline(always)]
3526        fn new_empty() -> Self {
3527            Self::default()
3528        }
3529
3530        unsafe fn decode(
3531            &mut self,
3532            decoder: &mut fidl::encoding::Decoder<'_, D>,
3533            offset: usize,
3534            mut depth: fidl::encoding::Depth,
3535        ) -> fidl::Result<()> {
3536            decoder.debug_check_bounds::<Self>(offset);
3537            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3538                None => return Err(fidl::Error::NotNullable),
3539                Some(len) => len,
3540            };
3541            // Calling decoder.out_of_line_offset(0) is not allowed.
3542            if len == 0 {
3543                return Ok(());
3544            };
3545            depth.increment()?;
3546            let envelope_size = 8;
3547            let bytes_len = len * envelope_size;
3548            let offset = decoder.out_of_line_offset(bytes_len)?;
3549            // Decode the envelope for each type.
3550            let mut _next_ordinal_to_read = 0;
3551            let mut next_offset = offset;
3552            let end_offset = offset + bytes_len;
3553            _next_ordinal_to_read += 1;
3554            if next_offset >= end_offset {
3555                return Ok(());
3556            }
3557
3558            // Decode unknown envelopes for gaps in ordinals.
3559            while _next_ordinal_to_read < 1 {
3560                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3561                _next_ordinal_to_read += 1;
3562                next_offset += envelope_size;
3563            }
3564
3565            let next_out_of_line = decoder.next_out_of_line();
3566            let handles_before = decoder.remaining_handles();
3567            if let Some((inlined, num_bytes, num_handles)) =
3568                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3569            {
3570                let member_inline_size = <fidl::encoding::BoundedString<1000> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3571                if inlined != (member_inline_size <= 4) {
3572                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3573                }
3574                let inner_offset;
3575                let mut inner_depth = depth.clone();
3576                if inlined {
3577                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3578                    inner_offset = next_offset;
3579                } else {
3580                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3581                    inner_depth.increment()?;
3582                }
3583                let val_ref = self.domain.get_or_insert_with(|| {
3584                    fidl::new_empty!(fidl::encoding::BoundedString<1000>, D)
3585                });
3586                fidl::decode!(
3587                    fidl::encoding::BoundedString<1000>,
3588                    D,
3589                    val_ref,
3590                    decoder,
3591                    inner_offset,
3592                    inner_depth
3593                )?;
3594                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3595                {
3596                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3597                }
3598                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3599                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3600                }
3601            }
3602
3603            next_offset += envelope_size;
3604            _next_ordinal_to_read += 1;
3605            if next_offset >= end_offset {
3606                return Ok(());
3607            }
3608
3609            // Decode unknown envelopes for gaps in ordinals.
3610            while _next_ordinal_to_read < 2 {
3611                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3612                _next_ordinal_to_read += 1;
3613                next_offset += envelope_size;
3614            }
3615
3616            let next_out_of_line = decoder.next_out_of_line();
3617            let handles_before = decoder.remaining_handles();
3618            if let Some((inlined, num_bytes, num_handles)) =
3619                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3620            {
3621                let member_inline_size = <fidl_fuchsia_media__common::AudioRenderUsage as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3622                if inlined != (member_inline_size <= 4) {
3623                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3624                }
3625                let inner_offset;
3626                let mut inner_depth = depth.clone();
3627                if inlined {
3628                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3629                    inner_offset = next_offset;
3630                } else {
3631                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3632                    inner_depth.increment()?;
3633                }
3634                let val_ref = self.usage.get_or_insert_with(|| {
3635                    fidl::new_empty!(fidl_fuchsia_media__common::AudioRenderUsage, D)
3636                });
3637                fidl::decode!(
3638                    fidl_fuchsia_media__common::AudioRenderUsage,
3639                    D,
3640                    val_ref,
3641                    decoder,
3642                    inner_offset,
3643                    inner_depth
3644                )?;
3645                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3646                {
3647                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3648                }
3649                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3650                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3651                }
3652            }
3653
3654            next_offset += envelope_size;
3655            _next_ordinal_to_read += 1;
3656            if next_offset >= end_offset {
3657                return Ok(());
3658            }
3659
3660            // Decode unknown envelopes for gaps in ordinals.
3661            while _next_ordinal_to_read < 3 {
3662                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3663                _next_ordinal_to_read += 1;
3664                next_offset += envelope_size;
3665            }
3666
3667            let next_out_of_line = decoder.next_out_of_line();
3668            let handles_before = decoder.remaining_handles();
3669            if let Some((inlined, num_bytes, num_handles)) =
3670                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3671            {
3672                let member_inline_size = <fidl_fuchsia_media__common::AudioRenderUsage2 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3673                if inlined != (member_inline_size <= 4) {
3674                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3675                }
3676                let inner_offset;
3677                let mut inner_depth = depth.clone();
3678                if inlined {
3679                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3680                    inner_offset = next_offset;
3681                } else {
3682                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3683                    inner_depth.increment()?;
3684                }
3685                let val_ref = self.usage2.get_or_insert_with(|| {
3686                    fidl::new_empty!(fidl_fuchsia_media__common::AudioRenderUsage2, D)
3687                });
3688                fidl::decode!(
3689                    fidl_fuchsia_media__common::AudioRenderUsage2,
3690                    D,
3691                    val_ref,
3692                    decoder,
3693                    inner_offset,
3694                    inner_depth
3695                )?;
3696                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3697                {
3698                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3699                }
3700                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3701                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3702                }
3703            }
3704
3705            next_offset += envelope_size;
3706
3707            // Decode the remaining unknown envelopes.
3708            while next_offset < end_offset {
3709                _next_ordinal_to_read += 1;
3710                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3711                next_offset += envelope_size;
3712            }
3713
3714            Ok(())
3715        }
3716    }
3717
3718    impl PlayerStatus {
3719        #[inline(always)]
3720        fn max_ordinal_present(&self) -> u64 {
3721            if let Some(_) = self.is_live {
3722                return 8;
3723            }
3724            if let Some(_) = self.error {
3725                return 7;
3726            }
3727            if let Some(_) = self.content_type {
3728                return 6;
3729            }
3730            if let Some(_) = self.shuffle_on {
3731                return 5;
3732            }
3733            if let Some(_) = self.repeat_mode {
3734                return 4;
3735            }
3736            if let Some(_) = self.timeline_function {
3737                return 3;
3738            }
3739            if let Some(_) = self.player_state {
3740                return 2;
3741            }
3742            if let Some(_) = self.duration {
3743                return 1;
3744            }
3745            0
3746        }
3747    }
3748
3749    impl fidl::encoding::ValueTypeMarker for PlayerStatus {
3750        type Borrowed<'a> = &'a Self;
3751        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3752            value
3753        }
3754    }
3755
3756    unsafe impl fidl::encoding::TypeMarker for PlayerStatus {
3757        type Owned = Self;
3758
3759        #[inline(always)]
3760        fn inline_align(_context: fidl::encoding::Context) -> usize {
3761            8
3762        }
3763
3764        #[inline(always)]
3765        fn inline_size(_context: fidl::encoding::Context) -> usize {
3766            16
3767        }
3768    }
3769
3770    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PlayerStatus, D>
3771        for &PlayerStatus
3772    {
3773        unsafe fn encode(
3774            self,
3775            encoder: &mut fidl::encoding::Encoder<'_, D>,
3776            offset: usize,
3777            mut depth: fidl::encoding::Depth,
3778        ) -> fidl::Result<()> {
3779            encoder.debug_check_bounds::<PlayerStatus>(offset);
3780            // Vector header
3781            let max_ordinal: u64 = self.max_ordinal_present();
3782            encoder.write_num(max_ordinal, offset);
3783            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3784            // Calling encoder.out_of_line_offset(0) is not allowed.
3785            if max_ordinal == 0 {
3786                return Ok(());
3787            }
3788            depth.increment()?;
3789            let envelope_size = 8;
3790            let bytes_len = max_ordinal as usize * envelope_size;
3791            #[allow(unused_variables)]
3792            let offset = encoder.out_of_line_offset(bytes_len);
3793            let mut _prev_end_offset: usize = 0;
3794            if 1 > max_ordinal {
3795                return Ok(());
3796            }
3797
3798            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3799            // are envelope_size bytes.
3800            let cur_offset: usize = (1 - 1) * envelope_size;
3801
3802            // Zero reserved fields.
3803            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3804
3805            // Safety:
3806            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3807            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3808            //   envelope_size bytes, there is always sufficient room.
3809            fidl::encoding::encode_in_envelope_optional::<i64, D>(
3810                self.duration.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
3811                encoder,
3812                offset + cur_offset,
3813                depth,
3814            )?;
3815
3816            _prev_end_offset = cur_offset + envelope_size;
3817            if 2 > max_ordinal {
3818                return Ok(());
3819            }
3820
3821            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3822            // are envelope_size bytes.
3823            let cur_offset: usize = (2 - 1) * envelope_size;
3824
3825            // Zero reserved fields.
3826            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3827
3828            // Safety:
3829            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3830            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3831            //   envelope_size bytes, there is always sufficient room.
3832            fidl::encoding::encode_in_envelope_optional::<PlayerState, D>(
3833                self.player_state
3834                    .as_ref()
3835                    .map(<PlayerState as fidl::encoding::ValueTypeMarker>::borrow),
3836                encoder,
3837                offset + cur_offset,
3838                depth,
3839            )?;
3840
3841            _prev_end_offset = cur_offset + envelope_size;
3842            if 3 > max_ordinal {
3843                return Ok(());
3844            }
3845
3846            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3847            // are envelope_size bytes.
3848            let cur_offset: usize = (3 - 1) * envelope_size;
3849
3850            // Zero reserved fields.
3851            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3852
3853            // Safety:
3854            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3855            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3856            //   envelope_size bytes, there is always sufficient room.
3857            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_media__common::TimelineFunction, D>(
3858            self.timeline_function.as_ref().map(<fidl_fuchsia_media__common::TimelineFunction as fidl::encoding::ValueTypeMarker>::borrow),
3859            encoder, offset + cur_offset, depth
3860        )?;
3861
3862            _prev_end_offset = cur_offset + envelope_size;
3863            if 4 > max_ordinal {
3864                return Ok(());
3865            }
3866
3867            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3868            // are envelope_size bytes.
3869            let cur_offset: usize = (4 - 1) * envelope_size;
3870
3871            // Zero reserved fields.
3872            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3873
3874            // Safety:
3875            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3876            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3877            //   envelope_size bytes, there is always sufficient room.
3878            fidl::encoding::encode_in_envelope_optional::<RepeatMode, D>(
3879                self.repeat_mode
3880                    .as_ref()
3881                    .map(<RepeatMode as fidl::encoding::ValueTypeMarker>::borrow),
3882                encoder,
3883                offset + cur_offset,
3884                depth,
3885            )?;
3886
3887            _prev_end_offset = cur_offset + envelope_size;
3888            if 5 > max_ordinal {
3889                return Ok(());
3890            }
3891
3892            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3893            // are envelope_size bytes.
3894            let cur_offset: usize = (5 - 1) * envelope_size;
3895
3896            // Zero reserved fields.
3897            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3898
3899            // Safety:
3900            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3901            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3902            //   envelope_size bytes, there is always sufficient room.
3903            fidl::encoding::encode_in_envelope_optional::<bool, D>(
3904                self.shuffle_on.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
3905                encoder,
3906                offset + cur_offset,
3907                depth,
3908            )?;
3909
3910            _prev_end_offset = cur_offset + envelope_size;
3911            if 6 > max_ordinal {
3912                return Ok(());
3913            }
3914
3915            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3916            // are envelope_size bytes.
3917            let cur_offset: usize = (6 - 1) * envelope_size;
3918
3919            // Zero reserved fields.
3920            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3921
3922            // Safety:
3923            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3924            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3925            //   envelope_size bytes, there is always sufficient room.
3926            fidl::encoding::encode_in_envelope_optional::<ContentType, D>(
3927                self.content_type
3928                    .as_ref()
3929                    .map(<ContentType as fidl::encoding::ValueTypeMarker>::borrow),
3930                encoder,
3931                offset + cur_offset,
3932                depth,
3933            )?;
3934
3935            _prev_end_offset = cur_offset + envelope_size;
3936            if 7 > max_ordinal {
3937                return Ok(());
3938            }
3939
3940            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3941            // are envelope_size bytes.
3942            let cur_offset: usize = (7 - 1) * envelope_size;
3943
3944            // Zero reserved fields.
3945            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3946
3947            // Safety:
3948            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3949            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3950            //   envelope_size bytes, there is always sufficient room.
3951            fidl::encoding::encode_in_envelope_optional::<Error, D>(
3952                self.error.as_ref().map(<Error as fidl::encoding::ValueTypeMarker>::borrow),
3953                encoder,
3954                offset + cur_offset,
3955                depth,
3956            )?;
3957
3958            _prev_end_offset = cur_offset + envelope_size;
3959            if 8 > max_ordinal {
3960                return Ok(());
3961            }
3962
3963            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3964            // are envelope_size bytes.
3965            let cur_offset: usize = (8 - 1) * envelope_size;
3966
3967            // Zero reserved fields.
3968            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3969
3970            // Safety:
3971            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3972            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3973            //   envelope_size bytes, there is always sufficient room.
3974            fidl::encoding::encode_in_envelope_optional::<bool, D>(
3975                self.is_live.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
3976                encoder,
3977                offset + cur_offset,
3978                depth,
3979            )?;
3980
3981            _prev_end_offset = cur_offset + envelope_size;
3982
3983            Ok(())
3984        }
3985    }
3986
3987    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PlayerStatus {
3988        #[inline(always)]
3989        fn new_empty() -> Self {
3990            Self::default()
3991        }
3992
3993        unsafe fn decode(
3994            &mut self,
3995            decoder: &mut fidl::encoding::Decoder<'_, D>,
3996            offset: usize,
3997            mut depth: fidl::encoding::Depth,
3998        ) -> fidl::Result<()> {
3999            decoder.debug_check_bounds::<Self>(offset);
4000            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4001                None => return Err(fidl::Error::NotNullable),
4002                Some(len) => len,
4003            };
4004            // Calling decoder.out_of_line_offset(0) is not allowed.
4005            if len == 0 {
4006                return Ok(());
4007            };
4008            depth.increment()?;
4009            let envelope_size = 8;
4010            let bytes_len = len * envelope_size;
4011            let offset = decoder.out_of_line_offset(bytes_len)?;
4012            // Decode the envelope for each type.
4013            let mut _next_ordinal_to_read = 0;
4014            let mut next_offset = offset;
4015            let end_offset = offset + bytes_len;
4016            _next_ordinal_to_read += 1;
4017            if next_offset >= end_offset {
4018                return Ok(());
4019            }
4020
4021            // Decode unknown envelopes for gaps in ordinals.
4022            while _next_ordinal_to_read < 1 {
4023                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4024                _next_ordinal_to_read += 1;
4025                next_offset += envelope_size;
4026            }
4027
4028            let next_out_of_line = decoder.next_out_of_line();
4029            let handles_before = decoder.remaining_handles();
4030            if let Some((inlined, num_bytes, num_handles)) =
4031                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4032            {
4033                let member_inline_size =
4034                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4035                if inlined != (member_inline_size <= 4) {
4036                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4037                }
4038                let inner_offset;
4039                let mut inner_depth = depth.clone();
4040                if inlined {
4041                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4042                    inner_offset = next_offset;
4043                } else {
4044                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4045                    inner_depth.increment()?;
4046                }
4047                let val_ref = self.duration.get_or_insert_with(|| fidl::new_empty!(i64, D));
4048                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
4049                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4050                {
4051                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4052                }
4053                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4054                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4055                }
4056            }
4057
4058            next_offset += envelope_size;
4059            _next_ordinal_to_read += 1;
4060            if next_offset >= end_offset {
4061                return Ok(());
4062            }
4063
4064            // Decode unknown envelopes for gaps in ordinals.
4065            while _next_ordinal_to_read < 2 {
4066                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4067                _next_ordinal_to_read += 1;
4068                next_offset += envelope_size;
4069            }
4070
4071            let next_out_of_line = decoder.next_out_of_line();
4072            let handles_before = decoder.remaining_handles();
4073            if let Some((inlined, num_bytes, num_handles)) =
4074                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4075            {
4076                let member_inline_size =
4077                    <PlayerState as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4078                if inlined != (member_inline_size <= 4) {
4079                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4080                }
4081                let inner_offset;
4082                let mut inner_depth = depth.clone();
4083                if inlined {
4084                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4085                    inner_offset = next_offset;
4086                } else {
4087                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4088                    inner_depth.increment()?;
4089                }
4090                let val_ref =
4091                    self.player_state.get_or_insert_with(|| fidl::new_empty!(PlayerState, D));
4092                fidl::decode!(PlayerState, D, val_ref, decoder, inner_offset, inner_depth)?;
4093                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4094                {
4095                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4096                }
4097                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4098                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4099                }
4100            }
4101
4102            next_offset += envelope_size;
4103            _next_ordinal_to_read += 1;
4104            if next_offset >= end_offset {
4105                return Ok(());
4106            }
4107
4108            // Decode unknown envelopes for gaps in ordinals.
4109            while _next_ordinal_to_read < 3 {
4110                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4111                _next_ordinal_to_read += 1;
4112                next_offset += envelope_size;
4113            }
4114
4115            let next_out_of_line = decoder.next_out_of_line();
4116            let handles_before = decoder.remaining_handles();
4117            if let Some((inlined, num_bytes, num_handles)) =
4118                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4119            {
4120                let member_inline_size = <fidl_fuchsia_media__common::TimelineFunction as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4121                if inlined != (member_inline_size <= 4) {
4122                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4123                }
4124                let inner_offset;
4125                let mut inner_depth = depth.clone();
4126                if inlined {
4127                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4128                    inner_offset = next_offset;
4129                } else {
4130                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4131                    inner_depth.increment()?;
4132                }
4133                let val_ref = self.timeline_function.get_or_insert_with(|| {
4134                    fidl::new_empty!(fidl_fuchsia_media__common::TimelineFunction, D)
4135                });
4136                fidl::decode!(
4137                    fidl_fuchsia_media__common::TimelineFunction,
4138                    D,
4139                    val_ref,
4140                    decoder,
4141                    inner_offset,
4142                    inner_depth
4143                )?;
4144                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4145                {
4146                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4147                }
4148                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4149                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4150                }
4151            }
4152
4153            next_offset += envelope_size;
4154            _next_ordinal_to_read += 1;
4155            if next_offset >= end_offset {
4156                return Ok(());
4157            }
4158
4159            // Decode unknown envelopes for gaps in ordinals.
4160            while _next_ordinal_to_read < 4 {
4161                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4162                _next_ordinal_to_read += 1;
4163                next_offset += envelope_size;
4164            }
4165
4166            let next_out_of_line = decoder.next_out_of_line();
4167            let handles_before = decoder.remaining_handles();
4168            if let Some((inlined, num_bytes, num_handles)) =
4169                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4170            {
4171                let member_inline_size =
4172                    <RepeatMode as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4173                if inlined != (member_inline_size <= 4) {
4174                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4175                }
4176                let inner_offset;
4177                let mut inner_depth = depth.clone();
4178                if inlined {
4179                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4180                    inner_offset = next_offset;
4181                } else {
4182                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4183                    inner_depth.increment()?;
4184                }
4185                let val_ref =
4186                    self.repeat_mode.get_or_insert_with(|| fidl::new_empty!(RepeatMode, D));
4187                fidl::decode!(RepeatMode, D, val_ref, decoder, inner_offset, inner_depth)?;
4188                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4189                {
4190                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4191                }
4192                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4193                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4194                }
4195            }
4196
4197            next_offset += envelope_size;
4198            _next_ordinal_to_read += 1;
4199            if next_offset >= end_offset {
4200                return Ok(());
4201            }
4202
4203            // Decode unknown envelopes for gaps in ordinals.
4204            while _next_ordinal_to_read < 5 {
4205                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4206                _next_ordinal_to_read += 1;
4207                next_offset += envelope_size;
4208            }
4209
4210            let next_out_of_line = decoder.next_out_of_line();
4211            let handles_before = decoder.remaining_handles();
4212            if let Some((inlined, num_bytes, num_handles)) =
4213                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4214            {
4215                let member_inline_size =
4216                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4217                if inlined != (member_inline_size <= 4) {
4218                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4219                }
4220                let inner_offset;
4221                let mut inner_depth = depth.clone();
4222                if inlined {
4223                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4224                    inner_offset = next_offset;
4225                } else {
4226                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4227                    inner_depth.increment()?;
4228                }
4229                let val_ref = self.shuffle_on.get_or_insert_with(|| fidl::new_empty!(bool, D));
4230                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
4231                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4232                {
4233                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4234                }
4235                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4236                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4237                }
4238            }
4239
4240            next_offset += envelope_size;
4241            _next_ordinal_to_read += 1;
4242            if next_offset >= end_offset {
4243                return Ok(());
4244            }
4245
4246            // Decode unknown envelopes for gaps in ordinals.
4247            while _next_ordinal_to_read < 6 {
4248                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4249                _next_ordinal_to_read += 1;
4250                next_offset += envelope_size;
4251            }
4252
4253            let next_out_of_line = decoder.next_out_of_line();
4254            let handles_before = decoder.remaining_handles();
4255            if let Some((inlined, num_bytes, num_handles)) =
4256                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4257            {
4258                let member_inline_size =
4259                    <ContentType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4260                if inlined != (member_inline_size <= 4) {
4261                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4262                }
4263                let inner_offset;
4264                let mut inner_depth = depth.clone();
4265                if inlined {
4266                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4267                    inner_offset = next_offset;
4268                } else {
4269                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4270                    inner_depth.increment()?;
4271                }
4272                let val_ref =
4273                    self.content_type.get_or_insert_with(|| fidl::new_empty!(ContentType, D));
4274                fidl::decode!(ContentType, D, val_ref, decoder, inner_offset, inner_depth)?;
4275                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4276                {
4277                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4278                }
4279                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4280                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4281                }
4282            }
4283
4284            next_offset += envelope_size;
4285            _next_ordinal_to_read += 1;
4286            if next_offset >= end_offset {
4287                return Ok(());
4288            }
4289
4290            // Decode unknown envelopes for gaps in ordinals.
4291            while _next_ordinal_to_read < 7 {
4292                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4293                _next_ordinal_to_read += 1;
4294                next_offset += envelope_size;
4295            }
4296
4297            let next_out_of_line = decoder.next_out_of_line();
4298            let handles_before = decoder.remaining_handles();
4299            if let Some((inlined, num_bytes, num_handles)) =
4300                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4301            {
4302                let member_inline_size =
4303                    <Error as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4304                if inlined != (member_inline_size <= 4) {
4305                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4306                }
4307                let inner_offset;
4308                let mut inner_depth = depth.clone();
4309                if inlined {
4310                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4311                    inner_offset = next_offset;
4312                } else {
4313                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4314                    inner_depth.increment()?;
4315                }
4316                let val_ref = self.error.get_or_insert_with(|| fidl::new_empty!(Error, D));
4317                fidl::decode!(Error, D, val_ref, decoder, inner_offset, inner_depth)?;
4318                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4319                {
4320                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4321                }
4322                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4323                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4324                }
4325            }
4326
4327            next_offset += envelope_size;
4328            _next_ordinal_to_read += 1;
4329            if next_offset >= end_offset {
4330                return Ok(());
4331            }
4332
4333            // Decode unknown envelopes for gaps in ordinals.
4334            while _next_ordinal_to_read < 8 {
4335                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4336                _next_ordinal_to_read += 1;
4337                next_offset += envelope_size;
4338            }
4339
4340            let next_out_of_line = decoder.next_out_of_line();
4341            let handles_before = decoder.remaining_handles();
4342            if let Some((inlined, num_bytes, num_handles)) =
4343                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4344            {
4345                let member_inline_size =
4346                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4347                if inlined != (member_inline_size <= 4) {
4348                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4349                }
4350                let inner_offset;
4351                let mut inner_depth = depth.clone();
4352                if inlined {
4353                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4354                    inner_offset = next_offset;
4355                } else {
4356                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4357                    inner_depth.increment()?;
4358                }
4359                let val_ref = self.is_live.get_or_insert_with(|| fidl::new_empty!(bool, D));
4360                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
4361                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4362                {
4363                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4364                }
4365                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4366                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4367                }
4368            }
4369
4370            next_offset += envelope_size;
4371
4372            // Decode the remaining unknown envelopes.
4373            while next_offset < end_offset {
4374                _next_ordinal_to_read += 1;
4375                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4376                next_offset += envelope_size;
4377            }
4378
4379            Ok(())
4380        }
4381    }
4382
4383    impl SessionInfoDelta {
4384        #[inline(always)]
4385        fn max_ordinal_present(&self) -> u64 {
4386            if let Some(_) = self.player_capabilities {
4387                return 7;
4388            }
4389            if let Some(_) = self.media_images {
4390                return 6;
4391            }
4392            if let Some(_) = self.metadata {
4393                return 5;
4394            }
4395            if let Some(_) = self.player_status {
4396                return 4;
4397            }
4398            if let Some(_) = self.is_locally_active {
4399                return 3;
4400            }
4401            if let Some(_) = self.is_local {
4402                return 2;
4403            }
4404            if let Some(_) = self.domain {
4405                return 1;
4406            }
4407            0
4408        }
4409    }
4410
4411    impl fidl::encoding::ValueTypeMarker for SessionInfoDelta {
4412        type Borrowed<'a> = &'a Self;
4413        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4414            value
4415        }
4416    }
4417
4418    unsafe impl fidl::encoding::TypeMarker for SessionInfoDelta {
4419        type Owned = Self;
4420
4421        #[inline(always)]
4422        fn inline_align(_context: fidl::encoding::Context) -> usize {
4423            8
4424        }
4425
4426        #[inline(always)]
4427        fn inline_size(_context: fidl::encoding::Context) -> usize {
4428            16
4429        }
4430    }
4431
4432    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SessionInfoDelta, D>
4433        for &SessionInfoDelta
4434    {
4435        unsafe fn encode(
4436            self,
4437            encoder: &mut fidl::encoding::Encoder<'_, D>,
4438            offset: usize,
4439            mut depth: fidl::encoding::Depth,
4440        ) -> fidl::Result<()> {
4441            encoder.debug_check_bounds::<SessionInfoDelta>(offset);
4442            // Vector header
4443            let max_ordinal: u64 = self.max_ordinal_present();
4444            encoder.write_num(max_ordinal, offset);
4445            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4446            // Calling encoder.out_of_line_offset(0) is not allowed.
4447            if max_ordinal == 0 {
4448                return Ok(());
4449            }
4450            depth.increment()?;
4451            let envelope_size = 8;
4452            let bytes_len = max_ordinal as usize * envelope_size;
4453            #[allow(unused_variables)]
4454            let offset = encoder.out_of_line_offset(bytes_len);
4455            let mut _prev_end_offset: usize = 0;
4456            if 1 > max_ordinal {
4457                return Ok(());
4458            }
4459
4460            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4461            // are envelope_size bytes.
4462            let cur_offset: usize = (1 - 1) * envelope_size;
4463
4464            // Zero reserved fields.
4465            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4466
4467            // Safety:
4468            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4469            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4470            //   envelope_size bytes, there is always sufficient room.
4471            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<1000>, D>(
4472            self.domain.as_ref().map(<fidl::encoding::BoundedString<1000> as fidl::encoding::ValueTypeMarker>::borrow),
4473            encoder, offset + cur_offset, depth
4474        )?;
4475
4476            _prev_end_offset = cur_offset + envelope_size;
4477            if 2 > max_ordinal {
4478                return Ok(());
4479            }
4480
4481            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4482            // are envelope_size bytes.
4483            let cur_offset: usize = (2 - 1) * envelope_size;
4484
4485            // Zero reserved fields.
4486            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4487
4488            // Safety:
4489            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4490            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4491            //   envelope_size bytes, there is always sufficient room.
4492            fidl::encoding::encode_in_envelope_optional::<bool, D>(
4493                self.is_local.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
4494                encoder,
4495                offset + cur_offset,
4496                depth,
4497            )?;
4498
4499            _prev_end_offset = cur_offset + envelope_size;
4500            if 3 > max_ordinal {
4501                return Ok(());
4502            }
4503
4504            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4505            // are envelope_size bytes.
4506            let cur_offset: usize = (3 - 1) * envelope_size;
4507
4508            // Zero reserved fields.
4509            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4510
4511            // Safety:
4512            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4513            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4514            //   envelope_size bytes, there is always sufficient room.
4515            fidl::encoding::encode_in_envelope_optional::<bool, D>(
4516                self.is_locally_active
4517                    .as_ref()
4518                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
4519                encoder,
4520                offset + cur_offset,
4521                depth,
4522            )?;
4523
4524            _prev_end_offset = cur_offset + envelope_size;
4525            if 4 > max_ordinal {
4526                return Ok(());
4527            }
4528
4529            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4530            // are envelope_size bytes.
4531            let cur_offset: usize = (4 - 1) * envelope_size;
4532
4533            // Zero reserved fields.
4534            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4535
4536            // Safety:
4537            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4538            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4539            //   envelope_size bytes, there is always sufficient room.
4540            fidl::encoding::encode_in_envelope_optional::<PlayerStatus, D>(
4541                self.player_status
4542                    .as_ref()
4543                    .map(<PlayerStatus as fidl::encoding::ValueTypeMarker>::borrow),
4544                encoder,
4545                offset + cur_offset,
4546                depth,
4547            )?;
4548
4549            _prev_end_offset = cur_offset + envelope_size;
4550            if 5 > max_ordinal {
4551                return Ok(());
4552            }
4553
4554            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4555            // are envelope_size bytes.
4556            let cur_offset: usize = (5 - 1) * envelope_size;
4557
4558            // Zero reserved fields.
4559            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4560
4561            // Safety:
4562            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4563            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4564            //   envelope_size bytes, there is always sufficient room.
4565            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_media__common::Metadata, D>(
4566            self.metadata.as_ref().map(<fidl_fuchsia_media__common::Metadata as fidl::encoding::ValueTypeMarker>::borrow),
4567            encoder, offset + cur_offset, depth
4568        )?;
4569
4570            _prev_end_offset = cur_offset + envelope_size;
4571            if 6 > max_ordinal {
4572                return Ok(());
4573            }
4574
4575            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4576            // are envelope_size bytes.
4577            let cur_offset: usize = (6 - 1) * envelope_size;
4578
4579            // Zero reserved fields.
4580            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4581
4582            // Safety:
4583            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4584            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4585            //   envelope_size bytes, there is always sufficient room.
4586            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<MediaImage>, D>(
4587            self.media_images.as_ref().map(<fidl::encoding::UnboundedVector<MediaImage> as fidl::encoding::ValueTypeMarker>::borrow),
4588            encoder, offset + cur_offset, depth
4589        )?;
4590
4591            _prev_end_offset = cur_offset + envelope_size;
4592            if 7 > max_ordinal {
4593                return Ok(());
4594            }
4595
4596            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4597            // are envelope_size bytes.
4598            let cur_offset: usize = (7 - 1) * envelope_size;
4599
4600            // Zero reserved fields.
4601            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4602
4603            // Safety:
4604            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4605            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4606            //   envelope_size bytes, there is always sufficient room.
4607            fidl::encoding::encode_in_envelope_optional::<PlayerCapabilities, D>(
4608                self.player_capabilities
4609                    .as_ref()
4610                    .map(<PlayerCapabilities as fidl::encoding::ValueTypeMarker>::borrow),
4611                encoder,
4612                offset + cur_offset,
4613                depth,
4614            )?;
4615
4616            _prev_end_offset = cur_offset + envelope_size;
4617
4618            Ok(())
4619        }
4620    }
4621
4622    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SessionInfoDelta {
4623        #[inline(always)]
4624        fn new_empty() -> Self {
4625            Self::default()
4626        }
4627
4628        unsafe fn decode(
4629            &mut self,
4630            decoder: &mut fidl::encoding::Decoder<'_, D>,
4631            offset: usize,
4632            mut depth: fidl::encoding::Depth,
4633        ) -> fidl::Result<()> {
4634            decoder.debug_check_bounds::<Self>(offset);
4635            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4636                None => return Err(fidl::Error::NotNullable),
4637                Some(len) => len,
4638            };
4639            // Calling decoder.out_of_line_offset(0) is not allowed.
4640            if len == 0 {
4641                return Ok(());
4642            };
4643            depth.increment()?;
4644            let envelope_size = 8;
4645            let bytes_len = len * envelope_size;
4646            let offset = decoder.out_of_line_offset(bytes_len)?;
4647            // Decode the envelope for each type.
4648            let mut _next_ordinal_to_read = 0;
4649            let mut next_offset = offset;
4650            let end_offset = offset + bytes_len;
4651            _next_ordinal_to_read += 1;
4652            if next_offset >= end_offset {
4653                return Ok(());
4654            }
4655
4656            // Decode unknown envelopes for gaps in ordinals.
4657            while _next_ordinal_to_read < 1 {
4658                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4659                _next_ordinal_to_read += 1;
4660                next_offset += envelope_size;
4661            }
4662
4663            let next_out_of_line = decoder.next_out_of_line();
4664            let handles_before = decoder.remaining_handles();
4665            if let Some((inlined, num_bytes, num_handles)) =
4666                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4667            {
4668                let member_inline_size = <fidl::encoding::BoundedString<1000> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4669                if inlined != (member_inline_size <= 4) {
4670                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4671                }
4672                let inner_offset;
4673                let mut inner_depth = depth.clone();
4674                if inlined {
4675                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4676                    inner_offset = next_offset;
4677                } else {
4678                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4679                    inner_depth.increment()?;
4680                }
4681                let val_ref = self.domain.get_or_insert_with(|| {
4682                    fidl::new_empty!(fidl::encoding::BoundedString<1000>, D)
4683                });
4684                fidl::decode!(
4685                    fidl::encoding::BoundedString<1000>,
4686                    D,
4687                    val_ref,
4688                    decoder,
4689                    inner_offset,
4690                    inner_depth
4691                )?;
4692                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4693                {
4694                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4695                }
4696                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4697                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4698                }
4699            }
4700
4701            next_offset += envelope_size;
4702            _next_ordinal_to_read += 1;
4703            if next_offset >= end_offset {
4704                return Ok(());
4705            }
4706
4707            // Decode unknown envelopes for gaps in ordinals.
4708            while _next_ordinal_to_read < 2 {
4709                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4710                _next_ordinal_to_read += 1;
4711                next_offset += envelope_size;
4712            }
4713
4714            let next_out_of_line = decoder.next_out_of_line();
4715            let handles_before = decoder.remaining_handles();
4716            if let Some((inlined, num_bytes, num_handles)) =
4717                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4718            {
4719                let member_inline_size =
4720                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4721                if inlined != (member_inline_size <= 4) {
4722                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4723                }
4724                let inner_offset;
4725                let mut inner_depth = depth.clone();
4726                if inlined {
4727                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4728                    inner_offset = next_offset;
4729                } else {
4730                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4731                    inner_depth.increment()?;
4732                }
4733                let val_ref = self.is_local.get_or_insert_with(|| fidl::new_empty!(bool, D));
4734                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
4735                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4736                {
4737                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4738                }
4739                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4740                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4741                }
4742            }
4743
4744            next_offset += envelope_size;
4745            _next_ordinal_to_read += 1;
4746            if next_offset >= end_offset {
4747                return Ok(());
4748            }
4749
4750            // Decode unknown envelopes for gaps in ordinals.
4751            while _next_ordinal_to_read < 3 {
4752                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4753                _next_ordinal_to_read += 1;
4754                next_offset += envelope_size;
4755            }
4756
4757            let next_out_of_line = decoder.next_out_of_line();
4758            let handles_before = decoder.remaining_handles();
4759            if let Some((inlined, num_bytes, num_handles)) =
4760                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4761            {
4762                let member_inline_size =
4763                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4764                if inlined != (member_inline_size <= 4) {
4765                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4766                }
4767                let inner_offset;
4768                let mut inner_depth = depth.clone();
4769                if inlined {
4770                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4771                    inner_offset = next_offset;
4772                } else {
4773                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4774                    inner_depth.increment()?;
4775                }
4776                let val_ref =
4777                    self.is_locally_active.get_or_insert_with(|| fidl::new_empty!(bool, D));
4778                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
4779                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4780                {
4781                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4782                }
4783                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4784                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4785                }
4786            }
4787
4788            next_offset += envelope_size;
4789            _next_ordinal_to_read += 1;
4790            if next_offset >= end_offset {
4791                return Ok(());
4792            }
4793
4794            // Decode unknown envelopes for gaps in ordinals.
4795            while _next_ordinal_to_read < 4 {
4796                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4797                _next_ordinal_to_read += 1;
4798                next_offset += envelope_size;
4799            }
4800
4801            let next_out_of_line = decoder.next_out_of_line();
4802            let handles_before = decoder.remaining_handles();
4803            if let Some((inlined, num_bytes, num_handles)) =
4804                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4805            {
4806                let member_inline_size =
4807                    <PlayerStatus as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4808                if inlined != (member_inline_size <= 4) {
4809                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4810                }
4811                let inner_offset;
4812                let mut inner_depth = depth.clone();
4813                if inlined {
4814                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4815                    inner_offset = next_offset;
4816                } else {
4817                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4818                    inner_depth.increment()?;
4819                }
4820                let val_ref =
4821                    self.player_status.get_or_insert_with(|| fidl::new_empty!(PlayerStatus, D));
4822                fidl::decode!(PlayerStatus, D, val_ref, decoder, inner_offset, inner_depth)?;
4823                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4824                {
4825                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4826                }
4827                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4828                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4829                }
4830            }
4831
4832            next_offset += envelope_size;
4833            _next_ordinal_to_read += 1;
4834            if next_offset >= end_offset {
4835                return Ok(());
4836            }
4837
4838            // Decode unknown envelopes for gaps in ordinals.
4839            while _next_ordinal_to_read < 5 {
4840                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4841                _next_ordinal_to_read += 1;
4842                next_offset += envelope_size;
4843            }
4844
4845            let next_out_of_line = decoder.next_out_of_line();
4846            let handles_before = decoder.remaining_handles();
4847            if let Some((inlined, num_bytes, num_handles)) =
4848                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4849            {
4850                let member_inline_size = <fidl_fuchsia_media__common::Metadata as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4851                if inlined != (member_inline_size <= 4) {
4852                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4853                }
4854                let inner_offset;
4855                let mut inner_depth = depth.clone();
4856                if inlined {
4857                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4858                    inner_offset = next_offset;
4859                } else {
4860                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4861                    inner_depth.increment()?;
4862                }
4863                let val_ref = self.metadata.get_or_insert_with(|| {
4864                    fidl::new_empty!(fidl_fuchsia_media__common::Metadata, D)
4865                });
4866                fidl::decode!(
4867                    fidl_fuchsia_media__common::Metadata,
4868                    D,
4869                    val_ref,
4870                    decoder,
4871                    inner_offset,
4872                    inner_depth
4873                )?;
4874                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4875                {
4876                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4877                }
4878                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4879                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4880                }
4881            }
4882
4883            next_offset += envelope_size;
4884            _next_ordinal_to_read += 1;
4885            if next_offset >= end_offset {
4886                return Ok(());
4887            }
4888
4889            // Decode unknown envelopes for gaps in ordinals.
4890            while _next_ordinal_to_read < 6 {
4891                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4892                _next_ordinal_to_read += 1;
4893                next_offset += envelope_size;
4894            }
4895
4896            let next_out_of_line = decoder.next_out_of_line();
4897            let handles_before = decoder.remaining_handles();
4898            if let Some((inlined, num_bytes, num_handles)) =
4899                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4900            {
4901                let member_inline_size = <fidl::encoding::UnboundedVector<MediaImage> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4902                if inlined != (member_inline_size <= 4) {
4903                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4904                }
4905                let inner_offset;
4906                let mut inner_depth = depth.clone();
4907                if inlined {
4908                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4909                    inner_offset = next_offset;
4910                } else {
4911                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4912                    inner_depth.increment()?;
4913                }
4914                let val_ref = self.media_images.get_or_insert_with(|| {
4915                    fidl::new_empty!(fidl::encoding::UnboundedVector<MediaImage>, D)
4916                });
4917                fidl::decode!(
4918                    fidl::encoding::UnboundedVector<MediaImage>,
4919                    D,
4920                    val_ref,
4921                    decoder,
4922                    inner_offset,
4923                    inner_depth
4924                )?;
4925                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4926                {
4927                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4928                }
4929                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4930                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4931                }
4932            }
4933
4934            next_offset += envelope_size;
4935            _next_ordinal_to_read += 1;
4936            if next_offset >= end_offset {
4937                return Ok(());
4938            }
4939
4940            // Decode unknown envelopes for gaps in ordinals.
4941            while _next_ordinal_to_read < 7 {
4942                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4943                _next_ordinal_to_read += 1;
4944                next_offset += envelope_size;
4945            }
4946
4947            let next_out_of_line = decoder.next_out_of_line();
4948            let handles_before = decoder.remaining_handles();
4949            if let Some((inlined, num_bytes, num_handles)) =
4950                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4951            {
4952                let member_inline_size =
4953                    <PlayerCapabilities as fidl::encoding::TypeMarker>::inline_size(
4954                        decoder.context,
4955                    );
4956                if inlined != (member_inline_size <= 4) {
4957                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4958                }
4959                let inner_offset;
4960                let mut inner_depth = depth.clone();
4961                if inlined {
4962                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4963                    inner_offset = next_offset;
4964                } else {
4965                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4966                    inner_depth.increment()?;
4967                }
4968                let val_ref = self
4969                    .player_capabilities
4970                    .get_or_insert_with(|| fidl::new_empty!(PlayerCapabilities, D));
4971                fidl::decode!(PlayerCapabilities, D, val_ref, decoder, inner_offset, inner_depth)?;
4972                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4973                {
4974                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4975                }
4976                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4977                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4978                }
4979            }
4980
4981            next_offset += envelope_size;
4982
4983            // Decode the remaining unknown envelopes.
4984            while next_offset < end_offset {
4985                _next_ordinal_to_read += 1;
4986                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4987                next_offset += envelope_size;
4988            }
4989
4990            Ok(())
4991        }
4992    }
4993
4994    impl WatchOptions {
4995        #[inline(always)]
4996        fn max_ordinal_present(&self) -> u64 {
4997            if let Some(_) = self.allowed_sessions {
4998                return 2;
4999            }
5000            if let Some(_) = self.only_active {
5001                return 1;
5002            }
5003            0
5004        }
5005    }
5006
5007    impl fidl::encoding::ValueTypeMarker for WatchOptions {
5008        type Borrowed<'a> = &'a Self;
5009        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5010            value
5011        }
5012    }
5013
5014    unsafe impl fidl::encoding::TypeMarker for WatchOptions {
5015        type Owned = Self;
5016
5017        #[inline(always)]
5018        fn inline_align(_context: fidl::encoding::Context) -> usize {
5019            8
5020        }
5021
5022        #[inline(always)]
5023        fn inline_size(_context: fidl::encoding::Context) -> usize {
5024            16
5025        }
5026    }
5027
5028    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WatchOptions, D>
5029        for &WatchOptions
5030    {
5031        unsafe fn encode(
5032            self,
5033            encoder: &mut fidl::encoding::Encoder<'_, D>,
5034            offset: usize,
5035            mut depth: fidl::encoding::Depth,
5036        ) -> fidl::Result<()> {
5037            encoder.debug_check_bounds::<WatchOptions>(offset);
5038            // Vector header
5039            let max_ordinal: u64 = self.max_ordinal_present();
5040            encoder.write_num(max_ordinal, offset);
5041            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5042            // Calling encoder.out_of_line_offset(0) is not allowed.
5043            if max_ordinal == 0 {
5044                return Ok(());
5045            }
5046            depth.increment()?;
5047            let envelope_size = 8;
5048            let bytes_len = max_ordinal as usize * envelope_size;
5049            #[allow(unused_variables)]
5050            let offset = encoder.out_of_line_offset(bytes_len);
5051            let mut _prev_end_offset: usize = 0;
5052            if 1 > max_ordinal {
5053                return Ok(());
5054            }
5055
5056            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5057            // are envelope_size bytes.
5058            let cur_offset: usize = (1 - 1) * envelope_size;
5059
5060            // Zero reserved fields.
5061            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5062
5063            // Safety:
5064            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5065            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5066            //   envelope_size bytes, there is always sufficient room.
5067            fidl::encoding::encode_in_envelope_optional::<bool, D>(
5068                self.only_active.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
5069                encoder,
5070                offset + cur_offset,
5071                depth,
5072            )?;
5073
5074            _prev_end_offset = cur_offset + envelope_size;
5075            if 2 > max_ordinal {
5076                return Ok(());
5077            }
5078
5079            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5080            // are envelope_size bytes.
5081            let cur_offset: usize = (2 - 1) * envelope_size;
5082
5083            // Zero reserved fields.
5084            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5085
5086            // Safety:
5087            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5088            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5089            //   envelope_size bytes, there is always sufficient room.
5090            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u64, 1000>, D>(
5091                self.allowed_sessions.as_ref().map(
5092                    <fidl::encoding::Vector<u64, 1000> as fidl::encoding::ValueTypeMarker>::borrow,
5093                ),
5094                encoder,
5095                offset + cur_offset,
5096                depth,
5097            )?;
5098
5099            _prev_end_offset = cur_offset + envelope_size;
5100
5101            Ok(())
5102        }
5103    }
5104
5105    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WatchOptions {
5106        #[inline(always)]
5107        fn new_empty() -> Self {
5108            Self::default()
5109        }
5110
5111        unsafe fn decode(
5112            &mut self,
5113            decoder: &mut fidl::encoding::Decoder<'_, D>,
5114            offset: usize,
5115            mut depth: fidl::encoding::Depth,
5116        ) -> fidl::Result<()> {
5117            decoder.debug_check_bounds::<Self>(offset);
5118            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5119                None => return Err(fidl::Error::NotNullable),
5120                Some(len) => len,
5121            };
5122            // Calling decoder.out_of_line_offset(0) is not allowed.
5123            if len == 0 {
5124                return Ok(());
5125            };
5126            depth.increment()?;
5127            let envelope_size = 8;
5128            let bytes_len = len * envelope_size;
5129            let offset = decoder.out_of_line_offset(bytes_len)?;
5130            // Decode the envelope for each type.
5131            let mut _next_ordinal_to_read = 0;
5132            let mut next_offset = offset;
5133            let end_offset = offset + bytes_len;
5134            _next_ordinal_to_read += 1;
5135            if next_offset >= end_offset {
5136                return Ok(());
5137            }
5138
5139            // Decode unknown envelopes for gaps in ordinals.
5140            while _next_ordinal_to_read < 1 {
5141                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5142                _next_ordinal_to_read += 1;
5143                next_offset += envelope_size;
5144            }
5145
5146            let next_out_of_line = decoder.next_out_of_line();
5147            let handles_before = decoder.remaining_handles();
5148            if let Some((inlined, num_bytes, num_handles)) =
5149                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5150            {
5151                let member_inline_size =
5152                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5153                if inlined != (member_inline_size <= 4) {
5154                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5155                }
5156                let inner_offset;
5157                let mut inner_depth = depth.clone();
5158                if inlined {
5159                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5160                    inner_offset = next_offset;
5161                } else {
5162                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5163                    inner_depth.increment()?;
5164                }
5165                let val_ref = self.only_active.get_or_insert_with(|| fidl::new_empty!(bool, D));
5166                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
5167                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5168                {
5169                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5170                }
5171                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5172                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5173                }
5174            }
5175
5176            next_offset += envelope_size;
5177            _next_ordinal_to_read += 1;
5178            if next_offset >= end_offset {
5179                return Ok(());
5180            }
5181
5182            // Decode unknown envelopes for gaps in ordinals.
5183            while _next_ordinal_to_read < 2 {
5184                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5185                _next_ordinal_to_read += 1;
5186                next_offset += envelope_size;
5187            }
5188
5189            let next_out_of_line = decoder.next_out_of_line();
5190            let handles_before = decoder.remaining_handles();
5191            if let Some((inlined, num_bytes, num_handles)) =
5192                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5193            {
5194                let member_inline_size =
5195                    <fidl::encoding::Vector<u64, 1000> as fidl::encoding::TypeMarker>::inline_size(
5196                        decoder.context,
5197                    );
5198                if inlined != (member_inline_size <= 4) {
5199                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5200                }
5201                let inner_offset;
5202                let mut inner_depth = depth.clone();
5203                if inlined {
5204                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5205                    inner_offset = next_offset;
5206                } else {
5207                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5208                    inner_depth.increment()?;
5209                }
5210                let val_ref = self
5211                    .allowed_sessions
5212                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u64, 1000>, D));
5213                fidl::decode!(fidl::encoding::Vector<u64, 1000>, D, val_ref, decoder, inner_offset, inner_depth)?;
5214                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5215                {
5216                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5217                }
5218                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5219                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5220                }
5221            }
5222
5223            next_offset += envelope_size;
5224
5225            // Decode the remaining unknown envelopes.
5226            while next_offset < end_offset {
5227                _next_ordinal_to_read += 1;
5228                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5229                next_offset += envelope_size;
5230            }
5231
5232            Ok(())
5233        }
5234    }
5235}