dvr_configuration_data.cpp 995 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #include "include/dvr/dvr_configuration_data.h"
  2. #include <private/dvr/display_client.h>
  3. using android::dvr::display::ConfigFileType;
  4. using android::dvr::display::DisplayClient;
  5. extern "C" {
  6. int dvrConfigurationDataGet(int config_type, uint8_t** data,
  7. size_t* data_size) {
  8. if (!data || !data_size) {
  9. return -EINVAL;
  10. }
  11. auto client = DisplayClient::Create();
  12. if (!client) {
  13. ALOGE("dvrGetGlobalBuffer: Failed to create display client!");
  14. return -ECOMM;
  15. }
  16. ConfigFileType config_file_type = static_cast<ConfigFileType>(config_type);
  17. auto config_data_status =
  18. client->GetConfigurationData(config_file_type);
  19. if (!config_data_status) {
  20. return -config_data_status.error();
  21. }
  22. *data_size = config_data_status.get().size();
  23. *data = new uint8_t[*data_size];
  24. std::copy_n(config_data_status.get().begin(), *data_size, *data);
  25. return 0;
  26. }
  27. void dvrConfigurationDataDestroy(uint8_t* data) {
  28. delete[] data;
  29. }
  30. } // extern "C"