summaryrefslogtreecommitdiff
path: root/chromium/media/base/text_track_config.cc
blob: a736883b956b03f5b815543390f4e53ae86643b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "media/base/text_track_config.h"

namespace media {

TextTrackConfig::TextTrackConfig()
    : kind_(kTextNone) {
}

TextTrackConfig::TextTrackConfig(TextKind kind,
                                 const std::string& label,
                                 const std::string& language,
                                 const std::string& id)
    : kind_(kind),
      label_(label),
      language_(language),
      id_(id) {
}

TextTrackConfig::TextTrackConfig(const TextTrackConfig&) = default;

TextTrackConfig& TextTrackConfig::operator=(const TextTrackConfig&) = default;

bool TextTrackConfig::Matches(const TextTrackConfig& config) const {
  return config.kind() == kind_ &&
         config.label() == label_ &&
         config.language() == language_ &&
         config.id() == id_;
}

// static
TextKind TextTrackConfig::ConvertKind(const std::string& str) {
  if (str == "subtitles")
    return kTextSubtitles;
  if (str == "captions")
    return kTextCaptions;
  if (str == "descriptions")
    return kTextDescriptions;
  if (str == "chapters")
    return kTextChapters;
  if (str == "metadata")
    return kTextMetadata;
  return kTextNone;
}

}  // namespace media