Interface Muxer
-
- All Known Implementing Classes:
DefaultMuxer
,InAppMuxer
@Deprecated public interface Muxer
Deprecated.com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.Abstracts media muxing operations.Query whether sample MIME types are supported and add all tracks, then write sample data to mux samples. Once any sample data has been written, it is not possible to add tracks. After writing all sample data, release the instance to finish writing to the output and return any resources to the system.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
Muxer.Factory
Deprecated.Factory for muxers.static class
Muxer.MuxerException
Deprecated.Thrown when a muxing failure occurs.
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description void
addMetadata(Metadata metadata)
Deprecated.AddsMetadata
about the output file.int
addTrack(Format format)
Deprecated.Adds a track with the specified format.long
getMaxDelayBetweenSamplesMs()
Deprecated.Returns the maximum delay allowed between output samples, in milliseconds, orC.TIME_UNSET
if there is no maximum.void
release(boolean forCancellation)
Deprecated.Finishes writing the output and releases any resources associated with muxing.void
writeSampleData(int trackIndex, ByteBuffer data, long presentationTimeUs, @com.google.android.exoplayer2.C.BufferFlags int flags)
Deprecated.Writes the specified sample.
-
-
-
Method Detail
-
addTrack
int addTrack(Format format) throws Muxer.MuxerException
Deprecated.Adds a track with the specified format.- Parameters:
format
- TheFormat
of the track.- Returns:
- The index for this track, which should be passed to
writeSampleData(int, java.nio.ByteBuffer, long, @com.google.android.exoplayer2.C.BufferFlags int)
. - Throws:
Muxer.MuxerException
- If the muxer encounters a problem while adding the track.
-
writeSampleData
void writeSampleData(int trackIndex, ByteBuffer data, long presentationTimeUs, @com.google.android.exoplayer2.C.BufferFlags int flags) throws Muxer.MuxerException
Deprecated.Writes the specified sample.- Parameters:
trackIndex
- The index of the track, previously returned byaddTrack(Format)
.data
- A buffer containing the sample data to write to the container.presentationTimeUs
- The presentation time of the sample in microseconds.flags
- TheC.BufferFlags
associated with the data. OnlyC.BUFFER_FLAG_KEY_FRAME
andC.BUFFER_FLAG_END_OF_STREAM
are supported.- Throws:
Muxer.MuxerException
- If the muxer fails to write the sample.
-
release
void release(boolean forCancellation) throws Muxer.MuxerException
Deprecated.Finishes writing the output and releases any resources associated with muxing.The muxer cannot be used anymore once this method has been called.
- Parameters:
forCancellation
- Whether the reason for releasing the resources is the export cancellation.- Throws:
Muxer.MuxerException
- If the muxer fails to finish writing the output andforCancellation
is false.
-
getMaxDelayBetweenSamplesMs
long getMaxDelayBetweenSamplesMs()
Deprecated.Returns the maximum delay allowed between output samples, in milliseconds, orC.TIME_UNSET
if there is no maximum.This is the maximum delay between samples of any track. They can be of the same or of different track types.
This value is used to abort the export when the maximum delay is reached. Note that there is no guarantee that the export will be aborted exactly at that time.
-
-