• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.TranscodingJobParcel;
20 import android.media.TranscodingRequestParcel;
21 import android.media.ITranscodingServiceClient;
22 
23 /**
24  * Binder interface for MediaTranscodingService.
25  *
26  * {@hide}
27  */
28 interface IMediaTranscodingService {
29     /**
30      * All MediaTranscoding service and device Binder calls may return a
31      * ServiceSpecificException with the following error codes
32      */
33     const int ERROR_PERMISSION_DENIED = 1;
34     const int ERROR_ALREADY_EXISTS = 2;
35     const int ERROR_ILLEGAL_ARGUMENT = 3;
36     const int ERROR_DISCONNECTED = 4;
37     const int ERROR_TIMED_OUT = 5;
38     const int ERROR_DISABLED = 6;
39     const int ERROR_INVALID_OPERATION = 7;
40 
41     /**
42      * Default UID/PID values for non-privileged callers of
43      * registerClient().
44      */
45     const int USE_CALLING_UID = -1;
46     const int USE_CALLING_PID = -1;
47 
48     /**
49      * Register the client with the MediaTranscodingService.
50      *
51      * Client must call this function to register itself with the service in order to perform
52      * transcoding. This function will return a unique positive Id assigned by the service.
53      * Client should save this Id and use it for all the transaction with the service.
54      *
55      * @param client interface for the MediaTranscodingService to call the client.
56      * @param opPackageName op package name of the client.
57      * @param clientUid user id of the client.
58      * @param clientPid process id of the client.
59      * @return a unique positive Id assigned to the client by the service, -1  means failed to
60      * register.
61      */
registerClient(in ITranscodingServiceClient client, in String opPackageName, in int clientUid, in int clientPid)62     int registerClient(in ITranscodingServiceClient client,
63                        in String opPackageName,
64                        in int clientUid,
65                        in int clientPid);
66 
67     /**
68     * Unregister the client with the MediaTranscodingService.
69     *
70     * Client will not be able to perform any more transcoding after unregister.
71     *
72     * @param clientId assigned Id of the client.
73     * @return true if succeeds, false otherwise.
74     */
unregisterClient(in int clientId)75     boolean unregisterClient(in int clientId);
76 
77     /**
78     * Returns the number of clients. This is used for debugging.
79     */
getNumOfClients()80     int getNumOfClients();
81 
82     /**
83      * Submits a transcoding request to MediaTranscodingService.
84      *
85      * @param clientId assigned Id of the client.
86      * @param request a TranscodingRequest contains transcoding configuration.
87      * @param job(output variable) a TranscodingJob generated by the MediaTranscodingService.
88      * @return a unique positive jobId generated by the MediaTranscodingService, -1 means failure.
89      */
submitRequest(in int clientId, in TranscodingRequestParcel request, out TranscodingJobParcel job)90     int submitRequest(in int clientId,
91                       in TranscodingRequestParcel request,
92                       out TranscodingJobParcel job);
93 
94     /**
95      * Cancels a transcoding job.
96      *
97      * @param clientId assigned id of the client.
98      * @param jobId a TranscodingJob generated by the MediaTranscodingService.
99      * @return true if succeeds, false otherwise.
100      */
cancelJob(in int clientId, in int jobId)101     boolean cancelJob(in int clientId, in int jobId);
102 
103     /**
104      * Queries the job detail associated with a jobId.
105      *
106      * @param jobId a TranscodingJob generated by the MediaTranscodingService.
107      * @param job(output variable) the TranscodingJob associated with the jobId.
108      * @return true if succeeds, false otherwise.
109      */
getJobWithId(in int jobId, out TranscodingJobParcel job)110     boolean getJobWithId(in int jobId, out TranscodingJobParcel job);
111 }
112