11 { |
29 { |
12 char callback_string[50]; |
30 char callback_string[50]; |
13 COpenMaxPlayerUtility* pSelf = (COpenMaxPlayerUtility*)pContext; |
31 COpenMaxPlayerUtility* pSelf = (COpenMaxPlayerUtility*)pContext; |
14 if(event & XA_PLAYEVENT_HEADMOVING) |
32 if(event & XA_PLAYEVENT_HEADMOVING) |
15 { |
33 { |
16 strcpy(callback_string, "XA_PLAYEVENT_HEADMOVING"); |
34 strcpy(callback_string, "XA_PLAYEVENT_HEADMOVING"); |
17 } |
35 } |
18 else if(event & XA_PLAYEVENT_HEADATEND) |
36 else if(event & XA_PLAYEVENT_HEADATEND) |
19 { |
37 { |
20 strcpy(callback_string, "XA_PLAYEVENT_HEADATEND"); |
38 strcpy(callback_string, "XA_PLAYEVENT_HEADATEND"); |
21 bIsPlayDone = XA_BOOLEAN_TRUE; |
39 bIsPlayDone = XA_BOOLEAN_TRUE; |
22 pSelf->Stop(); |
40 pSelf->Stop(); |
23 } |
41 } |
24 else if(event & XA_PLAYEVENT_HEADATMARKER) |
42 else if(event & XA_PLAYEVENT_HEADATMARKER) |
25 { |
43 { |
26 strcpy(callback_string, "XA_PLAYEVENT_HEADATMARKER"); |
44 strcpy(callback_string, "XA_PLAYEVENT_HEADATMARKER"); |
27 } |
45 } |
28 else if(event & XA_PLAYEVENT_HEADATNEWPOS) |
46 else if(event & XA_PLAYEVENT_HEADATNEWPOS) |
29 { |
47 { |
30 strcpy(callback_string, "XA_PLAYEVENT_HEADATNEWPOS"); |
48 strcpy(callback_string, "XA_PLAYEVENT_HEADATNEWPOS"); |
31 } |
49 } |
32 else if(event & XA_PLAYEVENT_HEADSTALLED) |
50 else if(event & XA_PLAYEVENT_HEADSTALLED) |
33 { |
51 { |
34 strcpy(callback_string, "XA_PLAYEVENT_HEADSTALLED"); |
52 strcpy(callback_string, "XA_PLAYEVENT_HEADSTALLED"); |
35 } |
53 } |
36 //LOGFILE (callback_string); |
54 //LOGFILE (callback_string); |
37 } |
55 } |
38 |
56 |
39 COpenMaxPlayerUtility::COpenMaxPlayerUtility() |
57 COpenMaxPlayerUtility::COpenMaxPlayerUtility() |
64 (XAuint32) XA_ENGINEOPTION_THREADSAFE, |
82 (XAuint32) XA_ENGINEOPTION_THREADSAFE, |
65 (XAuint32) XA_BOOLEAN_TRUE |
83 (XAuint32) XA_BOOLEAN_TRUE |
66 }; |
84 }; |
67 |
85 |
68 /* Create OpenMAX AL */ |
86 /* Create OpenMAX AL */ |
69 res = xaCreateEngine(&m_engine, 1, EngineOption, 0, NULL, NULL); |
87 res = xaCreateEngine(&m_engine, 1, EngineOption, 0, NULL, NULL); |
70 CheckErr(res, "xaCreateEngine"); |
88 CheckErr(res, "xaCreateEngine"); |
71 |
89 |
72 /* Realizing the XA Engine in synchronous mode. */ |
90 /* Realizing the XA Engine in synchronous mode. */ |
73 res = (*m_engine)->Realize(m_engine, XA_BOOLEAN_FALSE); |
91 res = (*m_engine)->Realize(m_engine, XA_BOOLEAN_FALSE); |
74 CheckErr(res, "Realize(engine)"); |
92 CheckErr(res, "Realize(engine)"); |
75 |
93 |
76 /* Get the XA Engine Interface which is implicit */ |
94 /* Get the XA Engine Interface which is implicit */ |
77 res = (*m_engine)->GetInterface(m_engine, XA_IID_ENGINE, (void**) &m_EngineItf); |
95 res = (*m_engine)->GetInterface(m_engine, XA_IID_ENGINE, (void**) &m_EngineItf); |
78 CheckErr(res, "GetInterface(engine)"); |
96 CheckErr(res, "GetInterface(engine)"); |
79 |
97 |
80 /* Initialize arrays required[] and iidArray[] */ |
98 /* Initialize arrays required[] and iidArray[] */ |
81 for (i = 0; i < MAX_NUMBER_INTERFACES; i++) |
99 for (i = 0; i < MAX_NUMBER_INTERFACES; i++) |
82 { |
100 { |
89 m_iidArray[0] = XA_IID_VOLUME; |
107 m_iidArray[0] = XA_IID_VOLUME; |
90 m_required[1] = XA_BOOLEAN_TRUE; |
108 m_required[1] = XA_BOOLEAN_TRUE; |
91 m_iidArray[1] = XA_IID_EQUALIZER; |
109 m_iidArray[1] = XA_IID_EQUALIZER; |
92 |
110 |
93 /* Create Output Mix object to be used by player */ |
111 /* Create Output Mix object to be used by player */ |
94 res = (*m_EngineItf)->CreateOutputMix(m_EngineItf, &m_outputMix, 2, m_iidArray, m_required); |
112 res = (*m_EngineItf)->CreateOutputMix(m_EngineItf, &m_outputMix, 2, m_iidArray, m_required); |
95 CheckErr(res, "CreateOutputMix"); |
113 CheckErr(res, "CreateOutputMix"); |
96 |
114 |
97 /* Realizing the Output Mix object in synchronous mode. */ |
115 /* Realizing the Output Mix object in synchronous mode. */ |
98 res = (*m_outputMix)->Realize(m_outputMix, XA_BOOLEAN_FALSE); |
116 res = (*m_outputMix)->Realize(m_outputMix, XA_BOOLEAN_FALSE); |
99 CheckErr(res, "Realize(outputMix)"); |
117 CheckErr(res, "Realize(outputMix)"); |
100 |
118 |
101 /* Get volume and equalizer interfaces */ |
119 /* Get volume and equalizer interfaces */ |
102 res = (*m_outputMix)->GetInterface(m_outputMix, XA_IID_VOLUME, (void**) &m_volumeItf); |
120 res = (*m_outputMix)->GetInterface(m_outputMix, XA_IID_VOLUME, (void**) &m_volumeItf); |
103 CheckErr(res, "GetInterface(volume)"); |
121 CheckErr(res, "GetInterface(volume)"); |
104 res = (*m_outputMix)->GetInterface(m_outputMix, XA_IID_EQUALIZER, (void**) &m_equalizerItf); |
122 res = (*m_outputMix)->GetInterface(m_outputMix, XA_IID_EQUALIZER, (void**) &m_equalizerItf); |
105 CheckErr(res, "GetInterface(equalizer)"); |
123 CheckErr(res, "GetInterface(equalizer)"); |
106 |
124 |
107 // Setup the audio sink structure |
125 // Setup the audio sink structure |
108 m_locator_outputmix.locatorType = XA_DATALOCATOR_OUTPUTMIX; |
126 m_locator_outputmix.locatorType = XA_DATALOCATOR_OUTPUTMIX; |
109 m_locator_outputmix.outputMix = m_outputMix; |
127 m_locator_outputmix.outputMix = m_outputMix; |
110 m_audioSink.pLocator = (void*) &m_locator_outputmix; |
128 m_audioSink.pLocator = (void*) &m_locator_outputmix; |
111 m_audioSink.pFormat = NULL; |
129 m_audioSink.pFormat = NULL; |
112 |
130 |
114 m_required[0] = XA_BOOLEAN_TRUE; |
132 m_required[0] = XA_BOOLEAN_TRUE; |
115 m_iidArray[0] = XA_IID_DYNAMICSOURCE; |
133 m_iidArray[0] = XA_IID_DYNAMICSOURCE; |
116 m_required[1] = XA_BOOLEAN_FALSE; |
134 m_required[1] = XA_BOOLEAN_FALSE; |
117 m_iidArray[1] = XA_IID_NULL; |
135 m_iidArray[1] = XA_IID_NULL; |
118 |
136 |
119 // Setup the video sink structure |
137 // Setup the video sink structure |
120 // Set nativeWindowHandle and nativeDisplayHandle to platform specific values |
138 // Set nativeWindowHandle and nativeDisplayHandle to platform specific values |
121 XANativeHandle nativeWindowHandle = NULL; |
139 XANativeHandle nativeWindowHandle = NULL; |
122 XANativeHandle nativeDisplayHandle = NULL; |
140 XANativeHandle nativeDisplayHandle = NULL; |
123 |
141 |
124 m_locator_displayregion.locatorType = XA_DATALOCATOR_NATIVEDISPLAY; |
142 m_locator_displayregion.locatorType = XA_DATALOCATOR_NATIVEDISPLAY; |
125 m_locator_displayregion.hDisplay = nativeDisplayHandle; |
143 m_locator_displayregion.hDisplay = nativeDisplayHandle; |
126 m_locator_displayregion.hWindow = nativeWindowHandle; |
144 m_locator_displayregion.hWindow = nativeWindowHandle; |
127 m_videoSink.pLocator = (void*) &m_locator_displayregion; |
145 m_videoSink.pLocator = (void*) &m_locator_displayregion; |
128 m_videoSink.pFormat = NULL; |
146 m_videoSink.pFormat = NULL; |
129 |
147 |
130 /* Before we start set volume to -3dB (-300mB) and enable equalizer */ |
148 /* Before we start set volume to -3dB (-300mB) and enable equalizer */ |
131 XAmillibel minVol = m_nVolume = XA_MILLIBEL_MIN; |
149 XAmillibel minVol = m_nVolume = XA_MILLIBEL_MIN; |
132 XAmillibel maxVol = 0; |
150 XAmillibel maxVol = 0; |
133 res = (*m_volumeItf)->GetMaxVolumeLevel (m_volumeItf, &maxVol); |
151 res = (*m_volumeItf)->GetMaxVolumeLevel (m_volumeItf, &maxVol); |
134 CheckErr(res, "GetMaxVolumeLevel"); |
152 CheckErr(res, "GetMaxVolumeLevel"); |
135 |
153 |
136 // before Play, set volume |
154 // before Play, set volume |
137 res = (*m_volumeItf)->SetVolumeLevel(m_volumeItf, minVol); |
155 res = (*m_volumeItf)->SetVolumeLevel(m_volumeItf, minVol); |
138 CheckErr(res, "SetVolumeLevel"); |
156 CheckErr(res, "SetVolumeLevel"); |
139 } |
157 } |
140 |
158 |
141 void COpenMaxPlayerUtility::DestroyPlayer () |
159 void COpenMaxPlayerUtility::DestroyPlayer () |
142 { |
160 { |
143 XAresult res; |
161 XAresult res; |
144 XAuint32 playState; |
162 XAuint32 playState; |
145 /* Stop the music */ |
163 /* Stop the music */ |
146 res = (*m_playItf)->GetPlayState(m_playItf, &playState); |
164 res = (*m_playItf)->GetPlayState(m_playItf, &playState); |
147 CheckErr(res, "GetPlayState"); |
165 CheckErr(res, "GetPlayState"); |
148 |
166 |
149 if ( playState != XA_PLAYSTATE_STOPPED ) |
167 if ( playState != XA_PLAYSTATE_STOPPED ) |
150 { |
168 { |
151 res = (*m_playItf)->SetPlayState(m_playItf, XA_PLAYSTATE_STOPPED); |
169 res = (*m_playItf)->SetPlayState(m_playItf, XA_PLAYSTATE_STOPPED); |
152 CheckErr(res, "SetPlayState(stopped)"); |
170 CheckErr(res, "SetPlayState(stopped)"); |
153 } |
171 } |
154 |
172 |
155 // Destroy the player caused app to crash |
173 // Destroy the player caused app to crash |
156 // (*player)->Destroy(player); |
174 // (*player)->Destroy(player); |
157 } |
175 } |
158 |
176 |
159 /* |
177 /* |
160 * Called when the display is repainted. |
178 * Called when the display is repainted. |
167 XAmillibel maxLevel; |
185 XAmillibel maxLevel; |
168 XAmilliHertz minFreq; |
186 XAmilliHertz minFreq; |
169 XAmilliHertz maxFreq; |
187 XAmilliHertz maxFreq; |
170 int band; |
188 int band; |
171 XAresult res; |
189 XAresult res; |
172 res = (*m_equalizerItf)->GetNumberOfBands(m_equalizerItf, &numBands); |
190 res = (*m_equalizerItf)->GetNumberOfBands(m_equalizerItf, &numBands); |
173 CheckErr(res, "GetNumberOfBands(equalizerItf)"); |
191 CheckErr(res, "GetNumberOfBands(equalizerItf)"); |
174 res = (*m_equalizerItf)->GetBandLevelRange(m_equalizerItf, &minLevel, &maxLevel); |
192 res = (*m_equalizerItf)->GetBandLevelRange(m_equalizerItf, &minLevel, &maxLevel); |
175 CheckErr(res, "GetBandLevelRange(equalizerItf)"); |
193 CheckErr(res, "GetBandLevelRange(equalizerItf)"); |
176 for (band = 0; band<numBands; band++) |
194 for (band = 0; band<numBands; band++) |
177 { |
195 { |
178 res = (*m_equalizerItf)->GetBandFreqRange(m_equalizerItf, (XAint16) band, &minFreq, &maxFreq); |
196 res = (*m_equalizerItf)->GetBandFreqRange(m_equalizerItf, (XAint16) band, &minFreq, &maxFreq); |
179 CheckErr(res, "GetBandFreqRange(equalizerItf)"); |
197 CheckErr(res, "GetBandFreqRange(equalizerItf)"); |
180 res = (*m_equalizerItf)->GetBandLevel(m_equalizerItf, (XAint16)band, &bandLevel); |
198 res = (*m_equalizerItf)->GetBandLevel(m_equalizerItf, (XAint16)band, &bandLevel); |
181 CheckErr(res, "GetBandLevel(equalizerItf)"); |
199 CheckErr(res, "GetBandLevel(equalizerItf)"); |
182 // drawEQBand(minFreq, maxFreq, bandLevel); |
200 // drawEQBand(minFreq, maxFreq, bandLevel); |
183 } |
201 } |
184 } |
202 } |
185 |
203 |
218 } |
236 } |
219 |
237 |
220 void COpenMaxPlayerUtility::SetVolume(TInt aVolume) |
238 void COpenMaxPlayerUtility::SetVolume(TInt aVolume) |
221 { |
239 { |
222 m_nVolume = aVolume; |
240 m_nVolume = aVolume; |
223 XAresult res = (*m_volumeItf)->SetVolumeLevel(m_volumeItf, (XAmillibel)m_nVolume); |
241 XAresult res = (*m_volumeItf)->SetVolumeLevel(m_volumeItf, (XAmillibel)m_nVolume); |
224 CheckErr(res, "SetVolumeL"); |
242 CheckErr(res, "SetVolumeL"); |
225 } |
243 } |
226 |
244 |
227 void COpenMaxPlayerUtility::SetBalance(TInt /*aBalance*/) |
245 void COpenMaxPlayerUtility::SetBalance(TInt /*aBalance*/) |
228 { |
246 { |
229 } |
247 } |
230 |
248 |
231 void COpenMaxPlayerUtility::SetPosition(const TTimeIntervalMicroSeconds& /*aPosition*/) |
249 void COpenMaxPlayerUtility::SetPosition(const TTimeIntervalMicroSeconds& /*aPosition*/) |
232 { |
250 { |
233 |
251 |
234 } |
252 } |
235 |
253 |
236 void COpenMaxPlayerUtility::SetRotation(const RWindow& /*aWindow*/, TVideoRotation /*aRotation*/) |
254 void COpenMaxPlayerUtility::SetRotation(const RWindow& /*aWindow*/, TVideoRotation /*aRotation*/) |
237 { |
255 { |
238 |
256 |
239 } |
257 } |
240 |
258 |
241 void COpenMaxPlayerUtility::SetScaleFactor(const RWindow& /*aWindow*/, TReal32 /*aWidthPercentage*/, |
259 void COpenMaxPlayerUtility::SetScaleFactor(const RWindow& /*aWindow*/, TReal32 /*aWidthPercentage*/, |
242 TReal32 /*aHeightPercentage*/) |
260 TReal32 /*aHeightPercentage*/) |
243 { |
261 { |
244 |
262 |
245 } |
263 } |
246 |
264 |
247 void COpenMaxPlayerUtility::SetAutoScale(const RWindow& /*aWindow*/, TAutoScaleType /*aScaleType*/) |
265 void COpenMaxPlayerUtility::SetAutoScale(const RWindow& /*aWindow*/, TAutoScaleType /*aScaleType*/) |
248 { |
266 { |
249 |
267 |
250 } |
268 } |
251 |
269 |
252 void COpenMaxPlayerUtility::StepFrame(TInt /*aStep*/) |
270 void COpenMaxPlayerUtility::StepFrame(TInt /*aStep*/) |
253 { |
271 { |
254 |
272 |
255 } |
273 } |
256 |
274 |
257 void COpenMaxPlayerUtility::OpenFile(const TDesC& aFileName, TUid /*aControllerUid*/) |
275 void COpenMaxPlayerUtility::OpenFile(const TDesC& aFileName, TUid /*aControllerUid*/) |
258 { |
276 { |
259 const TUint16 *pFile = aFileName.Ptr(); |
277 const TUint16 *pFile = aFileName.Ptr(); |
260 TInt len = aFileName.Length(); |
278 TInt len = aFileName.Length(); |
261 |
279 |
262 if (pFile) |
280 if (pFile) |
263 { |
281 { |
264 strcpy((char*)m_sourceName, FILE_EXTN); |
282 strcpy((char*)m_sourceName, FILE_EXTN); |
265 len = wcstombs((char*)&m_sourceName[FILE_EXTN_LEN], (const wchar_t *)pFile, len); |
283 len = wcstombs((char*)&m_sourceName[FILE_EXTN_LEN], (const wchar_t *)pFile, len); |
266 m_sourceName[FILE_EXTN_LEN + len] = '\0'; |
284 m_sourceName[FILE_EXTN_LEN + len] = '\0'; |
267 uri.locatorType = XA_DATALOCATOR_URI; |
285 uri.locatorType = XA_DATALOCATOR_URI; |
268 uri.URI = (XAchar*) m_sourceName; |
286 uri.URI = (XAchar*) m_sourceName; |
269 m_mime.formatType = XA_DATAFORMAT_MIME; |
287 m_mime.formatType = XA_DATAFORMAT_MIME; |
270 m_mime.mimeType = (XAchar *) "audio/ra"; |
288 m_mime.mimeType = (XAchar *) "audio/ra"; |
271 |
289 |
272 //Do we need this here? |
290 //Do we need this here? |
273 PlaySource (uri); |
291 PlaySource (uri); |
274 } |
292 } |
275 } |
293 } |
276 |
294 |
277 void COpenMaxPlayerUtility::OpenUrl(const TDesC& /*aUrl*/) |
295 void COpenMaxPlayerUtility::OpenUrl(const TDesC& /*aUrl*/) |
278 { |
296 { |
279 |
297 |
280 } |
298 } |
281 |
299 |
282 void COpenMaxPlayerUtility::Prepare() |
300 void COpenMaxPlayerUtility::Prepare() |
283 { |
301 { |
284 |
302 |
285 } |
303 } |
286 |
304 |
287 void COpenMaxPlayerUtility::Close() |
305 void COpenMaxPlayerUtility::Close() |
288 { |
306 { |
289 |
307 |
290 } |
308 } |
291 |
309 |
292 void COpenMaxPlayerUtility::Pause() |
310 void COpenMaxPlayerUtility::Pause() |
293 { |
311 { |
294 XAresult res; |
312 XAresult res; |
295 res = (*m_playItf)->SetPlayState(m_playItf, XA_PLAYSTATE_PAUSED); |
313 res = (*m_playItf)->SetPlayState(m_playItf, XA_PLAYSTATE_PAUSED); |
296 CheckErr(res, "SetPlayState(paused)"); |
314 CheckErr(res, "SetPlayState(paused)"); |
297 } |
315 } |
298 |
316 |
299 void COpenMaxPlayerUtility::Play() |
317 void COpenMaxPlayerUtility::Play() |
300 { |
318 { |
301 XAresult res; |
319 XAresult res; |
302 res = (*m_playItf)->SetPlayState(m_playItf, XA_PLAYSTATE_PLAYING); |
320 res = (*m_playItf)->SetPlayState(m_playItf, XA_PLAYSTATE_PLAYING); |
303 CheckErr(res, "SetPlayState(playing)"); |
321 CheckErr(res, "SetPlayState(playing)"); |
304 } |
322 } |
305 |
323 |
306 TInt COpenMaxPlayerUtility::Stop() |
324 TInt COpenMaxPlayerUtility::Stop() |
307 { |
325 { |
341 XAmillibel bandLevel; |
359 XAmillibel bandLevel; |
342 XAmillibel minLevel; |
360 XAmillibel minLevel; |
343 XAmillibel maxLevel; |
361 XAmillibel maxLevel; |
344 XAresult res; |
362 XAresult res; |
345 |
363 |
346 res = (*m_equalizerItf)->GetNumberOfBands(m_equalizerItf, &numBands); |
364 res = (*m_equalizerItf)->GetNumberOfBands(m_equalizerItf, &numBands); |
347 CheckErr(res, "GetNumberOfBands"); |
365 CheckErr(res, "GetNumberOfBands"); |
348 |
366 |
349 res = (*m_equalizerItf)->GetBandLevelRange(m_equalizerItf, &minLevel, &maxLevel); |
367 res = (*m_equalizerItf)->GetBandLevelRange(m_equalizerItf, &minLevel, &maxLevel); |
350 CheckErr(res, "GetBandLevelRange"); |
368 CheckErr(res, "GetBandLevelRange"); |
351 if (band >= numBands) |
369 if (band >= numBands) |
352 { |
370 { |
353 /* Error. Insert debug print here. */ |
371 /* Error. Insert debug print here. */ |
354 exit(0); |
372 exit(0); |
355 } |
373 } |
356 |
374 |
357 res = (*m_equalizerItf)->GetBandLevel(m_equalizerItf, band, &bandLevel); |
375 res = (*m_equalizerItf)->GetBandLevel(m_equalizerItf, band, &bandLevel); |
358 CheckErr(res, "GetBandLevel"); |
376 CheckErr(res, "GetBandLevel"); |
359 |
377 |
360 if (increase==XA_BOOLEAN_TRUE) |
378 if (increase==XA_BOOLEAN_TRUE) |
361 { |
379 { |
362 /* increase the level by 1 dB (100mB) if the max supported level |
380 /* increase the level by 1 dB (100mB) if the max supported level |
363 * is not exceeded */ |
381 * is not exceeded */ |
364 bandLevel = bandLevel + 100; |
382 bandLevel = bandLevel + 100; |
365 if(bandLevel < maxLevel) |
383 if(bandLevel < maxLevel) |
366 { |
384 { |
367 res = (*m_equalizerItf)->SetBandLevel(m_equalizerItf, band, bandLevel); |
385 res = (*m_equalizerItf)->SetBandLevel(m_equalizerItf, band, bandLevel); |
368 CheckErr(res); |
386 CheckErr(res); |
369 DrawEQDisplay(); |
387 DrawEQDisplay(); |
370 } |
388 } |
371 } |
389 } |
372 else /* increase==false */ |
390 else /* increase==false */ |
388 m_dataSource.pLocator = (void*) &source; |
406 m_dataSource.pLocator = (void*) &source; |
389 m_dataSource.pFormat = (void*) &m_mime; |
407 m_dataSource.pFormat = (void*) &m_mime; |
390 |
408 |
391 // Create the music player // |
409 // Create the music player // |
392 XAresult res; |
410 XAresult res; |
393 res = (*m_EngineItf)->CreateMediaPlayer ( m_EngineItf, &player, &m_dataSource, NULL, &m_audioSink, |
411 res = (*m_EngineItf)->CreateMediaPlayer ( m_EngineItf, &player, &m_dataSource, NULL, &m_audioSink, |
394 &m_videoSink, NULL, NULL, 1, m_iidArray, m_required); |
412 &m_videoSink, NULL, NULL, 1, m_iidArray, m_required); |
395 CheckErr(res, "CreateMediaPlayer"); |
413 CheckErr(res, "CreateMediaPlayer"); |
396 |
414 |
397 // Realizing the player in synchronous mode. |
415 // Realizing the player in synchronous mode. |
398 res = (*player)->Realize(player, XA_BOOLEAN_FALSE); |
416 res = (*player)->Realize(player, XA_BOOLEAN_FALSE); |
399 CheckErr(res, "Realize(player)"); |
417 CheckErr(res, "Realize(player)"); |
400 |
418 |
401 // Get the play interface |
419 // Get the play interface |
402 res = (*player)->GetInterface(player, XA_IID_PLAY, (void**) &m_playItf); |
420 res = (*player)->GetInterface(player, XA_IID_PLAY, (void**) &m_playItf); |
403 CheckErr(res, "GetInterface(player)"); |
421 CheckErr(res, "GetInterface(player)"); |
404 |
422 |
405 /* XADynamicSourceItf sourceItf; |
423 /* XADynamicSourceItf sourceItf; |
406 res = (*player)->GetInterface(player, XA_IID_DYNAMICSOURCE, (void**) &sourceItf); |
424 res = (*player)->GetInterface(player, XA_IID_DYNAMICSOURCE, (void**) &sourceItf); |
407 CheckErr(res, "GetDynamicSource"); |
425 CheckErr(res, "GetDynamicSource"); |
408 |
426 |
409 res = (*sourceItf)->SetSource (sourceItf, &m_dataSource); |
427 res = (*sourceItf)->SetSource (sourceItf, &m_dataSource); |
410 CheckErr(res, "SetSource"); |
428 CheckErr(res, "SetSource"); |
411 */ |
429 */ |
412 // before Play, set volume |
430 // before Play, set volume |
413 res = (*m_volumeItf)->SetVolumeLevel(m_volumeItf, m_nVolume); |
431 res = (*m_volumeItf)->SetVolumeLevel(m_volumeItf, m_nVolume); |
414 CheckErr(res, "SetVolumeLevel"); |
432 CheckErr(res, "SetVolumeLevel"); |
415 |
433 |
416 XAmillisecond playDuration = 0; |
434 XAmillisecond playDuration = 0; |
417 res = (*m_playItf)->GetDuration(m_playItf, &playDuration); |
435 res = (*m_playItf)->GetDuration(m_playItf, &playDuration); |
418 bool b = CheckErr(res, "GetDuration"); |
436 bool b = CheckErr(res, "GetDuration"); |
419 //if ( b && (playDuration != XA_DURATION_UNKNOWN) ) |
437 //if ( b && (playDuration != XA_DURATION_UNKNOWN) ) |
420 //SetDurationL ((playDuration/1000)); |
438 //SetDurationL ((playDuration/1000)); |
421 |
439 |
422 res = (*m_playItf)->SetCallbackEventsMask(m_playItf, XA_PLAYEVENT_HEADATEND | XA_PLAYEVENT_HEADMOVING); |
440 res = (*m_playItf)->SetCallbackEventsMask(m_playItf, XA_PLAYEVENT_HEADATEND | XA_PLAYEVENT_HEADMOVING); |
423 CheckErr(res, "SetCallbackEventsMask"); |
441 CheckErr(res, "SetCallbackEventsMask"); |
424 |
442 |
425 res = (*m_playItf)->RegisterCallback(m_playItf, PlayCallbackFun, this); |
443 res = (*m_playItf)->RegisterCallback(m_playItf, PlayCallbackFun, this); |
426 CheckErr(res, "RegisterCallback"); |
444 CheckErr(res, "RegisterCallback"); |
427 //Do we need this here? |
445 //Do we need this here? |
428 Play(); |
446 Play(); |
429 } |
447 } |