mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Adds Format to MediaCodecAdapter.Configuration.
PiperOrigin-RevId: 369444747
This commit is contained in:
parent
efce7b9e2c
commit
32c5ea0643
@ -362,7 +362,7 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
|
||||
&& !MimeTypes.AUDIO_RAW.equals(format.sampleMimeType);
|
||||
decryptOnlyCodecFormat = decryptOnlyCodecEnabled ? format : null;
|
||||
return new MediaCodecAdapter.Configuration(
|
||||
codecInfo, mediaFormat, /* surface= */ null, crypto, /* flags= */ 0);
|
||||
codecInfo, mediaFormat, format, /* surface= */ null, crypto, /* flags= */ 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -25,6 +25,7 @@ import android.view.Surface;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import com.google.android.exoplayer2.C;
|
||||
import com.google.android.exoplayer2.Format;
|
||||
import com.google.android.exoplayer2.decoder.CryptoInfo;
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
@ -37,11 +38,13 @@ import java.nio.ByteBuffer;
|
||||
*/
|
||||
public interface MediaCodecAdapter {
|
||||
/** Configuration parameters for a {@link MediaCodecAdapter}. */
|
||||
class Configuration {
|
||||
final class Configuration {
|
||||
/** Information about the {@link MediaCodec} being configured. */
|
||||
public final MediaCodecInfo codecInfo;
|
||||
/** The {@link MediaFormat} for which the codec is being configured. */
|
||||
public final MediaFormat mediaFormat;
|
||||
/** The {@link Format} for which the codec is being configured. */
|
||||
public final Format format;
|
||||
/** For video playbacks, the output where the object will render the decoded frames. */
|
||||
@Nullable public final Surface surface;
|
||||
/** For DRM protected playbacks, a {@link MediaCrypto} to use for decryption. */
|
||||
@ -56,11 +59,13 @@ public interface MediaCodecAdapter {
|
||||
public Configuration(
|
||||
MediaCodecInfo codecInfo,
|
||||
MediaFormat mediaFormat,
|
||||
Format format,
|
||||
@Nullable Surface surface,
|
||||
@Nullable MediaCrypto crypto,
|
||||
int flags) {
|
||||
this.codecInfo = codecInfo;
|
||||
this.mediaFormat = mediaFormat;
|
||||
this.format = format;
|
||||
this.surface = surface;
|
||||
this.crypto = crypto;
|
||||
this.flags = flags;
|
||||
|
@ -625,7 +625,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
|
||||
surface = dummySurface;
|
||||
}
|
||||
return new MediaCodecAdapter.Configuration(
|
||||
codecInfo, mediaFormat, surface, crypto, /* flags= */ 0);
|
||||
codecInfo, mediaFormat, format, surface, crypto, /* flags= */ 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -24,6 +24,7 @@ import android.media.MediaCodec;
|
||||
import android.media.MediaFormat;
|
||||
import android.os.HandlerThread;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import com.google.android.exoplayer2.Format;
|
||||
import java.lang.reflect.Constructor;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
@ -45,6 +46,7 @@ public class AsynchronousMediaCodecAdapterTest {
|
||||
new MediaCodecAdapter.Configuration(
|
||||
codecInfo,
|
||||
createMediaFormat("format"),
|
||||
/* format= */ new Format.Builder().build(),
|
||||
/* surface= */ null,
|
||||
/* crypto= */ null,
|
||||
/* flags= */ 0);
|
||||
|
@ -116,6 +116,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
new MediaCodecAdapter.Configuration(
|
||||
createPlaceholderMediaCodecInfo(),
|
||||
mediaFormat,
|
||||
format,
|
||||
/* surface= */ null,
|
||||
/* crypto= */ null,
|
||||
/* flags= */ 0));
|
||||
@ -151,6 +152,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
new MediaCodecAdapter.Configuration(
|
||||
createPlaceholderMediaCodecInfo(),
|
||||
mediaFormat,
|
||||
format,
|
||||
/* surface= */ null,
|
||||
/* crypto= */ null,
|
||||
/* flags= */ MediaCodec.CONFIGURE_FLAG_ENCODE));
|
||||
|
Loading…
x
Reference in New Issue
Block a user