videoplayback/hbvideoplaybackview/viewsrc/mpxvideoviewwrapper.cpp
author hgs
Thu, 01 Apr 2010 23:32:44 +0300
changeset 35 3738fe97f027
parent 30 4f111d64a341
child 36 8aed59de29f9
permissions -rw-r--r--
201011
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
30
hgs
parents:
diff changeset
     1
/*
hgs
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
hgs
parents:
diff changeset
     3
* All rights reserved.
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents:
diff changeset
     8
*
hgs
parents:
diff changeset
     9
* Initial Contributors:
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
hgs
parents:
diff changeset
    11
*
hgs
parents:
diff changeset
    12
* Contributors:
hgs
parents:
diff changeset
    13
*
hgs
parents:
diff changeset
    14
* Description:   Implementation of Video base playback view
hgs
parents:
diff changeset
    15
*
hgs
parents:
diff changeset
    16
*/
hgs
parents:
diff changeset
    17
35
hgs
parents: 30
diff changeset
    18
// Version : %version: da1mmcf#24 %
30
hgs
parents:
diff changeset
    19
hgs
parents:
diff changeset
    20
hgs
parents:
diff changeset
    21
hgs
parents:
diff changeset
    22
//  Include Files
hgs
parents:
diff changeset
    23
hgs
parents:
diff changeset
    24
#include <w32std.h>
hgs
parents:
diff changeset
    25
#include <eikenv.h>
hgs
parents:
diff changeset
    26
hgs
parents:
diff changeset
    27
#include <mpxplaybackcommanddefs.h>
hgs
parents:
diff changeset
    28
#include <mpxvideoplaybackdefs.h>
hgs
parents:
diff changeset
    29
#include <mpxcommandgeneraldefs.h>
hgs
parents:
diff changeset
    30
#include <mpxcommand.h>
hgs
parents:
diff changeset
    31
#include <mpxmessagegeneraldefs.h>
hgs
parents:
diff changeset
    32
#include <mpxplaybackmessage.h>
hgs
parents:
diff changeset
    33
#include <mpxmediageneraldefs.h>
hgs
parents:
diff changeset
    34
#include <mpxmediavideodefs.h>
hgs
parents:
diff changeset
    35
#include <mpxplaybackutility.h>
hgs
parents:
diff changeset
    36
#include <mmf/common/mmferrors.h>
hgs
parents:
diff changeset
    37
#include <mpxcollectionutility.h>
hgs
parents:
diff changeset
    38
#include <mpxcollectionplaylist.h>
hgs
parents:
diff changeset
    39
#include <mpxmediageneralextdefs.h>
hgs
parents:
diff changeset
    40
hgs
parents:
diff changeset
    41
#include "mpxvideo_debug.h"
hgs
parents:
diff changeset
    42
#include "mpxvideoregion.h"
hgs
parents:
diff changeset
    43
#include "mpxvideoviewwrapper.h"
hgs
parents:
diff changeset
    44
#include "mpxvideoplaybackuids.hrh"
hgs
parents:
diff changeset
    45
#include "mpxhbvideocommondefs.h"
hgs
parents:
diff changeset
    46
#include "hbvideobaseplaybackview.h"
hgs
parents:
diff changeset
    47
#include "mpxvideoplaybackcontrol.hrh"
hgs
parents:
diff changeset
    48
#include "mpxvideoplaybackviewfiledetails.h"
hgs
parents:
diff changeset
    49
#include "mpxvideoplaybackdisplayhandler.h"
hgs
parents:
diff changeset
    50
#include "mpxcommonvideoplaybackview.hrh"
hgs
parents:
diff changeset
    51
#include "mpxvideoplaybackcontrolscontroller.h"
hgs
parents:
diff changeset
    52
#include "mpxvideoplaybackuserinputhandler.h"
hgs
parents:
diff changeset
    53
hgs
parents:
diff changeset
    54
//  Member Functions
hgs
parents:
diff changeset
    55
hgs
parents:
diff changeset
    56
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    57
// CMPXVideoViewWrapper::CMPXVideoViewWrapper()
hgs
parents:
diff changeset
    58
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    59
//
hgs
parents:
diff changeset
    60
CMPXVideoViewWrapper::CMPXVideoViewWrapper( HbVideoBasePlaybackView* aView )
hgs
parents:
diff changeset
    61
    : iView( aView )
hgs
parents:
diff changeset
    62
    , iControlsController( NULL )
35
hgs
parents: 30
diff changeset
    63
    , iMediaRequested( false )
hgs
parents: 30
diff changeset
    64
    , iPlaylistView( false )
30
hgs
parents:
diff changeset
    65
{
hgs
parents:
diff changeset
    66
}
hgs
parents:
diff changeset
    67
hgs
parents:
diff changeset
    68
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    69
// CMPXVideoViewWrapper::NewL()
hgs
parents:
diff changeset
    70
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    71
//
hgs
parents:
diff changeset
    72
CMPXVideoViewWrapper* CMPXVideoViewWrapper::NewL( HbVideoBasePlaybackView* aView )
hgs
parents:
diff changeset
    73
{
hgs
parents:
diff changeset
    74
    MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::NewL()"));
hgs
parents:
diff changeset
    75
hgs
parents:
diff changeset
    76
    CMPXVideoViewWrapper* self = new (ELeave) CMPXVideoViewWrapper( aView );
hgs
parents:
diff changeset
    77
hgs
parents:
diff changeset
    78
    CleanupStack::PushL( self );
hgs
parents:
diff changeset
    79
    self->ConstructL();
hgs
parents:
diff changeset
    80
    CleanupStack::Pop();
hgs
parents:
diff changeset
    81
hgs
parents:
diff changeset
    82
    return self;
hgs
parents:
diff changeset
    83
}
hgs
parents:
diff changeset
    84
hgs
parents:
diff changeset
    85
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    86
//   CMPXVideoViewWrapper::ConstructL()
hgs
parents:
diff changeset
    87
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    88
//
hgs
parents:
diff changeset
    89
void CMPXVideoViewWrapper::ConstructL()
hgs
parents:
diff changeset
    90
{
hgs
parents:
diff changeset
    91
    MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::ConstructL()"));
hgs
parents:
diff changeset
    92
hgs
parents:
diff changeset
    93
    iPlaybackUtility = 
hgs
parents:
diff changeset
    94
        MMPXPlaybackUtility::UtilityL( EMPXCategoryVideo, KPbModeDefault );
hgs
parents:
diff changeset
    95
    iPlaybackUtility->AddObserverL( *this );
hgs
parents:
diff changeset
    96
    iPlaybackUtility->SetPrimaryClientL();
hgs
parents:
diff changeset
    97
hgs
parents:
diff changeset
    98
    //
hgs
parents:
diff changeset
    99
    //  Create Active Object for closing player
hgs
parents:
diff changeset
   100
    //
hgs
parents:
diff changeset
   101
    iCloseAO = CIdle::NewL( CActive::EPriorityStandard );   
35
hgs
parents: 30
diff changeset
   102
                
30
hgs
parents:
diff changeset
   103
    //
hgs
parents:
diff changeset
   104
    //  Create Video Playback Display Handler
hgs
parents:
diff changeset
   105
    //
hgs
parents:
diff changeset
   106
    iDisplayHandler = CMPXVideoPlaybackDisplayHandler::NewL( iPlaybackUtility, this );
hgs
parents:
diff changeset
   107
hgs
parents:
diff changeset
   108
    //
hgs
parents:
diff changeset
   109
    // Create control's controller
hgs
parents:
diff changeset
   110
    //
hgs
parents:
diff changeset
   111
    CreateControlsL();
hgs
parents:
diff changeset
   112
hgs
parents:
diff changeset
   113
    //
hgs
parents:
diff changeset
   114
    // Create user input handler
hgs
parents:
diff changeset
   115
    //
hgs
parents:
diff changeset
   116
    iUserInputHandler = CMPXVideoPlaybackUserInputHandler::NewL( this, iFileDetails->mTvOutConnected );
hgs
parents:
diff changeset
   117
}
hgs
parents:
diff changeset
   118
hgs
parents:
diff changeset
   119
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   120
// CMPXVideoViewWrapper::~CMPXVideoViewWrapper()
hgs
parents:
diff changeset
   121
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   122
//
hgs
parents:
diff changeset
   123
CMPXVideoViewWrapper::~CMPXVideoViewWrapper()
hgs
parents:
diff changeset
   124
{
hgs
parents:
diff changeset
   125
    MPX_DEBUG(_L("CMPXVideoViewWrapper::~CMPXVideoViewWrapper()"));
hgs
parents:
diff changeset
   126
hgs
parents:
diff changeset
   127
    //
hgs
parents:
diff changeset
   128
    //  Delete the display handler when the view is deactivated
hgs
parents:
diff changeset
   129
    //
hgs
parents:
diff changeset
   130
    if ( iDisplayHandler )
hgs
parents:
diff changeset
   131
    {
hgs
parents:
diff changeset
   132
        iDisplayHandler->RemoveDisplayWindow();
hgs
parents:
diff changeset
   133
        delete iDisplayHandler;
hgs
parents:
diff changeset
   134
        iDisplayHandler = NULL;
hgs
parents:
diff changeset
   135
    }
hgs
parents:
diff changeset
   136
hgs
parents:
diff changeset
   137
    if ( iUserInputHandler )
hgs
parents:
diff changeset
   138
    {
hgs
parents:
diff changeset
   139
        delete iUserInputHandler;
hgs
parents:
diff changeset
   140
        iUserInputHandler = NULL;
hgs
parents:
diff changeset
   141
    }
hgs
parents:
diff changeset
   142
hgs
parents:
diff changeset
   143
    if ( iControlsController )
hgs
parents:
diff changeset
   144
    {
hgs
parents:
diff changeset
   145
        delete iControlsController;
hgs
parents:
diff changeset
   146
        iControlsController = NULL;
hgs
parents:
diff changeset
   147
    }
hgs
parents:
diff changeset
   148
hgs
parents:
diff changeset
   149
    if ( iCloseAO )
hgs
parents:
diff changeset
   150
    {
hgs
parents:
diff changeset
   151
        delete iCloseAO;
hgs
parents:
diff changeset
   152
        iCloseAO = NULL;
hgs
parents:
diff changeset
   153
    }
hgs
parents:
diff changeset
   154
hgs
parents:
diff changeset
   155
    if ( iFileDetails )
hgs
parents:
diff changeset
   156
    {
hgs
parents:
diff changeset
   157
        delete iFileDetails;
hgs
parents:
diff changeset
   158
        iFileDetails = NULL;
hgs
parents:
diff changeset
   159
    }
hgs
parents:
diff changeset
   160
hgs
parents:
diff changeset
   161
    if ( iPlaybackUtility )
hgs
parents:
diff changeset
   162
    {
hgs
parents:
diff changeset
   163
        TRAP_IGNORE( iPlaybackUtility->RemoveObserverL( *this ) );
hgs
parents:
diff changeset
   164
        iPlaybackUtility->Close();
hgs
parents:
diff changeset
   165
        iPlaybackUtility = NULL;
hgs
parents:
diff changeset
   166
    }
hgs
parents:
diff changeset
   167
hgs
parents:
diff changeset
   168
    if ( iCollectionUtility )
hgs
parents:
diff changeset
   169
    {
hgs
parents:
diff changeset
   170
        iCollectionUtility->Close();
hgs
parents:
diff changeset
   171
    }
hgs
parents:
diff changeset
   172
}
hgs
parents:
diff changeset
   173
hgs
parents:
diff changeset
   174
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   175
// CMPXVideoViewWrapper::IsLive()
hgs
parents:
diff changeset
   176
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   177
//
hgs
parents:
diff changeset
   178
TBool CMPXVideoViewWrapper::IsLive()
hgs
parents:
diff changeset
   179
{
hgs
parents:
diff changeset
   180
    return (iFileDetails->mPlaybackMode == EMPXVideoLiveStreaming);
hgs
parents:
diff changeset
   181
}
hgs
parents:
diff changeset
   182
hgs
parents:
diff changeset
   183
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   184
// CMPXVideoViewWrapper::IsPlaylist()
hgs
parents:
diff changeset
   185
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   186
//
hgs
parents:
diff changeset
   187
TBool CMPXVideoViewWrapper::IsPlaylist()
hgs
parents:
diff changeset
   188
{
hgs
parents:
diff changeset
   189
    return iPlaylistView;
hgs
parents:
diff changeset
   190
}
hgs
parents:
diff changeset
   191
hgs
parents:
diff changeset
   192
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   193
//   CMPXVideoViewWrapper::CreateGeneralPlaybackCommandL()
hgs
parents:
diff changeset
   194
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   195
//
hgs
parents:
diff changeset
   196
void CMPXVideoViewWrapper::CreateGeneralPlaybackCommandL( TMPXPlaybackCommand aCmd )
hgs
parents:
diff changeset
   197
{
hgs
parents:
diff changeset
   198
    MPX_DEBUG(_L("CMPXVideoViewWrapper::CreateGeneralPlaybackCommandL(%d)"), aCmd );
hgs
parents:
diff changeset
   199
hgs
parents:
diff changeset
   200
    CMPXCommand* cmd = CMPXCommand::NewL();
hgs
parents:
diff changeset
   201
    CleanupStack::PushL( cmd );
hgs
parents:
diff changeset
   202
hgs
parents:
diff changeset
   203
    cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
hgs
parents:
diff changeset
   204
    cmd->SetTObjectValueL<TBool>( KMPXCommandPlaybackGeneralNoBuffer, ETrue );
hgs
parents:
diff changeset
   205
    cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXCommandIdPlaybackGeneral );
hgs
parents:
diff changeset
   206
    cmd->SetTObjectValueL<TInt>( KMPXCommandPlaybackGeneralType, aCmd );
hgs
parents:
diff changeset
   207
hgs
parents:
diff changeset
   208
    iPlaybackUtility->CommandL( *cmd );
hgs
parents:
diff changeset
   209
hgs
parents:
diff changeset
   210
    CleanupStack::PopAndDestroy( cmd );
hgs
parents:
diff changeset
   211
}
hgs
parents:
diff changeset
   212
hgs
parents:
diff changeset
   213
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   214
//   CMPXVideoViewWrapper::HandleCommandL()
hgs
parents:
diff changeset
   215
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   216
//
hgs
parents:
diff changeset
   217
void CMPXVideoViewWrapper::HandleCommandL( TInt aCommand )
hgs
parents:
diff changeset
   218
{
hgs
parents:
diff changeset
   219
    MPX_ENTER_EXIT(
hgs
parents:
diff changeset
   220
        _L("CMPXVideoViewWrapper::HandleCommandL()"),
hgs
parents:
diff changeset
   221
        _L("aCommand = %d"), aCommand );
hgs
parents:
diff changeset
   222
hgs
parents:
diff changeset
   223
    switch ( aCommand )
hgs
parents:
diff changeset
   224
    {
hgs
parents:
diff changeset
   225
        case EMPXPbvCmdPlay:
hgs
parents:
diff changeset
   226
        {
hgs
parents:
diff changeset
   227
            IssuePlayCommandL();
hgs
parents:
diff changeset
   228
            break;
hgs
parents:
diff changeset
   229
        }
hgs
parents:
diff changeset
   230
        case EMPXPbvCmdPause:
hgs
parents:
diff changeset
   231
        {
hgs
parents:
diff changeset
   232
            MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdPause"));
hgs
parents:
diff changeset
   233
            CreateGeneralPlaybackCommandL( EPbCmdPause );
hgs
parents:
diff changeset
   234
            break;
hgs
parents:
diff changeset
   235
        }
hgs
parents:
diff changeset
   236
        case EMPXPbvCmdClose:
hgs
parents:
diff changeset
   237
        {
hgs
parents:
diff changeset
   238
            MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdClose"));
hgs
parents:
diff changeset
   239
            
hgs
parents:
diff changeset
   240
            //
hgs
parents:
diff changeset
   241
            // The display window must be removed before closing the playback plugin
hgs
parents:
diff changeset
   242
            //
hgs
parents:
diff changeset
   243
            if ( iDisplayHandler )
hgs
parents:
diff changeset
   244
            {
hgs
parents:
diff changeset
   245
                //
hgs
parents:
diff changeset
   246
                // Remove the display window so the surface can be released
hgs
parents:
diff changeset
   247
                //
hgs
parents:
diff changeset
   248
                iDisplayHandler->RemoveDisplayWindow();
hgs
parents:
diff changeset
   249
            }
hgs
parents:
diff changeset
   250
hgs
parents:
diff changeset
   251
            CreateGeneralPlaybackCommandL( EPbCmdClose );
hgs
parents:
diff changeset
   252
            break;
hgs
parents:
diff changeset
   253
        }
hgs
parents:
diff changeset
   254
        case EMPXPbvCmdSeekForward:
hgs
parents:
diff changeset
   255
        {
hgs
parents:
diff changeset
   256
            MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdSeekForward"));
hgs
parents:
diff changeset
   257
            CreateVideoSpecificCmdL( EPbCmdStartVideoSeekingForward );
hgs
parents:
diff changeset
   258
            break;
hgs
parents:
diff changeset
   259
        }
hgs
parents:
diff changeset
   260
        case EMPXPbvCmdSeekBackward:
hgs
parents:
diff changeset
   261
        {
hgs
parents:
diff changeset
   262
            MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdSeekBackward"));
hgs
parents:
diff changeset
   263
            CreateVideoSpecificCmdL( EPbCmdStartVideoSeekingBackward );
hgs
parents:
diff changeset
   264
            break;
hgs
parents:
diff changeset
   265
        }
hgs
parents:
diff changeset
   266
        case EMPXPbvCmdEndSeek:
hgs
parents:
diff changeset
   267
        {
hgs
parents:
diff changeset
   268
            MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdEndSeek"));
hgs
parents:
diff changeset
   269
            CreateVideoSpecificCmdL( EPbCmdStopVideoSeeking );
hgs
parents:
diff changeset
   270
            break;
hgs
parents:
diff changeset
   271
        }
hgs
parents:
diff changeset
   272
        case EMPXPbvCmdPlayPause:
hgs
parents:
diff changeset
   273
        {
hgs
parents:
diff changeset
   274
            MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdPause"));
hgs
parents:
diff changeset
   275
            iPlaybackUtility->CommandL( EPbCmdPlayPause );
hgs
parents:
diff changeset
   276
            break;
hgs
parents:
diff changeset
   277
        }
hgs
parents:
diff changeset
   278
        case EMPXPbvCmdStop:
hgs
parents:
diff changeset
   279
        {
hgs
parents:
diff changeset
   280
            MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdStop"));
hgs
parents:
diff changeset
   281
            CreateGeneralPlaybackCommandL( EPbCmdStop );
hgs
parents:
diff changeset
   282
            break;
hgs
parents:
diff changeset
   283
        }
hgs
parents:
diff changeset
   284
        case EMPXPbvCmdDecreaseVolume:
hgs
parents:
diff changeset
   285
        {
hgs
parents:
diff changeset
   286
            MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdDecreaseVolume"));
hgs
parents:
diff changeset
   287
            HandleVolumeCmdL( EPbCmdDecreaseVolume );
hgs
parents:
diff changeset
   288
            break;
hgs
parents:
diff changeset
   289
        }
hgs
parents:
diff changeset
   290
        case EMPXPbvCmdIncreaseVolume:
hgs
parents:
diff changeset
   291
        {
hgs
parents:
diff changeset
   292
            MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdIncreaseVolume"));
hgs
parents:
diff changeset
   293
            HandleVolumeCmdL( EPbCmdIncreaseVolume );
hgs
parents:
diff changeset
   294
            break;
hgs
parents:
diff changeset
   295
        }
hgs
parents:
diff changeset
   296
        case EMPXPbvCmdNaturalAspectRatio:
hgs
parents:
diff changeset
   297
        {
hgs
parents:
diff changeset
   298
            MPX_DEBUG(
hgs
parents:
diff changeset
   299
                _L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdNaturalAspectRatio"));
hgs
parents:
diff changeset
   300
            SetAspectRatioL( EPbCmdNaturalAspectRatio );
hgs
parents:
diff changeset
   301
            break;
hgs
parents:
diff changeset
   302
        }
hgs
parents:
diff changeset
   303
        case EMPXPbvCmdZoomAspectRatio:
hgs
parents:
diff changeset
   304
        {
hgs
parents:
diff changeset
   305
            MPX_DEBUG(
hgs
parents:
diff changeset
   306
                _L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdZoomAspectRatio"));
hgs
parents:
diff changeset
   307
            SetAspectRatioL( EPbCmdZoomAspectRatio );
hgs
parents:
diff changeset
   308
            break;
hgs
parents:
diff changeset
   309
        }
hgs
parents:
diff changeset
   310
        case EMPXPbvCmdStretchAspectRatio:
hgs
parents:
diff changeset
   311
        {
hgs
parents:
diff changeset
   312
            MPX_DEBUG(
hgs
parents:
diff changeset
   313
                _L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdStretchAspectRatio"));
hgs
parents:
diff changeset
   314
            SetAspectRatioL( EPbCmdStretchAspectRatio );
hgs
parents:
diff changeset
   315
            break;
hgs
parents:
diff changeset
   316
        }
hgs
parents:
diff changeset
   317
        case EMPXPbvCmdMute:
hgs
parents:
diff changeset
   318
        {
hgs
parents:
diff changeset
   319
            MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdMute"));
hgs
parents:
diff changeset
   320
            HandleVolumeCmdL( EPbCmdMuteVolume );
hgs
parents:
diff changeset
   321
            break;
hgs
parents:
diff changeset
   322
        }
hgs
parents:
diff changeset
   323
        case EMPXPbvCmdUnMute:
hgs
parents:
diff changeset
   324
        {
hgs
parents:
diff changeset
   325
            MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdUnMute"));
hgs
parents:
diff changeset
   326
            HandleVolumeCmdL( EPbCmdUnMuteVolume );
hgs
parents:
diff changeset
   327
            break;
hgs
parents:
diff changeset
   328
        }
hgs
parents:
diff changeset
   329
        case EMPXPbvCmdShortPressBackward:
hgs
parents:
diff changeset
   330
        {
hgs
parents:
diff changeset
   331
            MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdShortPressBackward"));
hgs
parents:
diff changeset
   332
hgs
parents:
diff changeset
   333
            HandleShortPressBackwardL();
hgs
parents:
diff changeset
   334
            break;
hgs
parents:
diff changeset
   335
        }
hgs
parents:
diff changeset
   336
        case EMPXPbvCmdResetControls:
hgs
parents:
diff changeset
   337
        {
hgs
parents:
diff changeset
   338
            CreateControlsL();
hgs
parents:
diff changeset
   339
            iView->retrievePdlInformation();
hgs
parents:
diff changeset
   340
            break;
hgs
parents:
diff changeset
   341
        }
hgs
parents:
diff changeset
   342
        case EMPXPbvCmdNextListItem:
hgs
parents:
diff changeset
   343
        {
35
hgs
parents: 30
diff changeset
   344
            if ( iPlaylistView && iFileDetails->mMultiItemPlaylist )
30
hgs
parents:
diff changeset
   345
            {
hgs
parents:
diff changeset
   346
                iPlaybackUtility->CommandL( EPbCmdNext );
hgs
parents:
diff changeset
   347
            }
hgs
parents:
diff changeset
   348
            break;
hgs
parents:
diff changeset
   349
        }
hgs
parents:
diff changeset
   350
        case EMPXPbvCmdPreviousListItem:  
hgs
parents:
diff changeset
   351
        {
35
hgs
parents: 30
diff changeset
   352
            if ( iPlaylistView && iFileDetails->mMultiItemPlaylist )
30
hgs
parents:
diff changeset
   353
            {
hgs
parents:
diff changeset
   354
			    //
hgs
parents:
diff changeset
   355
			    // the command is being sent twice on purpose
hgs
parents:
diff changeset
   356
                // one EMPXPbvCmdPreviousListItem command only sets the position to 0  
hgs
parents:
diff changeset
   357
                // the second cmd actually goes to the previous item in the list
hgs
parents:
diff changeset
   358
				//
hgs
parents:
diff changeset
   359
                iPlaybackUtility->CommandL( EPbCmdPrevious );
hgs
parents:
diff changeset
   360
                iPlaybackUtility->CommandL( EPbCmdPrevious );  
hgs
parents:
diff changeset
   361
            }
hgs
parents:
diff changeset
   362
            break;
hgs
parents:
diff changeset
   363
        }
hgs
parents:
diff changeset
   364
        case EMPXPbvCmdEndOfClip:
hgs
parents:
diff changeset
   365
        {
hgs
parents:
diff changeset
   366
            CreateVideoSpecificCmdL( EPbCmdEndofClipReached );
hgs
parents:
diff changeset
   367
            break;
hgs
parents:
diff changeset
   368
        }
hgs
parents:
diff changeset
   369
        case EMPXPbvCmdCustomPause:
hgs
parents:
diff changeset
   370
        {
hgs
parents:
diff changeset
   371
            CreateVideoSpecificCmdL( EPbCmdCustomPause );
hgs
parents:
diff changeset
   372
            break;
hgs
parents:
diff changeset
   373
        }
hgs
parents:
diff changeset
   374
        case EMPXPbvCmdCustomPlay:
hgs
parents:
diff changeset
   375
        {
hgs
parents:
diff changeset
   376
            CreateVideoSpecificCmdL( EPbCmdCustomPlay );
hgs
parents:
diff changeset
   377
            break;
hgs
parents:
diff changeset
   378
        }
hgs
parents:
diff changeset
   379
    }
hgs
parents:
diff changeset
   380
}
hgs
parents:
diff changeset
   381
hgs
parents:
diff changeset
   382
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   383
// From MMPXPlaybackObserver
hgs
parents:
diff changeset
   384
// Handle playback message.
hgs
parents:
diff changeset
   385
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   386
//
hgs
parents:
diff changeset
   387
void CMPXVideoViewWrapper::HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError )
hgs
parents:
diff changeset
   388
{
hgs
parents:
diff changeset
   389
    MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::HandlePlaybackMessage()"),
hgs
parents:
diff changeset
   390
                   _L("aError = %d"), aError );
hgs
parents:
diff changeset
   391
hgs
parents:
diff changeset
   392
    if ( aError )
hgs
parents:
diff changeset
   393
    {
hgs
parents:
diff changeset
   394
        MPX_TRAPD( err, DoHandleErrorPlaybackMessageL( aError ) );
hgs
parents:
diff changeset
   395
    }
hgs
parents:
diff changeset
   396
    else if ( aMessage )
hgs
parents:
diff changeset
   397
    {
hgs
parents:
diff changeset
   398
        MPX_TRAPD( err, DoHandlePlaybackMessageL( aMessage ) );
hgs
parents:
diff changeset
   399
    }
hgs
parents:
diff changeset
   400
}
hgs
parents:
diff changeset
   401
hgs
parents:
diff changeset
   402
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   403
// Request for the media object
hgs
parents:
diff changeset
   404
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   405
//
hgs
parents:
diff changeset
   406
void CMPXVideoViewWrapper::RequestMediaL()
hgs
parents:
diff changeset
   407
{
hgs
parents:
diff changeset
   408
    MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::RequestMediaL()"));
hgs
parents:
diff changeset
   409
hgs
parents:
diff changeset
   410
    if ( ! iMediaRequested && iPlaybackUtility->StateL() == EPbStateInitialised )
hgs
parents:
diff changeset
   411
    {
hgs
parents:
diff changeset
   412
        iMediaRequested = ETrue;
hgs
parents:
diff changeset
   413
hgs
parents:
diff changeset
   414
        //
hgs
parents:
diff changeset
   415
        //  Request the volume for the controls
hgs
parents:
diff changeset
   416
        //
hgs
parents:
diff changeset
   417
        iPlaybackUtility->PropertyL( *this, EPbPropertyVolume );
hgs
parents:
diff changeset
   418
hgs
parents:
diff changeset
   419
        //
hgs
parents:
diff changeset
   420
        //  Request the clip's meta data
hgs
parents:
diff changeset
   421
        //
hgs
parents:
diff changeset
   422
        MMPXSource* s = iPlaybackUtility->Source();
hgs
parents:
diff changeset
   423
hgs
parents:
diff changeset
   424
        if ( s )
hgs
parents:
diff changeset
   425
        {
hgs
parents:
diff changeset
   426
            RArray<TMPXAttribute> attrs;
hgs
parents:
diff changeset
   427
            CleanupClosePushL(attrs);
hgs
parents:
diff changeset
   428
hgs
parents:
diff changeset
   429
            //
hgs
parents:
diff changeset
   430
            //  General Media Attributes
hgs
parents:
diff changeset
   431
            //
hgs
parents:
diff changeset
   432
            attrs.Append( KMPXMediaGeneralUri |
hgs
parents:
diff changeset
   433
                          KMPXMediaGeneralDuration |
hgs
parents:
diff changeset
   434
                          KMPXMediaGeneralTitle |
hgs
parents:
diff changeset
   435
                          KMPXMediaGeneralMimeType );
hgs
parents:
diff changeset
   436
hgs
parents:
diff changeset
   437
            //
hgs
parents:
diff changeset
   438
            //  Video specific Attributes
hgs
parents:
diff changeset
   439
            //
hgs
parents:
diff changeset
   440
            attrs.Append( KMPXMediaVideoAll );
hgs
parents:
diff changeset
   441
hgs
parents:
diff changeset
   442
            // Set the attribute to always route the media call to playback plugin
hgs
parents:
diff changeset
   443
            CMPXAttributeSpecs* specs = CMPXAttributeSpecs::NewL();
hgs
parents:
diff changeset
   444
            CleanupStack::PushL( specs );
hgs
parents:
diff changeset
   445
hgs
parents:
diff changeset
   446
            specs->SetTObjectValueL<TBool>(KMPXMediaGeneralExtMediaRedirect, ETrue);
hgs
parents:
diff changeset
   447
hgs
parents:
diff changeset
   448
            s->MediaL( attrs.Array(), *this, specs);
hgs
parents:
diff changeset
   449
hgs
parents:
diff changeset
   450
            CleanupStack::PopAndDestroy( specs );
hgs
parents:
diff changeset
   451
            CleanupStack::PopAndDestroy( &attrs );
hgs
parents:
diff changeset
   452
        }
hgs
parents:
diff changeset
   453
    }
hgs
parents:
diff changeset
   454
}
hgs
parents:
diff changeset
   455
hgs
parents:
diff changeset
   456
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   457
//   CMPXVideoViewWrapper::DoHandlePlaybackMessageL()
hgs
parents:
diff changeset
   458
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   459
//
hgs
parents:
diff changeset
   460
void CMPXVideoViewWrapper::DoHandlePlaybackMessageL( CMPXMessage* aMessage )
hgs
parents:
diff changeset
   461
{
hgs
parents:
diff changeset
   462
    TMPXMessageId id( *(aMessage->Value<TMPXMessageId>(KMPXMessageGeneralId)) );
hgs
parents:
diff changeset
   463
hgs
parents:
diff changeset
   464
    MPX_ENTER_EXIT(
hgs
parents:
diff changeset
   465
        _L("CMPXVideoViewWrapper::DoHandlePlaybackMessageL()"),
hgs
parents:
diff changeset
   466
        _L("id = 0x%08x"), id );
hgs
parents:
diff changeset
   467
hgs
parents:
diff changeset
   468
    if ( KMPXMessageGeneral == id )
hgs
parents:
diff changeset
   469
    {
hgs
parents:
diff changeset
   470
        HandleGeneralPlaybackMessageL( aMessage );
hgs
parents:
diff changeset
   471
    }
hgs
parents:
diff changeset
   472
    else if ( KMPXMediaIdVideoPlayback == id )
hgs
parents:
diff changeset
   473
    {
hgs
parents:
diff changeset
   474
        HandleVideoPlaybackMessage( aMessage );
hgs
parents:
diff changeset
   475
    }
hgs
parents:
diff changeset
   476
    else if ( KMPXMediaIdVideoDisplaySyncMessage == id )
hgs
parents:
diff changeset
   477
    {
hgs
parents:
diff changeset
   478
        if ( iDisplayHandler )
hgs
parents:
diff changeset
   479
        {
hgs
parents:
diff changeset
   480
            iDisplayHandler->HandleVideoDisplayMessageL( aMessage );
hgs
parents:
diff changeset
   481
        }
hgs
parents:
diff changeset
   482
hgs
parents:
diff changeset
   483
        //
hgs
parents:
diff changeset
   484
        //  Signal Sync Message handling is complete
hgs
parents:
diff changeset
   485
        //
hgs
parents:
diff changeset
   486
        iPlaybackUtility->CommandL( EPbCmdSyncMsgComplete );
hgs
parents:
diff changeset
   487
    }
hgs
parents:
diff changeset
   488
}
hgs
parents:
diff changeset
   489
hgs
parents:
diff changeset
   490
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   491
//   CMPXVideoViewWrapper::HandleGeneralPlaybackMessageL()
hgs
parents:
diff changeset
   492
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   493
//
hgs
parents:
diff changeset
   494
void CMPXVideoViewWrapper::HandleGeneralPlaybackMessageL( CMPXMessage* aMessage )
hgs
parents:
diff changeset
   495
{
hgs
parents:
diff changeset
   496
    TInt event( *aMessage->Value<TInt>( KMPXMessageGeneralEvent ) );
hgs
parents:
diff changeset
   497
    TInt type( *aMessage->Value<TInt>( KMPXMessageGeneralType ) );
hgs
parents:
diff changeset
   498
    TInt data( *aMessage->Value<TInt>( KMPXMessageGeneralData ) );
hgs
parents:
diff changeset
   499
hgs
parents:
diff changeset
   500
    MPX_DEBUG(
hgs
parents:
diff changeset
   501
      _L("CMPXVideoViewWrapper::HandleGeneralPlaybackMessageL() event = %d type = %d  value = %d"),
hgs
parents:
diff changeset
   502
      event, type, data );
hgs
parents:
diff changeset
   503
hgs
parents:
diff changeset
   504
    switch ( event )
hgs
parents:
diff changeset
   505
    {
hgs
parents:
diff changeset
   506
        case TMPXPlaybackMessage::EStateChanged:
hgs
parents:
diff changeset
   507
        {
hgs
parents:
diff changeset
   508
            DoHandleStateChangeL( type );
hgs
parents:
diff changeset
   509
hgs
parents:
diff changeset
   510
            break;
hgs
parents:
diff changeset
   511
        }
hgs
parents:
diff changeset
   512
        case TMPXPlaybackMessage::EPropertyChanged:
hgs
parents:
diff changeset
   513
        {
hgs
parents:
diff changeset
   514
            TMPXPlaybackProperty property(
hgs
parents:
diff changeset
   515
                 static_cast<TMPXPlaybackProperty>( type ) );
hgs
parents:
diff changeset
   516
hgs
parents:
diff changeset
   517
            HandlePropertyL( property, data, KErrNone );
hgs
parents:
diff changeset
   518
            break;
hgs
parents:
diff changeset
   519
        }
hgs
parents:
diff changeset
   520
        case TMPXPlaybackMessage::EDownloadPositionChanged:
hgs
parents:
diff changeset
   521
        {
hgs
parents:
diff changeset
   522
            if ( iControlsController )
hgs
parents:
diff changeset
   523
            {
hgs
parents:
diff changeset
   524
                iControlsController->handleEvent( EMPXControlCmdDownloadUpdated, data );
hgs
parents:
diff changeset
   525
            }
hgs
parents:
diff changeset
   526
hgs
parents:
diff changeset
   527
            break;
hgs
parents:
diff changeset
   528
        }
hgs
parents:
diff changeset
   529
        case TMPXPlaybackMessage::EDownloadStateChanged:
hgs
parents:
diff changeset
   530
        {
hgs
parents:
diff changeset
   531
            break;
hgs
parents:
diff changeset
   532
        }
hgs
parents:
diff changeset
   533
        case TMPXPlaybackMessage::ECommandReceived:
hgs
parents:
diff changeset
   534
        {
hgs
parents:
diff changeset
   535
            break;
hgs
parents:
diff changeset
   536
        }
hgs
parents:
diff changeset
   537
        case TMPXPlaybackMessage::EReachedEndOfPlaylist:
hgs
parents:
diff changeset
   538
        {
hgs
parents:
diff changeset
   539
            iView->closePlaybackView();
hgs
parents:
diff changeset
   540
            break;
hgs
parents:
diff changeset
   541
        }
hgs
parents:
diff changeset
   542
        case TMPXPlaybackMessage::ESongChanged:
hgs
parents:
diff changeset
   543
        {
hgs
parents:
diff changeset
   544
            break;
hgs
parents:
diff changeset
   545
        }
hgs
parents:
diff changeset
   546
    }
hgs
parents:
diff changeset
   547
}
hgs
parents:
diff changeset
   548
hgs
parents:
diff changeset
   549
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   550
//   CMPXVideoViewWrapper::HandleVideoPlaybackMessage()
hgs
parents:
diff changeset
   551
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   552
//
hgs
parents:
diff changeset
   553
void CMPXVideoViewWrapper::HandleVideoPlaybackMessage( CMPXMessage* aMessage )
hgs
parents:
diff changeset
   554
{
hgs
parents:
diff changeset
   555
    TMPXVideoPlaybackCommand message =
hgs
parents:
diff changeset
   556
        ( *(aMessage->Value<TMPXVideoPlaybackCommand>(KMPXMediaVideoPlaybackCommand)) );
hgs
parents:
diff changeset
   557
hgs
parents:
diff changeset
   558
    MPX_DEBUG(
hgs
parents:
diff changeset
   559
      _L("CMPXVideoViewWrapper::HandleVideoPlaybackMessage() message = %d"), message );
hgs
parents:
diff changeset
   560
hgs
parents:
diff changeset
   561
    switch ( message )
hgs
parents:
diff changeset
   562
    {
hgs
parents:
diff changeset
   563
        case EPbCmdPluginError:
hgs
parents:
diff changeset
   564
        {
hgs
parents:
diff changeset
   565
            TInt error( *aMessage->Value<TInt>( KMPXMediaVideoError ) );
hgs
parents:
diff changeset
   566
hgs
parents:
diff changeset
   567
            iView->handlePluginError( error );
hgs
parents:
diff changeset
   568
            break;
hgs
parents:
diff changeset
   569
        }
hgs
parents:
diff changeset
   570
        case EPbCmdTvOutEvent:
hgs
parents:
diff changeset
   571
        {
hgs
parents:
diff changeset
   572
            TMPXVideoPlaybackControlCommandIds cmdId = EMPXControlCmdTvOutDisconnected;
hgs
parents:
diff changeset
   573
hgs
parents:
diff changeset
   574
            TBool tvOutConnected( *aMessage->Value<TInt>( KMPXMediaVideoTvOutConnected ) );
hgs
parents:
diff changeset
   575
            TBool playbackAllowed = ETrue;
hgs
parents:
diff changeset
   576
hgs
parents:
diff changeset
   577
            if ( tvOutConnected )
hgs
parents:
diff changeset
   578
            {
hgs
parents:
diff changeset
   579
                cmdId = EMPXControlCmdTvOutConnected;
hgs
parents:
diff changeset
   580
hgs
parents:
diff changeset
   581
                playbackAllowed = *aMessage->Value<TInt>( KMPXMediaVideoTvOutPlayAllowed );
hgs
parents:
diff changeset
   582
            }
hgs
parents:
diff changeset
   583
hgs
parents:
diff changeset
   584
            if ( iUserInputHandler )
hgs
parents:
diff changeset
   585
            {
hgs
parents:
diff changeset
   586
                TRAP_IGNORE(iUserInputHandler->HandleTVOutEventL( tvOutConnected ));     
hgs
parents:
diff changeset
   587
            }
hgs
parents:
diff changeset
   588
hgs
parents:
diff changeset
   589
            if ( iControlsController )
hgs
parents:
diff changeset
   590
            {
hgs
parents:
diff changeset
   591
                iControlsController->handleEvent( cmdId, playbackAllowed );
hgs
parents:
diff changeset
   592
            }
hgs
parents:
diff changeset
   593
            break;
hgs
parents:
diff changeset
   594
        }
hgs
parents:
diff changeset
   595
    }
hgs
parents:
diff changeset
   596
}
hgs
parents:
diff changeset
   597
hgs
parents:
diff changeset
   598
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   599
//   CMPXVideoViewWrapper::HandlePluginError()
hgs
parents:
diff changeset
   600
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   601
//
hgs
parents:
diff changeset
   602
void CMPXVideoViewWrapper::HandlePluginError( int aError )
hgs
parents:
diff changeset
   603
{
hgs
parents:
diff changeset
   604
    MPX_DEBUG(
hgs
parents:
diff changeset
   605
      _L("CMPXVideoViewWrapper::HandlePluginError() aError = %d"), aError );
hgs
parents:
diff changeset
   606
hgs
parents:
diff changeset
   607
    iView->handlePluginError( aError );
hgs
parents:
diff changeset
   608
}
hgs
parents:
diff changeset
   609
hgs
parents:
diff changeset
   610
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   611
//   Handle playback state changes
hgs
parents:
diff changeset
   612
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   613
//
hgs
parents:
diff changeset
   614
void CMPXVideoViewWrapper::DoHandleStateChangeL( TInt aNewState )
hgs
parents:
diff changeset
   615
{
hgs
parents:
diff changeset
   616
    MPX_ENTER_EXIT(
hgs
parents:
diff changeset
   617
        _L("CMPXVideoViewWrapper::DoHandleStateChangeL()"),
hgs
parents:
diff changeset
   618
        _L("aNewState = %d"), aNewState );
hgs
parents:
diff changeset
   619
hgs
parents:
diff changeset
   620
    if ( aNewState != iPlaybackState )
hgs
parents:
diff changeset
   621
    {
hgs
parents:
diff changeset
   622
        switch ( aNewState )
hgs
parents:
diff changeset
   623
        {
hgs
parents:
diff changeset
   624
            case EPbStateInitialising:
hgs
parents:
diff changeset
   625
            {
hgs
parents:
diff changeset
   626
                if ( iControlsController )
hgs
parents:
diff changeset
   627
                {
hgs
parents:
diff changeset
   628
                    //
hgs
parents:
diff changeset
   629
                    //  If transitioning from Not Initialized to Initialising there is
hgs
parents:
diff changeset
   630
                    //  no need to update the playback information that was gathered
hgs
parents:
diff changeset
   631
                    //  when the container was created
hgs
parents:
diff changeset
   632
                    //
hgs
parents:
diff changeset
   633
                    if ( iPlaybackState != EPbStateNotInitialised )
hgs
parents:
diff changeset
   634
                    {
hgs
parents:
diff changeset
   635
                        iMediaRequested = EFalse;
hgs
parents:
diff changeset
   636
                        HandleCommandL( EMPXPbvCmdResetControls );
hgs
parents:
diff changeset
   637
hgs
parents:
diff changeset
   638
                        if ( iFileDetails )
hgs
parents:
diff changeset
   639
                        {    
hgs
parents:
diff changeset
   640
                            iFileDetails->clearFileDetails();
hgs
parents:
diff changeset
   641
                        }
hgs
parents:
diff changeset
   642
                    }
hgs
parents:
diff changeset
   643
                }
hgs
parents:
diff changeset
   644
                break;
hgs
parents:
diff changeset
   645
            }
hgs
parents:
diff changeset
   646
            case EPbStateBuffering:
hgs
parents:
diff changeset
   647
            {
hgs
parents:
diff changeset
   648
                HandleBufferingStateL();
hgs
parents:
diff changeset
   649
hgs
parents:
diff changeset
   650
                break;
hgs
parents:
diff changeset
   651
            }
hgs
parents:
diff changeset
   652
            case EPbStatePluginSeeking:
hgs
parents:
diff changeset
   653
            {
hgs
parents:
diff changeset
   654
                // no-op
hgs
parents:
diff changeset
   655
                break;
hgs
parents:
diff changeset
   656
            }
hgs
parents:
diff changeset
   657
            case EPbStateStopped:
hgs
parents:
diff changeset
   658
            {
hgs
parents:
diff changeset
   659
                if ( iPlaylistView && iDisplayHandler )
hgs
parents:
diff changeset
   660
                {
hgs
parents:
diff changeset
   661
                    iDisplayHandler->RemoveDisplayWindow();
hgs
parents:
diff changeset
   662
                }
hgs
parents:
diff changeset
   663
hgs
parents:
diff changeset
   664
                if ( iFileDetails->mMultiItemPlaylist )
hgs
parents:
diff changeset
   665
                {
hgs
parents:
diff changeset
   666
                    iView->handleStoppedState();
hgs
parents:
diff changeset
   667
                }
hgs
parents:
diff changeset
   668
                else
hgs
parents:
diff changeset
   669
                {
hgs
parents:
diff changeset
   670
                    iView->closePlaybackView();  
hgs
parents:
diff changeset
   671
                }
hgs
parents:
diff changeset
   672
hgs
parents:
diff changeset
   673
                break;
hgs
parents:
diff changeset
   674
            }
hgs
parents:
diff changeset
   675
            case EPbStateInitialised:
hgs
parents:
diff changeset
   676
            {
hgs
parents:
diff changeset
   677
                RequestMediaL();
hgs
parents:
diff changeset
   678
            	break;
hgs
parents:
diff changeset
   679
            }
hgs
parents:
diff changeset
   680
            default:
hgs
parents:
diff changeset
   681
            {
hgs
parents:
diff changeset
   682
                break;
hgs
parents:
diff changeset
   683
            }
hgs
parents:
diff changeset
   684
        }
hgs
parents:
diff changeset
   685
hgs
parents:
diff changeset
   686
        iPlaybackState = (TMPXPlaybackState)aNewState;
hgs
parents:
diff changeset
   687
hgs
parents:
diff changeset
   688
        if ( iControlsController )
hgs
parents:
diff changeset
   689
        {
hgs
parents:
diff changeset
   690
            iControlsController->handleEvent( EMPXControlCmdStateChanged, aNewState );
hgs
parents:
diff changeset
   691
        }
hgs
parents:
diff changeset
   692
    }
hgs
parents:
diff changeset
   693
}
hgs
parents:
diff changeset
   694
hgs
parents:
diff changeset
   695
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   696
//   CMPXVideoViewWrapper::HandleBufferingStateL
hgs
parents:
diff changeset
   697
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   698
//
hgs
parents:
diff changeset
   699
void CMPXVideoViewWrapper::HandleBufferingStateL()
hgs
parents:
diff changeset
   700
{
hgs
parents:
diff changeset
   701
    MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleBufferingStateL()"));
hgs
parents:
diff changeset
   702
hgs
parents:
diff changeset
   703
}
hgs
parents:
diff changeset
   704
hgs
parents:
diff changeset
   705
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   706
// Handle playback error message.
hgs
parents:
diff changeset
   707
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   708
//
hgs
parents:
diff changeset
   709
void CMPXVideoViewWrapper::DoHandleErrorPlaybackMessageL( TInt aError )
hgs
parents:
diff changeset
   710
{
hgs
parents:
diff changeset
   711
    MPX_ENTER_EXIT( _L("CMPXVideoViewWrapper::DoHandleErrorPlaybackMessageL()"),
hgs
parents:
diff changeset
   712
                    _L("aError = %d"), aError );
hgs
parents:
diff changeset
   713
hgs
parents:
diff changeset
   714
    HandleCommandL( EMPXPbvCmdResetControls );
hgs
parents:
diff changeset
   715
    iView->handlePluginError(aError);
hgs
parents:
diff changeset
   716
}
hgs
parents:
diff changeset
   717
hgs
parents:
diff changeset
   718
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   719
// CMPXVideoViewWrapper::HandlePlaybackCommandComplete()
hgs
parents:
diff changeset
   720
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   721
//
hgs
parents:
diff changeset
   722
void CMPXVideoViewWrapper::HandlePlaybackCommandComplete( CMPXCommand* /*aCommandResult*/,
hgs
parents:
diff changeset
   723
                                                         TInt /*aError*/ )
hgs
parents:
diff changeset
   724
{
hgs
parents:
diff changeset
   725
    MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::HandlePlaybackCommandComplete()"));
hgs
parents:
diff changeset
   726
}
hgs
parents:
diff changeset
   727
hgs
parents:
diff changeset
   728
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   729
// CMPXVideoViewWrapper::ParseMetaDataL()
hgs
parents:
diff changeset
   730
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   731
//
hgs
parents:
diff changeset
   732
void CMPXVideoViewWrapper::ParseMetaDataL( const CMPXMessage& aMedia )
hgs
parents:
diff changeset
   733
{
hgs
parents:
diff changeset
   734
    MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::ParseMetaDataL()"));
hgs
parents:
diff changeset
   735
hgs
parents:
diff changeset
   736
    //
hgs
parents:
diff changeset
   737
    //  Clip Name
hgs
parents:
diff changeset
   738
    //
hgs
parents:
diff changeset
   739
    if ( aMedia.IsSupported( KMPXMediaGeneralUri ) )
hgs
parents:
diff changeset
   740
    {
hgs
parents:
diff changeset
   741
        TPtrC uri( aMedia.ValueText( KMPXMediaGeneralUri ) );
hgs
parents:
diff changeset
   742
        const QString qClipname( (QChar*)uri.Ptr(), uri.Length() );
hgs
parents:
diff changeset
   743
        iFileDetails->mClipName = qClipname;
hgs
parents:
diff changeset
   744
    }
hgs
parents:
diff changeset
   745
hgs
parents:
diff changeset
   746
    //
hgs
parents:
diff changeset
   747
    //  Title
hgs
parents:
diff changeset
   748
    //
hgs
parents:
diff changeset
   749
    if ( aMedia.IsSupported( KMPXMediaGeneralTitle ) )
hgs
parents:
diff changeset
   750
    {
hgs
parents:
diff changeset
   751
        TPtrC title( aMedia.ValueText( KMPXMediaGeneralTitle ) );
hgs
parents:
diff changeset
   752
        const QString qTitle( (QChar*)title.Ptr(), title.Length() );
hgs
parents:
diff changeset
   753
        iFileDetails->mTitle = qTitle;
hgs
parents:
diff changeset
   754
    }
hgs
parents:
diff changeset
   755
hgs
parents:
diff changeset
   756
    //
hgs
parents:
diff changeset
   757
    //  Artist
hgs
parents:
diff changeset
   758
    //
hgs
parents:
diff changeset
   759
    if ( aMedia.IsSupported( KMPXMediaVideoArtist ) )
hgs
parents:
diff changeset
   760
    {
hgs
parents:
diff changeset
   761
        TPtrC artist( aMedia.ValueText( KMPXMediaVideoArtist ) );
hgs
parents:
diff changeset
   762
        const QString qArtist( (QChar*)artist.Ptr(), artist.Length() );
hgs
parents:
diff changeset
   763
        iFileDetails->mArtist = qArtist;
hgs
parents:
diff changeset
   764
    }
hgs
parents:
diff changeset
   765
hgs
parents:
diff changeset
   766
    //
hgs
parents:
diff changeset
   767
    //  Mime Type
hgs
parents:
diff changeset
   768
    //
hgs
parents:
diff changeset
   769
    if ( aMedia.IsSupported( KMPXMediaGeneralMimeType ) )
hgs
parents:
diff changeset
   770
    {
hgs
parents:
diff changeset
   771
        TPtrC mimeType( aMedia.ValueText( KMPXMediaGeneralMimeType ) );
hgs
parents:
diff changeset
   772
        const QString qMimeType( (QChar*)mimeType.Ptr(), mimeType.Length() );
hgs
parents:
diff changeset
   773
        iFileDetails->mMimeType = qMimeType;
hgs
parents:
diff changeset
   774
    }
hgs
parents:
diff changeset
   775
hgs
parents:
diff changeset
   776
    //
hgs
parents:
diff changeset
   777
    //  Duration
hgs
parents:
diff changeset
   778
    //
hgs
parents:
diff changeset
   779
    if ( aMedia.IsSupported( KMPXMediaGeneralDuration ) )
hgs
parents:
diff changeset
   780
    {
hgs
parents:
diff changeset
   781
        iFileDetails->mDuration = aMedia.ValueTObjectL<TInt>( KMPXMediaGeneralDuration );
hgs
parents:
diff changeset
   782
    }
hgs
parents:
diff changeset
   783
hgs
parents:
diff changeset
   784
    //
hgs
parents:
diff changeset
   785
    //  Audio Enabled
hgs
parents:
diff changeset
   786
    //
hgs
parents:
diff changeset
   787
    if ( aMedia.IsSupported( KMPXMediaVideoAudioEnabled ) )
hgs
parents:
diff changeset
   788
    {
hgs
parents:
diff changeset
   789
        iFileDetails->mAudioEnabled = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoAudioEnabled );
hgs
parents:
diff changeset
   790
    }
hgs
parents:
diff changeset
   791
hgs
parents:
diff changeset
   792
    //
hgs
parents:
diff changeset
   793
    //  Video Enabled
hgs
parents:
diff changeset
   794
    //
hgs
parents:
diff changeset
   795
    if ( aMedia.IsSupported( KMPXMediaVideoVideoEnabled ) )
hgs
parents:
diff changeset
   796
    {
hgs
parents:
diff changeset
   797
        iFileDetails->mVideoEnabled = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoVideoEnabled );
hgs
parents:
diff changeset
   798
    }
hgs
parents:
diff changeset
   799
hgs
parents:
diff changeset
   800
    //
hgs
parents:
diff changeset
   801
    //  Partial Playback
hgs
parents:
diff changeset
   802
    //
hgs
parents:
diff changeset
   803
    if ( aMedia.IsSupported( KMPXMediaVideoPartialPlayback ) )
hgs
parents:
diff changeset
   804
    {
hgs
parents:
diff changeset
   805
        iFileDetails->mPartialPlayback =
hgs
parents:
diff changeset
   806
            aMedia.ValueTObjectL<TInt>( KMPXMediaVideoPartialPlayback );
hgs
parents:
diff changeset
   807
    }
hgs
parents:
diff changeset
   808
hgs
parents:
diff changeset
   809
    //
hgs
parents:
diff changeset
   810
    //  Playback Mode
hgs
parents:
diff changeset
   811
    //
hgs
parents:
diff changeset
   812
    if ( aMedia.IsSupported( KMPXMediaVideoPlaybackMode ) )
hgs
parents:
diff changeset
   813
    {
hgs
parents:
diff changeset
   814
        iFileDetails->mPlaybackMode =
hgs
parents:
diff changeset
   815
            (TMPXVideoMode)aMedia.ValueTObjectL<TInt>( KMPXMediaVideoPlaybackMode );
hgs
parents:
diff changeset
   816
    }
hgs
parents:
diff changeset
   817
hgs
parents:
diff changeset
   818
    //
hgs
parents:
diff changeset
   819
    //  Seekable
hgs
parents:
diff changeset
   820
    //
hgs
parents:
diff changeset
   821
    if ( aMedia.IsSupported( KMPXMediaVideoSeekable ) )
hgs
parents:
diff changeset
   822
    {
hgs
parents:
diff changeset
   823
        iFileDetails->mSeekable = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoSeekable );
hgs
parents:
diff changeset
   824
    }
hgs
parents:
diff changeset
   825
hgs
parents:
diff changeset
   826
    //
hgs
parents:
diff changeset
   827
    //  Pausable
hgs
parents:
diff changeset
   828
    //
hgs
parents:
diff changeset
   829
    if ( aMedia.IsSupported( KMPXMediaVideoPausableStream ) )
hgs
parents:
diff changeset
   830
    {
hgs
parents:
diff changeset
   831
        iFileDetails->mPausableStream = aMedia.ValueTObjectL<TBool>( KMPXMediaVideoPausableStream );
hgs
parents:
diff changeset
   832
    }
hgs
parents:
diff changeset
   833
hgs
parents:
diff changeset
   834
    //
hgs
parents:
diff changeset
   835
    //  Video Height
hgs
parents:
diff changeset
   836
    //
hgs
parents:
diff changeset
   837
    if ( aMedia.IsSupported( KMPXMediaVideoHeight ) )
hgs
parents:
diff changeset
   838
    {
hgs
parents:
diff changeset
   839
        iFileDetails->mVideoHeight = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoHeight );
hgs
parents:
diff changeset
   840
    }
hgs
parents:
diff changeset
   841
hgs
parents:
diff changeset
   842
    //
hgs
parents:
diff changeset
   843
    //  Video Width
hgs
parents:
diff changeset
   844
    //
hgs
parents:
diff changeset
   845
    if ( aMedia.IsSupported( KMPXMediaVideoWidth ) )
hgs
parents:
diff changeset
   846
    {
hgs
parents:
diff changeset
   847
        iFileDetails->mVideoWidth = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoWidth );
hgs
parents:
diff changeset
   848
    }
hgs
parents:
diff changeset
   849
hgs
parents:
diff changeset
   850
    //
hgs
parents:
diff changeset
   851
    //  TV-Out Connected
hgs
parents:
diff changeset
   852
    //
hgs
parents:
diff changeset
   853
    if ( aMedia.IsSupported( KMPXMediaVideoTvOutConnected ) )
hgs
parents:
diff changeset
   854
    {
hgs
parents:
diff changeset
   855
        iFileDetails->mTvOutConnected = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoTvOutConnected );
hgs
parents:
diff changeset
   856
    }
hgs
parents:
diff changeset
   857
hgs
parents:
diff changeset
   858
    //
hgs
parents:
diff changeset
   859
    //  TV-Out Playback Allowed
hgs
parents:
diff changeset
   860
    //
hgs
parents:
diff changeset
   861
    if ( aMedia.IsSupported( KMPXMediaVideoTvOutPlayAllowed ) )
hgs
parents:
diff changeset
   862
    {
hgs
parents:
diff changeset
   863
        iFileDetails->mTvOutPlayAllowed =
hgs
parents:
diff changeset
   864
            aMedia.ValueTObjectL<TInt>( KMPXMediaVideoTvOutPlayAllowed );
hgs
parents:
diff changeset
   865
    }
hgs
parents:
diff changeset
   866
hgs
parents:
diff changeset
   867
    //
hgs
parents:
diff changeset
   868
    //  BitRate
hgs
parents:
diff changeset
   869
    //
hgs
parents:
diff changeset
   870
    if ( aMedia.IsSupported( KMPXMediaVideoBitRate ) )
hgs
parents:
diff changeset
   871
    {
hgs
parents:
diff changeset
   872
        iFileDetails->mBitRate = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoBitRate );
hgs
parents:
diff changeset
   873
    }
hgs
parents:
diff changeset
   874
hgs
parents:
diff changeset
   875
    //
hgs
parents:
diff changeset
   876
    //  Drm Protected
hgs
parents:
diff changeset
   877
    //
hgs
parents:
diff changeset
   878
    if ( aMedia.IsSupported( KMPXMediaVideoDrmProtected ) )
hgs
parents:
diff changeset
   879
    {
hgs
parents:
diff changeset
   880
        iFileDetails->mDrmProtected = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoDrmProtected );
hgs
parents:
diff changeset
   881
    }
hgs
parents:
diff changeset
   882
    
hgs
parents:
diff changeset
   883
    //
hgs
parents:
diff changeset
   884
    //  Description
hgs
parents:
diff changeset
   885
    //
hgs
parents:
diff changeset
   886
    if ( aMedia.IsSupported( KMPXMediaVideoDescription ) )
hgs
parents:
diff changeset
   887
    {
hgs
parents:
diff changeset
   888
        TPtrC description( aMedia.ValueText( KMPXMediaVideoDescription ) );
hgs
parents:
diff changeset
   889
        const QString qDescription( (QChar*)description.Ptr(), description.Length() );
hgs
parents:
diff changeset
   890
        iFileDetails->mDescription = qDescription;
hgs
parents:
diff changeset
   891
    }
hgs
parents:
diff changeset
   892
    
hgs
parents:
diff changeset
   893
    //
hgs
parents:
diff changeset
   894
    //  Location
hgs
parents:
diff changeset
   895
    //
hgs
parents:
diff changeset
   896
    if ( aMedia.IsSupported( KMPXMediaVideoLocation ) )
hgs
parents:
diff changeset
   897
    {
hgs
parents:
diff changeset
   898
        TPtrC location( aMedia.ValueText( KMPXMediaVideoLocation ) );
hgs
parents:
diff changeset
   899
        const QString qLocation( (QChar*)location.Ptr(), location.Length() );
hgs
parents:
diff changeset
   900
        iFileDetails->mLocation = qLocation;
hgs
parents:
diff changeset
   901
    }
hgs
parents:
diff changeset
   902
    
hgs
parents:
diff changeset
   903
    //
hgs
parents:
diff changeset
   904
    //  Copyright
hgs
parents:
diff changeset
   905
    //
hgs
parents:
diff changeset
   906
    if ( aMedia.IsSupported( KMPXMediaVideoCopyright ) )
hgs
parents:
diff changeset
   907
    {
hgs
parents:
diff changeset
   908
        TPtrC copyright( aMedia.ValueText( KMPXMediaVideoCopyright ) );
hgs
parents:
diff changeset
   909
        const QString qCopyright( (QChar*)copyright.Ptr(), copyright.Length() );
hgs
parents:
diff changeset
   910
        iFileDetails->mCopyright = qCopyright;
hgs
parents:
diff changeset
   911
    }
hgs
parents:
diff changeset
   912
    
hgs
parents:
diff changeset
   913
    //
hgs
parents:
diff changeset
   914
    //  Language
hgs
parents:
diff changeset
   915
    //
hgs
parents:
diff changeset
   916
    if ( aMedia.IsSupported( KMPXMediaVideoLanguage ) )
hgs
parents:
diff changeset
   917
    {
hgs
parents:
diff changeset
   918
        TPtrC language( aMedia.ValueText( KMPXMediaVideoLanguage ) );
hgs
parents:
diff changeset
   919
        const QString qLanguage( (QChar*)language.Ptr(), language.Length() );
hgs
parents:
diff changeset
   920
        iFileDetails->mLanguage = qLanguage;
hgs
parents:
diff changeset
   921
    }
hgs
parents:
diff changeset
   922
    
hgs
parents:
diff changeset
   923
    //
hgs
parents:
diff changeset
   924
    //  Keywords
hgs
parents:
diff changeset
   925
    //
hgs
parents:
diff changeset
   926
    if ( aMedia.IsSupported( KMPXMediaVideoKeywords ) )
hgs
parents:
diff changeset
   927
    {
hgs
parents:
diff changeset
   928
        TPtrC keywords( aMedia.ValueText( KMPXMediaVideoKeywords ) );
hgs
parents:
diff changeset
   929
        const QString qKeywords( (QChar*)keywords.Ptr(), keywords.Length() );
hgs
parents:
diff changeset
   930
        iFileDetails->mKeywords = qKeywords;
hgs
parents:
diff changeset
   931
    }
hgs
parents:
diff changeset
   932
}
hgs
parents:
diff changeset
   933
hgs
parents:
diff changeset
   934
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   935
// Handle media properties.
hgs
parents:
diff changeset
   936
// Notes: The client is responsible for delete the object of aProperties.
hgs
parents:
diff changeset
   937
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   938
//
hgs
parents:
diff changeset
   939
void CMPXVideoViewWrapper::DoHandleMediaL( const CMPXMessage& aMedia, TInt aError )
hgs
parents:
diff changeset
   940
{
hgs
parents:
diff changeset
   941
    MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::DoHandleMediaL()"),
hgs
parents:
diff changeset
   942
                   _L("aError = %d"), aError );
hgs
parents:
diff changeset
   943
hgs
parents:
diff changeset
   944
    if ( aError == KErrNone )
hgs
parents:
diff changeset
   945
    {
hgs
parents:
diff changeset
   946
        if ( iFileDetails )
hgs
parents:
diff changeset
   947
        {
hgs
parents:
diff changeset
   948
            iFileDetails->clearFileDetails();
hgs
parents:
diff changeset
   949
        }
hgs
parents:
diff changeset
   950
        else
hgs
parents:
diff changeset
   951
        {
hgs
parents:
diff changeset
   952
            iFileDetails = new QMPXVideoPlaybackViewFileDetails();
hgs
parents:
diff changeset
   953
        }       
hgs
parents:
diff changeset
   954
        
hgs
parents:
diff changeset
   955
        //
hgs
parents:
diff changeset
   956
        //  Read in the media data
hgs
parents:
diff changeset
   957
        //
hgs
parents:
diff changeset
   958
        ParseMetaDataL( aMedia );
hgs
parents:
diff changeset
   959
hgs
parents:
diff changeset
   960
        //
hgs
parents:
diff changeset
   961
        //  Create controls since file details are available
hgs
parents:
diff changeset
   962
        //
hgs
parents:
diff changeset
   963
        if ( iControlsController )
hgs
parents:
diff changeset
   964
        {
hgs
parents:
diff changeset
   965
            iControlsController->addFileDetails( iFileDetails );            
hgs
parents:
diff changeset
   966
        }
hgs
parents:
diff changeset
   967
hgs
parents:
diff changeset
   968
        if ( iFileDetails->mVideoEnabled )
hgs
parents:
diff changeset
   969
        {
hgs
parents:
diff changeset
   970
            RWindow *window = iView->getWindow();
hgs
parents:
diff changeset
   971
hgs
parents:
diff changeset
   972
            TRect displayRect = TRect( window->Position().iX,
hgs
parents:
diff changeset
   973
                                       window->Position().iY,
hgs
parents:
diff changeset
   974
                                       window->Position().iX + window->Size().iWidth,                  
hgs
parents:
diff changeset
   975
                                       window->Position().iY + window->Size().iHeight );
hgs
parents:
diff changeset
   976
hgs
parents:
diff changeset
   977
            TReal displayAspectRatio = (TReal32)displayRect.Width() / (TReal32)displayRect.Height();
hgs
parents:
diff changeset
   978
hgs
parents:
diff changeset
   979
            TInt newAspectRatio = 
hgs
parents:
diff changeset
   980
                iDisplayHandler->SetDefaultAspectRatioL( iFileDetails, displayAspectRatio );
hgs
parents:
diff changeset
   981
hgs
parents:
diff changeset
   982
            //
hgs
parents:
diff changeset
   983
            //  Setup the display window and issue play command
hgs
parents:
diff changeset
   984
            //
hgs
parents:
diff changeset
   985
            iDisplayHandler->CreateDisplayWindowL( CCoeEnv::Static()->WsSession(),
hgs
parents:
diff changeset
   986
                                                   *(CCoeEnv::Static()->ScreenDevice()),
hgs
parents:
diff changeset
   987
                                                   *window,
hgs
parents:
diff changeset
   988
                                                   displayRect );
hgs
parents:
diff changeset
   989
hgs
parents:
diff changeset
   990
            if ( iControlsController )
hgs
parents:
diff changeset
   991
            {
hgs
parents:
diff changeset
   992
                iControlsController->handleEvent( EMPXControlCmdSetAspectRatio, newAspectRatio );
hgs
parents:
diff changeset
   993
            }
hgs
parents:
diff changeset
   994
        }
hgs
parents:
diff changeset
   995
hgs
parents:
diff changeset
   996
        CreateGeneralPlaybackCommandL( EPbCmdPlay );
hgs
parents:
diff changeset
   997
    }
hgs
parents:
diff changeset
   998
}
hgs
parents:
diff changeset
   999
hgs
parents:
diff changeset
  1000
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1001
// From MMPXPlaybackCallback
hgs
parents:
diff changeset
  1002
// Handle media event.
hgs
parents:
diff changeset
  1003
// Notes: The client is responsible for delete the object of aProperties.
hgs
parents:
diff changeset
  1004
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1005
//
hgs
parents:
diff changeset
  1006
void CMPXVideoViewWrapper::HandleMediaL( const CMPXMedia& aMedia, TInt aError)
hgs
parents:
diff changeset
  1007
{
hgs
parents:
diff changeset
  1008
    MPX_ENTER_EXIT(_L( "CMPXVideoViewWrapper::HandleMediaL()" ));
hgs
parents:
diff changeset
  1009
    if ( aMedia.IsSupported( KMPXMediaVideoError ) )
hgs
parents:
diff changeset
  1010
    {
hgs
parents:
diff changeset
  1011
        TInt error = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoError );
hgs
parents:
diff changeset
  1012
        // Reset the controls
hgs
parents:
diff changeset
  1013
        HandleCommandL( EMPXPbvCmdResetControls );
hgs
parents:
diff changeset
  1014
        // Set the iMediaRequested flag to false
hgs
parents:
diff changeset
  1015
        iMediaRequested = EFalse;
hgs
parents:
diff changeset
  1016
        // Reset the playback state to stopped
hgs
parents:
diff changeset
  1017
        iPlaybackState = EPbStateStopped;
hgs
parents:
diff changeset
  1018
        // Handle the plugin error
hgs
parents:
diff changeset
  1019
        iView->handlePluginError( error );
hgs
parents:
diff changeset
  1020
    }
hgs
parents:
diff changeset
  1021
    else
hgs
parents:
diff changeset
  1022
    {
hgs
parents:
diff changeset
  1023
        DoHandleMediaL( aMedia, aError );
hgs
parents:
diff changeset
  1024
    }
hgs
parents:
diff changeset
  1025
}
hgs
parents:
diff changeset
  1026
hgs
parents:
diff changeset
  1027
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1028
//   CMPXVideoViewWrapper::SetPropertyL()
hgs
parents:
diff changeset
  1029
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1030
//
hgs
parents:
diff changeset
  1031
void CMPXVideoViewWrapper::SetPropertyL( TMPXPlaybackProperty aProperty, TInt aValue )
hgs
parents:
diff changeset
  1032
{
hgs
parents:
diff changeset
  1033
    MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::SetPropertyL"),
hgs
parents:
diff changeset
  1034
                   _L("aProperty = %d, aValue = %d"), aProperty, aValue );
hgs
parents:
diff changeset
  1035
hgs
parents:
diff changeset
  1036
    iPlaybackUtility->SetL( aProperty, aValue );
hgs
parents:
diff changeset
  1037
}
hgs
parents:
diff changeset
  1038
hgs
parents:
diff changeset
  1039
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1040
//   CMPXVideoViewWrapper::HandlePropertyL()
hgs
parents:
diff changeset
  1041
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1042
//
hgs
parents:
diff changeset
  1043
void CMPXVideoViewWrapper::HandlePropertyL( TMPXPlaybackProperty aProperty,
hgs
parents:
diff changeset
  1044
                                                 TInt aValue,
hgs
parents:
diff changeset
  1045
                                                 TInt aError )
hgs
parents:
diff changeset
  1046
{
hgs
parents:
diff changeset
  1047
    MPX_DEBUG(_L("CMPXVideoViewWrapper::DoHandlePropertyL - Error(%d)"), aError );
hgs
parents:
diff changeset
  1048
hgs
parents:
diff changeset
  1049
    if ( aError == KErrNone )
hgs
parents:
diff changeset
  1050
    {
hgs
parents:
diff changeset
  1051
        switch ( aProperty  )
hgs
parents:
diff changeset
  1052
        {
hgs
parents:
diff changeset
  1053
            case EPbPropertyPosition:
hgs
parents:
diff changeset
  1054
            {
hgs
parents:
diff changeset
  1055
                MPX_DEBUG(_L("CMPXVideoViewWrapper::DoHandlePropertyL position(%d)"), aValue );
hgs
parents:
diff changeset
  1056
hgs
parents:
diff changeset
  1057
                if ( iControlsController )
hgs
parents:
diff changeset
  1058
                {
hgs
parents:
diff changeset
  1059
                    iControlsController->handleEvent( EMPXControlCmdSetPosition, aValue );
hgs
parents:
diff changeset
  1060
                }
hgs
parents:
diff changeset
  1061
hgs
parents:
diff changeset
  1062
                break;
hgs
parents:
diff changeset
  1063
            }
hgs
parents:
diff changeset
  1064
            case EPbPropertyDuration:
hgs
parents:
diff changeset
  1065
            {
hgs
parents:
diff changeset
  1066
                MPX_DEBUG(_L("CMPXVideoViewWrapper::DoHandlePropertyL duration(%d)"), aValue );
hgs
parents:
diff changeset
  1067
hgs
parents:
diff changeset
  1068
                if ( iControlsController )
hgs
parents:
diff changeset
  1069
                {
hgs
parents:
diff changeset
  1070
                    iControlsController->handleEvent( EMPXControlCmdSetDuration, aValue );
hgs
parents:
diff changeset
  1071
                }
hgs
parents:
diff changeset
  1072
hgs
parents:
diff changeset
  1073
                break;
hgs
parents:
diff changeset
  1074
            }
hgs
parents:
diff changeset
  1075
            case EPbPropertyMaxVolume:
hgs
parents:
diff changeset
  1076
            {
hgs
parents:
diff changeset
  1077
                MPX_DEBUG(_L("CMPXVideoViewWrapper::DoHandlePropertyL max volume(%d)"), aValue );
hgs
parents:
diff changeset
  1078
hgs
parents:
diff changeset
  1079
                break;
hgs
parents:
diff changeset
  1080
            }
hgs
parents:
diff changeset
  1081
            case EPbPropertyVolume:
hgs
parents:
diff changeset
  1082
            {
hgs
parents:
diff changeset
  1083
                MPX_DEBUG(_L("CMPXVideoViewWrapper::DoHandlePropertyL volume(%d)"), aValue );
hgs
parents:
diff changeset
  1084
hgs
parents:
diff changeset
  1085
                if ( iControlsController )
hgs
parents:
diff changeset
  1086
                {
hgs
parents:
diff changeset
  1087
                    iControlsController->handleEvent( EMPXControlCmdSetVolume, aValue );
hgs
parents:
diff changeset
  1088
                }
hgs
parents:
diff changeset
  1089
hgs
parents:
diff changeset
  1090
                break;
hgs
parents:
diff changeset
  1091
            }
hgs
parents:
diff changeset
  1092
            case EPbPropertyMute:
hgs
parents:
diff changeset
  1093
            {
hgs
parents:
diff changeset
  1094
                MPX_DEBUG(_L("CMPXVideoViewWrapper::DoHandlePropertyL mute(%d)"), aValue );
hgs
parents:
diff changeset
  1095
hgs
parents:
diff changeset
  1096
                if ( iControlsController && aValue )
hgs
parents:
diff changeset
  1097
                {
hgs
parents:
diff changeset
  1098
                    iControlsController->handleEvent( EMPXControlCmdSetVolume, 0 );
hgs
parents:
diff changeset
  1099
                }
hgs
parents:
diff changeset
  1100
hgs
parents:
diff changeset
  1101
                break;
hgs
parents:
diff changeset
  1102
            }
hgs
parents:
diff changeset
  1103
        }
hgs
parents:
diff changeset
  1104
    }
hgs
parents:
diff changeset
  1105
}
hgs
parents:
diff changeset
  1106
hgs
parents:
diff changeset
  1107
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1108
//   CMPXVideoViewWrapper::RetrieveFileNameAndModeL
hgs
parents:
diff changeset
  1109
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1110
//
hgs
parents:
diff changeset
  1111
void CMPXVideoViewWrapper::RetrieveFileNameAndModeL( CMPXCommand* aCmd )
hgs
parents:
diff changeset
  1112
{
hgs
parents:
diff changeset
  1113
    //
hgs
parents:
diff changeset
  1114
    //  set attributes on the command
hgs
parents:
diff changeset
  1115
    //
hgs
parents:
diff changeset
  1116
    aCmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
hgs
parents:
diff changeset
  1117
hgs
parents:
diff changeset
  1118
    aCmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXMediaIdVideoPlayback );
hgs
parents:
diff changeset
  1119
hgs
parents:
diff changeset
  1120
    aCmd->SetTObjectValueL<TMPXVideoPlaybackCommand>( KMPXMediaVideoPlaybackCommand,
hgs
parents:
diff changeset
  1121
                                                      EPbCmdInitView );
hgs
parents:
diff changeset
  1122
hgs
parents:
diff changeset
  1123
    iPlaybackUtility->CommandL( *aCmd );
hgs
parents:
diff changeset
  1124
}
hgs
parents:
diff changeset
  1125
hgs
parents:
diff changeset
  1126
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1127
//   CMPXVideoViewWrapper::ActivateClosePlayerActiveObject
hgs
parents:
diff changeset
  1128
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1129
//
hgs
parents:
diff changeset
  1130
void CMPXVideoViewWrapper::ActivateClosePlayerActiveObject()
hgs
parents:
diff changeset
  1131
{
hgs
parents:
diff changeset
  1132
    MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::ActivateClosePlayerActiveObject()"));
hgs
parents:
diff changeset
  1133
hgs
parents:
diff changeset
  1134
    if ( ! iCloseAO->IsActive() )
hgs
parents:
diff changeset
  1135
    {
hgs
parents:
diff changeset
  1136
        iCloseAO->Start( TCallBack( CMPXVideoViewWrapper::ClosePlayerL, this ) );
hgs
parents:
diff changeset
  1137
    }
hgs
parents:
diff changeset
  1138
}
hgs
parents:
diff changeset
  1139
hgs
parents:
diff changeset
  1140
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1141
//   CMPXVideoViewWrapper::ClosePlayerL
hgs
parents:
diff changeset
  1142
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1143
//
hgs
parents:
diff changeset
  1144
TInt CMPXVideoViewWrapper::ClosePlayerL( TAny* aPtr )
hgs
parents:
diff changeset
  1145
{
hgs
parents:
diff changeset
  1146
    MPX_DEBUG(_L("CMPXVideoViewWrapper::ClosePlayerL()"));
hgs
parents:
diff changeset
  1147
hgs
parents:
diff changeset
  1148
    static_cast<CMPXVideoViewWrapper*>(aPtr)->DoClosePlayerL();
hgs
parents:
diff changeset
  1149
    return KErrNone;
hgs
parents:
diff changeset
  1150
}
hgs
parents:
diff changeset
  1151
hgs
parents:
diff changeset
  1152
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1153
//   CMPXVideoViewWrapper::DoClosePlayerL
hgs
parents:
diff changeset
  1154
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1155
//
hgs
parents:
diff changeset
  1156
void CMPXVideoViewWrapper::DoClosePlayerL()
hgs
parents:
diff changeset
  1157
{
hgs
parents:
diff changeset
  1158
    MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::DoClosePlayerL()"));
hgs
parents:
diff changeset
  1159
hgs
parents:
diff changeset
  1160
    iView->doClosePlayer();
hgs
parents:
diff changeset
  1161
}
hgs
parents:
diff changeset
  1162
hgs
parents:
diff changeset
  1163
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1164
//   CMPXVideoViewWrapper::IssuePlayCommandL
hgs
parents:
diff changeset
  1165
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1166
//
hgs
parents:
diff changeset
  1167
void CMPXVideoViewWrapper::IssuePlayCommandL()
hgs
parents:
diff changeset
  1168
{
hgs
parents:
diff changeset
  1169
    MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::IssuePlayCommandL()"));
hgs
parents:
diff changeset
  1170
    CreateGeneralPlaybackCommandL( EPbCmdPlay );
hgs
parents:
diff changeset
  1171
}
hgs
parents:
diff changeset
  1172
hgs
parents:
diff changeset
  1173
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1174
//   CMPXVideoViewWrapper::RetrievePdlInformationL
hgs
parents:
diff changeset
  1175
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1176
//
hgs
parents:
diff changeset
  1177
void CMPXVideoViewWrapper::RetrievePdlInformationL()
hgs
parents:
diff changeset
  1178
{
hgs
parents:
diff changeset
  1179
    MPX_DEBUG(_L("CMPXVideoViewWrapper::RetrievePdlInformationL()"));
hgs
parents:
diff changeset
  1180
}
hgs
parents:
diff changeset
  1181
hgs
parents:
diff changeset
  1182
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1183
// CMPXVideoViewWrapper::CreateVideoSpecificCmdL()
hgs
parents:
diff changeset
  1184
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1185
//
hgs
parents:
diff changeset
  1186
void CMPXVideoViewWrapper::CreateVideoSpecificCmdL( TMPXVideoPlaybackCommand aCmd )
hgs
parents:
diff changeset
  1187
{
hgs
parents:
diff changeset
  1188
    //
hgs
parents:
diff changeset
  1189
    //  create command to pass to playback plugin
hgs
parents:
diff changeset
  1190
    //
hgs
parents:
diff changeset
  1191
    CMPXCommand* cmd = CMPXCommand::NewL();
hgs
parents:
diff changeset
  1192
    CleanupStack::PushL( cmd );
hgs
parents:
diff changeset
  1193
hgs
parents:
diff changeset
  1194
    cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
hgs
parents:
diff changeset
  1195
hgs
parents:
diff changeset
  1196
    cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXMediaIdVideoPlayback );
hgs
parents:
diff changeset
  1197
hgs
parents:
diff changeset
  1198
    cmd->SetTObjectValueL<TMPXVideoPlaybackCommand>( KMPXMediaVideoPlaybackCommand, aCmd );
hgs
parents:
diff changeset
  1199
hgs
parents:
diff changeset
  1200
    iPlaybackUtility->CommandL( *cmd );
hgs
parents:
diff changeset
  1201
hgs
parents:
diff changeset
  1202
    CleanupStack::PopAndDestroy( cmd );
hgs
parents:
diff changeset
  1203
}
hgs
parents:
diff changeset
  1204
hgs
parents:
diff changeset
  1205
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1206
// CMPXVideoViewWrapper::SetAspectRatioL()
hgs
parents:
diff changeset
  1207
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1208
//
hgs
parents:
diff changeset
  1209
void CMPXVideoViewWrapper::SetAspectRatioL( TMPXVideoPlaybackCommand aCmd )
hgs
parents:
diff changeset
  1210
{
hgs
parents:
diff changeset
  1211
    MPX_DEBUG(_L("CMPXVideoViewWrapper::SetAspectRatioL()"));
hgs
parents:
diff changeset
  1212
hgs
parents:
diff changeset
  1213
    TInt newAspectRatio = iDisplayHandler->SetAspectRatioL( aCmd );
hgs
parents:
diff changeset
  1214
hgs
parents:
diff changeset
  1215
    if ( iControlsController )
hgs
parents:
diff changeset
  1216
    {
hgs
parents:
diff changeset
  1217
        iControlsController->handleEvent( EMPXControlCmdSetAspectRatio, newAspectRatio );
hgs
parents:
diff changeset
  1218
    }
hgs
parents:
diff changeset
  1219
}
hgs
parents:
diff changeset
  1220
hgs
parents:
diff changeset
  1221
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1222
// CMPXVideoViewWrapper::IsAppInFrontL()
hgs
parents:
diff changeset
  1223
// Returns true if app is foreground. Uses windowgroup id
hgs
parents:
diff changeset
  1224
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1225
//
hgs
parents:
diff changeset
  1226
TBool CMPXVideoViewWrapper::IsAppInFrontL()
hgs
parents:
diff changeset
  1227
{
hgs
parents:
diff changeset
  1228
    TBool ret = EFalse;
hgs
parents:
diff changeset
  1229
    RWsSession wsSession;
hgs
parents:
diff changeset
  1230
hgs
parents:
diff changeset
  1231
    User::LeaveIfError( wsSession.Connect() );
hgs
parents:
diff changeset
  1232
hgs
parents:
diff changeset
  1233
    if( wsSession.Handle() )
hgs
parents:
diff changeset
  1234
    {
hgs
parents:
diff changeset
  1235
        CArrayFixFlat<TInt>* wgList =
hgs
parents:
diff changeset
  1236
            new (ELeave) CArrayFixFlat<TInt>( wsSession.NumWindowGroups() );
hgs
parents:
diff changeset
  1237
hgs
parents:
diff changeset
  1238
        // check if our window is front or not
hgs
parents:
diff changeset
  1239
        if ( wsSession.WindowGroupList( 0, wgList ) == KErrNone )
hgs
parents:
diff changeset
  1240
        {
hgs
parents:
diff changeset
  1241
            ret = ( CEikonEnv::Static()->RootWin().Identifier() == wgList->At(0) );			        
hgs
parents:
diff changeset
  1242
        }
hgs
parents:
diff changeset
  1243
        else
hgs
parents:
diff changeset
  1244
        {
hgs
parents:
diff changeset
  1245
            ret = EFalse;
hgs
parents:
diff changeset
  1246
        }
hgs
parents:
diff changeset
  1247
hgs
parents:
diff changeset
  1248
        delete wgList;
hgs
parents:
diff changeset
  1249
    }
hgs
parents:
diff changeset
  1250
hgs
parents:
diff changeset
  1251
    wsSession.Close();
hgs
parents:
diff changeset
  1252
hgs
parents:
diff changeset
  1253
    MPX_DEBUG(_L("CMPXVideoViewWrapper::IsAppInFrontL (%d)" ), ret);
hgs
parents:
diff changeset
  1254
hgs
parents:
diff changeset
  1255
    return ret;
hgs
parents:
diff changeset
  1256
}
hgs
parents:
diff changeset
  1257
hgs
parents:
diff changeset
  1258
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1259
//   CMPXVideoViewWrapper::ClosePlaybackViewL()
hgs
parents:
diff changeset
  1260
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1261
//
hgs
parents:
diff changeset
  1262
void CMPXVideoViewWrapper::ClosePlaybackViewL()
hgs
parents:
diff changeset
  1263
{
hgs
parents:
diff changeset
  1264
    MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::closePlaybackView()"));
hgs
parents:
diff changeset
  1265
        
hgs
parents:
diff changeset
  1266
    iView->closePlaybackView();
hgs
parents:
diff changeset
  1267
}
hgs
parents:
diff changeset
  1268
hgs
parents:
diff changeset
  1269
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1270
//   CMPXVideoViewWrapper::HandleVolumeCmdL()
hgs
parents:
diff changeset
  1271
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1272
//
hgs
parents:
diff changeset
  1273
void CMPXVideoViewWrapper::HandleVolumeCmdL( TMPXPlaybackCommand aCmd )
hgs
parents:
diff changeset
  1274
{
hgs
parents:
diff changeset
  1275
    MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::HandleVolumeCmdL()"));
hgs
parents:
diff changeset
  1276
hgs
parents:
diff changeset
  1277
    //
hgs
parents:
diff changeset
  1278
    // In case user try to change the volume via media key, rocker key or etc
hgs
parents:
diff changeset
  1279
    // We need to show the controls though the volume level doesn't get changed
hgs
parents:
diff changeset
  1280
    // For examples : - try to change the volume with a clip without audio track
hgs
parents:
diff changeset
  1281
    //                - try to reduce the volume with volume level 0
hgs
parents:
diff changeset
  1282
    //                - try to increase the volume with max volume level
hgs
parents:
diff changeset
  1283
    //
hgs
parents:
diff changeset
  1284
    iControlsController->handleEvent( EMPXControlCmdShowVolumeControls );
hgs
parents:
diff changeset
  1285
hgs
parents:
diff changeset
  1286
    iPlaybackUtility->CommandL( aCmd );
hgs
parents:
diff changeset
  1287
}
hgs
parents:
diff changeset
  1288
hgs
parents:
diff changeset
  1289
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1290
//   CMPXVideoViewWrapper::HandleShortPressBackwardL()
hgs
parents:
diff changeset
  1291
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1292
//
hgs
parents:
diff changeset
  1293
void CMPXVideoViewWrapper::HandleShortPressBackwardL()
hgs
parents:
diff changeset
  1294
{
hgs
parents:
diff changeset
  1295
    MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL()"));
hgs
parents:
diff changeset
  1296
hgs
parents:
diff changeset
  1297
    if( !iPlaylistView )
hgs
parents:
diff changeset
  1298
    {
hgs
parents:
diff changeset
  1299
        SetPropertyL( EPbPropertyPosition, 0 );
hgs
parents:
diff changeset
  1300
    }
hgs
parents:
diff changeset
  1301
}
hgs
parents:
diff changeset
  1302
hgs
parents:
diff changeset
  1303
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1304
//   CMPXVideoViewWrapper::IssueVideoAppForegroundCmd()
hgs
parents:
diff changeset
  1305
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1306
//
hgs
parents:
diff changeset
  1307
void CMPXVideoViewWrapper::IssueVideoAppForegroundCmdL( TBool aForeground )
hgs
parents:
diff changeset
  1308
{
hgs
parents:
diff changeset
  1309
    MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::HandleForegroundEventL()"),
hgs
parents:
diff changeset
  1310
                   _L("aForeground = %d"), aForeground );
hgs
parents:
diff changeset
  1311
hgs
parents:
diff changeset
  1312
    TMPXVideoPlaybackCommand videoCmd = EPbCmdHandleBackground;
hgs
parents:
diff changeset
  1313
hgs
parents:
diff changeset
  1314
    if ( aForeground )
hgs
parents:
diff changeset
  1315
    {
hgs
parents:
diff changeset
  1316
        videoCmd = EPbCmdHandleForeground;
hgs
parents:
diff changeset
  1317
    }
hgs
parents:
diff changeset
  1318
hgs
parents:
diff changeset
  1319
    //
hgs
parents:
diff changeset
  1320
    //  create command to pass to playback plugin
hgs
parents:
diff changeset
  1321
    //
hgs
parents:
diff changeset
  1322
    CMPXCommand* cmd = CMPXCommand::NewL();
hgs
parents:
diff changeset
  1323
    CleanupStack::PushL( cmd );
hgs
parents:
diff changeset
  1324
hgs
parents:
diff changeset
  1325
    cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
hgs
parents:
diff changeset
  1326
    cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXMediaIdVideoPlayback );
hgs
parents:
diff changeset
  1327
    cmd->SetTObjectValueL<TMPXVideoPlaybackCommand>( KMPXMediaVideoPlaybackCommand, videoCmd );
hgs
parents:
diff changeset
  1328
    cmd->SetTObjectValueL<TBool>( KMPXMediaVideoAppForeground, IsAppInFrontL() );
hgs
parents:
diff changeset
  1329
hgs
parents:
diff changeset
  1330
    iPlaybackUtility->CommandL( *cmd );
hgs
parents:
diff changeset
  1331
    CleanupStack::PopAndDestroy( cmd );
hgs
parents:
diff changeset
  1332
}
hgs
parents:
diff changeset
  1333
hgs
parents:
diff changeset
  1334
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1335
//   CMPXVideoViewWrapper::CreateControlsL()
hgs
parents:
diff changeset
  1336
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1337
//
hgs
parents:
diff changeset
  1338
void CMPXVideoViewWrapper::CreateControlsL()
hgs
parents:
diff changeset
  1339
{
hgs
parents:
diff changeset
  1340
    MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::CreateControlsL()"));
hgs
parents:
diff changeset
  1341
hgs
parents:
diff changeset
  1342
    //
hgs
parents:
diff changeset
  1343
    //  Query playback plugin for filename and mode
hgs
parents:
diff changeset
  1344
    //
hgs
parents:
diff changeset
  1345
    CMPXCommand* cmd = CMPXCommand::NewL();
hgs
parents:
diff changeset
  1346
    CleanupStack::PushL( cmd );
hgs
parents:
diff changeset
  1347
hgs
parents:
diff changeset
  1348
    RetrieveFileNameAndModeL( cmd );
hgs
parents:
diff changeset
  1349
hgs
parents:
diff changeset
  1350
    //
hgs
parents:
diff changeset
  1351
    //  Create a temporary file details that is populated with the
hgs
parents:
diff changeset
  1352
    //  file name and playback mode.  This will be delete when
hgs
parents:
diff changeset
  1353
    //  plugin initialization is complete
hgs
parents:
diff changeset
  1354
    //
hgs
parents:
diff changeset
  1355
    if ( iFileDetails )
hgs
parents:
diff changeset
  1356
    {
hgs
parents:
diff changeset
  1357
        delete iFileDetails;
hgs
parents:
diff changeset
  1358
        iFileDetails = NULL;
hgs
parents:
diff changeset
  1359
    }
hgs
parents:
diff changeset
  1360
hgs
parents:
diff changeset
  1361
    iFileDetails = new QMPXVideoPlaybackViewFileDetails();
hgs
parents:
diff changeset
  1362
hgs
parents:
diff changeset
  1363
    TPtrC fileName( cmd->ValueText( KMPXMediaVideoPlaybackFileName ) );    
hgs
parents:
diff changeset
  1364
    const QString qFilename( (QChar*)fileName.Ptr(), fileName.Length() );
hgs
parents:
diff changeset
  1365
    iFileDetails->mClipName = qFilename;
hgs
parents:
diff changeset
  1366
hgs
parents:
diff changeset
  1367
    iFileDetails->mPlaybackMode = (TMPXVideoMode) cmd->ValueTObjectL<TInt>( KMPXMediaVideoMode );
hgs
parents:
diff changeset
  1368
hgs
parents:
diff changeset
  1369
    iFileDetails->mTvOutConnected   = cmd->ValueTObjectL<TInt>( KMPXMediaVideoTvOutConnected );
hgs
parents:
diff changeset
  1370
    iFileDetails->mTvOutPlayAllowed = cmd->ValueTObjectL<TInt>( KMPXMediaVideoTvOutPlayAllowed );
hgs
parents:
diff changeset
  1371
hgs
parents:
diff changeset
  1372
    TPtrC mimeType( cmd->ValueText( KMPXMediaVideoRecognizedMimeType ) );    
hgs
parents:
diff changeset
  1373
    const QString qMimeType( (QChar*)mimeType.Ptr(), mimeType.Length() );
hgs
parents:
diff changeset
  1374
    iFileDetails->mMimeType = qMimeType;
hgs
parents:
diff changeset
  1375
35
hgs
parents: 30
diff changeset
  1376
    //
hgs
parents: 30
diff changeset
  1377
    // get playlist information and set mMultiItemPlaylist flag
hgs
parents: 30
diff changeset
  1378
    //
hgs
parents: 30
diff changeset
  1379
    TInt numItems = 1;    
hgs
parents: 30
diff changeset
  1380
    MMPXSource* s = iPlaybackUtility->Source();
hgs
parents: 30
diff changeset
  1381
hgs
parents: 30
diff changeset
  1382
    if ( s )
hgs
parents: 30
diff changeset
  1383
    {
hgs
parents: 30
diff changeset
  1384
        CMPXCollectionPlaylist* playlist = NULL;
30
hgs
parents:
diff changeset
  1385
35
hgs
parents: 30
diff changeset
  1386
        MPX_TRAPD( err, playlist = s->PlaylistL() );
hgs
parents: 30
diff changeset
  1387
        
hgs
parents: 30
diff changeset
  1388
        if ( err == KErrNone && playlist )
hgs
parents: 30
diff changeset
  1389
        {
hgs
parents: 30
diff changeset
  1390
            iPlaylistView = ETrue;
hgs
parents: 30
diff changeset
  1391
            numItems = playlist->Count();
hgs
parents: 30
diff changeset
  1392
            delete playlist;
hgs
parents: 30
diff changeset
  1393
        }
hgs
parents: 30
diff changeset
  1394
    }
hgs
parents: 30
diff changeset
  1395
hgs
parents: 30
diff changeset
  1396
    iFileDetails->mMultiItemPlaylist = ( numItems > 1 );
hgs
parents: 30
diff changeset
  1397
    
30
hgs
parents:
diff changeset
  1398
    CleanupStack::PopAndDestroy( cmd );
hgs
parents:
diff changeset
  1399
hgs
parents:
diff changeset
  1400
    if ( iControlsController )
hgs
parents:
diff changeset
  1401
    {
hgs
parents:
diff changeset
  1402
        delete iControlsController;
hgs
parents:
diff changeset
  1403
        iControlsController = NULL;
hgs
parents:
diff changeset
  1404
    }
hgs
parents:
diff changeset
  1405
hgs
parents:
diff changeset
  1406
    iControlsController = new QMPXVideoPlaybackControlsController( iView, this, iFileDetails );
hgs
parents:
diff changeset
  1407
}
hgs
parents:
diff changeset
  1408
hgs
parents:
diff changeset
  1409
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1410
//   CMPXVideoViewWrapper::IsMultiItemPlaylist()
hgs
parents:
diff changeset
  1411
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1412
//
hgs
parents:
diff changeset
  1413
TBool CMPXVideoViewWrapper::IsMultiItemPlaylist()
hgs
parents:
diff changeset
  1414
{
35
hgs
parents: 30
diff changeset
  1415
    
hgs
parents: 30
diff changeset
  1416
    bool multiLinks( false );
hgs
parents: 30
diff changeset
  1417
    
hgs
parents: 30
diff changeset
  1418
    if ( iFileDetails )
30
hgs
parents:
diff changeset
  1419
    {
35
hgs
parents: 30
diff changeset
  1420
        MPX_DEBUG(_L("CMPXVideoViewWrapper::IsMultiItemPlaylist(%d)"), 
hgs
parents: 30
diff changeset
  1421
            iFileDetails->mMultiItemPlaylist );
hgs
parents: 30
diff changeset
  1422
        multiLinks = iFileDetails->mMultiItemPlaylist;
30
hgs
parents:
diff changeset
  1423
    }
35
hgs
parents: 30
diff changeset
  1424
    
hgs
parents: 30
diff changeset
  1425
    return multiLinks;
30
hgs
parents:
diff changeset
  1426
}
hgs
parents:
diff changeset
  1427
hgs
parents:
diff changeset
  1428
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1429
//   CMPXVideoViewWrapper::UpdateVideoRect()
hgs
parents:
diff changeset
  1430
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1431
//
hgs
parents:
diff changeset
  1432
void CMPXVideoViewWrapper::UpdateVideoRect( 
hgs
parents:
diff changeset
  1433
        TInt aX, TInt aY, TInt aWidth, TInt aHeight, TBool transitionEffect )
hgs
parents:
diff changeset
  1434
{
hgs
parents:
diff changeset
  1435
    MPX_DEBUG(_L("CMPXVideoViewWrapper::UpdateVideoRect()"));
hgs
parents:
diff changeset
  1436
hgs
parents:
diff changeset
  1437
    TRect rect( TPoint( aX, aY ), TSize( aWidth, aHeight ) );
hgs
parents:
diff changeset
  1438
    TRAP_IGNORE( iDisplayHandler->UpdateVideoRectL( rect, transitionEffect ) );
hgs
parents:
diff changeset
  1439
}
hgs
parents:
diff changeset
  1440
hgs
parents:
diff changeset
  1441
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1442
//   CMPXVideoViewWrapper::UpdateVideoRectDone()
hgs
parents:
diff changeset
  1443
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1444
//
hgs
parents:
diff changeset
  1445
void CMPXVideoViewWrapper::UpdateVideoRectDone()
hgs
parents:
diff changeset
  1446
{
hgs
parents:
diff changeset
  1447
    MPX_DEBUG(_L("CMPXVideoViewWrapper::UpdateVideoRectDone()"));
hgs
parents:
diff changeset
  1448
hgs
parents:
diff changeset
  1449
    iControlsController->updateVideoRectDone();
hgs
parents:
diff changeset
  1450
}
hgs
parents:
diff changeset
  1451
hgs
parents:
diff changeset
  1452
// EOF