Loading camera/Android.mk +1 −1 Original line number Diff line number Diff line Loading @@ -50,7 +50,7 @@ LOCAL_SHARED_LIBRARIES := \ LOCAL_C_INCLUDES += \ system/media/camera/include \ system/media/private/camera/include system/media/private/camera/include \ LOCAL_MODULE:= libcamera_client Loading camera/CameraParameters.cpp +42 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ #include <string.h> #include <stdlib.h> #include <camera/CameraParameters.h> #include <system/graphics.h> namespace android { // Parameter keys to communicate between camera application and driver. Loading Loading @@ -483,4 +484,45 @@ status_t CameraParameters::dump(int fd, const Vector<String16>& args) const return NO_ERROR; } void CameraParameters::getSupportedPreviewFormats(Vector<int>& formats) const { const char* supportedPreviewFormats = get(CameraParameters::KEY_SUPPORTED_PREVIEW_FORMATS); String8 fmtStr(supportedPreviewFormats); char* prevFmts = fmtStr.lockBuffer(fmtStr.size()); char* savePtr; char* fmt = strtok_r(prevFmts, ",", &savePtr); while (fmt) { int actual = previewFormatToEnum(fmt); if (actual != -1) { formats.add(actual); } fmt = strtok_r(NULL, ",", &savePtr); } fmtStr.unlockBuffer(fmtStr.size()); } int CameraParameters::previewFormatToEnum(const char* format) { return !format ? HAL_PIXEL_FORMAT_YCrCb_420_SP : !strcmp(format, PIXEL_FORMAT_YUV422SP) ? HAL_PIXEL_FORMAT_YCbCr_422_SP : // NV16 !strcmp(format, PIXEL_FORMAT_YUV420SP) ? HAL_PIXEL_FORMAT_YCrCb_420_SP : // NV21 !strcmp(format, PIXEL_FORMAT_YUV422I) ? HAL_PIXEL_FORMAT_YCbCr_422_I : // YUY2 !strcmp(format, PIXEL_FORMAT_YUV420P) ? HAL_PIXEL_FORMAT_YV12 : // YV12 !strcmp(format, PIXEL_FORMAT_RGB565) ? HAL_PIXEL_FORMAT_RGB_565 : // RGB565 !strcmp(format, PIXEL_FORMAT_RGBA8888) ? HAL_PIXEL_FORMAT_RGBA_8888 : // RGB8888 !strcmp(format, PIXEL_FORMAT_BAYER_RGGB) ? HAL_PIXEL_FORMAT_RAW_SENSOR : // Raw sensor data -1; } }; // namespace android camera/camera2/ICameraDeviceUser.cpp +35 −1 Original line number Diff line number Diff line Loading @@ -42,7 +42,9 @@ enum { CREATE_DEFAULT_REQUEST, GET_CAMERA_INFO, WAIT_UNTIL_IDLE, FLUSH FLUSH, BEGIN_CONFIGURE, END_CONFIGURE }; namespace { Loading Loading @@ -283,6 +285,26 @@ public: return res; } virtual status_t beginConfigure() { ALOGV("beginConfigure"); Parcel data, reply; data.writeInterfaceToken(ICameraDeviceUser::getInterfaceDescriptor()); remote()->transact(BEGIN_CONFIGURE, data, &reply); reply.readExceptionCode(); return reply.readInt32(); } virtual status_t endConfigure() { ALOGV("endConfigure"); Parcel data, reply; data.writeInterfaceToken(ICameraDeviceUser::getInterfaceDescriptor()); remote()->transact(END_CONFIGURE, data, &reply); reply.readExceptionCode(); return reply.readInt32(); } private: Loading Loading @@ -456,6 +478,18 @@ status_t BnCameraDeviceUser::onTransact( reply->writeInt64(lastFrameNumber); return NO_ERROR; } case BEGIN_CONFIGURE: { CHECK_INTERFACE(ICameraDeviceUser, data, reply); reply->writeNoException(); reply->writeInt32(beginConfigure()); return NO_ERROR; } break; case END_CONFIGURE: { CHECK_INTERFACE(ICameraDeviceUser, data, reply); reply->writeNoException(); reply->writeInt32(endConfigure()); return NO_ERROR; } break; default: return BBinder::onTransact(code, data, reply, flags); } Loading include/camera/CameraParameters.h +13 −0 Original line number Diff line number Diff line Loading @@ -102,6 +102,12 @@ public: void dump() const; status_t dump(int fd, const Vector<String16>& args) const; /** * Returns a Vector containing the supported preview formats * as enums given in graphics.h. */ void getSupportedPreviewFormats(Vector<int>& formats) const; // Parameter keys to communicate between camera application and driver. // The access (read/write, read only, or write only) is viewed from the // perspective of applications, not driver. Loading Loading @@ -674,6 +680,13 @@ public: // High-dynamic range mode static const char LIGHTFX_HDR[]; /** * Returns the the supported preview formats as an enum given in graphics.h * corrsponding to the format given in the input string or -1 if no such * conversion exists. */ static int previewFormatToEnum(const char* format); private: DefaultKeyedVector<String8,String8> mMap; }; Loading include/camera/camera2/ICameraDeviceUser.h +21 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,27 @@ public: /*out*/ int64_t* lastFrameNumber = NULL) = 0; /** * Begin the device configuration. * * <p> * beginConfigure must be called before any call to deleteStream, createStream, * or endConfigure. It is not valid to call this when the device is not idle. * <p> */ virtual status_t beginConfigure() = 0; /** * End the device configuration. * * <p> * endConfigure must be called after stream configuration is complete (i.e. after * a call to beginConfigure and subsequent createStream/deleteStream calls). This * must be called before any requests can be submitted. * <p> */ virtual status_t endConfigure() = 0; virtual status_t deleteStream(int streamId) = 0; virtual status_t createStream( int width, int height, int format, Loading Loading
camera/Android.mk +1 −1 Original line number Diff line number Diff line Loading @@ -50,7 +50,7 @@ LOCAL_SHARED_LIBRARIES := \ LOCAL_C_INCLUDES += \ system/media/camera/include \ system/media/private/camera/include system/media/private/camera/include \ LOCAL_MODULE:= libcamera_client Loading
camera/CameraParameters.cpp +42 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ #include <string.h> #include <stdlib.h> #include <camera/CameraParameters.h> #include <system/graphics.h> namespace android { // Parameter keys to communicate between camera application and driver. Loading Loading @@ -483,4 +484,45 @@ status_t CameraParameters::dump(int fd, const Vector<String16>& args) const return NO_ERROR; } void CameraParameters::getSupportedPreviewFormats(Vector<int>& formats) const { const char* supportedPreviewFormats = get(CameraParameters::KEY_SUPPORTED_PREVIEW_FORMATS); String8 fmtStr(supportedPreviewFormats); char* prevFmts = fmtStr.lockBuffer(fmtStr.size()); char* savePtr; char* fmt = strtok_r(prevFmts, ",", &savePtr); while (fmt) { int actual = previewFormatToEnum(fmt); if (actual != -1) { formats.add(actual); } fmt = strtok_r(NULL, ",", &savePtr); } fmtStr.unlockBuffer(fmtStr.size()); } int CameraParameters::previewFormatToEnum(const char* format) { return !format ? HAL_PIXEL_FORMAT_YCrCb_420_SP : !strcmp(format, PIXEL_FORMAT_YUV422SP) ? HAL_PIXEL_FORMAT_YCbCr_422_SP : // NV16 !strcmp(format, PIXEL_FORMAT_YUV420SP) ? HAL_PIXEL_FORMAT_YCrCb_420_SP : // NV21 !strcmp(format, PIXEL_FORMAT_YUV422I) ? HAL_PIXEL_FORMAT_YCbCr_422_I : // YUY2 !strcmp(format, PIXEL_FORMAT_YUV420P) ? HAL_PIXEL_FORMAT_YV12 : // YV12 !strcmp(format, PIXEL_FORMAT_RGB565) ? HAL_PIXEL_FORMAT_RGB_565 : // RGB565 !strcmp(format, PIXEL_FORMAT_RGBA8888) ? HAL_PIXEL_FORMAT_RGBA_8888 : // RGB8888 !strcmp(format, PIXEL_FORMAT_BAYER_RGGB) ? HAL_PIXEL_FORMAT_RAW_SENSOR : // Raw sensor data -1; } }; // namespace android
camera/camera2/ICameraDeviceUser.cpp +35 −1 Original line number Diff line number Diff line Loading @@ -42,7 +42,9 @@ enum { CREATE_DEFAULT_REQUEST, GET_CAMERA_INFO, WAIT_UNTIL_IDLE, FLUSH FLUSH, BEGIN_CONFIGURE, END_CONFIGURE }; namespace { Loading Loading @@ -283,6 +285,26 @@ public: return res; } virtual status_t beginConfigure() { ALOGV("beginConfigure"); Parcel data, reply; data.writeInterfaceToken(ICameraDeviceUser::getInterfaceDescriptor()); remote()->transact(BEGIN_CONFIGURE, data, &reply); reply.readExceptionCode(); return reply.readInt32(); } virtual status_t endConfigure() { ALOGV("endConfigure"); Parcel data, reply; data.writeInterfaceToken(ICameraDeviceUser::getInterfaceDescriptor()); remote()->transact(END_CONFIGURE, data, &reply); reply.readExceptionCode(); return reply.readInt32(); } private: Loading Loading @@ -456,6 +478,18 @@ status_t BnCameraDeviceUser::onTransact( reply->writeInt64(lastFrameNumber); return NO_ERROR; } case BEGIN_CONFIGURE: { CHECK_INTERFACE(ICameraDeviceUser, data, reply); reply->writeNoException(); reply->writeInt32(beginConfigure()); return NO_ERROR; } break; case END_CONFIGURE: { CHECK_INTERFACE(ICameraDeviceUser, data, reply); reply->writeNoException(); reply->writeInt32(endConfigure()); return NO_ERROR; } break; default: return BBinder::onTransact(code, data, reply, flags); } Loading
include/camera/CameraParameters.h +13 −0 Original line number Diff line number Diff line Loading @@ -102,6 +102,12 @@ public: void dump() const; status_t dump(int fd, const Vector<String16>& args) const; /** * Returns a Vector containing the supported preview formats * as enums given in graphics.h. */ void getSupportedPreviewFormats(Vector<int>& formats) const; // Parameter keys to communicate between camera application and driver. // The access (read/write, read only, or write only) is viewed from the // perspective of applications, not driver. Loading Loading @@ -674,6 +680,13 @@ public: // High-dynamic range mode static const char LIGHTFX_HDR[]; /** * Returns the the supported preview formats as an enum given in graphics.h * corrsponding to the format given in the input string or -1 if no such * conversion exists. */ static int previewFormatToEnum(const char* format); private: DefaultKeyedVector<String8,String8> mMap; }; Loading
include/camera/camera2/ICameraDeviceUser.h +21 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,27 @@ public: /*out*/ int64_t* lastFrameNumber = NULL) = 0; /** * Begin the device configuration. * * <p> * beginConfigure must be called before any call to deleteStream, createStream, * or endConfigure. It is not valid to call this when the device is not idle. * <p> */ virtual status_t beginConfigure() = 0; /** * End the device configuration. * * <p> * endConfigure must be called after stream configuration is complete (i.e. after * a call to beginConfigure and subsequent createStream/deleteStream calls). This * must be called before any requests can be submitted. * <p> */ virtual status_t endConfigure() = 0; virtual status_t deleteStream(int streamId) = 0; virtual status_t createStream( int width, int height, int format, Loading