libobs_sources/
output.rs

1use libobs_source_macro::obs_object_builder;
2
3macro_rules! new_output_builder {
4    ($builder:ident, $output_type:literal) => {
5        #[obs_object_builder($output_type)]
6        pub struct $builder {
7            #[obs_property(type_t = "string")]
8            /// The path the recording should be saved to
9            path: String,
10
11            #[obs_property(type_t = "int")]
12            bitrate: i32,
13
14            #[obs_property(type_t = "int")]
15            codec_type: i32,
16
17            #[obs_property(type_t = "string")]
18            // Custom Arguments for the muxer to use
19            muxer_settings: String,
20
21            #[obs_property(type_t = "int")]
22            // The maximum time in seconds that the recording should hold
23            max_time_sec: i32,
24
25            #[obs_property(type_t = "int")]
26            // The maximum size in megabytes that the recording should hold
27            max_size_mb: i32,
28
29            #[obs_property(type_t = "bool")]
30            /// Whether the recording should be split into multiple files and merged later
31            split_file: bool,
32
33            #[obs_property(type_t = "bool")]
34            /// Whether it should be permitted to overwrite the old file
35            allow_overwrite: bool,
36
37            #[obs_property(type_t = "string")]
38            /// The directory the recording should be saved to
39            directory: String,
40
41            #[obs_property(type_t = "string")]
42            /// The format to use for the file name of the recording.
43            /// e.g. "%CCYY-%MM-%DD %hh-%mm-%ss"
44            /// Code for formatting can be found [here](https://github.com/obsproject/obs-studio/blob/5854f3b9e5861246ea57dd4a26d3d847a8552c4b/libobs/util/platform.c#L715)
45            format: String,
46
47            #[obs_property(type_t = "string")]
48            /// The extension to use for the file name of the recording (without the dot, e.g. "mpr")
49            extension: String,
50
51            #[obs_property(type_t = "bool")]
52            /// Whether spaces are allowed in the file name
53            allow_spaces: bool,
54        }
55    };
56}
57
58new_output_builder!(FFmpegMuxerOutput, "ffmpeg_muxer");
59new_output_builder!(ReplayBufferOutput, "replay_buffer");