servo/
gstreamer_plugins.rs

1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
5#[cfg(any(target_os = "windows", target_os = "macos"))]
6static COMMON_PLUGINS: &[&str] = &include!("gstreamer_plugin_lists/common.rs.in");
7#[cfg(target_os = "windows")]
8static WINDOWS_PLUGINS: &[&str] = &include!("gstreamer_plugin_lists/windows.rs.in");
9#[cfg(target_os = "macos")]
10static MACOS_PLUGINS: &[&str] = &include!("gstreamer_plugin_lists/macos.rs.in");
11
12#[cfg(any(target_os = "windows", target_os = "macos"))]
13pub(crate) fn gstreamer_plugins() -> Vec<String> {
14    let mut plugins = Vec::from(COMMON_PLUGINS);
15    #[cfg(target_os = "windows")]
16    plugins.extend_from_slice(WINDOWS_PLUGINS);
17    #[cfg(target_os = "macos")]
18    plugins.extend_from_slice(MACOS_PLUGINS);
19
20    let (prefix, suffix) = if cfg!(target_os = "windows") {
21        ("", ".dll")
22    } else if cfg!(target_os = "macos") {
23        ("lib", ".dylib")
24    } else {
25        unreachable!("This function is only for macOS and Windows.")
26    };
27
28    plugins
29        .iter()
30        .map(|basename| format!("{prefix}{basename}{suffix}"))
31        .collect()
32}