mirror of
https://github.com/servo/servo.git
synced 2025-07-08 16:03:40 +01:00
Auto merge of #19337 - philn:gecko-canPlayType, r=nox
Implement HTMLMediaElement::canPlayType using gecko-media <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [x] There are tests for these changes <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- 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/19337) <!-- Reviewable:end -->
This commit is contained in:
commit
c5b446a573
2 changed files with 39 additions and 70 deletions
|
@ -31,10 +31,13 @@ use dom::node::{window_from_node, document_from_node, Node, UnbindContext};
|
|||
use dom::promise::Promise;
|
||||
use dom::virtualmethods::VirtualMethods;
|
||||
use dom_struct::dom_struct;
|
||||
#[cfg(all(any(target_os = "macos", target_os = "linux"), not(any(target_arch = "arm", target_arch = "aarch64"))))]
|
||||
use gecko_media::{CanPlayType, GeckoMedia};
|
||||
use html5ever::{LocalName, Prefix};
|
||||
use ipc_channel::ipc;
|
||||
use ipc_channel::router::ROUTER;
|
||||
use microtask::{Microtask, MicrotaskRunnable};
|
||||
#[allow(unused_imports)]
|
||||
use mime::{Mime, SubLevel, TopLevel};
|
||||
use net_traits::{FetchResponseListener, FetchMetadata, Metadata, NetworkError};
|
||||
use net_traits::request::{CredentialsMode, Destination, RequestInit};
|
||||
|
@ -869,6 +872,20 @@ impl HTMLMediaElementMethods for HTMLMediaElement {
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-navigator-canplaytype
|
||||
fn CanPlayType(&self, type_: DOMString) -> CanPlayTypeResult {
|
||||
#[cfg(all(
|
||||
any(target_os = "macos", target_os = "linux"),
|
||||
not(any(target_arch = "arm", target_arch = "aarch64"))))]
|
||||
{
|
||||
let gecko_media = match GeckoMedia::get() {
|
||||
Ok(gecko_media) => gecko_media,
|
||||
Err(_error) => return CanPlayTypeResult::_empty,
|
||||
};
|
||||
return match gecko_media.can_play_type(&type_) {
|
||||
CanPlayType::No => CanPlayTypeResult::_empty,
|
||||
CanPlayType::Maybe => CanPlayTypeResult::Maybe,
|
||||
CanPlayType::Probably => CanPlayTypeResult::Probably
|
||||
};
|
||||
}
|
||||
match type_.parse::<Mime>() {
|
||||
Ok(Mime(TopLevel::Application, SubLevel::OctetStream, _)) |
|
||||
Err(_) => {
|
||||
|
|
|
@ -1,83 +1,23 @@
|
|||
[canPlayType.html]
|
||||
type: testharness
|
||||
[video/x-new-fictional-format]
|
||||
expected: FAIL
|
||||
|
||||
[audio/mp4; codecs="mp4a.40.2" (optional)]
|
||||
expected: FAIL
|
||||
|
||||
[audio/mp4 with bogus codec]
|
||||
expected: FAIL
|
||||
|
||||
[audio/ogg; codecs="opus" (optional)]
|
||||
expected: FAIL
|
||||
|
||||
[audio/ogg; codecs="vorbis" (optional)]
|
||||
expected: FAIL
|
||||
|
||||
[audio/ogg with bogus codec]
|
||||
expected: FAIL
|
||||
|
||||
[audio/wav; codecs="1" (optional)]
|
||||
expected: FAIL
|
||||
|
||||
[audio/wav with bogus codec]
|
||||
expected: FAIL
|
||||
|
||||
[audio/webm; codecs="opus" (optional)]
|
||||
expected: FAIL
|
||||
|
||||
[audio/webm; codecs="vorbis" (optional)]
|
||||
expected: FAIL
|
||||
|
||||
[audio/webm with bogus codec]
|
||||
expected: FAIL
|
||||
|
||||
[video/3gpp; codecs="samr" (optional)]
|
||||
expected: FAIL
|
||||
|
||||
[video/3gpp; codecs="mp4v.20.8" (optional)]
|
||||
expected: FAIL
|
||||
|
||||
[video/3gpp with bogus codec]
|
||||
expected: FAIL
|
||||
|
||||
[video/mp4; codecs="mp4a.40.2" (optional)]
|
||||
expected: FAIL
|
||||
|
||||
[video/mp4; codecs="avc1.42E01E" (optional)]
|
||||
expected: FAIL
|
||||
|
||||
[video/mp4; codecs="avc1.4D401E" (optional)]
|
||||
expected: FAIL
|
||||
|
||||
[video/mp4; codecs="avc1.58A01E" (optional)]
|
||||
expected: FAIL
|
||||
|
||||
[video/mp4; codecs="avc1.64001E" (optional)]
|
||||
expected: FAIL
|
||||
|
||||
[video/mp4; codecs="mp4v.20.8" (optional)]
|
||||
expected: FAIL
|
||||
|
||||
[video/mp4; codecs="mp4v.20.240" (optional)]
|
||||
expected: FAIL
|
||||
|
||||
[video/mp4 with bogus codec]
|
||||
expected: FAIL
|
||||
|
||||
[video/ogg; codecs="opus" (optional)]
|
||||
expected: FAIL
|
||||
|
||||
[video/ogg; codecs="vorbis" (optional)]
|
||||
expected: FAIL
|
||||
|
||||
[video/ogg; codecs="theora" (optional)]
|
||||
expected: FAIL
|
||||
|
||||
[video/ogg with bogus codec]
|
||||
expected: FAIL
|
||||
|
||||
[video/webm; codecs="opus" (optional)]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -96,9 +36,6 @@
|
|||
[video/webm; codecs="vp9.0" (optional)]
|
||||
expected: FAIL
|
||||
|
||||
[video/webm with bogus codec]
|
||||
expected: FAIL
|
||||
|
||||
[audio/mp4 with and without codecs]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -108,18 +45,33 @@
|
|||
[audio/wav with and without codecs]
|
||||
expected: FAIL
|
||||
|
||||
[audio/webm with and without codecs]
|
||||
expected: FAIL
|
||||
|
||||
[video/3gpp with and without codecs]
|
||||
expected: FAIL
|
||||
|
||||
[video/mp4 with and without codecs]
|
||||
expected: FAIL
|
||||
|
||||
[video/ogg with and without codecs]
|
||||
expected: FAIL
|
||||
|
||||
[video/webm with and without codecs]
|
||||
[audio/mp4 (optional)]
|
||||
expected: FAIL
|
||||
|
||||
[audio/ogg (optional)]
|
||||
expected: FAIL
|
||||
|
||||
[audio/wav (optional)]
|
||||
expected: FAIL
|
||||
|
||||
[audio/webm (optional)]
|
||||
expected: FAIL
|
||||
|
||||
[video/3gpp (optional)]
|
||||
expected: FAIL
|
||||
|
||||
[video/mp4 (optional)]
|
||||
expected: FAIL
|
||||
|
||||
[video/ogg (optional)]
|
||||
expected: FAIL
|
||||
|
||||
[video/webm (optional)]
|
||||
expected: FAIL
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue