Initial common device tree

This commit is contained in:
Astrako 2019-11-17 18:53:04 +01:00
commit 765503ce5e
71 changed files with 22665 additions and 0 deletions

20
shims/Android.mk Normal file
View file

@ -0,0 +1,20 @@
#
#
# Copyright (C) 2016 The CyanogenMod 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.
#
LOCAL_PATH := $(call my-dir)
include $(call all-subdir-makefiles,$(LOCAL_PATH))

View file

@ -0,0 +1,27 @@
#
# Copyright (C) 2019 The LineageOS 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.
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := CameraParameters.cpp GraphicBuffer.cpp
LOCAL_C_INCLUDES := frameworks/native/include
LOCAL_SHARED_LIBRARIES := libui libutils
LOCAL_MODULE := libexynoscamera_shim
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
LOCAL_VENDOR_MODULE := true
include $(BUILD_SHARED_LIBRARY)

View file

@ -0,0 +1,50 @@
/*
* Copyright (C) 2018 The LineageOS 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.
*/
#include "CameraParameters.h"
namespace android {
const char CameraParameters::PIXEL_FORMAT_YUV420SP_NV21[] = "nv21";
const char CameraParameters::EFFECT_CARTOONIZE[] = "cartoonize";
const char CameraParameters::EFFECT_POINT_RED_YELLOW[] = "point-red-yellow";
const char CameraParameters::EFFECT_POINT_GREEN[] = "point-green";
const char CameraParameters::EFFECT_POINT_BLUE[] = "point-blue";
const char CameraParameters::EFFECT_VINTAGE_COLD[] = "vintage-cold";
const char CameraParameters::EFFECT_VINTAGE_WARM[] = "vintage-warm";
const char CameraParameters::EFFECT_WASHED[] = "washed";
const char CameraParameters::ISO_AUTO[] = "auto";
const char CameraParameters::ISO_NIGHT[] = "night";
const char CameraParameters::ISO_SPORTS[] = "sports";
const char CameraParameters::ISO_1600[] = "1600";
const char CameraParameters::ISO_800[] = "800";
const char CameraParameters::ISO_400[] = "400";
const char CameraParameters::ISO_200[] = "200";
const char CameraParameters::ISO_100[] = "100";
const char CameraParameters::ISO_80[] = "80";
const char CameraParameters::ISO_50[] = "50";
const char CameraParameters::KEY_SUPPORTED_METERING_MODE[] = "metering-values";
const char CameraParameters::METERING_CENTER[] = "center";
const char CameraParameters::METERING_MATRIX[] = "matrix";
const char CameraParameters::METERING_SPOT[] = "spot";
const char CameraParameters::METERING_OFF[] = "off";
const char CameraParameters::KEY_DYNAMIC_RANGE_CONTROL[] = "dynamic-range-control";
const char CameraParameters::KEY_SUPPORTED_PHASE_AF[] = "phase-af-values";
const char CameraParameters::KEY_PHASE_AF[] = "phase-af";
const char CameraParameters::KEY_SUPPORTED_RT_HDR[] = "rt-hdr-values";
const char CameraParameters::KEY_RT_HDR[] = "rt-hdr";
}; // namespace android

View file

@ -0,0 +1,52 @@
/*
* Copyright (C) 2018 The LineageOS 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.
*/
namespace android {
class CameraParameters
{
public:
static const char PIXEL_FORMAT_YUV420SP_NV21[];
static const char EFFECT_CARTOONIZE[];
static const char EFFECT_POINT_RED_YELLOW[];
static const char EFFECT_POINT_GREEN[];
static const char EFFECT_POINT_BLUE[];
static const char EFFECT_VINTAGE_COLD[];
static const char EFFECT_VINTAGE_WARM[];
static const char EFFECT_WASHED[];
static const char ISO_AUTO[];
static const char ISO_NIGHT[];
static const char ISO_SPORTS[];
static const char ISO_1600[];
static const char ISO_800[];
static const char ISO_400[];
static const char ISO_200[];
static const char ISO_100[];
static const char ISO_80[];
static const char ISO_50[];
static const char KEY_SUPPORTED_METERING_MODE[];
static const char METERING_CENTER[];
static const char METERING_MATRIX[];
static const char METERING_SPOT[];
static const char METERING_OFF[];
static const char KEY_DYNAMIC_RANGE_CONTROL[];
static const char KEY_SUPPORTED_PHASE_AF[];
static const char KEY_PHASE_AF[];
static const char KEY_SUPPORTED_RT_HDR[];
static const char KEY_RT_HDR[];
};
}; // namespace android

View file

@ -0,0 +1,20 @@
/*
* Copyright (C) 2018 The LineageOS 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.
*/
#include <ui/GraphicBuffer.h>
extern "C" void _ZN7android5FenceD1Ev() {
}

View file

@ -0,0 +1,46 @@
#
# Copyright (C) 2018 The LineageOS 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.
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := CameraSource.cpp
LOCAL_C_INCLUDES := \
$(TOP)/frameworks/av/include \
$(TOP)/frameworks/av/media/ndk/include \
$(TOP)/frameworks/native/include \
$(TOP)/frameworks/native/include/gui \
$(TOP)/frameworks/native/include/media/hardware \
$(TOP)/frameworks/native/include/media/openmax \
$(TOP)/frameworks/native/libs/arect/include \
$(TOP)/frameworks/native/libs/nativebase/include \
$(TOP)/frameworks/native/libs/nativewindow/include \
$(TOP)/frameworks/native/opengl/include \
$(TOP)/hardware/libhardware/include \
$(TOP)/hardware/interfaces/graphics/bufferqueue/2.0
LOCAL_SHARED_LIBRARIES := \
android.hardware.graphics.bufferqueue@1.0 \
android.hidl.token@1.0-utils \
libbase \
liblog
LOCAL_MODULE := libstagefright_shim
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
LOCAL_VENDOR_MODULE := true
include $(BUILD_SHARED_LIBRARY)

View file

@ -0,0 +1,97 @@
/*
* Copyright (C) 2018 The LineageOS 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_NDEBUG 0
#define LOG_TAG "libstagefright_shim"
#include <utils/Log.h>
#include <OMX_Component.h>
#include <camera/CameraParameters.h>
#include <media/stagefright/CameraSource.h>
namespace android {
static const char PIXEL_FORMAT_YUV420SP_NV21[] = "nv21";
static int32_t getColorFormat(const char* colorFormat) {
if (!colorFormat) {
ALOGE("Invalid color format");
return -1;
}
if (!strcmp(colorFormat, CameraParameters::PIXEL_FORMAT_YUV420P)) {
return OMX_COLOR_FormatYUV420Planar;
}
if (!strcmp(colorFormat, CameraParameters::PIXEL_FORMAT_YUV422SP)) {
return OMX_COLOR_FormatYUV422SemiPlanar;
}
if (!strcmp(colorFormat, CameraParameters::PIXEL_FORMAT_YUV420SP)) {
return OMX_COLOR_FormatYUV420SemiPlanar;
}
if (!strcmp(colorFormat, PIXEL_FORMAT_YUV420SP_NV21)) {
static const int OMX_SEC_COLOR_FormatNV21Linear = 0x7F000011;
return OMX_SEC_COLOR_FormatNV21Linear;
}
if (!strcmp(colorFormat, CameraParameters::PIXEL_FORMAT_YUV422I)) {
return OMX_COLOR_FormatYCbYCr;
}
if (!strcmp(colorFormat, CameraParameters::PIXEL_FORMAT_RGB565)) {
return OMX_COLOR_Format16bitRGB565;
}
if (!strcmp(colorFormat, "OMX_TI_COLOR_FormatYUV420PackedSemiPlanar")) {
return OMX_TI_COLOR_FormatYUV420PackedSemiPlanar;
}
if (!strcmp(colorFormat, CameraParameters::PIXEL_FORMAT_ANDROID_OPAQUE)) {
return OMX_COLOR_FormatAndroidOpaque;
}
if (!strcmp(colorFormat, "YVU420SemiPlanar")) {
return OMX_QCOM_COLOR_FormatYVU420SemiPlanar;
}
ALOGE("Uknown color format (%s), please add it to "
"CameraSource::getColorFormat", colorFormat);
//CHECK(!"Unknown color format");
return -1;
}
/*
* Check whether the camera has the supported color format
* @param params CameraParameters to retrieve the information
* @return OK if no error.
*/
status_t CameraSource::isCameraColorFormatSupported(
const CameraParameters& params) {
ALOGW("SHIM: hijacking %s!", __func__);
mColorFormat = getColorFormat(params.get(
CameraParameters::KEY_VIDEO_FRAME_FORMAT));
if (mColorFormat == -1) {
return BAD_VALUE;
}
return OK;
}
} // namespace android