Line data Source code
1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim:set ts=2 sw=2 sts=2 et cindent: */
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/. */
6 :
7 : #include "WaveDemuxer.h"
8 : #include "MediaContainerType.h"
9 : #include "MediaDecoderStateMachine.h"
10 : #include "WaveDecoder.h"
11 : #include "MediaFormatReader.h"
12 : #include "PDMFactory.h"
13 :
14 : namespace mozilla {
15 :
16 : ChannelMediaDecoder*
17 0 : WaveDecoder::Clone(MediaDecoderInit& aInit)
18 : {
19 0 : return new WaveDecoder(aInit);
20 : }
21 :
22 : MediaDecoderStateMachine*
23 0 : WaveDecoder::CreateStateMachine()
24 : {
25 0 : MediaDecoderReaderInit init(this);
26 0 : mReader = new MediaFormatReader(init, new WAVDemuxer(mResource));
27 0 : return new MediaDecoderStateMachine(this, mReader);
28 : }
29 :
30 : /* static */ bool
31 0 : WaveDecoder::IsSupportedType(const MediaContainerType& aContainerType)
32 : {
33 0 : if (!IsWaveEnabled()) {
34 0 : return false;
35 : }
36 0 : if (aContainerType.Type() == MEDIAMIMETYPE("audio/wave")
37 0 : || aContainerType.Type() == MEDIAMIMETYPE("audio/x-wav")
38 0 : || aContainerType.Type() == MEDIAMIMETYPE("audio/wav")
39 0 : || aContainerType.Type() == MEDIAMIMETYPE("audio/x-pn-wav")) {
40 0 : return (aContainerType.ExtendedType().Codecs().IsEmpty()
41 0 : || aContainerType.ExtendedType().Codecs() == "1"
42 0 : || aContainerType.ExtendedType().Codecs() == "6"
43 0 : || aContainerType.ExtendedType().Codecs() == "7");
44 : }
45 :
46 0 : return false;
47 : }
48 :
49 : } // namespace mozilla
|