Files
ce_cdm/factory_upload_tool/ce/example_main.cpp
2025-04-02 10:27:18 -07:00

53 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.
#include <iostream>
#include "log.h"
#include "wv_factory_extractor.h"
int main(int argc, char* argv[]) {
widevine::ClientInfo client_info;
// REQUIRED: Replace with your own values.
// client_info.company_name = "<company_name>";
// client_info.arch_name = "<arch_name>";
// client_info.device_name = "<device_name>";
// client_info.model_name = "<model_name>";
// client_info.product_name = "<product_name>";
// client_info.build_info = "<build_info>";
auto extractor = widevine::WidevineFactoryExtractor::Create(client_info);
if (extractor == nullptr) {
LOGE("Failed to create WidevineFactoryExtractor");
return 1;
}
std::string request;
widevine::Status status = extractor->GenerateUploadRequest(request);
if (status != widevine::Status::kSuccess) {
LOGE("Fail to generate upload request: %d", status);
return 2;
}
std::cout << request << std::endl;
for (int i = 1; i < argc; ++i) {
std::string arg = argv[i];
if (arg == "--validate" || arg == "-v") {
#ifdef USE_VALIDATOR
std::string validation_out;
status = extractor->ValidateBcc(validation_out);
if (status != widevine::Status::kSuccess) {
LOGE("Fail to run validation: %d", status);
return 2;
}
std::cout << "\n--BCC VALIDATION--" << std::endl;
std::cout << validation_out << std::endl;
#endif
break;
}
}
return 0;
}