1 #include "include/dvr/dvr_vsync.h" 2 3 #include <utils/Log.h> 4 5 #include <private/dvr/vsync_client.h> 6 7 extern "C" { 8 9 struct DvrVSyncClient { 10 std::unique_ptr<android::dvr::VSyncClient> client; 11 }; 12 13 int dvrVSyncClientCreate(DvrVSyncClient** client_out) { 14 auto client = android::dvr::VSyncClient::Create(); 15 if (!client) { 16 ALOGE("dvrVSyncClientCreate: Failed to create vsync client!"); 17 return -EIO; 18 } 19 20 *client_out = new DvrVSyncClient{std::move(client)}; 21 return 0; 22 } 23 24 void dvrVSyncClientDestroy(DvrVSyncClient* client) { delete client; } 25 26 int dvrVSyncClientGetSchedInfo(DvrVSyncClient* client, int64_t* vsync_period_ns, 27 int64_t* next_timestamp_ns, 28 uint32_t* next_vsync_count) { 29 return client->client->GetSchedInfo(vsync_period_ns, next_timestamp_ns, 30 next_vsync_count); 31 } 32 33 } // extern "C" 34