gecko-dev/dom/media/wave/WaveDecoder.cpp
JW Wang 7f6f26e511 Bug 1386951 - have ChannelMediaDecoder implement CreateStateMachine() and fix includes. r=jya
The implementation will be shared by most of the sub-classes except OggDecoder
which needs to call demuxer->SetChainingEvents().

http://searchfox.org/mozilla-central/rev/f0e4ae5f8c40ba742214e89aba3f554da0b89a33/dom/media/ogg/OggDecoder.cpp#25

This helps reducing code changes whenever we add a field to MediaFormatReaderInit.

MozReview-Commit-ID: 5K8NY1oxol4

--HG--
extra : rebase_source : 7bc2a71ad9bd982ada51fd28d6a5b7c6f1d7395a
extra : source : cccd49795938ce53cd8eee597ec0ea4859543c37
2017-08-03 14:05:28 +08:00

40 lines
1.2 KiB
C++

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* 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 "WaveDemuxer.h"
#include "MediaContainerType.h"
#include "WaveDecoder.h"
#include "PDMFactory.h"
namespace mozilla {
ChannelMediaDecoder*
WaveDecoder::Clone(MediaDecoderInit& aInit)
{
return new WaveDecoder(aInit);
}
/* static */ bool
WaveDecoder::IsSupportedType(const MediaContainerType& aContainerType)
{
if (!IsWaveEnabled()) {
return false;
}
if (aContainerType.Type() == MEDIAMIMETYPE("audio/wave")
|| aContainerType.Type() == MEDIAMIMETYPE("audio/x-wav")
|| aContainerType.Type() == MEDIAMIMETYPE("audio/wav")
|| aContainerType.Type() == MEDIAMIMETYPE("audio/x-pn-wav")) {
return (aContainerType.ExtendedType().Codecs().IsEmpty()
|| aContainerType.ExtendedType().Codecs() == "1"
|| aContainerType.ExtendedType().Codecs() == "6"
|| aContainerType.ExtendedType().Codecs() == "7");
}
return false;
}
} // namespace mozilla