videoplayback/videoplaybackcontrols/tsrc/videoplaybackcontrols_test/src/mpxvpbc_stub.cpp
branchRCL_3
changeset 21 315810614048
parent 11 8970fbd719ec
equal deleted inserted replaced
20:2d690156cf8f 21:315810614048
     1 /*
     1 /*
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    13 *
    13 *
    14 * Description:  Test Harness for VideoPlaybackControls
    14 * Description:  Test Harness for VideoPlaybackControls
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 // Version : %version: e003sa33#15 %
    18 // Version : %version: 16 %
    19 
    19 
    20 
    20 
    21 // INCLUDES
    21 // INCLUDES
    22 #include <coeaui.h>
    22 #include <coeaui.h>
    23 #include <aknutils.h>
    23 #include <aknutils.h>
    24 #include <aknsutils.h> 
    24 #include <aknsutils.h>
    25 #include <aknviewappui.h>
    25 #include <aknviewappui.h>
    26 #include <aknsdrawutils.h>
    26 #include <aknsdrawutils.h>
    27 #include <aknsbasicbackgroundcontrolcontext.h>
    27 #include <aknsbasicbackgroundcontrolcontext.h>
    28 
    28 
    29 #include "mpxvideoplaybackviewfiledetails.h"
    29 #include "mpxvideoplaybackviewfiledetails.h"
    62 //
    62 //
    63 void CMPXVideoPlaybackContainer::ConstructL( const TDesC& aFileName )
    63 void CMPXVideoPlaybackContainer::ConstructL( const TDesC& aFileName )
    64 {
    64 {
    65     MPX_DEBUG(_L("CMPXVideoPlaybackContainer::ConstructL()"));
    65     MPX_DEBUG(_L("CMPXVideoPlaybackContainer::ConstructL()"));
    66 
    66 
    67     iFileDetails = CMPXVideoPlaybackViewFileDetails::NewL();    
    67     iFileDetails = CMPXVideoPlaybackViewFileDetails::NewL();
    68     iFileDetails->iClipName = HBufC::NewL( aFileName.Length() );
    68     iFileDetails->iClipName = HBufC::NewL( aFileName.Length() );
    69     iFileDetails->iClipName->Des().Copy( aFileName );
    69     iFileDetails->iClipName->Des().Copy( aFileName );
    70 
    70 
    71     CreateWindowL();       
    71     CreateWindowL();
    72 
    72 
    73     iUserInputHandler = CMPXVideoPlaybackUserInputHandler::NewL( this );
    73     iUserInputHandler = CMPXVideoPlaybackUserInputHandler::NewL( this );
    74     
    74 
    75     SetFocus( ETrue );
    75     SetFocus( ETrue );
    76     
    76 
    77     MakeVisible( ETrue );
    77     MakeVisible( ETrue );
    78 
    78 
    79     ActivateL();
    79     ActivateL();
    80 }
    80 }
    81 
    81 
    96     CleanupStack::Pop();
    96     CleanupStack::Pop();
    97 
    97 
    98     return self;
    98     return self;
    99 }
    99 }
   100 
   100 
   101 // 
   101 //
   102 // -------------------------------------------------------------------------------------------------
   102 // -------------------------------------------------------------------------------------------------
   103 // CMPXVideoPlaybackContainer::~CMPXVideoPlaybackContainer()
   103 // CMPXVideoPlaybackContainer::~CMPXVideoPlaybackContainer()
   104 // Destructor.
   104 // Destructor.
   105 // -------------------------------------------------------------------------------------------------
   105 // -------------------------------------------------------------------------------------------------
   106 //
   106 //
   110 
   110 
   111     if ( iFileDetails )
   111     if ( iFileDetails )
   112     {
   112     {
   113         delete iFileDetails;
   113         delete iFileDetails;
   114         iFileDetails = NULL;
   114         iFileDetails = NULL;
   115     }   
   115     }
   116     
   116 
   117     if ( iUserInputHandler )
   117     if ( iUserInputHandler )
   118     {
   118     {
   119         delete iUserInputHandler;
   119         delete iUserInputHandler;
   120         iUserInputHandler = NULL;
   120         iUserInputHandler = NULL;
   121     } 
   121     }
   122 
   122 
   123     CloseWindow();
   123     CloseWindow();
   124 }
   124 }
   125 
   125 
   126 // -------------------------------------------------------------------------------------------------
   126 // -------------------------------------------------------------------------------------------------
   144     gc.SetBrushColor( KRgbBlack );
   144     gc.SetBrushColor( KRgbBlack );
   145     gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
   145     gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
   146     gc.DrawRect( aRect );
   146     gc.DrawRect( aRect );
   147 }
   147 }
   148 
   148 
   149 // 
   149 //
   150 // -------------------------------------------------------------------------------------------------
   150 // -------------------------------------------------------------------------------------------------
   151 // CMPXVideoPlaybackContainer::HandleCommandL()
   151 // CMPXVideoPlaybackContainer::HandleCommandL()
   152 // -------------------------------------------------------------------------------------------------
   152 // -------------------------------------------------------------------------------------------------
   153 //
   153 //
   154 void CMPXVideoPlaybackContainer::HandleCommandL( TInt aCommand, TInt aValue )
   154 void CMPXVideoPlaybackContainer::HandleCommandL( TInt aCommand, TInt aValue )
   157 
   157 
   158     iCommand = aCommand;
   158     iCommand = aCommand;
   159     iValue = aValue;
   159     iValue = aValue;
   160 }
   160 }
   161 
   161 
   162 // 
   162 //
   163 // -------------------------------------------------------------------------------------------------
   163 // -------------------------------------------------------------------------------------------------
   164 // CMPXVideoPlaybackContainer::ExpectedResultL()
   164 // CMPXVideoPlaybackContainer::ExpectedResultL()
   165 // -------------------------------------------------------------------------------------------------
   165 // -------------------------------------------------------------------------------------------------
   166 //
   166 //
   167 void CMPXVideoPlaybackContainer::ExpectedResultL( TInt aCommand, TInt aValue )
   167 void CMPXVideoPlaybackContainer::ExpectedResultL( TInt aCommand, TInt aValue )
   168 {
   168 {
   169     MPX_DEBUG(_L("CMPXVideoPlaybackContainer::ExpectedResultL(aCommand=%d,aValue=%d)"),aCommand,aValue);
   169     MPX_DEBUG(_L("CMPXVideoPlaybackContainer::ExpectedResultL(aCommand=%d,aValue=%d)"),aCommand,aValue);
   170 
   170 
   171     if ( iCommand != aCommand || iValue != aValue )
   171     if ( aCommand == iCommand )
   172     {
   172     {
       
   173         if ( iValue != aValue )
       
   174         {
       
   175             if ( aCommand == EMPXPbvCmdSetVolume )
       
   176             {
       
   177                 if ( Abs( iValue - aValue ) > 6 )
       
   178                 {
       
   179                     User::Leave( KErrGeneral );
       
   180                 }
       
   181             }
       
   182             else
       
   183             {
       
   184                 User::Leave( KErrGeneral );
       
   185             }
       
   186         }
       
   187     }
       
   188     else
       
   189     {
       
   190 
   173         User::Leave( KErrGeneral );
   191         User::Leave( KErrGeneral );
   174     }
   192     }
   175 }
   193 }
   176 
   194 
   177 //
   195 //
   197     MPX_DEBUG(_L("CMPXVideoPlaybackContainer::AddFileDetailsL() "));
   215     MPX_DEBUG(_L("CMPXVideoPlaybackContainer::AddFileDetailsL() "));
   198 
   216 
   199     iFileDetails->iAudioEnabled = ETrue;
   217     iFileDetails->iAudioEnabled = ETrue;
   200     iFileDetails->iVideoEnabled = aHasVideoTrack;
   218     iFileDetails->iVideoEnabled = aHasVideoTrack;
   201     iFileDetails->iSeekable = ETrue;
   219     iFileDetails->iSeekable = ETrue;
   202     
   220 
   203     iFileDetails->iTitle    = _L("Test Title").Alloc();
   221     iFileDetails->iTitle    = _L("Test Title").Alloc();
   204 
   222 
   205     if ( iFileDetails->iVideoEnabled )
   223     if ( iFileDetails->iVideoEnabled )
   206     {        
   224     {
   207         iFileDetails->iVideoHeight = 176;
   225         iFileDetails->iVideoHeight = 176;
   208         iFileDetails->iVideoWidth = 144;
   226         iFileDetails->iVideoWidth = 144;
   209         
   227 
   210         iFileDetails->iBitRate = 8000;
   228         iFileDetails->iBitRate = 8000;
   211         iFileDetails->iMimeType = _L("video/3gp").Alloc();        
   229         iFileDetails->iMimeType = _L("video/3gp").Alloc();
   212     }
   230     }
   213 
   231 
   214     if ( iFileDetails->iPlaybackMode == EMPXVideoLiveStreaming )
   232     if ( iFileDetails->iPlaybackMode == EMPXVideoLiveStreaming )
   215     {
   233     {
   216         iFileDetails->iSeekable = EFalse;
   234         iFileDetails->iSeekable = EFalse;
   241 //
   259 //
   242 TKeyResponse CMPXVideoPlaybackContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent,
   260 TKeyResponse CMPXVideoPlaybackContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent,
   243                                                          TEventCode aType )
   261                                                          TEventCode aType )
   244 {
   262 {
   245     iKeyResponse = EKeyWasNotConsumed;
   263     iKeyResponse = EKeyWasNotConsumed;
   246     
   264 
   247     iUserInputHandler->ProcessKeyEventL( aKeyEvent, aType );
   265     iUserInputHandler->ProcessKeyEventL( aKeyEvent, aType );
   248     
   266 
   249     return iKeyResponse;
   267     return iKeyResponse;
   250 }
   268 }
   251 
   269 
   252 // -------------------------------------------------------------------------------------------------
   270 // -------------------------------------------------------------------------------------------------
   253 // CMPXVideoPlaybackContainer::DoHandleKeyEventL()
   271 // CMPXVideoPlaybackContainer::DoHandleKeyEventL()
   254 // -------------------------------------------------------------------------------------------------
   272 // -------------------------------------------------------------------------------------------------
   255 //
   273 //
   256 void CMPXVideoPlaybackContainer::DoHandleKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType )
   274 void CMPXVideoPlaybackContainer::DoHandleKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType )
   257 {
   275 {
   258     MPX_DEBUG(_L("CMPXVideoPlaybackContainer::DoHandleKeyEventL()"));
   276     MPX_DEBUG(_L("CMPXVideoPlaybackContainer::DoHandleKeyEventL()"));
   259     
   277 
   260     switch ( aKeyEvent.iScanCode )
   278     switch ( aKeyEvent.iScanCode )
   261     {
   279     {
   262         case EStdKeyDevice3:        // rocker middle key
   280         case EStdKeyDevice3:        // rocker middle key
   263         case EStdKeyEnter:          // enter key on a qwerty key board
   281         case EStdKeyEnter:          // enter key on a qwerty key board
   264         {
   282         {
   286             }
   304             }
   287             else if (aType == EEventKeyUp)
   305             else if (aType == EEventKeyUp)
   288             {
   306             {
   289                 HandleCommandL(EMPXPbvCmdEndSeek);
   307                 HandleCommandL(EMPXPbvCmdEndSeek);
   290             }
   308             }
   291             
   309 
   292             iKeyResponse = EKeyWasConsumed;
   310             iKeyResponse = EKeyWasConsumed;
   293             break;
   311             break;
   294         }
   312         }
   295         case EStdKeyRightArrow:     // rocker right key
   313         case EStdKeyRightArrow:     // rocker right key
   296         {
   314         {
   300             }
   318             }
   301             else if (aType == EEventKeyUp)
   319             else if (aType == EEventKeyUp)
   302             {
   320             {
   303                 HandleCommandL(EMPXPbvCmdEndSeek);
   321                 HandleCommandL(EMPXPbvCmdEndSeek);
   304             }
   322             }
   305             
   323 
   306             iKeyResponse = EKeyWasConsumed;
   324             iKeyResponse = EKeyWasConsumed;
   307             break;
   325             break;
   308         }
   326         }
   309         case EStdKeyYes:            // green/send key
   327         case EStdKeyYes:            // green/send key
   310         {
   328         {
   315         }
   333         }
   316         default:
   334         default:
   317         {
   335         {
   318             break;
   336             break;
   319         }
   337         }
   320     }    
   338     }
   321 }
   339 }
   322 
   340 
   323 // -------------------------------------------------------------------------------------------------
   341 // -------------------------------------------------------------------------------------------------
   324 // CMPXVideoPlaybackContainer::UserInputHandler()
   342 // CMPXVideoPlaybackContainer::UserInputHandler()
   325 // -------------------------------------------------------------------------------------------------
   343 // -------------------------------------------------------------------------------------------------
   373 
   391 
   374 void CMPXVideoPlaybackContainer::HandlePointerEventL( const TPointerEvent& aPointerEvent )
   392 void CMPXVideoPlaybackContainer::HandlePointerEventL( const TPointerEvent& aPointerEvent )
   375 {
   393 {
   376     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackContainer::HandlePointerEventL()"));
   394     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackContainer::HandlePointerEventL()"));
   377 
   395 
   378     MPX_DEBUG(_L("   iType = %d, iPosition = (%d,%d)"), 
   396     MPX_DEBUG(_L("   iType = %d, iPosition = (%d,%d)"),
   379        aPointerEvent.iType, aPointerEvent.iPosition.iX, aPointerEvent.iPosition.iY );
   397        aPointerEvent.iType, aPointerEvent.iPosition.iX, aPointerEvent.iPosition.iY );
   380 }
   398 }
   381 
   399 
   382 // -------------------------------------------------------------------------------------------------
   400 // -------------------------------------------------------------------------------------------------
   383 // CMPXVideoPlaybackContainer::AddSameARFileDetailsL()
   401 // CMPXVideoPlaybackContainer::AddSameARFileDetailsL()
   384 // -------------------------------------------------------------------------------------------------
   402 // -------------------------------------------------------------------------------------------------
   385 //
   403 //
   386 void CMPXVideoPlaybackContainer::AddSameARFileDetailsL( TBool aHasVideoTrack )
   404 void CMPXVideoPlaybackContainer::AddSameARFileDetailsL( TBool aHasVideoTrack )
   387 {
   405 {
   388 	MPX_ENTER_EXIT( _L( "CMPXVideoPlaybackContainer::AddSameARFileDetailsL() ") );
   406     MPX_ENTER_EXIT( _L( "CMPXVideoPlaybackContainer::AddSameARFileDetailsL() ") );
   389 
   407 
   390     iFileDetails->iAudioEnabled = ETrue;
   408     iFileDetails->iAudioEnabled = ETrue;
   391     iFileDetails->iVideoEnabled = aHasVideoTrack;
   409     iFileDetails->iVideoEnabled = aHasVideoTrack;
   392     iFileDetails->iSeekable = ETrue;
   410     iFileDetails->iSeekable = ETrue;
   393 
   411 
   394     if ( iFileDetails->iVideoEnabled )
   412     if ( iFileDetails->iVideoEnabled )
   395     {        
   413     {
   396         iFileDetails->iVideoHeight = this->Rect().Height();
   414         iFileDetails->iVideoHeight = this->Rect().Height();
   397         iFileDetails->iVideoWidth = this->Rect().Width();
   415         iFileDetails->iVideoWidth = this->Rect().Width();
   398         
   416 
   399         iFileDetails->iBitRate = 8000;
   417         iFileDetails->iBitRate = 8000;
   400         iFileDetails->iMimeType = _L("video/3gp").Alloc();        
   418         iFileDetails->iMimeType = _L("video/3gp").Alloc();
   401     }
   419     }
   402 
   420 
   403     if ( iFileDetails->iPlaybackMode == EMPXVideoLiveStreaming )
   421     if ( iFileDetails->iPlaybackMode == EMPXVideoLiveStreaming )
   404     {
   422     {
   405         iFileDetails->iSeekable = EFalse;
   423         iFileDetails->iSeekable = EFalse;
   418     MPX_DEBUG(_L("CMPXVideoPlaybackContainer::AddEmptyTitleFileDetailsL() "));
   436     MPX_DEBUG(_L("CMPXVideoPlaybackContainer::AddEmptyTitleFileDetailsL() "));
   419 
   437 
   420     iFileDetails->iAudioEnabled = ETrue;
   438     iFileDetails->iAudioEnabled = ETrue;
   421     iFileDetails->iVideoEnabled = aHasVideoTrack;
   439     iFileDetails->iVideoEnabled = aHasVideoTrack;
   422     iFileDetails->iSeekable = ETrue;
   440     iFileDetails->iSeekable = ETrue;
   423     
   441 
   424     if ( iFileDetails->iVideoEnabled )
   442     if ( iFileDetails->iVideoEnabled )
   425     {        
   443     {
   426         iFileDetails->iVideoHeight = 176;
   444         iFileDetails->iVideoHeight = 176;
   427         iFileDetails->iVideoWidth = 144;
   445         iFileDetails->iVideoWidth = 144;
   428         
   446 
   429         iFileDetails->iBitRate = 8000;
   447         iFileDetails->iBitRate = 8000;
   430         iFileDetails->iMimeType = _L("video/3gp").Alloc();        
   448         iFileDetails->iMimeType = _L("video/3gp").Alloc();
   431     }
   449     }
   432 
   450 
   433     if ( iFileDetails->iPlaybackMode == EMPXVideoLiveStreaming )
   451     if ( iFileDetails->iPlaybackMode == EMPXVideoLiveStreaming )
   434     {
   452     {
   435         iFileDetails->iSeekable = EFalse;
   453         iFileDetails->iSeekable = EFalse;