DASH Media Packaging SDK
 All Classes Namespaces Functions Variables Typedefs 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 edash_packager {
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 == "AUDIO")
26  return TRACK_TYPE_AUDIO;
27  if (track_type_string == "UNSPECIFIED")
28  return TRACK_TYPE_UNSPECIFIED;
29  LOG(WARNING) << "Unexpected track type: " << track_type_string;
30  return TRACK_TYPE_UNKNOWN;
31 }
32 
33 std::string KeySource::TrackTypeToString(TrackType track_type) {
34  switch (track_type) {
35  case TRACK_TYPE_SD:
36  return "SD";
37  case TRACK_TYPE_HD:
38  return "HD";
39  case TRACK_TYPE_AUDIO:
40  return "AUDIO";
41  default:
42  NOTIMPLEMENTED() << "Unknown track type: " << track_type;
43  return "UNKNOWN";
44  }
45 }
46 
47 KeySource::KeySource() {}
48 
49 } // namespace media
50 } // namespace edash_packager
static TrackType GetTrackTypeFromString(const std::string &track_type_string)
Convert string representation of track type to enum representation.
Definition: key_source.cc:19
static std::string TrackTypeToString(TrackType track_type)
Convert TrackType to string.
Definition: key_source.cc:33