| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 |
| 11 | package org.webrtc; |
| 12 |
| 13 | import android.media.MediaCodec; |
| 14 | import android.media.MediaCrypto; |
| 15 | import android.media.MediaFormat; |
| 16 | import android.os.Bundle; |
| 17 | import android.view.Surface; |
| 18 | import java.nio.ByteBuffer; |
| 19 |
| 20 | /** |
| 21 | * Subset of methods defined in {@link android.media.MediaCodec} needed by |
| 22 | * {@link HardwareVideoEncoder} and {@link AndroidVideoDecoder}. This interface |
| 23 | * exists to allow mocking and using a fake implementation in tests. |
| 24 | */ |
| 25 | interface MediaCodecWrapper { |
| 26 | void configure(MediaFormat format, Surface surface, MediaCrypto crypto, int flags); |
| 27 |
| 28 | void start(); |
| 29 |
| 30 | void flush(); |
| 31 |
| 32 | void stop(); |
| 33 |
| 34 | void release(); |
| 35 |
| 36 | int dequeueInputBuffer(long timeoutUs); |
| 37 |
| 38 | void queueInputBuffer(int index, int offset, int size, long presentationTimeUs, int flags); |
| 39 |
| 40 | int dequeueOutputBuffer(MediaCodec.BufferInfo info, long timeoutUs); |
| 41 |
| 42 | void releaseOutputBuffer(int index, boolean render); |
| 43 |
| 44 | MediaFormat getOutputFormat(); |
| 45 |
| 46 | ByteBuffer[] getInputBuffers(); |
| 47 |
| 48 | ByteBuffer[] getOutputBuffers(); |
| 49 |
| 50 | Surface createInputSurface(); |
| 51 |
| 52 | void setParameters(Bundle params); |
| 53 | } |
| 54 |