videoplayerapp/videoplayerengine/src/mpxvideoplaybackwrapper.cpp
changeset 17 69946d1824c4
parent 15 cf5481c2bc0b
child 28 c48470be1ba7
equal deleted inserted replaced
15:cf5481c2bc0b 17:69946d1824c4
    13 *
    13 *
    14 * Description:  Implimentation of QMpxVideoPlaybackWrapper
    14 * Description:  Implimentation of QMpxVideoPlaybackWrapper
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 // Version : %version:  3 %
    18 // Version : %version:  4 %
    19 
    19 
    20 
    20 
    21 #include "mpxvideo_debug.h"
    21 #include "mpxvideo_debug.h"
    22 #include "mpxvideoplaybackwrapper.h"
    22 #include "mpxvideoplaybackwrapper.h"
    23 #include "mpxvideoplayerappuiengine.h"
    23 #include "mpxvideoplayerappuiengine.h"
    65 //   QMpxVideoPlaybackWrapper::playMedia()
    65 //   QMpxVideoPlaybackWrapper::playMedia()
    66 // -------------------------------------------------------------------------------------------------
    66 // -------------------------------------------------------------------------------------------------
    67 //
    67 //
    68 int QMpxVideoPlaybackWrapper::playMedia( QString aFileName )
    68 int QMpxVideoPlaybackWrapper::playMedia( QString aFileName )
    69 {
    69 {
    70     MPX_ENTER_EXIT(_L("QMpxVideoPlaybackWrapper::playMedia"));
    70     MPX_ENTER_EXIT(_L("QMpxVideoPlaybackWrapper::playMedia"));   
       
    71     
       
    72     TBuf<KMaxFileName> filename( aFileName.utf16() );
       
    73     int error = openFileWithNativePath( filename );
    71 
    74 
    72     TBuf<KMaxFileName> filename( aFileName.utf16() );
    75     MPX_DEBUG(_L("QMpxVideoPlaybackWrapper::playMedia err = %d"), error);
    73     TRAPD( error, mUiEngine->OpenFileL( filename ) );
    76 
       
    77     return error;
       
    78 }
       
    79 
       
    80 // -------------------------------------------------------------------------------------------------
       
    81 //   QMpxVideoPlaybackWrapper::playMedia()
       
    82 // -------------------------------------------------------------------------------------------------
       
    83 //
       
    84 int QMpxVideoPlaybackWrapper::playMedia( RFile aFile )
       
    85 {
       
    86     MPX_ENTER_EXIT(_L("QMpxVideoPlaybackWrapper::playMedia"));   
       
    87     
       
    88     TRAPD( error, mUiEngine->OpenFileL( aFile ) );
    74 
    89 
    75     MPX_DEBUG(_L("QMpxVideoPlaybackWrapper::playMedia err = %d"), error);
    90     MPX_DEBUG(_L("QMpxVideoPlaybackWrapper::playMedia err = %d"), error);
    76 
    91 
    77     return error;
    92     return error;
    78 }
    93 }
    97     MPX_ENTER_EXIT(_L("QMpxVideoPlaybackWrapper::postInit()"));
   112     MPX_ENTER_EXIT(_L("QMpxVideoPlaybackWrapper::postInit()"));
    98     
   113     
    99     TRAP_IGNORE( mUiEngine->LateInitL() );
   114     TRAP_IGNORE( mUiEngine->LateInitL() );
   100 }
   115 }
   101 
   116 
       
   117 // -------------------------------------------------------------------------------------------------
       
   118 //   QMpxVideoPlaybackWrapper::openFileWithNativePath()
       
   119 // -------------------------------------------------------------------------------------------------
       
   120 //
       
   121 int QMpxVideoPlaybackWrapper::openFileWithNativePath(const TDesC& aFileName)
       
   122 {
       
   123     MPX_DEBUG(_L("QMpxVideoPlaybackWrapper::openFileWithNativePath()"));    
       
   124     
       
   125     int err = KErrNone;
       
   126 
       
   127     int fwdSlashPos = aFileName.LocateF('/');
       
   128 
       
   129     if( fwdSlashPos == KErrNotFound )
       
   130     {
       
   131         // no fwd slashes found => filepath is already in 
       
   132         // preferred format eg. c:\\data\\videos\\test.3gp
       
   133         //
       
   134         TRAP( err, mUiEngine->OpenFileL( aFileName ) );        
       
   135     }
       
   136     else
       
   137     {        
       
   138         HBufC* fileName = NULL;
       
   139 
       
   140         TRAP( err,  fileName = aFileName.AllocL() );
       
   141 
       
   142         if ( err == KErrNone )
       
   143         {
       
   144             int count( fileName->Des().Length() );
       
   145 
       
   146             for ( int j = fwdSlashPos ; j < count; ++j )
       
   147             {
       
   148                 if ( fileName->Des()[j]== '/' )
       
   149                 {
       
   150                     fileName->Des()[j]='\\';
       
   151                 }
       
   152             }
       
   153             
       
   154         }
       
   155 
       
   156         TRAP( err, mUiEngine->OpenFileL( fileName->Des() ) );
       
   157         
       
   158         if ( fileName )
       
   159         {
       
   160             delete fileName;
       
   161             fileName = NULL;
       
   162         }        
       
   163     }
       
   164     
       
   165     return err;
       
   166 }
       
   167 
       
   168 
   102 // End of File
   169 // End of File