blob: e00cfb24b5012326bc0e65ac18df9bf78f059f1b [file] [log] [blame]
Chong Zhang6d58e4b2020-03-31 09:41:10 -07001/*
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 Zhang3fa408f2020-04-30 11:04:28 -070022#include <media/TranscodingDefs.h>
Chong Zhang6d58e4b2020-03-31 09:41:10 -070023
24namespace android {
25
26using ::aidl::android::media::ITranscodingClientCallback;
27using ::aidl::android::media::TranscodingRequestParcel;
28
Chong Zhang6d58e4b2020-03-31 09:41:10 -070029// Interface for a client to call the scheduler to schedule or retrieve
30// the status of a job.
31class SchedulerClientInterface {
32public:
Chong Zhang15c192a2020-05-05 16:24:00 -070033 /**
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 Zhang3fa408f2020-04-30 11:04:28 -070039 virtual bool submit(ClientIdType clientId, JobIdType jobId, uid_t uid,
Chong Zhang6d58e4b2020-03-31 09:41:10 -070040 const TranscodingRequestParcel& request,
41 const std::weak_ptr<ITranscodingClientCallback>& clientCallback) = 0;
42
Chong Zhang15c192a2020-05-05 16:24:00 -070043 /**
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 Zhang3fa408f2020-04-30 11:04:28 -070053 virtual bool cancel(ClientIdType clientId, JobIdType jobId) = 0;
Chong Zhang6d58e4b2020-03-31 09:41:10 -070054
Chong Zhang15c192a2020-05-05 16:24:00 -070055 /**
56 * Retrieves information about a job.
57 *
58 * Returns true and the job if it exists, and false otherwise.
59 */
Chong Zhang3fa408f2020-04-30 11:04:28 -070060 virtual bool getJob(ClientIdType clientId, JobIdType jobId,
Chong Zhang6d58e4b2020-03-31 09:41:10 -070061 TranscodingRequestParcel* request) = 0;
62
63protected:
64 virtual ~SchedulerClientInterface() = default;
65};
66
67} // namespace android
68#endif // ANDROID_MEDIA_SCHEDULER_CLIENT_INTERFACE_H