2014-07-14 21:35:57 +00:00
|
|
|
// Copyright (c) 2012 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/network_util.h"
|
|
|
|
|
2014-09-19 20:41:13 +00:00
|
|
|
namespace edash_packager {
|
2014-07-14 21:35:57 +00:00
|
|
|
namespace media {
|
|
|
|
|
2014-09-30 21:52:21 +00:00
|
|
|
uint32_t ntohlFromBuffer(const unsigned char* buf) {
|
|
|
|
return (static_cast<uint32_t>(buf[0]) << 24) |
|
|
|
|
(static_cast<uint32_t>(buf[1]) << 16) |
|
|
|
|
(static_cast<uint32_t>(buf[2]) << 8) | (static_cast<uint32_t>(buf[3]));
|
2014-07-14 21:35:57 +00:00
|
|
|
}
|
|
|
|
|
2014-09-30 21:52:21 +00:00
|
|
|
uint16_t ntohsFromBuffer(const unsigned char* buf) {
|
|
|
|
return (static_cast<uint16_t>(buf[0]) << 8) | (static_cast<uint16_t>(buf[1]));
|
2014-07-14 21:35:57 +00:00
|
|
|
}
|
|
|
|
|
2014-09-30 21:52:21 +00:00
|
|
|
uint64_t ntohllFromBuffer(const unsigned char* buf) {
|
|
|
|
return (static_cast<uint64_t>(buf[0]) << 56) |
|
|
|
|
(static_cast<uint64_t>(buf[1]) << 48) |
|
|
|
|
(static_cast<uint64_t>(buf[2]) << 40) |
|
|
|
|
(static_cast<uint64_t>(buf[3]) << 32) |
|
|
|
|
(static_cast<uint64_t>(buf[4]) << 24) |
|
|
|
|
(static_cast<uint64_t>(buf[5]) << 16) |
|
|
|
|
(static_cast<uint64_t>(buf[6]) << 8) | (static_cast<uint64_t>(buf[7]));
|
2014-07-14 21:35:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace media
|
2014-09-19 20:41:13 +00:00
|
|
|
} // namespace edash_packager
|
2014-07-14 21:35:57 +00:00
|
|
|
|