Skip to content
Permalink
Browse files

Hook up GST_DEBUG log to visual studio output

  • Loading branch information...
ferjm committed Sep 23, 2019
1 parent 4fe8238 commit 558dd8b32d97643715379efdd29c3a99e86c79dd
Showing with 49 additions and 16 deletions.
  1. +15 −14 Cargo.lock
  2. +3 −2 components/servo/Cargo.toml
  3. +31 −0 components/servo/lib.rs

Some generated files are not rendered by default. Learn more.

@@ -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"
@@ -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))]

0 comments on commit 558dd8b

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