|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the Qt Mobility Components. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
15 ** |
|
16 ** GNU Lesser General Public License Usage |
|
17 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 ** General Public License version 2.1 as published by the Free Software |
|
19 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 ** packaging of this file. Please review the following information to |
|
21 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 ** |
|
24 ** In addition, as a special exception, Nokia gives you certain additional |
|
25 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 ** |
|
28 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 #ifndef S60AUDIOPLAYERSESSION_H |
|
43 #define S60AUDIOPLAYERSESSION_H |
|
44 |
|
45 #include "s60mediaplayersession.h" |
|
46 |
|
47 #ifdef S60_DRM_SUPPORTED |
|
48 #include <drmaudiosampleplayer.h> |
|
49 typedef CDrmPlayerUtility CAudioPlayer; |
|
50 typedef MDrmAudioPlayerCallback MAudioPlayerObserver; |
|
51 #else |
|
52 #include <mdaaudiosampleplayer.h> |
|
53 typedef CMdaAudioPlayerUtility CAudioPlayer; |
|
54 typedef MMdaAudioPlayerCallback MAudioPlayerObserver; |
|
55 #endif |
|
56 |
|
57 #include <AudioOutput.h> |
|
58 #include <MAudioOutputObserver.h> |
|
59 |
|
60 class S60AudioPlayerSession : public S60MediaPlayerSession |
|
61 , public MAudioPlayerObserver |
|
62 , public MAudioLoadingObserver |
|
63 , public MAudioOutputObserver |
|
64 { |
|
65 Q_OBJECT |
|
66 |
|
67 public: |
|
68 S60AudioPlayerSession(QObject *parent); |
|
69 ~S60AudioPlayerSession(); |
|
70 |
|
71 //From S60MediaPlayerSession |
|
72 bool isVideoAvailable() const; |
|
73 bool isAudioAvailable() const; |
|
74 |
|
75 // From MAudioLoadingObserver |
|
76 void MaloLoadingStarted(); |
|
77 void MaloLoadingComplete(); |
|
78 |
|
79 // From MAudioOutputObserver |
|
80 void DefaultAudioOutputChanged( CAudioOutput& aAudioOutput, |
|
81 CAudioOutput::TAudioOutputPreference aNewDefault ); |
|
82 |
|
83 public: |
|
84 // From S60MediaPlayerAudioEndpointSelector |
|
85 QString activeEndpoint() const; |
|
86 QString defaultEndpoint() const; |
|
87 public Q_SLOTS: |
|
88 void setActiveEndpoint(const QString& name); |
|
89 Q_SIGNALS: |
|
90 void activeEndpointChanged(const QString & name); |
|
91 |
|
92 protected: |
|
93 //From S60MediaPlayerSession |
|
94 void doLoadL(const TDesC &path); |
|
95 void doLoadUrlL(const TDesC &path){Q_UNUSED(path)/*empty implementation*/} |
|
96 void doPlay(); |
|
97 void doStop(); |
|
98 void doPauseL(); |
|
99 void doSetVolumeL(int volume); |
|
100 qint64 doGetPositionL() const; |
|
101 void doSetPositionL(qint64 microSeconds); |
|
102 void updateMetaDataEntriesL(); |
|
103 int doGetBufferStatusL() const; |
|
104 qint64 doGetDurationL() const; |
|
105 |
|
106 private: |
|
107 #ifdef S60_DRM_SUPPORTED |
|
108 // From MMdaAudioPlayerCallback |
|
109 void MdapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration); |
|
110 void MdapcPlayComplete(TInt aError); |
|
111 #else |
|
112 // From MDrmAudioPlayerCallback |
|
113 void MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration); |
|
114 void MapcPlayComplete(TInt aError); |
|
115 #endif |
|
116 QString qStringFromTAudioOutputPreference(CAudioOutput::TAudioOutputPreference output) const; |
|
117 |
|
118 private: |
|
119 CAudioPlayer *m_player; |
|
120 CAudioOutput *m_audioOutput; |
|
121 }; |
|
122 |
|
123 #endif |