videoplayback/videohelix/src/mpxvideoplaybackstate.cpp
branchRCL_3
changeset 14 55fa1ec415c6
parent 12 7f2b2a65da29
child 15 8f0df5c82986
--- a/videoplayback/videohelix/src/mpxvideoplaybackstate.cpp	Tue Apr 27 16:40:33 2010 +0300
+++ b/videoplayback/videohelix/src/mpxvideoplaybackstate.cpp	Tue May 11 16:15:40 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 
-// Version : %version: 39 %
+// Version : %version: 41 %
 
 
 //
@@ -24,6 +24,7 @@
 //
 #include <mpxcommandgeneraldefs.h>
 #include <mpxmessagegeneraldefs.h>
+#include <mpxmediageneralextdefs.h>
 
 #include "mpxvideoplaybackcontroller.h"
 #include "mpxvideoplaybackstate.h"
@@ -54,7 +55,6 @@
     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackState::ConstructL()"));
 
     iVideoPlaybackCtlr = aVideoPlaybackCtlr;
-    iVideoPlaybackCtlr->iPBPluginError = KErrNone;
 
     User::LeaveIfError( iFs.Connect() );
     iFs.ShareProtected();
@@ -296,8 +296,15 @@
     TUint attrG(0);  //  General attributes
     TUint attrV(0);  //  Video attributes
 
-    if (iVideoPlaybackCtlr->iPBPluginError != KErrNone)
+    if ( iVideoPlaybackCtlr->iPBPluginError != KErrNone )
     {
+        if ( iVideoPlaybackCtlr->iClipName )
+        {
+            aMedia->SetTextValueL(
+                TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralUri ),
+                *( iVideoPlaybackCtlr->iClipName ) );
+        }
+
         aMedia->SetTObjectValueL<TInt>(
             TMPXAttribute( KMPXMediaVideoError ), iVideoPlaybackCtlr->iPBPluginError );
 
@@ -485,16 +492,6 @@
     }
 
     //
-    //  TV-Out Playback Allowed
-    //
-    if ( attrV & KMPXMediaVideoTvOutPlayAllowed.iAttributeId )
-    {
-        aMedia->SetTObjectValueL<TInt>(
-            TMPXAttribute( KMPXMediaVideoTvOutPlayAllowed ),
-            iVideoPlaybackCtlr->iAccessoryMonitor->IsTvOutPlaybackAllowed() );
-    }
-
-    //
     //  BitRate
     //
     if ( attrV & KMPXMediaVideoBitRate.iAttributeId )
@@ -578,9 +575,9 @@
             TMPXAttribute( KMPXMediaVideoKeywords ),
             *( iVideoPlaybackCtlr->iFileDetails->iKeywords ) );
     }
-    
+
     //
-    //  Creation date/time 
+    //  Creation date/time
     //
     if ( attrV & KMPXMediaVideoCreated.iAttributeId )
     {
@@ -590,7 +587,7 @@
     }
 
     //
-    //  Last Modified date/time 
+    //  Last Modified date/time
     //
     if ( attrV & KMPXMediaVideoLastModified.iAttributeId )
     {
@@ -752,7 +749,7 @@
                                                MMPXPlaybackPluginObserver::TEvent aEvent,
                                                TBool aSendEvent )
 {
-    MPX_ENTER_EXIT(_L("CMPXVideoPlaybackState::CMPXVideoPlaybackState::IssuePlayCommand()"),
+    MPX_ENTER_EXIT(_L("CMPXVideoPlaybackState::IssuePlayCommand()"),
                    _L("aState = %d, aEvent  = %d, aSendEvent = %d"), aState, aEvent, aSendEvent );
 
     MPX_TRAPD( err, iVideoPlaybackCtlr->iPlayer->PlayL() );
@@ -772,6 +769,21 @@
     }
 }
 
+//  ------------------------------------------------------------------------------------------------
+//    CMPXVideoPlaybackState::UpdateSeekableL()
+//  ------------------------------------------------------------------------------------------------
+void CMPXVideoPlaybackState::UpdateSeekableL( CMPXCommand& aCmd )
+{
+    MPX_ENTER_EXIT(_L("CMPXVideoPlaybackState::UpdateSeekableL()"));
+
+    iVideoPlaybackCtlr->iSeekable = aCmd.ValueTObjectL<TBool>(KMPXMediaGeneralExtVideoSeekable);
+
+    if ( iVideoPlaybackCtlr->iFileDetails )
+    {
+        iVideoPlaybackCtlr->iFileDetails->iSeekable &= iVideoPlaybackCtlr->iSeekable;
+    }
+}
+
 // *************************************************************************************************
 //
 //                          STATE SUB-CLASSES
@@ -829,6 +841,16 @@
 
     if ( iVideoPlaybackCtlr->iPBPluginError != KErrNone )
     {
+        if ( iVideoPlaybackCtlr->iClipName )
+        {
+            //
+            //  Send the clip name and error code for further processing
+            //
+            aMedia->SetTextValueL(
+                TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralUri ),
+                *( iVideoPlaybackCtlr->iClipName ) );
+        }
+
         aMedia->SetTObjectValueL<TInt>(
             TMPXAttribute( KMPXMediaVideoError ), iVideoPlaybackCtlr->iPBPluginError );
 
@@ -902,6 +924,21 @@
      MPX_TRAPD( err, SendErrorToViewL( iVideoPlaybackCtlr->iPBPluginError ) );
 }
 
+//  ------------------------------------------------------------------------------------------------
+//    CMPXNotInitialisedState::UpdateSeekableL()
+//  ------------------------------------------------------------------------------------------------
+void CMPXNotInitialisedState::UpdateSeekableL( CMPXCommand& /*aCmd*/ )
+{
+    MPX_DEBUG(_L("CMPXNotInitialisedState::UpdateSeekableL()"));
+
+    //
+    //  Do not update the seekable state since the plugin is in the not initialized state
+    //  An error probably occurred, plugin went to not initialized.  If update was applied,
+    //  it would not be cleared for the next clip since we are already in not initialized
+    //  state.
+    //
+}
+
 // *************************************************************************************************
 //
 //                       CMPXInitialisingState
@@ -1024,25 +1061,7 @@
     }
     else
     {
-        //
-        // Transistion back to EMPXVideoNotInitialized, for pre loaded plugin
-        // this state will alert the view that pre loading failed
-        //
-        iVideoPlaybackCtlr->ChangeState( EMPXVideoNotInitialized );
-
-        // Store the error, in case of pre loaded pluging this can
-        // later be sent to the view
-        iVideoPlaybackCtlr->iPBPluginError = aError;
-
-        //
-        //  move the FW state to Initialized irrespective of the playback state
-        //  This enables the FW to send initailized event to view, which in turn
-        //  queries for the error
-        //
-        iVideoPlaybackCtlr->iMPXPluginObs->HandlePluginEvent(
-            MMPXPlaybackPluginObserver::EPInitialised,
-            0,
-            KErrNone );
+        iVideoPlaybackCtlr->HandleError( aError );
     }
 }
 
@@ -1090,23 +1109,7 @@
     }
     else
     {
-        //
-        // Transistion back to EMPXVideoNotInitialized, for pre loaded plugin
-        // this state will alert the view that pre loading failed
-        //
-        iVideoPlaybackCtlr->ChangeState( EMPXVideoNotInitialized );
-
-        // Store the error, in case of pre loaded pluging this can
-        // later be sent to the view
-        iVideoPlaybackCtlr->iPBPluginError = aError;
-
-        //
-        //  move the FW state to Initialized irrespective of the playback state
-        //  This enables the FW to send initailized event to view, which in turn
-        //  queries for the error
-        //
-        iVideoPlaybackCtlr->iMPXPluginObs->
-            HandlePluginEvent( MMPXPlaybackPluginObserver::EPInitialised, 0, KErrNone );
+        iVideoPlaybackCtlr->HandleError( aError );
     }
 }
 
@@ -1745,22 +1748,22 @@
     MPX_DEBUG(_L("CMPXBufferingState::HandleLoadingStarted()"));
 
     TInt loadingPercentage = RetrieveBufferingPercentage();
-    
+
     if ( loadingPercentage < 100 )
     {
         MPX_TRAPD( err,
         {
             CMPXMessage* message = CMPXMessage::NewL();
             CleanupStack::PushL( message );
-    
-            message->SetTObjectValueL<TMPXMessageId>( KMPXMessageGeneralId, 
+
+            message->SetTObjectValueL<TMPXMessageId>( KMPXMessageGeneralId,
                                                       KMPXMediaIdVideoPlayback );
-            
-            message->SetTObjectValueL<TMPXVideoPlaybackCommand>( KMPXMediaVideoPlaybackCommand, 
+
+            message->SetTObjectValueL<TMPXVideoPlaybackCommand>( KMPXMediaVideoPlaybackCommand,
                                                                  EPbCmdLoadingStarted );
-    
+
             iVideoPlaybackCtlr->iMPXPluginObs->HandlePlaybackMessage( message, KErrNone );
-    
+
             CleanupStack::PopAndDestroy( message );
         } );
     }