From 74fb54a60fe5d2f5cd2936ad948394db69e714db Mon Sep 17 00:00:00 2001 From: kimvde Date: Fri, 19 Nov 2021 10:20:49 +0000 Subject: [PATCH] Transformer: deprecate setOutputMimeType PiperOrigin-RevId: 411010270 --- .../transformer/TranscodingTransformer.java | 42 ++++--------------- .../media3/transformer/Transformer.java | 42 ++++--------------- .../transformer/TransformerBuilderTest.java | 4 +- 3 files changed, 18 insertions(+), 70 deletions(-) diff --git a/libraries/transformer/src/main/java/androidx/media3/transformer/TranscodingTransformer.java b/libraries/transformer/src/main/java/androidx/media3/transformer/TranscodingTransformer.java index ea59207926..3a4bec0b76 100644 --- a/libraries/transformer/src/main/java/androidx/media3/transformer/TranscodingTransformer.java +++ b/libraries/transformer/src/main/java/androidx/media3/transformer/TranscodingTransformer.java @@ -252,17 +252,8 @@ public final class TranscodingTransformer { } /** - * Sets the MIME type of the output. The default value is {@link MimeTypes#VIDEO_MP4}. Supported - * values are: - * - * - * - * @param outputMimeType The MIME type of the container. - * @return This builder. - * @deprecated Use {@link #setContainerMimeType} instead. + * @deprecated This feature will be removed in a following release and the MIME type of the + * output will always be MP4. */ @Deprecated public Builder setOutputMimeType(String outputMimeType) { @@ -270,23 +261,6 @@ public final class TranscodingTransformer { return this; } - /** - * Sets the MIME type of the output container. The default value is {@link MimeTypes#VIDEO_MP4}. - * Supported values are: - * - * - * - * @param containerMimeType The MIME type of the container. - * @return This builder. - */ - public Builder setContainerMimeType(String containerMimeType) { - this.containerMimeType = containerMimeType; - return this; - } - /** * Sets the video MIME type of the output. The default value is to use the same MIME type as the * input. Supported values are: @@ -547,9 +521,9 @@ public final class TranscodingTransformer { * *

Concurrent transformations on the same TranscodingTransformer object are not allowed. * - *

The output can contain at most one video track and one audio track. Other track types are - * ignored. For adaptive bitrate {@link MediaSource media sources}, the highest bitrate video and - * audio streams are selected. + *

The output is an MP4 file. It can contain at most one video track and one audio track. Other + * track types are ignored. For adaptive bitrate {@link MediaSource media sources}, the highest + * bitrate video and audio streams are selected. * * @param mediaItem The {@link MediaItem} to transform. The supported sample formats depend on the * {@link Muxer} and on the output container format. For the {@link FrameworkMuxer}, they are @@ -572,9 +546,9 @@ public final class TranscodingTransformer { * *

Concurrent transformations on the same TranscodingTransformer object are not allowed. * - *

The output can contain at most one video track and one audio track. Other track types are - * ignored. For adaptive bitrate {@link MediaSource media sources}, the highest bitrate video and - * audio streams are selected. + *

The output is an MP4 file. It can contain at most one video track and one audio track. Other + * track types are ignored. For adaptive bitrate {@link MediaSource media sources}, the highest + * bitrate video and audio streams are selected. * * @param mediaItem The {@link MediaItem} to transform. The supported sample formats depend on the * {@link Muxer} and on the output container format. For the {@link FrameworkMuxer}, they are diff --git a/libraries/transformer/src/main/java/androidx/media3/transformer/Transformer.java b/libraries/transformer/src/main/java/androidx/media3/transformer/Transformer.java index 6455ae389f..c450130894 100644 --- a/libraries/transformer/src/main/java/androidx/media3/transformer/Transformer.java +++ b/libraries/transformer/src/main/java/androidx/media3/transformer/Transformer.java @@ -210,17 +210,8 @@ public final class Transformer { } /** - * Sets the MIME type of the output. The default value is {@link MimeTypes#VIDEO_MP4}. Supported - * values are: - * - *

- * - * @param outputMimeType The MIME type of the container. - * @return This builder. - * @deprecated Use {@link #setContainerMimeType} instead. + * @deprecated This feature will be removed in a following release and the MIME type of the + * output will always be MP4. */ @Deprecated public Builder setOutputMimeType(String outputMimeType) { @@ -228,23 +219,6 @@ public final class Transformer { return this; } - /** - * Sets the MIME type of the output container. The default value is {@link MimeTypes#VIDEO_MP4}. - * Supported values are: - * - * - * - * @param containerMimeType The MIME type of the output. - * @return This builder. - */ - public Builder setContainerMimeType(String containerMimeType) { - this.containerMimeType = containerMimeType; - return this; - } - /** * Sets the {@link Transformer.Listener} to listen to the transformation events. * @@ -435,9 +409,9 @@ public final class Transformer { * *

Concurrent transformations on the same Transformer object are not allowed. * - *

The output can contain at most one video track and one audio track. Other track types are - * ignored. For adaptive bitrate {@link MediaSource media sources}, the highest bitrate video and - * audio streams are selected. + *

The output is an MP4 file. It can contain at most one video track and one audio track. Other + * track types are ignored. For adaptive bitrate {@link MediaSource media sources}, the highest + * bitrate video and audio streams are selected. * * @param mediaItem The {@link MediaItem} to transform. The supported sample formats depend on the * {@link Muxer} and on the output container format. For the {@link FrameworkMuxer}, they are @@ -460,9 +434,9 @@ public final class Transformer { * *

Concurrent transformations on the same Transformer object are not allowed. * - *

The output can contain at most one video track and one audio track. Other track types are - * ignored. For adaptive bitrate {@link MediaSource media sources}, the highest bitrate video and - * audio streams are selected. + *

The output is an MP4 file. It can contain at most one video track and one audio track. Other + * track types are ignored. For adaptive bitrate {@link MediaSource media sources}, the highest + * bitrate video and audio streams are selected. * * @param mediaItem The {@link MediaItem} to transform. The supported sample formats depend on the * {@link Muxer} and on the output container format. For the {@link FrameworkMuxer}, they are diff --git a/libraries/transformer/src/test/java/androidx/media3/transformer/TransformerBuilderTest.java b/libraries/transformer/src/test/java/androidx/media3/transformer/TransformerBuilderTest.java index e27bc2e037..7e19f2c250 100644 --- a/libraries/transformer/src/test/java/androidx/media3/transformer/TransformerBuilderTest.java +++ b/libraries/transformer/src/test/java/androidx/media3/transformer/TransformerBuilderTest.java @@ -30,10 +30,10 @@ import org.junit.runner.RunWith; public class TransformerBuilderTest { @Test - public void setContainerMimeType_unsupportedMimeType_throws() { + public void setOutputMimeType_unsupportedMimeType_throws() { assertThrows( IllegalStateException.class, - () -> new Transformer.Builder().setContainerMimeType(MimeTypes.VIDEO_FLV).build()); + () -> new Transformer.Builder().setOutputMimeType(MimeTypes.VIDEO_FLV).build()); } @Test