Skip to content

Commit

Permalink
Adjust gstreamer plugins for UWP.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdm committed Jul 12, 2019
1 parent 677f26d commit ce01cd7
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 462 deletions.
40 changes: 29 additions & 11 deletions components/servo/lib.rs
Expand Up @@ -135,7 +135,7 @@ mod media_platform {
let mut plugin_dir = std::env::current_exe().unwrap();
plugin_dir.pop();

let plugins = &[
let uwp_plugins = [
"gstapp.dll",
"gstaudioconvert.dll",
"gstaudiofx.dll",
Expand All @@ -144,31 +144,49 @@ mod media_platform {
"gstautodetect.dll",
"gstcoreelements.dll",
"gstdeinterlace.dll",
"gstplayback.dll",
"gstinterleave.dll",
"gstisomp4.dll",
"gstlibav.dll",
"gstnice.dll",
"gstogg.dll",
"gstopengl.dll",
"gstopus.dll",
"gstplayback.dll",
"gstproxy.dll",
"gstrtp.dll",
"gsttheora.dll",
"gsttypefindfunctions.dll",
"gstvideoconvert.dll",
"gstvideofilter.dll",
"gstvideoparsersbad.dll",
"gstvideoscale.dll",
"gstvolume.dll",
"gstwasapi.dll",
];

let non_uwp_plugins = [
"gstnice.dll",
"gstogg.dll",
"gstopengl.dll",
"gstopus.dll",
"gstrtp.dll",
"gsttheora.dll",
"gstvorbis.dll",
"gstvpx.dll",
"gstwasapi.dll",
"gstwebrtc.dll",
];

let backend = GStreamerBackend::init_with_plugins(plugin_dir, plugins)
.expect("Error initializing GStreamer");
let plugins: Vec<_> = if cfg!(feature = "uwp") {
uwp_plugins.to_vec()
} else {
uwp_plugins
.iter()
.map(|&s| s)
.chain(non_uwp_plugins.iter().map(|&s| s))
.collect()
};

let backend = match GStreamerBackend::init_with_plugins(plugin_dir, &plugins) {
Ok(b) => b,
Err(e) => {
error!("Error initializing GStreamer: {:?}", e);
panic!()
},
};
ServoMedia::init_with_backend(backend);
}

Expand Down
72 changes: 42 additions & 30 deletions python/servo/build_commands.py
Expand Up @@ -606,7 +606,7 @@ def package_generated_shared_libraries(libs, build_path, servo_exe_dir):
target_triple = target or host_triple()
if "aarch64" not in target_triple:
print("Packaging gstreamer DLLs")
if not package_gstreamer_dlls(servo_exe_dir, target_triple):
if not package_gstreamer_dlls(servo_exe_dir, target_triple, uwp):
status = 1
print("Packaging MSVC DLLs")
if not package_msvc_dlls(servo_exe_dir, target_triple):
Expand Down Expand Up @@ -658,7 +658,7 @@ def clean(self, manifest_path=None, params=[], verbose=False):
return check_call(["cargo", "clean"] + opts, env=self.build_env(), verbose=verbose)


def package_gstreamer_dlls(servo_exe_dir, target):
def package_gstreamer_dlls(servo_exe_dir, target, uwp):
msvc_x64 = "64" if "x86_64" in target else ""
gst_x64 = "X86_64" if msvc_x64 == "64" else "X86"
gst_root = ""
Expand All @@ -684,7 +684,6 @@ def package_gstreamer_dlls(servo_exe_dir, target):
"glib-2.0-0.dll",
"gmodule-2.0-0.dll",
"gobject-2.0-0.dll",
"graphene-1.0-0.dll",
"gstapp-1.0-0.dll",
"gstaudio-1.0-0.dll",
"gstbase-1.0-0.dll",
Expand All @@ -697,33 +696,42 @@ def package_gstreamer_dlls(servo_exe_dir, target):
"gstreamer-1.0-0.dll",
"gstriff-1.0-0.dll",
"gstrtp-1.0-0.dll",
"gstsctp-1.0-0.dll",
"gstsdp-1.0-0.dll",
"gsttag-1.0-0.dll",
"gstvideo-1.0-0.dll",
"gstwebrtc-1.0-0.dll",
"intl-8.dll",
"libgmp-10.dll",
"libgnutls-30.dll",
"libhogweed-4.dll",
"libjpeg-8.dll",
"libnettle-6.dll.",
"libpng16-16.dll",
"libogg-0.dll",
"libopus-0.dll",
"libtasn1-6.dll",
"libtheora-0.dll",
"libtheoradec-1.dll",
"libtheoraenc-1.dll",
"libvorbis-0.dll",
"libvorbisenc-2.dll",
"libwinpthread-1.dll",
"nice-10.dll",
"orc-0.4-0.dll",
"swresample-3.dll",
"z-1.dll",
]

# FIXME: until we build with UWP-enabled GStreamer binaries,
# almost every UWP-friendly DLL depends on this
# incompatible DLL.
gst_dlls += ["libwinpthread-1.dll"]

if not uwp:
gst_dlls += [
"graphene-1.0-0.dll",
"gstsctp-1.0-0.dll",
"libgmp-10.dll",
"libgnutls-30.dll",
"libhogweed-4.dll",
"libjpeg-8.dll",
"libnettle-6.dll.",
"libogg-0.dll",
"libopus-0.dll",
"libpng16-16.dll",
"libtasn1-6.dll",
"libtheora-0.dll",
"libtheoradec-1.dll",
"libtheoraenc-1.dll",
"libvorbis-0.dll",
"libvorbisenc-2.dll",
"nice-10.dll",
]

missing = []
for gst_lib in gst_dlls:
try:
Expand All @@ -749,26 +757,30 @@ def package_gstreamer_dlls(servo_exe_dir, target):
"gstplayback.dll",
"gstinterleave.dll",
"gstisomp4.dll",
"gstnice.dll",
"gstogg.dll",
"gstopengl.dll",
"gstopus.dll",
"gstlibav.dll",
"gstproxy.dll",
"gstrtp.dll",
"gsttheora.dll",
"gsttypefindfunctions.dll",
"gstvideoconvert.dll",
"gstvideofilter.dll",
"gstvideoparsersbad.dll",
"gstvideoscale.dll",
"gstvolume.dll",
"gstvorbis.dll",
"gstvpx.dll",
"gstwebrtc.dll",
"gstwasapi.dll",
"gstlibav.dll",
]

if not uwp:
gst_dlls += [
"gstnice.dll",
"gstogg.dll",
"gstopengl.dll",
"gstopus.dll",
"gstrtp.dll",
"gsttheora.dll",
"gstvorbis.dll",
"gstvpx.dll",
"gstwebrtc.dll",
]

gst_plugin_path_root = os.environ.get("GSTREAMER_PACKAGE_PLUGIN_PATH") or gst_root
gst_plugin_path = path.join(gst_plugin_path_root, "lib", "gstreamer-1.0")
if not os.path.exists(gst_plugin_path):
Expand Down

0 comments on commit ce01cd7

Please sign in to comment.