Merge "libwvhidl: implement API to get plugin logs" into sc-dev
This commit is contained in:
@@ -10,6 +10,7 @@
|
|||||||
#include <android/hardware/drm/1.1/types.h>
|
#include <android/hardware/drm/1.1/types.h>
|
||||||
#include <android/hardware/drm/1.2/types.h>
|
#include <android/hardware/drm/1.2/types.h>
|
||||||
#include <android/hardware/drm/1.2/IDrmPluginListener.h>
|
#include <android/hardware/drm/1.2/IDrmPluginListener.h>
|
||||||
|
#include <android/hardware/drm/1.4/types.h>
|
||||||
#include <android/hardware/drm/1.4/ICryptoFactory.h>
|
#include <android/hardware/drm/1.4/ICryptoFactory.h>
|
||||||
#include <android/hardware/drm/1.4/ICryptoPlugin.h>
|
#include <android/hardware/drm/1.4/ICryptoPlugin.h>
|
||||||
#include <android/hardware/drm/1.4/IDrmFactory.h>
|
#include <android/hardware/drm/1.4/IDrmFactory.h>
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "log.h"
|
||||||
#include "media/stagefright/MediaErrors.h"
|
#include "media/stagefright/MediaErrors.h"
|
||||||
#include "HidlTypes.h"
|
#include "HidlTypes.h"
|
||||||
#include "utils/Errors.h"
|
#include "utils/Errors.h"
|
||||||
@@ -29,6 +30,23 @@ namespace drm {
|
|||||||
namespace V1_2 {
|
namespace V1_2 {
|
||||||
namespace widevine {
|
namespace widevine {
|
||||||
|
|
||||||
|
template<typename T, typename U>
|
||||||
|
hidl_vec<T> toHidlVec(const std::vector<U> &vec);
|
||||||
|
|
||||||
|
template<>
|
||||||
|
inline hidl_vec<::drm::V1_4::LogMessage> toHidlVec(const std::vector<wvcdm::LogMessage> &vec) {
|
||||||
|
hidl_vec<::drm::V1_4::LogMessage> hLogs(vec.size());
|
||||||
|
for (size_t i = 0; i < vec.size(); i++) {
|
||||||
|
const auto& msg = vec[i];
|
||||||
|
hLogs[i] = {
|
||||||
|
msg.time_ms_,
|
||||||
|
static_cast<::drm::V1_4::LogPriority>(msg.priority_),
|
||||||
|
msg.message_,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return hLogs;
|
||||||
|
}
|
||||||
|
|
||||||
template<typename T> const hidl_vec<T> toHidlVec(const std::vector<T> &vec) {
|
template<typename T> const hidl_vec<T> toHidlVec(const std::vector<T> &vec) {
|
||||||
hidl_vec<T> hVec;
|
hidl_vec<T> hVec;
|
||||||
hVec.setToExternal(const_cast<T *>(vec.data()), vec.size());
|
hVec.setToExternal(const_cast<T *>(vec.data()), vec.size());
|
||||||
|
|||||||
@@ -61,6 +61,9 @@ struct WVCryptoPlugin : public ::drm::V1_4::ICryptoPlugin {
|
|||||||
const DestinationBuffer& destination,
|
const DestinationBuffer& destination,
|
||||||
decrypt_1_2_cb _hidl_cb) override;
|
decrypt_1_2_cb _hidl_cb) override;
|
||||||
|
|
||||||
|
Return<void> getLogMessages(
|
||||||
|
getLogMessages_cb _hidl_cb) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
WVDRM_DISALLOW_COPY_AND_ASSIGN_AND_NEW(WVCryptoPlugin);
|
WVDRM_DISALLOW_COPY_AND_ASSIGN_AND_NEW(WVCryptoPlugin);
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ namespace drm {
|
|||||||
namespace V1_4 {
|
namespace V1_4 {
|
||||||
namespace widevine {
|
namespace widevine {
|
||||||
|
|
||||||
|
using android::hardware::drm::V1_2::widevine::toHidlVec;
|
||||||
using android::hardware::drm::V1_2::widevine::toVector;
|
using android::hardware::drm::V1_2::widevine::toVector;
|
||||||
using wvcdm::CdmDecryptionParametersV16;
|
using wvcdm::CdmDecryptionParametersV16;
|
||||||
using wvcdm::CdmDecryptionSample;
|
using wvcdm::CdmDecryptionSample;
|
||||||
@@ -348,6 +349,12 @@ Status_V1_2 WVCryptoPlugin::attemptDecrypt(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Return<void> WVCryptoPlugin::getLogMessages(getLogMessages_cb _hidl_cb) {
|
||||||
|
const std::vector<wvcdm::LogMessage> &logs(wvcdm::g_logbuf.getLogs());
|
||||||
|
_hidl_cb(::drm::V1_4::Status::OK, toHidlVec<::drm::V1_4::LogMessage>(logs));
|
||||||
|
return Void();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace widevine
|
} // namespace widevine
|
||||||
} // namespace V1_4
|
} // namespace V1_4
|
||||||
} // namespace drm
|
} // namespace drm
|
||||||
|
|||||||
@@ -220,6 +220,9 @@ struct WVDrmPlugin : public ::drm::V1_4::IDrmPlugin, IDrmPluginListener,
|
|||||||
Return<void> sendSessionLostState(
|
Return<void> sendSessionLostState(
|
||||||
const hidl_vec<uint8_t>& sessionId) override;
|
const hidl_vec<uint8_t>& sessionId) override;
|
||||||
|
|
||||||
|
Return<void> getLogMessages(
|
||||||
|
getLogMessages_cb _hidl_cb) override;
|
||||||
|
|
||||||
Return<bool> requiresSecureDecoder(const hidl_string& mime, SecurityLevel level)
|
Return<bool> requiresSecureDecoder(const hidl_string& mime, SecurityLevel level)
|
||||||
override;
|
override;
|
||||||
|
|
||||||
|
|||||||
@@ -1926,6 +1926,12 @@ Return<void> WVDrmPlugin::sendSessionLostState(
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Return<void> WVDrmPlugin::getLogMessages(getLogMessages_cb _hidl_cb) {
|
||||||
|
const std::vector<wvcdm::LogMessage> &logs(wvcdm::g_logbuf.getLogs());
|
||||||
|
_hidl_cb(::drm::V1_4::Status::OK, toHidlVec<::drm::V1_4::LogMessage>(logs));
|
||||||
|
return Void();
|
||||||
|
}
|
||||||
|
|
||||||
Return<bool> WVDrmPlugin::requiresSecureDecoder(
|
Return<bool> WVDrmPlugin::requiresSecureDecoder(
|
||||||
const hidl_string& mime, SecurityLevel level) {
|
const hidl_string& mime, SecurityLevel level) {
|
||||||
if (!strncasecmp(mime.c_str(), "video/", 6)) {
|
if (!strncasecmp(mime.c_str(), "video/", 6)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user