@UnstableApi
class WavMuxer : Muxer


A muxer for creating a WAV container file.

This muxer supports muxing of AUDIO_RAW with PCM encodings.

Summary

Public constructors

WavMuxer(seekableMuxerOutput: SeekableMuxerOutput!)

Creates an instance.

Public functions

Unit

Adds metadata about the output file.

Int
addTrack(format: Format!)

Adds a track of the given media format.

Unit

Closes the file.

Unit
writeSampleData(
    trackId: Int,
    byteBuffer: ByteBuffer!,
    bufferInfo: BufferInfo!
)

Writes encoded sample data.

Inherited functions

From java.lang.AutoCloseable
abstract Unit

Public constructors

WavMuxer

WavMuxer(seekableMuxerOutput: SeekableMuxerOutput!)

Creates an instance.

Parameters
seekableMuxerOutput: SeekableMuxerOutput!

The SeekableMuxerOutput to write the media data to. It will be automatically closed by the muxer when close is called.

Public functions

addMetadataEntry

fun addMetadataEntry(metadataEntry: Metadata.Entry!): Unit

Adds metadata about the output file.

addTrack

fun addTrack(format: Format!): Int

Adds a track of the given media format.

All tracks must be added before any samples are written to any track.

Only a single audio track is supported.

close

fun close(): Unit

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

fun writeSampleData(
    trackId: Int,
    byteBuffer: ByteBuffer!,
    bufferInfo: BufferInfo!
): Unit

Writes encoded sample data.

The bufferInfo is ignored.