Class DefaultMuxer

  • All Implemented Interfaces:
    Muxer

    public final class DefaultMuxer
    extends Object
    implements Muxer
    A default Muxer implementation.
    • Method Detail

      • writeSampleData

        public void writeSampleData​(int trackIndex,
                                    ByteBuffer data,
                                    boolean isKeyFrame,
                                    long presentationTimeUs)
                             throws Muxer.MuxerException
        Description copied from interface: Muxer
        Writes the specified sample.
        Specified by:
        writeSampleData in interface Muxer
        Parameters:
        trackIndex - The index of the track, previously returned by Muxer.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.
        Throws:
        Muxer.MuxerException - If the muxer fails to write the sample.
      • release

        public void release​(boolean forCancellation)
                     throws Muxer.MuxerException
        Description copied from interface: Muxer
        Finishes writing the output and releases any resources associated with muxing.

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

        Specified by:
        release in interface Muxer
        Parameters:
        forCancellation - Whether the reason for releasing the resources is the transformation cancellation.
        Throws:
        Muxer.MuxerException - If the muxer fails to finish writing the output and forCancellation is false.
      • getMaxDelayBetweenSamplesMs

        public long getMaxDelayBetweenSamplesMs()
        Description copied from interface: Muxer
        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.

        Specified by:
        getMaxDelayBetweenSamplesMs in interface Muxer