no bug - Bumping Firefox l10n changesets r=release a=l10n-bump DONTBUILD CLOSED TREE
[gecko.git] / dom / media / ADTSDecoder.cpp
blob4df1cb1885226ca6e1b05d2457a62dde7fce14b8
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "ADTSDecoder.h"
8 #include "MediaContainerType.h"
9 #include "PDMFactory.h"
11 namespace mozilla {
13 /* static */
14 bool ADTSDecoder::IsEnabled() {
15 RefPtr<PDMFactory> platform = new PDMFactory();
16 return !platform->SupportsMimeType("audio/mp4a-latm"_ns).isEmpty();
19 /* static */
20 bool ADTSDecoder::IsSupportedType(const MediaContainerType& aContainerType) {
21 if (aContainerType.Type() == MEDIAMIMETYPE("audio/aac") ||
22 aContainerType.Type() == MEDIAMIMETYPE("audio/aacp") ||
23 aContainerType.Type() == MEDIAMIMETYPE("audio/x-aac")) {
24 return IsEnabled() && (aContainerType.ExtendedType().Codecs().IsEmpty() ||
25 aContainerType.ExtendedType().Codecs() == "aac");
28 return false;
31 /* static */
32 nsTArray<UniquePtr<TrackInfo>> ADTSDecoder::GetTracksInfo(
33 const MediaContainerType& aType) {
34 nsTArray<UniquePtr<TrackInfo>> tracks;
35 if (!IsSupportedType(aType)) {
36 return tracks;
39 tracks.AppendElement(
40 CreateTrackInfoWithMIMETypeAndContainerTypeExtraParameters(
41 "audio/mp4a-latm"_ns, aType));
43 return tracks;
46 } // namespace mozilla