diff --git a/components/servo/Cargo.toml b/components/servo/Cargo.toml index f3e4cd086c5..f0eb9c892e8 100644 --- a/components/servo/Cargo.toml +++ b/components/servo/Cargo.toml @@ -71,6 +71,8 @@ script_traits = {path = "../script_traits"} servo_config = {path = "../config"} servo_geometry = {path = "../geometry"} servo-media = {git = "https://github.com/servo/media"} +servo-media-dummy = {git = "https://github.com/servo/media", optional = true} +servo-media-gstreamer = {git = "https://github.com/servo/media", optional = true} servo_url = {path = "../url"} sparkle = "0.1" style = {path = "../style", features = ["servo"]} @@ -90,10 +92,6 @@ gaol = "0.2.1" [target.'cfg(any(target_os = "android", target_arch = "x86_64", target_os = "windows"))'.dependencies] gstreamer = "0.14.5" -servo-media-gstreamer= {git = "https://github.com/servo/media"} - -[target.'cfg(not(any(target_os = "android", target_arch = "x86_64", target_os = "windows")))'.dependencies.servo-media-dummy] -git = "https://github.com/servo/media" [target.'cfg(target_os = "windows")'.dependencies] mozangle = {version = "0.2"} diff --git a/components/servo/lib.rs b/components/servo/lib.rs index e32c28ef740..e6a152dc15f 100644 --- a/components/servo/lib.rs +++ b/components/servo/lib.rs @@ -135,7 +135,7 @@ pub use msg::constellation_msg::TopLevelBrowsingContextId as BrowserId; pub use servo_config as config; pub use servo_url as url; -#[cfg(any(target_os = "android", target_arch = "x86_64", target_os = "windows",))] +#[cfg(feature = "servo-media-gstreamer")] mod media_platform { use super::ServoMedia; use servo_media_gstreamer::GStreamerBackend; @@ -245,7 +245,7 @@ mod media_platform { } } -#[cfg(not(any(target_os = "android", target_arch = "x86_64", target_os = "windows",)))] +#[cfg(feature = "servo-media-dummy")] mod media_platform { use super::ServoMedia; pub fn init() { diff --git a/ports/glutin/Cargo.toml b/ports/glutin/Cargo.toml index d4ad9f3a299..886f140b9b2 100644 --- a/ports/glutin/Cargo.toml +++ b/ports/glutin/Cargo.toml @@ -33,6 +33,8 @@ default = ["webdriver", "max_log_level"] egl = ["libservo/egl"] energy-profiling = ["libservo/energy-profiling"] debugmozjs = ["libservo/debugmozjs"] +media-dummy = ["libservo/servo-media-dummy"] +media-gstreamer = ["libservo/servo-media-gstreamer"] js_backtrace = ["libservo/js_backtrace"] layout-2013 = ["libservo/layout-2013"] layout-2020 = ["libservo/layout-2020"] diff --git a/python/servo/build_commands.py b/python/servo/build_commands.py index d4ac8d98b68..fc5cf912a52 100644 --- a/python/servo/build_commands.py +++ b/python/servo/build_commands.py @@ -155,6 +155,10 @@ class MachCommands(CommandBase): @CommandArgument('--jobs', '-j', default=None, help='Number of jobs to run in parallel') + @CommandArgument('--media-stack', + default=None, + choices=["gstreamer", "dummy"], + help='Which media stack to use') @CommandArgument('--no-package', action='store_true', help='For Android, disable packaging into a .apk after building') @@ -171,7 +175,7 @@ class MachCommands(CommandBase): @CommandArgument('params', nargs='...', help="Command-line arguments to be passed through to Cargo") @CommandBase.build_like_command_arguments - def build(self, release=False, dev=False, jobs=None, params=None, + def build(self, release=False, dev=False, jobs=None, params=None, media_stack=None, no_package=False, verbose=False, very_verbose=False, target=None, android=False, magicleap=False, libsimpleservo=False, features=None, uwp=False, win_arm64=False, **kwargs): @@ -191,6 +195,19 @@ class MachCommands(CommandBase): if not uwp: uwp = target and 'uwp' in target + # A guess about which platforms should use the gstreamer media stack + if not(media_stack): + if ( + not(target) or + ("armv7" in target and "android" in target) or + ("x86_64" in target) + ): + media_stack = "gstreamer" + else: + media_stack = "dummy" + + features += ["media-" + media_stack] + target_path = base_path = self.get_target_dir() if android: target_path = path.join(target_path, "android")