• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2023 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 package android.companion.virtualcamera;
18 
19 import android.companion.virtualcamera.Format;
20 import android.view.Surface;
21 
22 /**
23  * AIDL Interface to receive callbacks from virtual camera instance.
24  * @hide
25  */
26 oneway interface IVirtualCameraCallback {
27 
28     /**
29      * Called when there's new video stream. This callback is send after clients opens and
30      * configures camera. Implementation should hold onto the surface until corresponding
31      * terminateStream call is received.
32      *
33      * @param streamId - id of the video stream.
34      * @param surface - Surface representing the virtual camera sensor.
35      * @param width - width of the surface.
36      * @param height - height of the surface.
37      * @param pixelFormat - pixel format of the surface.
38      */
onStreamConfigured(int streamId, in Surface surface, int width, int height, in Format pixelFormat)39     void onStreamConfigured(int streamId, in Surface surface, int width, int height,
40             in Format pixelFormat);
41 
42     /**
43      * Called when framework requests capture. This can be used by the client as a hint
44      * to render another frame into input surface.
45      *
46      * @param streamId - id of the stream corresponding to the Surface for which next
47      *     frame is requested.
48      * @param frameId - id of the requested frame.
49      */
onProcessCaptureRequest(int streamId, int frameId)50     void onProcessCaptureRequest(int streamId, int frameId);
51 
52     /**
53      * Called when the corresponding stream is no longer in use. Implementation should dispose of
54      * corresponding Surface upon receiving this call and no longer interact with it.
55      *
56      * @param streamId - id of the video stream to terminate.
57      */
onStreamClosed(int streamId)58     void onStreamClosed(int streamId);
59 }
60