upload android base code part6
This commit is contained in:
parent
421e214c7d
commit
4e516ec6ed
35396 changed files with 9188716 additions and 0 deletions
43
android/device/generic/goldfish/camera/GrallocModule.h
Normal file
43
android/device/generic/goldfish/camera/GrallocModule.h
Normal file
|
@ -0,0 +1,43 @@
|
|||
#ifndef EMU_CAMERA_GRALLOC_MODULE_H
|
||||
#define EMU_CAMERA_GRALLOC_MODULE_H
|
||||
|
||||
#include <hardware/gralloc.h>
|
||||
|
||||
class GrallocModule
|
||||
{
|
||||
public:
|
||||
static GrallocModule &getInstance() {
|
||||
static GrallocModule instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
int lock(buffer_handle_t handle,
|
||||
int usage, int l, int t, int w, int h, void **vaddr) {
|
||||
return mModule->lock(mModule, handle, usage, l, t, w, h, vaddr);
|
||||
}
|
||||
|
||||
#ifdef GRALLOC_MODULE_API_VERSION_0_2
|
||||
int lock_ycbcr(buffer_handle_t handle,
|
||||
int usage, int l, int t, int w, int h,
|
||||
struct android_ycbcr *ycbcr) {
|
||||
return mModule->lock_ycbcr(mModule, handle, usage, l, t, w, h, ycbcr);
|
||||
}
|
||||
#endif
|
||||
|
||||
int unlock(buffer_handle_t handle) {
|
||||
return mModule->unlock(mModule, handle);
|
||||
}
|
||||
|
||||
private:
|
||||
GrallocModule() {
|
||||
const hw_module_t *module = NULL;
|
||||
int ret = hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &module);
|
||||
if (ret) {
|
||||
ALOGE("%s: Failed to get gralloc module: %d", __FUNCTION__, ret);
|
||||
}
|
||||
mModule = reinterpret_cast<const gralloc_module_t*>(module);
|
||||
}
|
||||
const gralloc_module_t *mModule;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue