DASH Media Packaging SDK
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
key_source.cc
1 // Copyright 2014 Google Inc. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 
7 #include "packager/media/base/key_source.h"
8 
9 #include "packager/base/logging.h"
10 
11 namespace shaka {
12 namespace media {
13 
14 EncryptionKey::EncryptionKey() {}
15 EncryptionKey::~EncryptionKey() {}
16 
17 KeySource::~KeySource() {}
18 
19 KeySource::TrackType KeySource::GetTrackTypeFromString(
20  const std::string& track_type_string) {
21  if (track_type_string == "SD")
22  return TRACK_TYPE_SD;
23  if (track_type_string == "HD")
24  return TRACK_TYPE_HD;
25  if (track_type_string == "UHD1")
26  return TRACK_TYPE_UHD1;
27  if (track_type_string == "UHD2")
28  return TRACK_TYPE_UHD2;
29  if (track_type_string == "AUDIO")
30  return TRACK_TYPE_AUDIO;
31  if (track_type_string == "UNSPECIFIED")
32  return TRACK_TYPE_UNSPECIFIED;
33  LOG(WARNING) << "Unexpected track type: " << track_type_string;
34  return TRACK_TYPE_UNKNOWN;
35 }
36 
37 std::string KeySource::TrackTypeToString(TrackType track_type) {
38  switch (track_type) {
39  case TRACK_TYPE_SD:
40  return "SD";
41  case TRACK_TYPE_HD:
42  return "HD";
43  case TRACK_TYPE_UHD1:
44  return "UHD1";
45  case TRACK_TYPE_UHD2:
46  return "UHD2";
47  case TRACK_TYPE_AUDIO:
48  return "AUDIO";
49  default:
50  NOTIMPLEMENTED() << "Unknown track type: " << track_type;
51  return "UNKNOWN";
52  }
53 }
54 
55 KeySource::KeySource() {}
56 
57 } // namespace media
58 } // namespace shaka
static std::string TrackTypeToString(TrackType track_type)
Convert TrackType to string.
Definition: key_source.cc:37
static TrackType GetTrackTypeFromString(const std::string &track_type_string)
Convert string representation of track type to enum representation.
Definition: key_source.cc:19