Chong Zhang | 6d332d2 | 2016-09-07 12:06:50 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2016 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; |
| 18 | |
| 19 | import android.OMXFenceParcelable; |
| 20 | |
| 21 | /** |
| 22 | * Binder interface for a buffer source to be used together with an OMX encoder |
| 23 | * |
| 24 | * @hide |
| 25 | */ |
| 26 | interface IOMXBufferSource { |
| 27 | /** |
| 28 | * This is called when OMX transitions to OMX_StateExecuting, which means |
| 29 | * we can start handing it buffers. If we already have buffers of data |
| 30 | * sitting in the BufferQueue, this will send them to the codec. |
| 31 | */ |
| 32 | void onOmxExecuting(); |
| 33 | |
| 34 | /** |
| 35 | * This is called when OMX transitions to OMX_StateIdle, indicating that |
| 36 | * the codec is meant to return all buffers back to the client for them |
| 37 | * to be freed. Do NOT submit any more buffers to the component. |
| 38 | */ |
| 39 | void onOmxIdle(); |
| 40 | |
| 41 | /** |
| 42 | * This is called when OMX transitions to OMX_StateLoaded, indicating that |
| 43 | * we are shutting down. |
| 44 | */ |
| 45 | void onOmxLoaded(); |
| 46 | |
| 47 | /** |
| 48 | * A "codec buffer", i.e. a buffer that can be used to pass data into |
| 49 | * the encoder, has been allocated. |
| 50 | */ |
| 51 | void onInputBufferAdded(int bufferID); |
| 52 | |
| 53 | /** |
| 54 | * Called from OnEmptyBufferDone. If we have a BQ buffer available, |
| 55 | * fill it with a new frame of data; otherwise, just mark it as available. |
| 56 | * |
| 57 | * fenceParcel contains the fence's fd that the callee should wait on before |
| 58 | * using the buffer (or pass on to the user of the buffer, if the user supports |
| 59 | * fences). Callee takes ownership of the fence fd even if it fails. |
| 60 | */ |
| 61 | void onInputBufferEmptied(int bufferID, in OMXFenceParcelable fenceParcel); |
| 62 | } |