1791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang/* 2791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang * Copyright (C) 2017 The Android Open Source Project 3791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang * 4791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang * Licensed under the Apache License, Version 2.0 (the "License"); 5791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang * you may not use this file except in compliance with the License. 6791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang * You may obtain a copy of the License at 7791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang * 8791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang * http://www.apache.org/licenses/LICENSE-2.0 9791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang * 10791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang * Unless required by applicable law or agreed to in writing, software 11791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang * distributed under the License is distributed on an "AS IS" BASIS, 12791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang * See the License for the specific language governing permissions and 14791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang * limitations under the License. 15791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang */ 16791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang 17791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang#ifndef LICENSE_FETCHER_H_ 18791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang#define LICENSE_FETCHER_H_ 19791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang 20791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang#include "protos/license_protos.pb.h" 21791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang#include <media/stagefright/foundation/ABase.h> 22791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang 23791a1a206b56be8601a6fffd2614926e67d64790Chong Zhangnamespace android { 24791a1a206b56be8601a6fffd2614926e67d64790Chong Zhangnamespace clearkeycas { 25791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang 26791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang// Interface for classes which request a license. 27791a1a206b56be8601a6fffd2614926e67d64790Chong Zhangclass LicenseFetcher { 28791a1a206b56be8601a6fffd2614926e67d64790Chong Zhangpublic: 29791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang LicenseFetcher() {} 30791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang virtual ~LicenseFetcher() {} 31791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang 32791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang // Initializes resources set in subclass-specific calls. This must be called 33791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang // before threads are started. 34791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang virtual status_t Init(const char *input) = 0; 35791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang 36791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang // Fetches license based on |asset_id|. On return, |asset| contains the 37791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang // decrypted asset_key needed to decrypt content keys. 38791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang // |asset| must be non-null. 39791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang virtual status_t FetchLicense( 40791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang uint64_t asset_id, clearkeycas::Asset* asset) = 0; 41791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang 42791a1a206b56be8601a6fffd2614926e67d64790Chong Zhangprivate: 43791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang DISALLOW_EVIL_CONSTRUCTORS(LicenseFetcher); 44791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang}; 45791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang 46791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang} // namespace clearkeycas 47791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang} // namespace android 48791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang 49791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang#endif // LICENSE_FETCHER_H_ 50