PersistentSurface.h revision d291c222357303b9611cab89d0c3b047584ef377
1d291c222357303b9611cab89d0c3b047584ef377Chong Zhang/*
2d291c222357303b9611cab89d0c3b047584ef377Chong Zhang * Copyright 2015 The Android Open Source Project
3d291c222357303b9611cab89d0c3b047584ef377Chong Zhang *
4d291c222357303b9611cab89d0c3b047584ef377Chong Zhang * Licensed under the Apache License, Version 2.0 (the "License");
5d291c222357303b9611cab89d0c3b047584ef377Chong Zhang * you may not use this file except in compliance with the License.
6d291c222357303b9611cab89d0c3b047584ef377Chong Zhang * You may obtain a copy of the License at
7d291c222357303b9611cab89d0c3b047584ef377Chong Zhang *
8d291c222357303b9611cab89d0c3b047584ef377Chong Zhang *      http://www.apache.org/licenses/LICENSE-2.0
9d291c222357303b9611cab89d0c3b047584ef377Chong Zhang *
10d291c222357303b9611cab89d0c3b047584ef377Chong Zhang * Unless required by applicable law or agreed to in writing, software
11d291c222357303b9611cab89d0c3b047584ef377Chong Zhang * distributed under the License is distributed on an "AS IS" BASIS,
12d291c222357303b9611cab89d0c3b047584ef377Chong Zhang * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13d291c222357303b9611cab89d0c3b047584ef377Chong Zhang * See the License for the specific language governing permissions and
14d291c222357303b9611cab89d0c3b047584ef377Chong Zhang * limitations under the License.
15d291c222357303b9611cab89d0c3b047584ef377Chong Zhang */
16d291c222357303b9611cab89d0c3b047584ef377Chong Zhang
17d291c222357303b9611cab89d0c3b047584ef377Chong Zhang#ifndef PERSISTENT_SURFACE_H_
18d291c222357303b9611cab89d0c3b047584ef377Chong Zhang
19d291c222357303b9611cab89d0c3b047584ef377Chong Zhang#define PERSISTENT_SURFACE_H_
20d291c222357303b9611cab89d0c3b047584ef377Chong Zhang
21d291c222357303b9611cab89d0c3b047584ef377Chong Zhang#include <gui/IGraphicBufferProducer.h>
22d291c222357303b9611cab89d0c3b047584ef377Chong Zhang#include <gui/IGraphicBufferConsumer.h>
23d291c222357303b9611cab89d0c3b047584ef377Chong Zhang#include <media/stagefright/foundation/ABase.h>
24d291c222357303b9611cab89d0c3b047584ef377Chong Zhang
25d291c222357303b9611cab89d0c3b047584ef377Chong Zhangnamespace android {
26d291c222357303b9611cab89d0c3b047584ef377Chong Zhang
27d291c222357303b9611cab89d0c3b047584ef377Chong Zhangstruct PersistentSurface : public RefBase {
28d291c222357303b9611cab89d0c3b047584ef377Chong Zhang    PersistentSurface(
29d291c222357303b9611cab89d0c3b047584ef377Chong Zhang            const sp<IGraphicBufferProducer>& bufferProducer,
30d291c222357303b9611cab89d0c3b047584ef377Chong Zhang            const sp<IGraphicBufferConsumer>& bufferConsumer) :
31d291c222357303b9611cab89d0c3b047584ef377Chong Zhang        mBufferProducer(bufferProducer),
32d291c222357303b9611cab89d0c3b047584ef377Chong Zhang        mBufferConsumer(bufferConsumer) { }
33d291c222357303b9611cab89d0c3b047584ef377Chong Zhang
34d291c222357303b9611cab89d0c3b047584ef377Chong Zhang    sp<IGraphicBufferProducer> getBufferProducer() const {
35d291c222357303b9611cab89d0c3b047584ef377Chong Zhang        return mBufferProducer;
36d291c222357303b9611cab89d0c3b047584ef377Chong Zhang    }
37d291c222357303b9611cab89d0c3b047584ef377Chong Zhang
38d291c222357303b9611cab89d0c3b047584ef377Chong Zhang    sp<IGraphicBufferConsumer> getBufferConsumer() const {
39d291c222357303b9611cab89d0c3b047584ef377Chong Zhang        return mBufferConsumer;
40d291c222357303b9611cab89d0c3b047584ef377Chong Zhang    }
41d291c222357303b9611cab89d0c3b047584ef377Chong Zhang
42d291c222357303b9611cab89d0c3b047584ef377Chong Zhangprivate:
43d291c222357303b9611cab89d0c3b047584ef377Chong Zhang    const sp<IGraphicBufferProducer> mBufferProducer;
44d291c222357303b9611cab89d0c3b047584ef377Chong Zhang    const sp<IGraphicBufferConsumer> mBufferConsumer;
45d291c222357303b9611cab89d0c3b047584ef377Chong Zhang
46d291c222357303b9611cab89d0c3b047584ef377Chong Zhang    DISALLOW_EVIL_CONSTRUCTORS(PersistentSurface);
47d291c222357303b9611cab89d0c3b047584ef377Chong Zhang};
48d291c222357303b9611cab89d0c3b047584ef377Chong Zhang
49d291c222357303b9611cab89d0c3b047584ef377Chong Zhang}  // namespace android
50d291c222357303b9611cab89d0c3b047584ef377Chong Zhang
51d291c222357303b9611cab89d0c3b047584ef377Chong Zhang#endif  // PERSISTENT_SURFACE_H_
52