Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aba29b77 authored by Lajos Molnar's avatar Lajos Molnar
Browse files

media: rename MediaSync.configureSurface/AudioTrack to set...

Change-Id: Ia1ebf5747959a89635dd45b8966a201397374c71
parent 1c3f534a
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -16346,8 +16346,6 @@ package android.media {
  public final class MediaSync {
  public final class MediaSync {
    ctor public MediaSync();
    ctor public MediaSync();
    method public void configureAudioTrack(android.media.AudioTrack);
    method public void configureSurface(android.view.Surface);
    method public final android.view.Surface createInputSurface();
    method public final android.view.Surface createInputSurface();
    method public void flush();
    method public void flush();
    method public android.media.PlaybackSettings getPlaybackSettings();
    method public android.media.PlaybackSettings getPlaybackSettings();
@@ -16355,9 +16353,11 @@ package android.media {
    method public android.media.MediaTimestamp getTimestamp();
    method public android.media.MediaTimestamp getTimestamp();
    method public void queueAudio(java.nio.ByteBuffer, int, int, long);
    method public void queueAudio(java.nio.ByteBuffer, int, int, long);
    method public final void release();
    method public final void release();
    method public void setAudioTrack(android.media.AudioTrack);
    method public void setCallback(android.media.MediaSync.Callback, android.os.Handler);
    method public void setCallback(android.media.MediaSync.Callback, android.os.Handler);
    method public void setPlaybackRate(float, int);
    method public void setPlaybackRate(float, int);
    method public void setPlaybackSettings(android.media.PlaybackSettings);
    method public void setPlaybackSettings(android.media.PlaybackSettings);
    method public void setSurface(android.view.Surface);
    method public void setSyncSettings(android.media.SyncSettings);
    method public void setSyncSettings(android.media.SyncSettings);
    field public static final int PLAYBACK_RATE_AUDIO_MODE_DEFAULT = 0; // 0x0
    field public static final int PLAYBACK_RATE_AUDIO_MODE_DEFAULT = 0; // 0x0
    field public static final int PLAYBACK_RATE_AUDIO_MODE_RESAMPLE = 2; // 0x2
    field public static final int PLAYBACK_RATE_AUDIO_MODE_RESAMPLE = 2; // 0x2
+2 −2
Original line number Original line Diff line number Diff line
@@ -17561,8 +17561,6 @@ package android.media {
  public final class MediaSync {
  public final class MediaSync {
    ctor public MediaSync();
    ctor public MediaSync();
    method public void configureAudioTrack(android.media.AudioTrack);
    method public void configureSurface(android.view.Surface);
    method public final android.view.Surface createInputSurface();
    method public final android.view.Surface createInputSurface();
    method public void flush();
    method public void flush();
    method public android.media.PlaybackSettings getPlaybackSettings();
    method public android.media.PlaybackSettings getPlaybackSettings();
@@ -17570,9 +17568,11 @@ package android.media {
    method public android.media.MediaTimestamp getTimestamp();
    method public android.media.MediaTimestamp getTimestamp();
    method public void queueAudio(java.nio.ByteBuffer, int, int, long);
    method public void queueAudio(java.nio.ByteBuffer, int, int, long);
    method public final void release();
    method public final void release();
    method public void setAudioTrack(android.media.AudioTrack);
    method public void setCallback(android.media.MediaSync.Callback, android.os.Handler);
    method public void setCallback(android.media.MediaSync.Callback, android.os.Handler);
    method public void setPlaybackRate(float, int);
    method public void setPlaybackRate(float, int);
    method public void setPlaybackSettings(android.media.PlaybackSettings);
    method public void setPlaybackSettings(android.media.PlaybackSettings);
    method public void setSurface(android.view.Surface);
    method public void setSyncSettings(android.media.SyncSettings);
    method public void setSyncSettings(android.media.SyncSettings);
    field public static final int PLAYBACK_RATE_AUDIO_MODE_DEFAULT = 0; // 0x0
    field public static final int PLAYBACK_RATE_AUDIO_MODE_DEFAULT = 0; // 0x0
    field public static final int PLAYBACK_RATE_AUDIO_MODE_RESAMPLE = 2; // 0x2
    field public static final int PLAYBACK_RATE_AUDIO_MODE_RESAMPLE = 2; // 0x2
+18 −14
Original line number Original line Diff line number Diff line
@@ -39,13 +39,13 @@ import java.util.List;
 * <p>MediaSync is generally used like this:
 * <p>MediaSync is generally used like this:
 * <pre>
 * <pre>
 * MediaSync sync = new MediaSync();
 * MediaSync sync = new MediaSync();
 * sync.configureSurface(surface);
 * sync.setSurface(surface);
 * Surface inputSurface = sync.createInputSurface();
 * Surface inputSurface = sync.createInputSurface();
 * ...
 * ...
 * // MediaCodec videoDecoder = ...;
 * // MediaCodec videoDecoder = ...;
 * videoDecoder.configure(format, inputSurface, ...);
 * videoDecoder.configure(format, inputSurface, ...);
 * ...
 * ...
 * sync.configureAudioTrack(audioTrack);
 * sync.setAudioTrack(audioTrack);
 * sync.setCallback(new MediaSync.Callback() {
 * sync.setCallback(new MediaSync.Callback() {
 *     {@literal @Override}
 *     {@literal @Override}
 *     public void onReturnAudioBuffer(MediaSync sync, ByteBuffer audioBuffer, int bufferIndex) {
 *     public void onReturnAudioBuffer(MediaSync sync, ByteBuffer audioBuffer, int bufferIndex) {
@@ -95,8 +95,8 @@ import java.util.List;
 *
 *
 * </pre>
 * </pre>
 *
 *
 * The client needs to configure corresponding sink (i.e., Surface and AudioTrack) based on
 * The client needs to configure corresponding sink by setting the Surface and/or AudioTrack
 * the stream type it will play.
 * based on the stream type it will play.
 * <p>
 * <p>
 * For video, the client needs to call {@link #createInputSurface} to obtain a surface on
 * For video, the client needs to call {@link #createInputSurface} to obtain a surface on
 * which it will render video frames.
 * which it will render video frames.
@@ -234,29 +234,33 @@ final public class MediaSync {
    }
    }


    /**
    /**
     * Configures the output surface for MediaSync.
     * Sets the output surface for MediaSync.
     * <p>
     * Currently, this is only supported in the Initialized state.
     *
     *
     * @param surface Specify a surface on which to render the video data.
     * @param surface Specify a surface on which to render the video data.
     * @throws IllegalArgumentException if the surface has been released, or is invalid.
     * @throws IllegalArgumentException if the surface has been released, is invalid,
     *     or can not be connected.
     *     or can not be connected.
     * @throws IllegalStateException if not in the Initialized state, or another surface
     * @throws IllegalStateException if setting the surface is not supported, e.g.
     *     has already been configured.
     *     not in the Initialized state, or another surface has already been configured.
     */
     */
    public void configureSurface(@Nullable Surface surface) {
    public void setSurface(@Nullable Surface surface) {
        native_configureSurface(surface);
        native_configureSurface(surface);
    }
    }


    private native final void native_configureSurface(@Nullable Surface surface);
    private native final void native_configureSurface(@Nullable Surface surface);


    /**
    /**
     * Configures the audio track for MediaSync.
     * Sets the audio track for MediaSync.
     * <p>
     * Currently, this is only supported in the Initialized state.
     *
     *
     * @param audioTrack Specify an AudioTrack through which to render the audio data.
     * @param audioTrack Specify an AudioTrack through which to render the audio data.
     * @throws IllegalArgumentException if the audioTrack has been released, or is invalid.
     * @throws IllegalArgumentException if the audioTrack has been released, or is invalid.
     * @throws IllegalStateException if not in the Initialized state, or another audio track
     * @throws IllegalStateException if setting the audio track is not supported, e.g.
     *     has already been configured.
     *     not in the Initialized state, or another audio track has already been configured.
     */
     */
    public void configureAudioTrack(@Nullable AudioTrack audioTrack) {
    public void setAudioTrack(@Nullable AudioTrack audioTrack) {
        // AudioTrack has sanity check for configured sample rate.
        // AudioTrack has sanity check for configured sample rate.
        int nativeSampleRateInHz = (audioTrack == null ? 0 : audioTrack.getSampleRate());
        int nativeSampleRateInHz = (audioTrack == null ? 0 : audioTrack.getSampleRate());


@@ -272,7 +276,7 @@ final public class MediaSync {


    /**
    /**
     * Requests a Surface to use as the input. This may only be called after
     * Requests a Surface to use as the input. This may only be called after
     * {@link #configureSurface}.
     * {@link #setSurface}.
     * <p>
     * <p>
     * The application is responsible for calling release() on the Surface when
     * The application is responsible for calling release() on the Surface when
     * done.
     * done.