1 /**
2  * Copyright (c) 2020, The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.media;
18 
19 import android.media.TranscodingVideoCodecType;
20 
21 /**
22  * TranscodingVideoTrackFormat contains the video track format of a video.
23  *
24  * TODO(hkuang): Switch to PersistableBundle when b/156428735 is fixed or after we remove
25  * aidl_interface
26  *
27  * Note that TranscodingVideoTrackFormat is used in TranscodingRequestParcel for the  client to
28  * specify the desired transcoded video format, and is also used in TranscodingSessionParcel for the
29  * service to notify client of the final video format for transcoding.
30  * When used as input in TranscodingRequestParcel, the client only needs to specify the config that
31  * they want to change, e.g. codec or resolution, and all the missing configs will be extracted
32  * from the source video and applied to the destination video.
33  * When used as output in TranscodingSessionParcel, all the configs will be populated to indicate
34  * the final encoder configs used for transcoding.
35  *
36  * {@hide}
37  */
38 parcelable TranscodingVideoTrackFormat {
39     /**
40      * Video Codec type.
41      */
42     TranscodingVideoCodecType codecType; // TranscodingVideoCodecType::kUnspecified;
43 
44     /**
45      * Width of the video in pixels. -1 means unavailable.
46      */
47     int width = -1;
48 
49     /**
50      * Height of the video in pixels. -1 means unavailable.
51      */
52     int height = -1;
53 
54     /**
55      * Bitrate in bits per second. -1 means unavailable.
56      */
57     int bitrateBps = -1;
58 
59     /**
60      * Codec profile. This must be the same constant as used in MediaCodecInfo.CodecProfileLevel.
61      * -1 means unavailable.
62      */
63     int profile = -1;
64 
65     /**
66      * Codec level. This must be the same constant as used in MediaCodecInfo.CodecProfileLevel.
67      * -1 means unavailable.
68      */
69     int level = -1;
70 
71     /**
72      * Decoder operating rate. This is used to work around the fact that vendor does not boost the
73      * hardware to maximum speed in transcoding usage case. This operating rate will be applied
74      * to decoder inside MediaTranscoder. -1 means unavailable.
75      */
76     int decoderOperatingRate = -1;
77 
78     /**
79      * Encoder operating rate. This is used to work around the fact that vendor does not boost the
80      * hardware to maximum speed in transcoding usage case. This operating rate will be applied
81      * to encoder inside MediaTranscoder. -1 means unavailable.
82      */
83     int encoderOperatingRate = -1;
84 }
85