1 /*
2  * Copyright 2024, 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 #pragma once
18 
19 #include <utils/RefBase.h>
20 #include <aidl/android/hardware/graphics/common/Dataspace.h>
21 #include <aidl/android/media/IAidlBufferSource.h>
22 #include <aidl/android/media/IAidlNode.h>
23 #include <aidl/android/media/BnAidlGraphicBufferSource.h>
24 
25 namespace android::media {
26 
27 class AidlGraphicBufferSource;
28 
29 using ::android::sp;
30 
31 /**
32  * Aidl wrapper implementation for IAidlGraphicBufferSource
33  */
34 class WAidlGraphicBufferSource : public ::aidl::android::media::BnAidlGraphicBufferSource {
35 public:
36 
37     struct WAidlNodeWrapper;
38     class WAidlBufferSource;
39 
40     sp<AidlGraphicBufferSource> mBase;
41     std::shared_ptr<::aidl::android::media::IAidlBufferSource> mBufferSource;
42 
43     WAidlGraphicBufferSource(sp<AidlGraphicBufferSource> const& base);
44     ::ndk::ScopedAStatus configure(
45             const std::shared_ptr<::aidl::android::media::IAidlNode>& node,
46             aidl::android::hardware::graphics::common::Dataspace dataspace) override;
47     ::ndk::ScopedAStatus setSuspend(bool suspend, int64_t timeUs) override;
48     ::ndk::ScopedAStatus setRepeatPreviousFrameDelayUs(int64_t repeatAfterUs) override;
49     ::ndk::ScopedAStatus setMaxFps(float maxFps) override;
50     ::ndk::ScopedAStatus setTimeLapseConfig(double fps, double captureFps) override;
51     ::ndk::ScopedAStatus setStartTimeUs(int64_t startTimeUs) override;
52     ::ndk::ScopedAStatus setStopTimeUs(int64_t stopTimeUs) override;
53     ::ndk::ScopedAStatus getStopTimeOffsetUs(int64_t *_aidl_return) override;
54     ::ndk::ScopedAStatus setColorAspects(
55             const ::aidl::android::media::AidlColorAspects& aspects) override;
56     ::ndk::ScopedAStatus setTimeOffsetUs(int64_t timeOffsetUs) override;
57     ::ndk::ScopedAStatus signalEndOfInputStream() override;
58 };
59 
60 }  // namespace android::media
61