screencapturekit/stream/output_type.rs
1//! Output type enumeration for stream handlers
2//!
3//! Defines the types of output that can be received from a capture stream.
4
5use std::fmt::{self, Display};
6
7/// Type of output received from a capture stream
8///
9/// Used to distinguish between different types of captured data
10/// when implementing [`SCStreamOutputTrait`](crate::stream::output_trait::SCStreamOutputTrait).
11///
12/// # Examples
13///
14/// ```
15/// use screencapturekit::stream::output_type::SCStreamOutputType;
16///
17/// fn handle_output(output_type: SCStreamOutputType) {
18/// match output_type {
19/// SCStreamOutputType::Screen => println!("Video frame"),
20/// SCStreamOutputType::Audio => println!("Audio buffer"),
21/// SCStreamOutputType::Microphone => println!("Microphone audio"),
22/// }
23/// }
24/// ```
25#[derive(Eq, PartialEq, Debug, Clone, Copy, Hash, Default)]
26#[repr(C)]
27pub enum SCStreamOutputType {
28 /// Video frame output
29 #[default]
30 Screen,
31 /// System audio output
32 Audio,
33 /// Microphone audio output (macOS 15.0+)
34 ///
35 /// When using microphone capture, this output type allows separate handling
36 /// of microphone audio from system audio.
37 Microphone,
38}
39
40impl Display for SCStreamOutputType {
41 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
42 match self {
43 Self::Screen => write!(f, "Screen"),
44 Self::Audio => write!(f, "Audio"),
45 Self::Microphone => write!(f, "Microphone"),
46 }
47 }
48}