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 "cmmaemcaudioplayer.h" |
|
23 #include "mmmastreamhandlerlistener.h" |
|
24 #include "cmmaemcresolver.h" |
|
25 #include <MetaDataUtility.h> |
|
26 |
|
27 class CMMADataSourceStream; |
|
28 class CMMAStreamHandler; |
|
29 |
|
30 |
|
31 // CLASS DECLARATION |
|
32 /** |
|
33 * This class is used for playing audio from stream source. |
|
34 */ |
|
35 NONSHARABLE_CLASS(CMMAAudioStreamPlayer): public CMMAEMCAudioPlayer, |
|
36 public MMMAStreamHandlerListener |
|
37 { |
|
38 public: // Construction |
|
39 /** |
|
40 * Creates new player. |
|
41 */ |
|
42 static CMMAAudioStreamPlayer* NewLC( |
|
43 CMMAEMCResolver* aResolver); |
|
44 |
|
45 // Destructor |
|
46 ~CMMAAudioStreamPlayer(); |
|
47 |
|
48 protected: |
|
49 // C++ constructor |
|
50 CMMAAudioStreamPlayer(CMMAEMCResolver* aResolver); |
|
51 void ConstructL(); |
|
52 |
|
53 private: // New methods |
|
54 |
|
55 /** |
|
56 * Starts playback and posts started event. |
|
57 */ |
|
58 void PrivateStartL(); |
|
59 |
|
60 public: // New methods |
|
61 /** |
|
62 * Pause playback without sending stopped event or changing state |
|
63 */ |
|
64 TInt Pause(); |
|
65 |
|
66 public: // from CMMAPlayer |
|
67 void DeallocateL(); |
|
68 void StartL(); |
|
69 void PrefetchL(); |
|
70 CMMASourceStream* AddSourceStreamL(JNIEnv* aJNIEnv, |
|
71 MMAFunctionServer* aEventSource, |
|
72 jobject aReader); |
|
73 |
|
74 void GetDuration(TInt64* aDuration); |
|
75 void StopL(TBool aPostEvent); |
|
76 |
|
77 protected: // From CMMAEMCAudioPlayer |
|
78 void PlayCompleteL(TInt aError); |
|
79 |
|
80 public: |
|
81 void AddDataSourceToStreamL(); |
|
82 void CreateStreamL(); |
|
83 CMetaDataUtility* MetaDataUtilityOwnership(); |
|
84 |
|
85 public: // from MMMAStreamHandlerListener |
|
86 void PrepareComplete(TInt aError); |
|
87 void StartComplete(TInt aError); |
|
88 void HandleError(TInt aError); |
|
89 |
|
90 public: // from MControlObserver |
|
91 void Event(MControl* aControl, |
|
92 TUint aEventType, |
|
93 TAny* aEventObject); |
|
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 // created here and ownership is transferred to |
|
103 // CMMAAudioStreamMetaDataControl by call to |
|
104 // MetaDataUtilityOwnership() |
|
105 CMetaDataUtility* iMetaDataUtility; |
|
106 }; |
|
107 |
|
108 #endif // CMMAAUDIOSTREAMPLAYER_H |
|