@ -65,7 +65,20 @@ status_t ClearKeyCasFactory::createPlugin(
* plugin = new ClearKeyCasPlugin ( appData , callback ) ;
* plugin = new ClearKeyCasPlugin ( appData , callback ) ;
return OK ;
return OK ;
}
}
///////////////////////////////////////////////////////////////////////////////
status_t ClearKeyCasFactory : : createPlugin (
int32_t CA_system_id ,
void * appData ,
CasPluginCallbackExt callback ,
CasPlugin * * plugin ) {
if ( ! isSystemIdSupported ( CA_system_id ) ) {
return BAD_VALUE ;
}
* plugin = new ClearKeyCasPlugin ( appData , callback ) ;
return OK ;
}
////////////////////////////////////////////////////////////////////////////////
bool ClearKeyDescramblerFactory : : isSystemIdSupported (
bool ClearKeyDescramblerFactory : : isSystemIdSupported (
int32_t CA_system_id ) const {
int32_t CA_system_id ) const {
return CA_system_id = = sClearKeySystemId ;
return CA_system_id = = sClearKeySystemId ;
@ -88,6 +101,12 @@ ClearKeyCasPlugin::ClearKeyCasPlugin(
ALOGV ( " CTOR " ) ;
ALOGV ( " CTOR " ) ;
}
}
ClearKeyCasPlugin : : ClearKeyCasPlugin (
void * appData , CasPluginCallbackExt callback )
: mCallbackExt ( callback ) , mAppData ( appData ) {
ALOGV ( " CTOR " ) ;
}
ClearKeyCasPlugin : : ~ ClearKeyCasPlugin ( ) {
ClearKeyCasPlugin : : ~ ClearKeyCasPlugin ( ) {
ALOGV ( " DTOR " ) ;
ALOGV ( " DTOR " ) ;
ClearKeySessionLibrary : : get ( ) - > destroyPlugin ( this ) ;
ClearKeySessionLibrary : : get ( ) - > destroyPlugin ( this ) ;
@ -167,8 +186,27 @@ status_t ClearKeyCasPlugin::sendEvent(
// Echo the received event to the callback.
// Echo the received event to the callback.
// Clear key plugin doesn't use any event, echo'ing for testing only.
// Clear key plugin doesn't use any event, echo'ing for testing only.
if ( mCallback ! = NULL ) {
if ( mCallback ! = NULL ) {
mCallback ( ( void * ) mAppData , event , arg , ( uint8_t * ) eventData . data ( ) , eventData . size ( ) ) ;
mCallback ( ( void * ) mAppData , event , arg , ( uint8_t * ) eventData . data ( ) ,
eventData . size ( ) ) ;
} else if ( mCallbackExt ! = NULL ) {
mCallbackExt ( ( void * ) mAppData , event , arg , ( uint8_t * ) eventData . data ( ) ,
eventData . size ( ) , NULL ) ;
}
return OK ;
}
status_t ClearKeyCasPlugin : : sendSessionEvent (
const CasSessionId & sessionId , int32_t event ,
int arg , const CasData & eventData ) {
ALOGV ( " sendSessionEvent: sessionId=%s, event=%d, arg=%d " ,
sessionIdToString ( sessionId ) . string ( ) , event , arg ) ;
// Echo the received event to the callback.
// Clear key plugin doesn't use any event, echo'ing for testing only.
if ( mCallbackExt ! = NULL ) {
mCallbackExt ( ( void * ) mAppData , event , arg , ( uint8_t * ) eventData . data ( ) ,
eventData . size ( ) , & sessionId ) ;
}
}
return OK ;
return OK ;
}
}