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