1 /** 2 * Copyright (c) 2019, 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.os.ParcelFileDescriptor; 20 import android.media.TranscodingSessionPriority; 21 import android.media.TranscodingTestConfig; 22 import android.media.TranscodingType; 23 import android.media.TranscodingVideoTrackFormat; 24 25 /** 26 * TranscodingRequest contains the desired configuration for the transcoding. 27 * 28 * {@hide} 29 */ 30 //TODO(hkuang): Implement the parcelable. 31 parcelable TranscodingRequestParcel { 32 /** 33 * The absolute file path of the source file. 34 */ 35 @utf8InCpp String sourceFilePath; 36 37 /* 38 * The filedescrptor of the sourceFilePath. If the source Fd is provided, transcoding service 39 * will use this fd instead of calling back to client side to open the sourceFilePath. It is 40 * client's responsibility to make sure sourceFd is opened from sourceFilePath. 41 */ 42 @nullable ParcelFileDescriptor sourceFd; 43 44 /** 45 * The absolute file path of the destination file. 46 */ 47 @utf8InCpp String destinationFilePath; 48 49 /* 50 * The filedescrptor of the destinationFilePath. If the destination Fd is provided, transcoding 51 * service will use this fd instead of calling back to client side to open the 52 * destinationFilePath. It is client's responsibility to make sure destinationFd is opened 53 * from destinationFilePath. 54 */ 55 @nullable ParcelFileDescriptor destinationFd; 56 57 /** 58 * The UID of the client that this transcoding request is for. Only privileged caller could 59 * set this Uid as only they could do the transcoding on behalf of the client. 60 * -1 means not available. 61 */ 62 int clientUid = -1; 63 64 /** 65 * The PID of the client that this transcoding request is for. Only privileged caller could 66 * set this Uid as only they could do the transcoding on behalf of the client. 67 * -1 means not available. 68 */ 69 int clientPid = -1; 70 71 /** 72 * The package name of the client whom this transcoding request is for. 73 */ 74 @utf8InCpp String clientPackageName; 75 76 /** 77 * Type of the transcoding. 78 */ 79 TranscodingType transcodingType; 80 81 /** 82 * Requested video track format for the transcoding. 83 * Note that the transcoding service will try to fulfill the requested format as much as 84 * possbile, while subject to hardware and software limitation. The final video track format 85 * will be available in the TranscodingSessionParcel when the session is finished. 86 */ 87 @nullable TranscodingVideoTrackFormat requestedVideoTrackFormat; 88 89 /** 90 * Priority of this transcoding. Service will schedule the transcoding based on the priority. 91 */ 92 TranscodingSessionPriority priority; 93 94 /** 95 * Whether to receive update on progress and change of awaitNumSessions. 96 * Default to false. 97 */ 98 boolean requestProgressUpdate = false; 99 100 /** 101 * Whether to receive update on session's start/stop/pause/resume. 102 * Default to false. 103 */ 104 boolean requestSessionEventUpdate = false; 105 106 /** 107 * Whether this request is for testing. 108 */ 109 boolean isForTesting = false; 110 111 /** 112 * Test configuration. This will be available only when isForTesting is set to true. 113 */ 114 @nullable TranscodingTestConfig testConfig; 115 116 /** 117 * Whether to get the stats of the transcoding. 118 * If this is enabled, the TranscodingSessionStats will be returned in TranscodingResultParcel 119 * upon transcoding finishes. 120 */ 121 boolean enableStats = false; 122 } 123