Skip to content
Permalink
Browse files

Allow mach build to explicitly set the media stack

You can select the media backend by building as follows:

$ ./mach build -d --media-stack=dummy
or
$ ./mach build -d --media-stack=gstreamer
  • Loading branch information
asajeffrey authored and tuncer committed May 17, 2019
1 parent 91b612f commit 4e3f164f7bd020b1aed453ec11586cafd84e1a5d
Showing with 24 additions and 7 deletions.
  1. +2 −4 components/servo/Cargo.toml
  2. +2 −2 components/servo/lib.rs
  3. +2 −0 ports/glutin/Cargo.toml
  4. +18 −1 python/servo/build_commands.py
@@ -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"}
@@ -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() {
@@ -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"]
@@ -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 @@ def build(self, release=False, dev=False, jobs=None, params=None,
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")

0 comments on commit 4e3f164

Please sign in to comment.
You can’t perform that action at this time.