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_CONNECTION_H
18#define ANDROID_HARDWARE_MEDIA_C2_V1_0_INPUT_SURFACE_CONNECTION_H
19
20#include <memory>
21
22#include <C2Component.h>
23#include <media/stagefright/bqhelper/GraphicBufferSource.h>
24#include <media/stagefright/bqhelper/WGraphicBufferProducer.h>
25#include <media/stagefright/codec2/1.0/InputSurfaceConnection.h>
26
27namespace android {
28namespace hardware {
29namespace media {
30namespace c2 {
31namespace V1_0 {
32namespace implementation {
33
34// TODO: inherit from IInputSurfaceConnection
35class InputSurfaceConnection : public RefBase {
36public:
37    virtual ~InputSurfaceConnection();
38
39    // From IInputSurfaceConnection
40    void disconnect();
41
42private:
43    friend class InputSurface;
44
45    // For InputSurface
46    InputSurfaceConnection(
47            const sp<GraphicBufferSource> &source, const std::shared_ptr<C2Component> &comp);
48    bool init();
49
50    InputSurfaceConnection() = delete;
51
52    class Impl;
53
54    sp<GraphicBufferSource> mSource;
55    sp<Impl> mImpl;
56
57    DISALLOW_EVIL_CONSTRUCTORS(InputSurfaceConnection);
58};
59
60}  // namespace implementation
61}  // namespace V1_0
62}  // namespace c2
63}  // namespace media
64}  // namespace hardware
65}  // namespace android
66
67#endif  // ANDROID_HARDWARE_MEDIA_C2_V1_0_INPUT_SURFACE_CONNECTION_H
68