videoplayback/videohelix/tsrc/ut_videohelixtest/src/videohelixtestbody.cpp
changeset 39 f6d44a0cd476
parent 38 ff53afa8ad05
child 44 518105d52e45
--- a/videoplayback/videohelix/tsrc/ut_videohelixtest/src/videohelixtestbody.cpp	Fri May 14 15:14:51 2010 +0300
+++ b/videoplayback/videohelix/tsrc/ut_videohelixtest/src/videohelixtestbody.cpp	Fri May 28 09:45:19 2010 +0300
@@ -15,7 +15,7 @@
 *
 */
 
-// Version : %version: 23 %
+// Version : %version: e003sa33#24.1.1 %
 
 
 // [INCLUDE FILES] - do not remove
@@ -42,6 +42,7 @@
 #include "mpxmediavideodefs.h"
 #include "mpxvideo_debug.h"
 #include "mpxvideoplayerutility_stub.h"
+#include "mpxhelixplaybackplugindefs.h"
 
 #ifdef __WINSCW__
     _LIT( KVideoTestPath, "c:\\data\\Videos\\" );
@@ -118,7 +119,10 @@
 
         ENTRY ("InitializeWithPositionL", CVHPPTestClass::InitializeWithPositionL),
         ENTRY ("InitializeLinkWithPositionL", CVHPPTestClass::InitializeLinkWithPositionL),
-        ENTRY ("InitializeHandleWithPositionL", CVHPPTestClass::InitializeHandleWithPositionL)
+        ENTRY ("InitializeHandleWithPositionL", CVHPPTestClass::InitializeHandleWithPositionL),
+        ENTRY ( "InitializeStreamingWithSdpFileHandleL", 
+        		CVHPPTestClass::InitializeStreamingWithSdpFileHandleL ),
+        ENTRY ( "RetrieveFileNameAndModeL", CVHPPTestClass::RetrieveFileNameAndModeL )        
 
         //
         //  ADD NEW ENTRIES HERE
@@ -1142,6 +1146,10 @@
     MPX_ENTER_EXIT(_L("CVHPPTestClass::ConnectToDownloadL()"));
     iLog->Log(_L("CVHPPTestClass::ConnectToDownloadL()"));
 
+    TInt err = KErrNone;
+    
+#ifdef USE_S60_DOWNLOAD_MANAGER       
+    
     iDlMgrTester = CDlMgrTestClass::NewL();
     iDlMgrTester->AddStifObserver( this );
 
@@ -1152,7 +1160,7 @@
     //
     //   Read in the download id and filename
     //
-    TInt err = aItem.GetNextInt( dlId );
+    err = aItem.GetNextInt( dlId );
 
     if ( err == KErrNone )
     {
@@ -1188,7 +1196,17 @@
             CleanupStack::PopAndDestroy( cmd );
         }
     }
-
+    
+#else // USE_S60_DOWNLOAD_MANAGER    
+     
+	// suppress build warning
+    MPX_DEBUG(_L("CVHPPTestClass::ConnectToDownloadL() : parsing type = %d"), aItem.ParsingType()); 
+	
+	// Signal TestScripter to continue from waittestclass
+    Signal();
+	
+#endif // USE_S60_DOWNLOAD_MANAGER
+    
     return err;
 }
 
@@ -1202,6 +1220,8 @@
     MPX_ENTER_EXIT(_L("CVHPPTestClass::SendPdlCustomCommandL"),
                    _L("aCustomCmd = %d"), aCustomCmd );
 
+#ifdef USE_S60_DOWNLOAD_MANAGER     
+
     CMPXCommand* cmd = CMPXCommand::NewL();
     CleanupStack::PushL( cmd );
 
@@ -1212,6 +1232,14 @@
     iPlaybackPlugin->CommandL( *cmd );
 
     CleanupStack::PopAndDestroy( cmd );
+	
+#else // USE_S60_DOWNLOAD_MANAGER     
+	
+	// Signal TestScripter to continue from waittestclass
+    Signal();
+	
+#endif // USE_S60_DOWNLOAD_MANAGER
+
 }
 
 // -----------------------------------------------------------------------------
@@ -1224,6 +1252,8 @@
     MPX_ENTER_EXIT(_L("CVHPPTestClass::PauseDownloadL()"));
     iLog->Log(_L("CVHPPTestClass::PauseDownloadL()"));
 
+#ifdef USE_S60_DOWNLOAD_MANAGER   
+    
     TCallbackEvent* event = new TCallbackEvent;
 
     event->iEvent = EPDownloadStateChanged;
@@ -1233,7 +1263,14 @@
     AddExpectedEvent( event );
 
     iDlMgrTester->PauseDownload();
-
+    
+#else // USE_S60_DOWNLOAD_MANAGER    
+	
+	// Signal TestScripter to continue from waittestclass
+    Signal();
+	
+#endif // USE_S60_DOWNLOAD_MANAGER 
+    
     return KErrNone;
 }
 
@@ -1247,9 +1284,13 @@
     MPX_ENTER_EXIT(_L("CVHPPTestClass::ResumeDownloadL()"));
     iLog->Log(_L("CVHPPTestClass::ResumeDownloadL()"));
 
+    TInt err = KErrNone;
+    
+#ifdef USE_S60_DOWNLOAD_MANAGER 
+    
     TInt dlSize;
 
-    TInt err = aItem.GetNextInt( dlSize );
+    err = aItem.GetNextInt( dlSize );
 
     if ( err == KErrNone )
     {
@@ -1273,7 +1314,17 @@
 
         iDlMgrTester->ResumeDownload();
     }
-
+    
+#else // USE_S60_DOWNLOAD_MANAGER    
+     
+	// suppress build warning
+    MPX_DEBUG(_L("CVHPPTestClass::ResumeDownloadL() : parsing type = %d"), aItem.ParsingType()); 
+	
+	// Signal TestScripter to continue from waittestclass
+    Signal();
+	
+#endif // USE_S60_DOWNLOAD_MANAGER 
+    
     return err;
 }
 
@@ -1287,6 +1338,8 @@
     MPX_ENTER_EXIT(_L("CVHPPTestClass::CancelDownloadL()"));
     iLog->Log(_L("CVHPPTestClass::CancelDownloadL()"));
 
+#ifdef USE_S60_DOWNLOAD_MANAGER 
+    
     TCallbackEvent* event = new TCallbackEvent;
 
     event->iEvent = EPDownloadStateChanged;
@@ -1297,6 +1350,13 @@
 
     iDlMgrTester->CancelDownload();
 
+#else // USE_S60_DOWNLOAD_MANAGER    
+	
+	// Signal TestScripter to continue from waittestclass
+    Signal();
+	
+#endif // USE_S60_DOWNLOAD_MANAGER 
+    
     return KErrNone;
 }
 
@@ -1310,6 +1370,10 @@
     MPX_ENTER_EXIT(_L("CVHPPTestClass::RetrievePdlStatusL()"));
     iLog->Log(_L("CVHPPTestClass::RetrievePdlStatusL()"));
 
+    TInt err = KErrNone;
+    
+#ifdef USE_S60_DOWNLOAD_MANAGER 
+    
     TInt pdlState;
     TInt expectedPdlState;
     TInt downloadedBytes;
@@ -1320,7 +1384,7 @@
     //
     //   Read in the expected download data
     //
-    TInt err = aItem.GetNextInt( expectedPdlState );
+    err = aItem.GetNextInt( expectedPdlState );
 
     if ( err == KErrNone )
     {
@@ -1368,6 +1432,16 @@
         CleanupStack::PopAndDestroy( cmd );
     }
 
+#else // USE_S60_DOWNLOAD_MANAGER 
+     
+	// suppress build warning
+    MPX_DEBUG(_L("CVHPPTestClass::RetrievePdlStatusL() : parsing type = %d"), aItem.ParsingType()); 
+	
+	// Signal TestScripter to continue from waittestclass
+    Signal();
+	
+#endif // USE_S60_DOWNLOAD_MANAGER 
+    
     return err;
 }
 
@@ -1548,6 +1622,8 @@
 void
 CVHPPTestClass::ProcessEvent( TCallbackEvent* aCallback )
 {
+    MPX_ENTER_EXIT(_L("CVHPPTestClass::ProcessEvent"));
+    
     if ( iExpectedCallbackArray->Count() > 0 )
     {
         TCallbackEvent* expectedCallback = (*iExpectedCallbackArray)[0];
@@ -2352,4 +2428,164 @@
     return err;
 }
 
+TInt
+CVHPPTestClass::InitializeStreamingWithSdpFileHandleL( CStifItemParser& aItem )
+{
+    MPX_ENTER_EXIT(_L("CVHPPTestClass::InitializeStreamingWithSdpFileHandleL()"));
+    iLog->Log(_L("CVHPPTestClass::InitializeStreamingWithSdpFileHandleL()"));
+
+    TInt duration;
+    TInt volumeSteps;
+    TInt fileHandle32;
+    
+    TInt err = aItem.GetNextInt( fileHandle32 );
+    
+    if ( err == KErrNone )
+    {        
+    
+#ifndef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
+        //
+        // set RFile as default if the 64-bit flag is not defined
+        //
+        fileHandle32 = ETrue;
+#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
+        
+        err = aItem.GetNextInt( duration );
+    
+        if ( err == KErrNone )
+        {
+            //
+            //  We will always get an Init Complete message out
+            //
+            TCallbackEvent* event = new TCallbackEvent;
+    
+            event->iEvent = EPInitialised;
+            event->iData  = duration;
+            event->iError = KErrNone;
+    
+            AddExpectedEvent( event );
+    
+            // 
+            // read number of volume steps
+            //
+            err = aItem.GetNextInt( volumeSteps );
+            
+            if ( err == KErrNone )
+            {        
+                //
+                // set volume steps
+                //
+                SetVolumeSteps( volumeSteps );
+               
+                TBuf<120> fullPath;
+                err = ReadFileInitializationParameters( aItem, fullPath );
+
+                if ( err == KErrNone )
+                {
+					PreparePluginL();
+					
+					MPX_DEBUG( _L("Initialize the Plugin:  link = %S"), &fullPath );
+					iLog->Log( _L("Initialize the Plugin:  link = %S"), &fullPath );
+					
+					//
+					//  Extract the streaming link from the ram file and
+					//  Initalize the Plugin with the file handle and an access point
+					//
+					RFs fs;
+					TInt error = fs.Connect();
+					
+					if ( fileHandle32 )
+					{
+						RFile file;
+						error = file.Open( fs, fullPath, EFileRead | EFileShareAny );
+						
+						MPX_DEBUG( _L("Initialize the Plugin:  file open error = %d"),
+								error );   
+						
+						User::LeaveIfError( error );
+				  
+						iPlaybackPlugin->InitStreamingL( file, 11 );
+						file.Close();
+					}
+    #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
+					else
+					{
+						RFile64 file64;
+						error = file64.Open( fs, fullPath, EFileRead | EFileShareAny  );
+						
+						MPX_DEBUG( _L("Initialize the Plugin:  file open error = %d"),
+								error );
+						
+						User::LeaveIfError( error );
+						
+						iPlaybackPlugin->InitStreaming64L( file64, 11 );
+						file64.Close();
+					}
+#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
+					
+					fs.Close();
+                }
+            } 
+        } 
+    } 
+    return err;
+}
+
+TInt
+CVHPPTestClass::RetrieveFileNameAndModeL( CStifItemParser& aItem )
+{
+    MPX_ENTER_EXIT( _L("CVHPPTestClass::RetrieveFileNameAndModeL()") );
+    iLog->Log( _L("CVHPPTestClass::RetrieveFileNameAndModeL()") );
+
+    TBuf<120>	fullPath;
+    TPtrC		fileName;
+    TInt		err;
+    
+    err = aItem.GetNextString( fileName );
+
+    if ( err == KErrNone )
+    {
+        //
+        //  Build the full path to the file
+        //
+        fullPath.Append( KVideoTestPath );
+        fullPath.Append( fileName );
+        
+        TInt mode;
+        err = aItem.GetNextInt( mode);
+        
+        if ( err == KErrNone )
+        {
+ 			CMPXCommand* cmd = CMPXCommand::NewL();
+			CleanupStack::PushL( cmd );
+	
+			cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
+			cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId,
+										 KMPXMediaIdVideoPlayback );
+			cmd->SetTObjectValueL<TInt>( KMPXMediaVideoPlaybackCommand, EPbCmdInitView );
+			
+			iPlaybackPlugin->CommandL( *cmd );
+			
+			TPtrC clipName( cmd->ValueText( KMPXMediaVideoPlaybackFileName ) );
+			TMPXVideoMode  playbackMode = (TMPXVideoMode) cmd->ValueTObjectL<TInt>( KMPXMediaVideoMode );
+	
+			MPX_DEBUG( _L("    Expected Data:  filename = %S, playbackmode= %d" ),
+				 &fullPath, mode );
+			
+			MPX_DEBUG( _L("    Retrieved Data: filename = %S, playbackmode= %d"),
+				 &clipName, playbackMode );
+			
+			if ( fullPath.Compare( clipName) != 0 || mode != playbackMode )
+			{
+			    err = KErrGeneral;
+				MPX_DEBUG( _L("    err = %d"), err );
+			}
+			
+			CleanupStack::PopAndDestroy( cmd );
+        }
+    }
+
+    return err;
+}
+
 //  EOF