50 lines
1.5 KiB
C++
50 lines
1.5 KiB
C++
//
|
|
// Copyright 2021 Google LLC. All Rights Reserved. This file and proprietary
|
|
// source code may only be used and distributed under the Widevine License
|
|
// Agreement.
|
|
//
|
|
|
|
#ifndef WV_UTILS_H_
|
|
#define WV_UTILS_H_
|
|
|
|
#include <aidl/android/hardware/drm/LogPriority.h>
|
|
#include <aidl/android/hardware/drm/Status.h>
|
|
#include <android/binder_auto_utils.h>
|
|
|
|
#include "WVTypes.h"
|
|
#include "log.h"
|
|
|
|
namespace wvdrm {
|
|
|
|
inline ::aidl::android::hardware::drm::LogPriority toAidlLogPriority(
|
|
wvutil::LogPriority p) {
|
|
switch (p) {
|
|
case wvutil::LogPriority::CDM_LOG_ERROR:
|
|
return ::aidl::android::hardware::drm::LogPriority::ERROR;
|
|
case wvutil::LogPriority::CDM_LOG_WARN:
|
|
return ::aidl::android::hardware::drm::LogPriority::WARN;
|
|
case wvutil::LogPriority::CDM_LOG_INFO:
|
|
return ::aidl::android::hardware::drm::LogPriority::INFO;
|
|
case wvutil::LogPriority::CDM_LOG_DEBUG:
|
|
return ::aidl::android::hardware::drm::LogPriority::DEBUG;
|
|
case wvutil::LogPriority::CDM_LOG_VERBOSE:
|
|
return ::aidl::android::hardware::drm::LogPriority::VERBOSE;
|
|
default:
|
|
return ::aidl::android::hardware::drm::LogPriority::UNKNOWN;
|
|
}
|
|
}
|
|
|
|
::ndk::ScopedAStatus toNdkScopedAStatus(::wvdrm::WvStatus status,
|
|
const char* msg = nullptr);
|
|
|
|
inline ::ndk::ScopedAStatus toNdkScopedAStatus(
|
|
::aidl::android::hardware::drm::Status status, const char* msg = nullptr) {
|
|
return toNdkScopedAStatus(::wvdrm::WvStatus(status), msg);
|
|
}
|
|
|
|
bool checkIfEnableMultiThreadBinder();
|
|
|
|
} // namespace wvdrm
|
|
|
|
#endif // WV_UTILS_H_
|