From: Stricted Date: Tue, 1 May 2018 14:18:05 +0000 (+0200) Subject: add another camera patch X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b58455c344b7658619d764ca0c15f110363fe0d4;p=GitHub%2Fmt8127%2Fandroid_device_alcatel_ttab.git add another camera patch Change-Id: I4ea2d0b490ffa6b5a9940dcbe0ee75b0bc4f5aa9 --- diff --git a/patches/frameworks/av/0002-Implement-MediaTek-Camera-Support.patch b/patches/frameworks/av/0002-Implement-MediaTek-Camera-Support.patch new file mode 100644 index 0000000..128071c --- /dev/null +++ b/patches/frameworks/av/0002-Implement-MediaTek-Camera-Support.patch @@ -0,0 +1,799 @@ +From 3ed5dd81041727ea352fc3e85a197311bd917577 Mon Sep 17 00:00:00 2001 +From: adi766 +Date: Sat, 23 Sep 2017 15:56:27 +0000 +Subject: [PATCH] Implement MediaTek Camera Support + +Change-Id: Iaae7c60d6711c6af53e59b966d2548c9cad8dfab +--- + camera/Android.mk | 5 + + camera/MtkCameraParameters.cpp | 294 +++++++++++++++++ + include/camera/MtkCameraParameters.h | 351 +++++++++++++++++++++ + .../libstagefright/foundation/MediaBufferGroup.cpp | 6 + + services/camera/libcameraservice/Android.mk | 4 + + .../camera/libcameraservice/api1/CameraClient.cpp | 42 +++ + 6 files changed, 702 insertions(+) + create mode 100644 camera/MtkCameraParameters.cpp + create mode 100644 include/camera/MtkCameraParameters.h + +diff --git a/camera/Android.mk b/camera/Android.mk +index 8a32299fa..8ba0e610f 100644 +--- a/camera/Android.mk ++++ b/camera/Android.mk +@@ -52,6 +52,11 @@ LOCAL_SRC_FILES += \ + CameraUtils.cpp \ + VendorTagDescriptor.cpp + ++ifeq ($(BOARD_HAS_MTK_HARDWARE),true) ++LOCAL_SRC_FILES+= \ ++ MtkCameraParameters.cpp ++endif ++ + LOCAL_SHARED_LIBRARIES := \ + libcutils \ + libutils \ +diff --git a/camera/MtkCameraParameters.cpp b/camera/MtkCameraParameters.cpp +new file mode 100644 +index 000000000..7d7042aad +--- /dev/null ++++ b/camera/MtkCameraParameters.cpp +@@ -0,0 +1,294 @@ ++/* ++ * ++ * Copyright 2008, The Android Open Source Project ++ * ++ * Licensed under the Apache License, Version 2.0 (the "License"); ++ * you may not use this file except in compliance with the License. ++ * You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++ ++#define LOG_TAG "MTKCameraParams" ++#include ++ ++#include ++#include ++#include ++ ++namespace android { ++ ++ ++//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++// App Mode. ++//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++const char MtkCameraParameters::PROPERTY_KEY_CLIENT_APPMODE[] = "client.appmode"; ++// ++const char MtkCameraParameters::APP_MODE_NAME_DEFAULT[] = "Default"; ++const char MtkCameraParameters::APP_MODE_NAME_MTK_ENG[] = "MtkEng"; ++const char MtkCameraParameters::APP_MODE_NAME_MTK_ATV[] = "MtkAtv"; ++const char MtkCameraParameters::APP_MODE_NAME_MTK_S3D[] = "MtkS3d"; ++const char MtkCameraParameters::APP_MODE_NAME_MTK_VT[] = "MtkVt"; ++const char MtkCameraParameters::APP_MODE_NAME_MTK_PHOTO[] = "MtkPhoto"; ++const char MtkCameraParameters::APP_MODE_NAME_MTK_VIDEO[] = "MtkVideo"; ++const char MtkCameraParameters::APP_MODE_NAME_MTK_ZSD[] = "MtkZsd"; ++ ++//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++// Scene Mode ++//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++const char MtkCameraParameters::SCENE_MODE_NORMAL[] = "normal"; ++ ++//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++// Face Beauty ++//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++const char MtkCameraParameters::KEY_FB_SMOOTH_LEVEL[] = "fb-smooth-level"; ++const char MtkCameraParameters::KEY_FB_SMOOTH_LEVEL_MIN[] = "fb-smooth-level-min"; ++const char MtkCameraParameters::KEY_FB_SMOOTH_LEVEL_MAX[] = "fb-smooth-level-max"; ++// ++const char MtkCameraParameters::KEY_FB_SKIN_COLOR[] = "fb-skin-color"; ++const char MtkCameraParameters::KEY_FB_SKIN_COLOR_MIN[] = "fb-skin-color-min"; ++const char MtkCameraParameters::KEY_FB_SKIN_COLOR_MAX[] = "fb-skin-color-max"; ++// ++const char MtkCameraParameters::KEY_FB_SHARP[] = "fb-sharp"; ++const char MtkCameraParameters::KEY_FB_SHARP_MIN[] = "fb-sharp-min"; ++const char MtkCameraParameters::KEY_FB_SHARP_MAX[] = "fb-sharp-max"; ++// ++const char MtkCameraParameters::KEY_FB_ENLARGE_EYE[] = "fb-enlarge-eye"; ++const char MtkCameraParameters::KEY_FB_ENLARGE_EYE_MIN[] = "fb-enlarge-eye-min"; ++const char MtkCameraParameters::KEY_FB_ENLARGE_EYE_MAX[] = "fb-enlarge-eye-max"; ++// ++const char MtkCameraParameters::KEY_FB_SLIM_FACE[] = "fb-slim-face"; ++const char MtkCameraParameters::KEY_FB_SLIM_FACE_MIN[] = "fb-slim-face-min"; ++const char MtkCameraParameters::KEY_FB_SLIM_FACE_MAX[] = "fb-slim-face-max"; ++// ++const char MtkCameraParameters::KEY_FB_EXTREME_BEAUTY[] = "fb-extreme-beauty"; ++// ++const char MtkCameraParameters::KEY_FACE_BEAUTY[] = "face-beauty"; ++ ++ ++// ++const char MtkCameraParameters::KEY_EXPOSURE[] = "exposure"; ++const char MtkCameraParameters::KEY_EXPOSURE_METER[] = "exposure-meter"; ++const char MtkCameraParameters::KEY_ISO_SPEED[] = "iso-speed"; ++const char MtkCameraParameters::KEY_AE_MODE[] = "ae-mode"; ++const char MtkCameraParameters::KEY_FOCUS_METER[] = "focus-meter"; ++const char MtkCameraParameters::KEY_EDGE[] = "edge"; ++const char MtkCameraParameters::KEY_HUE[] = "hue"; ++const char MtkCameraParameters::KEY_SATURATION[] = "saturation"; ++const char MtkCameraParameters::KEY_BRIGHTNESS[] = "brightness"; ++const char MtkCameraParameters::KEY_CONTRAST[] = "contrast"; ++const char MtkCameraParameters::KEY_AF_LAMP_MODE [] = "aflamp-mode"; ++const char MtkCameraParameters::KEY_STEREO_3D_PREVIEW_SIZE[] = "stereo3d-preview-size"; ++const char MtkCameraParameters::KEY_STEREO_3D_PICTURE_SIZE[] = "stereo3d-picture-size"; ++const char MtkCameraParameters::KEY_STEREO_3D_TYPE [] = "stereo3d-type"; ++const char MtkCameraParameters::KEY_STEREO_3D_MODE [] = "stereo3d-mode"; ++const char MtkCameraParameters::KEY_STEREO_3D_IMAGE_FORMAT [] = "stereo3d-image-format"; ++ ++// ZSD ++const char MtkCameraParameters::KEY_ZSD_MODE[] = "zsd-mode"; ++const char MtkCameraParameters::KEY_SUPPORTED_ZSD_MODE[] = "zsd-supported"; ++// ++const char MtkCameraParameters::KEY_FPS_MODE[] = "fps-mode"; ++// ++const char MtkCameraParameters::KEY_FOCUS_DRAW[] = "af-draw"; ++// ++const char MtkCameraParameters::KEY_CAPTURE_MODE[] = "cap-mode"; ++const char MtkCameraParameters::KEY_SUPPORTED_CAPTURE_MODES[] = "cap-mode-values"; ++const char MtkCameraParameters::KEY_CAPTURE_PATH[] = "capfname"; ++const char MtkCameraParameters::KEY_BURST_SHOT_NUM[] = "burst-num"; ++// ++const char MtkCameraParameters::KEY_MATV_PREVIEW_DELAY[] = "tv-delay"; ++const char MtkCameraParameters::KEY_PANORAMA_IDX[] = "pano-idx"; ++const char MtkCameraParameters::KEY_PANORAMA_DIR[] = "pano-dir"; ++ ++// Values for KEY_EXPOSURE ++const char MtkCameraParameters::EXPOSURE_METER_SPOT[] = "spot"; ++const char MtkCameraParameters::EXPOSURE_METER_CENTER[] = "center"; ++const char MtkCameraParameters::EXPOSURE_METER_AVERAGE[] = "average"; ++ ++// Valeus for KEY_ISO_SPEED ++const char MtkCameraParameters::ISO_SPEED_AUTO[] = "auto"; ++const char MtkCameraParameters::ISO_SPEED_100[] = "100"; ++const char MtkCameraParameters::ISO_SPEED_200[] = "200"; ++const char MtkCameraParameters::ISO_SPEED_400[] = "400"; ++const char MtkCameraParameters::ISO_SPEED_800[] = "800"; ++const char MtkCameraParameters::ISO_SPEED_1600[] = "1600"; ++ ++// Values for KEY_AE_MODE = "ae-mode" ++ ++// Values for KEY_FOCUS_METER ++const char MtkCameraParameters::FOCUS_METER_SPOT[] = "spot"; ++const char MtkCameraParameters::FOCUS_METER_MULTI[] = "multi"; ++ ++// AWB2PASS ++const char MtkCameraParameters::KEY_AWB2PASS[] = "awb-2pass"; ++ ++ ++// ++// Camera Mode ++const char MtkCameraParameters::KEY_CAMERA_MODE[] = "mtk-cam-mode"; ++// Values for KEY_CAMERA_MODE ++const int MtkCameraParameters::CAMERA_MODE_NORMAL = 0; ++const int MtkCameraParameters::CAMERA_MODE_MTK_PRV = 1; ++const int MtkCameraParameters::CAMERA_MODE_MTK_VDO = 2; ++const int MtkCameraParameters::CAMERA_MODE_MTK_VT = 3; ++ ++// Values for KEY_FPS_MODE ++const int MtkCameraParameters::FPS_MODE_NORMAL = 0; ++const int MtkCameraParameters::FPS_MODE_FIX = 1; ++ ++// Values for raw save mode ++ ++// Values for KEY_FOCUS_DRAW ++ ++// Values for capture mode ++const char MtkCameraParameters::CAPTURE_MODE_PANORAMA_SHOT[] = "panoramashot"; ++const char MtkCameraParameters::CAPTURE_MODE_BURST_SHOT[] = "burstshot"; ++const char MtkCameraParameters::CAPTURE_MODE_NORMAL[] = "normal"; ++const char MtkCameraParameters::CAPTURE_MODE_BEST_SHOT[] = "bestshot"; ++const char MtkCameraParameters::CAPTURE_MODE_EV_BRACKET_SHOT[] = "evbracketshot"; ++const char MtkCameraParameters::CAPTURE_MODE_SMILE_SHOT[] = "smileshot"; ++const char MtkCameraParameters::CAPTURE_MODE_MAV_SHOT[] = "mav"; ++const char MtkCameraParameters::CAPTURE_MODE_AUTO_PANORAMA_SHOT[] = "autorama"; ++const char MtkCameraParameters::CAPTURE_MODE_MOTION_TRACK_SHOT[] = "motiontrack"; ++const char MtkCameraParameters::CAPTURE_MODE_HDR_SHOT[] = "hdr"; ++const char MtkCameraParameters::CAPTURE_MODE_ASD_SHOT[] = "asd"; ++const char MtkCameraParameters::CAPTURE_MODE_ZSD_SHOT[] = "zsd"; ++const char MtkCameraParameters::CAPTURE_MODE_PANO_3D[] = "pano_3d"; ++const char MtkCameraParameters::CAPTURE_MODE_SINGLE_3D[] = "single_3d"; ++const char MtkCameraParameters::CAPTURE_MODE_FACE_BEAUTY[] = "face_beauty"; ++const char MtkCameraParameters::CAPTURE_MODE_CONTINUOUS_SHOT[] = "continuousshot"; ++const char MtkCameraParameters::CAPTURE_MODE_MULTI_MOTION[] = "multi_motion"; ++const char MtkCameraParameters::CAPTURE_MODE_GESTURE_SHOT[] = "gestureshot"; ++ ++// Values for panorama direction settings ++const char MtkCameraParameters::PANORAMA_DIR_RIGHT[] = "right"; ++const char MtkCameraParameters::PANORAMA_DIR_LEFT[] = "left"; ++const char MtkCameraParameters::PANORAMA_DIR_TOP[] = "top"; ++const char MtkCameraParameters::PANORAMA_DIR_DOWN[] = "down"; ++ ++// ++const int MtkCameraParameters::ENABLE = 1; ++const int MtkCameraParameters::DISABLE = 0; ++ ++// Values for KEY_EDGE, KEY_HUE, KEY_SATURATION, KEY_BRIGHTNESS, KEY_CONTRAST ++const char MtkCameraParameters::HIGH[] = "high"; ++const char MtkCameraParameters::MIDDLE[] = "middle"; ++const char MtkCameraParameters::LOW[] = "low"; ++ ++// Preview Internal Format. ++const char MtkCameraParameters::KEY_PREVIEW_INT_FORMAT[] = "prv-int-fmt"; ++ ++// Pixel color formats for KEY_PREVIEW_FORMAT, KEY_PICTURE_FORMAT, ++// and KEY_VIDEO_FRAME_FORMAT ++const char MtkCameraParameters::PIXEL_FORMAT_YUV420I[] = "yuv420i-yyuvyy-3plane"; ++const char MtkCameraParameters::PIXEL_FORMAT_YV12_GPU[] = "yv12-gpu"; ++const char MtkCameraParameters::PIXEL_FORMAT_YUV422I_UYVY[] = "yuv422i-uyvy"; ++const char MtkCameraParameters::PIXEL_FORMAT_YUV422I_VYUY[] = "yuv422i-vyuy"; ++const char MtkCameraParameters::PIXEL_FORMAT_YUV422I_YVYU[] = "yuv422i-yvyu"; ++ ++const char MtkCameraParameters::PIXEL_FORMAT_BAYER8[] = "bayer8"; ++const char MtkCameraParameters::PIXEL_FORMAT_BAYER10[] = "bayer10"; ++ ++const char MtkCameraParameters::KEY_BRIGHTNESS_VALUE[] = "brightness_value"; ++ ++// ISP Operation mode for meta mode use ++const char MtkCameraParameters::KEY_ISP_MODE[] = "isp-mode"; ++// AF ++const char MtkCameraParameters::KEY_AF_X[] = "af-x"; ++const char MtkCameraParameters::KEY_AF_Y[] = "af-y"; ++// Effect ++const char MtkCameraParameters::EFFECT_SEPIA_BLUE[] = "sepiablue"; ++const char MtkCameraParameters::EFFECT_SEPIA_GREEN[] = "sepiagreen"; ++ ++// ++// on/off => FIXME: should be replaced with TRUE[] ++const char MtkCameraParameters::ON[] = "on"; ++const char MtkCameraParameters::OFF[] = "off"; ++// ++const char MtkCameraParameters::WHITE_BALANCE_TUNGSTEN[] = "tungsten"; ++// ++const char MtkCameraParameters::ISO_SPEED_ENG[] = "iso-speed-eng"; ++const char MtkCameraParameters::KEY_RAW_SAVE_MODE[] = "rawsave-mode"; ++const char MtkCameraParameters::KEY_RAW_PATH[] = "rawfname"; ++ ++const char MtkCameraParameters::KEY_FAST_CONTINUOUS_SHOT[] = "fast-continuous-shot"; ++ ++const char MtkCameraParameters::KEY_CSHOT_INDICATOR[] = "cshot-indicator"; ++ ++// AF EM MODE ++const char MtkCameraParameters::KEY_FOCUS_ENG_MODE[] = "afeng-mode"; ++const char MtkCameraParameters::KEY_FOCUS_ENG_STEP[] = "afeng-pos"; ++const char MtkCameraParameters::KEY_FOCUS_ENG_MAX_STEP[] = "afeng-max-focus-step"; ++const char MtkCameraParameters::KEY_FOCUS_ENG_MIN_STEP[] = "afeng-min-focus-step"; ++const char MtkCameraParameters::KEY_FOCUS_ENG_BEST_STEP[] = "afeng-best-focus-step"; ++const char MtkCameraParameters::KEY_RAW_DUMP_FLAG[] = "afeng_raw_dump_flag"; ++const char MtkCameraParameters::KEY_PREVIEW_DUMP_RESOLUTION[] = "preview-dump-resolution"; ++// Values for KEY_PREVIEW_DUMP_RESOLUTION ++const int MtkCameraParameters::PREVIEW_DUMP_RESOLUTION_NORMAL = 0; ++const int MtkCameraParameters::PREVIEW_DUMP_RESOLUTION_CROP = 1; ++// ++const char MtkCameraParameters::KEY_MAX_NUM_DETECTED_OBJECT[] = "max-num-ot"; ++// ++const char MtkCameraParameters::KEY_VIDEO_HDR[] = "video-hdr"; ++ ++// KEY for [Engineer Mode] Add new camera paramters for new requirements ++const char MtkCameraParameters::KEY_ENG_AE_ENABLE[] = "eng-ae-enable"; ++const char MtkCameraParameters::KEY_ENG_PREVIEW_SHUTTER_SPEED[] = "eng-preview-shutter-speed"; ++const char MtkCameraParameters::KEY_ENG_PREVIEW_SENSOR_GAIN[] = "eng-preview-sensor-gain"; ++const char MtkCameraParameters::KEY_ENG_PREVIEW_ISP_GAIN[] = "eng-preview-isp-gain"; ++const char MtkCameraParameters::KEY_ENG_PREVIEW_AE_INDEX[] = "eng-preview-ae-index"; ++const char MtkCameraParameters::KEY_ENG_CAPTURE_SENSOR_GAIN[] = "eng-capture-sensor-gain"; ++const char MtkCameraParameters::KEY_ENG_CAPTURE_ISP_GAIN[] = "eng-capture-isp-gain"; ++const char MtkCameraParameters::KEY_ENG_CAPTURE_SHUTTER_SPEED[] = "eng-capture-shutter-speed"; ++const char MtkCameraParameters::KEY_ENG_CAPTURE_ISO[] = "eng-capture-iso"; ++const char MtkCameraParameters::KEY_ENG_FLASH_DUTY_VALUE[] = "eng-flash-duty-value"; ++const char MtkCameraParameters::KEY_ENG_FLASH_DUTY_MIN[] = "eng-flash-duty-min"; ++const char MtkCameraParameters::KEY_ENG_FLASH_DUTY_MAX[] = "eng-flash-duty-max"; ++const char MtkCameraParameters::KEY_ENG_ZSD_ENABLE[] = "eng-zsd-enable"; ++const char MtkCameraParameters::KEY_SENSOR_TYPE[] = "sensor-type"; ++const char MtkCameraParameters::KEY_ENG_PREVIEW_FPS[] = "eng-preview-fps"; ++const char MtkCameraParameters::KEY_ENG_MSG[] = "eng-msg"; ++const int MtkCameraParameters::KEY_ENG_FLASH_DUTY_DEFAULT_VALUE = -1; ++const int MtkCameraParameters::KEY_ENG_FLASH_STEP_DEFAULT_VALUE = -1; ++const char MtkCameraParameters::KEY_ENG_FLASH_STEP_MIN[] = "eng-flash-step-min"; ++const char MtkCameraParameters::KEY_ENG_FLASH_STEP_MAX[] = "eng-flash-step-max"; ++const char MtkCameraParameters::KEY_ENG_FOCUS_FULLSCAN_FRAME_INTERVAL[] = "eng-focus-fullscan-frame-interval"; ++const char MtkCameraParameters::KEY_ENG_FOCUS_FULLSCAN_FRAME_INTERVAL_MAX[] = "eng-focus-fullscan-frame-interval-max"; ++const char MtkCameraParameters::KEY_ENG_FOCUS_FULLSCAN_FRAME_INTERVAL_MIN[] = "eng-focus-fullscan-frame-interval-min"; ++const int MtkCameraParameters::KEY_ENG_FOCUS_FULLSCAN_FRAME_INTERVAL_MAX_DEFAULT = 65535; ++const int MtkCameraParameters::KEY_ENG_FOCUS_FULLSCAN_FRAME_INTERVAL_MIN_DEFAULT = 0; ++const char MtkCameraParameters::KEY_ENG_PREVIEW_FRAME_INTERVAL_IN_US[] = "eng-preview-frame-interval-in-us"; ++const char MtkCameraParameters::KEY_ENG_PARAMETER1[] = "key-eng-parameter1"; ++const char MtkCameraParameters::KEY_ENG_PARAMETER2[] = "key-eng-parameter2"; ++const char MtkCameraParameters::KEY_ENG_PARAMETER3[] = "key-eng-parameter3"; ++ ++const char MtkCameraParameters::KEY_ENG_SAVE_SHADING_TABLE[] = "eng-save-shading-table"; ++const char MtkCameraParameters::KEY_ENG_SHADING_TABLE[] = "eng-shading-table"; ++const int MtkCameraParameters::KEY_ENG_SHADING_TABLE_AUTO = 0; ++const int MtkCameraParameters::KEY_ENG_SHADING_TABLE_LOW = 1; ++const int MtkCameraParameters::KEY_ENG_SHADING_TABLE_MIDDLE = 2; ++const int MtkCameraParameters::KEY_ENG_SHADING_TABLE_HIGH = 3; ++const int MtkCameraParameters::KEY_ENG_SHADING_TABLE_TSF = 4; ++ ++// KEY for [Engineer Mode] Add new camera paramters for ev calibration ++const char MtkCameraParameters::KEY_ENG_EV_CALBRATION_OFFSET_VALUE[] = "eng-ev-cal-offset"; ++ ++#ifdef MTK_SLOW_MOTION_VIDEO_SUPPORT ++// High Speed Video Record ++const char MtkCameraParameters::KEY_HSVR_PRV_SIZE[] = "hsvr-prv-size"; ++const char MtkCameraParameters::KEY_SUPPORTED_HSVR_PRV_SIZE[] = "hsvr-prv-size-values"; ++const char MtkCameraParameters::KEY_HSVR_PRV_FPS[] = "hsvr-prv-fps"; ++const char MtkCameraParameters::KEY_SUPPORTED_HSVR_PRV_FPS[] = "hsvr-prv-fps-values"; ++#endif ++const char MtkCameraParameters::KEY_DXOEIS_ONOFF[] = "dxo-eis"; ++const char MtkCameraParameters::KEY_FIX_EXPOSURE_TIME[] = "fix-exposure-time"; ++ ++}; // namespace android ++ +diff --git a/include/camera/MtkCameraParameters.h b/include/camera/MtkCameraParameters.h +new file mode 100644 +index 000000000..e9456d53d +--- /dev/null ++++ b/include/camera/MtkCameraParameters.h +@@ -0,0 +1,351 @@ ++/* ++ * Copyright (C) 2008 The Android Open Source Project ++ * ++ * Licensed under the Apache License, Version 2.0 (the "License"); ++ * you may not use this file except in compliance with the License. ++ * You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++ ++#ifndef ANDROID_HARDWARE_MTK_CAMERA_PARAMETERS_H ++#define ANDROID_HARDWARE_MTK_CAMERA_PARAMETERS_H ++ ++#include ++ ++namespace android { ++ ++ ++/** ++ * @class MtkCameraParameters ++ * @brief MTK-proprietary camera parameters. ++ * @details This class is derived from CameraParameters and defines MTK-proprietary camera parameters. ++ */ ++class MtkCameraParameters : public CameraParameters ++{ ++public: ++ MtkCameraParameters() : CameraParameters() {} ++ MtkCameraParameters(const String8 ¶ms) { unflatten(params); } ++ ~MtkCameraParameters() {} ++ ++ MtkCameraParameters& operator=(CameraParameters const& params) ++ { ++ unflatten(params.flatten()); ++ return (*this); ++ } ++ // ++//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++// App Mode. ++//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++ static const char PROPERTY_KEY_CLIENT_APPMODE[]; ++ // ++ static const char APP_MODE_NAME_DEFAULT[]; ++ static const char APP_MODE_NAME_MTK_ENG[]; ++ static const char APP_MODE_NAME_MTK_ATV[]; ++ static const char APP_MODE_NAME_MTK_S3D[]; ++ static const char APP_MODE_NAME_MTK_VT[]; ++ static const char APP_MODE_NAME_MTK_PHOTO[]; ++ static const char APP_MODE_NAME_MTK_VIDEO[]; ++ static const char APP_MODE_NAME_MTK_ZSD[]; ++ // ++//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++// Scene Mode ++//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++ static const char SCENE_MODE_NORMAL[]; ++ // ++//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++// Face Beauty ++//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++ static const char KEY_FB_SMOOTH_LEVEL[]; ++ static const char KEY_FB_SMOOTH_LEVEL_MIN[]; ++ static const char KEY_FB_SMOOTH_LEVEL_MAX[]; ++ // ++ static const char KEY_FB_SKIN_COLOR[]; ++ static const char KEY_FB_SKIN_COLOR_MIN[]; ++ static const char KEY_FB_SKIN_COLOR_MAX[]; ++ // ++ static const char KEY_FB_SHARP[]; ++ static const char KEY_FB_SHARP_MIN[]; ++ static const char KEY_FB_SHARP_MAX[]; ++ // ++ static const char KEY_FB_ENLARGE_EYE[]; ++ static const char KEY_FB_ENLARGE_EYE_MIN[]; ++ static const char KEY_FB_ENLARGE_EYE_MAX[]; ++ // ++ static const char KEY_FB_SLIM_FACE[]; ++ static const char KEY_FB_SLIM_FACE_MIN[]; ++ static const char KEY_FB_SLIM_FACE_MAX[]; ++ // ++ static const char KEY_FB_EXTREME_BEAUTY[]; ++ // ++ static const char KEY_FACE_BEAUTY[]; ++ // ++//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++// ++//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++ static const char KEY_EXPOSURE[]; ++ static const char KEY_EXPOSURE_METER[]; ++ static const char KEY_ISO_SPEED[]; ++ static const char KEY_AE_MODE[]; ++ static const char KEY_FOCUS_METER[]; ++ static const char KEY_EDGE[]; ++ static const char KEY_HUE[]; ++ static const char KEY_SATURATION[]; ++ static const char KEY_BRIGHTNESS[]; ++ static const char KEY_CONTRAST[]; ++ static const char KEY_ZSD_MODE[]; ++ static const char KEY_SUPPORTED_ZSD_MODE[]; ++ static const char KEY_AWB2PASS[]; ++ static const char KEY_AF_LAMP_MODE []; ++ ++ static const char KEY_STEREO_3D_PREVIEW_SIZE[]; ++ static const char KEY_STEREO_3D_PICTURE_SIZE[]; ++ static const char KEY_STEREO_3D_TYPE []; ++ static const char KEY_STEREO_3D_MODE []; ++ static const char KEY_STEREO_3D_IMAGE_FORMAT []; ++ // ++ static const char KEY_FPS_MODE[]; // normal,fix ++ // ++ static const char KEY_FOCUS_DRAW[]; // 0,1 ++ // ++ static const char KEY_CAPTURE_MODE[]; // normal,bestshot,evbracketshot,burstshot,smileshot,panoramashot ++ static const char KEY_SUPPORTED_CAPTURE_MODES[]; ++ static const char KEY_CAPTURE_PATH[]; ++ static const char KEY_BURST_SHOT_NUM[]; ++ // ++ static const char KEY_MATV_PREVIEW_DELAY[]; ++ // ++ static const char KEY_PANORAMA_IDX[]; ++ static const char KEY_PANORAMA_DIR[]; // right,left,top,bottom ++ // ++ static const char KEY_SENSOR_DEV[]; // main,sub,atv ++ static const char KEY_SUPPORTED_SENSOR_DEVS[]; ++ ++ // Values for KEY_EXPOSURE ++ static const char EXPOSURE_METER_SPOT[]; ++ static const char EXPOSURE_METER_CENTER[]; ++ static const char EXPOSURE_METER_AVERAGE[]; ++ ++ // Valeus for KEY_ISO_SPEED ++ static const char ISO_SPEED_AUTO[]; ++ static const char ISO_SPEED_100[]; ++ static const char ISO_SPEED_200[]; ++ static const char ISO_SPEED_400[]; ++ static const char ISO_SPEED_800[]; ++ static const char ISO_SPEED_1600[]; ++ ++ // Values for KEY_FOCUS_METER ++ static const char FOCUS_METER_SPOT[]; ++ static const char FOCUS_METER_MULTI[]; ++ ++ static const char KEY_CAMERA_MODE[]; ++ // Values for KEY_CAMERA_MODE ++ static const int CAMERA_MODE_NORMAL; ++ static const int CAMERA_MODE_MTK_PRV; ++ static const int CAMERA_MODE_MTK_VDO; ++ static const int CAMERA_MODE_MTK_VT; ++ ++ // Values for KEY_FPS_MODE ++ static const int FPS_MODE_NORMAL; ++ static const int FPS_MODE_FIX; ++ ++ // Values for KEY_CAPTURE_MODE ++ static const char CAPTURE_MODE_PANORAMA_SHOT[]; ++ static const char CAPTURE_MODE_BURST_SHOT[]; ++ static const char CAPTURE_MODE_NORMAL[]; ++ static const char CAPTURE_MODE_BEST_SHOT[]; ++ static const char CAPTURE_MODE_EV_BRACKET_SHOT[]; ++ static const char CAPTURE_MODE_SMILE_SHOT[]; ++ static const char CAPTURE_MODE_AUTO_PANORAMA_SHOT[]; ++ static const char CAPTURE_MODE_MOTION_TRACK_SHOT[]; ++ static const char CAPTURE_MODE_MAV_SHOT[]; ++ static const char CAPTURE_MODE_HDR_SHOT[]; ++ static const char CAPTURE_MODE_ASD_SHOT[]; ++ static const char CAPTURE_MODE_ZSD_SHOT[]; ++ static const char CAPTURE_MODE_PANO_3D[]; ++ static const char CAPTURE_MODE_SINGLE_3D[]; ++ static const char CAPTURE_MODE_FACE_BEAUTY[]; ++ static const char CAPTURE_MODE_CONTINUOUS_SHOT[]; ++ static const char CAPTURE_MODE_MULTI_MOTION[]; ++ static const char CAPTURE_MODE_GESTURE_SHOT[]; ++ ++ // Values for KEY_PANORAMA_DIR ++ static const char PANORAMA_DIR_RIGHT[]; ++ static const char PANORAMA_DIR_LEFT[]; ++ static const char PANORAMA_DIR_TOP[]; ++ static const char PANORAMA_DIR_DOWN[]; ++ // ++ static const int ENABLE; ++ static const int DISABLE; ++ ++ // Values for KEY_EDGE, KEY_HUE, KEY_SATURATION, KEY_BRIGHTNESS, KEY_CONTRAST ++ static const char HIGH[]; ++ static const char MIDDLE[]; ++ static const char LOW[]; ++ ++ // Preview Internal Format. ++ static const char KEY_PREVIEW_INT_FORMAT[]; ++ ++ // Pixel color formats for KEY_PREVIEW_FORMAT, KEY_PICTURE_FORMAT, ++ // and KEY_VIDEO_FRAME_FORMAT ++ static const char PIXEL_FORMAT_YUV420I[]; // I420 ++ ++ /** ++ * @var PIXEL_FORMAT_YV12_GPU ++ * ++ * GPU YUV format: ++ * ++ * YV12 is a 4:2:0 YCrCb planar format comprised of a WxH Y plane followed ++ * by (W/2) x (H/2) Cr and Cb planes. ++ * ++ * This format assumes ++ * - an even width ++ * - an even height ++ * - a vertical stride equal to the height ++ * - a horizontal stride multiple of 32/16/16 pixels for y/cr/cb respectively ++ * i.e. ++ * y_stride = ALIGN(width, 32) ++ * c_stride = y_stride / 2 ++ * ++ * y_size = y_stride * height ++ * c_size = c_stride * height / 2 ++ * size = y_size + c_size * 2 ++ * cr_offset = y_size ++ * cb_offset = y_size + c_size ++ * ++ * for example: ++ * width/height = 176x144 ++ * y stride = 192x144 ++ * cr stride = 96x72 ++ * cb stride = 96x72 ++ * ++ */ ++ static const char PIXEL_FORMAT_YV12_GPU[]; ++ ++ /* ++ * YUV422 format, 1 plane (UYVY) ++ * ++ * Effective bits per pixel : 16 ++ * ++ * Y sample at every pixel, U and V sampled at every second pixel horizontally on each line. ++ * A macropixel contains 2 pixels in 1 uint32_t. ++ * ++ */ ++ static const char PIXEL_FORMAT_YUV422I_UYVY[]; ++ // ++ static const char PIXEL_FORMAT_YUV422I_VYUY[]; ++ static const char PIXEL_FORMAT_YUV422I_YVYU[]; ++ static const char PIXEL_FORMAT_BAYER8[]; ++ static const char PIXEL_FORMAT_BAYER10[]; ++ ++ /** ++ * @var KEY_BRIGHTNESS_VALUE ++ * ++ * This is a key string of brightness value, scaled by 10. ++ * ++ */ ++ static const char KEY_BRIGHTNESS_VALUE[]; ++ ++ // ISP Operation mode for meta mode use ++ static const char KEY_ISP_MODE[]; ++ // AF ++ static const char KEY_AF_X[]; ++ static const char KEY_AF_Y[]; ++ static const char KEY_FOCUS_ENG_MAX_STEP[]; ++ static const char KEY_FOCUS_ENG_MIN_STEP[]; ++ static const char KEY_FOCUS_ENG_BEST_STEP[]; ++ static const char KEY_RAW_DUMP_FLAG[]; ++ static const char KEY_PREVIEW_DUMP_RESOLUTION[]; ++ static const int PREVIEW_DUMP_RESOLUTION_NORMAL; ++ static const int PREVIEW_DUMP_RESOLUTION_CROP; ++ ++ // Values for effect ++ static const char EFFECT_SEPIA_BLUE[]; ++ static const char EFFECT_SEPIA_GREEN[]; ++ // Values for AWB ++ static const char WHITE_BALANCE_TUNGSTEN[]; ++ // Eng ++ static const char ISO_SPEED_ENG[]; ++ static const char KEY_FOCUS_ENG_MODE[]; // 0,1,2,3 (0: normal) ++ static const char KEY_FOCUS_ENG_STEP[]; ++ static const char KEY_RAW_SAVE_MODE[]; // on, off ++ static const char KEY_RAW_PATH[]; ++ ++ // KEY for Continuous shot speed ++ static const char KEY_FAST_CONTINUOUS_SHOT[]; ++ ++ static const char KEY_VIDEO_HDR[]; ++ ++ static const char KEY_MAX_NUM_DETECTED_OBJECT[]; ++ ++ // KEY for c_shot indicator ++ static const char KEY_CSHOT_INDICATOR[]; ++ ++ // KEY for [Engineer Mode] Add new camera paramters for new requirements ++ static const char KEY_ENG_AE_ENABLE[]; ++ static const char KEY_ENG_PREVIEW_SHUTTER_SPEED[]; ++ static const char KEY_ENG_PREVIEW_SENSOR_GAIN[]; ++ static const char KEY_ENG_PREVIEW_ISP_GAIN[]; ++ static const char KEY_ENG_PREVIEW_AE_INDEX[]; ++ static const char KEY_ENG_CAPTURE_SENSOR_GAIN[]; ++ static const char KEY_ENG_CAPTURE_ISP_GAIN[]; ++ static const char KEY_ENG_CAPTURE_SHUTTER_SPEED[]; ++ static const char KEY_ENG_CAPTURE_ISO[]; ++ static const char KEY_ENG_FLASH_DUTY_VALUE[]; ++ static const char KEY_ENG_FLASH_DUTY_MIN[]; ++ static const char KEY_ENG_FLASH_DUTY_MAX[]; ++ static const char KEY_ENG_ZSD_ENABLE[]; ++ static const char KEY_SENSOR_TYPE[]; ++ static const char KEY_ENG_PREVIEW_FPS[]; ++ static const char KEY_ENG_MSG[]; ++ static const int KEY_ENG_FLASH_DUTY_DEFAULT_VALUE; ++ static const int KEY_ENG_FLASH_STEP_DEFAULT_VALUE; ++ static const char KEY_ENG_FLASH_STEP_MIN[]; ++ static const char KEY_ENG_FLASH_STEP_MAX[]; ++ static const char KEY_ENG_FOCUS_FULLSCAN_FRAME_INTERVAL[]; ++ static const char KEY_ENG_FOCUS_FULLSCAN_FRAME_INTERVAL_MAX[]; ++ static const char KEY_ENG_FOCUS_FULLSCAN_FRAME_INTERVAL_MIN[]; ++ static const int KEY_ENG_FOCUS_FULLSCAN_FRAME_INTERVAL_MAX_DEFAULT; ++ static const int KEY_ENG_FOCUS_FULLSCAN_FRAME_INTERVAL_MIN_DEFAULT; ++ static const char KEY_ENG_PREVIEW_FRAME_INTERVAL_IN_US[]; ++ static const char KEY_ENG_PARAMETER1[]; ++ static const char KEY_ENG_PARAMETER2[]; ++ static const char KEY_ENG_PARAMETER3[]; ++ ++ static const char KEY_ENG_SAVE_SHADING_TABLE[]; ++ static const char KEY_ENG_SHADING_TABLE[]; ++ static const int KEY_ENG_SHADING_TABLE_AUTO; ++ static const int KEY_ENG_SHADING_TABLE_LOW; ++ static const int KEY_ENG_SHADING_TABLE_MIDDLE; ++ static const int KEY_ENG_SHADING_TABLE_HIGH; ++ static const int KEY_ENG_SHADING_TABLE_TSF; ++ ++ // KEY for [Engineer Mode] Add new camera paramters for ev calibration ++ static const char KEY_ENG_EV_CALBRATION_OFFSET_VALUE[]; ++ ++#ifdef MTK_SLOW_MOTION_VIDEO_SUPPORT ++ // High Speed Video Record ++ static const char KEY_HSVR_PRV_SIZE[]; ++ static const char KEY_SUPPORTED_HSVR_PRV_SIZE[]; ++ static const char KEY_HSVR_PRV_FPS[]; ++ static const char KEY_SUPPORTED_HSVR_PRV_FPS[]; ++#endif ++ ++ static const char KEY_DXOEIS_ONOFF[]; ++ static const char KEY_FIX_EXPOSURE_TIME[]; ++ // ++public: //// on/off => FIXME: should be replaced with TRUE[] ++ static const char ON[]; ++ static const char OFF[]; ++}; ++ ++}; // namespace android ++ ++#endif ++ +diff --git a/media/libstagefright/foundation/MediaBufferGroup.cpp b/media/libstagefright/foundation/MediaBufferGroup.cpp +index 8e4d0641c..9fdeccbdd 100644 +--- a/media/libstagefright/foundation/MediaBufferGroup.cpp ++++ b/media/libstagefright/foundation/MediaBufferGroup.cpp +@@ -138,6 +138,12 @@ bool MediaBufferGroup::has_buffers() { + return false; + } + ++extern "C" status_t _ZN7android16MediaBufferGroupC1Ev( ++ MediaBufferGroup* group, MediaBuffer **out, bool nonBlocking) { ++ ALOGD("_ZN7android16MediaBufferGroupC1Ev"); ++ return group->acquire_buffer(out, nonBlocking, 0); ++} ++ + status_t MediaBufferGroup::acquire_buffer( + MediaBuffer **out, bool nonBlocking, size_t requestedSize) { + Mutex::Autolock autoLock(mLock); +diff --git a/services/camera/libcameraservice/Android.mk b/services/camera/libcameraservice/Android.mk +index ced1232b0..bddfb5fb2 100644 +--- a/services/camera/libcameraservice/Android.mk ++++ b/services/camera/libcameraservice/Android.mk +@@ -96,6 +96,10 @@ ifeq ($(BOARD_NEEDS_MEMORYHEAPION),true) + LOCAL_CFLAGS += -DUSE_MEMORY_HEAP_ION + endif + ++ifeq ($(BOARD_HAS_MTK_HARDWARE),true) ++ LOCAL_CFLAGS += -DMTK_HARDWARE ++endif ++ + LOCAL_MODULE:= libcameraservice + + include $(BUILD_SHARED_LIBRARY) +diff --git a/services/camera/libcameraservice/api1/CameraClient.cpp b/services/camera/libcameraservice/api1/CameraClient.cpp +index b02d8f967..60232d8e5 100644 +--- a/services/camera/libcameraservice/api1/CameraClient.cpp ++++ b/services/camera/libcameraservice/api1/CameraClient.cpp +@@ -496,6 +496,7 @@ void CameraClient::releaseRecordingFrame(const sp& mem) { + void CameraClient::releaseRecordingFrameHandle(native_handle_t *handle) { + if (handle == nullptr) return; + ++ + sp dataPtr; + { + Mutex::Autolock l(mAvailableCallbackBuffersLock); +@@ -750,6 +751,9 @@ void CameraClient::disableMsgType(int32_t msgType) { + + #define CHECK_MESSAGE_INTERVAL 10 // 10ms + bool CameraClient::lockIfMessageWanted(int32_t msgType) { ++#ifdef MTK_HARDWARE ++ return true; ++#endif + int sleepCount = 0; + while (mMsgEnabled & msgType) { + if (mLock.tryLock() == NO_ERROR) { +@@ -793,6 +797,17 @@ bool CameraClient::lockIfMessageWanted(int32_t msgType) { + void CameraClient::notifyCallback(int32_t msgType, int32_t ext1, + int32_t ext2, void* user) { + LOG2("notifyCallback(%d)", msgType); ++#ifdef MTK_HARDWARE ++ if (msgType == 0x40000000) { //MTK_CAMERA_MSG_EXT_NOTIFY ++ if (ext1 == 0x11) { //MTK_CAMERA_MSG_EXT_NOTIFY_SHUTTER ++ msgType = CAMERA_MSG_SHUTTER; ++ } ++ if (ext1 == 0x10) { //MTK_CAMERA_MSG_EXT_CAPTURE_DONE ++ return; ++ } ++ LOG2("MtknotifyCallback(0x%x, 0x%x)", ext1, ext2); ++ } ++#endif + + sp client = static_cast(getClientFromCookie(user).get()); + if (client.get() == nullptr) return; +@@ -823,6 +838,33 @@ void CameraClient::dataCallback(int32_t msgType, + client->handleGenericNotify(CAMERA_MSG_ERROR, UNKNOWN_ERROR, 0); + return; + } ++#ifdef MTK_HARDWARE ++ if (int32_t msgType = 0x80000000) { //MTK_CAMERA_MSG_EXT_DATA ++ struct DataHeader { ++ uint32_t extMsgType; ++ } dataHeader; ++ sp heap = 0; ++ ssize_t offset = 0; ++ size_t size = 0; ++ ++ if (dataPtr.get()) { ++ ++ heap = dataPtr->getMemory(&offset, &size); ++ if ( NULL != heap.get() && NULL != heap->base() ) ++ ::memcpy(&dataHeader, ((uint8_t*)heap->base()) + offset, sizeof(DataHeader)); ++ ++ if (dataHeader.extMsgType == 0x10) { //MTK_CAMERA_MSG_EXT_DATA_COMPRESSED_IMAGE ++ msgType = CAMERA_MSG_COMPRESSED_IMAGE; ++ sp image = new MemoryBase(heap, ++ (offset + sizeof(DataHeader) + sizeof(uint_t) * 1), ++ (size - sizeof(DataHeader) - sizeof(uint_t) * 1)); ++ client->handleCompressedPicture(image); ++ return; ++ } ++ } ++ LOG2("MtkDataCallback(0x%x)", dataHeader.extMsgType); ++ } ++#endif + + switch (msgType & ~CAMERA_MSG_PREVIEW_METADATA) { + case CAMERA_MSG_PREVIEW_FRAME: +-- +2.15.0.windows.1 +