Commit 8962f5a3 by kimvde Committed by Marc Baechinger

Remove supportsSampleMimeType from Muxer.Factory

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

PiperOrigin-RevId: 480840902
parent 6052212c
...@@ -26,7 +26,6 @@ import android.media.MediaFormat; ...@@ -26,7 +26,6 @@ import android.media.MediaFormat;
import android.media.MediaMuxer; import android.media.MediaMuxer;
import android.os.ParcelFileDescriptor; import android.os.ParcelFileDescriptor;
import android.util.SparseLongArray; import android.util.SparseLongArray;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi; import androidx.annotation.RequiresApi;
import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.Format; import com.google.android.exoplayer2.Format;
...@@ -98,13 +97,6 @@ import java.nio.ByteBuffer; ...@@ -98,13 +97,6 @@ import java.nio.ByteBuffer;
} }
@Override @Override
public boolean supportsSampleMimeType(
@Nullable String sampleMimeType, String containerMimeType) {
return getSupportedSampleMimeTypes(MimeTypes.getTrackType(sampleMimeType), containerMimeType)
.contains(sampleMimeType);
}
@Override
public ImmutableList<String> getSupportedSampleMimeTypes( public ImmutableList<String> getSupportedSampleMimeTypes(
@C.TrackType int trackType, String containerMimeType) { @C.TrackType int trackType, String containerMimeType) {
// MediaMuxer supported sample formats are documented in MediaMuxer.addTrack(MediaFormat). // MediaMuxer supported sample formats are documented in MediaMuxer.addTrack(MediaFormat).
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package com.google.android.exoplayer2.transformer; package com.google.android.exoplayer2.transformer;
import android.os.ParcelFileDescriptor; import android.os.ParcelFileDescriptor;
import androidx.annotation.Nullable;
import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.Format; import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.util.MimeTypes; import com.google.android.exoplayer2.util.MimeTypes;
...@@ -28,11 +27,12 @@ import java.nio.ByteBuffer; ...@@ -28,11 +27,12 @@ import java.nio.ByteBuffer;
* Abstracts media muxing operations. * Abstracts media muxing operations.
* *
* <p>Query whether {@linkplain Factory#supportsOutputMimeType(String) container MIME type} and * <p>Query whether {@linkplain Factory#supportsOutputMimeType(String) container MIME type} and
* {@linkplain Factory#supportsSampleMimeType(String, String) sample MIME types} are supported and * {@linkplain Factory#getSupportedSampleMimeTypes(int, String)} sample MIME types} are supported
* {@linkplain #addTrack(Format) add all tracks}, then {@linkplain #writeSampleData(int, ByteBuffer, * and {@linkplain #addTrack(Format) add all tracks}, then {@linkplain #writeSampleData(int,
* boolean, long) write sample data} to mux samples. Once any sample data has been written, it is * ByteBuffer, boolean, long) write sample data} to mux samples. Once any sample data has been
* not possible to add tracks. After writing all sample data, {@linkplain #release(boolean) release} * written, it is not possible to add tracks. After writing all sample data, {@linkplain
* the instance to finish writing to the output and return any resources to the system. * #release(boolean) release} the instance to finish writing to the output and return any resources
* to the system.
*/ */
/* package */ interface Muxer { /* package */ interface Muxer {
...@@ -82,12 +82,6 @@ import java.nio.ByteBuffer; ...@@ -82,12 +82,6 @@ import java.nio.ByteBuffer;
boolean supportsOutputMimeType(String mimeType); 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 * Returns the supported sample {@linkplain MimeTypes MIME types} for the given {@link
* C.TrackType} and container {@linkplain MimeTypes MIME type}. * C.TrackType} and container {@linkplain MimeTypes MIME type}.
*/ */
......
...@@ -88,7 +88,8 @@ import java.nio.ByteBuffer; ...@@ -88,7 +88,8 @@ import java.nio.ByteBuffer;
/** Returns whether the sample {@linkplain MimeTypes MIME type} is supported. */ /** Returns whether the sample {@linkplain MimeTypes MIME type} is supported. */
public boolean supportsSampleMimeType(@Nullable String mimeType) { public boolean supportsSampleMimeType(@Nullable String mimeType) {
return muxerFactory.supportsSampleMimeType(mimeType, containerMimeType); @C.TrackType int trackType = MimeTypes.getTrackType(mimeType);
return getSupportedSampleMimeTypes(trackType).contains(mimeType);
} }
/** /**
......
...@@ -483,7 +483,10 @@ public final class Transformer { ...@@ -483,7 +483,10 @@ public final class Transformer {
private void checkSampleMimeType(String sampleMimeType) { private void checkSampleMimeType(String sampleMimeType) {
checkState( checkState(
muxerFactory.supportsSampleMimeType(sampleMimeType, containerMimeType), muxerFactory
.getSupportedSampleMimeTypes(
MimeTypes.getTrackType(sampleMimeType), containerMimeType)
.contains(sampleMimeType),
"Unsupported sample MIME type " "Unsupported sample MIME type "
+ sampleMimeType + sampleMimeType
+ " for container MIME type " + " for container MIME type "
......
...@@ -883,11 +883,6 @@ public final class TransformerEndToEndTest { ...@@ -883,11 +883,6 @@ public final class TransformerEndToEndTest {
} }
@Override @Override
public boolean supportsSampleMimeType(String sampleMimeType, String outputMimeType) {
return frameworkMuxerFactory.supportsSampleMimeType(sampleMimeType, outputMimeType);
}
@Override
public ImmutableList<String> getSupportedSampleMimeTypes( public ImmutableList<String> getSupportedSampleMimeTypes(
@C.TrackType int trackType, String containerMimeType) { @C.TrackType int trackType, String containerMimeType) {
return frameworkMuxerFactory.getSupportedSampleMimeTypes(trackType, containerMimeType); return frameworkMuxerFactory.getSupportedSampleMimeTypes(trackType, containerMimeType);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment