[go: nahoru, domu]

Skip to content

Commit

Permalink
Remove supportsSampleMimeType from Muxer.Factory
Browse files Browse the repository at this point in the history
- This method is redundant with getSupportedSampleMimeTypes().
- This is to prepare the Muxer class to become public.

PiperOrigin-RevId: 480840902
  • Loading branch information
kim-vde authored and marcbaechinger committed Oct 20, 2022
1 parent 6052212 commit 8962f5a
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
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;
Expand Down Expand Up @@ -97,13 +96,6 @@ public boolean supportsOutputMimeType(String mimeType) {
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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -28,11 +27,12 @@
* 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 {

Expand Down Expand Up @@ -81,12 +81,6 @@ Muxer create(ParcelFileDescriptor parcelFileDescriptor, String outputMimeType)
*/
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}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ public void registerTrack() {

/** 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);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,10 @@ public Transformer build() {

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 "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -882,11 +882,6 @@ public boolean supportsOutputMimeType(String mimeType) {
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) {
Expand Down

0 comments on commit 8962f5a

Please sign in to comment.