|
1 /* |
|
2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: This class is used for streaming audio. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CMMAAUDIOSTREAMPLAYER_H |
|
19 #define CMMAAUDIOSTREAMPLAYER_H |
|
20 |
|
21 // INCLUDES |
|
22 #include "CMMAAudioPlayer.h" |
|
23 #include "MMMAStreamHandlerListener.h" |
|
24 |
|
25 class CMMADataSourceStream; |
|
26 class CMMAStreamHandler; |
|
27 |
|
28 |
|
29 // CLASS DECLARATION |
|
30 /** |
|
31 * This class is used for playing audio from stream source. |
|
32 */ |
|
33 NONSHARABLE_CLASS(CMMAAudioStreamPlayer): public CMMAAudioPlayer, |
|
34 public MMMAStreamHandlerListener |
|
35 { |
|
36 public: // Construction |
|
37 /** |
|
38 * Creates new player. |
|
39 */ |
|
40 static CMMAAudioStreamPlayer* NewLC( |
|
41 CMMAMMFResolver* aResolver); |
|
42 |
|
43 // Destructor |
|
44 ~CMMAAudioStreamPlayer(); |
|
45 |
|
46 protected: |
|
47 // C++ constructor |
|
48 CMMAAudioStreamPlayer(CMMAMMFResolver* aResolver); |
|
49 void ConstructL(); |
|
50 |
|
51 private: // New methods |
|
52 /** |
|
53 * Loops through iControllerInfos and tries to open those |
|
54 * @param aSourceUid Data source uid |
|
55 * @param aSourceData Data for source |
|
56 * @param aSinkUid Data sink uid |
|
57 * @param aSinkData Data for sink. |
|
58 * @param aPrioritySettings Controller's priority. |
|
59 * @return KErrNone if controller was opened |
|
60 */ |
|
61 TInt DoOpen(TUid aSourceUid, |
|
62 const TDesC8& aSourceData, |
|
63 TUid aSinkUid, |
|
64 const TDesC8& aSinkData, |
|
65 TMMFPrioritySettings aPrioritySettings); |
|
66 |
|
67 /** |
|
68 * Starts playback and posts started event. |
|
69 */ |
|
70 void PrivateStartL(); |
|
71 |
|
72 public: // New methods |
|
73 /** |
|
74 * Pause playback without sending stopped event or changing state |
|
75 */ |
|
76 TInt Pause(); |
|
77 |
|
78 public: // from CMMAPlayer |
|
79 void StartL(TBool aPostEvent); |
|
80 void PrefetchL(); |
|
81 CMMASourceStream* AddSourceStreamL(JNIEnv* aJNIEnv, |
|
82 CMMAEventSource* aEventSource, |
|
83 jobject aReader); |
|
84 void GetDuration(TInt64* aDuration); |
|
85 void StopL(TBool aPostEvent); |
|
86 |
|
87 protected: // From CMMAAudioPlayer |
|
88 void PlayCompleteL(TInt aError); |
|
89 |
|
90 public: // from MMMAStreamHandlerListener |
|
91 void PrepareComplete(TInt aError); |
|
92 void StartComplete(TInt aError); |
|
93 void HandleError(TInt aError); |
|
94 |
|
95 private: // data |
|
96 // owned stream handler |
|
97 CMMAStreamHandler* iStreamHandler; |
|
98 |
|
99 // controller's state, prime panics if called twice |
|
100 TBool iControllerPrimed; |
|
101 }; |
|
102 |
|
103 #endif // CMMAAUDIOSTREAMPLAYER_H |