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

Commit 99aa7ffc authored by Hangyu Kuang's avatar Hangyu Kuang Committed by Android (Google) Code Review
Browse files

Merge "Transcoding: Add new AIDL structure TranscodingVideoTrackFormat."

parents c0067e1b b6f39b34
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ aidl_interface {
        "aidl/android/media/TranscodingJobPriority.aidl",
        "aidl/android/media/TranscodingType.aidl",
        "aidl/android/media/TranscodingVideoCodecType.aidl",
        "aidl/android/media/TranscodingVideoTrackFormat.aidl",
        "aidl/android/media/TranscodingJobParcel.aidl",
        "aidl/android/media/TranscodingRequestParcel.aidl",
        "aidl/android/media/TranscodingResultParcel.aidl",
+7 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.media;

import android.media.TranscodingRequestParcel;
import android.media.TranscodingVideoTrackFormat;

/**
 * TranscodingJob is generated by the MediaTranscodingService upon receiving a TranscodingRequest.
@@ -37,6 +38,12 @@ parcelable TranscodingJobParcel {
     */
    TranscodingRequestParcel request;

    /**
     * Output video track's format. This will only be avaiable for video transcoding and it will
     * be avaiable when the job is finished.
     */
    @nullable TranscodingVideoTrackFormat videoTrackFormat;

    /**
    * Current number of jobs ahead of this job. The service schedules the job based on the priority
    * passed from the client. Client could specify whether to receive updates when the
+9 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.media;

import android.media.TranscodingJobPriority;
import android.media.TranscodingType;
import android.media.TranscodingVideoTrackFormat;

/**
 * TranscodingRequest contains the desired configuration for the transcoding.
@@ -36,6 +37,14 @@ parcelable TranscodingRequestParcel {
     */
    TranscodingType transcodingType;

    /**
     * Requested video track format for the transcoding.
     * Note that the transcoding service will try to fulfill the requested format as much as
     * possbile, while subject to hardware and software limitation. The final video track format
     * will be available in the TranscodingJobParcel when the job is finished.
     */
    @nullable TranscodingVideoTrackFormat requestedVideoTrackFormat;

    /**
     * Input source file descriptor.
     */
+70 −0
Original line number Diff line number Diff line
/**
 * Copyright (c) 2020, The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.media;

import android.media.TranscodingVideoCodecType;

/**
 * TranscodingVideoTrackFormat contains the video track format of a video.
 *
 * TODO(hkuang): Switch to PersistableBundle when b/156428735 is fixed or after we remove
 * aidl_interface
 *
 * Note that TranscodingVideoTrackFormat is used in TranscodingRequestParcel for the  client to
 * specify the desired transcoded video format, and is also used in TranscodingJobParcel for the
 * service to notify client of the final video format for transcoding.
 * When used as input in TranscodingRequestParcel, the client only needs to specify the config that
 * they want to change, e.g. codec or resolution, and all the missing configs will be extracted
 * from the source video and applied to the destination video.
 * When used as output in TranscodingJobParcel, all the configs will be populated to indicate the
 * final encoder configs used for transcoding.
 *
 * {@hide}
 */
parcelable TranscodingVideoTrackFormat {
    /**
     * Video Codec type.
     */
    TranscodingVideoCodecType codecType; // TranscodingVideoCodecType::kUnspecified;

    /**
     * Width of the video in pixels. -1 means unavailable.
     */
    int width = -1;

    /**
     * Height of the video in pixels. -1 means unavailable.
     */
    int height = -1;

    /**
     * Bitrate in bits per second. -1 means unavailable.
     */
    int bitrateBps = -1;

    /**
     * Codec profile. This must be the same constant as used in MediaCodecInfo.CodecProfileLevel.
     * -1 means unavailable.
     */
    int profile = -1;

    /**
     * Codec level. This must be the same constant as used in MediaCodecInfo.CodecProfileLevel.
     * -1 means unavailable.
     */
    int level = -1;
}