Пример #1
0
imeth int UnsignedShortInteger_im_gCompare(object self, object obj)
{ UnsignedShortInteger_iv_t *iv = GetIVs(UnsignedShortInteger, self);
	unsigned short sv, ov; 

	ChkArg(obj, 2); 
	if (ClassOf(obj) != CLASS) 
		return oSuper(UnsignedShortInteger_c, gCompare, self)(self, obj); 
	if ((sv=iv->iVal) < (ov=ivPtr(obj)->iVal)) 
		return -1; 
	else if (sv == ov) 
		return 0; 
	else 
		return 1; 
} 
//
// Expected synchronisation from caller. This method is not thread-safe!
//
bool PlayreadySession::playreadyProcessKey(Uint8Array* key, RefPtr<Uint8Array>& nextMessage, unsigned short& errorCode, uint32_t& systemCode)
{
    DRM_RESULT dr = DRM_SUCCESS;
    DRM_LICENSE_RESPONSE oLicenseResponse = {eUnknownProtocol, 0};
    uint8_t *m_pbKeyMessageResponse = key->data();
    uint32_t m_cbKeyMessageResponse = key->byteLength();

    GST_MEMDUMP("response received :", key->data(), key->byteLength());

    // The current state MUST be KEY_PENDING otherwise error out.
    ChkBOOL(m_eKeyState == KEY_PENDING, DRM_E_INVALIDARG);

    ChkArg(m_pbKeyMessageResponse != NULL && m_cbKeyMessageResponse > 0);

    ChkDR(Drm_LicenseAcq_ProcessResponse(m_poAppContext,
                                         DRM_PROCESS_LIC_RESPONSE_SIGNATURE_NOT_REQUIRED,
                                         NULL,
                                         NULL,
                                         const_cast<DRM_BYTE *>(m_pbKeyMessageResponse),
                                         m_cbKeyMessageResponse,
                                         &oLicenseResponse));

    ChkDR(Drm_Reader_Bind(m_poAppContext,
                          g_rgpdstrRights,
                          NO_OF(g_rgpdstrRights),
                          _PolicyCallback,
                          NULL,
                          &m_oDecryptContext));

    m_key = key->buffer();
    errorCode = 0;
    m_eKeyState = KEY_READY;
    GST_DEBUG("key processed, now ready for content decryption");
    systemCode = dr;
    return true;

ErrorExit:
    if (DRM_FAILED(dr)) {
        GST_ERROR("failed processing license response");
        errorCode = MediaKeyError::MEDIA_KEYERR_CLIENT;
        m_eKeyState = KEY_ERROR;
    }
    return false;
}
Пример #3
0
imeth objrtn UnsignedShortInteger_im_gChangeValue(object self, object val)
{ UnsignedShortInteger_iv_t *iv = GetIVs(UnsignedShortInteger, self);
	ChkArg(val, 2); 
	iv->iVal = gUnsignedShortValue(val); 
	return self; 
}