36 |
36 |
37 EXPORT_C CMMAEMCAudioPlayer::CMMAEMCAudioPlayer( |
37 EXPORT_C CMMAEMCAudioPlayer::CMMAEMCAudioPlayer( |
38 CMMAEMCResolver* aResolver): |
38 CMMAEMCResolver* aResolver): |
39 CMMAEMCPlayerBase(aResolver) |
39 CMMAEMCPlayerBase(aResolver) |
40 { |
40 { |
41 LOG( EJavaMMAPI, EInfo, "MMA::CMMAEMCAudioPlayer::CMMAEMCAudioPlayer"); |
41 LOG(EJavaMMAPI, EInfo, "MMA::CMMAEMCAudioPlayer::CMMAEMCAudioPlayer"); |
42 } |
42 } |
43 |
43 |
44 EXPORT_C void CMMAEMCAudioPlayer::ConstructL() |
44 EXPORT_C void CMMAEMCAudioPlayer::ConstructL() |
45 { |
45 { |
46 LOG( EJavaMMAPI, EInfo, "MMA::CMMAEMCAudioPlayer::ConstructL +"); |
46 LOG(EJavaMMAPI, EInfo, "MMA::CMMAEMCAudioPlayer::ConstructL +"); |
47 CMMAEMCPlayerBase::ConstructL(); |
47 CMMAEMCPlayerBase::ConstructL(); |
48 LOG( EJavaMMAPI, EInfo, "MMA::CMMAEMCAudioPlayer::ConstructL -"); |
48 LOG(EJavaMMAPI, EInfo, "MMA::CMMAEMCAudioPlayer::ConstructL -"); |
49 } |
49 } |
50 |
50 |
51 EXPORT_C void CMMAEMCAudioPlayer::PrefetchDataL(const TDesC8& /*aData*/) |
51 EXPORT_C void CMMAEMCAudioPlayer::PrefetchDataL(const TDesC8& /*aData*/) |
52 { |
52 { |
53 LOG( EJavaMMAPI, EInfo, "MMA::CMMAEMCAudioPlayer::PrefetchDataL +"); |
53 LOG(EJavaMMAPI, EInfo, "MMA::CMMAEMCAudioPlayer::PrefetchDataL +"); |
54 |
54 |
55 User::LeaveIfError(iMStreamControl->Prime()); |
55 User::LeaveIfError(iMStreamControl->Prime()); |
56 LOG( EJavaMMAPI, EInfo, "MMA::CMMAEMCAudioPlayer::PrefetchDataL -"); |
56 LOG(EJavaMMAPI, EInfo, "MMA::CMMAEMCAudioPlayer::PrefetchDataL -"); |
57 } |
57 } |
58 |
58 |
59 EXPORT_C void CMMAEMCAudioPlayer::PrefetchFileL() |
59 EXPORT_C void CMMAEMCAudioPlayer::PrefetchFileL() |
60 { |
60 { |
61 LOG( EJavaMMAPI, EInfo, "MMA::CMMAEMCAudioPlayer::Prefetching from file"); |
61 LOG(EJavaMMAPI, EInfo, "MMA::CMMAEMCAudioPlayer::Prefetching from file"); |
62 } |
62 } |
63 |
63 |
64 EXPORT_C void CMMAEMCAudioPlayer::PlayCompleteL(TInt aError) |
64 EXPORT_C void CMMAEMCAudioPlayer::PlayCompleteL(TInt aError) |
65 { |
65 { |
66 LOG( EJavaMMAPI, EInfo, "MMA::CMMAEMCAudioPlayer::PlayCompleteL +"); |
66 LOG(EJavaMMAPI, EInfo, "MMA::CMMAEMCAudioPlayer::PlayCompleteL +"); |
67 TInt64 time; |
67 TInt64 time; |
68 GetDuration(&time); |
68 GetDuration(&time); |
69 iMediaTime = time; |
69 iMediaTime = time; |
70 iStartedEventTime = 0; |
70 iStartedEventTime = 0; |
71 |
71 |
97 { |
97 { |
98 // error has occured, setting correct number of |
98 // error has occured, setting correct number of |
99 // repeats for next start |
99 // repeats for next start |
100 SetLoopCount(iRepeatNumberOfTimes); |
100 SetLoopCount(iRepeatNumberOfTimes); |
101 } |
101 } |
102 LOG( EJavaMMAPI, EInfo, "MMA::CMMAEMCAudioPlayer::PlayCompleteL -"); |
102 LOG(EJavaMMAPI, EInfo, "MMA::CMMAEMCAudioPlayer::PlayCompleteL -"); |
103 } |
103 } |
104 |
104 |
105 EXPORT_C void CMMAEMCAudioPlayer::RealizeL() |
105 EXPORT_C void CMMAEMCAudioPlayer::RealizeL() |
106 { |
106 { |
107 LOG( EJavaMMAPI, EInfo, "CMMAEMCAudioPlayer::RealizeL +"); |
107 LOG(EJavaMMAPI, EInfo, "CMMAEMCAudioPlayer::RealizeL +"); |
108 // DataSource must have at least 1 stream or |
108 // DataSource must have at least 1 stream or |
109 // we must have file to play |
109 // we must have file to play |
110 if ((iSourceStreams.Count() == 0) && !iFileName) |
110 if ((iSourceStreams.Count() == 0) && !iFileName) |
111 { |
111 { |
112 LOG( EJavaMMAPI, EInfo, "CMMAEMCAudioPlayer::RealizeL : Not Enough Streams"); |
112 LOG(EJavaMMAPI, EInfo, "CMMAEMCAudioPlayer::RealizeL : Not Enough Streams"); |
113 User::Leave(KErrNotEnoughStreams); |
113 User::Leave(KErrNotEnoughStreams); |
114 } |
114 } |
115 User::LeaveIfError(iMStreamControl->Open()); |
115 User::LeaveIfError(iMStreamControl->Open()); |
116 |
116 |
117 if (!iActiveSchedulerWait->IsStarted()) |
117 if (!iActiveSchedulerWait->IsStarted()) |
118 { |
118 { |
119 iActiveSchedulerWait->Start(); |
119 iActiveSchedulerWait->Start(); |
120 } |
120 } |
121 CMMAPlayer::RealizeL(); |
121 CMMAPlayer::RealizeL(); |
122 LOG( EJavaMMAPI, EInfo, "CMMAEMCAudioPlayer::RealizeL -"); |
122 LOG(EJavaMMAPI, EInfo, "CMMAEMCAudioPlayer::RealizeL -"); |
123 } |
123 } |
124 |
124 |
125 EXPORT_C void CMMAEMCAudioPlayer::PrefetchL() |
125 EXPORT_C void CMMAEMCAudioPlayer::PrefetchL() |
126 { |
126 { |
127 LOG( EJavaMMAPI, EInfo, "CMMAEMCAudioPlayer::PrefetchL +"); |
127 LOG(EJavaMMAPI, EInfo, "CMMAEMCAudioPlayer::PrefetchL +"); |
128 __ASSERT_DEBUG((iSourceStreams.Count() > 0) || iFileName, User::Invariant()); |
128 __ASSERT_DEBUG((iSourceStreams.Count() > 0) || iFileName, User::Invariant()); |
129 |
129 |
130 if (iFileName) |
130 if (iFileName) |
131 { |
131 { |
132 // prefetching the file |
132 // prefetching the file |
139 { |
139 { |
140 // Using TDes -- load the whole sound |
140 // Using TDes -- load the whole sound |
141 iSourceStreams[ 0 ]->ReadAllL(); |
141 iSourceStreams[ 0 ]->ReadAllL(); |
142 } |
142 } |
143 // CMMASourceStream will notify with ReadCompleted |
143 // CMMASourceStream will notify with ReadCompleted |
144 LOG( EJavaMMAPI, EInfo, "CMMAEMCAudioPlayer::PrefetchL -"); |
144 LOG(EJavaMMAPI, EInfo, "CMMAEMCAudioPlayer::PrefetchL -"); |
145 } |
145 } |
146 |
146 |
147 EXPORT_C const TDesC& CMMAEMCAudioPlayer::Type() |
147 EXPORT_C const TDesC& CMMAEMCAudioPlayer::Type() |
148 { |
148 { |
149 // Should be used in AMMS Implementation to differentiate between |
149 // Should be used in AMMS Implementation to differentiate between |
155 // CMMASourceStreamReader finished read operation |
155 // CMMASourceStreamReader finished read operation |
156 // This is called when ReadL is completed in Prefetch() |
156 // This is called when ReadL is completed in Prefetch() |
157 // |
157 // |
158 EXPORT_C void CMMAEMCAudioPlayer::ReadCompletedL(TInt aStatus, const TDesC8& aData) |
158 EXPORT_C void CMMAEMCAudioPlayer::ReadCompletedL(TInt aStatus, const TDesC8& aData) |
159 { |
159 { |
160 LOG( EJavaMMAPI, EInfo, "CMMAEMCAudioPlayer::ReadCompletedL +"); |
160 LOG(EJavaMMAPI, EInfo, "CMMAEMCAudioPlayer::ReadCompletedL +"); |
161 LOG1( EJavaMMAPI, EInfo, "CMMAEMCAudioPlayer::ReadCompletedL: status = %d", aStatus); |
161 LOG1(EJavaMMAPI, EInfo, "CMMAEMCAudioPlayer::ReadCompletedL: status = %d", aStatus); |
162 if (aStatus < KErrNone) |
162 if (aStatus < KErrNone) |
163 { |
163 { |
164 PostActionCompleted(aStatus); |
164 PostActionCompleted(aStatus); |
165 } |
165 } |
166 else |
166 else |