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