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"
14 bool ADTSDecoder::IsEnabled() {
15 RefPtr
<PDMFactory
> platform
= new PDMFactory();
16 return !platform
->SupportsMimeType("audio/mp4a-latm"_ns
).isEmpty();
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");
32 nsTArray
<UniquePtr
<TrackInfo
>> ADTSDecoder::GetTracksInfo(
33 const MediaContainerType
& aType
) {
34 nsTArray
<UniquePtr
<TrackInfo
>> tracks
;
35 if (!IsSupportedType(aType
)) {
40 CreateTrackInfoWithMIMETypeAndContainerTypeExtraParameters(
41 "audio/mp4a-latm"_ns
, aType
));
46 } // namespace mozilla