1 /* 2 * Copyright (C) 2018 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 HARDWARE_GOOGLE_MEDIA_C2_V1_0_UTILS_INPUTSURFACECONNECTION_H 18 #define HARDWARE_GOOGLE_MEDIA_C2_V1_0_UTILS_INPUTSURFACECONNECTION_H 19 20 #include <codec2/hidl/1.0/Component.h> 21 22 #include <hardware/google/media/c2/1.0/IInputSurfaceConnection.h> 23 24 #include <media/stagefright/bqhelper/GraphicBufferSource.h> 25 26 #include <hidl/HidlSupport.h> 27 #include <hidl/Status.h> 28 29 #include <C2Component.h> 30 31 #include <memory> 32 #include <mutex> 33 34 namespace hardware { 35 namespace google { 36 namespace media { 37 namespace c2 { 38 namespace V1_0 { 39 namespace utils { 40 41 using ::android::hardware::Return; 42 using ::android::hardware::Void; 43 using ::android::sp; 44 using ::android::GraphicBufferSource; 45 46 struct InputSurfaceConnection : public IInputSurfaceConnection { 47 48 virtual Return<Status> disconnect() override; 49 50 protected: 51 52 InputSurfaceConnection( 53 const sp<GraphicBufferSource>& source, 54 const std::shared_ptr<C2Component>& component); 55 56 bool init(); 57 58 friend struct InputSurface; 59 60 InputSurfaceConnection() = delete; 61 InputSurfaceConnection(const InputSurfaceConnection&) = delete; 62 void operator=(const InputSurfaceConnection&) = delete; 63 64 struct Impl; 65 66 std::mutex mMutex; 67 sp<GraphicBufferSource> mSource; 68 sp<Impl> mImpl; 69 70 virtual ~InputSurfaceConnection() override; 71 }; 72 73 } // namespace utils 74 } // namespace V1_0 75 } // namespace c2 76 } // namespace media 77 } // namespace google 78 } // namespace hardware 79 80 #endif // HARDWARE_GOOGLE_MEDIA_C2_V1_0_UTILS_INPUTSURFACECONNECTION_H 81