1 /* 2 * Copyright (C) 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 package android.media; 18 19 import android.os.ParcelFileDescriptor; 20 21 /** 22 * Binder interface for controlling and handling IAidlGraphicBufferSource 23 * from the process which owns IAidlNode. 24 * 25 * In order to support Persistent InputSurface and/or MediaRecorder 26 */ 27 interface IAidlBufferSource { 28 /** 29 * This is called when IAidlGraphicBufferSource can start handing buffers. 30 * If we already have buffers of data sitting in the BufferQueue, 31 * this will send them to the codec. 32 */ onStart()33 void onStart(); 34 35 /** 36 * This is called when IAidlGraphicBufferSource indicaters that 37 * the codec is meant to return all buffers back to the client for them 38 * to be freed. Do NOT submit any more buffers to the component. 39 */ onStop()40 void onStop(); 41 42 /** 43 * This is called when IAidlGraphicBufferSource indicates that 44 * we are shutting down. 45 */ onRelease()46 void onRelease(); 47 48 /** 49 * A "codec buffer", i.e. a buffer that can be used to pass data into 50 * the encoder, has been allocated. 51 */ onInputBufferAdded(int bufferID)52 void onInputBufferAdded(int bufferID); 53 54 /** 55 * If we have a BQ buffer available, 56 * fill it with a new frame of data; otherwise, just mark it as available. 57 * 58 * fence contains the fence's fd that the callee should wait on before 59 * using the buffer (or pass on to the user of the buffer, if the user supports 60 * fences). Callee takes ownership of the fence fd even if it fails. 61 */ onInputBufferEmptied(int bufferID, in @nullable ParcelFileDescriptor fence)62 void onInputBufferEmptied(int bufferID, in @nullable ParcelFileDescriptor fence); 63 } 64 65