示例#1
0
        public bool SupportsSystemId(byte[] uuid)
        {
            if (!CencUtils.SupportsSystemId(uuid))
            {
                return(false);
            }

            var iemeKeySystemName = CencUtils.GetKeySystemName(uuid);

            return(IEME.isKeySystemSupported(iemeKeySystemName) == Status.kSupported);
        }
示例#2
0
        public IDrmSession CreateDRMSession(DRMInitData initData, DRMDescription drmDescription)
        {
            var iemeKeySystemName = CencUtils.GetKeySystemName(initData.SystemId);

            if (IEME.isKeySystemSupported(iemeKeySystemName) != Status.kSupported)
            {
                Logger.Warn($"Key System: {iemeKeySystemName} is not supported");
                return(null);
            }
            return(CencSession.Create(initData, drmDescription));
        }
示例#3
0
        public CdmInstance(string keySystem)
        {
            cdmInstance = IEME.create(this, keySystem, false, CDM_MODEL.E_CDM_MODEL_DEFAULT);
            if (cdmInstance == null)
            {
                Logger.Error($"Cannot create CDM instance for key system ${keySystem}!");
                throw new DrmException($"Cannot create CDM instance for key system ${keySystem}!");
            }

            KeySystem = keySystem;
            DrmType   = EmeUtils.GetDrmTypeFromKeySystemName(KeySystem);
            sessionsDuringInitializationTcs.TrySetResult(true);
        }
示例#4
0
        private async Task <IDrmSession> CreateDrmSession(DrmInitData initData, IEnumerable <byte[]> keys, List <DrmDescription> clipDrmConfigurations)
        {
            Logger.Warn("Creating new DRM session.");
            var scheme         = EmeUtils.GetScheme(initData.SystemId);
            var drmDescription = clipDrmConfigurations.FirstOrDefault(o => SchemeEquals(o.Scheme, scheme));

            if (drmDescription == null)
            {
                Logger.Warn("DRM not configured.");
                throw new DrmException("DRM not configured.");
            }

            var iemeKeySystemName = EmeUtils.GetKeySystemName(initData.SystemId);

            if (IEME.isKeySystemSupported(iemeKeySystemName) != Status.kSupported)
            {
                Logger.Warn($"Key System: {iemeKeySystemName} is not supported");
                throw new DrmException($"Key System: {iemeKeySystemName} is not supported");
            }

            var session = new MediaKeySession(initData, drmDescription, keys, this);

            SessionInitializing();

            try
            {
                await thread.Factory.Run(() => InitializeSessionOnIemeThread(session, initData)).ConfigureAwait(false);
            }
            catch (Exception e)
            {
                Logger.Error($"EME session creation fail: {e}");
                SessionInitializingDone();
                CloseSession(session.GetSessionId());
                session.Release();
                return(null);
            }

            return(session);
        }
示例#5
0
 private void DestroyCdm()
 {
     IEME.destroy(cdmInstance);
     cdmInstance = null;
 }