1 /* 2 * Copyright 2022 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.google.android.exoplayer2.transformer; 18 19 import android.media.MediaCodec; 20 import android.media.MediaCodecInfo; 21 import com.google.android.exoplayer2.util.MimeTypes; 22 import java.util.List; 23 24 /** Selector of {@link MediaCodec} encoder instances. */ 25 public interface EncoderSelector { 26 27 /** 28 * Default implementation of {@link EncoderSelector}, which returns the preferred encoders for the 29 * given {@link MimeTypes MIME type}. 30 */ 31 EncoderSelector DEFAULT = EncoderUtil::getSupportedEncoders; 32 33 /** 34 * Returns a list of encoders that can encode media in the specified {@code mimeType}, in priority 35 * order. 36 * 37 * @param mimeType The {@linkplain MimeTypes MIME type} for which an encoder is required. 38 * @return An unmodifiable list of {@linkplain MediaCodecInfo encoders} that support the {@code 39 * mimeType}. The list may be empty. 40 */ selectEncoderInfos(String mimeType)41 List<MediaCodecInfo> selectEncoderInfos(String mimeType); 42 } 43