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

Commit 66ee5e4b authored by Wonsik Kim's avatar Wonsik Kim
Browse files

MediaCodec: minor revision of APIs for vendor parameters

- add hashCode() and equals() to ParameterDescriptor
- clarify documentation for subscribe/unsubscribe APIs

Bug: 184537653
Test: atest CtsMediaTestCases:MediaCodecTest
Change-Id: Ie98d2d29eccd94f26ecf6763ae47cee942fc08f8
parent 9a24f337
Loading
Loading
Loading
Loading
+26 −4
Original line number Original line Diff line number Diff line
@@ -4607,6 +4607,25 @@ final public class MediaCodec {
            return mType;
            return mType;
        }
        }


        @Override
        public boolean equals(Object o) {
            if (o == null) {
                return false;
            }
            if (!(o instanceof ParameterDescriptor)) {
                return false;
            }
            ParameterDescriptor other = (ParameterDescriptor) o;
            return this.mName.equals(other.mName) && this.mType == other.mType;
        }

        @Override
        public int hashCode() {
            return Arrays.asList(
                    (Object) mName,
                    (Object) Integer.valueOf(mType)).hashCode();
        }

        private String mName;
        private String mName;
        private @MediaFormat.Type int mType;
        private @MediaFormat.Type int mType;
    }
    }
@@ -4631,7 +4650,8 @@ final public class MediaCodec {
    private native ParameterDescriptor native_getParameterDescriptor(@NonNull String name);
    private native ParameterDescriptor native_getParameterDescriptor(@NonNull String name);


    /**
    /**
     * Subscribe to vendor parameters, so that changes to these parameters generate
     * Subscribe to vendor parameters, so that these parameters will be present in
     * {@link #getOutputFormat} and changes to these parameters generate
     * output format change event.
     * output format change event.
     * <p>
     * <p>
     * Unrecognized parameter names or standard (non-vendor) parameter names will be ignored.
     * Unrecognized parameter names or standard (non-vendor) parameter names will be ignored.
@@ -4660,8 +4680,9 @@ final public class MediaCodec {
    private native void native_subscribeToVendorParameters(@NonNull List<String> names);
    private native void native_subscribeToVendorParameters(@NonNull List<String> names);


    /**
    /**
     * Unsubscribe from vendor parameters, so that changes to these parameters
     * Unsubscribe from vendor parameters, so that these parameters will not be present in
     * no longer generate output format change event.
     * {@link #getOutputFormat} and changes to these parameters no longer generate
     * output format change event.
     * <p>
     * <p>
     * Unrecognized parameter names, standard (non-vendor) parameter names will be ignored.
     * Unrecognized parameter names, standard (non-vendor) parameter names will be ignored.
     * {@link #reset} also resets the list of subscribed parameters.
     * {@link #reset} also resets the list of subscribed parameters.
@@ -4669,7 +4690,8 @@ final public class MediaCodec {
     * <p>
     * <p>
     * This method can be called in any codec state except for released state. When called in
     * This method can be called in any codec state except for released state. When called in
     * running state with newly unsubscribed parameters, it takes effect no later than the
     * running state with newly unsubscribed parameters, it takes effect no later than the
     * processing of the subsequently queued buffer.
     * processing of the subsequently queued buffer. For the removed parameters, the codec will
     * generate output format change event.
     * <p>
     * <p>
     * Note that any vendor parameters set in a {@link #configure} or
     * Note that any vendor parameters set in a {@link #configure} or
     * {@link #setParameters} call are automatically subscribed, and with this method
     * {@link #setParameters} call are automatically subscribed, and with this method