javauis/mmapi_qt/baseline/src/cmmammfplayerbase.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 31 Aug 2010 15:09:22 +0300
branchRCL_3
changeset 65 ae942d28ec0e
permissions -rw-r--r--
Revision: v2.2.11 Kit: 201035
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
65
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     1
/*
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     2
* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     3
* All rights reserved.
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     8
*
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    11
*
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    12
* Contributors:
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    13
*
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    14
* Description:  This class is used for playing sounds
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    15
*
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    16
*/
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    17
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    18
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    19
//  INCLUDE FILES
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    20
#include <mmf/server/mmfdes.h>
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    21
#include <AudioPreference.h>
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    22
#include <logger.h>
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    23
#include "cmmammfplayerbase.h"
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    24
#include "cmmammfresolver.h"
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    25
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    26
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    27
CMMAMMFPlayerBase::~CMMAMMFPlayerBase()
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    28
{
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    29
    // First delete the control and then close the controller
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    30
    // Added after AudioOutputControl
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    31
    DeleteControls();
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    32
    if (iControllerInfos)
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    33
    {
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    34
        iControllerInfos->ResetAndDestroy();
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    35
    }
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    36
    delete iControllerInfos;
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    37
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    38
    if (iEventMonitor)
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    39
    {
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    40
        iEventMonitor->Cancel();
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    41
    }
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    42
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    43
    iController.Close();
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    44
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    45
    delete iEventMonitor;
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    46
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    47
    delete iFileName;
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    48
}
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    49
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    50
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    51
CMMAMMFPlayerBase::CMMAMMFPlayerBase(
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    52
    CMMAMMFResolver* aResolver) :
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    53
        iMediaTime(KTimeUnknown), iStartedEventTime(0)
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    54
{
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    55
    // implementation array ownership is transferred
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    56
    iControllerInfos = aResolver->ImplementationsOwnership();
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    57
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    58
    // content type ownership is transferred
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    59
    iContentType = aResolver->ContentTypeOwnership();
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    60
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    61
    // file name ownership is transferred
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    62
    iFileName = aResolver->FileNameOwnership();
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    63
}
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    64
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    65
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    66
void CMMAMMFPlayerBase::ConstructL()
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    67
{
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    68
    CMMAPlayer::ConstructL();
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    69
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    70
    // Create an event monitor
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    71
    iEventMonitor =
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    72
        CMMFControllerEventMonitor::NewL(*this, iController);
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    73
}
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    74
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    75
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    76
EXPORT_C RMMFController& CMMAMMFPlayerBase::Controller()
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    77
{
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    78
    return iController;
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    79
}
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    80
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    81
EXPORT_C TInt CMMAMMFPlayerBase::DoOpen(TUid aSourceUid,
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    82
                                        const TDesC8& aSourceData,
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    83
                                        TUid aSinkUid,
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    84
                                        const TDesC8& aSinkData,
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    85
                                        TMMFPrioritySettings aPrioritySettings)
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    86
{
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    87
    // Make sure any existing controller is closed.
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    88
    iEventMonitor->Cancel();
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    89
    iController.Close();
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    90
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    91
    // Try opening and configuring each controller in turn
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    92
    TInt error = KErrNotSupported;
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    93
    TInt index = 0;
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    94
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    95
    // Try controllers until found a good controller or out of list
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    96
    while ((error != KErrNone) &&
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    97
            (index < iControllerInfos->Count()))
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    98
    {
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    99
        // Open the controller
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   100
        error = iController.Open((*iControllerInfos)[ index ]->Uid(),
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   101
                                 aPrioritySettings, ETrue);
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   102
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   103
        // If the controller was opened without error, start receiving events from it.
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   104
        if (!error)
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   105
        {
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   106
            iEventMonitor->Start();
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   107
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   108
            // Add the data source to the controller.
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   109
            error = iController.AddDataSource(aSourceUid, aSourceData);
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   110
        }
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   111
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   112
        // Add the data sink
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   113
        if (!error)
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   114
        {
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   115
            error = iController.AddDataSink(aSinkUid, aSinkData);
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   116
        }
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   117
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   118
        // If an error occurred in any of the above, close the controller.
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   119
        if (error)
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   120
        {
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   121
            iEventMonitor->Cancel();
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   122
            iController.Close();
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   123
        }
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   124
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   125
        index++;
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   126
    }
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   127
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   128
    return error;
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   129
}
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   130
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   131
TBool CMMAMMFPlayerBase::IsFilePlayer()
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   132
{
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   133
    if (iFileName != NULL)
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   134
    {
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   135
        return ETrue;
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   136
    }
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   137
    return EFalse;
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   138
}
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   139
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   140
void CMMAMMFPlayerBase::StartL()
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   141
{
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   142
    LOG(EJavaMMAPI, EInfo, "CMMAMMFPlayerBase::StartL +");
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   143
    iMediaTime = KTimeUnknown;
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   144
    User::LeaveIfError(iController.Play());
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   145
    LOG(EJavaMMAPI, EInfo, "CMMAMMFPlayerBase::StartL after iController.Play() ");
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   146
    // inform java side
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   147
    ChangeState(EStarted);
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   148
    LOG(EJavaMMAPI, EInfo, "CMMAMMFPlayerBase::StartL after ChangeState ");
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   149
    PostLongEvent(CMMAPlayerEvent::EStarted, iStartedEventTime);
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   150
    PostActionCompletedStart();
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   151
    LOG(EJavaMMAPI, EInfo, "CMMAMMFPlayerBase::StartL after PostLongEvent ");
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   152
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   153
//    PostActionCompleted(KErrNone);   // java start return
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   154
    LOG(EJavaMMAPI, EInfo, "CMMAMMFPlayerBase::StartL after PostActionCompleted ");
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   155
}
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   156
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   157
void CMMAMMFPlayerBase::StopL(TBool aPostEvent)
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   158
{
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   159
    if (iState == EStarted)
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   160
    {
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   161
        TInt64 time;
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   162
        GetMediaTime(&time);
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   163
        iStartedEventTime = time;
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   164
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   165
        TInt err = KErrNone;
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   166
        // AAC controller does not support multiple
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   167
        // calls to pause but leave with KErrNotReady.
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   168
        // That error is dismissed as player should
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   169
        // be paused already in that case.
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   170
        if (time == 0)
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   171
        {
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   172
            LOG(EJavaMMAPI, EInfo, "CMMAMMFPlayerBase::StopL: Position is zero, stopping");
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   173
            // Normally pause would be called, but if
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   174
            // current time is zero, Stop is called instead.
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   175
            // This is done because video playback breaks
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   176
            // if pause is called between events
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   177
            // KMMFEventCategoryVideoLoadingStarted and
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   178
            // KMMFEventCategoryVideoLoadingCompleted
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   179
            // (no wurther events are delivered altough
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   180
            // playback continues fine).
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   181
            // However calling Stop is tolerated in that
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   182
            // situation.
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   183
            err = iController.Stop();
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   184
            if (err == KErrNone)
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   185
            {
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   186
                err = iController.Prime();
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   187
            }
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   188
        }
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   189
        else
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   190
        {
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   191
            LOG(EJavaMMAPI, EInfo, "CMMAMMFPlayerBase::StopL: Position not zero, pausing");
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   192
            err = iController.Pause();
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   193
        }
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   194
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   195
        if ((err != KErrNone) && (err != KErrNotReady))
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   196
        {
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   197
            ELOG1(EJavaMMAPI, "CMMAMMFPlayerBase::StopL: pause/stop failed %d, leaving", err);
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   198
            User::Leave(err);
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   199
        }
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   200
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   201
        if (aPostEvent)
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   202
        {
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   203
            PostLongEvent(CMMAPlayerEvent::EStopped, time);
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   204
        }
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   205
        // go back to prefetched state
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   206
        ChangeState(EPrefetched);
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   207
    }
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   208
}
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   209
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   210
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   211
void CMMAMMFPlayerBase::DeallocateL()
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   212
{
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   213
    if (iState == EPrefetched)
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   214
    {
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   215
        // release all resources
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   216
        if (iEventMonitor)
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   217
        {
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   218
            iEventMonitor->Cancel();
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   219
        }
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   220
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   221
        // Change state first to enable AMMS to delete Effect API classes
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   222
        ChangeState(ERealized);
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   223
        iController.Stop();
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   224
        ResetSourceStreams();
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   225
    }
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   226
}
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   227
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   228
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   229
EXPORT_C void CMMAMMFPlayerBase::GetDuration(TInt64* aDuration)
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   230
{
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   231
    LOG(EJavaMMAPI, EInfo, "CMMAMMFPlayerBase::GetDuration ");
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   232
    if (iDuration == KTimeUnknown)
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   233
    {
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   234
        LOG(EJavaMMAPI, EInfo, "CMMAMMFPlayerBase::GetDuration Time unknown ");
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   235
        TTimeIntervalMicroSeconds duration;
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   236
        TInt err = iController.GetDuration(duration);
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   237
        if (!err)
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   238
        {
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   239
            iDuration = duration.Int64();
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   240
        }
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   241
    }
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   242
    *aDuration = iDuration;
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   243
    LOG(EJavaMMAPI, EInfo, "CMMAMMFPlayerBase::GetDuration - ");
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   244
}
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   245
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   246
void CMMAMMFPlayerBase::SetMediaTimeL(TInt64* aTime)
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   247
{
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   248
    LOG(EJavaMMAPI, EInfo, "CMMAMMFPlayerBase::SetMediaTimeL");
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   249
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   250
    // Negative values are not checked here
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   251
    // because it's done already in Java side.
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   252
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   253
    // Get clip duration
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   254
    TTimeIntervalMicroSeconds duration;
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   255
    User::LeaveIfError(iController.GetDuration(duration));
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   256
    LOG1(EJavaMMAPI, EInfo, "CMMAMMFPlayerBase::SetMediaTimeL iController.GetDuration=%d", duration.Int64());
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   257
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   258
    TTimeIntervalMicroSeconds position;
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   259
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   260
    // If the desired media time is beyond the duration,
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   261
    // the time is set to the end of the media.
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   262
    if (*aTime > duration.Int64())
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   263
    {
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   264
        position = duration;
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   265
    }
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   266
    else
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   267
    {
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   268
        position = *aTime;
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   269
    }
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   270
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   271
    TBool paused = EFalse;
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   272
    TInt err = KErrNone;
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   273
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   274
    if (iState == EStarted)
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   275
    {
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   276
        paused = ETrue;
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   277
        User::LeaveIfError(err = iController.Pause());
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   278
        ELOG1(EJavaMMAPI, "CMMAMMFPlayerBase::SetMediaTimeL after iController.Pause = %d", err);
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   279
    }
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   280
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   281
    if (err == KErrNone)
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   282
    {
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   283
        // The controller must be in the PRIMED or PLAYING state
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   284
        User::LeaveIfError(err = iController.SetPosition(position));
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   285
        ELOG1(EJavaMMAPI, "CMMAMMFPlayerBase::SetMediaTimeL iController.SetPosition() = %d", err);
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   286
    }
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   287
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   288
    // Reset cached media time, because actual set position may be
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   289
    // something else than aTime.
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   290
    iMediaTime = KTimeUnknown;
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   291
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   292
    // Inform about the position change to the StateListeners
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   293
    ChangeState(iState);
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   294
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   295
    // Get the actual media time
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   296
    GetMediaTime(aTime);
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   297
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   298
    iStartedEventTime = iMediaTime;
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   299
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   300
    if (err == KErrNone)
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   301
    {
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   302
        if (paused == (TBool)ETrue)
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   303
        {
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   304
            User::LeaveIfError(err = iController.Play());
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   305
            ELOG1(EJavaMMAPI, "CMMAMMFPlayerBase::SetMediaTimeL iController.Play() = %d", err);
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   306
        }
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   307
    }
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   308
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   309
    if (err != KErrNone)
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   310
    {
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   311
        User::Leave(err);
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   312
    }
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   313
}
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   314
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   315
void CMMAMMFPlayerBase::GetMediaTime(TInt64* aMediaTime)
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   316
{
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   317
    LOG(EJavaMMAPI, EInfo, "CMMAMMFPlayerBase::GetMediaTime +");
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   318
    TTimeIntervalMicroSeconds position(0);
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   319
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   320
    if (iMediaTime == KTimeUnknown || iState == EStarted)
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   321
    {
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   322
        // The controller must be in the PRIMED or PLAYING state
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   323
        TInt error(iController.GetPosition(position));
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   324
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   325
        if (error == KErrNone)
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   326
        {
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   327
            TInt64 newTime = position.Int64();
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   328
            LOG1(EJavaMMAPI, EInfo, "CMMAMMFPlayerBase::GetMediaTime iController.GetPosition : %d", newTime);
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   329
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   330
            // Sanity check for media time going backwards or beyond the
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   331
            // duration.
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   332
            // Some native controls may return zero media time for
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   333
            // a few moments just before playback will complete.
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   334
            if (newTime < iMediaTime ||
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   335
                    (iDuration > 0 && newTime > iDuration))
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   336
            {
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   337
                LOG(EJavaMMAPI, EInfo, "CMMAMMFPlayerBase::GetMediaTime.GetDuration ");
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   338
                GetDuration(&iMediaTime);
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   339
            }
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   340
            else
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   341
            {
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   342
                LOG(EJavaMMAPI, EInfo, "CMMAMMFPlayerBase::GetMediaTime.else ");
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   343
                // set return value
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   344
                iMediaTime = newTime;
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   345
            }
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   346
        }
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   347
        else
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   348
        {
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   349
            LOG1(EJavaMMAPI, EInfo, "CMMAMMFPlayerBase::GetMediaTime: error=%d, returning TIME_UNKNOWN", error);
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   350
            // cannot get media time
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   351
            iMediaTime = KTimeUnknown;
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   352
        }
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   353
    }
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   354
    *aMediaTime = iMediaTime;
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   355
    LOG1(EJavaMMAPI, EInfo, "CMMAMMFPlayerBase::GetMediaTime - %d", *aMediaTime);
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   356
}
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   357
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   358
void CMMAMMFPlayerBase::CloseL()
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   359
{
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   360
    CMMAPlayer::CloseL();
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   361
    if (iEventMonitor)
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   362
    {
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   363
        iEventMonitor->Cancel();
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   364
    }
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   365
    // First delete the control and then close the controller
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   366
    // Added after AudioOutputControl
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   367
    iController.Stop();
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   368
    delete iEventMonitor;
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   369
    iEventMonitor = NULL;
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   370
}
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   371
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   372
void CMMAMMFPlayerBase::HandleEvent(const TMMFEvent& /*aEvent*/)
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   373
{
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   374
    // empty implementation
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   375
}
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   376
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   377
//  END OF FILE