michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim:set ts=2 sw=2 sts=2 et cindent: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "DirectShowDecoder.h" michael@0: #include "DirectShowReader.h" michael@0: #include "MediaDecoderStateMachine.h" michael@0: #include "mozilla/Preferences.h" michael@0: #include "mozilla/WindowsVersion.h" michael@0: michael@0: namespace mozilla { michael@0: michael@0: MediaDecoderStateMachine* DirectShowDecoder::CreateStateMachine() michael@0: { michael@0: return new MediaDecoderStateMachine(this, new DirectShowReader(this)); michael@0: } michael@0: michael@0: /* static */ michael@0: bool michael@0: DirectShowDecoder::GetSupportedCodecs(const nsACString& aType, michael@0: char const *const ** aCodecList) michael@0: { michael@0: if (!IsEnabled()) { michael@0: return false; michael@0: } michael@0: michael@0: static char const *const mp3AudioCodecs[] = { michael@0: "mp3", michael@0: nullptr michael@0: }; michael@0: if (aType.EqualsASCII("audio/mpeg") || michael@0: aType.EqualsASCII("audio/mp3")) { michael@0: if (aCodecList) { michael@0: *aCodecList = mp3AudioCodecs; michael@0: } michael@0: return true; michael@0: } michael@0: michael@0: return false; michael@0: } michael@0: michael@0: /* static */ michael@0: bool michael@0: DirectShowDecoder::IsEnabled() michael@0: { michael@0: return Preferences::GetBool("media.directshow.enabled"); michael@0: } michael@0: michael@0: DirectShowDecoder::DirectShowDecoder() michael@0: { michael@0: MOZ_COUNT_CTOR(DirectShowDecoder); michael@0: } michael@0: michael@0: DirectShowDecoder::~DirectShowDecoder() michael@0: { michael@0: MOZ_COUNT_DTOR(DirectShowDecoder); michael@0: } michael@0: michael@0: } // namespace mozilla michael@0: