Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(209)

Unified Diff: mojo/services/html_viewer/webmimeregistry_impl.cc

Issue 571183002: Add basic video support to mojo html_viewer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | mojo/services/public/cpp/surfaces/lib/surfaces_type_converters.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/services/html_viewer/webmimeregistry_impl.cc
diff --git a/mojo/services/html_viewer/webmimeregistry_impl.cc b/mojo/services/html_viewer/webmimeregistry_impl.cc
index edaed24e39e9cdfb0161e7a34e4aaec720ff2bf0..2faac176dedb38022cd271d0bb910ba795c61754 100644
--- a/mojo/services/html_viewer/webmimeregistry_impl.cc
+++ b/mojo/services/html_viewer/webmimeregistry_impl.cc
@@ -58,8 +58,32 @@ blink::WebMimeRegistry::SupportsType WebMimeRegistryImpl::supportsMediaMIMEType(
const blink::WebString& mime_type,
const blink::WebString& codecs,
const blink::WebString& key_system) {
- NOTIMPLEMENTED();
- return IsNotSupported;
+ const std::string mime_type_ascii = ToASCIIOrEmpty(mime_type);
+ // Not supporting the container is a flat-out no.
+ if (!net::IsSupportedMediaMimeType(mime_type_ascii))
+ return IsNotSupported;
+
+ // Mojo does not currently support any key systems.
+ if (!key_system.isEmpty())
+ return IsNotSupported;
+
+ // Check list of strict codecs to see if it is supported.
+ if (net::IsStrictMediaMimeType(mime_type_ascii)) {
+ // Check if the codecs are a perfect match.
+ std::vector<std::string> strict_codecs;
+ net::ParseCodecString(ToASCIIOrEmpty(codecs), &strict_codecs, false);
+ return static_cast<WebMimeRegistry::SupportsType>(
+ net::IsSupportedStrictMediaMimeType(mime_type_ascii, strict_codecs));
+ }
+
+ // If we don't recognize the codec, it's possible we support it.
+ std::vector<std::string> parsed_codecs;
+ net::ParseCodecString(ToASCIIOrEmpty(codecs), &parsed_codecs, true);
+ if (!net::AreSupportedMediaCodecs(parsed_codecs))
+ return MayBeSupported;
+
+ // Otherwise we have a perfect match.
+ return IsSupported;
}
bool WebMimeRegistryImpl::supportsMediaSourceMIMEType(
« no previous file with comments | « no previous file | mojo/services/public/cpp/surfaces/lib/surfaces_type_converters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698