os/mm/mmlibs/mmfw/inc/mmf/server/mmfdatapath2.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
/**
sl@0
    17
 @file
sl@0
    18
 @internalTechnology 
sl@0
    19
*/
sl@0
    20
sl@0
    21
#ifndef MMFDATAPATH2_H
sl@0
    22
#define MMFDATAPATH2_H
sl@0
    23
sl@0
    24
#include <mmf/common/mmfcontroller.h>
sl@0
    25
#include <mmf/server/mmfdatasource.h>
sl@0
    26
#include <mmf/server/mmfdatasink.h>
sl@0
    27
#include <mmf/server/mmfcodec.h>
sl@0
    28
#include <mmf/server/mmfbuffer.h>
sl@0
    29
#include <mmf/common/mmfutilities.h>
sl@0
    30
#include <mmf/server/mmfformat.h>
sl@0
    31
#include <mmf/server/mmfsubthreadbase.h>
sl@0
    32
#include <mmf/server/mmfdatapath.h>
sl@0
    33
sl@0
    34
/**
sl@0
    35
sl@0
    36
This class is an extended version of CMMFDataPath. CMMFDataPath is extended to implement the loop play 
sl@0
    37
functionality in the controller. This class overrides some of the virual functions of CMMFDataPath in order to
sl@0
    38
implement the loop play functionality. All the controller plugins that require loop play functionality should
sl@0
    39
use CMMFDataPath2 in place of CMMFDataPath.
sl@0
    40
sl@0
    41
@see CMMFDataPath
sl@0
    42
*/
sl@0
    43
class CMMFDataPath2 : public CMMFDataPath
sl@0
    44
	{
sl@0
    45
public:
sl@0
    46
	//CMMFDataPath2 constructor if codec Uid is not already known by CMMFController
sl@0
    47
	//and there is no data path ambiguity - ie only one data path is possible
sl@0
    48
	IMPORT_C static CMMFDataPath2* NewL(MAsyncEventHandler& aEventHandler); 
sl@0
    49
sl@0
    50
	//CMMFDataPath2 constructor if codec Uid is not already known by CMMFController
sl@0
    51
	//and there is ambiguity ie more than one possible data path TMediaId used to select path 
sl@0
    52
	IMPORT_C static CMMFDataPath2* NewL(TMediaId aMediaId, MAsyncEventHandler& aEventHandler); 
sl@0
    53
sl@0
    54
	//CMMFDataPath2 constructor if codec Uid is already known by CMMFController
sl@0
    55
	//and there is no data path ambiguity - ie only one data path is possible
sl@0
    56
	IMPORT_C static CMMFDataPath2* NewL(TUid aCodecUid, MAsyncEventHandler& aEventHandler); 
sl@0
    57
sl@0
    58
	//CMMFDataPath2 constructor if codec Uid is already known by CMMFController
sl@0
    59
	//and there is ambiguity ie more than one possible data path TMediaId used to select path 
sl@0
    60
	IMPORT_C static CMMFDataPath2* NewL(TUid aCodecUid, TMediaId aMediaId, MAsyncEventHandler& aEventHandler);
sl@0
    61
sl@0
    62
	virtual ~CMMFDataPath2();
sl@0
    63
	virtual void BufferFilledL(CMMFBuffer* aBuffer); //called by the CMMFDataPath's MDataSource when it has filled the buffer
sl@0
    64
	
sl@0
    65
	virtual void PrimeL();
sl@0
    66
	virtual void PlayL();
sl@0
    67
	virtual void Pause();
sl@0
    68
	virtual void Stop();
sl@0
    69
	virtual void SetPositionL(const TTimeIntervalMicroSeconds& aPosition);
sl@0
    70
	virtual TTimeIntervalMicroSeconds Position() const;
sl@0
    71
	// Called when source and sink needs to be de-referenced
sl@0
    72
	virtual void ResetL();
sl@0
    73
	void RunL();
sl@0
    74
	// Set Repeats.
sl@0
    75
	IMPORT_C void SetRepeats(TInt aRepeatNumberOfTimes, const TTimeIntervalMicroSeconds& aTrailingSilence);
sl@0
    76
	IMPORT_C void SetDrmProperties(MDataSource* iDrmSource, TBool *aDisableAutoIntent);
sl@0
    77
	IMPORT_C void RetainRepeatInfo();
sl@0
    78
	IMPORT_C void PreEmptionPause();
sl@0
    79
	
sl@0
    80
protected:
sl@0
    81
	CMMFDataPath2(TMediaId aMediaId, MAsyncEventHandler& aEventHandler);
sl@0
    82
	void ConstructL(TUid aCodecUid = KNullUid);
sl@0
    83
	void FillSourceBufferL();
sl@0
    84
	void DoFillSourceBufferL();
sl@0
    85
	TTimeIntervalMicroSeconds CalculateAudioOutputPosition() const;
sl@0
    86
	//called when trailing silence playback is complete
sl@0
    87
	static TInt RepeatTrailingSilenceTimerComplete(TAny* aDataPath);
sl@0
    88
	TInt DoRepeatTrailingSilenceTimerCompleteL();
sl@0
    89
	void PlaySilence();
sl@0
    90
	void DoStopL();
sl@0
    91
	void DoPauseL();
sl@0
    92
	void DoCancel();
sl@0
    93
	TTimeIntervalMicroSeconds OutputPosition() const;
sl@0
    94
	void DoPreEmptionPauseL();
sl@0
    95
	
sl@0
    96
	
sl@0
    97
protected:
sl@0
    98
	/**
sl@0
    99
    The number of times to repeat the audio sample. 
sl@0
   100
    */
sl@0
   101
    TInt iNumberOfTimesToRepeat;
sl@0
   102
    
sl@0
   103
    /**
sl@0
   104
    The number of times played. 
sl@0
   105
    */
sl@0
   106
    TInt iNumberOfTimesPlayed;
sl@0
   107
	/**
sl@0
   108
    The time interval of the trailing silence in microseconds.
sl@0
   109
	*/
sl@0
   110
	TTimeIntervalMicroSeconds iTrailingSilence;
sl@0
   111
sl@0
   112
	/**
sl@0
   113
    The time interval of the trailing silence left to play in microseconds.
sl@0
   114
	*/
sl@0
   115
	TTimeIntervalMicroSeconds iTrailingSilenceLeftToPlay;
sl@0
   116
	
sl@0
   117
	/**
sl@0
   118
    The time left for the play will be completed in a particular repeat
sl@0
   119
	*/
sl@0
   120
	TTimeIntervalMicroSeconds iTimeLeftToPlayComplete;
sl@0
   121
sl@0
   122
	/**
sl@0
   123
	Timer used for trailing silences when repeating
sl@0
   124
	*/
sl@0
   125
	CPeriodic* iRepeatTrailingSilenceTimer;
sl@0
   126
	//This variable stores the devsound time played when the play is repositioned
sl@0
   127
	TTimeIntervalMicroSeconds iDevSoundRepositionTime;
sl@0
   128
	//states when the silence period between repeats needs to be verified
sl@0
   129
	TBool iVerifyPlayComplete;
sl@0
   130
	
sl@0
   131
	//For Drm implementation during repeats
sl@0
   132
	MDataSource* iDrmSource;
sl@0
   133
	TBool* iDisableAutoIntent;
sl@0
   134
	TBool iRetainRepeatInfo;
sl@0
   135
	TBool iGetTimePlayedSupported;
sl@0
   136
	TBool iIsResumeSupported;
sl@0
   137
	TBool iIsUsingResumeSupport;
sl@0
   138
	TBool iPauseCalledInsilence;
sl@0
   139
	}; 
sl@0
   140
sl@0
   141
#endif