Auto merge of #24255 - ferjm:gst.log.uwp, r=jdm

Hook up GST_DEBUG log to visual studio output

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #23700

<strike>Depends on https://github.com/servo/media/pull/312</strike>

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/24255)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2019-09-24 03:02:36 -04:00 committed by GitHub
commit a7f76a3d09
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 49 additions and 16 deletions

View file

@ -86,8 +86,9 @@ webxr-api = {git = "https://github.com/servo/webxr"}
[target.'cfg(all(not(target_os = "windows"), not(target_os = "ios"), not(target_os="android"), not(target_arch="arm"), not(target_arch="aarch64")))'.dependencies]
gaol = {git = "https://github.com/servo/gaol"}
[target.'cfg(any(target_os = "android", target_arch = "x86_64", target_os = "windows"))'.dependencies.servo-media-gstreamer]
git = "https://github.com/servo/media"
[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"

View file

@ -130,6 +130,34 @@ mod media_platform {
use super::ServoMedia;
use servo_media_gstreamer::GStreamerBackend;
#[cfg(target_os = "windows")]
fn set_gstreamer_log_handler() {
use gstreamer::{debug_add_log_function, debug_remove_default_log_function, DebugLevel};
debug_remove_default_log_function();
debug_add_log_function(|cat, level, file, function, line, _, message| {
let message = format!(
"{:?} {:?} {:?}:{:?}:{:?} {:?}",
cat.get_name(),
level,
file,
line,
function,
message
);
match level {
DebugLevel::Debug => debug!("{}", message),
DebugLevel::Error => error!("{}", message),
DebugLevel::Warning => warn!("{}", message),
DebugLevel::Fixme | DebugLevel::Info => info!("{}", message),
DebugLevel::Memdump | DebugLevel::Count | DebugLevel::Trace => {
trace!("{}", message)
},
_ => (),
}
});
}
#[cfg(windows)]
pub fn init() {
// UWP apps have the working directory set appropriately. Win32 apps
@ -195,6 +223,9 @@ mod media_platform {
},
};
ServoMedia::init_with_backend(backend);
if cfg!(feature = "uwp") {
set_gstreamer_log_handler();
}
}
#[cfg(not(windows))]