| | 68 | if ( *aMIMEType==KMimeDRM ) |
| | 69 | { |
| | 70 | HBufC8* drmContent = DecodeDRMImageContentL(aData); |
| | 71 | TInt drmContentLength = drmContent->Des().Length(); |
| | 72 | const TUint8* src = drmContent->Des().Ptr(); |
| | 73 | iData = MemoryManager::Alloc( drmContentLength ); |
| | 74 | Mem::Copy( iData, src, drmContentLength ); |
| | 75 | iDataPtr.Set((TUint8*)iData, drmContentLength, drmContentLength ); |
| | 76 | delete drmContent; |
| | 77 | } |
| | 78 | else |
| | 79 | { |
| | 94 | } |
| | 95 | //============================================================================= |
| | 96 | // DecodeDRMImageContentL : Function for handling the DRM image content |
| | 97 | //============================================================================= |
| | 98 | HBufC8* CRawData::DecodeDRMImageContentL(const TDesC8& aData) |
| | 99 | { |
| | 100 | // input buffers for image conversion |
| | 101 | HBufC8* bufInput = HBufC8::NewLC( aData.Length() + 1 ); |
| | 102 | TPtr8 ptrInput = bufInput->Des(); |
| | 103 | //Reader intends to view content |
| | 104 | ptrInput.Append( EView ); |
| | 105 | ptrInput.Append( aData ); |
| | 106 | |
| | 107 | // output buffer for image conversion |
| | 108 | HBufC8* animatedDRMdata = HBufC8::NewLC( aData.Length() + 256 ); |
| | 109 | TPtr8 ptrOutput = animatedDRMdata->Des(); |
| | 110 | |
| | 111 | //Find DRM agent |
| | 112 | TAgent agentDRM; |
| | 113 | RArray<ContentAccess::TAgent> agents; |
| | 114 | ContentAccess::CManager* manager = CManager::NewLC(); |
| | 115 | manager->ListAgentsL( agents ); |
| | 116 | for ( TInt i = 0; i < agents.Count(); i++ ) |
| | 117 | { |
| | 118 | if ( agents[i].Name().Compare( KOmaDrm2AgentName ) == 0) |
| | 119 | { |
| | 120 | agentDRM = agents[i]; |
| | 121 | break; |
| | 122 | } |
| | 123 | } |
| | 124 | |
| | 125 | // convert the DRM image |
| | 126 | manager->AgentSpecificCommand( agentDRM, EDecryptOma1DcfBuffer, ptrInput, |
| | 127 | ptrOutput); |
| | 128 | |
| | 129 | CleanupStack::PopAndDestroy(manager); |
| | 130 | //keep animatedDRMdata to return |
| | 131 | CleanupStack::Pop(animatedDRMdata); |
| | 132 | CleanupStack::PopAndDestroy(bufInput); |
| | 133 | |
| | 134 | return animatedDRMdata; |
| 185 | | } |
| 186 | | |
| 187 | | //============================================================================= |
| 188 | | // DecodeDRMImageL : Function for handling the DRM images. |
| 189 | | //============================================================================= |
| 190 | | void CStaticImageDecoder::DecodeDRMImageL() |
| 191 | | { |
| 192 | | TInt error(KErrNone); |
| 193 | | CRawData* data = iQueue[0]; |
| 194 | | |
| 195 | | // Input buffer length |
| 196 | | TInt inputBufLen = data->iDataPtr.Size() + 1; |
| 197 | | // input buffers for image conversion |
| 198 | | HBufC8* bufInput = HBufC8::NewLC( inputBufLen + 1 ); |
| 199 | | TPtr8 ptrInput = bufInput->Des(); |
| 200 | | //Reader intends to view content |
| 201 | | ptrInput.Append( EView ); |
| 202 | | ptrInput.Append( data->iDataPtr ); |
| 203 | | |
| 204 | | // Output buffer length |
| 205 | | TInt outputBufLen = data->iDataPtr.Size() + 256; |
| 206 | | // output buffer for image conversion |
| 207 | | HBufC8* bufOutput = HBufC8::NewLC( outputBufLen ); |
| 208 | | TPtr8 ptrOutput = bufOutput->Des(); |
| 209 | | |
| 210 | | // Do we have a DRM image? |
| 211 | | TAgent agentDRM; |
| 212 | | RArray<ContentAccess::TAgent> agents; |
| 213 | | ContentAccess::CManager* manager = CManager::NewLC(); |
| 214 | | manager->ListAgentsL( agents ); |
| 215 | | for ( TInt i = 0; i < agents.Count(); i++ ) |
| 216 | | { |
| 217 | | if ( agents[i].Name().Compare( KOmaDrm2AgentName ) == 0) |
| 218 | | { |
| 219 | | agentDRM = agents[i]; |
| 220 | | break; |
| 221 | | } |
| 222 | | } |
| 223 | | |
| 224 | | // convert the DRM image |
| 225 | | error = manager->AgentSpecificCommand( |
| 226 | | agentDRM, |
| 227 | | EDecryptOma1DcfBuffer, |
| 228 | | ptrInput, |
| 229 | | ptrOutput); |
| 230 | | |
| 231 | | if ( error == KErrNone) |
| 232 | | { |
| 233 | | Reset(); |
| 234 | | // Decrypted ok (if not image is skipped) |
| 235 | | iDecoder->OpenL( ptrOutput, CImageDecoder::EOptionNone ); |
| 236 | | } |
| 237 | | |
| 238 | | CleanupStack::Pop(3); // manager, bufOutput,bufInput |