57 } |
57 } |
58 |
58 |
59 |
59 |
60 void CMMAPlayer::ConstructL() |
60 void CMMAPlayer::ConstructL() |
61 { |
61 { |
62 LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::ConstructL + "); |
62 LOG(EJavaMMAPI, EInfo, "MMA::CMMAPlayer::ConstructL + "); |
63 iDurationUpdater = CMMADurationUpdater::NewL(*this); |
63 iDurationUpdater = CMMADurationUpdater::NewL(*this); |
64 LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::ConstructL - "); |
64 LOG(EJavaMMAPI, EInfo, "MMA::CMMAPlayer::ConstructL - "); |
65 } |
65 } |
66 |
66 |
67 |
67 |
68 void CMMAPlayer::StaticAddSourceStreamL(JNIEnv* aJniEnv, |
68 void CMMAPlayer::StaticAddSourceStreamL(JNIEnv* aJniEnv, |
69 CMMAPlayer* aPlayer, |
69 CMMAPlayer* aPlayer, |
70 MMAFunctionServer* aEventSource, |
70 MMAFunctionServer* aEventSource, |
71 jobject aReader, |
71 jobject aReader, |
72 CMMASourceStream** aSourceStream) |
72 CMMASourceStream** aSourceStream) |
73 { |
73 { |
74 LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::StaticAddSourceStreamL +"); |
74 LOG(EJavaMMAPI, EInfo, "MMA::CMMAPlayer::StaticAddSourceStreamL +"); |
75 |
75 |
76 // JNI interface pointer can't be passed to different thread, so |
76 // JNI interface pointer can't be passed to different thread, so |
77 // it is needed to get valid JNI interface pointer for Event Server thread |
77 // it is needed to get valid JNI interface pointer for Event Server thread |
78 aJniEnv = aEventSource-> getValidJniEnv(); |
78 aJniEnv = aEventSource-> getValidJniEnv(); |
79 |
79 |
80 *aSourceStream = aPlayer->AddSourceStreamL(aJniEnv, |
80 *aSourceStream = aPlayer->AddSourceStreamL(aJniEnv, |
81 aEventSource, |
81 aEventSource, |
82 aReader); |
82 aReader); |
83 LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::StaticAddSourceStreamL -"); |
83 LOG(EJavaMMAPI, EInfo, "MMA::CMMAPlayer::StaticAddSourceStreamL -"); |
84 } |
84 } |
85 |
85 |
86 |
86 |
87 |
87 |
88 void CMMAPlayer::StaticSetPlayerListenerObjectL(CMMAPlayer* aPlayer, |
88 void CMMAPlayer::StaticSetPlayerListenerObjectL(CMMAPlayer* aPlayer, |
89 MMAFunctionServer* aEventsource, |
89 MMAFunctionServer* aEventsource, |
90 jobject aListenerObject, |
90 jobject aListenerObject, |
91 JNIEnv* aJni, |
91 JNIEnv* aJni, |
92 MMMAEventPoster* aPoster) |
92 MMMAEventPoster* aPoster) |
93 { |
93 { |
94 |
94 |
95 LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::StaticSetPlayerListenerObjectL +"); |
95 LOG(EJavaMMAPI, EInfo, "MMA::CMMAPlayer::StaticSetPlayerListenerObjectL +"); |
96 |
96 |
97 // JNI interface pointer can't be passed to different thread, so |
97 // JNI interface pointer can't be passed to different thread, so |
98 // it is needed to get valid JNI interface pointer for Event Server thread |
98 // it is needed to get valid JNI interface pointer for Event Server thread |
99 aJni = aEventsource-> getValidJniEnv(); |
99 aJni = aEventsource-> getValidJniEnv(); |
100 |
100 |
101 aPlayer->SetPlayerListenerObjectL(aListenerObject, aJni, aPoster); |
101 aPlayer->SetPlayerListenerObjectL(aListenerObject, aJni, aPoster); |
102 |
102 |
103 LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::StaticSetPlayerListenerObjectL -"); |
103 LOG(EJavaMMAPI, EInfo, "MMA::CMMAPlayer::StaticSetPlayerListenerObjectL -"); |
104 } |
104 } |
105 |
105 |
106 |
106 |
107 void CMMAPlayer::StaticInitPlayerL(CMMAPlayer* aPlayer, |
107 void CMMAPlayer::StaticInitPlayerL(CMMAPlayer* aPlayer, |
108 MMAFunctionServer* aEventsource, |
108 MMAFunctionServer* aEventsource, |
109 jobject aPlayerObject, |
109 jobject aPlayerObject, |
110 JNIEnv* aJni) |
110 JNIEnv* aJni) |
111 { |
111 { |
112 LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::StaticInitPlayerL +"); |
112 LOG(EJavaMMAPI, EInfo, "MMA::CMMAPlayer::StaticInitPlayerL +"); |
113 |
113 |
114 // JNI interface pointer can't be passed to different thread, so |
114 // JNI interface pointer can't be passed to different thread, so |
115 // it is needed to get valid JNI interface pointer for Event Server thread |
115 // it is needed to get valid JNI interface pointer for Event Server thread |
116 aJni = aEventsource-> getValidJniEnv(); |
116 aJni = aEventsource-> getValidJniEnv(); |
117 |
117 |
118 jmethodID actionCompletedMethod = aJni->GetMethodID( |
118 jmethodID actionCompletedMethod = aJni->GetMethodID( |
119 aJni->GetObjectClass(aPlayerObject), |
119 aJni->GetObjectClass(aPlayerObject), |
120 "actionCompleted", |
120 "actionCompleted", |
121 "(I)V"); |
121 "(I)V"); |
122 |
122 |
123 jmethodID actionCompletedFileMethod = aJni->GetMethodID( |
123 jmethodID actionCompletedFileMethod = aJni->GetMethodID( |
124 aJni->GetObjectClass(aPlayerObject), |
124 aJni->GetObjectClass(aPlayerObject), |
125 "actionCompletedFile", |
125 "actionCompletedFile", |
126 "()V"); |
126 "()V"); |
127 |
127 |
128 jmethodID actionCompletedStartMethod = aJni->GetMethodID( |
128 jmethodID actionCompletedStartMethod = aJni->GetMethodID( |
129 aJni->GetObjectClass(aPlayerObject), |
129 aJni->GetObjectClass(aPlayerObject), |
130 "actionCompletedStart", |
130 "actionCompletedStart", |
131 "()V"); |
131 "()V"); |
132 |
132 |
133 // Sanity Check, something is really wrong if methods cannot be found |
133 // Sanity Check, something is really wrong if methods cannot be found |
134 __ASSERT_DEBUG(actionCompletedMethod, |
134 __ASSERT_DEBUG(actionCompletedMethod, |
135 User::Panic(KPanicMethod, KErrGeneral)); |
135 User::Panic(KPanicMethod, KErrGeneral)); |
136 |
136 |
137 aPlayer->iActionCompletedEvent = new(ELeave) CMMAEvent( |
137 aPlayer->iActionCompletedEvent = new(ELeave) CMMAEvent( |
138 aPlayerObject, |
138 aPlayerObject, |
139 actionCompletedMethod, |
139 actionCompletedMethod, |
140 CMMAEvent::EReusableEvent); |
140 CMMAEvent::EReusableEvent); |
141 |
141 |
142 aPlayer->iActionCompletedFileEvent = new(ELeave) CMMAEvent( |
142 aPlayer->iActionCompletedFileEvent = new(ELeave) CMMAEvent( |
143 aPlayerObject, |
143 aPlayerObject, |
144 actionCompletedFileMethod, |
144 actionCompletedFileMethod, |
145 CMMAEvent::EReusableEvent); |
145 CMMAEvent::EReusableEvent); |
146 |
146 |
147 aPlayer->iActionCompletedStartEvent = new(ELeave) CMMAEvent( |
147 aPlayer->iActionCompletedStartEvent = new(ELeave) CMMAEvent( |
148 aPlayerObject, |
148 aPlayerObject, |
149 actionCompletedStartMethod, |
149 actionCompletedStartMethod, |
150 CMMAEvent::EReusableEvent); |
150 CMMAEvent::EReusableEvent); |
151 |
151 |
152 LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::StaticInitPlayerL -"); |
152 LOG(EJavaMMAPI, EInfo, "MMA::CMMAPlayer::StaticInitPlayerL -"); |
153 } |
153 } |
154 |
154 |
155 CMMAControl* CMMAPlayer::StaticControl(CMMAPlayer* aPlayer, TInt aIndex) |
155 CMMAControl* CMMAPlayer::StaticControl(CMMAPlayer* aPlayer, TInt aIndex) |
156 { |
156 { |
157 LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::StaticControl +"); |
157 LOG(EJavaMMAPI, EInfo, "MMA::CMMAPlayer::StaticControl +"); |
158 return aPlayer->Control(aIndex); |
158 return aPlayer->Control(aIndex); |
159 |
159 |
160 } |
160 } |
161 |
161 |
162 |
162 |
163 void CMMAPlayer::RealizeL() |
163 void CMMAPlayer::RealizeL() |
164 { |
164 { |
165 LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::RealizeL +"); |
165 LOG(EJavaMMAPI, EInfo, "MMA::CMMAPlayer::RealizeL +"); |
166 ChangeState(ERealized); |
166 ChangeState(ERealized); |
167 |
167 |
168 } |
168 } |
169 |
169 |
170 |
170 |
171 void CMMAPlayer::CloseL() |
171 void CMMAPlayer::CloseL() |
172 { |
172 { |
173 LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::CloseL "); |
173 LOG(EJavaMMAPI, EInfo, "MMA::CMMAPlayer::CloseL "); |
174 ChangeState(EClosed); |
174 ChangeState(EClosed); |
175 PostObjectEvent(CMMAPlayerEvent::EClosed, NULL); |
175 PostObjectEvent(CMMAPlayerEvent::EClosed, NULL); |
176 } |
176 } |
177 |
177 |
178 |
178 |
179 void CMMAPlayer::GetDuration(TInt64* aDuration) |
179 void CMMAPlayer::GetDuration(TInt64* aDuration) |
180 { |
180 { |
181 LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::GetDuration "); |
181 LOG(EJavaMMAPI, EInfo, "MMA::CMMAPlayer::GetDuration "); |
182 *aDuration = iDuration; |
182 *aDuration = iDuration; |
183 } |
183 } |
184 |
184 |
185 |
185 |
186 void CMMAPlayer::SetMediaTimeL(TInt64* aTime) |
186 void CMMAPlayer::SetMediaTimeL(TInt64* aTime) |
187 { |
187 { |
188 LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::SetMediaTimeL "); |
188 LOG(EJavaMMAPI, EInfo, "MMA::CMMAPlayer::SetMediaTimeL "); |
189 *aTime = KErrNotSupported; |
189 *aTime = KErrNotSupported; |
190 } |
190 } |
191 |
191 |
192 void CMMAPlayer::GetMediaTime(TInt64* aMediaTime) |
192 void CMMAPlayer::GetMediaTime(TInt64* aMediaTime) |
193 { |
193 { |
194 LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::GetMediaTime "); |
194 LOG(EJavaMMAPI, EInfo, "MMA::CMMAPlayer::GetMediaTime "); |
195 *aMediaTime = KErrNotSupported; |
195 *aMediaTime = KErrNotSupported; |
196 } |
196 } |
197 |
197 |
198 |
198 |
199 EXPORT_C void CMMAPlayer::SetLoopCount(TInt aCount) |
199 EXPORT_C void CMMAPlayer::SetLoopCount(TInt aCount) |
200 { |
200 { |
201 LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::SetLoopCount "); |
201 LOG(EJavaMMAPI, EInfo, "MMA::CMMAPlayer::SetLoopCount "); |
202 iRepeatForever = (aCount == KJavaRepeatForever); |
202 iRepeatForever = (aCount == KJavaRepeatForever); |
203 iRepeatNumberOfTimes = aCount; |
203 iRepeatNumberOfTimes = aCount; |
204 iRepeatCount = 0; |
204 iRepeatCount = 0; |
205 } |
205 } |
206 |
206 |
207 HBufC* CMMAPlayer::ContentType() const |
207 HBufC* CMMAPlayer::ContentType() const |
208 { |
208 { |
209 LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::ContentType "); |
209 LOG(EJavaMMAPI, EInfo, "MMA::CMMAPlayer::ContentType "); |
210 return iContentType; |
210 return iContentType; |
211 } |
211 } |
212 |
212 |
213 void CMMAPlayer::SetPlayerListenerObjectL(jobject aListenerObject, |
213 void CMMAPlayer::SetPlayerListenerObjectL(jobject aListenerObject, |
214 JNIEnv* aJni, |
214 JNIEnv* aJni, |
215 MMMAEventPoster* aEventPoster) |
215 MMMAEventPoster* aEventPoster) |
216 { |
216 { |
217 LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::SetPlayerListenerObjectL +"); |
217 LOG(EJavaMMAPI, EInfo, "MMA::CMMAPlayer::SetPlayerListenerObjectL +"); |
218 iListenerObject = aListenerObject; |
218 iListenerObject = aListenerObject; |
219 iEventPoster = aEventPoster; |
219 iEventPoster = aEventPoster; |
220 |
220 |
221 jclass listenerClass = aJni->GetObjectClass(aListenerObject); |
221 jclass listenerClass = aJni->GetObjectClass(aListenerObject); |
222 |
222 |
446 } |
446 } |
447 |
447 |
448 |
448 |
449 void CMMAPlayer::PostActionCompleted(TInt aError) |
449 void CMMAPlayer::PostActionCompleted(TInt aError) |
450 { |
450 { |
451 LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::PostActionCompleted "); |
451 LOG(EJavaMMAPI, EInfo, "MMA::CMMAPlayer::PostActionCompleted "); |
452 iActionCompletedEvent->SetEventData(aError); |
452 iActionCompletedEvent->SetEventData(aError); |
453 iEventPoster->PostEvent(iActionCompletedEvent, |
453 iEventPoster->PostEvent(iActionCompletedEvent, |
454 CMMAEvent::ENotifyPriority); |
454 CMMAEvent::ENotifyPriority); |
455 } |
455 } |
456 |
456 |
457 void CMMAPlayer::PostActionCompletedFile() |
457 void CMMAPlayer::PostActionCompletedFile() |
458 { |
458 { |
459 LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::PostActionCompleted "); |
459 LOG(EJavaMMAPI, EInfo, "MMA::CMMAPlayer::PostActionCompletedFile "); |
460 // iActionCompletedFileEvent->SetEventData(aError); |
460 // iActionCompletedFileEvent->SetEventData(aError); |
461 iEventPoster->PostEvent(iActionCompletedFileEvent, |
461 iEventPoster->PostEvent(iActionCompletedFileEvent, |
462 CMMAEvent::ENotifyPriority); |
462 CMMAEvent::ENotifyPriority); |
463 } |
463 } |
464 |
464 |
465 |
465 |
466 void CMMAPlayer::PostActionCompletedStart() |
466 void CMMAPlayer::PostActionCompletedStart() |
467 { |
467 { |
468 LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::PostActionCompleted "); |
468 LOG(EJavaMMAPI, EInfo, "MMA::CMMAPlayer::PostActionCompletedStart "); |
469 iEventPoster->PostEvent(iActionCompletedStartEvent, |
469 iEventPoster->PostEvent(iActionCompletedStartEvent, |
470 CMMAEvent::ENotifyPriority); |
470 CMMAEvent::ENotifyPriority); |
471 } |
471 } |
472 |
472 |
473 void CMMAPlayer::ChangeState(TPlayerState aState) |
473 void CMMAPlayer::ChangeState(TPlayerState aState) |
474 { |
474 { |
475 iState = aState; |
475 iState = aState; |
476 LOG1( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::ChangeState - iStateListeners count is %d", iStateListeners.Count()); |
476 LOG1(EJavaMMAPI, EInfo, "MMA::CMMAPlayer::ChangeState - iStateListeners count is %d", iStateListeners.Count()); |
477 for (TInt i(0); i<iStateListeners.Count(); i++) |
477 for (TInt i(0); i<iStateListeners.Count(); i++) |
478 { |
478 { |
479 iStateListeners[ i ]->StateChanged(aState); |
479 iStateListeners[ i ]->StateChanged(aState); |
480 } |
480 } |
481 LOG1( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::ChangeState - State changed to %d", iState); |
481 LOG1(EJavaMMAPI, EInfo, "MMA::CMMAPlayer::ChangeState - State changed to %d", iState); |
482 } |
482 } |
483 |
483 |
484 void CMMAPlayer::ReadCompletedL(TInt /*aStatus*/, const TDesC8& /*aData*/) |
484 void CMMAPlayer::ReadCompletedL(TInt /*aStatus*/, const TDesC8& /*aData*/) |
485 { |
485 { |
486 // empty implementation |
486 // empty implementation |
487 LOG( EJavaMMAPI, EInfo, "MMA::CMMAPlayer::ReadCompletedL "); |
487 LOG(EJavaMMAPI, EInfo, "MMA::CMMAPlayer::ReadCompletedL "); |
488 } |
488 } |
489 void CMMAPlayer:: DeleteControls() |
489 void CMMAPlayer:: DeleteControls() |
490 { |
490 { |
491 if (iControls.Count() > 0) |
491 if (iControls.Count() > 0) |
492 { |
492 { |