Remove supportsSampleMimeType from Muxer.Factory

- This method is redundant with getSupportedSampleMimeTypes().
- This is to prepare the Muxer class to become public.

PiperOrigin-RevId: 480840902
(cherry picked from commit 8962f5a3f4b505224ceb22ac5771b85f24e30358)
This commit is contained in:
kimvde 2022-10-13 09:52:26 +00:00 committed by microkatz
parent 3aca9bc0d3
commit 267725c54a
5 changed files with 12 additions and 27 deletions

View File

@ -26,7 +26,6 @@ import android.media.MediaFormat;
import android.media.MediaMuxer;
import android.os.ParcelFileDescriptor;
import android.util.SparseLongArray;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.Format;
@ -97,13 +96,6 @@ import java.nio.ByteBuffer;
return true;
}
@Override
public boolean supportsSampleMimeType(
@Nullable String sampleMimeType, String containerMimeType) {
return getSupportedSampleMimeTypes(MimeTypes.getTrackType(sampleMimeType), containerMimeType)
.contains(sampleMimeType);
}
@Override
public ImmutableList<String> getSupportedSampleMimeTypes(
@C.TrackType int trackType, String containerMimeType) {

View File

@ -16,7 +16,6 @@
package com.google.android.exoplayer2.transformer;
import android.os.ParcelFileDescriptor;
import androidx.annotation.Nullable;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.util.MimeTypes;
@ -28,11 +27,12 @@ import java.nio.ByteBuffer;
* Abstracts media muxing operations.
*
* <p>Query whether {@linkplain Factory#supportsOutputMimeType(String) container MIME type} and
* {@linkplain Factory#supportsSampleMimeType(String, String) 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.
* {@linkplain Factory#getSupportedSampleMimeTypes(int, String)} 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 {
@ -81,12 +81,6 @@ import java.nio.ByteBuffer;
*/
boolean supportsOutputMimeType(String mimeType);
/**
* Returns whether the sample {@linkplain MimeTypes MIME type} is supported with the given
* container {@linkplain MimeTypes MIME type}.
*/
boolean supportsSampleMimeType(@Nullable String sampleMimeType, String containerMimeType);
/**
* Returns the supported sample {@linkplain MimeTypes MIME types} for the given {@link
* C.TrackType} and container {@linkplain MimeTypes MIME type}.

View File

@ -88,7 +88,8 @@ import java.nio.ByteBuffer;
/** Returns whether the sample {@linkplain MimeTypes MIME type} is supported. */
public boolean supportsSampleMimeType(@Nullable String mimeType) {
return muxerFactory.supportsSampleMimeType(mimeType, containerMimeType);
@C.TrackType int trackType = MimeTypes.getTrackType(mimeType);
return getSupportedSampleMimeTypes(trackType).contains(mimeType);
}
/**

View File

@ -483,7 +483,10 @@ public final class Transformer {
private void checkSampleMimeType(String sampleMimeType) {
checkState(
muxerFactory.supportsSampleMimeType(sampleMimeType, containerMimeType),
muxerFactory
.getSupportedSampleMimeTypes(
MimeTypes.getTrackType(sampleMimeType), containerMimeType)
.contains(sampleMimeType),
"Unsupported sample MIME type "
+ sampleMimeType
+ " for container MIME type "

View File

@ -882,11 +882,6 @@ public final class TransformerEndToEndTest {
return true;
}
@Override
public boolean supportsSampleMimeType(String sampleMimeType, String outputMimeType) {
return frameworkMuxerFactory.supportsSampleMimeType(sampleMimeType, outputMimeType);
}
@Override
public ImmutableList<String> getSupportedSampleMimeTypes(
@C.TrackType int trackType, String containerMimeType) {