2014-02-14 23:21:05 +00:00
|
|
|
// Copyright 2014 Google Inc. All rights reserved.
|
|
|
|
//
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file or at
|
|
|
|
// https://developers.google.com/open-source/licenses/bsd
|
2013-11-12 20:34:58 +00:00
|
|
|
|
2014-10-01 22:10:21 +00:00
|
|
|
#include "packager/media/base/key_source.h"
|
2013-11-12 20:34:58 +00:00
|
|
|
|
2016-02-19 20:23:37 +00:00
|
|
|
#include "packager/base/logging.h"
|
2014-01-13 19:34:08 +00:00
|
|
|
|
2016-05-20 21:19:33 +00:00
|
|
|
namespace shaka {
|
2013-11-12 20:34:58 +00:00
|
|
|
namespace media {
|
|
|
|
|
2014-04-15 22:18:26 +00:00
|
|
|
EncryptionKey::EncryptionKey() {}
|
|
|
|
EncryptionKey::~EncryptionKey() {}
|
2013-11-12 20:34:58 +00:00
|
|
|
|
2014-08-20 23:51:15 +00:00
|
|
|
KeySource::~KeySource() {}
|
2013-11-12 20:34:58 +00:00
|
|
|
|
2014-08-20 23:51:15 +00:00
|
|
|
KeySource::TrackType KeySource::GetTrackTypeFromString(
|
2014-04-15 22:18:26 +00:00
|
|
|
const std::string& track_type_string) {
|
|
|
|
if (track_type_string == "SD")
|
|
|
|
return TRACK_TYPE_SD;
|
|
|
|
if (track_type_string == "HD")
|
|
|
|
return TRACK_TYPE_HD;
|
2016-11-11 23:17:17 +00:00
|
|
|
if (track_type_string == "UHD1")
|
|
|
|
return TRACK_TYPE_UHD1;
|
|
|
|
if (track_type_string == "UHD2")
|
|
|
|
return TRACK_TYPE_UHD2;
|
2014-04-15 22:18:26 +00:00
|
|
|
if (track_type_string == "AUDIO")
|
|
|
|
return TRACK_TYPE_AUDIO;
|
2014-11-06 23:13:35 +00:00
|
|
|
if (track_type_string == "UNSPECIFIED")
|
|
|
|
return TRACK_TYPE_UNSPECIFIED;
|
2014-04-15 22:18:26 +00:00
|
|
|
LOG(WARNING) << "Unexpected track type: " << track_type_string;
|
|
|
|
return TRACK_TYPE_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
2014-08-20 23:51:15 +00:00
|
|
|
std::string KeySource::TrackTypeToString(TrackType track_type) {
|
2014-04-15 22:18:26 +00:00
|
|
|
switch (track_type) {
|
|
|
|
case TRACK_TYPE_SD:
|
|
|
|
return "SD";
|
|
|
|
case TRACK_TYPE_HD:
|
|
|
|
return "HD";
|
2016-11-11 23:17:17 +00:00
|
|
|
case TRACK_TYPE_UHD1:
|
|
|
|
return "UHD1";
|
|
|
|
case TRACK_TYPE_UHD2:
|
|
|
|
return "UHD2";
|
2014-04-15 22:18:26 +00:00
|
|
|
case TRACK_TYPE_AUDIO:
|
|
|
|
return "AUDIO";
|
|
|
|
default:
|
|
|
|
NOTIMPLEMENTED() << "Unknown track type: " << track_type;
|
|
|
|
return "UNKNOWN";
|
2014-01-13 19:34:08 +00:00
|
|
|
}
|
2014-04-15 22:18:26 +00:00
|
|
|
}
|
|
|
|
|
2014-08-20 23:51:15 +00:00
|
|
|
KeySource::KeySource() {}
|
2014-01-13 19:34:08 +00:00
|
|
|
|
2013-11-12 20:34:58 +00:00
|
|
|
} // namespace media
|
2016-05-20 21:19:33 +00:00
|
|
|
} // namespace shaka
|