@ -23,7 +23,6 @@
# include <binder/IMemory.h>
# include <binder/Parcel.h>
# include <drm/drm_framework_common.h>
# include <media/stagefright/foundation/ADebug.h>
namespace android {
@ -35,7 +34,6 @@ enum {
CLOSE ,
GET_FLAGS ,
TO_STRING ,
DRM_INITIALIZATION ,
} ;
struct BpDataSource : public BpInterface < IDataSource > {
@ -95,47 +93,6 @@ struct BpDataSource : public BpInterface<IDataSource> {
remote ( ) - > transact ( TO_STRING , data , & reply ) ;
return reply . readString8 ( ) ;
}
virtual sp < DecryptHandle > DrmInitialization ( const char * mime ) {
Parcel data , reply ;
data . writeInterfaceToken ( IDataSource : : getInterfaceDescriptor ( ) ) ;
if ( mime = = NULL ) {
data . writeInt32 ( 0 ) ;
} else {
data . writeInt32 ( 1 ) ;
data . writeCString ( mime ) ;
}
remote ( ) - > transact ( DRM_INITIALIZATION , data , & reply ) ;
sp < DecryptHandle > handle ;
if ( reply . dataAvail ( ) ! = 0 ) {
handle = new DecryptHandle ( ) ;
handle - > decryptId = reply . readInt32 ( ) ;
handle - > mimeType = reply . readString8 ( ) ;
handle - > decryptApiType = reply . readInt32 ( ) ;
handle - > status = reply . readInt32 ( ) ;
const int bufferLength = data . readInt32 ( ) ;
if ( bufferLength ! = - 1 ) {
handle - > decryptInfo = new DecryptInfo ( ) ;
handle - > decryptInfo - > decryptBufferLength = bufferLength ;
}
size_t size = data . readInt32 ( ) ;
for ( size_t i = 0 ; i < size ; + + i ) {
DrmCopyControl key = ( DrmCopyControl ) data . readInt32 ( ) ;
int value = data . readInt32 ( ) ;
handle - > copyControlVector . add ( key , value ) ;
}
size = data . readInt32 ( ) ;
for ( size_t i = 0 ; i < size ; + + i ) {
String8 key = data . readString8 ( ) ;
String8 value = data . readString8 ( ) ;
handle - > extendedData . add ( key , value ) ;
}
}
return handle ;
}
} ;
IMPLEMENT_META_INTERFACE ( DataSource , " android.media.IDataSource " ) ;
@ -178,42 +135,6 @@ status_t BnDataSource::onTransact(
reply - > writeString8 ( toString ( ) ) ;
return NO_ERROR ;
} break ;
case DRM_INITIALIZATION : {
CHECK_INTERFACE ( IDataSource , data , reply ) ;
const char * mime = NULL ;
const int32_t flag = data . readInt32 ( ) ;
if ( flag ! = 0 ) {
mime = data . readCString ( ) ;
}
sp < DecryptHandle > handle = DrmInitialization ( mime ) ;
if ( handle ! = NULL ) {
reply - > writeInt32 ( handle - > decryptId ) ;
reply - > writeString8 ( handle - > mimeType ) ;
reply - > writeInt32 ( handle - > decryptApiType ) ;
reply - > writeInt32 ( handle - > status ) ;
if ( handle - > decryptInfo ! = NULL ) {
reply - > writeInt32 ( handle - > decryptInfo - > decryptBufferLength ) ;
} else {
reply - > writeInt32 ( - 1 ) ;
}
size_t size = handle - > copyControlVector . size ( ) ;
reply - > writeInt32 ( size ) ;
for ( size_t i = 0 ; i < size ; + + i ) {
reply - > writeInt32 ( handle - > copyControlVector . keyAt ( i ) ) ;
reply - > writeInt32 ( handle - > copyControlVector . valueAt ( i ) ) ;
}
size = handle - > extendedData . size ( ) ;
reply - > writeInt32 ( size ) ;
for ( size_t i = 0 ; i < size ; + + i ) {
reply - > writeString8 ( handle - > extendedData . keyAt ( i ) ) ;
reply - > writeString8 ( handle - > extendedData . valueAt ( i ) ) ;
}
}
return NO_ERROR ;
} break ;
default :
return BBinder : : onTransact ( code , data , reply , flags ) ;