musichomescreen_multiview/mcpmusicplayer/src/aiplayerpluginengine.cpp
author Pat Downey <patd@symbian.org>
Wed, 01 Sep 2010 12:32:02 +0100
branchRCL_3
changeset 53 3de6c4cf6b67
child 66 1f1dad4af8f8
permissions -rw-r--r--
Revert incorrect RCL_3 drop: Revision: 201033 Kit: 201035
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
53
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     1
/*
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     2
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     3
* All rights reserved.
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     8
*
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     9
* Initial Contributors:
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    11
*
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    12
* Contributors:
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    13
*
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    14
* Description:  Music Player stautus observer
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    15
*
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    16
*/
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    17
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    18
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    19
#include <mpxplaybackutility.h>
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    20
#include <mpxplaybackmessage.h>
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    21
#include <mpxmedia.h>
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    22
#include <mpxmediageneraldefs.h>
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    23
#include <mpxmediamusicdefs.h>
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    24
#include <mpxmessagegeneraldefs.h>
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    25
#include <mpxplaybackmessagedefs.h>
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    26
#include <mpxalbumartutil.h>
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    27
#include <mpxlog.h>
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    28
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    29
#include "aiplayerpluginengine.h"
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    30
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    31
const TInt KMPXOneSecInMilliSecs( 1000 );
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    32
const TUid  KMusicPlayerAppUid = { 0x102072C3 };
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    33
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    34
// ======== MEMBER FUNCTIONS ========
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    35
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    36
// ---------------------------------------------------------------------------
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    37
// CAiPlayerPluginEngine::ConstructL
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    38
// ---------------------------------------------------------------------------
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    39
//
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    40
void CAiPlayerPluginEngine::ConstructL()
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    41
    {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    42
    MPX_DEBUG1("CAiPlayerPluginEngine::ConstructL");
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    43
    // Get the playback utility instance from engine.
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    44
    //iPlaybackUtility = MMPXPlaybackUtility::NewL( KPbModeActivePlayer, this );
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    45
    iPlaybackUtility = MMPXPlaybackUtility::NewL( KMusicPlayerAppUid, this );
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    46
    iAlbumArtUtil = CMPXAlbumArtUtil::NewL();
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    47
    if (iPlaybackUtility->StateL() == EPbStatePlaying)
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    48
        {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    49
    	  RequestMediaL();
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    50
        }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    51
    }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    52
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    53
// ---------------------------------------------------------------------------
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    54
// CAiPlayerPluginEngine::NewL
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    55
// ---------------------------------------------------------------------------
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    56
//
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    57
CAiPlayerPluginEngine* CAiPlayerPluginEngine::NewL( 
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    58
        MAiPlayerPluginEngineObserver& aObserver )
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    59
    {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    60
    MPX_DEBUG1("CAiPlayerPluginEngine::NewL");
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    61
    CAiPlayerPluginEngine* self = new ( ELeave ) 
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    62
            CAiPlayerPluginEngine( aObserver );
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    63
    CleanupStack::PushL( self );
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    64
    self->ConstructL();
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    65
    CleanupStack::Pop( self );
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    66
    return self;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    67
    }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    68
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    69
// ---------------------------------------------------------------------------
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    70
// CAiPlayerPluginEngine::CAiPlayerPluginEngine
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    71
// ---------------------------------------------------------------------------
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    72
//
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    73
CAiPlayerPluginEngine::CAiPlayerPluginEngine( 
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    74
        MAiPlayerPluginEngineObserver& aObserver )
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    75
    : iObserver( &aObserver ),
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    76
      iPlaybackUtility( NULL ),
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    77
      iTitle( NULL ),
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    78
      iArtist( NULL ),
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    79
      iUri( NULL ),
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    80
      iMedia( NULL ),
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    81
      iPosition( KErrNotFound ),
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    82
      iDuration( KErrNotFound ),
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    83
      iExtractingAlbumArt( EFalse ),
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    84
      iSkipping( EFalse )
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    85
    {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    86
    }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    87
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    88
// ---------------------------------------------------------------------------
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    89
// CAiPlayerPluginEngine::~CAiPlayerPluginEngine
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    90
// ---------------------------------------------------------------------------
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    91
//
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    92
CAiPlayerPluginEngine::~CAiPlayerPluginEngine()
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    93
    {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    94
    MPX_DEBUG1("CAiPlayerPluginEngine::~CAiPlayerPluginEngine");
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    95
    if ( iPlaybackUtility )
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    96
        {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    97
        iPlaybackUtility->Close();
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    98
        }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    99
    delete iMedia;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   100
    delete iAlbumArtUtil;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   101
    delete iTitle;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   102
    delete iArtist;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   103
    delete iUri;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   104
        
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   105
    }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   106
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   107
// ---------------------------------------------------------------------------
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   108
// From MMPXPlaybackObserver
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   109
// Handle playback message.
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   110
// ---------------------------------------------------------------------------
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   111
//
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   112
void CAiPlayerPluginEngine::HandlePlaybackMessage( CMPXMessage* aMessage, 
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   113
        TInt aError )
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   114
    {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   115
    if ( aError == KErrNone && aMessage )
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   116
        {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   117
        TRAP_IGNORE( DoHandlePlaybackMessageL( *aMessage ) );
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   118
        }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   119
    }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   120
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   121
// ---------------------------------------------------------------------------
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   122
// From MMPXPlaybackCallback
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   123
// Handle playback property.
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   124
// ---------------------------------------------------------------------------
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   125
//
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   126
void CAiPlayerPluginEngine::HandlePropertyL( TMPXPlaybackProperty aProperty, 
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   127
        TInt aValue, TInt aError )
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   128
    {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   129
    DoHandlePropertyL( aProperty, aValue, aError );
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   130
    }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   131
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   132
// ---------------------------------------------------------------------------
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   133
// From MMPXPlaybackCallback
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   134
// Method is called continously until aComplete=ETrue, signifying that
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   135
// it is done and there will be no more callbacks
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   136
// Only new items are passed each time
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   137
// ---------------------------------------------------------------------------
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   138
//
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   139
void CAiPlayerPluginEngine::HandleSubPlayerNamesL(
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   140
    TUid /* aPlayer */,
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   141
    const MDesCArray* /* aSubPlayers */,
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   142
    TBool /* aComplete */,
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   143
    TInt /* aError */ )
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   144
    {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   145
    // do nothing
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   146
    }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   147
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   148
// ---------------------------------------------------------------------------
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   149
// From MMPXPlaybackCallback
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   150
// Handle media
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   151
// ---------------------------------------------------------------------------
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   152
//
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   153
void CAiPlayerPluginEngine::HandleMediaL( const CMPXMedia& aMedia, 
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   154
        TInt aError )
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   155
    {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   156
    MPX_DEBUG1("CAiPlayerPluginEngine::HandleMediaL");
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   157
    if ( KErrNone == aError )
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   158
        {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   159
        delete iUri;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   160
        iUri = NULL;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   161
        if (aMedia.IsSupported(KMPXMediaGeneralUri))
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   162
            {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   163
            TParsePtrC filePath(aMedia.ValueText(KMPXMediaGeneralUri) );
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   164
            iUri = filePath.FullName().AllocL();
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   165
            }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   166
        
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   167
		delete iTitle;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   168
		iTitle = NULL;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   169
        if ( aMedia.IsSupported( KMPXMediaGeneralTitle ) )
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   170
            {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   171
            iTitle = ( aMedia.ValueText( KMPXMediaGeneralTitle ) ).AllocL();
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   172
            }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   173
        else if ( aMedia.IsSupported( KMPXMediaGeneralUri ) )
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   174
            {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   175
            TParsePtrC filePath( aMedia.ValueText( KMPXMediaGeneralUri ) );
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   176
            iTitle = (filePath.Name()).AllocL();
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   177
            }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   178
		delete iArtist;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   179
		iArtist = NULL;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   180
		if ( aMedia.IsSupported( KMPXMediaMusicArtist ) )
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   181
		    {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   182
		    iArtist = ( aMedia.ValueText( KMPXMediaMusicArtist ) ).AllocL();
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   183
		    }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   184
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   185
		iObserver->TrackInfoChanged(iTitle ? *iTitle : KNullDesC(), iArtist ? *iArtist : KNullDesC());
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   186
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   187
		if (!iSkipping)
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   188
            {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   189
            if (iExtractingAlbumArt)
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   190
                {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   191
                iAlbumArtUtil->CancelRequest();
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   192
                iExtractingAlbumArt=EFalse;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   193
                }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   194
            
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   195
            if ( aMedia.IsSupported( KMPXMediaMusicAlbumArtFileName ) )
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   196
                {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   197
                delete iMedia;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   198
                iMedia=NULL;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   199
                iMedia = CMPXMedia::NewL( aMedia );
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   200
                TRAPD(err,iAlbumArtUtil->ExtractAlbumArtL(
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   201
                        *iMedia,
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   202
                        *this,
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   203
                        TSize(70,70),
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   204
                        EFalse));
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   205
                
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   206
                if (err != KErrNone)
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   207
                    {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   208
                    iObserver->AlbumArtChanged(NULL);
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   209
                    }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   210
                }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   211
            else
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   212
                {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   213
                iObserver->AlbumArtChanged(NULL);
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   214
                }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   215
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   216
            }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   217
		else
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   218
		    {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   219
		    iObserver->AlbumArtChanged(NULL);
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   220
		    }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   221
        }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   222
    }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   223
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   224
// ---------------------------------------------------------------------------
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   225
// From MMPXPlaybackCallback
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   226
// Handle completion of a asynchronous command
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   227
// ---------------------------------------------------------------------------
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   228
//
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   229
void CAiPlayerPluginEngine::HandlePlaybackCommandComplete( 
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   230
        CMPXCommand* /*aCommandResult*/, TInt /*aError*/ )
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   231
    {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   232
    // do nothing
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   233
    }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   234
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   235
// ---------------------------------------------------------------------------
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   236
// From MMPXAlbumArtUtilObserver
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   237
// Notify that extraction of album art started.
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   238
// ---------------------------------------------------------------------------
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   239
//
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   240
void CAiPlayerPluginEngine::ExtractAlbumArtStarted()
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   241
    {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   242
    iExtractingAlbumArt = ETrue;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   243
    }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   244
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   245
// ---------------------------------------------------------------------------
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   246
// From MMPXAlbumArtUtilObserver
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   247
// Notify that the extraction of album art has completed.
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   248
// ---------------------------------------------------------------------------
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   249
//
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   250
void CAiPlayerPluginEngine::ExtractAlbumArtCompleted( 
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   251
        CFbsBitmap* aBitmap, 
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   252
        TInt aErr )
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   253
    {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   254
    if (aErr == KErrNone)
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   255
        {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   256
        iObserver->AlbumArtChanged(aBitmap);
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   257
        }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   258
    else
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   259
        {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   260
        iObserver->AlbumArtChanged(NULL);
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   261
        }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   262
    iExtractingAlbumArt = EFalse;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   263
    }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   264
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   265
// ---------------------------------------------------------------------------
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   266
// Get the current state of the active player
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   267
// ---------------------------------------------------------------------------
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   268
//
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   269
TMPlayerState CAiPlayerPluginEngine::PlayerState()
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   270
    {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   271
    MPX_DEBUG1( "CAiPlayerPluginEngine::PlayerState" );
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   272
    TMPXPlaybackState state( EPbStateNotInitialised );
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   273
    TRAP_IGNORE( state = iPlaybackUtility->StateL() );
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   274
    return MapState( state );
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   275
    }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   276
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   277
// ---------------------------------------------------------------------------
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   278
// CAiPlayerPluginEngine::TitleL
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   279
// ---------------------------------------------------------------------------
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   280
//
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   281
const TDesC& CAiPlayerPluginEngine::TitleL()
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   282
    {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   283
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   284
    if ( iTitle )
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   285
        {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   286
        return *iTitle;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   287
        }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   288
     else
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   289
        {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   290
        RequestMediaL();
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   291
        return KNullDesC;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   292
        }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   293
    }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   294
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   295
// ---------------------------------------------------------------------------
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   296
// CAiPlayerPluginEngine::Artist
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   297
// ---------------------------------------------------------------------------
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   298
//
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   299
const TDesC& CAiPlayerPluginEngine::Artist()
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   300
    {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   301
    if ( iArtist )
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   302
        {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   303
        return *iArtist;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   304
        }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   305
     else
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   306
        {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   307
        return KNullDesC;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   308
        }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   309
    }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   310
// ---------------------------------------------------------------------------
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   311
// CAiPlayerPluginEngine::Artist
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   312
// ---------------------------------------------------------------------------
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   313
//
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   314
const TDesC& CAiPlayerPluginEngine::Uri()
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   315
    {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   316
    if ( iUri )
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   317
        {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   318
        return *iUri;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   319
        }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   320
     else
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   321
        {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   322
        return KNullDesC;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   323
        }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   324
    }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   325
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   326
// ----------------------------------------------------
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   327
// CAiPlayerPluginEngine::Position
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   328
// ----------------------------------------------------
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   329
//
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   330
TInt CAiPlayerPluginEngine::Position()
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   331
    {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   332
    return iPosition;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   333
    }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   334
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   335
// ----------------------------------------------------
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   336
// CAiPlayerPluginEngine::Duration
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   337
// ----------------------------------------------------
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   338
//
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   339
TInt CAiPlayerPluginEngine::Duration()
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   340
    {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   341
    return iDuration;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   342
    }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   343
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   344
// ---------------------------------------------------------------------------
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   345
// Handle playback message.
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   346
// ---------------------------------------------------------------------------
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   347
//
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   348
void CAiPlayerPluginEngine::DoHandlePlaybackMessageL( 
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   349
        const CMPXMessage& aMessage )
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   350
    {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   351
    MPX_DEBUG1("CAiPlayerPluginEngine::DoHandlePlaybackMessageL");
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   352
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   353
    TMPXMessageId id( 
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   354
            aMessage.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) );
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   355
    if ( KMPXMessageGeneral == id )
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   356
        {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   357
        TInt event( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) );
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   358
        MPX_DEBUG2( "CAiPlayerPluginEngine::DoHandlePlaybackMessageL(%d)", 
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   359
                event );
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   360
        switch ( event )
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   361
            {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   362
            case TMPXPlaybackMessage::EPropertyChanged:
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   363
                {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   364
                TInt error( KErrNone );
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   365
                DoHandlePropertyL(
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   366
                    aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ),
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   367
                    aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ),
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   368
                    error );
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   369
                break;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   370
                }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   371
            case TMPXPlaybackMessage::EStateChanged:
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   372
                {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   373
				TMPXPlaybackState state( 
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   374
				        aMessage.ValueTObjectL<TMPXPlaybackState>( 
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   375
				                KMPXMessageGeneralType ));
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   376
                MPX_DEBUG2("CAiPlayerPluginEngine::HandlePlaybackMessageL - E"
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   377
                        "StateChanged(%d)", state);
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   378
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   379
                DoHandleStateChangedL( state );
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   380
                break;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   381
                }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   382
            case TMPXPlaybackMessage::EMediaChanged:
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   383
            case TMPXPlaybackMessage::EPlaylistUpdated:
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   384
                {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   385
                MMPXSource* s = iPlaybackUtility->Source();
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   386
                if ( s )
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   387
                    {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   388
                    RequestMediaL();
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   389
                    }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   390
                else
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   391
                    {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   392
                    iObserver->PlaylisIsEmpty();
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   393
                    }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   394
                break;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   395
                }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   396
            case TMPXPlaybackMessage::ECommandReceived:
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   397
                {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   398
                MPX_DEBUG2("CAiPlayerPluginEngine::HandlePlaybackMessageL - E"
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   399
                        "CommandReceived(%d)",
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   400
                    aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ) );
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   401
                break;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   402
                }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   403
            case TMPXPlaybackMessage::EActivePlayerChanged:
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   404
                {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   405
                MPX_DEBUG3("CAiPlayerPluginEngine::HandlePlaybackMessageL - E"
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   406
                        "ActivePlayerChanged(%d, %d)",
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   407
                    aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ), 
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   408
                    aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ) );
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   409
                iPlaybackUtility->PropertyL( *this, EPbPropertyPosition );
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   410
                iPlaybackUtility->PropertyL( *this, EPbPropertyDuration );
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   411
                DoHandleStateChangedL( iPlaybackUtility->StateL() );
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   412
                // refresh media property
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   413
                RequestMediaL();
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   414
                break;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   415
                }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   416
            case TMPXPlaybackMessage::ESkipping:
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   417
                {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   418
                MPX_DEBUG1( "CAiPlayerPluginEngine::DoHandlePlaybackMessageL - ESkipping");
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   419
                iAlbumArtUtil->CancelRequest();
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   420
                iObserver->Opening();
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   421
                iSkipping =ETrue;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   422
                break;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   423
                }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   424
            case TMPXPlaybackMessage::ESkipEnd:
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   425
                {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   426
                MPX_DEBUG1( "CAiPlayerPluginEngine::DoHandlePlaybackMessageL - ESkipEnd()");
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   427
                iSkipping = EFalse;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   428
                break;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   429
                }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   430
            default:
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   431
                {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   432
                break;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   433
                }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   434
            }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   435
        }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   436
    }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   437
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   438
// ---------------------------------------------------------------------------
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   439
// Handle playback property.
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   440
// ---------------------------------------------------------------------------
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   441
//
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   442
void CAiPlayerPluginEngine::DoHandlePropertyL( TInt aProperty, TInt aValue, 
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   443
        TInt aError )
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   444
    {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   445
    MPX_DEBUG4("CAiPlayerPluginEngine::DoHandlePropertyL - Property(%d); Valu"
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   446
            "e(%d); Error(%d)", aProperty, aValue, aError );
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   447
    if ( KErrNone == aError )
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   448
        {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   449
        switch ( aProperty	)
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   450
            {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   451
            case EPbPropertyPosition:
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   452
                {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   453
				iPosition = aValue / KMPXOneSecInMilliSecs;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   454
                iObserver->PlaybackPositionChanged( iPosition );
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   455
                break;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   456
                }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   457
            case EPbPropertyDuration:
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   458
                {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   459
				iDuration = aValue / KMPXOneSecInMilliSecs;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   460
                break;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   461
                }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   462
            default:
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   463
                {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   464
                break;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   465
                }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   466
            }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   467
        }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   468
    }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   469
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   470
// ---------------------------------------------------------------------------
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   471
// Handle playback state changed.
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   472
// ---------------------------------------------------------------------------
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   473
//
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   474
void CAiPlayerPluginEngine::DoHandleStateChangedL( TMPXPlaybackState aState )
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   475
    {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   476
    TMPlayerState state = MapState( aState );
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   477
    MPX_DEBUG3("CAiPlayerPluginEngine::DoHandleStateChangedL - State mapped "
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   478
            "from (%d) to (%d)", aState, state );
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   479
    if (state != EMPlayerStateStarting)
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   480
        {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   481
        iObserver->PlayerStateChanged(state);
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   482
        }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   483
    else 
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   484
        {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   485
        iObserver->Opening();
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   486
        }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   487
    }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   488
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   489
// ---------------------------------------------------------------------------
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   490
// Displays error notes.
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   491
// ---------------------------------------------------------------------------
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   492
//
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   493
void CAiPlayerPluginEngine::HandleErrorL( TInt aError )
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   494
    {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   495
	MPX_DEBUG2("CAiPlayerPluginEngine::HandleErrorL(%d)", aError );
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   496
    }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   497
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   498
// ---------------------------------------------------------------------------
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   499
// Map states from TMPXPlaybackState to TMPlayerState
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   500
// ---------------------------------------------------------------------------
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   501
//
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   502
TMPlayerState CAiPlayerPluginEngine::MapState( TMPXPlaybackState aState )
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   503
    {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   504
	TMPlayerState state = EMPlayerStateOther;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   505
    switch ( aState )
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   506
        {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   507
        case EPbStatePlaying:
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   508
            state = EMPlayerStatePlaying;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   509
            break;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   510
        case EPbStatePaused:
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   511
            state = EMPlayerStatePaused;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   512
            break;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   513
        case EPbStateSeekingForward:
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   514
        case EPbStateSeekingBackward:
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   515
            state = EMPlayerStateSeeking;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   516
            break;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   517
        case EPbStateNotInitialised:
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   518
        case EPbStateInitialising:
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   519
            state = EMPlayerStateStarting;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   520
            break;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   521
        case EPbStateStopped:
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   522
            state = EMPlayerStateStopped;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   523
            break;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   524
        default:
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   525
            break;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   526
        }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   527
    return state;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   528
    }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   529
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   530
// ---------------------------------------------------------------------------
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   531
// Requests Media.
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   532
// ---------------------------------------------------------------------------
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   533
//
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   534
void CAiPlayerPluginEngine::RequestMediaL()
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   535
    {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   536
    MPX_DEBUG1( "CAiPlayerPluginEngine::RequestMediaL" );
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   537
    MMPXSource* s = iPlaybackUtility->Source();
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   538
    if ( s )
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   539
        {
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   540
        RArray<TMPXAttribute> attrs;
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   541
        CleanupClosePushL(attrs);
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   542
        attrs.Append( KMPXMediaGeneralUri );
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   543
        attrs.Append( KMPXMediaGeneralTitle );
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   544
        attrs.Append( KMPXMediaMusicArtist );
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   545
        attrs.Append( KMPXMediaMusicAlbumArtFileName );
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   546
        s->MediaL( attrs.Array(), *this );
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   547
        CleanupStack::PopAndDestroy( &attrs );
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   548
        }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   549
    }
3de6c4cf6b67 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   550
//  End of File