Interface Muxer

  • All Known Implementing Classes:

    public interface Muxer
    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.

    • Method Detail

      • writeSampleData

        void writeSampleData​(int trackIndex,
                             ByteBuffer data,
                             boolean isKeyFrame,
                             long presentationTimeUs)
                      throws Muxer.MuxerException
        Writes the specified sample.
        trackIndex - The index of the track, previously returned by addTrack(Format).
        data - A buffer containing the sample data to write to the container.
        isKeyFrame - Whether the sample is a key frame.
        presentationTimeUs - The presentation time of the sample in microseconds.
        Muxer.MuxerException - If the muxer fails to write the sample.
      • release

        void release​(boolean forCancellation)
              throws Muxer.MuxerException
        Finishes writing the output and releases any resources associated with muxing.

        The muxer cannot be used anymore once this method has been called.

        forCancellation - Whether the reason for releasing the resources is the transformation cancellation.
        Muxer.MuxerException - If the muxer fails to finish writing the output and forCancellation is false.
      • getMaxDelayBetweenSamplesMs

        long getMaxDelayBetweenSamplesMs()
        Returns the maximum delay allowed between output samples, in milliseconds, or C.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 transformation when the maximum delay is reached. Note that there is no guarantee that the transformation will be aborted exactly at that time.