1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_mediacodec_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct CodecFactoryAttachLifetimeTrackingRequest {
16 pub codec_end: fidl::EventPair,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20 for CodecFactoryAttachLifetimeTrackingRequest
21{
22}
23
24#[derive(Debug, PartialEq)]
25pub struct CodecFactoryCreateDecoderRequest {
26 pub decoder_params: CreateDecoderParams,
27 pub decoder: fidl::endpoints::ServerEnd<fidl_fuchsia_media::StreamProcessorMarker>,
28}
29
30impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
31 for CodecFactoryCreateDecoderRequest
32{
33}
34
35#[derive(Debug, PartialEq)]
36pub struct CodecFactoryCreateEncoderRequest {
37 pub encoder_params: CreateEncoderParams,
38 pub encoder: fidl::endpoints::ServerEnd<fidl_fuchsia_media::StreamProcessorMarker>,
39}
40
41impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
42 for CodecFactoryCreateEncoderRequest
43{
44}
45
46#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
47pub struct CodecFactoryMarker;
48
49impl fidl::endpoints::ProtocolMarker for CodecFactoryMarker {
50 type Proxy = CodecFactoryProxy;
51 type RequestStream = CodecFactoryRequestStream;
52 #[cfg(target_os = "fuchsia")]
53 type SynchronousProxy = CodecFactorySynchronousProxy;
54
55 const DEBUG_NAME: &'static str = "fuchsia.mediacodec.CodecFactory";
56}
57impl fidl::endpoints::DiscoverableProtocolMarker for CodecFactoryMarker {}
58
59pub trait CodecFactoryProxyInterface: Send + Sync {
60 type GetDetailedCodecDescriptionsResponseFut: std::future::Future<
61 Output = Result<CodecFactoryGetDetailedCodecDescriptionsResponse, fidl::Error>,
62 > + Send;
63 fn r#get_detailed_codec_descriptions(&self) -> Self::GetDetailedCodecDescriptionsResponseFut;
64 fn r#create_decoder(
65 &self,
66 decoder_params: &CreateDecoderParams,
67 decoder: fidl::endpoints::ServerEnd<fidl_fuchsia_media::StreamProcessorMarker>,
68 ) -> Result<(), fidl::Error>;
69 fn r#create_encoder(
70 &self,
71 encoder_params: &CreateEncoderParams,
72 encoder: fidl::endpoints::ServerEnd<fidl_fuchsia_media::StreamProcessorMarker>,
73 ) -> Result<(), fidl::Error>;
74 fn r#attach_lifetime_tracking(&self, codec_end: fidl::EventPair) -> Result<(), fidl::Error>;
75}
76#[derive(Debug)]
77#[cfg(target_os = "fuchsia")]
78pub struct CodecFactorySynchronousProxy {
79 client: fidl::client::sync::Client,
80}
81
82#[cfg(target_os = "fuchsia")]
83impl fidl::endpoints::SynchronousProxy for CodecFactorySynchronousProxy {
84 type Proxy = CodecFactoryProxy;
85 type Protocol = CodecFactoryMarker;
86
87 fn from_channel(inner: fidl::Channel) -> Self {
88 Self::new(inner)
89 }
90
91 fn into_channel(self) -> fidl::Channel {
92 self.client.into_channel()
93 }
94
95 fn as_channel(&self) -> &fidl::Channel {
96 self.client.as_channel()
97 }
98}
99
100#[cfg(target_os = "fuchsia")]
101impl CodecFactorySynchronousProxy {
102 pub fn new(channel: fidl::Channel) -> Self {
103 let protocol_name = <CodecFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
104 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
105 }
106
107 pub fn into_channel(self) -> fidl::Channel {
108 self.client.into_channel()
109 }
110
111 pub fn wait_for_event(
114 &self,
115 deadline: zx::MonotonicInstant,
116 ) -> Result<CodecFactoryEvent, fidl::Error> {
117 CodecFactoryEvent::decode(self.client.wait_for_event(deadline)?)
118 }
119
120 pub fn r#get_detailed_codec_descriptions(
123 &self,
124 ___deadline: zx::MonotonicInstant,
125 ) -> Result<CodecFactoryGetDetailedCodecDescriptionsResponse, fidl::Error> {
126 let _response = self.client.send_query::<
127 fidl::encoding::EmptyPayload,
128 CodecFactoryGetDetailedCodecDescriptionsResponse,
129 >(
130 (),
131 0x7a3a1c956352d49a,
132 fidl::encoding::DynamicFlags::empty(),
133 ___deadline,
134 )?;
135 Ok(_response)
136 }
137
138 pub fn r#create_decoder(
159 &self,
160 mut decoder_params: &CreateDecoderParams,
161 mut decoder: fidl::endpoints::ServerEnd<fidl_fuchsia_media::StreamProcessorMarker>,
162 ) -> Result<(), fidl::Error> {
163 self.client.send::<CodecFactoryCreateDecoderRequest>(
164 (decoder_params, decoder),
165 0x72a3c2035a1e94f0,
166 fidl::encoding::DynamicFlags::empty(),
167 )
168 }
169
170 pub fn r#create_encoder(
182 &self,
183 mut encoder_params: &CreateEncoderParams,
184 mut encoder: fidl::endpoints::ServerEnd<fidl_fuchsia_media::StreamProcessorMarker>,
185 ) -> Result<(), fidl::Error> {
186 self.client.send::<CodecFactoryCreateEncoderRequest>(
187 (encoder_params, encoder),
188 0x20c3a235602eed0f,
189 fidl::encoding::DynamicFlags::empty(),
190 )
191 }
192
193 pub fn r#attach_lifetime_tracking(
242 &self,
243 mut codec_end: fidl::EventPair,
244 ) -> Result<(), fidl::Error> {
245 self.client.send::<CodecFactoryAttachLifetimeTrackingRequest>(
246 (codec_end,),
247 0x1086674ad2568498,
248 fidl::encoding::DynamicFlags::empty(),
249 )
250 }
251}
252
253#[cfg(target_os = "fuchsia")]
254impl From<CodecFactorySynchronousProxy> for zx::Handle {
255 fn from(value: CodecFactorySynchronousProxy) -> Self {
256 value.into_channel().into()
257 }
258}
259
260#[cfg(target_os = "fuchsia")]
261impl From<fidl::Channel> for CodecFactorySynchronousProxy {
262 fn from(value: fidl::Channel) -> Self {
263 Self::new(value)
264 }
265}
266
267#[derive(Debug, Clone)]
268pub struct CodecFactoryProxy {
269 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
270}
271
272impl fidl::endpoints::Proxy for CodecFactoryProxy {
273 type Protocol = CodecFactoryMarker;
274
275 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
276 Self::new(inner)
277 }
278
279 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
280 self.client.into_channel().map_err(|client| Self { client })
281 }
282
283 fn as_channel(&self) -> &::fidl::AsyncChannel {
284 self.client.as_channel()
285 }
286}
287
288impl CodecFactoryProxy {
289 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
291 let protocol_name = <CodecFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
292 Self { client: fidl::client::Client::new(channel, protocol_name) }
293 }
294
295 pub fn take_event_stream(&self) -> CodecFactoryEventStream {
301 CodecFactoryEventStream { event_receiver: self.client.take_event_receiver() }
302 }
303
304 pub fn r#get_detailed_codec_descriptions(
307 &self,
308 ) -> fidl::client::QueryResponseFut<
309 CodecFactoryGetDetailedCodecDescriptionsResponse,
310 fidl::encoding::DefaultFuchsiaResourceDialect,
311 > {
312 CodecFactoryProxyInterface::r#get_detailed_codec_descriptions(self)
313 }
314
315 pub fn r#create_decoder(
336 &self,
337 mut decoder_params: &CreateDecoderParams,
338 mut decoder: fidl::endpoints::ServerEnd<fidl_fuchsia_media::StreamProcessorMarker>,
339 ) -> Result<(), fidl::Error> {
340 CodecFactoryProxyInterface::r#create_decoder(self, decoder_params, decoder)
341 }
342
343 pub fn r#create_encoder(
355 &self,
356 mut encoder_params: &CreateEncoderParams,
357 mut encoder: fidl::endpoints::ServerEnd<fidl_fuchsia_media::StreamProcessorMarker>,
358 ) -> Result<(), fidl::Error> {
359 CodecFactoryProxyInterface::r#create_encoder(self, encoder_params, encoder)
360 }
361
362 pub fn r#attach_lifetime_tracking(
411 &self,
412 mut codec_end: fidl::EventPair,
413 ) -> Result<(), fidl::Error> {
414 CodecFactoryProxyInterface::r#attach_lifetime_tracking(self, codec_end)
415 }
416}
417
418impl CodecFactoryProxyInterface for CodecFactoryProxy {
419 type GetDetailedCodecDescriptionsResponseFut = fidl::client::QueryResponseFut<
420 CodecFactoryGetDetailedCodecDescriptionsResponse,
421 fidl::encoding::DefaultFuchsiaResourceDialect,
422 >;
423 fn r#get_detailed_codec_descriptions(&self) -> Self::GetDetailedCodecDescriptionsResponseFut {
424 fn _decode(
425 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
426 ) -> Result<CodecFactoryGetDetailedCodecDescriptionsResponse, fidl::Error> {
427 let _response = fidl::client::decode_transaction_body::<
428 CodecFactoryGetDetailedCodecDescriptionsResponse,
429 fidl::encoding::DefaultFuchsiaResourceDialect,
430 0x7a3a1c956352d49a,
431 >(_buf?)?;
432 Ok(_response)
433 }
434 self.client.send_query_and_decode::<
435 fidl::encoding::EmptyPayload,
436 CodecFactoryGetDetailedCodecDescriptionsResponse,
437 >(
438 (),
439 0x7a3a1c956352d49a,
440 fidl::encoding::DynamicFlags::empty(),
441 _decode,
442 )
443 }
444
445 fn r#create_decoder(
446 &self,
447 mut decoder_params: &CreateDecoderParams,
448 mut decoder: fidl::endpoints::ServerEnd<fidl_fuchsia_media::StreamProcessorMarker>,
449 ) -> Result<(), fidl::Error> {
450 self.client.send::<CodecFactoryCreateDecoderRequest>(
451 (decoder_params, decoder),
452 0x72a3c2035a1e94f0,
453 fidl::encoding::DynamicFlags::empty(),
454 )
455 }
456
457 fn r#create_encoder(
458 &self,
459 mut encoder_params: &CreateEncoderParams,
460 mut encoder: fidl::endpoints::ServerEnd<fidl_fuchsia_media::StreamProcessorMarker>,
461 ) -> Result<(), fidl::Error> {
462 self.client.send::<CodecFactoryCreateEncoderRequest>(
463 (encoder_params, encoder),
464 0x20c3a235602eed0f,
465 fidl::encoding::DynamicFlags::empty(),
466 )
467 }
468
469 fn r#attach_lifetime_tracking(
470 &self,
471 mut codec_end: fidl::EventPair,
472 ) -> Result<(), fidl::Error> {
473 self.client.send::<CodecFactoryAttachLifetimeTrackingRequest>(
474 (codec_end,),
475 0x1086674ad2568498,
476 fidl::encoding::DynamicFlags::empty(),
477 )
478 }
479}
480
481pub struct CodecFactoryEventStream {
482 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
483}
484
485impl std::marker::Unpin for CodecFactoryEventStream {}
486
487impl futures::stream::FusedStream for CodecFactoryEventStream {
488 fn is_terminated(&self) -> bool {
489 self.event_receiver.is_terminated()
490 }
491}
492
493impl futures::Stream for CodecFactoryEventStream {
494 type Item = Result<CodecFactoryEvent, fidl::Error>;
495
496 fn poll_next(
497 mut self: std::pin::Pin<&mut Self>,
498 cx: &mut std::task::Context<'_>,
499 ) -> std::task::Poll<Option<Self::Item>> {
500 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
501 &mut self.event_receiver,
502 cx
503 )?) {
504 Some(buf) => std::task::Poll::Ready(Some(CodecFactoryEvent::decode(buf))),
505 None => std::task::Poll::Ready(None),
506 }
507 }
508}
509
510#[derive(Debug)]
511pub enum CodecFactoryEvent {
512 OnCodecList { codecs: Vec<CodecDescription> },
513}
514
515impl CodecFactoryEvent {
516 #[allow(irrefutable_let_patterns)]
517 pub fn into_on_codec_list(self) -> Option<Vec<CodecDescription>> {
518 if let CodecFactoryEvent::OnCodecList { codecs } = self {
519 Some((codecs))
520 } else {
521 None
522 }
523 }
524
525 fn decode(
527 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
528 ) -> Result<CodecFactoryEvent, fidl::Error> {
529 let (bytes, _handles) = buf.split_mut();
530 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
531 debug_assert_eq!(tx_header.tx_id, 0);
532 match tx_header.ordinal {
533 0x2f93e3d51ff1ace0 => {
534 let mut out = fidl::new_empty!(
535 CodecFactoryOnCodecListRequest,
536 fidl::encoding::DefaultFuchsiaResourceDialect
537 );
538 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CodecFactoryOnCodecListRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
539 Ok((CodecFactoryEvent::OnCodecList { codecs: out.codecs }))
540 }
541 _ => Err(fidl::Error::UnknownOrdinal {
542 ordinal: tx_header.ordinal,
543 protocol_name: <CodecFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
544 }),
545 }
546 }
547}
548
549pub struct CodecFactoryRequestStream {
551 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
552 is_terminated: bool,
553}
554
555impl std::marker::Unpin for CodecFactoryRequestStream {}
556
557impl futures::stream::FusedStream for CodecFactoryRequestStream {
558 fn is_terminated(&self) -> bool {
559 self.is_terminated
560 }
561}
562
563impl fidl::endpoints::RequestStream for CodecFactoryRequestStream {
564 type Protocol = CodecFactoryMarker;
565 type ControlHandle = CodecFactoryControlHandle;
566
567 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
568 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
569 }
570
571 fn control_handle(&self) -> Self::ControlHandle {
572 CodecFactoryControlHandle { inner: self.inner.clone() }
573 }
574
575 fn into_inner(
576 self,
577 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
578 {
579 (self.inner, self.is_terminated)
580 }
581
582 fn from_inner(
583 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
584 is_terminated: bool,
585 ) -> Self {
586 Self { inner, is_terminated }
587 }
588}
589
590impl futures::Stream for CodecFactoryRequestStream {
591 type Item = Result<CodecFactoryRequest, fidl::Error>;
592
593 fn poll_next(
594 mut self: std::pin::Pin<&mut Self>,
595 cx: &mut std::task::Context<'_>,
596 ) -> std::task::Poll<Option<Self::Item>> {
597 let this = &mut *self;
598 if this.inner.check_shutdown(cx) {
599 this.is_terminated = true;
600 return std::task::Poll::Ready(None);
601 }
602 if this.is_terminated {
603 panic!("polled CodecFactoryRequestStream after completion");
604 }
605 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
606 |bytes, handles| {
607 match this.inner.channel().read_etc(cx, bytes, handles) {
608 std::task::Poll::Ready(Ok(())) => {}
609 std::task::Poll::Pending => return std::task::Poll::Pending,
610 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
611 this.is_terminated = true;
612 return std::task::Poll::Ready(None);
613 }
614 std::task::Poll::Ready(Err(e)) => {
615 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
616 e.into(),
617 ))))
618 }
619 }
620
621 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
623
624 std::task::Poll::Ready(Some(match header.ordinal {
625 0x7a3a1c956352d49a => {
626 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
627 let mut req = fidl::new_empty!(
628 fidl::encoding::EmptyPayload,
629 fidl::encoding::DefaultFuchsiaResourceDialect
630 );
631 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
632 let control_handle =
633 CodecFactoryControlHandle { inner: this.inner.clone() };
634 Ok(CodecFactoryRequest::GetDetailedCodecDescriptions {
635 responder: CodecFactoryGetDetailedCodecDescriptionsResponder {
636 control_handle: std::mem::ManuallyDrop::new(control_handle),
637 tx_id: header.tx_id,
638 },
639 })
640 }
641 0x72a3c2035a1e94f0 => {
642 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
643 let mut req = fidl::new_empty!(
644 CodecFactoryCreateDecoderRequest,
645 fidl::encoding::DefaultFuchsiaResourceDialect
646 );
647 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CodecFactoryCreateDecoderRequest>(&header, _body_bytes, handles, &mut req)?;
648 let control_handle =
649 CodecFactoryControlHandle { inner: this.inner.clone() };
650 Ok(CodecFactoryRequest::CreateDecoder {
651 decoder_params: req.decoder_params,
652 decoder: req.decoder,
653
654 control_handle,
655 })
656 }
657 0x20c3a235602eed0f => {
658 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
659 let mut req = fidl::new_empty!(
660 CodecFactoryCreateEncoderRequest,
661 fidl::encoding::DefaultFuchsiaResourceDialect
662 );
663 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CodecFactoryCreateEncoderRequest>(&header, _body_bytes, handles, &mut req)?;
664 let control_handle =
665 CodecFactoryControlHandle { inner: this.inner.clone() };
666 Ok(CodecFactoryRequest::CreateEncoder {
667 encoder_params: req.encoder_params,
668 encoder: req.encoder,
669
670 control_handle,
671 })
672 }
673 0x1086674ad2568498 => {
674 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
675 let mut req = fidl::new_empty!(
676 CodecFactoryAttachLifetimeTrackingRequest,
677 fidl::encoding::DefaultFuchsiaResourceDialect
678 );
679 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CodecFactoryAttachLifetimeTrackingRequest>(&header, _body_bytes, handles, &mut req)?;
680 let control_handle =
681 CodecFactoryControlHandle { inner: this.inner.clone() };
682 Ok(CodecFactoryRequest::AttachLifetimeTracking {
683 codec_end: req.codec_end,
684
685 control_handle,
686 })
687 }
688 _ => Err(fidl::Error::UnknownOrdinal {
689 ordinal: header.ordinal,
690 protocol_name:
691 <CodecFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
692 }),
693 }))
694 },
695 )
696 }
697}
698
699#[derive(Debug)]
705pub enum CodecFactoryRequest {
706 GetDetailedCodecDescriptions { responder: CodecFactoryGetDetailedCodecDescriptionsResponder },
709 CreateDecoder {
730 decoder_params: CreateDecoderParams,
731 decoder: fidl::endpoints::ServerEnd<fidl_fuchsia_media::StreamProcessorMarker>,
732 control_handle: CodecFactoryControlHandle,
733 },
734 CreateEncoder {
746 encoder_params: CreateEncoderParams,
747 encoder: fidl::endpoints::ServerEnd<fidl_fuchsia_media::StreamProcessorMarker>,
748 control_handle: CodecFactoryControlHandle,
749 },
750 AttachLifetimeTracking { codec_end: fidl::EventPair, control_handle: CodecFactoryControlHandle },
799}
800
801impl CodecFactoryRequest {
802 #[allow(irrefutable_let_patterns)]
803 pub fn into_get_detailed_codec_descriptions(
804 self,
805 ) -> Option<(CodecFactoryGetDetailedCodecDescriptionsResponder)> {
806 if let CodecFactoryRequest::GetDetailedCodecDescriptions { responder } = self {
807 Some((responder))
808 } else {
809 None
810 }
811 }
812
813 #[allow(irrefutable_let_patterns)]
814 pub fn into_create_decoder(
815 self,
816 ) -> Option<(
817 CreateDecoderParams,
818 fidl::endpoints::ServerEnd<fidl_fuchsia_media::StreamProcessorMarker>,
819 CodecFactoryControlHandle,
820 )> {
821 if let CodecFactoryRequest::CreateDecoder { decoder_params, decoder, control_handle } = self
822 {
823 Some((decoder_params, decoder, control_handle))
824 } else {
825 None
826 }
827 }
828
829 #[allow(irrefutable_let_patterns)]
830 pub fn into_create_encoder(
831 self,
832 ) -> Option<(
833 CreateEncoderParams,
834 fidl::endpoints::ServerEnd<fidl_fuchsia_media::StreamProcessorMarker>,
835 CodecFactoryControlHandle,
836 )> {
837 if let CodecFactoryRequest::CreateEncoder { encoder_params, encoder, control_handle } = self
838 {
839 Some((encoder_params, encoder, control_handle))
840 } else {
841 None
842 }
843 }
844
845 #[allow(irrefutable_let_patterns)]
846 pub fn into_attach_lifetime_tracking(
847 self,
848 ) -> Option<(fidl::EventPair, CodecFactoryControlHandle)> {
849 if let CodecFactoryRequest::AttachLifetimeTracking { codec_end, control_handle } = self {
850 Some((codec_end, control_handle))
851 } else {
852 None
853 }
854 }
855
856 pub fn method_name(&self) -> &'static str {
858 match *self {
859 CodecFactoryRequest::GetDetailedCodecDescriptions { .. } => {
860 "get_detailed_codec_descriptions"
861 }
862 CodecFactoryRequest::CreateDecoder { .. } => "create_decoder",
863 CodecFactoryRequest::CreateEncoder { .. } => "create_encoder",
864 CodecFactoryRequest::AttachLifetimeTracking { .. } => "attach_lifetime_tracking",
865 }
866 }
867}
868
869#[derive(Debug, Clone)]
870pub struct CodecFactoryControlHandle {
871 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
872}
873
874impl fidl::endpoints::ControlHandle for CodecFactoryControlHandle {
875 fn shutdown(&self) {
876 self.inner.shutdown()
877 }
878 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
879 self.inner.shutdown_with_epitaph(status)
880 }
881
882 fn is_closed(&self) -> bool {
883 self.inner.channel().is_closed()
884 }
885 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
886 self.inner.channel().on_closed()
887 }
888
889 #[cfg(target_os = "fuchsia")]
890 fn signal_peer(
891 &self,
892 clear_mask: zx::Signals,
893 set_mask: zx::Signals,
894 ) -> Result<(), zx_status::Status> {
895 use fidl::Peered;
896 self.inner.channel().signal_peer(clear_mask, set_mask)
897 }
898}
899
900impl CodecFactoryControlHandle {
901 pub fn send_on_codec_list(&self, mut codecs: &[CodecDescription]) -> Result<(), fidl::Error> {
902 self.inner.send::<CodecFactoryOnCodecListRequest>(
903 (codecs,),
904 0,
905 0x2f93e3d51ff1ace0,
906 fidl::encoding::DynamicFlags::empty(),
907 )
908 }
909}
910
911#[must_use = "FIDL methods require a response to be sent"]
912#[derive(Debug)]
913pub struct CodecFactoryGetDetailedCodecDescriptionsResponder {
914 control_handle: std::mem::ManuallyDrop<CodecFactoryControlHandle>,
915 tx_id: u32,
916}
917
918impl std::ops::Drop for CodecFactoryGetDetailedCodecDescriptionsResponder {
922 fn drop(&mut self) {
923 self.control_handle.shutdown();
924 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
926 }
927}
928
929impl fidl::endpoints::Responder for CodecFactoryGetDetailedCodecDescriptionsResponder {
930 type ControlHandle = CodecFactoryControlHandle;
931
932 fn control_handle(&self) -> &CodecFactoryControlHandle {
933 &self.control_handle
934 }
935
936 fn drop_without_shutdown(mut self) {
937 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
939 std::mem::forget(self);
941 }
942}
943
944impl CodecFactoryGetDetailedCodecDescriptionsResponder {
945 pub fn send(
949 self,
950 mut payload: &CodecFactoryGetDetailedCodecDescriptionsResponse,
951 ) -> Result<(), fidl::Error> {
952 let _result = self.send_raw(payload);
953 if _result.is_err() {
954 self.control_handle.shutdown();
955 }
956 self.drop_without_shutdown();
957 _result
958 }
959
960 pub fn send_no_shutdown_on_err(
962 self,
963 mut payload: &CodecFactoryGetDetailedCodecDescriptionsResponse,
964 ) -> Result<(), fidl::Error> {
965 let _result = self.send_raw(payload);
966 self.drop_without_shutdown();
967 _result
968 }
969
970 fn send_raw(
971 &self,
972 mut payload: &CodecFactoryGetDetailedCodecDescriptionsResponse,
973 ) -> Result<(), fidl::Error> {
974 self.control_handle.inner.send::<CodecFactoryGetDetailedCodecDescriptionsResponse>(
975 payload,
976 self.tx_id,
977 0x7a3a1c956352d49a,
978 fidl::encoding::DynamicFlags::empty(),
979 )
980 }
981}
982
983mod internal {
984 use super::*;
985
986 impl fidl::encoding::ResourceTypeMarker for CodecFactoryAttachLifetimeTrackingRequest {
987 type Borrowed<'a> = &'a mut Self;
988 fn take_or_borrow<'a>(
989 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
990 ) -> Self::Borrowed<'a> {
991 value
992 }
993 }
994
995 unsafe impl fidl::encoding::TypeMarker for CodecFactoryAttachLifetimeTrackingRequest {
996 type Owned = Self;
997
998 #[inline(always)]
999 fn inline_align(_context: fidl::encoding::Context) -> usize {
1000 4
1001 }
1002
1003 #[inline(always)]
1004 fn inline_size(_context: fidl::encoding::Context) -> usize {
1005 4
1006 }
1007 }
1008
1009 unsafe impl
1010 fidl::encoding::Encode<
1011 CodecFactoryAttachLifetimeTrackingRequest,
1012 fidl::encoding::DefaultFuchsiaResourceDialect,
1013 > for &mut CodecFactoryAttachLifetimeTrackingRequest
1014 {
1015 #[inline]
1016 unsafe fn encode(
1017 self,
1018 encoder: &mut fidl::encoding::Encoder<
1019 '_,
1020 fidl::encoding::DefaultFuchsiaResourceDialect,
1021 >,
1022 offset: usize,
1023 _depth: fidl::encoding::Depth,
1024 ) -> fidl::Result<()> {
1025 encoder.debug_check_bounds::<CodecFactoryAttachLifetimeTrackingRequest>(offset);
1026 fidl::encoding::Encode::<
1028 CodecFactoryAttachLifetimeTrackingRequest,
1029 fidl::encoding::DefaultFuchsiaResourceDialect,
1030 >::encode(
1031 (<fidl::encoding::HandleType<
1032 fidl::EventPair,
1033 { fidl::ObjectType::EVENTPAIR.into_raw() },
1034 2147483648,
1035 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1036 &mut self.codec_end
1037 ),),
1038 encoder,
1039 offset,
1040 _depth,
1041 )
1042 }
1043 }
1044 unsafe impl<
1045 T0: fidl::encoding::Encode<
1046 fidl::encoding::HandleType<
1047 fidl::EventPair,
1048 { fidl::ObjectType::EVENTPAIR.into_raw() },
1049 2147483648,
1050 >,
1051 fidl::encoding::DefaultFuchsiaResourceDialect,
1052 >,
1053 >
1054 fidl::encoding::Encode<
1055 CodecFactoryAttachLifetimeTrackingRequest,
1056 fidl::encoding::DefaultFuchsiaResourceDialect,
1057 > for (T0,)
1058 {
1059 #[inline]
1060 unsafe fn encode(
1061 self,
1062 encoder: &mut fidl::encoding::Encoder<
1063 '_,
1064 fidl::encoding::DefaultFuchsiaResourceDialect,
1065 >,
1066 offset: usize,
1067 depth: fidl::encoding::Depth,
1068 ) -> fidl::Result<()> {
1069 encoder.debug_check_bounds::<CodecFactoryAttachLifetimeTrackingRequest>(offset);
1070 self.0.encode(encoder, offset + 0, depth)?;
1074 Ok(())
1075 }
1076 }
1077
1078 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1079 for CodecFactoryAttachLifetimeTrackingRequest
1080 {
1081 #[inline(always)]
1082 fn new_empty() -> Self {
1083 Self {
1084 codec_end: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
1085 }
1086 }
1087
1088 #[inline]
1089 unsafe fn decode(
1090 &mut self,
1091 decoder: &mut fidl::encoding::Decoder<
1092 '_,
1093 fidl::encoding::DefaultFuchsiaResourceDialect,
1094 >,
1095 offset: usize,
1096 _depth: fidl::encoding::Depth,
1097 ) -> fidl::Result<()> {
1098 decoder.debug_check_bounds::<Self>(offset);
1099 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.codec_end, decoder, offset + 0, _depth)?;
1101 Ok(())
1102 }
1103 }
1104
1105 impl fidl::encoding::ResourceTypeMarker for CodecFactoryCreateDecoderRequest {
1106 type Borrowed<'a> = &'a mut Self;
1107 fn take_or_borrow<'a>(
1108 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1109 ) -> Self::Borrowed<'a> {
1110 value
1111 }
1112 }
1113
1114 unsafe impl fidl::encoding::TypeMarker for CodecFactoryCreateDecoderRequest {
1115 type Owned = Self;
1116
1117 #[inline(always)]
1118 fn inline_align(_context: fidl::encoding::Context) -> usize {
1119 8
1120 }
1121
1122 #[inline(always)]
1123 fn inline_size(_context: fidl::encoding::Context) -> usize {
1124 24
1125 }
1126 }
1127
1128 unsafe impl
1129 fidl::encoding::Encode<
1130 CodecFactoryCreateDecoderRequest,
1131 fidl::encoding::DefaultFuchsiaResourceDialect,
1132 > for &mut CodecFactoryCreateDecoderRequest
1133 {
1134 #[inline]
1135 unsafe fn encode(
1136 self,
1137 encoder: &mut fidl::encoding::Encoder<
1138 '_,
1139 fidl::encoding::DefaultFuchsiaResourceDialect,
1140 >,
1141 offset: usize,
1142 _depth: fidl::encoding::Depth,
1143 ) -> fidl::Result<()> {
1144 encoder.debug_check_bounds::<CodecFactoryCreateDecoderRequest>(offset);
1145 fidl::encoding::Encode::<
1147 CodecFactoryCreateDecoderRequest,
1148 fidl::encoding::DefaultFuchsiaResourceDialect,
1149 >::encode(
1150 (
1151 <CreateDecoderParams as fidl::encoding::ValueTypeMarker>::borrow(
1152 &self.decoder_params,
1153 ),
1154 <fidl::encoding::Endpoint<
1155 fidl::endpoints::ServerEnd<fidl_fuchsia_media::StreamProcessorMarker>,
1156 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1157 &mut self.decoder
1158 ),
1159 ),
1160 encoder,
1161 offset,
1162 _depth,
1163 )
1164 }
1165 }
1166 unsafe impl<
1167 T0: fidl::encoding::Encode<
1168 CreateDecoderParams,
1169 fidl::encoding::DefaultFuchsiaResourceDialect,
1170 >,
1171 T1: fidl::encoding::Encode<
1172 fidl::encoding::Endpoint<
1173 fidl::endpoints::ServerEnd<fidl_fuchsia_media::StreamProcessorMarker>,
1174 >,
1175 fidl::encoding::DefaultFuchsiaResourceDialect,
1176 >,
1177 >
1178 fidl::encoding::Encode<
1179 CodecFactoryCreateDecoderRequest,
1180 fidl::encoding::DefaultFuchsiaResourceDialect,
1181 > for (T0, T1)
1182 {
1183 #[inline]
1184 unsafe fn encode(
1185 self,
1186 encoder: &mut fidl::encoding::Encoder<
1187 '_,
1188 fidl::encoding::DefaultFuchsiaResourceDialect,
1189 >,
1190 offset: usize,
1191 depth: fidl::encoding::Depth,
1192 ) -> fidl::Result<()> {
1193 encoder.debug_check_bounds::<CodecFactoryCreateDecoderRequest>(offset);
1194 unsafe {
1197 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1198 (ptr as *mut u64).write_unaligned(0);
1199 }
1200 self.0.encode(encoder, offset + 0, depth)?;
1202 self.1.encode(encoder, offset + 16, depth)?;
1203 Ok(())
1204 }
1205 }
1206
1207 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1208 for CodecFactoryCreateDecoderRequest
1209 {
1210 #[inline(always)]
1211 fn new_empty() -> Self {
1212 Self {
1213 decoder_params: fidl::new_empty!(
1214 CreateDecoderParams,
1215 fidl::encoding::DefaultFuchsiaResourceDialect
1216 ),
1217 decoder: fidl::new_empty!(
1218 fidl::encoding::Endpoint<
1219 fidl::endpoints::ServerEnd<fidl_fuchsia_media::StreamProcessorMarker>,
1220 >,
1221 fidl::encoding::DefaultFuchsiaResourceDialect
1222 ),
1223 }
1224 }
1225
1226 #[inline]
1227 unsafe fn decode(
1228 &mut self,
1229 decoder: &mut fidl::encoding::Decoder<
1230 '_,
1231 fidl::encoding::DefaultFuchsiaResourceDialect,
1232 >,
1233 offset: usize,
1234 _depth: fidl::encoding::Depth,
1235 ) -> fidl::Result<()> {
1236 decoder.debug_check_bounds::<Self>(offset);
1237 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1239 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1240 let mask = 0xffffffff00000000u64;
1241 let maskedval = padval & mask;
1242 if maskedval != 0 {
1243 return Err(fidl::Error::NonZeroPadding {
1244 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1245 });
1246 }
1247 fidl::decode!(
1248 CreateDecoderParams,
1249 fidl::encoding::DefaultFuchsiaResourceDialect,
1250 &mut self.decoder_params,
1251 decoder,
1252 offset + 0,
1253 _depth
1254 )?;
1255 fidl::decode!(
1256 fidl::encoding::Endpoint<
1257 fidl::endpoints::ServerEnd<fidl_fuchsia_media::StreamProcessorMarker>,
1258 >,
1259 fidl::encoding::DefaultFuchsiaResourceDialect,
1260 &mut self.decoder,
1261 decoder,
1262 offset + 16,
1263 _depth
1264 )?;
1265 Ok(())
1266 }
1267 }
1268
1269 impl fidl::encoding::ResourceTypeMarker for CodecFactoryCreateEncoderRequest {
1270 type Borrowed<'a> = &'a mut Self;
1271 fn take_or_borrow<'a>(
1272 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1273 ) -> Self::Borrowed<'a> {
1274 value
1275 }
1276 }
1277
1278 unsafe impl fidl::encoding::TypeMarker for CodecFactoryCreateEncoderRequest {
1279 type Owned = Self;
1280
1281 #[inline(always)]
1282 fn inline_align(_context: fidl::encoding::Context) -> usize {
1283 8
1284 }
1285
1286 #[inline(always)]
1287 fn inline_size(_context: fidl::encoding::Context) -> usize {
1288 24
1289 }
1290 }
1291
1292 unsafe impl
1293 fidl::encoding::Encode<
1294 CodecFactoryCreateEncoderRequest,
1295 fidl::encoding::DefaultFuchsiaResourceDialect,
1296 > for &mut CodecFactoryCreateEncoderRequest
1297 {
1298 #[inline]
1299 unsafe fn encode(
1300 self,
1301 encoder: &mut fidl::encoding::Encoder<
1302 '_,
1303 fidl::encoding::DefaultFuchsiaResourceDialect,
1304 >,
1305 offset: usize,
1306 _depth: fidl::encoding::Depth,
1307 ) -> fidl::Result<()> {
1308 encoder.debug_check_bounds::<CodecFactoryCreateEncoderRequest>(offset);
1309 fidl::encoding::Encode::<
1311 CodecFactoryCreateEncoderRequest,
1312 fidl::encoding::DefaultFuchsiaResourceDialect,
1313 >::encode(
1314 (
1315 <CreateEncoderParams as fidl::encoding::ValueTypeMarker>::borrow(
1316 &self.encoder_params,
1317 ),
1318 <fidl::encoding::Endpoint<
1319 fidl::endpoints::ServerEnd<fidl_fuchsia_media::StreamProcessorMarker>,
1320 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1321 &mut self.encoder
1322 ),
1323 ),
1324 encoder,
1325 offset,
1326 _depth,
1327 )
1328 }
1329 }
1330 unsafe impl<
1331 T0: fidl::encoding::Encode<
1332 CreateEncoderParams,
1333 fidl::encoding::DefaultFuchsiaResourceDialect,
1334 >,
1335 T1: fidl::encoding::Encode<
1336 fidl::encoding::Endpoint<
1337 fidl::endpoints::ServerEnd<fidl_fuchsia_media::StreamProcessorMarker>,
1338 >,
1339 fidl::encoding::DefaultFuchsiaResourceDialect,
1340 >,
1341 >
1342 fidl::encoding::Encode<
1343 CodecFactoryCreateEncoderRequest,
1344 fidl::encoding::DefaultFuchsiaResourceDialect,
1345 > for (T0, T1)
1346 {
1347 #[inline]
1348 unsafe fn encode(
1349 self,
1350 encoder: &mut fidl::encoding::Encoder<
1351 '_,
1352 fidl::encoding::DefaultFuchsiaResourceDialect,
1353 >,
1354 offset: usize,
1355 depth: fidl::encoding::Depth,
1356 ) -> fidl::Result<()> {
1357 encoder.debug_check_bounds::<CodecFactoryCreateEncoderRequest>(offset);
1358 unsafe {
1361 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1362 (ptr as *mut u64).write_unaligned(0);
1363 }
1364 self.0.encode(encoder, offset + 0, depth)?;
1366 self.1.encode(encoder, offset + 16, depth)?;
1367 Ok(())
1368 }
1369 }
1370
1371 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1372 for CodecFactoryCreateEncoderRequest
1373 {
1374 #[inline(always)]
1375 fn new_empty() -> Self {
1376 Self {
1377 encoder_params: fidl::new_empty!(
1378 CreateEncoderParams,
1379 fidl::encoding::DefaultFuchsiaResourceDialect
1380 ),
1381 encoder: fidl::new_empty!(
1382 fidl::encoding::Endpoint<
1383 fidl::endpoints::ServerEnd<fidl_fuchsia_media::StreamProcessorMarker>,
1384 >,
1385 fidl::encoding::DefaultFuchsiaResourceDialect
1386 ),
1387 }
1388 }
1389
1390 #[inline]
1391 unsafe fn decode(
1392 &mut self,
1393 decoder: &mut fidl::encoding::Decoder<
1394 '_,
1395 fidl::encoding::DefaultFuchsiaResourceDialect,
1396 >,
1397 offset: usize,
1398 _depth: fidl::encoding::Depth,
1399 ) -> fidl::Result<()> {
1400 decoder.debug_check_bounds::<Self>(offset);
1401 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1403 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1404 let mask = 0xffffffff00000000u64;
1405 let maskedval = padval & mask;
1406 if maskedval != 0 {
1407 return Err(fidl::Error::NonZeroPadding {
1408 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1409 });
1410 }
1411 fidl::decode!(
1412 CreateEncoderParams,
1413 fidl::encoding::DefaultFuchsiaResourceDialect,
1414 &mut self.encoder_params,
1415 decoder,
1416 offset + 0,
1417 _depth
1418 )?;
1419 fidl::decode!(
1420 fidl::encoding::Endpoint<
1421 fidl::endpoints::ServerEnd<fidl_fuchsia_media::StreamProcessorMarker>,
1422 >,
1423 fidl::encoding::DefaultFuchsiaResourceDialect,
1424 &mut self.encoder,
1425 decoder,
1426 offset + 16,
1427 _depth
1428 )?;
1429 Ok(())
1430 }
1431 }
1432}