/* * Copyright (C) 2011 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef __WVMDRMPLUGIN_API_H__ #define __WVMDRMPLUGIN_API_H__ #include #include "WVStreamControlAPI.h" class WVDRMPluginAPI { public: virtual ~WVDRMPluginAPI() {} enum { RIGHTS_VALID, RIGHTS_INVALID, RIGHTS_EXPIRED, RIGHTS_NOT_ACQUIRED }; enum { PLAYBACK_START, PLAYBACK_STOP, PLAYBACK_PAUSE, PLAYBACK_INVALID }; static WVDRMPluginAPI *create(); static void destroy(WVDRMPluginAPI *plugin); virtual void OpenSession() = 0; virtual void CloseSession() = 0; virtual bool IsSupportedMediaType(const char *uri) = 0; virtual bool AcquireDrmInfo(std::string &assetPath, WVCredentials &credentials, std::string &dsPath, const std::string &assetIdStr, const std::string &systemIdStr, const std::string &keyIdStr, uint32_t *assetId, uint32_t *systemId, uint32_t *keyId) = 0; virtual bool ProcessDrmInfo(std::string &assetPath) = 0; virtual int CheckRightsStatus(std::string &path) = 0; virtual bool GetConstraints(std::string &path, uint32_t *timeSincePlayback, uint32_t *timeRemaining, uint32_t *licenseDuration) = 0; virtual bool SetPlaybackStatus(int playbackStatus, off64_t position) = 0; virtual bool RemoveRights(std::string &path) = 0; virtual bool RemoveAllRights() = 0; virtual bool Prepare(char *data, int len) = 0; virtual bool Operate(char *in, char *out, int len, char *iv) = 0; protected: // use create factory method, don't construct directly WVDRMPluginAPI() {} }; #endif