| 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.MediaCodecInfo; |
| 15 | import android.media.MediaCrypto; |
| 16 | import android.media.MediaFormat; |
| 17 | import android.os.Bundle; |
| 18 | import android.view.Surface; |
| 19 | import java.nio.ByteBuffer; |
| 20 |
| 21 | /** |
| 22 | * Subset of methods defined in {@link android.media.MediaCodec} needed by |
| 23 | * {@link HardwareVideoEncoder} and {@link AndroidVideoDecoder}. This interface |
| 24 | * exists to allow mocking and using a fake implementation in tests. |
| 25 | */ |
| 26 | interface MediaCodecWrapper { |
| 27 | void configure(MediaFormat format, Surface surface, MediaCrypto crypto, int flags); |
| 28 |
| 29 | void start(); |
| 30 |
| 31 | void flush(); |
| 32 |
| 33 | void stop(); |
| 34 |
| 35 | void release(); |
| 36 |
| 37 | int dequeueInputBuffer(long timeoutUs); |
| 38 |
| 39 | void queueInputBuffer(int index, int offset, int size, long presentationTimeUs, int flags); |
| 40 |
| 41 | int dequeueOutputBuffer(MediaCodec.BufferInfo info, long timeoutUs); |
| 42 |
| 43 | void releaseOutputBuffer(int index, boolean render); |
| 44 |
| 45 | MediaFormat getInputFormat(); |
| 46 |
| 47 | MediaFormat getOutputFormat(); |
| 48 |
| 49 | MediaFormat getOutputFormat(int index); |
| 50 |
| 51 | ByteBuffer getInputBuffer(int index); |
| 52 |
| 53 | ByteBuffer getOutputBuffer(int index); |
| 54 |
| 55 | Surface createInputSurface(); |
| 56 |
| 57 | void setParameters(Bundle params); |
| 58 |
| 59 | MediaCodecInfo getCodecInfo(); |
| 60 | } |
| 61 |