videoplayback/videohelix/src/mpxvideohelixplayback.cpp
branchRCL_3
changeset 13 112a725ff2c2
parent 11 5294c000a26d
equal deleted inserted replaced
11:5294c000a26d 13:112a725ff2c2
    13 *
    13 *
    14 * Description:  This class plays local video file
    14 * Description:  This class plays local video file
    15  *
    15  *
    16 */
    16 */
    17 
    17 
    18 // Version : %version: 14 %
    18 // Version : %version: 15 %
    19 
    19 
    20 
    20 
    21 //
    21 //
    22 //  INCLUDE FILES
    22 //  INCLUDE FILES
    23 //
    23 //
   113         aFile.Close();
   113         aFile.Close();
   114     }
   114     }
   115 
   115 
   116     TInt err = aFile.Open( iFs, aUri, EFileRead | EFileShareReadersOrWriters );
   116     TInt err = aFile.Open( iFs, aUri, EFileRead | EFileShareReadersOrWriters );
   117 
   117 
   118     if ( err != KErrNone )
   118     //
       
   119     //  Check if RFile64 is needed
       
   120     //
       
   121     if ( err == KErrTooBig )
       
   122     {
       
   123         User::Leave( KErrTooBig );
       
   124     }
       
   125     else if ( err != KErrNone )
   119     {
   126     {
   120         CheckForStreamingUrlL( aUri );
   127         CheckForStreamingUrlL( aUri );
   121     }
   128     }
   122 }
   129 }
   123 
   130 
   127 //
   134 //
   128 void CMPXVideoHelixPlayback::InitialiseL( const TDesC& aSong )
   135 void CMPXVideoHelixPlayback::InitialiseL( const TDesC& aSong )
   129 {
   136 {
   130     MPX_ENTER_EXIT(_L("CMPXVideoHelixPlayback::InitialiseL()"),
   137     MPX_ENTER_EXIT(_L("CMPXVideoHelixPlayback::InitialiseL()"),
   131                   _L("aSong %S"), &aSong );
   138                   _L("aSong %S"), &aSong );
   132     
   139 
   133     InitialiseWithPositionL( aSong );
   140     InitialiseWithPositionL( aSong );
   134 }
   141 }
   135 
   142 
   136 
   143 
   137 //  ----------------------------------------------------------------------------
   144 //  ----------------------------------------------------------------------------
   149 
   156 
   150     MPX_TRAPD( err, OpenFileHandleL( aSong, fileHandle ));
   157     MPX_TRAPD( err, OpenFileHandleL( aSong, fileHandle ));
   151 
   158 
   152     if ( err == KErrNone )
   159     if ( err == KErrNone )
   153     {
   160     {
   154         iVideoPlaybackCtlr->OpenFileL( aSong, fileHandle, aPosition ); 
   161         iVideoPlaybackCtlr->OpenFileL( aSong, fileHandle, aPosition );
   155     }   
   162     }
   156 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   163 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   157     else if ( err == KErrTooBig )
   164     else if ( err == KErrTooBig )
   158     {
   165     {
   159         //
   166         //
   160         // use RFile64 handle
   167         // use RFile64 handle
   169             // Handle error
   176             // Handle error
   170             iVideoPlaybackCtlr->HandleError( err );
   177             iVideoPlaybackCtlr->HandleError( err );
   171         }
   178         }
   172         else
   179         else
   173         {
   180         {
   174                 iVideoPlaybackCtlr->OpenFile64L( aSong, fileHandle64, aPosition ); 
   181                 iVideoPlaybackCtlr->OpenFile64L( aSong, fileHandle64, aPosition );
   175         }
   182         }
   176 
   183 
   177         CleanupStack::PopAndDestroy(); // fileHandle64
   184         CleanupStack::PopAndDestroy(); // fileHandle64
   178     }
   185     }
   179 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   186 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   191 //  ----------------------------------------------------------------------------
   198 //  ----------------------------------------------------------------------------
   192 //
   199 //
   193 void CMPXVideoHelixPlayback::InitialiseL( RFile& aSong )
   200 void CMPXVideoHelixPlayback::InitialiseL( RFile& aSong )
   194 {
   201 {
   195     MPX_ENTER_EXIT(_L("CMPXVideoHelixPlayback::InitialiseL( RFile )"));
   202     MPX_ENTER_EXIT(_L("CMPXVideoHelixPlayback::InitialiseL( RFile )"));
   196         
   203 
   197     InitialiseWithPositionL( aSong );
   204     InitialiseWithPositionL( aSong );
   198 }
   205 }
   199 
   206 
   200 //  ----------------------------------------------------------------------------
   207 //  ----------------------------------------------------------------------------
   201 //    Initializes a clip for playback from a file handle with position
   208 //    Initializes a clip for playback from a file handle with position
   203 //
   210 //
   204 void CMPXVideoHelixPlayback::InitialiseWithPositionL( RFile& aSong, TInt aPosition )
   211 void CMPXVideoHelixPlayback::InitialiseWithPositionL( RFile& aSong, TInt aPosition )
   205 {
   212 {
   206     MPX_ENTER_EXIT(_L("CMPXVideoHelixPlayback::InitialiseWithPositionL( RFile )"),
   213     MPX_ENTER_EXIT(_L("CMPXVideoHelixPlayback::InitialiseWithPositionL( RFile )"),
   207                    _L("aPosition %d"), aPosition );
   214                    _L("aPosition %d"), aPosition );
   208     
   215 
   209     TFileName filename;
   216     TFileName filename;
   210     aSong.FullName( filename );
   217     aSong.FullName( filename );
   211 
   218 
   212     iVideoPlaybackCtlr->OpenFileL( filename, aSong, aPosition ); 
   219     iVideoPlaybackCtlr->OpenFileL( filename, aSong, aPosition );
   213 }
   220 }
   214 
   221 
   215 
   222 
   216 //  ----------------------------------------------------------------------------
   223 //  ----------------------------------------------------------------------------
   217 //    Initializes a clip for playback from a file name
   224 //    Initializes a clip for playback from a file name
   218 //  ----------------------------------------------------------------------------
   225 //  ----------------------------------------------------------------------------
   219 //
   226 //
   220 void CMPXVideoHelixPlayback::InitStreamingL( const TDesC& aUri,
   227 void CMPXVideoHelixPlayback::InitStreamingL( const TDesC& aUri,
   221                                              const TDesC8& /*aType*/,
   228                                              const TDesC8& /*aType*/,
   222                                              TInt aAccessPoint, 
   229                                              TInt aAccessPoint,
   223                                              TInt aPosition ) 
   230                                              TInt aPosition )
   224 {
   231 {
   225     MPX_ENTER_EXIT(_L("CMPXVideoHelixPlayback::InitStreamingL()"),
   232     MPX_ENTER_EXIT(_L("CMPXVideoHelixPlayback::InitStreamingL()"),
   226                    _L("aUri %S, aAccessPoint %d, aPosition %d"), &aUri, aAccessPoint, aPosition );
   233                    _L("aUri %S, aAccessPoint %d, aPosition %d"), &aUri, aAccessPoint, aPosition );
   227 
   234 
   228     RFile fileHandle;
   235     RFile fileHandle;
   236         // Handle error
   243         // Handle error
   237         iVideoPlaybackCtlr->HandleError( err );
   244         iVideoPlaybackCtlr->HandleError( err );
   238     }
   245     }
   239     else
   246     else
   240     {
   247     {
   241         iVideoPlaybackCtlr->OpenFileL( aUri, fileHandle, aPosition, aAccessPoint );  
   248         iVideoPlaybackCtlr->OpenFileL( aUri, fileHandle, aPosition, aAccessPoint );
   242     }
   249     }
   243 
   250 
   244     CleanupStack::PopAndDestroy();
   251     CleanupStack::PopAndDestroy();
   245 }
   252 }
   246 
   253 
   247 //  ----------------------------------------------------------------------------
   254 //  ----------------------------------------------------------------------------
   248 //    Initializes a clip for playback from a file handle
   255 //    Initializes a clip for playback from a file handle
   249 //  ----------------------------------------------------------------------------
   256 //  ----------------------------------------------------------------------------
   250 //
   257 //
   251 void CMPXVideoHelixPlayback::InitStreamingL( RFile& aFile, TInt aAccessPoint, TInt aPosition  ) 
   258 void CMPXVideoHelixPlayback::InitStreamingL( RFile& aFile, TInt aAccessPoint, TInt aPosition  )
   252 {
   259 {
   253     MPX_ENTER_EXIT(_L("CMPXVideoHelixPlayback::InitStreamingL( RFile )"),
   260     MPX_ENTER_EXIT(_L("CMPXVideoHelixPlayback::InitStreamingL( RFile )"),
   254                    _L("aAccessPoint = %d, aPosition = %d"), aAccessPoint, aPosition );
   261                    _L("aAccessPoint = %d, aPosition = %d"), aAccessPoint, aPosition );
   255 
   262 
   256     TFileName filename;
   263     TFileName filename;
   392 
   399 
   393 //  ----------------------------------------------------------------------------
   400 //  ----------------------------------------------------------------------------
   394 //    Initializes a clip for playback from a 64-bit file handle
   401 //    Initializes a clip for playback from a 64-bit file handle
   395 //  ----------------------------------------------------------------------------
   402 //  ----------------------------------------------------------------------------
   396 //
   403 //
   397 void CMPXVideoHelixPlayback::Initialise64L( RFile64& aSong, TInt aPosition ) 
   404 void CMPXVideoHelixPlayback::Initialise64L( RFile64& aSong, TInt aPosition )
   398 {
   405 {
   399     MPX_ENTER_EXIT(_L("CMPXVideoHelixPlayback::Initialise64L( RFile64 )"),
   406     MPX_ENTER_EXIT(_L("CMPXVideoHelixPlayback::Initialise64L( RFile64 )"),
   400                    _L("aPosition %d"), aPosition );
   407                    _L("aPosition %d"), aPosition );
   401     TFileName filename;
   408     TFileName filename;
   402     aSong.FullName( filename );
   409     aSong.FullName( filename );
   403 
   410 
   404     iVideoPlaybackCtlr->OpenFile64L( filename, aSong, aPosition );   
   411     iVideoPlaybackCtlr->OpenFile64L( filename, aSong, aPosition );
   405 }
   412 }
   406 
   413 
   407 //  ----------------------------------------------------------------------------
   414 //  ----------------------------------------------------------------------------
   408 //    Initializes a clip for playback from a 64-bit file handle
   415 //    Initializes a clip for playback from a 64-bit file handle
   409 //  ----------------------------------------------------------------------------
   416 //  ----------------------------------------------------------------------------
   410 //
   417 //
   411 void CMPXVideoHelixPlayback::InitStreaming64L( RFile64& aFile, TInt aAccessPoint, TInt aPosition ) 
   418 void CMPXVideoHelixPlayback::InitStreaming64L( RFile64& aFile, TInt aAccessPoint, TInt aPosition )
   412 {
   419 {
   413     MPX_ENTER_EXIT(_L("CMPXVideoHelixPlayback::InitStreaming64L( RFile64 )"),
   420     MPX_ENTER_EXIT(_L("CMPXVideoHelixPlayback::InitStreaming64L( RFile64 )"),
   414                    _L("aAccessPoint = %d, aPosition %d"), aAccessPoint, aPosition );
   421                    _L("aAccessPoint = %d, aPosition %d"), aAccessPoint, aPosition );
   415 
   422 
   416     TFileName filename;
   423     TFileName filename;
   417     aFile.FullName( filename );
   424     aFile.FullName( filename );
   418 
   425 
   419     iVideoPlaybackCtlr->OpenFile64L( filename, aFile, aPosition, aAccessPoint ); 
   426     iVideoPlaybackCtlr->OpenFile64L( filename, aFile, aPosition, aAccessPoint );
   420 }
   427 }
   421 
   428 
   422 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   429 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   423 
   430 
   424 // End of file
   431 // End of file