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

Commit 386e8ba0 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "media: polish EncoderProfiles" into sc-dev

parents ae812a30 4ef563a2
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -20973,8 +20973,8 @@ package android.media {
  }
  public class CamcorderProfile {
    method public static android.media.CamcorderProfile get(int);
    method public static android.media.CamcorderProfile get(int, int);
    method @Deprecated public static android.media.CamcorderProfile get(int);
    method @Deprecated public static android.media.CamcorderProfile get(int, int);
    method @Nullable public static android.media.EncoderProfiles getAll(@NonNull String, int);
    method public static boolean hasProfile(int);
    method public static boolean hasProfile(int, int);
@@ -21056,14 +21056,14 @@ package android.media {
    field @NonNull public final java.util.UUID uuid;
  }
  public class EncoderProfiles {
  public final class EncoderProfiles {
    method @NonNull public java.util.List<android.media.EncoderProfiles.AudioProfile> getAudioProfiles();
    method public int getDurationSeconds();
    method public int getFileFormat();
    method public int getDefaultDurationSeconds();
    method public int getRecommendedFileFormat();
    method @NonNull public java.util.List<android.media.EncoderProfiles.VideoProfile> getVideoProfiles();
  }
  public static class EncoderProfiles.AudioProfile {
  public static final class EncoderProfiles.AudioProfile {
    method public int getBitrate();
    method public int getChannels();
    method public int getCodec();
@@ -21072,7 +21072,7 @@ package android.media {
    method public int getSampleRate();
  }
  public static class EncoderProfiles.VideoProfile {
  public static final class EncoderProfiles.VideoProfile {
    method public int getBitrate();
    method public int getCodec();
    method public int getFrameRate();
+5 −3
Original line number Diff line number Diff line
@@ -442,6 +442,7 @@ public class CamcorderProfile
     * camera on the device. If the device has no back-facing camera, this returns null.
     * @param quality the target quality level for the camcorder profile
     * @see #get(int, int)
     * @deprecated Use {@link #getAll} instead
     */
    public static CamcorderProfile get(int quality) {
        int numberOfCameras = Camera.getNumberOfCameras();
@@ -508,6 +509,7 @@ public class CamcorderProfile
     * @see #QUALITY_HIGH_SPEED_720P
     * @see #QUALITY_HIGH_SPEED_1080P
     * @see #QUALITY_HIGH_SPEED_2160P
     * @deprecated Use {@link #getAll} instead
     * @throws IllegalArgumentException if quality is not one of the defined QUALITY_ values.
    */
    public static CamcorderProfile get(int cameraId, int quality) {
@@ -549,9 +551,9 @@ public class CamcorderProfile
     * resolution and higher audio sampling rate, etc, than those with lower quality
     * level.
     *
     * @param cameraId the id for the camera. Numeric camera ids parsed from the list received by
     *                 invoking {@link CameraManager#getCameraIdList} can be used as long as they
     *                 are {@link CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE}
     * @param cameraId the id for the camera. Numeric camera ids from the list received by invoking
     *                 {@link CameraManager#getCameraIdList} can be used as long as they are
     *                 {@link CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE}
     *                 and not
     *                 {@link CameraMetadata#INFO_SUPPORTED_HARDWARE_LEVEL_EXTERNAL EXTERNAL}.
     * @param quality the target quality level for the camcorder profile.
+8 −13
Original line number Diff line number Diff line
@@ -51,14 +51,14 @@ import java.util.List;
 * <li> Number of audio channels for recording.
 * </ul>
 */
public class EncoderProfiles
public final class EncoderProfiles
{
    /**
     * Default recording duration in seconds before the session is terminated.
     * This is useful for applications like MMS has limited file size requirement.
     * This is useful for applications like MMS that have a limited file size requirement.
     * This could be 0 if there is no default recording duration.
     */
    public int getDurationSeconds() {
    public int getDefaultDurationSeconds() {
        return durationSecs;
    }

@@ -66,19 +66,19 @@ public class EncoderProfiles
     * Recommended output file format
     * @see android.media.MediaRecorder.OutputFormat
     */
    public int getFileFormat() {
    public @MediaRecorder.OutputFormatValues int getRecommendedFileFormat() {
        return fileFormat;
    }

    /**
     * Configuration for a video encoder.
     */
    public static class VideoProfile {
    public final static class VideoProfile {
        /**
         * The video encoder being used for the video track
         * @see android.media.MediaRecorder.VideoEncoder
         */
        public int getCodec() {
        public @MediaRecorder.VideoEncoderValues int getCodec() {
            return codec;
        }

@@ -238,12 +238,12 @@ public class EncoderProfiles
    /**
     * Configuration for an audio encoder.
     */
    public static class AudioProfile {
    public final static class AudioProfile {
        /**
         * The audio encoder being used for the audio track.
         * @see android.media.MediaRecorder.AudioEncoder
         */
        public int getCodec() {
        public @MediaRecorder.AudioEncoderValues int getCodec() {
            return codec;
        }

@@ -326,11 +326,6 @@ public class EncoderProfiles
        private int bitrate;
    }

    //static {
    //    System.loadLibrary("media_jni");
    //native_init();
    //}

    private int durationSecs;
    private int fileFormat;
    // non-modifiable lists
+52 −3
Original line number Diff line number Diff line
@@ -608,6 +608,25 @@ public class MediaRecorder implements AudioRouting,
        public static final int OGG = 11;
    };

    /**
     * @hide
     */
    @IntDef({
        OutputFormat.DEFAULT,
        OutputFormat.THREE_GPP,
        OutputFormat.MPEG_4,
        OutputFormat.AMR_NB,
        OutputFormat.AMR_WB,
        OutputFormat.AAC_ADIF,
        OutputFormat.AAC_ADTS,
        OutputFormat.MPEG_2_TS,
        OutputFormat.WEBM,
        OutputFormat.HEIF,
        OutputFormat.OGG,
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface OutputFormatValues {}

    /**
     * Defines the audio encoding. These constants are used with
     * {@link MediaRecorder#setAudioEncoder(int)}.
@@ -634,6 +653,22 @@ public class MediaRecorder implements AudioRouting,
        public static final int OPUS = 7;
    }

    /**
     * @hide
     */
    @IntDef({
        AudioEncoder.DEFAULT,
        AudioEncoder.AMR_NB,
        AudioEncoder.AMR_WB,
        AudioEncoder.AAC,
        AudioEncoder.HE_AAC,
        AudioEncoder.AAC_ELD,
        AudioEncoder.VORBIS,
        AudioEncoder.OPUS,
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface AudioEncoderValues {}

    /**
     * Defines the video encoding. These constants are used with
     * {@link MediaRecorder#setVideoEncoder(int)}.
@@ -651,6 +686,20 @@ public class MediaRecorder implements AudioRouting,
        public static final int HEVC = 5;
    }

    /**
     * @hide
     */
    @IntDef({
        VideoEncoder.DEFAULT,
        VideoEncoder.H263,
        VideoEncoder.H264,
        VideoEncoder.MPEG_4_SP,
        VideoEncoder.VP8,
        VideoEncoder.HEVC,
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface VideoEncoderValues {}

    /**
     * Sets the audio source to be used for recording. If this method is not
     * called, the output file will not contain an audio track. The source needs
@@ -887,7 +936,7 @@ public class MediaRecorder implements AudioRouting,
     * setAudioSource()/setVideoSource().
     * @see android.media.MediaRecorder.OutputFormat
     */
    public native void setOutputFormat(int output_format)
    public native void setOutputFormat(@OutputFormatValues int output_format)
            throws IllegalStateException;

    /**
@@ -970,7 +1019,7 @@ public class MediaRecorder implements AudioRouting,
     * setOutputFormat() or after prepare().
     * @see android.media.MediaRecorder.AudioEncoder
     */
    public native void setAudioEncoder(int audio_encoder)
    public native void setAudioEncoder(@AudioEncoderValues int audio_encoder)
            throws IllegalStateException;

    /**
@@ -983,7 +1032,7 @@ public class MediaRecorder implements AudioRouting,
     * setOutputFormat() or after prepare()
     * @see android.media.MediaRecorder.VideoEncoder
     */
    public native void setVideoEncoder(int video_encoder)
    public native void setVideoEncoder(@VideoEncoderValues int video_encoder)
            throws IllegalStateException;

    /**