| Chong Zhang | 6d58e4b | 2020-03-31 09:41:10 -0700 | [diff] [blame] | 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 | #ifndef ANDROID_MEDIA_SCHEDULER_CLIENT_INTERFACE_H | 
 | 18 | #define ANDROID_MEDIA_SCHEDULER_CLIENT_INTERFACE_H | 
 | 19 |  | 
 | 20 | #include <aidl/android/media/ITranscodingClientCallback.h> | 
 | 21 | #include <aidl/android/media/TranscodingRequestParcel.h> | 
| Chong Zhang | 3fa408f | 2020-04-30 11:04:28 -0700 | [diff] [blame] | 22 | #include <media/TranscodingDefs.h> | 
| Chong Zhang | 6d58e4b | 2020-03-31 09:41:10 -0700 | [diff] [blame] | 23 |  | 
 | 24 | namespace android { | 
 | 25 |  | 
 | 26 | using ::aidl::android::media::ITranscodingClientCallback; | 
 | 27 | using ::aidl::android::media::TranscodingRequestParcel; | 
 | 28 |  | 
| Chong Zhang | 6d58e4b | 2020-03-31 09:41:10 -0700 | [diff] [blame] | 29 | // Interface for a client to call the scheduler to schedule or retrieve | 
 | 30 | // the status of a job. | 
 | 31 | class SchedulerClientInterface { | 
 | 32 | public: | 
| Chong Zhang | 15c192a | 2020-05-05 16:24:00 -0700 | [diff] [blame] | 33 |     /** | 
 | 34 |      * Submits one request to the scheduler. | 
 | 35 |      * | 
 | 36 |      * Returns true on success and false on failure. This call will fail is a job identified | 
 | 37 |      * by <clientId, jobId> already exists. | 
 | 38 |      */ | 
| Chong Zhang | 3fa408f | 2020-04-30 11:04:28 -0700 | [diff] [blame] | 39 |     virtual bool submit(ClientIdType clientId, JobIdType jobId, uid_t uid, | 
| Chong Zhang | 6d58e4b | 2020-03-31 09:41:10 -0700 | [diff] [blame] | 40 |                         const TranscodingRequestParcel& request, | 
 | 41 |                         const std::weak_ptr<ITranscodingClientCallback>& clientCallback) = 0; | 
 | 42 |  | 
| Chong Zhang | 15c192a | 2020-05-05 16:24:00 -0700 | [diff] [blame] | 43 |     /** | 
 | 44 |      * Cancels a job identified by <clientId, jobId>. | 
 | 45 |      * | 
 | 46 |      * If jobId is negative (<0), all jobs with a specified priority (that's not | 
 | 47 |      * TranscodingJobPriority::kUnspecified) will be cancelled. Otherwise, only the single job | 
 | 48 |      * <clientId, jobId> will be cancelled. | 
 | 49 |      * | 
 | 50 |      * Returns false if a single job is being cancelled but it doesn't exist. Returns | 
 | 51 |      * true otherwise. | 
 | 52 |      */ | 
| Chong Zhang | 3fa408f | 2020-04-30 11:04:28 -0700 | [diff] [blame] | 53 |     virtual bool cancel(ClientIdType clientId, JobIdType jobId) = 0; | 
| Chong Zhang | 6d58e4b | 2020-03-31 09:41:10 -0700 | [diff] [blame] | 54 |  | 
| Chong Zhang | 15c192a | 2020-05-05 16:24:00 -0700 | [diff] [blame] | 55 |     /** | 
 | 56 |      * Retrieves information about a job. | 
 | 57 |      * | 
 | 58 |      * Returns true and the job if it exists, and false otherwise. | 
 | 59 |      */ | 
| Chong Zhang | 3fa408f | 2020-04-30 11:04:28 -0700 | [diff] [blame] | 60 |     virtual bool getJob(ClientIdType clientId, JobIdType jobId, | 
| Chong Zhang | 6d58e4b | 2020-03-31 09:41:10 -0700 | [diff] [blame] | 61 |                         TranscodingRequestParcel* request) = 0; | 
 | 62 |  | 
 | 63 | protected: | 
 | 64 |     virtual ~SchedulerClientInterface() = default; | 
 | 65 | }; | 
 | 66 |  | 
 | 67 | }  // namespace android | 
 | 68 | #endif  // ANDROID_MEDIA_SCHEDULER_CLIENT_INTERFACE_H |