EmulatedCamera::EmulatedCamera(int cameraId, struct hw_module_t* module) : EmulatedBaseCamera(cameraId, HARDWARE_DEVICE_API_VERSION(1, 0), &common, module), mPreviewWindow(), mCallbackNotifier() { /* camera_device v1 fields. */ common.close = EmulatedCamera::close; ops = &mDeviceOps; priv = this; }
static int HAL_getCameraInfo(int cameraId, struct camera_info *info) { ExynosCameraAutoTimer autoTimer(__func__); ALOGV("DEBUG(%s):", __func__); if (cameraId < 0 || cameraId >= HAL_getNumberOfCameras()) { ALOGE("ERR(%s):Invalid camera ID %d", __func__, cameraId); return -EINVAL; } memcpy(info, &sCameraInfo[cameraId], sizeof(CameraInfo)); info->device_version = HARDWARE_DEVICE_API_VERSION(1, 0); return NO_ERROR; }
bool pa_conversion_parse_version(const char *fn, const unsigned ln, const char *str, uint32_t *version) { uint32_t version_maj; uint32_t version_min; pa_assert(fn); pa_assert(str); pa_assert(version); if ((sscanf(str, "%u.%u", &version_maj, &version_min)) != 2) { pa_log("[%s:%u] Failed to parse %s (%s).", fn, ln, AUDIO_HAL_VERSION_TAG, str); return false; } else { *version = HARDWARE_DEVICE_API_VERSION(version_maj, version_min); return true; } }
static int amp_module_open(const hw_module_t *module, UNUSED const char *name, hw_device_t **device) { if (m7_dev) { ALOGE("%s:%d: Unable to open second instance of TFA9887 amplifier\n", __func__, __LINE__); return -EBUSY; } m7_dev = calloc(1, sizeof(m7_device_t)); if (!m7_dev) { ALOGE("%s:%d: Unable to allocate memory for amplifier device\n", __func__, __LINE__); return -ENOMEM; } m7_dev->amp_dev.common.tag = HARDWARE_DEVICE_TAG; m7_dev->amp_dev.common.module = (hw_module_t *) module; m7_dev->amp_dev.common.version = HARDWARE_DEVICE_API_VERSION(1, 0); m7_dev->amp_dev.common.close = amp_dev_close; m7_dev->amp_dev.set_input_devices = NULL; m7_dev->amp_dev.set_output_devices = amp_set_output_devices; m7_dev->amp_dev.enable_input_devices = NULL; m7_dev->amp_dev.enable_output_devices = amp_enable_output_devices; m7_dev->amp_dev.set_mode = amp_set_mode; m7_dev->amp_dev.output_stream_start = NULL; m7_dev->amp_dev.input_stream_start = NULL; m7_dev->amp_dev.output_stream_standby = NULL; m7_dev->amp_dev.input_stream_standby = NULL; m7_dev->current_mode = AUDIO_MODE_NORMAL; *device = (hw_device_t *) m7_dev; tfa9887_open(); return 0; }