1 #include "include/dvr/dvr_api.h" 2 3 #include <errno.h> 4 #include <utils/Log.h> 5 6 // Headers from libdvr 7 #include <dvr/dvr_buffer.h> 8 #include <dvr/dvr_buffer_queue.h> 9 #include <dvr/dvr_display_manager.h> 10 #include <dvr/dvr_surface.h> 11 #include <dvr/dvr_vsync.h> 12 13 // Headers not yet moved into libdvr. 14 // TODO(jwcai) Move these once their callers are moved into Google3. 15 #include <dvr/dvr_hardware_composer_client.h> 16 #include <dvr/pose_client.h> 17 #include <dvr/virtual_touchpad_client.h> 18 19 extern "C" { 20 21 int dvrGetApi(void* api, size_t struct_size, int version) { 22 ALOGI("dvrGetApi: api=%p struct_size=%zu version=%d", api, struct_size, 23 version); 24 if (version == 1) { 25 if (struct_size != sizeof(DvrApi_v1)) { 26 ALOGE("dvrGetApi: Size mismatch: expected %zu; actual %zu", 27 sizeof(DvrApi_v1), struct_size); 28 return -EINVAL; 29 } 30 DvrApi_v1* dvr_api = static_cast<DvrApi_v1*>(api); 31 32 // Defines an API entry for V1 (no version suffix). 33 #define DVR_V1_API_ENTRY(name) dvr_api->name = dvr##name 34 35 #include "include/dvr/dvr_api_entries.h" 36 37 // Undefine macro definitions to play nice with Google3 style rules. 38 #undef DVR_V1_API_ENTRY 39 40 return 0; 41 } 42 43 ALOGE("dvrGetApi: Unknown API version=%d", version); 44 return -EINVAL; 45 } 46 47 } // extern "C" 48