gecko-dev/dom/media/flac/FlacDecoder.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

45 lines
1.1 KiB
C++

/* -*- 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 "FlacDecoder.h"
#include "FlacDemuxer.h"
#include "MediaContainerType.h"
#include "MediaPrefs.h"
namespace mozilla {
ChannelMediaDecoder*
FlacDecoder::Clone(MediaDecoderInit& aInit)
{
if (!IsEnabled()) {
return nullptr;
}
return new FlacDecoder(aInit);
}
/* static */ bool
FlacDecoder::IsEnabled()
{
#ifdef MOZ_FFVPX
return MediaPrefs::FlacEnabled();
#else
// Until bug 1295886 is fixed.
return false;
#endif
}
/* static */ bool
FlacDecoder::IsSupportedType(const MediaContainerType& aContainerType)
{
return IsEnabled()
&& (aContainerType.Type() == MEDIAMIMETYPE("audio/flac")
|| aContainerType.Type() == MEDIAMIMETYPE("audio/x-flac")
|| aContainerType.Type() == MEDIAMIMETYPE("application/x-flac"));
}
} // namespace mozilla