Revision: 201019 RCL_3 PDK_3.0.0
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 25 May 2010 12:38:39 +0300
branchRCL_3
changeset 19 95754dcd27ad
parent 18 0da2e08216b6
child 21 ce86b6d44a6d
Revision: 201019 Kit: 2010121
mmsharing/Conf/multimediasharing.confml
mmsharing/mmshengine/inc/musengclipsession.h
mmsharing/mmshengine/inc/musengclipsessionobserver.h
mmsharing/mmshengine/src/musengclipsession.cpp
mmsharing/mmshengine/src/musengmcesession.cpp
mmsharing/mmshengine/tsrc/ut_engine/inc/musengstubs.h
mmsharing/mmshengine/tsrc/ut_engine/inc/ut_musengclipsession.h
mmsharing/mmshengine/tsrc/ut_engine/src/musengstubs.cpp
mmsharing/mmshengine/tsrc/ut_engine/src/ut_musengclipsession.cpp
mmsharing/mmshui/inc/musuiclipsharingcontroller.h
mmsharing/mmshui/inc/musuiclipsharingobserver.h
mmsharing/mmshui/inc/musuiclipsharingview.h
mmsharing/mmshui/inc/musuilivesharingcontroller.h
mmsharing/mmshui/inc/musuisendcontroller.h
mmsharing/mmshui/src/musuiclipsharingcontroller.cpp
mmsharing/mmshui/src/musuiclipsharingview.cpp
mmsharing/mmshui/src/musuilivesharingcontroller.cpp
mmsharing/mmshui/src/musuilivesharingview.cpp
mmsharing/mmshui/src/musuinavimediadecorator.cpp
mmsharing/mmshui/src/musuireceiveview.cpp
mmsharing/mmshui/src/musuisendcontroller.cpp
Binary file mmsharing/Conf/multimediasharing.confml has changed
--- a/mmsharing/mmshengine/inc/musengclipsession.h	Tue May 11 16:10:30 2010 +0300
+++ b/mmsharing/mmshengine/inc/musengclipsession.h	Tue May 25 12:38:39 2010 +0300
@@ -199,6 +199,8 @@
         void AddVideoCodecL( CMceVideoStream& aVideoStream, TBool aIgnoreNegotiated = EFalse );
         
         TBool HasClipEnded();
+        
+        TBool IsRewindFromEnd();
 
         /**
         * Returns current position as microseconds.
--- a/mmsharing/mmshengine/inc/musengclipsessionobserver.h	Tue May 11 16:10:30 2010 +0300
+++ b/mmsharing/mmshengine/inc/musengclipsessionobserver.h	Tue May 25 12:38:39 2010 +0300
@@ -70,6 +70,10 @@
 	    */
         virtual void TranscodingFailed() = 0;
         
+        /**
+	    * Handle specific case that rewinding from end of file.
+	    */
+        virtual void RewindFromEndL() = 0;
     };
 
 #endif
--- a/mmsharing/mmshengine/src/musengclipsession.cpp	Tue May 11 16:10:30 2010 +0300
+++ b/mmsharing/mmshengine/src/musengclipsession.cpp	Tue May 25 12:38:39 2010 +0300
@@ -614,6 +614,11 @@
         
         iClipSessionObserver.EndOfClip();
         }
+    else if ( IsRewindFromEnd() )
+    	{
+        TRAP_IGNORE( iClipSessionObserver.RewindFromEndL() );
+    	}
+    
     else
         {
         // Cannot handle, forward to the ancestor class
@@ -1058,5 +1063,60 @@
     CleanupStack::PopAndDestroy(); // fs
     }
 
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+TBool CMusEngClipSession::IsRewindFromEnd()
+    {
+    MUS_LOG( "mus: [ENGINE] -> CMusEngClipSession::IsRewindFromEnd()" )
+
+    TBool isRewindFromEnd = EFalse;
+
+    if ( iSession )
+        {
+        
+        CMceVideoStream* videoOut = NULL;
+        
+        TRAPD( error, 
+               videoOut = MusEngMceUtils::GetVideoOutStreamL( *iSession ) );
+        if( error != KErrNone ) 
+            {
+            MUS_LOG1( "mus: [ENGINE]     Error in GetVideoOutStreamL #%d", error )
+            return isRewindFromEnd;
+            }
+
+        CMceFileSource* filesource = NULL;
+        TRAP( error, filesource = MusEngMceUtils::GetFileSourceL( *iSession ) )
+
+        if ( error == KErrNone )
+            {
+            TTimeIntervalMicroSeconds position;
+            TTimeIntervalMicroSeconds duration;
+            TRAP( error, position = filesource->PositionL() );
+            TRAPD( error1, duration = filesource->DurationL() );
+            if ( error != KErrNone || error1 != KErrNone )
+                {
+                return isRewindFromEnd;
+                }
+                
+            MUS_LOG2( "mus: [ENGINE]    position = %Ld, duration = %Ld", 
+                        position.Int64(), 
+                        duration.Int64() )
+                        
+            TRAP( error, isRewindFromEnd = 
+                        ( position.Int64() != 0 && 
+                          !filesource->IsEnabled() && 
+                          videoOut->State() == CMceMediaStream::EDisabled ) )
+            if(  isRewindFromEnd )
+                {
+                MUS_LOG( "mus: [ENGINE]     Rewind from end of clip" )
+                }
+            }
+        }
+
+    MUS_LOG( "mus: [ENGINE] <- CMusEngClipSession::IsRewindFromEnd()" )
+    return isRewindFromEnd;
+    }
 // End of file
 
--- a/mmsharing/mmshengine/src/musengmcesession.cpp	Tue May 11 16:10:30 2010 +0300
+++ b/mmsharing/mmshengine/src/musengmcesession.cpp	Tue May 25 12:38:39 2010 +0300
@@ -772,7 +772,7 @@
             }
         case CMceMediaStream::EIdle: // Stream is not receiving RTP
             {
-            // NOP
+            iSessionObserver.StreamIdle();
             break;
             }
         case CMceMediaStream::EStreaming: // Stream is streaming
--- a/mmsharing/mmshengine/tsrc/ut_engine/inc/musengstubs.h	Tue May 11 16:10:30 2010 +0300
+++ b/mmsharing/mmshengine/tsrc/ut_engine/inc/musengstubs.h	Tue May 25 12:38:39 2010 +0300
@@ -129,6 +129,8 @@
         void TranscodingCompletedFinalize();
 
         void TranscodingFailed();
+        
+        void RewindFromEndL();
 
 
         // From MMusEngReceiveSessionObserver    
@@ -190,6 +192,7 @@
     	TBool iDiskFullCalled;
     	
     	TBool iEndOfClipCalled;
+    	TBool iRewindFromEnd;
     	TBool iTranscodingNeededCalled;
     	TBool iTranscodingCompletedInitCalled;
     	TBool iTranscodingCompletedFinalizeCalled;
--- a/mmsharing/mmshengine/tsrc/ut_engine/inc/ut_musengclipsession.h	Tue May 11 16:10:30 2010 +0300
+++ b/mmsharing/mmshengine/tsrc/ut_engine/inc/ut_musengclipsession.h	Tue May 25 12:38:39 2010 +0300
@@ -89,6 +89,7 @@
         void UT_ConstructAudioStructureLL();
         void UT_ConstructAudioStructureL_OperatorVariantL();
         void UT_EstablishSessionLL();
+        void UT_IsRewindFromEndL();
         
     private:    // Data
 
--- a/mmsharing/mmshengine/tsrc/ut_engine/src/musengstubs.cpp	Tue May 11 16:10:30 2010 +0300
+++ b/mmsharing/mmshengine/tsrc/ut_engine/src/musengstubs.cpp	Tue May 25 12:38:39 2010 +0300
@@ -284,7 +284,15 @@
     {
     iEndOfClipCalled = ETrue;
     }
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
 
+void CMusEngObserverStub::RewindFromEndL()
+	{
+	iRewindFromEnd= ETrue;
+	}
 
 // -----------------------------------------------------------------------------
 // 
@@ -435,6 +443,7 @@
         	 !iSessionRequestCancelledCalled &&
         	 !iDiskFullCalled &&
         	 !iEndOfClipCalled &&
+        	 !iRewindFromEnd &&
         	 !iTranscodingNeededCalled &&
         	 !iTranscodingCompletedInitCalled &&
         	 !iTranscodingCompletedFinalizeCalled &&
@@ -478,6 +487,7 @@
 	iSessionRequestCancelledCalled = EFalse;
 	iDiskFullCalled = EFalse;
 	iEndOfClipCalled = EFalse;
+	iRewindFromEnd = EFalse;
 	iTranscodingNeededCalled = EFalse;
     iTranscodingCompletedInitCalled = EFalse;
     iTranscodingCompletedFinalizeCalled = EFalse;
--- a/mmsharing/mmshengine/tsrc/ut_engine/src/ut_musengclipsession.cpp	Tue May 11 16:10:30 2010 +0300
+++ b/mmsharing/mmshengine/tsrc/ut_engine/src/ut_musengclipsession.cpp	Tue May 25 12:38:39 2010 +0300
@@ -1542,6 +1542,59 @@
           
     }
 
+void UT_CMusEngClipSession::UT_IsRewindFromEndL()
+    {
+    // Try before establishing the session
+    EUNIT_ASSERT( !iClipSession->IsRewindFromEnd() )
+    
+    // Try with session, but without video out stream 
+    
+    CSIPProfile* profile = iClipSession->iSipProfileHandler->Profile();
+  
+    iClipSession->iSession = CMceOutSession::NewL( 
+                                    *(iClipSession->iManager),
+                                    *profile,
+                                    KTestRecipientSipUri8() ); 
+    
+    EUNIT_ASSERT( !iClipSession->IsRewindFromEnd() )
+    
+    // Try with video out stream without source...
+    CMceVideoStream* videoOut = CMceVideoStream::NewLC();
+    
+    videoOut->AddSinkL( CMceRtpSink::NewLC() );
+    CleanupStack::Pop();
+     
+    iClipSession->iSession->AddStreamL( videoOut );
+    CleanupStack::Pop( videoOut );
+    
+    EUNIT_ASSERT( !iClipSession->IsRewindFromEnd() )
+    
+    // And with enabled source and stream     
+    videoOut->SetSourceL( CMceFileSource::NewLC( *iClipSession->iManager,
+                                                 iClipSession->iFileName ) );
+    CleanupStack::Pop();
+    
+    EUNIT_ASSERT( !iClipSession->IsRewindFromEnd() )
+    
+    // try with different position and duration
+    (static_cast<CMceFileSource*> (videoOut->Source()))->iPosition = 90;
+    (static_cast<CMceFileSource*> (videoOut->Source()))->iDuration = 111;
+    EUNIT_ASSERT( !iClipSession->IsRewindFromEnd() )
+    
+    // Disapling source
+    (static_cast<CMceFileSource*> (videoOut->Source()))->DisableL();
+    EUNIT_ASSERT( !iClipSession->IsRewindFromEnd() )
+
+    // Disapling stream
+    videoOut->iState = CMceMediaStream::EDisabled;
+    EUNIT_ASSERT( iClipSession->IsRewindFromEnd() )
+       
+    // and finaly try with "real" end of clip 
+    (static_cast<CMceFileSource*> (videoOut->Source()))->iPosition = 0;
+    (static_cast<CMceFileSource*> (videoOut->Source()))->iDuration = 111;
+    
+    EUNIT_ASSERT( !iClipSession->IsRewindFromEnd() )
+    }
 
 //  TEST TABLE
 
@@ -1711,7 +1764,13 @@
     "FUNCTIONALITY",
     SetupL, UT_EstablishSessionLL, Teardown)    
 
-        
+EUNIT_TEST(
+    "IsRewindFromEnd - test ",
+    "CMusEngClipSession",
+    "IsRewindFromEnd",
+    "FUNCTIONALITY",
+    SetupL, UT_IsRewindFromEndL, Teardown)
+    
 EUNIT_END_TEST_TABLE
 
 //  END OF FILE
--- a/mmsharing/mmshui/inc/musuiclipsharingcontroller.h	Tue May 11 16:10:30 2010 +0300
+++ b/mmsharing/mmshui/inc/musuiclipsharingcontroller.h	Tue May 25 12:38:39 2010 +0300
@@ -137,6 +137,8 @@
     
     virtual void TranscodingFailed();
     
+    virtual void RewindFromEndL();
+    
 
 public: // from MMusEngOutSessionObserver
 
--- a/mmsharing/mmshui/inc/musuiclipsharingobserver.h	Tue May 11 16:10:30 2010 +0300
+++ b/mmsharing/mmshui/inc/musuiclipsharingobserver.h	Tue May 25 12:38:39 2010 +0300
@@ -46,6 +46,8 @@
     virtual void SetPositionValueL( TInt aPositionValue ) = 0;
 
     virtual void SetDurationVisible() = 0;
+        
+    virtual void InvalidVideoFrame( TBool aInvalid = EFalse ) = 0;
 
     };
 
--- a/mmsharing/mmshui/inc/musuiclipsharingview.h	Tue May 11 16:10:30 2010 +0300
+++ b/mmsharing/mmshui/inc/musuiclipsharingview.h	Tue May 25 12:38:39 2010 +0300
@@ -102,8 +102,9 @@
     virtual void ReplaceToolbarCommand( TInt aOldCommand, 
                                         TInt aNewCommand,
                                         TBool aSetNewCommandFocused );
-
-
+    
+    virtual void InvalidVideoFrame( TBool aInvalid = EFalse );
+    
 public: // new functions
 
     void RefreshView( TBool aLayoutChange = EFalse );
--- a/mmsharing/mmshui/inc/musuilivesharingcontroller.h	Tue May 11 16:10:30 2010 +0300
+++ b/mmsharing/mmshui/inc/musuilivesharingcontroller.h	Tue May 25 12:38:39 2010 +0300
@@ -116,6 +116,11 @@
     * 
     */
     void RefreshCameraOrientationL();
+    
+    /**
+     * Determines whether Session established or not
+     */
+    TBool IsSessionEstablished();
 
 
 private:	// new functions:
@@ -173,6 +178,8 @@
     TBool iBrightnessSelected;
     
     TBool iDiskFull;
+    
+    TBool iSessionEstablished;
 	
     };
 
--- a/mmsharing/mmshui/inc/musuisendcontroller.h	Tue May 11 16:10:30 2010 +0300
+++ b/mmsharing/mmshui/inc/musuisendcontroller.h	Tue May 25 12:38:39 2010 +0300
@@ -184,6 +184,7 @@
 
     void DeleteVideoL();
     
+	void DeleteFileL();
     
 protected:  // Data
 
--- a/mmsharing/mmshui/src/musuiclipsharingcontroller.cpp	Tue May 11 16:10:30 2010 +0300
+++ b/mmsharing/mmshui/src/musuiclipsharingcontroller.cpp	Tue May 25 12:38:39 2010 +0300
@@ -1024,6 +1024,7 @@
 void CMusUiClipSharingController::StreamIdle()
     {
     MUS_LOG( "mus: [MUSUI ]  -> CMusUiClipSharingController::StreamIdle" );
+    iClipObserver.InvalidVideoFrame( ETrue );
     MUS_LOG( "mus: [MUSUI ]  <- CMusUiClipSharingController::StreamIdle" );
     }
 
@@ -1035,6 +1036,7 @@
 void CMusUiClipSharingController::StreamStreaming()
     {
     MUS_LOG( "mus: [MUSUI ]  -> CMusUiClipSharingController::StreamStreaming" );
+    iClipObserver.InvalidVideoFrame( EFalse );
     TRAPD( error, StreamStreamingL() );
     if ( error != KErrNone )
         {
@@ -1189,5 +1191,19 @@
     }
     
 
+// -----------------------------------------------------------------------------
+// CMusUiClipSharingController::RewindFromEndL()
+// -----------------------------------------------------------------------------
+//    
+void CMusUiClipSharingController::RewindFromEndL()
+	{
+	MUS_LOG( "mus: [MUSUI ]  -> CMusUiClipSharingController::RewindFromEndL" );
+    PauseL();
+    iEventObserver.ShowNaviPaneIconL( EMusUiNaviIconPause );
+    iSharingObserver.ReplaceToolbarCommand( EMusuiCmdToolbarPause,
+                                            EMusuiCmdToolbarUnPause,
+                                            ETrue );
+    MUS_LOG( "mus: [MUSUI ]  <- CMusUiClipSharingController::RewindFromEndL" );
+	}
 // End of file
 
--- a/mmsharing/mmshui/src/musuiclipsharingview.cpp	Tue May 11 16:10:30 2010 +0300
+++ b/mmsharing/mmshui/src/musuiclipsharingview.cpp	Tue May 25 12:38:39 2010 +0300
@@ -467,7 +467,7 @@
 //
 // -----------------------------------------------------------------------------
 //
-void CMusUiClipSharingView::RefreshView( TBool aLayoutChange )
+void CMusUiClipSharingView::RefreshView( TBool /*aLayoutChange*/ )
     {
     MUS_LOG( "mus: [MUSUI ]  -> CMusUiClipSharingView::RefreshView" );
     
@@ -649,5 +649,21 @@
     MUS_LOG( "mus: [MUSUI ]  <- CMusUiClipSharingView::DoDeactivate" );
     }
 
+// -----------------------------------------------------------------------------
+// When Mmc is removed, dimmed the pause icon on toolbar
+// -----------------------------------------------------------------------------
+//
+void CMusUiClipSharingView::InvalidVideoFrame( TBool aInvalid )
+	{
+	MUS_LOG( "mus: [MUSUI ]  -> CMusUiClipSharingView::InvalidVideoFrame" );
+	Toolbar()->SetItemDimmed( iPauseSelected ?
+                                EMusuiCmdToolbarUnPause :
+                                EMusuiCmdToolbarPause,
+	                          aInvalid ?
+			                    ETrue :
+								EFalse,
+	                          ETrue ); 
+	MUS_LOG( "mus: [MUSUI ]  <- CMusUiClipSharingView::InvalidVideoFrame" );
+	}
 
 // end of file
--- a/mmsharing/mmshui/src/musuilivesharingcontroller.cpp	Tue May 11 16:10:30 2010 +0300
+++ b/mmsharing/mmshui/src/musuilivesharingcontroller.cpp	Tue May 25 12:38:39 2010 +0300
@@ -780,6 +780,8 @@
     {
     MUS_LOG( "mus: [MUSUI ]  -> CMusUiLiveSharingController::SessionEstablished" );
     
+    iSessionEstablished = ETrue;
+    
     TRAPD( error, iResourceHandler->RequestCameraL( ETrue ) );
     if ( error != KErrNone )
         {
@@ -821,7 +823,8 @@
 //
 void CMusUiLiveSharingController::SessionTerminated()
     {
-    MUS_LOG( "mus: [MUSUI ]  -> CMusUiLiveSharingController::SessionTerminated" );
+    MUS_LOG( "mus: [MUSUI ]  -> CMusUiLiveSharingController::SessionTerminated" );    
+    iSessionEstablished = EFalse;
     if ( !ExitOccured() )
         {
         DismissWaitDialog();
@@ -839,6 +842,7 @@
 void CMusUiLiveSharingController::SessionConnectionLost()
     {
     MUS_LOG( "mus: [MUSUI ]  -> CMusUiLiveSharingController::SessionConnectionLost" );
+    iSessionEstablished = EFalse;
     DismissWaitDialog();
     if ( !ExitOccured() )
         {
@@ -859,6 +863,7 @@
 void CMusUiLiveSharingController::SessionFailed()
     {
     MUS_LOG( "mus: [MUSUI ]  -> CMusUiLiveSharingController::SessionFailed" );
+    iSessionEstablished = EFalse;
     if ( !ExitOccured() )
         {
         DismissWaitDialog();
@@ -961,6 +966,14 @@
     
     }
 
+// -----------------------------------------------------------------------------
+// Determines whether Session established or not
+// -----------------------------------------------------------------------------
+//
+TBool CMusUiLiveSharingController::IsSessionEstablished()
+	{
+	return iSessionEstablished;
+	}
 
 // End of file
 
--- a/mmsharing/mmshui/src/musuilivesharingview.cpp	Tue May 11 16:10:30 2010 +0300
+++ b/mmsharing/mmshui/src/musuilivesharingview.cpp	Tue May 25 12:38:39 2010 +0300
@@ -577,7 +577,7 @@
     MUS_LOG( "mus: [MUSUI ]  -> CMusUiLiveSharingView::RefreshView" );
     if ( iController )
         {
-		if ( aLayoutChange ) 
+		if ( aLayoutChange && iController->IsSessionEstablished() ) 
 			{
 			iController->AsyncRefreshView();
 			}
--- a/mmsharing/mmshui/src/musuinavimediadecorator.cpp	Tue May 11 16:10:30 2010 +0300
+++ b/mmsharing/mmshui/src/musuinavimediadecorator.cpp	Tue May 25 12:38:39 2010 +0300
@@ -489,15 +489,17 @@
 
     CFbsBitmap* bitmap = NULL;
     CFbsBitmap* mask = NULL;
-
-
-    AknsUtils::CreateIconL(aSkin,
-                           aId,
-                           bitmap,
-                           mask,
-                           parse.FullName(),
-                           aBitmapId,
-                           aMaskId);
+   
+    AknsUtils::CreateColorIconL(aSkin,
+        		                aId,
+        		                KAknsIIDQsnIconColors,
+        		                EAknsCIQsnIconColorsCG13,
+        		                bitmap,
+    							mask,
+    							parse.FullName(),
+    							aBitmapId,
+    							aMaskId,
+    							KRgbBlack);
 
     AknIconUtils::SetSize( bitmap, iImageSize );
     AknIconUtils::SetSize( mask, iImageSize );
--- a/mmsharing/mmshui/src/musuireceiveview.cpp	Tue May 11 16:10:30 2010 +0300
+++ b/mmsharing/mmshui/src/musuireceiveview.cpp	Tue May 25 12:38:39 2010 +0300
@@ -386,7 +386,7 @@
 //
 // -----------------------------------------------------------------------------
 //
-void CMusUiReceiveView::RefreshView( TBool aLayoutChange )
+void CMusUiReceiveView::RefreshView( TBool /*aLayoutChange*/ )
     {
     MUS_LOG( "mus: [MUSUI ]  -> CMusUiReceiveView::RefreshView" );
     
--- a/mmsharing/mmshui/src/musuisendcontroller.cpp	Tue May 11 16:10:30 2010 +0300
+++ b/mmsharing/mmshui/src/musuisendcontroller.cpp	Tue May 25 12:38:39 2010 +0300
@@ -53,6 +53,7 @@
     delete iAddress;
     delete iRemoteSipAddress;
     delete iRemoteSipAddressProposal;
+    TRAP_IGNORE( DeleteFileL() );  
     delete iVideoFileName;
     delete iLocalizer;
     
@@ -1032,7 +1033,24 @@
         }
     MUS_LOG( "mus: [MUSUI ]  <- CMusUiSendController::DeleteVideoL" );
     }   
-    
+
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CMusUiSendController::DeleteFileL()
+    {
+    MUS_LOG( "mus: [MUSUI ]  -> CMusUiSendController::DeleteFileL" );
+    if ( iVideoFileName && 
+    		MusUiFileUtil::FileExists( *iVideoFileName ) && !iVideoToBeSaved ) 
+		{
+        DeleteVideoL();
+		}
+    MUS_LOG( "mus: [MUSUI ]  <- CMusUiSendController::DeleteFileL" );
+    }   
+
+
 
 // -----------------------------------------------------------------------------
 //