Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / media / mojo / scripts / run_mojo_media_renderer.py
blobd963e9ac46f456854b173457a29b4ce1ba7f531d
1 #!/usr/bin/env python
2 # Copyright 2015 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
6 # The script launches mandoline to test the mojo media renderer.
8 import argparse
9 import os
10 import subprocess
11 import sys
14 root_path = os.path.realpath(
15 os.path.join(
16 os.path.dirname(
17 os.path.realpath(__file__)),
18 os.pardir,
19 os.pardir,
20 os.pardir))
23 def _BuildCommand(args):
24 build_dir = os.path.join(root_path, args.build_dir)
26 runner = [os.path.join(build_dir, "mandoline")]
28 options = ["--enable-mojo-media-renderer"]
29 if args.verbose:
30 options.append("--vmodule=pipeline*=3,*renderer_impl*=3,"
31 "*mojo_demuxer*=3,mojo*service=3")
33 full_command = runner + options + [args.url]
35 if args.verbose:
36 print full_command
38 return full_command
41 def main():
42 parser = argparse.ArgumentParser(
43 description="View a URL with Mandoline with mojo media renderer. "
44 "You must have built //mandoline, //components/html_viewer, "
45 "//mojo, //mojo/services/network and //media/mojo/services "
46 "first.")
47 parser.add_argument(
48 "--build-dir",
49 help="Path to the dir containing the linux-x64 binaries relative to the "
50 "repo root (default: %(default)s)",
51 default="out/Release")
52 parser.add_argument("--verbose", help="Increase output verbosity.",
53 action="store_true")
54 parser.add_argument("url", help="The URL to be viewed")
56 args = parser.parse_args()
57 return subprocess.call(_BuildCommand(args))
59 if __name__ == '__main__':
60 sys.exit(main())