Skip to content

Commit

Permalink
Remove video-metadata from android platform
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Jul 27, 2016
1 parent 556cb99 commit 1d53dae
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 219 deletions.
4 changes: 3 additions & 1 deletion components/script/Cargo.toml
Expand Up @@ -17,6 +17,9 @@ debugmozjs = ['js/debugmozjs']
[target.'cfg(any(target_os = "macos", target_os = "linux"))'.dependencies]
tinyfiledialogs = {git = "https://github.com/jdm/tinyfiledialogs"}

[target.'cfg(not(target_os = "android"))'.dependencies]
video-metadata = {git = "https://github.com/GuillaumeGomez/video-metadata-rs"}

[dependencies]
angle = {git = "https://github.com/servo/angle", branch = "servo"}
app_units = "0.2.5"
Expand Down Expand Up @@ -67,7 +70,6 @@ time = "0.1.12"
url = {version = "1.0.0", features = ["heap_size", "query_encoding"]}
util = {path = "../util"}
uuid = {version = "0.2", features = ["v4"]}
video-metadata = {git = "https://github.com/GuillaumeGomez/video-metadata-rs"}
websocket = "0.17"
xml5ever = {version = "0.1.2", features = ["unstable"]}

Expand Down
48 changes: 30 additions & 18 deletions components/script/dom/htmlmediaelement.rs
Expand Up @@ -89,24 +89,7 @@ impl AsyncResponseListener for HTMLMediaElementContext {
// https://html.spec.whatwg.org/multipage/#media-data-processing-steps-list
// => "Once enough of the media data has been fetched to determine the duration..."
if !self.have_metadata {
match video_metadata::get_format_from_slice(&self.data) {
Ok(meta) => {
let dur = meta.duration.unwrap_or(::std::time::Duration::new(0, 0));
*elem.video.borrow_mut() = Some(VideoMedia {
format: format!("{:?}", meta.format),
duration: Duration::seconds(dur.as_secs() as i64) +
Duration::nanoseconds(dur.subsec_nanos() as i64),
width: meta.size.width,
height: meta.size.height,
video: meta.video,
audio: meta.audio,
});
// Step 6
elem.change_ready_state(HAVE_METADATA);
self.have_metadata = true;
}
_ => {}
}
self.check_metadata(&elem);
} else {
elem.change_ready_state(HAVE_CURRENT_DATA);
}
Expand Down Expand Up @@ -176,6 +159,35 @@ impl HTMLMediaElementContext {
ignore_response: false,
}
}

#[cfg(not(target_os = "android"))]
fn check_metadata(&mut self, elem: &HTMLMediaElement) {
match video_metadata::get_format_from_slice(&self.data) {
Ok(meta) => {
let dur = meta.duration.unwrap_or(::std::time::Duration::new(0, 0));
*elem.video.borrow_mut() = Some(VideoMedia {
format: format!("{:?}", meta.format),
duration: Duration::seconds(dur.as_secs() as i64) +
Duration::nanoseconds(dur.subsec_nanos() as i64),
width: meta.size.width,
height: meta.size.height,
video: meta.video,
audio: meta.audio,
});
// Step 6
elem.change_ready_state(HAVE_METADATA);
self.have_metadata = true;
}
_ => {}
}
}

#[cfg(target_os = "android")]
fn check_metadata(&mut self, _elem: &HTMLMediaElement) {
// Step 6.
elem.change_ready_state(HAVE_METADATA);
self.have_metadata = true;
}
}

#[derive(JSTraceable, HeapSizeOf)]
Expand Down
1 change: 1 addition & 0 deletions components/script/lib.rs
Expand Up @@ -88,6 +88,7 @@ extern crate url;
#[macro_use]
extern crate util;
extern crate uuid;
#[cfg(not(target_os = "android"))]
extern crate video_metadata;
extern crate webrender_traits;
extern crate websocket;
Expand Down
13 changes: 0 additions & 13 deletions support/android/ffmpeg.makefile

This file was deleted.

187 changes: 0 additions & 187 deletions support/android/ffmpeg.sh

This file was deleted.

0 comments on commit 1d53dae

Please sign in to comment.