#ifndef CDMSession_h
#define CDMSession_h
#if ENABLE(ENCRYPTED_MEDIA_V2)
#include <runtime/Uint8Array.h>
#include <wtf/Forward.h>
#include <wtf/PassRefPtr.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
class CDMSessionClient {
public:
virtual ~CDMSessionClient() { };
virtual void sendMessage(Uint8Array*, String destinationURL) = 0;
enum {
MediaKeyErrorUnknown = 1,
MediaKeyErrorClient,
MediaKeyErrorService,
MediaKeyErrorOutput,
MediaKeyErrorHardwareChange,
MediaKeyErrorDomain,
};
typedef unsigned short MediaKeyErrorCode;
virtual void sendError(MediaKeyErrorCode, unsigned long systemCode) = 0;
virtual String mediaKeysStorageDirectory() const = 0;
};
enum CDMSessionType {
CDMSessionTypeUnknown,
CDMSessionTypeAVFoundationObjC,
CDMSessionTypeMediaSourceAVFObjC,
};
class CDMSession {
public:
CDMSession() { }
virtual ~CDMSession() { }
virtual CDMSessionType type() { return CDMSessionTypeUnknown; }
virtual void setClient(CDMSessionClient*) = 0;
virtual const String& sessionId() const = 0;
virtual PassRefPtr<Uint8Array> generateKeyRequest(const String& mimeType, Uint8Array* initData, String& destinationURL, unsigned short& errorCode, unsigned long& systemCode) = 0;
virtual void releaseKeys() = 0;
virtual bool update(Uint8Array*, RefPtr<Uint8Array>& nextMessage, unsigned short& errorCode, unsigned long& systemCode) = 0;
};
}
#endif // ENABLE(ENCRYPTED_MEDIA_V2)
#endif // CDMSession_h