videoplayback/videohelix/src/mpxvideodrmhelper.cpp
branchRCL_3
changeset 6 7d91903f795f
parent 0 96612d01cf9f
child 14 55fa1ec415c6
equal deleted inserted replaced
2:dec420019252 6:7d91903f795f
    13 *
    13 *
    14 * Description:   This class handles the DRM functions for the playback plugin
    14 * Description:   This class handles the DRM functions for the playback plugin
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 // Version : %version: 7 %
    18 // Version : %version: 8 %
    19 
    19 
    20 
    20 
    21 #include <caf/data.h>
    21 #include <caf/data.h>
    22 #include <caf/caftypes.h>
    22 #include <caf/caftypes.h>
    23 #include <caf/content.h>
    23 #include <caf/content.h>
    53 {
    53 {
    54     iDrmUtility = DRM::CDrmUtility::NewL();
    54     iDrmUtility = DRM::CDrmUtility::NewL();
    55 }
    55 }
    56 
    56 
    57 //  ------------------------------------------------------------------------------------------------
    57 //  ------------------------------------------------------------------------------------------------
    58 //    CMpxVideoDrmHelper::IsProtected()
    58 //    CMpxVideoDrmHelper::IsProtectedL()
    59 //  ------------------------------------------------------------------------------------------------
    59 //  ------------------------------------------------------------------------------------------------
    60 //
    60 //
    61 TBool CMpxVideoDrmHelper::IsProtected( RFile& aFile )
    61 TBool CMpxVideoDrmHelper::IsProtectedL( RFile& aFile )
    62 {
    62 {
    63     TBool drmProtected = EFalse;
    63     TBool drmProtected = EFalse;
    64 
    64 
    65     if ( aFile.SubSessionHandle() )
    65     if ( aFile.SubSessionHandle() )
    66     {
    66     {
    67         MPX_TRAPD( err, drmProtected = iDrmUtility->IsProtectedL( aFile ) );
    67         drmProtected = iDrmUtility->IsProtectedL( aFile );
    68     }
    68     }
    69 
    69 
    70     MPX_DEBUG(_L("CMpxVideoDrmHelper::IsProtected(%d)"), drmProtected);
    70     MPX_DEBUG(_L("CMpxVideoDrmHelper::IsProtectedL(%d)"), drmProtected);
    71 
    71 
    72     return drmProtected;
    72     return drmProtected;
    73 }
    73 }
    74 
    74 
    75 //  ------------------------------------------------------------------------------------------------
    75 //  ------------------------------------------------------------------------------------------------
    79 TInt CMpxVideoDrmHelper::GetDrmRightsStatus( RFile& aFile )
    79 TInt CMpxVideoDrmHelper::GetDrmRightsStatus( RFile& aFile )
    80 {
    80 {
    81     MPX_ENTER_EXIT(_L("CMpxVideoDrmHelper::GetDrmRightsStatus()"));
    81     MPX_ENTER_EXIT(_L("CMpxVideoDrmHelper::GetDrmRightsStatus()"));
    82 
    82 
    83     TInt drmError = KErrNone;
    83     TInt drmError = KErrNone;
    84 
    84     TBool drmProtected = EFalse;
    85     if ( IsProtected( aFile ) )
    85 
       
    86     MPX_TRAP( drmError, drmProtected = IsProtectedL(aFile ) );
       
    87 
       
    88     if ( drmProtected && (drmError == KErrNone) )
    86     {
    89     {
    87         ContentAccess::CData* data = NULL;
    90         ContentAccess::CData* data = NULL;
    88 
    91 
    89         //
    92         //
    90         //  Check if rights exist for clip
    93         //  Check if rights exist for clip
   109 
   112 
   110 TBool CMpxVideoDrmHelper::IsTvOutAllowedL( RFile& aFile )
   113 TBool CMpxVideoDrmHelper::IsTvOutAllowedL( RFile& aFile )
   111 {
   114 {
   112     TBool tvOutAllowed = ETrue;
   115     TBool tvOutAllowed = ETrue;
   113 
   116 
   114     if ( IsProtected( aFile ) )
   117     if ( IsProtectedL( aFile ) )
   115     {
   118     {
   116         ContentAccess::CContent* content = ContentAccess::CContent::NewLC( aFile );
   119         ContentAccess::CContent* content = ContentAccess::CContent::NewLC( aFile );
   117 
   120 
   118         ContentAccess::CData* data = content->OpenContentL( ContentAccess::EPeek );
   121         ContentAccess::CData* data = content->OpenContentL( ContentAccess::EPeek );
   119 
   122 
   143 }
   146 }
   144 
   147 
   145 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   148 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   146 
   149 
   147 //  ------------------------------------------------------------------------------------------------
   150 //  ------------------------------------------------------------------------------------------------
   148 //    CMpxVideoDrmHelper::IsProtected64()
   151 //    CMpxVideoDrmHelper::IsProtected64L()
   149 //  ------------------------------------------------------------------------------------------------
   152 //  ------------------------------------------------------------------------------------------------
   150 //
   153 //
   151 TBool CMpxVideoDrmHelper::IsProtected64( RFile64& aFile )
   154 TBool CMpxVideoDrmHelper::IsProtected64L( RFile64& aFile )
   152 {
   155 {
   153     TBool drmProtected = EFalse;
   156     TBool drmProtected = EFalse;
   154 
   157 
   155     if ( aFile.SubSessionHandle() )
   158     if ( aFile.SubSessionHandle() )
   156     {
   159     {
   157         MPX_TRAPD( err, drmProtected = iDrmUtility->IsProtectedL( aFile ) );
   160        drmProtected = iDrmUtility->IsProtectedL( aFile );
   158     }
   161     }
   159 
   162 
   160     MPX_DEBUG(_L("CMpxVideoDrmHelper::IsProtected64(%d)"), drmProtected);
   163     MPX_DEBUG(_L("CMpxVideoDrmHelper::IsProtected64L(%d)"), drmProtected);
   161 
   164 
   162     return drmProtected;
   165     return drmProtected;
   163 }
   166 }
   164 
   167 
   165 //  ------------------------------------------------------------------------------------------------
   168 //  ------------------------------------------------------------------------------------------------
   169 TInt CMpxVideoDrmHelper::GetDrmRightsStatus64( RFile64& aFile )
   172 TInt CMpxVideoDrmHelper::GetDrmRightsStatus64( RFile64& aFile )
   170 {
   173 {
   171     MPX_ENTER_EXIT(_L("CMpxVideoDrmHelper::GetDrmRightsStatus64()"));
   174     MPX_ENTER_EXIT(_L("CMpxVideoDrmHelper::GetDrmRightsStatus64()"));
   172 
   175 
   173     TInt drmError = KErrNone;
   176     TInt drmError = KErrNone;
   174 
   177     TBool drmProtected = EFalse;
   175     if ( IsProtected64( aFile ) )
   178 
       
   179     MPX_TRAP( drmError, drmProtected = IsProtected64L( aFile ) );
       
   180 
       
   181     if ( drmProtected && (drmError == KErrNone) )
   176     {
   182     {
   177         ContentAccess::CData* data = NULL;
   183         ContentAccess::CData* data = NULL;
   178 
   184 
   179         //
   185         //
   180         //  Check if rights exist for clip
   186         //  Check if rights exist for clip
   203 //
   209 //
   204 TBool CMpxVideoDrmHelper::IsTvOutAllowed64L( RFile64& aFile )
   210 TBool CMpxVideoDrmHelper::IsTvOutAllowed64L( RFile64& aFile )
   205 {
   211 {
   206     TBool tvOutAllowed = ETrue;
   212     TBool tvOutAllowed = ETrue;
   207 
   213 
   208     if ( IsProtected64( aFile ) )
   214     if ( IsProtected64L( aFile ) )
   209     {
   215     {
   210         ContentAccess::CContent* content = ContentAccess::CContent::NewLC( aFile );
   216         ContentAccess::CContent* content = ContentAccess::CContent::NewLC( aFile );
   211 
   217 
   212         ContentAccess::CData* data = content->OpenContentL( ContentAccess::EPeek );
   218         ContentAccess::CData* data = content->OpenContentL( ContentAccess::EPeek );
   213 
   219