2015-11-27 04:40:30 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#include "ADTSDecoder.h"
|
|
|
|
#include "ADTSDemuxer.h"
|
2017-01-18 00:59:03 +00:00
|
|
|
#include "MediaContainerType.h"
|
2015-11-27 04:40:30 +00:00
|
|
|
#include "PDMFactory.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
2017-06-20 10:10:27 +00:00
|
|
|
ChannelMediaDecoder*
|
2017-08-03 09:39:55 +00:00
|
|
|
ADTSDecoder::CloneImpl(MediaDecoderInit& aInit)
|
2015-11-27 04:40:30 +00:00
|
|
|
{
|
|
|
|
if (!IsEnabled())
|
|
|
|
return nullptr;
|
|
|
|
|
2017-06-07 04:14:11 +00:00
|
|
|
return new ADTSDecoder(aInit);
|
2015-11-27 04:40:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* static */ bool
|
|
|
|
ADTSDecoder::IsEnabled()
|
|
|
|
{
|
|
|
|
RefPtr<PDMFactory> platform = new PDMFactory();
|
2016-04-19 07:36:19 +00:00
|
|
|
return platform->SupportsMimeType(NS_LITERAL_CSTRING("audio/mp4a-latm"),
|
|
|
|
/* DecoderDoctorDiagnostics* */ nullptr);
|
2015-11-27 04:40:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* static */ bool
|
2017-01-18 00:59:03 +00:00
|
|
|
ADTSDecoder::IsSupportedType(const MediaContainerType& aContainerType)
|
2015-11-27 04:40:30 +00:00
|
|
|
{
|
2017-01-18 00:59:03 +00:00
|
|
|
if (aContainerType.Type() == MEDIAMIMETYPE("audio/aac")
|
|
|
|
|| aContainerType.Type() == MEDIAMIMETYPE("audio/aacp")
|
|
|
|
|| aContainerType.Type() == MEDIAMIMETYPE("audio/x-aac")) {
|
2016-12-20 07:57:26 +00:00
|
|
|
return
|
|
|
|
IsEnabled()
|
2017-01-18 00:59:03 +00:00
|
|
|
&& (aContainerType.ExtendedType().Codecs().IsEmpty()
|
2017-01-24 04:42:48 +00:00
|
|
|
|| aContainerType.ExtendedType().Codecs() == "aac");
|
2015-11-27 04:40:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace mozilla
|