DefaultMuxer
@UnstableApi
public final class DefaultMuxer implements Muxer
A default Muxer implementation.
Summary
Nested types |
|---|
public final class DefaultMuxer.Factory implements Muxer.FactoryA |
Constants |
|
|---|---|
static final String |
Public methods |
|
|---|---|
void |
addMetadataEntry(Metadata.Entry metadataEntry)Adds |
int |
Adds a track of the given media format. |
void |
close()Closes the file. |
void |
writeSampleData(Writes encoded sample data. |
Inherited methods |
||
|---|---|---|
|
Constants
Public methods
addMetadataEntry
public void addMetadataEntry(Metadata.Entry metadataEntry)
Adds metadata about the output file.
addTrack
public int addTrack(Format format)
Adds a track of the given media format.
All tracks must be added before any samples are written to any track.
| Returns | |
|---|---|
int |
A track id for this track, which should be passed to |
| Throws | |
|---|---|
androidx.media3.muxer.MuxerException |
If the muxer encounters a problem while adding the track. |
close
public void close()
Closes the file.
The muxer cannot be used anymore once this method returns.
| Throws | |
|---|---|
androidx.media3.muxer.MuxerException |
If the muxer fails to finish writing the output. |
writeSampleData
public void writeSampleData(
int trackId,
ByteBuffer byteBuffer,
BufferInfo bufferInfo
)
Writes encoded sample data.
| Parameters | |
|---|---|
int trackId |
The track id, previously returned by |
ByteBuffer byteBuffer |
A buffer containing the sample data to write to the container. |
BufferInfo bufferInfo |
The |
| Throws | |
|---|---|
androidx.media3.muxer.MuxerException |
If the muxer fails to write the sample. |