|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. |
|
3 * |
|
4 * This library is free software; you can redistribute it and/or |
|
5 * modify it under the terms of the GNU Lesser General Public |
|
6 * License as published by the Free Software Foundation; either |
|
7 * version 2 of the License, or (at your option) any later version. |
|
8 * |
|
9 * This library is distributed in the hope that it will be useful, |
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
12 * Lesser General Public License for more details. |
|
13 * |
|
14 * You should have received a copy of the GNU Lesser General Public |
|
15 * License along with this library; if not, write to the |
|
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
|
17 * Boston, MA 02111-1307, USA. |
|
18 * |
|
19 * Description: |
|
20 * |
|
21 */ |
|
22 |
|
23 #include "devsoundsinkwrapper.h" |
|
24 #include <mmcccodecinformation.h> |
|
25 #include "debugtracemacros.h" |
|
26 |
|
27 DevSoundWrapper::DevSoundWrapper() |
|
28 { |
|
29 init_complete = 0; |
|
30 dev_sound = NULL; |
|
31 |
|
32 buffersize = 0; |
|
33 dev_count = 0; |
|
34 caps.iRate = EMMFSampleRate8000Hz; |
|
35 caps.iEncoding = EMMFSoundEncoding16BitPCM; |
|
36 caps.iChannels = EMMFMono; |
|
37 fourcc = KMMFFourCCCodePCM16; |
|
38 eosReceived = false; |
|
39 iErrConcealmentIntfc = NULL; |
|
40 iG711DecoderIntfc = NULL; |
|
41 iG729DecoderIntfc = NULL; |
|
42 iIlbcDecoderIntfc = NULL; |
|
43 iCallbackError = KErrNone; |
|
44 iAudioOutput = NULL; |
|
45 } |
|
46 |
|
47 /*********************************************************/ |
|
48 void DevSoundWrapper::InitializeComplete(TInt aError) |
|
49 { |
|
50 TRACE_PRN_FN_ENT; |
|
51 TRequestStatus* stat = &(AL->iStatus); |
|
52 |
|
53 if (aError == KErrNone) |
|
54 { |
|
55 init_complete = 1; |
|
56 } |
|
57 else |
|
58 { |
|
59 init_complete = 0; |
|
60 } |
|
61 |
|
62 User::RequestComplete(stat, aError); |
|
63 TRACE_PRN_IF_ERR(aError); |
|
64 TRACE_PRN_FN_EXT; |
|
65 } |
|
66 /************************************************************/ |
|
67 |
|
68 void DevSoundWrapper::BufferToBeFilled(CMMFBuffer* aBuffer) |
|
69 { |
|
70 // TRACE_PRN_FN_ENT; |
|
71 buffer = aBuffer; |
|
72 buffersize = aBuffer->RequestSize(); |
|
73 TRACE_PRN_N1(_L("DevSoundWrapper::BufferToBeFilled->buffersize [%d]"), buffersize); |
|
74 |
|
75 TRequestStatus* stat = &(AL->iStatus); |
|
76 |
|
77 if (aBuffer) |
|
78 { |
|
79 User::RequestComplete(stat, KErrNone); |
|
80 iCallbackError = KErrNone; |
|
81 } |
|
82 else |
|
83 { |
|
84 User::RequestComplete(stat, KErrNotFound); |
|
85 iCallbackError = KErrNotFound; |
|
86 } |
|
87 |
|
88 // TRACE_PRN_FN_EXT; |
|
89 } |
|
90 |
|
91 /***********************************************************/ |
|
92 void DevSoundWrapper::PlayError(TInt aError) |
|
93 { |
|
94 TRequestStatus* stat = &(AL->iStatus); |
|
95 User::RequestComplete(stat, aError); |
|
96 iCallbackError = aError; |
|
97 } |
|
98 /*******************************************************/ |
|
99 void DevSoundWrapper::BufferToBeEmptied(CMMFBuffer* /*aBuffer*/) |
|
100 { |
|
101 |
|
102 } |
|
103 /********************************************************/ |
|
104 void DevSoundWrapper::RecordError(TInt /*aError*/) |
|
105 { |
|
106 |
|
107 } |
|
108 /**********************************************************/ |
|
109 void DevSoundWrapper::ConvertError(TInt /*aError*/) |
|
110 { |
|
111 |
|
112 } |
|
113 /***********************************************************/ |
|
114 void DevSoundWrapper::DeviceMessage(TUid /*aMessageType*/, const TDesC8& /*aMsg*/) |
|
115 { |
|
116 |
|
117 } |
|
118 /***********************************************************/ |
|
119 void DevSoundWrapper::SendEventToClient(const TMMFEvent& /*aEvent*/) |
|
120 { |
|
121 |
|
122 } |
|
123 /************************************************************/ |
|
124 void DevSoundWrapper::ToneFinished(TInt /*aError*/) |
|
125 { |
|
126 |
|
127 } |
|
128 |
|
129 /*********************************************************** |
|
130 *********C interface functions****************************** |
|
131 ************************************************************/ |
|
132 |
|
133 /******************************************************/ |
|
134 int open_devsound(DevSoundWrapper **handle) |
|
135 { |
|
136 TRACE_PRN_FN_ENT; |
|
137 int ret = 0; |
|
138 *handle = new DevSoundWrapper(); |
|
139 if (handle) |
|
140 { |
|
141 ret = open_device(handle); |
|
142 } |
|
143 else |
|
144 { |
|
145 ret = KErrNoMemory; |
|
146 } |
|
147 TRACE_PRN_FN_EXT; |
|
148 return ret; |
|
149 } |
|
150 |
|
151 /*********************************************************/ |
|
152 |
|
153 int check_if_device_open(DevSoundWrapper *handle) |
|
154 { |
|
155 TRACE_PRN_FN_ENT; |
|
156 |
|
157 int ret; |
|
158 if ((handle->dev_count) == 1) |
|
159 { |
|
160 ret = 1; |
|
161 } |
|
162 else |
|
163 { |
|
164 ret = 0; |
|
165 } |
|
166 |
|
167 TRACE_PRN_FN_EXT; |
|
168 return ret; |
|
169 } |
|
170 |
|
171 /*********************************************************/ |
|
172 int open_device(DevSoundWrapper **handle) |
|
173 { |
|
174 int retcode = KErrNone; |
|
175 TRACE_PRN_FN_ENT; |
|
176 |
|
177 (*handle)->dev_count++; |
|
178 |
|
179 (*handle)->as = CActiveScheduler::Current(); |
|
180 |
|
181 if (!((*handle)->as)) |
|
182 { |
|
183 (*handle)->as = new CActiveScheduler(); |
|
184 if ((*handle)->as) |
|
185 { |
|
186 CActiveScheduler::Install((*handle)->as); |
|
187 } |
|
188 |
|
189 } |
|
190 (*handle)->AL = new CActiveListener; |
|
191 ((*handle)->AL)->asw = new CActiveSchedulerWait(); |
|
192 |
|
193 TRAP( retcode,(*handle)->dev_sound = CMMFDevSound::NewL() ); |
|
194 |
|
195 if (!(*handle)->AL || !((*handle)->AL)->asw || !(*handle)->dev_sound |
|
196 || !(*handle)->as) |
|
197 { |
|
198 retcode = KErrNoMemory; |
|
199 } |
|
200 |
|
201 TRACE_PRN_FN_EXT; |
|
202 return retcode; |
|
203 } |
|
204 |
|
205 /*******************************************************/ |
|
206 int initialize_devsound(GstDevsoundSink* ds) |
|
207 { |
|
208 TRACE_PRN_FN_ENT; |
|
209 int ret = 0; |
|
210 DevSoundWrapper* handle = (DevSoundWrapper*) ds->handle; |
|
211 |
|
212 handle->AL->InitialiseActiveListener(); |
|
213 |
|
214 TRAP (ret, handle->dev_sound->InitializeL(*handle, handle->fourcc, EMMFStatePlaying)); |
|
215 |
|
216 if (ret) |
|
217 { |
|
218 TRACE_PRN_IF_ERR(ret); |
|
219 return ret; |
|
220 } |
|
221 |
|
222 handle->AL->StartActiveScheduler(); |
|
223 |
|
224 if (handle->init_complete==1) |
|
225 { |
|
226 TMMFPrioritySettings temp; |
|
227 temp.iPref = (TMdaPriorityPreference)ds->preference; |
|
228 temp.iPriority = ds->priority; |
|
229 handle->dev_sound->SetPrioritySettings(temp); |
|
230 |
|
231 //set post initialize properties |
|
232 post_init_setconfig(handle); |
|
233 ret = KErrNone; |
|
234 } |
|
235 else |
|
236 { |
|
237 ret = KErrNotFound; |
|
238 } |
|
239 |
|
240 TRACE_PRN_IF_ERR(ret); |
|
241 TRACE_PRN_FN_EXT; |
|
242 return ret; |
|
243 } |
|
244 |
|
245 /************************************************************/ |
|
246 |
|
247 int close_devsound(GstDevsoundSink *ds) |
|
248 { |
|
249 TRACE_PRN_FN_ENT; |
|
250 |
|
251 g_list_foreach(ds->fmt, (GFunc) g_free, NULL); |
|
252 g_list_free(ds->fmt); |
|
253 ds->fmt = NULL; |
|
254 delete ds->handle; |
|
255 TRACE_PRN_FN_EXT; |
|
256 return 0; |
|
257 } |
|
258 |
|
259 /************************************************************/ |
|
260 |
|
261 int post_init_setconfig(DevSoundWrapper *handle) |
|
262 { |
|
263 TRACE_PRN_FN_ENT; |
|
264 int ret = 0; |
|
265 |
|
266 TRAP(ret, (handle->dev_sound)->SetConfigL(handle->caps) ); |
|
267 |
|
268 if (ret) |
|
269 { |
|
270 TRACE_PRN_IF_ERR(ret); |
|
271 return ret; |
|
272 } |
|
273 |
|
274 (handle->caps)= (handle->dev_sound)->Config(); |
|
275 |
|
276 if (handle->fourcc == KMccFourCCIdG711 || |
|
277 handle->fourcc == KMccFourCCIdG729 || |
|
278 handle->fourcc == KMccFourCCIdILBC || |
|
279 handle->fourcc == KMccFourCCIdAMRNB) |
|
280 { |
|
281 if (!handle->iErrConcealmentIntfc) |
|
282 { |
|
283 |
|
284 TRAP(ret, handle->iErrConcealmentIntfc = CErrorConcealmentIntfc::NewL(*handle->dev_sound) ); |
|
285 } |
|
286 } |
|
287 switch (handle->fourcc) |
|
288 { |
|
289 case KMccFourCCIdG711: |
|
290 { |
|
291 if (!handle->iG711DecoderIntfc) |
|
292 { |
|
293 |
|
294 TRAP(ret, handle->iG711DecoderIntfc = CG711DecoderIntfc::NewL(*handle->dev_sound) ); |
|
295 } |
|
296 break; |
|
297 } |
|
298 case KMccFourCCIdG729: |
|
299 { |
|
300 if (!handle->iG729DecoderIntfc) |
|
301 { |
|
302 |
|
303 TRAP(ret, handle->iG729DecoderIntfc = CG729DecoderIntfc::NewL(*handle->dev_sound) ); |
|
304 } |
|
305 break; |
|
306 } |
|
307 case KMccFourCCIdILBC: |
|
308 { |
|
309 if (!handle->iIlbcDecoderIntfc) |
|
310 { |
|
311 |
|
312 TRAP(ret, handle->iIlbcDecoderIntfc = CIlbcDecoderIntfc::NewL(*handle->dev_sound) ); |
|
313 } |
|
314 break; |
|
315 } |
|
316 case KMccFourCCIdAMRNB: |
|
317 case KMMFFourCCCodePCM16: |
|
318 default: |
|
319 { |
|
320 break; |
|
321 } |
|
322 } |
|
323 |
|
324 if (!handle->iAudioOutput) |
|
325 { |
|
326 TRAP(ret, handle->iAudioOutput = CAudioOutput::NewL(*handle->dev_sound) ); |
|
327 } |
|
328 |
|
329 TRACE_PRN_IF_ERR(ret); |
|
330 TRACE_PRN_FN_EXT; |
|
331 return ret; |
|
332 |
|
333 } |
|
334 |
|
335 /*********************************************************/ |
|
336 |
|
337 void conceal_error_for_next_buffer(DevSoundWrapper *handle) |
|
338 { |
|
339 TRACE_PRN_FN_ENT; |
|
340 if (handle->iErrConcealmentIntfc) |
|
341 { |
|
342 (handle->iErrConcealmentIntfc)->ConcealErrorForNextBuffer(); |
|
343 } |
|
344 TRACE_PRN_FN_EXT; |
|
345 } |
|
346 |
|
347 /*********************************************************/ |
|
348 void set_framemode(DevSoundWrapper *handle, gboolean mode) |
|
349 { |
|
350 TRACE_PRN_FN_ENT; |
|
351 if (handle->iErrConcealmentIntfc) |
|
352 { |
|
353 (handle->iErrConcealmentIntfc)->SetFrameMode(mode); |
|
354 } |
|
355 TRACE_PRN_FN_EXT; |
|
356 } |
|
357 |
|
358 /*********************************************************/ |
|
359 int framemode_rqrd_for_ec(DevSoundWrapper *handle, gboolean* modereq) |
|
360 { |
|
361 TRACE_PRN_FN_ENT; |
|
362 int err = 0; |
|
363 if (handle->iErrConcealmentIntfc) |
|
364 { |
|
365 err = (handle->iErrConcealmentIntfc)->FrameModeRqrdForEC(*modereq); |
|
366 } |
|
367 TRACE_PRN_FN_EXT; |
|
368 return err; |
|
369 } |
|
370 |
|
371 /*********************************************************/ |
|
372 int set_decodermode(DevSoundWrapper *handle, int aDecodeMode) |
|
373 { |
|
374 TRACE_PRN_FN_ENT; |
|
375 int err = 0; |
|
376 if (handle->iG711DecoderIntfc) |
|
377 { |
|
378 err = (handle->iG711DecoderIntfc)->SetDecoderMode( |
|
379 (CG711DecoderIntfc::TDecodeMode) aDecodeMode); |
|
380 } |
|
381 TRACE_PRN_FN_EXT; |
|
382 return err; |
|
383 } |
|
384 |
|
385 /*********************************************************/ |
|
386 |
|
387 int set_cng(DevSoundWrapper *handle, gboolean aCng) |
|
388 { |
|
389 TRACE_PRN_FN_ENT; |
|
390 int err = 0; |
|
391 if (handle->iG711DecoderIntfc) |
|
392 { |
|
393 err = (handle->iG711DecoderIntfc)->SetCng(aCng); |
|
394 } |
|
395 TRACE_PRN_FN_EXT; |
|
396 return err; |
|
397 } |
|
398 |
|
399 /*********************************************************/ |
|
400 int get_cng(DevSoundWrapper *handle, gboolean* aCng) |
|
401 { |
|
402 TRACE_PRN_FN_ENT; |
|
403 int err = 0; |
|
404 if (handle->iG711DecoderIntfc) |
|
405 { |
|
406 err = (handle->iG711DecoderIntfc)->GetCng(*aCng); |
|
407 } |
|
408 TRACE_PRN_FN_EXT; |
|
409 return err; |
|
410 } |
|
411 |
|
412 /*********************************************************/ |
|
413 int set_plc(DevSoundWrapper *handle, gboolean aPlc) |
|
414 { |
|
415 TRACE_PRN_FN_ENT; |
|
416 int err = 0; |
|
417 if (handle->iG711DecoderIntfc) |
|
418 { |
|
419 err = (handle->iG711DecoderIntfc)->SetPlc(aPlc); |
|
420 } |
|
421 TRACE_PRN_FN_EXT; |
|
422 return err; |
|
423 } |
|
424 /*********************************************************/ |
|
425 //G729 custom interface |
|
426 gint badlsfnextbuffer(DevSoundWrapper *handle) |
|
427 { |
|
428 TRACE_PRN_FN_ENT; |
|
429 int err = 0; |
|
430 if (handle->iG729DecoderIntfc) |
|
431 { |
|
432 err = (handle->iG729DecoderIntfc)->BadLsfNextBuffer(); |
|
433 } |
|
434 TRACE_PRN_FN_EXT; |
|
435 return err; |
|
436 } |
|
437 /*********************************************************/ |
|
438 //Ilbc custom interace |
|
439 gint get_ilbccng(DevSoundWrapper *handle, gboolean* aCng) |
|
440 { |
|
441 TRACE_PRN_FN_ENT; |
|
442 int err = 0; |
|
443 if (handle->iIlbcDecoderIntfc) |
|
444 { |
|
445 err = (handle->iIlbcDecoderIntfc)->GetCng(*aCng); |
|
446 } |
|
447 |
|
448 TRACE_PRN_FN_EXT; |
|
449 return err; |
|
450 } |
|
451 /*********************************************************/ |
|
452 gint set_ilbccng(DevSoundWrapper *handle, gboolean aCng) |
|
453 { |
|
454 TRACE_PRN_FN_ENT; |
|
455 int err = 0; |
|
456 if (handle->iIlbcDecoderIntfc) |
|
457 { |
|
458 err = (handle->iIlbcDecoderIntfc)->SetCng(aCng); |
|
459 } |
|
460 TRACE_PRN_FN_EXT; |
|
461 return err; |
|
462 } |
|
463 /*********************************************************/ |
|
464 gint set_ilbcdecodermode(DevSoundWrapper *handle, |
|
465 enum TIlbcDecodeMode aDecodeMode) |
|
466 { |
|
467 TRACE_PRN_FN_ENT; |
|
468 int err = 0; |
|
469 if (handle->iIlbcDecoderIntfc) |
|
470 { |
|
471 err = (handle->iIlbcDecoderIntfc)->SetDecoderMode( |
|
472 (CIlbcDecoderIntfc::TDecodeMode) aDecodeMode); |
|
473 } |
|
474 TRACE_PRN_FN_EXT; |
|
475 return err; |
|
476 } |
|
477 |
|
478 /*********************************************************/ |
|
479 gint set_outputdevice(DevSoundWrapper *handle, gint outputDev) |
|
480 { |
|
481 TRACE_PRN_FN_ENT; |
|
482 int err = 0; |
|
483 if (handle->iAudioOutput) |
|
484 { |
|
485 (handle->iAudioOutput)->SetAudioOutputL( |
|
486 (CAudioOutput::TAudioOutputPreference) outputDev); |
|
487 } |
|
488 TRACE_PRN_FN_EXT; |
|
489 return err; |
|
490 } |
|
491 |
|
492 /*********************************************************/ |
|
493 gint get_outputdevice(DevSoundWrapper *handle, gint* outputDev) |
|
494 { |
|
495 TRACE_PRN_FN_ENT; |
|
496 int err = 0; |
|
497 if (handle->iAudioOutput) |
|
498 { |
|
499 *outputDev = (handle->iAudioOutput)->AudioOutput(); |
|
500 } |
|
501 TRACE_PRN_FN_EXT; |
|
502 return err; |
|
503 } |
|
504 |
|
505 /**************************************************************/ |
|
506 int reset_devsound(DevSoundWrapper* /*handle*/) |
|
507 { |
|
508 return 0; |
|
509 } |
|
510 /*****************************************************************/ |
|
511 int get_rate(DevSoundWrapper *handle) |
|
512 { |
|
513 return handle->caps.iRate; |
|
514 |
|
515 } |
|
516 /*****************************************************************/ |
|
517 int get_channels(DevSoundWrapper *handle) |
|
518 { |
|
519 return handle->caps.iChannels; |
|
520 } |
|
521 /********************************************************************/ |
|
522 int get_encoding(DevSoundWrapper *handle) |
|
523 { |
|
524 return handle->caps.iEncoding; |
|
525 |
|
526 } |
|
527 /*******************************************************************/ |
|
528 int get_size(DevSoundWrapper *handle) |
|
529 { |
|
530 return handle->caps.iBufferSize; |
|
531 } |
|
532 /******************************************************************/ |
|
533 |
|
534 void set_rate(DevSoundWrapper *handle, int rate) |
|
535 { |
|
536 handle->caps.iRate = rate; |
|
537 } |
|
538 /******************************************************************/ |
|
539 void set_channels(DevSoundWrapper *handle, int channels) |
|
540 { |
|
541 handle->caps.iChannels = channels; |
|
542 } |
|
543 /****************************************************************/ |
|
544 void set_encoding(DevSoundWrapper *handle, int encoding) |
|
545 { |
|
546 handle->caps.iEncoding = encoding; |
|
547 } |
|
548 /*****************************************************************/ |
|
549 void set_size(DevSoundWrapper *handle, int size) |
|
550 { |
|
551 handle->caps.iBufferSize = size; |
|
552 } |
|
553 /*****************************************************************/ |
|
554 void set_fourcc(DevSoundWrapper *handle, int fourcc) |
|
555 { |
|
556 handle->fourcc = fourcc; |
|
557 } |
|
558 |
|
559 int get_ds_cb_error(DevSoundWrapper *handle) |
|
560 { |
|
561 return handle->iCallbackError; |
|
562 } |
|
563 /*******************************************************************/ |
|
564 |
|
565 int playinit(DevSoundWrapper *handle) |
|
566 { |
|
567 TRACE_PRN_FN_ENT; |
|
568 |
|
569 ((handle)->AL)->InitialiseActiveListener(); |
|
570 handle->eosReceived = false; |
|
571 |
|
572 TRAP(handle->iCallbackError,(handle->dev_sound)->PlayInitL()); |
|
573 if (handle->iCallbackError == KErrNone) |
|
574 { |
|
575 ((handle)->AL)->StartActiveScheduler(); |
|
576 } |
|
577 |
|
578 TRACE_PRN_IF_ERR(handle->iCallbackError); |
|
579 TRACE_PRN_FN_EXT; |
|
580 return handle->iCallbackError; |
|
581 } |
|
582 /******************************************************************/ |
|
583 int write_data(DevSoundWrapper *handle, TUint8* gstPtr, int gstBufferSize, |
|
584 gboolean lastBuffer) |
|
585 { |
|
586 TRACE_PRN_FN_ENT; |
|
587 |
|
588 CMMFDataBuffer* buf = STATIC_CAST (CMMFDataBuffer*, handle->buffer); |
|
589 |
|
590 TRACE_PRN_N2(_L("***gstBufferSize:[%d], handle->buffersize:[%d]"), gstBufferSize, handle->buffersize); |
|
591 |
|
592 if ((lastBuffer == TRUE) && (gstBufferSize <= handle->buffersize)) |
|
593 { |
|
594 buf->SetLastBuffer(ETrue); |
|
595 } |
|
596 |
|
597 TInt copySize = Min(gstBufferSize, handle->buffersize); |
|
598 |
|
599 if (copySize <= 0) |
|
600 { |
|
601 //will crash thread if not handled here |
|
602 return gstBufferSize; |
|
603 } |
|
604 |
|
605 TPtr8 srcPtr(gstPtr, copySize, copySize); |
|
606 TUint8* p = (TUint8*) (buf->Data().Ptr()); |
|
607 TPtr8 destPtr(p, buf->Data().Length(), buf->Data().MaxLength()); |
|
608 |
|
609 destPtr.Append(srcPtr); |
|
610 TRACE_PRN_N(_L("write_data->Append")); |
|
611 buf->Data().SetLength(buf->Data().Length() + copySize); |
|
612 |
|
613 gstBufferSize -= copySize; |
|
614 handle->buffersize -= copySize; |
|
615 |
|
616 if ((handle->buffersize == 0) || (buf->LastBuffer())) |
|
617 { |
|
618 play_data(handle); |
|
619 } |
|
620 |
|
621 TRACE_PRN_FN_EXT; |
|
622 return gstBufferSize; |
|
623 } |
|
624 |
|
625 /*******************************************************************/ |
|
626 int play_data(DevSoundWrapper *handle) |
|
627 { |
|
628 TRACE_PRN_FN_ENT; |
|
629 (handle->AL)->InitialiseActiveListener(); |
|
630 |
|
631 (handle->dev_sound)->PlayData(); |
|
632 |
|
633 ((handle)->AL)->StartActiveScheduler(); |
|
634 |
|
635 TRACE_PRN_FN_EXT; |
|
636 return KErrNone; |
|
637 } |
|
638 |
|
639 /*********************************************************************/ |
|
640 |
|
641 int pre_init_setconf(GstDevsoundSink *ds) |
|
642 { |
|
643 TRACE_PRN_FN_ENT; |
|
644 int ret = 0; |
|
645 |
|
646 DevSoundWrapper* dsPtr = STATIC_CAST(DevSoundWrapper*, ds->handle); |
|
647 |
|
648 // NOTE: it is too late for setting prio/pref here |
|
649 if (ds->pending.preferenceupdate == 1 || ds->pending.priorityupdate == 1) |
|
650 { |
|
651 ds->pending.preferenceupdate = FALSE; |
|
652 ds->pending.priorityupdate = FALSE; |
|
653 } |
|
654 if (ds->pending.volumeupdate == 1) |
|
655 { |
|
656 (dsPtr->dev_sound)->SetVolume(ds->volume); |
|
657 ds->pending.volumeupdate = FALSE; |
|
658 } |
|
659 if (ds->pending.volumerampupdate == 1) |
|
660 { |
|
661 (dsPtr->dev_sound)->SetVolumeRamp(ds->volumeramp); |
|
662 ds->pending.volumerampupdate = FALSE; |
|
663 } |
|
664 if (ds->pending.leftbalanceupdate == 1 || ds->pending.rightbalanceupdate |
|
665 == 1) |
|
666 { |
|
667 TRAP( ret, (dsPtr->dev_sound)->SetPlayBalanceL(ds->leftbalance,ds->rightbalance) ); |
|
668 ds->pending.leftbalanceupdate = FALSE; |
|
669 ds->pending.rightbalanceupdate = FALSE; |
|
670 } |
|
671 if(ds->pending.outputupdate == 1) |
|
672 { |
|
673 set_outputdevice(dsPtr,ds->output); |
|
674 ds->pending.outputupdate = FALSE; |
|
675 } |
|
676 TRACE_PRN_FN_EXT; |
|
677 return ret; |
|
678 } |
|
679 /*********************************************************/ |
|
680 void getsupporteddatatypes(GstDevsoundSink *ds) |
|
681 { |
|
682 TRACE_PRN_FN_ENT; |
|
683 DevSoundWrapper* dsPtr = STATIC_CAST(DevSoundWrapper*, ds->handle); |
|
684 TRAP_IGNORE(dsPtr->GetDataTypesL(ds)); |
|
685 |
|
686 TRACE_PRN_FN_EXT; |
|
687 } |
|
688 |
|
689 /*********************************************************/ |
|
690 void DevSoundWrapper::GetDataTypesL(GstDevsoundSink *ds) |
|
691 { |
|
692 TRACE_PRN_FN_ENT; |
|
693 |
|
694 RArray<TFourCC> outputdatatypes; |
|
695 TMMFPrioritySettings prioritysettings; |
|
696 DevSoundWrapper* dsPtr = STATIC_CAST(DevSoundWrapper*, ds->handle); |
|
697 |
|
698 CleanupClosePushL(outputdatatypes); |
|
699 |
|
700 TRAP_IGNORE( (dsPtr->dev_sound)->GetSupportedOutputDataTypesL(outputdatatypes,prioritysettings) ); |
|
701 |
|
702 for (TInt i = 0; i < outputdatatypes.Count(); i++) |
|
703 { |
|
704 TRACE_PRN_N2(_L("GstDevsoundSink supported Codec[%d]==[0x%x]"), i+1, outputdatatypes[i].FourCC()); |
|
705 guint *ip = g_new (guint, 1); |
|
706 *ip = outputdatatypes[i].FourCC(); |
|
707 ds->fmt = g_list_append(ds->fmt, ip); |
|
708 } |
|
709 CleanupStack::PopAndDestroy(&outputdatatypes); |
|
710 TRACE_PRN_FN_EXT; |
|
711 } |
|
712 |
|
713 /*********************************************************/ |
|
714 void populateproperties(GstDevsoundSink *ds) |
|
715 { |
|
716 TRACE_PRN_FN_ENT; |
|
717 DevSoundWrapper* dsPtr = STATIC_CAST(DevSoundWrapper*, ds->handle); |
|
718 ds->samplesplayed = (dsPtr->dev_sound)->SamplesPlayed(); |
|
719 get_outputdevice(dsPtr,&ds->output); |
|
720 TRACE_PRN_FN_EXT; |
|
721 } |
|
722 |
|
723 void initproperties(GstDevsoundSink* ds) |
|
724 { |
|
725 TRACE_PRN_FN_ENT; |
|
726 DevSoundWrapper* dsPtr= STATIC_CAST(DevSoundWrapper*, ds->handle); |
|
727 ds->maxvolume = (dsPtr->dev_sound)->MaxVolume(); |
|
728 ds->volume = (dsPtr->dev_sound)->Volume(); |
|
729 framemode_rqrd_for_ec(dsPtr,&ds->framemodereq); |
|
730 get_cng(dsPtr,&ds->g711cng); |
|
731 get_ilbccng(dsPtr,&ds->ilbccng); |
|
732 TRACE_PRN_FN_EXT; |
|
733 } |