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 #ifndef ANDROID_MEDIA_TRANSCODING_SERVICE_H 18 #define ANDROID_MEDIA_TRANSCODING_SERVICE_H 19 20 #include <aidl/android/media/BnMediaTranscodingService.h> 21 #include <binder/IServiceManager.h> 22 23 namespace android { 24 25 using Status = ::ndk::ScopedAStatus; 26 using ::aidl::android::media::BnMediaTranscodingService; 27 using ::aidl::android::media::ITranscodingClient; 28 using ::aidl::android::media::ITranscodingClientCallback; 29 using ::aidl::android::media::TranscodingRequestParcel; 30 using ::aidl::android::media::TranscodingSessionParcel; 31 class TranscodingClientManager; 32 class TranscodingLogger; 33 class TranscodingSessionController; 34 class UidPolicyInterface; 35 class ResourcePolicyInterface; 36 class ThermalPolicyInterface; 37 38 class MediaTranscodingService : public BnMediaTranscodingService { 39 public: 40 static constexpr int32_t kInvalidSessionId = -1; 41 static constexpr int32_t kInvalidClientId = -1; 42 43 MediaTranscodingService(); 44 virtual ~MediaTranscodingService(); 45 46 static void instantiate(); 47 getServiceName()48 static const char* getServiceName() { return "media.transcoding"; } 49 50 Status registerClient(const std::shared_ptr<ITranscodingClientCallback>& in_callback, 51 const std::string& in_clientName, const std::string& in_opPackageName, 52 std::shared_ptr<ITranscodingClient>* _aidl_return) override; 53 54 Status getNumOfClients(int32_t* _aidl_return) override; 55 56 virtual inline binder_status_t dump(int /*fd*/, const char** /*args*/, uint32_t /*numArgs*/); 57 58 private: 59 friend class MediaTranscodingServiceTest; 60 61 mutable std::mutex mServiceLock; 62 63 std::shared_ptr<UidPolicyInterface> mUidPolicy; 64 std::shared_ptr<ResourcePolicyInterface> mResourcePolicy; 65 std::shared_ptr<ThermalPolicyInterface> mThermalPolicy; 66 std::shared_ptr<TranscodingLogger> mLogger; 67 std::shared_ptr<TranscodingSessionController> mSessionController; 68 std::shared_ptr<TranscodingClientManager> mClientManager; 69 }; 70 71 } // namespace android 72 73 #endif // ANDROID_MEDIA_TRANSCODING_SERVICE_H 74