--- a/videoplayerapp/mpxvideoplayer/src/mpxvideoplayerappuiengine.cpp Fri Mar 12 15:43:00 2010 +0200
+++ b/videoplayerapp/mpxvideoplayer/src/mpxvideoplayerappuiengine.cpp Mon Mar 15 12:40:47 2010 +0200
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: e92_66 %
+// Version : %version: e92_68 %
#include <eikon.hrh>
@@ -114,6 +114,13 @@
iCollectionUtility = MMPXCollectionUtility::NewL( this, collectionMode );
}
+ //
+ // Create the playback utility to reduce startup time for embedded cases
+ //
+ else
+ {
+ PlaybackUtilityL();
+ }
//
// Create Active Object for exiting the application
@@ -122,6 +129,42 @@
}
// -----------------------------------------------------------------------------
+// CMpxVideoPlayerAppUiEngine::PlaybackUtilityL
+// -----------------------------------------------------------------------------
+//
+MMPXPlaybackUtility& CMpxVideoPlayerAppUiEngine::PlaybackUtilityL()
+{
+ MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::PlaybackUtilityL()"));
+
+ if ( ! iPlaybackUtility )
+ {
+ //
+ // Create VideoHelix playback plugin
+ //
+ MMPXPlaybackUtility* playbackUtility =
+ MMPXPlaybackUtility::UtilityL( EMPXCategoryVideo, KPbModeNewPlayer );
+ MMPXPlayerManager& manager = playbackUtility->PlayerManager();
+ TRAPD( err,
+ {
+ manager.SelectPlayerL( KVideoHelixPlaybackPluginUid );
+ playbackUtility->CommandL( EPbCmdSetAutoResume, EFalse );
+ } );
+ if ( err == KErrNone )
+ {
+ iPlaybackUtility = playbackUtility;
+ }
+ else
+ {
+ TRAP_IGNORE( manager.ClearSelectPlayersL() );
+ playbackUtility->Close();
+ User::Leave( err );
+ }
+ }
+
+ return *iPlaybackUtility;
+}
+
+// -----------------------------------------------------------------------------
// CMpxVideoPlayerAppUiEngine::CreateCollectionUtilityMemberVariablesL
// -----------------------------------------------------------------------------
//
@@ -142,42 +185,14 @@
}
// -----------------------------------------------------------------------------
-// CMpxVideoPlayerAppUiEngine::CreatePlaybackUtilityMemberVariablesL
+// CMpxVideoPlayerAppUiEngine::PreLoadPdlPlaybackViewL
// -----------------------------------------------------------------------------
//
-void CMpxVideoPlayerAppUiEngine::CreatePlaybackUtilityMemberVariablesL()
+void CMpxVideoPlayerAppUiEngine::PreLoadPdlPlaybackViewL()
{
- MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::CreatePlaybackUtilityMemberVariablesL()"));
-
- if ( ! iPlaybackUtility )
- {
- //
- // Create VideoHelix playback plugin
- //
- iPlaybackUtility = MMPXPlaybackUtility::UtilityL( EMPXCategoryVideo, KPbModeNewPlayer );
- MMPXPlayerManager& manager = iPlaybackUtility->PlayerManager();
- manager.SelectPlayerL( KVideoHelixPlaybackPluginUid );
- iPlaybackUtility->CommandL( EPbCmdSetAutoResume, EFalse );
- }
-}
-
-// -----------------------------------------------------------------------------
-// CMpxVideoPlayerAppUiEngine::CreateEmbeddedPdlPlaybackUtilityMemberVariablesL
-// -----------------------------------------------------------------------------
-//
-void CMpxVideoPlayerAppUiEngine::CreateEmbeddedPdlPlaybackUtilityMemberVariablesL()
-{
- MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::CreateEmbeddedPdlPlaybackUtilityMemberVariablesL()"));
+ MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::PreLoadPdlPlaybackViewL()"));
iViewUtility->PreLoadViewL( KVideoPdlPlaybackViewUid );
-
- if ( ! iPlaybackUtility )
- {
- iPlaybackUtility = MMPXPlaybackUtility::UtilityL( EMPXCategoryVideo, KPbModeNewPlayer );
- MMPXPlayerManager& manager = iPlaybackUtility->PlayerManager();
- manager.SelectPlayerL( KVideoHelixPlaybackPluginUid );
- iPlaybackUtility->CommandL( EPbCmdSetAutoResume, EFalse );
- }
}
// -----------------------------------------------------------------------------
@@ -188,6 +203,12 @@
{
MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::~CMpxVideoPlayerAppUiEngine()"));
+ if ( iConstructTimer )
+ {
+ delete iConstructTimer;
+ iConstructTimer = NULL;
+ }
+
if ( iExitAo )
{
delete iExitAo;
@@ -350,11 +371,6 @@
if ( KErrNone == err && ! iPdlHandler )
{
- //
- // Create member variables for embedded use cases that are not PDL
- //
- CreatePlaybackUtilityMemberVariablesL();
-
TFileName filename;
aFile.FullName(filename);
@@ -367,13 +383,13 @@
}
else if ( mediaType == CMediaRecognizer::ELocalSdpFile )
{
- iPlaybackUtility->InitStreamingL( aFile, iAccessPointId );
+ PlaybackUtilityL().InitStreamingL( aFile, iAccessPointId );
ActivatePlaybackViewL();
}
else
{
iViewUtility->PreLoadViewL( KVideoPlaybackViewUid );
- iPlaybackUtility->InitL( aFile );
+ PlaybackUtilityL().InitL( aFile );
ActivatePlaybackViewL();
}
}
@@ -393,11 +409,8 @@
_L("aFileName = %S"), &aFileName);
//
- // Create member variables for embedded use cases that are not PDL
+ // pre load the view and initialize the playback framework
//
- CreatePlaybackUtilityMemberVariablesL();
-
- // pre load the view and initialize the playback framework
iViewUtility->PreLoadViewL( KVideoPlaybackViewUid );
CMediaRecognizer::TMediaType mediaType = iRecognizer->IdentifyMediaTypeL(aFileName);
@@ -406,7 +419,7 @@
{
InitializeFileL( aFileName );
}
- // check if aFileName is a path to a ram or asx file
+ // check if aFileName is a path to a ram or asx file
// eg. c:\\data\\videos\\ramfile.ram
else if ( mediaType == CMediaRecognizer::ELocalRamFile ||
mediaType == CMediaRecognizer::ELocalAsxFile )
@@ -451,8 +464,6 @@
playList->SetSingleItemPlaylist();
playList->SetToFirst();
- CreatePlaybackUtilityMemberVariablesL();
-
iViewUtility->PreLoadViewL( KVideoPlaybackViewUid );
InitializePlaylistL( *playList, ETrue );
@@ -478,7 +489,7 @@
iUpdateSeekInfo = EFalse;
}
- MMPXPlayer* player = iPlaybackUtility->PlayerManager().CurrentPlayer();
+ MMPXPlayer* player = PlaybackUtilityL().PlayerManager().CurrentPlayer();
TUid pluginUid( KNullUid );
RArray<TUid> array;
@@ -511,21 +522,6 @@
{
MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::StartStandAloneL()"));
- //
- // Create the utilities for the stand alone player
- //
- CreatePlaybackUtilityMemberVariablesL();
-
- // Fetch the video collection UID
- RArray<TUid> uid;
- CleanupClosePushL( uid );
-
- uid.AppendL( TUid::Uid( KVcxMediaIdMyVideos ) );
-
- iVideoCollectionId = iCollectionUtility->CollectionIDL( uid.Array() );
-
- CleanupStack::PopAndDestroy( &uid );
-
iViewUtility->SetAsDefaultViewL( KUidMyVideosViewType );
}
@@ -903,7 +899,7 @@
if ( aErr == KErrNone )
{
- iPlaybackUtility->CommandL( EPbCmdDisableEffect );
+ PlaybackUtilityL().CommandL( EPbCmdDisableEffect );
}
}
@@ -937,7 +933,7 @@
//
TBool CMpxVideoPlayerAppUiEngine::ProcessCommandParametersL( TApaCommand aCommand,
TFileName& aDocumentName,
- const TDesC8& aTail )
+ const TDesC8& /*aTail*/ )
{
MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::ProcessCommandParametersL()"));
@@ -1022,7 +1018,7 @@
cmd->SetTObjectValueL<TBool>( KMPXMediaGeneralExtVideoSeekable, iSeekable );
- iPlaybackUtility->CommandL( *cmd );
+ PlaybackUtilityL().CommandL( *cmd );
CleanupStack::PopAndDestroy( cmd );
}
@@ -1061,7 +1057,7 @@
MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::InitializeStreamingLinkL()"),
_L("aUri = %S"), &aUri );
- iPlaybackUtility->InitStreamingL( aUri,
+ PlaybackUtilityL().InitStreamingL( aUri,
(TDesC8*)(&KDATATYPEVIDEOHELIX),
iAccessPointId );
@@ -1077,7 +1073,7 @@
MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::InitializeFileL()"),
_L("aFileName = %S"), &aFileName );
- iPlaybackUtility->InitL( aFileName );
+ PlaybackUtilityL().InitL( aFileName );
ActivatePlaybackViewL();
}
@@ -1091,7 +1087,7 @@
{
MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::InitializePlaylistL()"));
- iPlaybackUtility->InitL( aPlaylist, aPlay );
+ PlaybackUtilityL().InitL( aPlaylist, aPlay );
ActivatePlaybackViewL();
}
@@ -1113,7 +1109,7 @@
}
else
{
- if (iPlaybackUtility)
+ if ( iPlaybackUtility )
{
iPlaybackUtility->CommandL( EPbCmdClose );
}
@@ -1121,12 +1117,12 @@
}
// -------------------------------------------------------------------------------------------------
-// CMpxVideoPlayerAppUiEngine::SignalViewPdlReloading()
+// CMpxVideoPlayerAppUiEngine::SignalViewPdlReloadingL()
// -------------------------------------------------------------------------------------------------
//
-void CMpxVideoPlayerAppUiEngine::SignalViewPdlReloading()
+void CMpxVideoPlayerAppUiEngine::SignalViewPdlReloadingL()
{
- MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::SignalViewPdlReloading"));
+ MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::SignalViewPdlReloadingL"));
if ( iViewUtility->ActiveViewType() == TUid::Uid( KMpxPlaybackPluginTypeUid ) )
{
@@ -1137,5 +1133,50 @@
}
}
+// -----------------------------------------------------------------------------
+// CMpxVideoPlayerAppUiEngine::ActivateLateConstructTimerL
+// -----------------------------------------------------------------------------
+//
+void CMpxVideoPlayerAppUiEngine::ActivateLateConstructTimerL()
+{
+ MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::ActivateLateConstructTimerL()"));
+
+ if ( !iConstructTimer )
+ {
+ const TTimeIntervalMicroSeconds32 timeout = 250000; // 250 ms
+
+ TCallBack callback ( CMpxVideoPlayerAppUiEngine::LateConstructCallback, this );
+
+ iConstructTimer = CPeriodic::NewL( CActive::EPriorityIdle );
+
+ iConstructTimer->Start( timeout, 0, callback );
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMpxVideoPlayerAppUiEngine::LateConstructCallback
+// -------------------------------------------------------------------------------------------------
+//
+TInt CMpxVideoPlayerAppUiEngine::LateConstructCallback( TAny* aPtr )
+{
+ MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::LateConstructCallback()"));
+
+ TRAP_IGNORE( static_cast<CMpxVideoPlayerAppUiEngine*>(aPtr)->DoLateConstructL() );
+
+ return KErrNone;
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMpxVideoPlayerAppUiEngine::DoLateConstructL
+// -------------------------------------------------------------------------------------------------
+//
+void CMpxVideoPlayerAppUiEngine::DoLateConstructL()
+{
+ MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::DoLateConstructL()"));
+
+ iConstructTimer->Cancel();
+
+ PlaybackUtilityL();
+}
// EOF