Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/dom/media/flac/FlacDecoder.cpp
Line
Count
Source (jump to first uncovered line)
1
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
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 "FlacDecoder.h"
8
#include "MediaContainerType.h"
9
#include "mozilla/StaticPrefs.h"
10
11
namespace mozilla {
12
13
/* static */ bool
14
FlacDecoder::IsEnabled()
15
0
{
16
0
#ifdef MOZ_FFVPX
17
0
  return StaticPrefs::MediaFlacEnabled();
18
#else
19
  // Until bug 1295886 is fixed.
20
  return false;
21
#endif
22
}
23
24
/* static */ bool
25
FlacDecoder::IsSupportedType(const MediaContainerType& aContainerType)
26
0
{
27
0
  return IsEnabled() &&
28
0
         (aContainerType.Type() == MEDIAMIMETYPE("audio/flac") ||
29
0
          aContainerType.Type() == MEDIAMIMETYPE("audio/x-flac") ||
30
0
          aContainerType.Type() == MEDIAMIMETYPE("application/x-flac"));
31
0
}
32
33
/* static */ nsTArray<UniquePtr<TrackInfo>>
34
FlacDecoder::GetTracksInfo(const MediaContainerType& aType)
35
0
{
36
0
  nsTArray<UniquePtr<TrackInfo>> tracks;
37
0
  if (!IsSupportedType(aType)) {
38
0
    return tracks;
39
0
  }
40
0
41
0
  tracks.AppendElement(
42
0
    CreateTrackInfoWithMIMETypeAndContainerTypeExtraParameters(
43
0
      NS_LITERAL_CSTRING("audio/flac"), aType));
44
0
45
0
  return tracks;
46
0
}
47
48
} // namespace mozilla