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.media.TranscodingErrorCode; 20 import android.media.TranscodingSessionParcel; 21 import android.media.TranscodingResultParcel; 22 import android.os.ParcelFileDescriptor; 23 24 /** 25 * ITranscodingClientCallback 26 * 27 * Interface for the MediaTranscodingService to communicate with the client. 28 * 29 * {@hide} 30 */ 31 interface ITranscodingClientCallback { 32 /** 33 * Called to open a raw file descriptor to access data under a URI 34 * 35 * @param fileUri The path of the filename. 36 * @param mode The file mode to use. Must be one of ("r, "w", "rw") 37 * @return ParcelFileDescriptor if open the file successfully, null otherwise. 38 */ openFileDescriptor(in @tf8InCpp String fileUri, in @utf8InCpp String mode)39 ParcelFileDescriptor openFileDescriptor(in @utf8InCpp String fileUri, 40 in @utf8InCpp String mode); 41 42 /** 43 * Called when the transcoding associated with the sessionId finished. 44 * This will only be called if client request to get all the status of the session. 45 * 46 * @param sessionId sessionId assigned by the MediaTranscodingService upon receiving request. 47 */ onTranscodingStarted(in int sessionId)48 oneway void onTranscodingStarted(in int sessionId); 49 50 /** 51 * Called when the transcoding associated with the sessionId is paused. 52 * This will only be called if client request to get all the status of the session. 53 * 54 * @param sessionId sessionId assigned by the MediaTranscodingService upon receiving request. 55 */ onTranscodingPaused(in int sessionId)56 oneway void onTranscodingPaused(in int sessionId); 57 58 /** 59 * Called when the transcoding associated with the sessionId is resumed. 60 * This will only be called if client request to get all the status of the session. 61 * 62 * @param sessionId sessionId assigned by the MediaTranscodingService upon receiving request. 63 */ onTranscodingResumed(in int sessionId)64 oneway void onTranscodingResumed(in int sessionId); 65 66 /** 67 * Called when the transcoding associated with the sessionId finished. 68 * 69 * @param sessionId sessionId assigned by the MediaTranscodingService upon receiving request. 70 * @param result contains the transcoded file stats and other transcoding metrics if requested. 71 */ onTranscodingFinished(in int sessionId, in TranscodingResultParcel result)72 oneway void onTranscodingFinished(in int sessionId, in TranscodingResultParcel result); 73 74 /** 75 * Called when the transcoding associated with the sessionId failed. 76 * 77 * @param sessionId sessionId assigned by the MediaTranscodingService upon receiving request. 78 * @param errorCode error code that indicates the error. 79 */ onTranscodingFailed(in int sessionId, in TranscodingErrorCode errorCode)80 oneway void onTranscodingFailed(in int sessionId, in TranscodingErrorCode errorCode); 81 82 /** 83 * Called when the transcoding configuration associated with the sessionId gets updated, i.e. wait 84 * number in the session queue. 85 * 86 * <p> This will only be called if client set requestUpdate to be true in the TranscodingRequest 87 * submitted to the MediaTranscodingService. 88 * 89 * @param sessionId sessionId assigned by the MediaTranscodingService upon receiving request. 90 * @param oldAwaitNumber previous number of sessions ahead of current session. 91 * @param newAwaitNumber updated number of sessions ahead of current session. 92 */ onAwaitNumberOfSessionsChanged(in int sessionId, in int oldAwaitNumber, in int newAwaitNumber)93 oneway void onAwaitNumberOfSessionsChanged(in int sessionId, 94 in int oldAwaitNumber, 95 in int newAwaitNumber); 96 97 /** 98 * Called when there is an update on the progress of the TranscodingSession. 99 * 100 * <p> This will only be called if client set requestUpdate to be true in the TranscodingRequest 101 * submitted to the MediaTranscodingService. 102 * 103 * @param sessionId sessionId assigned by the MediaTranscodingService upon receiving request. 104 * @param progress an integer number ranging from 0 ~ 100 inclusive. 105 */ onProgressUpdate(in int sessionId, in int progress)106 oneway void onProgressUpdate(in int sessionId, in int progress); 107 } 108