public interface TuSdkMediaMuxer
限定符和类型 | 方法和说明 |
---|---|
int |
addTrack(android.media.MediaFormat format)
Adds a track with the specified format.
|
void |
writeSampleData(int trackIndex,
java.nio.ByteBuffer byteBuf,
android.media.MediaCodec.BufferInfo bufferInfo)
Writes an encoded sample into the muxer.
|
int addTrack(android.media.MediaFormat format)
The following table summarizes support for specific format keys across android releases. Keys marked with '+:' are required.
format
- The media format for the track. This must not be an empty
MediaFormat.writeSampleData(int, java.nio.ByteBuffer, android.media.MediaCodec.BufferInfo)
.java.lang.IllegalArgumentException
- if format is invalid.java.lang.IllegalStateException
- if muxer is in the wrong state.void writeSampleData(int trackIndex, java.nio.ByteBuffer byteBuf, android.media.MediaCodec.BufferInfo bufferInfo)
The application needs to make sure that the samples are written into the right tracks. Also, it needs to make sure the samples for each track are written in chronological order (e.g. in the order they are provided by the encoder.)
trackIndex
- The track index for this sample.byteBuf
- The encoded sample.bufferInfo
- The buffer information related to this sample.java.lang.IllegalArgumentException
- if trackIndex, byteBuf or bufferInfo is invalid.java.lang.IllegalStateException
- if muxer is in wrong state.
MediaMuxer uses the flags provided in MediaCodec.BufferInfo
,
to signal sync frames.