InputSurface.h revision 4344f091aebaf3aee3ff062a95a05273bd2b1c57
1/* 2 * Copyright 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 ANDROID_HARDWARE_MEDIA_C2_V1_0_INPUT_SURFACE_H 18#define ANDROID_HARDWARE_MEDIA_C2_V1_0_INPUT_SURFACE_H 19 20#include <memory> 21 22#include <C2Component.h> 23#include <media/stagefright/bqhelper/WGraphicBufferProducer.h> 24#include <media/stagefright/codec2/1.0/InputSurfaceConnection.h> 25 26namespace android { 27 28class GraphicBufferSource; 29 30namespace hardware { 31namespace media { 32namespace c2 { 33namespace V1_0 { 34namespace implementation { 35 36using ::android::sp; 37 38typedef ::android::hardware::graphics::bufferqueue::V1_0::IGraphicBufferProducer 39 HGraphicBufferProducer; 40typedef ::android::IGraphicBufferProducer BGraphicBufferProducer; 41 42// TODO: ::android::TWGraphicBufferProducer<IInputSurface> 43typedef ::android::TWGraphicBufferProducer<HGraphicBufferProducer> InputSurfaceBase; 44 45class InputSurface : public InputSurfaceBase { 46public: 47 virtual ~InputSurface() = default; 48 49 // Methods from IInputSurface 50 sp<InputSurfaceConnection> connectToComponent( 51 const std::shared_ptr<::C2Component> &comp); 52 // TODO: intf() 53 54 static sp<InputSurface> Create(); 55 56private: 57 InputSurface( 58 const sp<BGraphicBufferProducer> &base, 59 const sp<::android::GraphicBufferSource> &source); 60 61 sp<::android::GraphicBufferSource> mSource; 62}; 63 64} // namespace implementation 65} // namespace V1_0 66} // namespace c2 67} // namespace media 68} // namespace hardware 69} // namespace android 70 71#endif // ANDROID_HARDWARE_MEDIA_C2_V1_0_INPUT_SURFACE_H 72