diff --git a/library/transformer/src/main/java/com/google/android/exoplayer2/transformer/Muxer.java b/library/transformer/src/main/java/com/google/android/exoplayer2/transformer/Muxer.java index 7d0f151494..59933fca0e 100644 --- a/library/transformer/src/main/java/com/google/android/exoplayer2/transformer/Muxer.java +++ b/library/transformer/src/main/java/com/google/android/exoplayer2/transformer/Muxer.java @@ -26,17 +26,17 @@ import java.nio.ByteBuffer; /** * Abstracts media muxing operations. * - *
Query whether {@linkplain Factory#getSupportedSampleMimeTypes(int)} sample MIME types} are + *
Query whether {@linkplain Factory#getSupportedSampleMimeTypes(int) sample MIME types} are * supported and {@linkplain #addTrack(Format) add all tracks}, then {@linkplain * #writeSampleData(int, ByteBuffer, boolean, long) 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, * {@linkplain #release(boolean) release} the instance to finish writing to the output and return * any resources to the system. */ -/* package */ interface Muxer { +public interface Muxer { /** Thrown when a muxing failure occurs. */ - /* package */ final class MuxerException extends Exception { + final class MuxerException extends Exception { /** * Creates an instance. * @@ -91,7 +91,7 @@ import java.nio.ByteBuffer; * Writes the specified sample. * * @param trackIndex The index of the track, previously returned by {@link #addTrack(Format)}. - * @param data Buffer containing the sample data to write to the container. + * @param data A buffer containing the sample data to write to the container. * @param isKeyFrame Whether the sample is a key frame. * @param presentationTimeUs The presentation time of the sample in microseconds. * @throws MuxerException If the muxer fails to write the sample. @@ -100,11 +100,13 @@ import java.nio.ByteBuffer; throws MuxerException; /** - * Releases any resources associated with muxing. + * Finishes writing the output and releases any resources associated with muxing. + * + *
The muxer cannot be used anymore once this method has been called. * * @param forCancellation Whether the reason for releasing the resources is the transformation * cancellation. - * @throws MuxerException If the muxer fails to stop or release resources and {@code + * @throws MuxerException If the muxer fails to finish writing the output and {@code * forCancellation} is false. */ void release(boolean forCancellation) throws MuxerException; diff --git a/library/transformer/src/main/java/com/google/android/exoplayer2/transformer/MuxerWrapper.java b/library/transformer/src/main/java/com/google/android/exoplayer2/transformer/MuxerWrapper.java index a3f47fe3c5..817586d03e 100644 --- a/library/transformer/src/main/java/com/google/android/exoplayer2/transformer/MuxerWrapper.java +++ b/library/transformer/src/main/java/com/google/android/exoplayer2/transformer/MuxerWrapper.java @@ -184,13 +184,13 @@ import java.nio.ByteBuffer; } /** - * Releases any resources associated with muxing. + * Finishes writing the output and releases any resources associated with muxing. * *
The muxer cannot be used anymore once this method has been called. * * @param forCancellation Whether the reason for releasing the resources is the transformation * cancellation. - * @throws Muxer.MuxerException If the underlying muxer fails to stop and to release resources and + * @throws Muxer.MuxerException If the underlying muxer fails to finish writing the output and * {@code forCancellation} is false. */ public void release(boolean forCancellation) throws Muxer.MuxerException { diff --git a/library/transformer/src/main/java/com/google/android/exoplayer2/transformer/Transformer.java b/library/transformer/src/main/java/com/google/android/exoplayer2/transformer/Transformer.java index 32f95a418e..50be7774f7 100644 --- a/library/transformer/src/main/java/com/google/android/exoplayer2/transformer/Transformer.java +++ b/library/transformer/src/main/java/com/google/android/exoplayer2/transformer/Transformer.java @@ -371,6 +371,20 @@ public final class Transformer { return this; } + /** + * Sets the factory for muxers that write the media container. + * + *
The default value is a {@link DefaultMuxer.Factory}. + * + * @param muxerFactory A {@link Muxer.Factory}. + * @return This builder. + */ + @CanIgnoreReturnValue + public Builder setMuxerFactory(Muxer.Factory muxerFactory) { + this.muxerFactory = muxerFactory; + return this; + } + /** * Sets a provider for views to show diagnostic information (if available) during * transformation. @@ -405,21 +419,6 @@ public final class Transformer { return this; } - /** - * Sets the factory for muxers that write the media container. - * - *
The default value is a {@link DefaultMuxer.Factory}. - * - * @param muxerFactory A {@link Muxer.Factory}. - * @return This builder. - */ - @CanIgnoreReturnValue - @VisibleForTesting - /* package */ Builder setMuxerFactory(Muxer.Factory muxerFactory) { - this.muxerFactory = muxerFactory; - return this; - } - /** * Builds a {@link Transformer} instance. *