blob: 099240e53ae89da8442284d866acab7f3dc22039 [file] [log] [blame]
Corey Tabaka2251d822017-04-20 16:04:07 -07001#include "include/dvr/dvr_vsync.h"
2
3#include <utils/Log.h>
4
5#include <private/dvr/vsync_client.h>
6
7extern "C" {
8
9struct DvrVSyncClient {
10 std::unique_ptr<android::dvr::VSyncClient> client;
11};
12
13int 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
24void dvrVSyncClientDestroy(DvrVSyncClient* client) { delete client; }
25
26int 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"