xref: /aosp_15_r20/frameworks/av/media/codec2/hal/aidl/include/codec2/aidl/inputsurface/InputSurfaceConnection.h (revision ec779b8e0859a360c3d303172224686826e6e0e1)
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 <aidl/android/hardware/media/c2/BnInputSurfaceConnection.h>
20 #include <media/NdkImage.h>
21 
22 #include <C2.h>
23 
24 #include <memory>
25 
26 namespace aidl::android::hardware::media::c2::utils {
27 
28 struct InputSurfaceConnection : public BnInputSurfaceConnection {
29     InputSurfaceConnection();
30     c2_status_t status() const;
31 
32     // Methods from IInputSurfaceConnection follow.
33     ::ndk::ScopedAStatus disconnect() override;
34     ::ndk::ScopedAStatus signalEndOfStream() override;
35 
36     // implementation specific interface.
37 
38     // Submit a buffer to the connected component.
39     c2_status_t submitBuffer(
40             int32_t bufferId,
41             const AImage *buffer = nullptr,
42             int64_t timestamp = 0,
43             int fenceFd = -1);
44 
45     // Submit eos to the connected component.
46     c2_status_t submitEos(int32_t bufferId);
47 
48     // notify dataspace being changed to the component.
49     void dispatchDataSpaceChanged(
50             int32_t dataSpace, int32_t aspects, int32_t pixelFormat);
51 
52 protected:
53     virtual ~InputSurfaceConnection() override;
54 };
55 
56 }  // namespace aidl::android::hardware::media::c2::utils
57