CDMInstanceFairPlayStreamingAVFObjC.h [plain text]
#pragma once
#if ENABLE(ENCRYPTED_MEDIA) && HAVE(AVCONTENTKEYSESSION)
#include "CDMInstance.h"
#include <wtf/Function.h>
#include <wtf/RetainPtr.h>
#include <wtf/WeakPtr.h>
#include <wtf/text/WTFString.h>
OBJC_CLASS AVContentKeyRequest;
OBJC_CLASS AVContentKeySession;
OBJC_CLASS NSData;
OBJC_CLASS NSError;
OBJC_CLASS NSURL;
OBJC_CLASS WebCoreFPSContentKeySessionDelegate;
namespace WebCore {
class CDMInstanceFairPlayStreamingAVFObjC final : public CDMInstance {
public:
CDMInstanceFairPlayStreamingAVFObjC();
virtual ~CDMInstanceFairPlayStreamingAVFObjC();
static bool supportsPersistableState();
static bool supportsPersistentKeys();
static bool mimeTypeIsPlayable(const String&);
ImplementationType implementationType() const final { return ImplementationType::FairPlayStreaming; }
SuccessValue initializeWithConfiguration(const CDMKeySystemConfiguration&) final;
SuccessValue setDistinctiveIdentifiersAllowed(bool) final;
SuccessValue setPersistentStateAllowed(bool) final;
SuccessValue setServerCertificate(Ref<SharedBuffer>&&) final;
SuccessValue setStorageDirectory(const String&) final;
void requestLicense(LicenseType, const AtomicString& initDataType, Ref<SharedBuffer>&& initData, LicenseCallback) final;
void updateLicense(const String&, LicenseType, const SharedBuffer&, LicenseUpdateCallback) final;
void loadSession(LicenseType, const String&, const String&, LoadSessionCallback) final;
void closeSession(const String&, CloseSessionCallback) final;
void removeSessionData(const String&, LicenseType, RemoveSessionDataCallback) final;
void storeRecordOfKeyUsage(const String&) final;
const String& keySystem() const final;
void didProvideRequest(AVContentKeyRequest *);
void didProvideRenewingRequest(AVContentKeyRequest *);
void didProvidePersistableRequest(AVContentKeyRequest *);
void didFailToProvideRequest(AVContentKeyRequest *, NSError *);
bool shouldRetryRequestForReason(AVContentKeyRequest *, NSString *);
void sessionIdentifierChanged(NSData *);
AVContentKeySession *contentKeySession() { return m_session.get(); }
private:
WeakPtr<CDMInstanceFairPlayStreamingAVFObjC> createWeakPtr() { return m_weakPtrFactory.createWeakPtr(*this); }
bool isLicenseTypeSupported(LicenseType) const;
Vector<Ref<SharedBuffer>> keyIDs();
WeakPtrFactory<CDMInstanceFairPlayStreamingAVFObjC> m_weakPtrFactory;
RefPtr<SharedBuffer> m_serverCertificate;
bool m_persistentStateAllowed { true };
RetainPtr<NSURL> m_storageDirectory;
RetainPtr<AVContentKeySession> m_session;
RetainPtr<AVContentKeyRequest> m_request;
RetainPtr<WebCoreFPSContentKeySessionDelegate> m_delegate;
Vector<RetainPtr<NSData>> m_expiredSessions;
String m_sessionId;
LicenseCallback m_requestLicenseCallback;
LicenseUpdateCallback m_updateLicenseCallback;
CloseSessionCallback m_closeSessionCallback;
RemoveSessionDataCallback m_removeSessionDataCallback;
};
}
SPECIALIZE_TYPE_TRAITS_CDM_INSTANCE(WebCore::CDMInstanceFairPlayStreamingAVFObjC, WebCore::CDMInstance::ImplementationType::FairPlayStreaming)
#endif // ENABLE(ENCRYPTED_MEDIA) && HAVE(AVCONTENTKEYSESSION)