1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//! Backend selection policy.
/// Optional backend selected for an operation.
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
pub enum BackendSelection {
/// Choose the compatibility backend for the operation.
#[default]
CompatibilityDefault,
/// Use an external ffmpeg process.
Ffmpeg,
/// Use an external mkvmerge process.
Mkvmerge,
/// Use the optional MP4 backend.
Mp4forge,
}
/// Dependency and backend policy for request planning.
#[derive(Clone, Debug, Default, Eq, PartialEq)]
pub struct BackendPolicy {
/// MP4 backend policy.
pub mp4: Mp4BackendPolicy,
}
/// Policy for the optional MP4 backend.
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct Mp4BackendPolicy {
/// Whether explicit MP4 backend selection is allowed.
pub enabled: bool,
/// Published crate version or Git revision recorded by the build.
pub source_version: Option<String>,
}
impl Default for Mp4BackendPolicy {
fn default() -> Self {
Self {
enabled: mp4forge_feature_enabled(),
source_version: None,
}
}
}
fn mp4forge_feature_enabled() -> bool {
#[cfg(feature = "mp4forge")]
{
true
}
#[cfg(not(feature = "mp4forge"))]
{
false
}
}