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

Commit e70785fa authored by Chong Zhang's avatar Chong Zhang
Browse files

heif: add muxer support for heic tracks

bug: 63633199

Change-Id: I367b29ae86be4e7d365fbfb66ca1cc463eb77571
parent c8e3c7c8
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -23028,6 +23028,7 @@ package android.media {
  public static final class MediaMuxer.OutputFormat {
    field public static final int MUXER_OUTPUT_3GPP = 2; // 0x2
    field public static final int MUXER_OUTPUT_HEIF = 3; // 0x3
    field public static final int MUXER_OUTPUT_MPEG_4 = 0; // 0x0
    field public static final int MUXER_OUTPUT_WEBM = 1; // 0x1
  }
+1 −0
Original line number Diff line number Diff line
@@ -24921,6 +24921,7 @@ package android.media {
  public static final class MediaMuxer.OutputFormat {
    field public static final int MUXER_OUTPUT_3GPP = 2; // 0x2
    field public static final int MUXER_OUTPUT_HEIF = 3; // 0x3
    field public static final int MUXER_OUTPUT_MPEG_4 = 0; // 0x0
    field public static final int MUXER_OUTPUT_WEBM = 1; // 0x1
  }
+1 −0
Original line number Diff line number Diff line
@@ -23232,6 +23232,7 @@ package android.media {
  public static final class MediaMuxer.OutputFormat {
    field public static final int MUXER_OUTPUT_3GPP = 2; // 0x2
    field public static final int MUXER_OUTPUT_HEIF = 3; // 0x3
    field public static final int MUXER_OUTPUT_MPEG_4 = 0; // 0x0
    field public static final int MUXER_OUTPUT_WEBM = 1; // 0x1
  }
+5 −3
Original line number Diff line number Diff line
@@ -721,14 +721,16 @@ public final class MediaFormat {
    /**
     * A key for boolean DEFAULT behavior for the track. The track with DEFAULT=true is
     * selected in the absence of a specific user choice.
     * This is currently only used for subtitle tracks, when the user selected
     * 'Default' for the captioning locale.
     * This is currently used in two scenarios:
     * 1) for subtitle tracks, when the user selected 'Default' for the captioning locale.
     * 2) for a {@link #MIMETYPE_IMAGE_ANDROID_HEIC} track, indicating the image is the
     * primary item in the file.

     * The associated value is an integer, where non-0 means TRUE.  This is an optional
     * field; if not specified, DEFAULT is considered to be FALSE.
     */
    public static final String KEY_IS_DEFAULT = "is-default";


    /**
     * A key for the FORCED field for subtitle tracks. True if it is a
     * forced subtitle track.  Forced subtitle tracks are essential for the
+11 −5
Original line number Diff line number Diff line
@@ -258,12 +258,18 @@ final public class MediaMuxer {
         * in include/media/stagefright/MediaMuxer.h!
         */
        private OutputFormat() {}
        /** @hide */
        public static final int MUXER_OUTPUT_FIRST   = 0;
        /** MPEG4 media file format*/
        public static final int MUXER_OUTPUT_MPEG_4 = 0;
        public static final int MUXER_OUTPUT_MPEG_4 = MUXER_OUTPUT_FIRST;
        /** WEBM media file format*/
        public static final int MUXER_OUTPUT_WEBM   = 1;
        public static final int MUXER_OUTPUT_WEBM   = MUXER_OUTPUT_FIRST + 1;
        /** 3GPP media file format*/
        public static final int MUXER_OUTPUT_3GPP   = 2;
        public static final int MUXER_OUTPUT_3GPP   = MUXER_OUTPUT_FIRST + 2;
        /** HEIF media file format*/
        public static final int MUXER_OUTPUT_HEIF   = MUXER_OUTPUT_FIRST + 3;
        /** @hide */
        public static final int MUXER_OUTPUT_LAST   = MUXER_OUTPUT_HEIF;
    };

    /** @hide */
@@ -271,6 +277,7 @@ final public class MediaMuxer {
        OutputFormat.MUXER_OUTPUT_MPEG_4,
        OutputFormat.MUXER_OUTPUT_WEBM,
        OutputFormat.MUXER_OUTPUT_3GPP,
        OutputFormat.MUXER_OUTPUT_HEIF,
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface Format {}
@@ -347,8 +354,7 @@ final public class MediaMuxer {
    }

    private void setUpMediaMuxer(@NonNull FileDescriptor fd, @Format int format) throws IOException {
        if (format != OutputFormat.MUXER_OUTPUT_MPEG_4 && format != OutputFormat.MUXER_OUTPUT_WEBM
                && format != OutputFormat.MUXER_OUTPUT_3GPP) {
        if (format < OutputFormat.MUXER_OUTPUT_FIRST || format > OutputFormat.MUXER_OUTPUT_LAST) {
            throw new IllegalArgumentException("format: " + format + " is invalid");
        }
        mNativeObject = nativeSetup(fd, format);