1 /* 2 * Copyright (C) 2017 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef CAR_EVS_APP_RENDERDIRECTVIEW_H 18 #define CAR_EVS_APP_RENDERDIRECTVIEW_H 19 20 #include "ConfigManager.h" 21 #include "RenderBase.h" 22 #include "VideoTex.h" 23 24 #include <aidl/android/hardware/automotive/evs/BufferDesc.h> 25 #include <aidl/android/hardware/automotive/evs/CameraDesc.h> 26 #include <aidl/android/hardware/automotive/evs/IEvsEnumerator.h> 27 #include <math/mat2.h> 28 29 /* 30 * Renders the view from a single specified camera directly to the full display. 31 */ 32 class RenderDirectView final : public RenderBase { 33 public: 34 RenderDirectView( 35 std::shared_ptr<aidl::android::hardware::automotive::evs::IEvsEnumerator> enumerator, 36 const aidl::android::hardware::automotive::evs::CameraDesc& camDesc, 37 const ConfigManager& config); 38 39 virtual bool activate() override; 40 virtual void deactivate() override; 41 42 virtual bool drawFrame(const aidl::android::hardware::automotive::evs::BufferDesc& tgtBuffer); 43 44 protected: 45 std::shared_ptr<aidl::android::hardware::automotive::evs::IEvsEnumerator> mEnumerator; 46 ConfigManager::CameraInfo mCameraInfo; 47 aidl::android::hardware::automotive::evs::CameraDesc mCameraDesc; 48 const ConfigManager& mConfig; 49 50 std::unique_ptr<VideoTex> mTexture; 51 52 GLuint mShaderProgram = 0; 53 54 android::mat2 mRotationMat; 55 }; 56 57 #endif // CAR_EVS_APP_RENDERDIRECTVIEW_H 58