mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Move supported sample mime types list in specific muxer
This will reduce the risk of list becoming stale (its already stale, to be fixed). PiperOrigin-RevId: 716685242
This commit is contained in:
parent
a0618eb0ec
commit
c797249998
@ -22,12 +22,14 @@ import android.media.MediaCodec.BufferInfo;
|
||||
import android.util.SparseArray;
|
||||
import androidx.media3.common.Format;
|
||||
import androidx.media3.common.Metadata;
|
||||
import androidx.media3.common.MimeTypes;
|
||||
import androidx.media3.common.util.UnstableApi;
|
||||
import androidx.media3.container.MdtaMetadataEntry;
|
||||
import androidx.media3.container.Mp4LocationData;
|
||||
import androidx.media3.container.Mp4OrientationData;
|
||||
import androidx.media3.container.Mp4TimestampData;
|
||||
import androidx.media3.container.XmpData;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.errorprone.annotations.CanIgnoreReturnValue;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
@ -140,6 +142,24 @@ public final class FragmentedMp4Muxer implements Muxer {
|
||||
}
|
||||
}
|
||||
|
||||
/** A list of supported video {@linkplain MimeTypes sample MIME types}. */
|
||||
public static final ImmutableList<String> SUPPORTED_VIDEO_SAMPLE_MIME_TYPES =
|
||||
ImmutableList.of(
|
||||
MimeTypes.VIDEO_AV1,
|
||||
MimeTypes.VIDEO_H263,
|
||||
MimeTypes.VIDEO_H264,
|
||||
MimeTypes.VIDEO_H265,
|
||||
MimeTypes.VIDEO_MP4V);
|
||||
|
||||
/** A list of supported audio {@linkplain MimeTypes sample MIME types}. */
|
||||
public static final ImmutableList<String> SUPPORTED_AUDIO_SAMPLE_MIME_TYPES =
|
||||
ImmutableList.of(
|
||||
MimeTypes.AUDIO_AAC,
|
||||
MimeTypes.AUDIO_AMR_NB,
|
||||
MimeTypes.AUDIO_AMR_WB,
|
||||
MimeTypes.AUDIO_OPUS,
|
||||
MimeTypes.AUDIO_VORBIS);
|
||||
|
||||
private final FragmentedMp4Writer fragmentedMp4Writer;
|
||||
private final MetadataCollector metadataCollector;
|
||||
private final SparseArray<Track> trackIdToTrack;
|
||||
|
@ -34,6 +34,7 @@ import androidx.annotation.Nullable;
|
||||
import androidx.media3.common.C;
|
||||
import androidx.media3.common.Format;
|
||||
import androidx.media3.common.Metadata;
|
||||
import androidx.media3.common.MimeTypes;
|
||||
import androidx.media3.common.util.Log;
|
||||
import androidx.media3.common.util.UnstableApi;
|
||||
import androidx.media3.container.MdtaMetadataEntry;
|
||||
@ -41,6 +42,7 @@ import androidx.media3.container.Mp4LocationData;
|
||||
import androidx.media3.container.Mp4OrientationData;
|
||||
import androidx.media3.container.Mp4TimestampData;
|
||||
import androidx.media3.container.XmpData;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import com.google.errorprone.annotations.CanIgnoreReturnValue;
|
||||
import java.io.FileInputStream;
|
||||
@ -335,6 +337,24 @@ public final class Mp4Muxer implements Muxer {
|
||||
}
|
||||
}
|
||||
|
||||
/** A list of supported video {@linkplain MimeTypes sample MIME types}. */
|
||||
public static final ImmutableList<String> SUPPORTED_VIDEO_SAMPLE_MIME_TYPES =
|
||||
ImmutableList.of(
|
||||
MimeTypes.VIDEO_AV1,
|
||||
MimeTypes.VIDEO_H263,
|
||||
MimeTypes.VIDEO_H264,
|
||||
MimeTypes.VIDEO_H265,
|
||||
MimeTypes.VIDEO_MP4V);
|
||||
|
||||
/** A list of supported audio {@linkplain MimeTypes sample MIME types}. */
|
||||
public static final ImmutableList<String> SUPPORTED_AUDIO_SAMPLE_MIME_TYPES =
|
||||
ImmutableList.of(
|
||||
MimeTypes.AUDIO_AAC,
|
||||
MimeTypes.AUDIO_AMR_NB,
|
||||
MimeTypes.AUDIO_AMR_WB,
|
||||
MimeTypes.AUDIO_OPUS,
|
||||
MimeTypes.AUDIO_VORBIS);
|
||||
|
||||
private static final String TAG = "Mp4Muxer";
|
||||
|
||||
private final FileOutputStream outputStream;
|
||||
|
@ -41,25 +41,6 @@ import java.util.Locale;
|
||||
public final class InAppFragmentedMp4Muxer implements Muxer {
|
||||
/** {@link Muxer.Factory} for {@link InAppFragmentedMp4Muxer}. */
|
||||
public static final class Factory implements Muxer.Factory {
|
||||
// TODO: b/372417042 - Move these lists to FragmentedMp4Muxer.
|
||||
/** A list of supported video sample MIME types. */
|
||||
private static final ImmutableList<String> SUPPORTED_VIDEO_SAMPLE_MIME_TYPES =
|
||||
ImmutableList.of(
|
||||
MimeTypes.VIDEO_AV1,
|
||||
MimeTypes.VIDEO_H263,
|
||||
MimeTypes.VIDEO_H264,
|
||||
MimeTypes.VIDEO_H265,
|
||||
MimeTypes.VIDEO_MP4V);
|
||||
|
||||
/** A list of supported audio sample MIME types. */
|
||||
private static final ImmutableList<String> SUPPORTED_AUDIO_SAMPLE_MIME_TYPES =
|
||||
ImmutableList.of(
|
||||
MimeTypes.AUDIO_AAC,
|
||||
MimeTypes.AUDIO_AMR_NB,
|
||||
MimeTypes.AUDIO_AMR_WB,
|
||||
MimeTypes.AUDIO_OPUS,
|
||||
MimeTypes.AUDIO_VORBIS);
|
||||
|
||||
private final long fragmentDurationMs;
|
||||
|
||||
private long videoDurationUs;
|
||||
@ -121,9 +102,9 @@ public final class InAppFragmentedMp4Muxer implements Muxer {
|
||||
@Override
|
||||
public ImmutableList<String> getSupportedSampleMimeTypes(@C.TrackType int trackType) {
|
||||
if (trackType == C.TRACK_TYPE_VIDEO) {
|
||||
return SUPPORTED_VIDEO_SAMPLE_MIME_TYPES;
|
||||
return FragmentedMp4Muxer.SUPPORTED_VIDEO_SAMPLE_MIME_TYPES;
|
||||
} else if (trackType == C.TRACK_TYPE_AUDIO) {
|
||||
return SUPPORTED_AUDIO_SAMPLE_MIME_TYPES;
|
||||
return FragmentedMp4Muxer.SUPPORTED_AUDIO_SAMPLE_MIME_TYPES;
|
||||
}
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
@ -60,25 +60,6 @@ public final class InAppMp4Muxer implements Muxer {
|
||||
|
||||
/** {@link Muxer.Factory} for {@link InAppMp4Muxer}. */
|
||||
public static final class Factory implements Muxer.Factory {
|
||||
// TODO: b/372417042 - Move these lists to Mp4Muxer.
|
||||
/** A list of supported video sample MIME types. */
|
||||
private static final ImmutableList<String> SUPPORTED_VIDEO_SAMPLE_MIME_TYPES =
|
||||
ImmutableList.of(
|
||||
MimeTypes.VIDEO_AV1,
|
||||
MimeTypes.VIDEO_H263,
|
||||
MimeTypes.VIDEO_H264,
|
||||
MimeTypes.VIDEO_H265,
|
||||
MimeTypes.VIDEO_MP4V);
|
||||
|
||||
/** A list of supported audio sample MIME types. */
|
||||
private static final ImmutableList<String> SUPPORTED_AUDIO_SAMPLE_MIME_TYPES =
|
||||
ImmutableList.of(
|
||||
MimeTypes.AUDIO_AAC,
|
||||
MimeTypes.AUDIO_AMR_NB,
|
||||
MimeTypes.AUDIO_AMR_WB,
|
||||
MimeTypes.AUDIO_OPUS,
|
||||
MimeTypes.AUDIO_VORBIS);
|
||||
|
||||
@Nullable private final MetadataProvider metadataProvider;
|
||||
|
||||
private long videoDurationUs;
|
||||
@ -141,9 +122,9 @@ public final class InAppMp4Muxer implements Muxer {
|
||||
@Override
|
||||
public ImmutableList<String> getSupportedSampleMimeTypes(@C.TrackType int trackType) {
|
||||
if (trackType == C.TRACK_TYPE_VIDEO) {
|
||||
return SUPPORTED_VIDEO_SAMPLE_MIME_TYPES;
|
||||
return Mp4Muxer.SUPPORTED_VIDEO_SAMPLE_MIME_TYPES;
|
||||
} else if (trackType == C.TRACK_TYPE_AUDIO) {
|
||||
return SUPPORTED_AUDIO_SAMPLE_MIME_TYPES;
|
||||
return Mp4Muxer.SUPPORTED_AUDIO_SAMPLE_MIME_TYPES;
|
||||
}
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user