Skip to content

Commit

Permalink
Hook up GST_DEBUG log to visual studio output
Browse files Browse the repository at this point in the history
  • Loading branch information
ferjm committed Sep 23, 2019
1 parent 4fe8238 commit 558dd8b
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 16 deletions.
29 changes: 15 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions components/servo/Cargo.toml
Expand Up @@ -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"
Expand Down
31 changes: 31 additions & 0 deletions components/servo/lib.rs
Expand Up @@ -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
Expand Down Expand Up @@ -195,6 +223,9 @@ mod media_platform {
},
};
ServoMedia::init_with_backend(backend);
if cfg!(feature = "uwp") {
set_gstreamer_log_handler();
}
}

#[cfg(not(windows))]
Expand Down

0 comments on commit 558dd8b

Please sign in to comment.