comparison libao2/ao_alsa.c @ 13661:07dc40f25068

Only use S/PDIF output when no other alsa device is set, allows to use external ac3 decoders.
author reimar
date Sun, 17 Oct 2004 20:03:55 +0000
parents 2df414ae2d2a
children a92101a7eb49
comparison
equal deleted inserted replaced
13660:b34c5aa5f798 13661:07dc40f25068
403 default: 403 default:
404 mp_msg(MSGT_AO,MSGL_ERR,"alsa-init: %d channels are not supported\n",channels); 404 mp_msg(MSGT_AO,MSGL_ERR,"alsa-init: %d channels are not supported\n",channels);
405 } 405 }
406 } 406 }
407 407
408 if (!device_set) {
408 /* switch for spdif 409 /* switch for spdif
409 * sets opening sequence for SPDIF 410 * sets opening sequence for SPDIF
410 * sets also the playback and other switches 'on the fly' 411 * sets also the playback and other switches 'on the fly'
411 * while opening the abstract alias for the spdif subdevice 412 * while opening the abstract alias for the spdif subdevice
412 * 'iec958' 413 * 'iec958'
428 snprintf(alsa_device, ALSA_DEVICE_SIZE, 429 snprintf(alsa_device, ALSA_DEVICE_SIZE,
429 "iec958:AES0=0x%x,AES1=0x%x,AES2=0x%x,AES3=0x%x", 430 "iec958:AES0=0x%x,AES1=0x%x,AES2=0x%x,AES3=0x%x",
430 s[0], s[1], s[2], s[3]); 431 s[0], s[1], s[2], s[3]);
431 432
432 mp_msg(MSGT_AO,MSGL_V,"alsa-spdif-init: playing AC3, %i channels\n", channels); 433 mp_msg(MSGT_AO,MSGL_V,"alsa-spdif-init: playing AC3, %i channels\n", channels);
433 device_set = 1;
434 break; 434 break;
435 case 4: 435 case 4:
436 strncpy(alsa_device, "surround40", ALSA_DEVICE_SIZE); 436 strncpy(alsa_device, "surround40", ALSA_DEVICE_SIZE);
437 device_set = 1;
438 break; 437 break;
439 438
440 case 6: 439 case 6:
441 strncpy(alsa_device, "surround51", ALSA_DEVICE_SIZE); 440 strncpy(alsa_device, "surround51", ALSA_DEVICE_SIZE);
442 device_set = 1;
443 break; 441 break;
444 442
445 default: 443 default:
446 mp_msg(MSGT_AO,MSGL_ERR,"alsa-spdif-init: %d channels are not supported\n", channels); 444 mp_msg(MSGT_AO,MSGL_ERR,"alsa-spdif-init: %d channels are not supported\n", channels);
447 } 445 }
448 } 446 }
449 447 else
450 if (!device_set) 448
451 { 449 {
452 int tmp_device, tmp_subdevice, err; 450 int tmp_device, tmp_subdevice, err;
453 451
454 snd_pcm_info_alloca(&alsa_info); 452 snd_pcm_info_alloca(&alsa_info);
455 453
472 { 470 {
473 mp_msg(MSGT_AO,MSGL_ERR,"alsa-init: can't write device-id\n"); 471 mp_msg(MSGT_AO,MSGL_ERR,"alsa-init: can't write device-id\n");
474 } 472 }
475 473
476 mp_msg(MSGT_AO,MSGL_INFO,"alsa-init: %d soundcard%s found, using: %s\n", cards+1,(cards >= 0) ? "" : "s", alsa_device); 474 mp_msg(MSGT_AO,MSGL_INFO,"alsa-init: %d soundcard%s found, using: %s\n", cards+1,(cards >= 0) ? "" : "s", alsa_device);
475 }
477 } else { 476 } else {
478 mp_msg(MSGT_AO,MSGL_INFO,"alsa-init: soundcard set to %s\n", alsa_device); 477 mp_msg(MSGT_AO,MSGL_INFO,"alsa-init: soundcard set to %s\n", alsa_device);
479 } 478 }
480 479
481 //setting modes for block or nonblock-mode 480 //setting modes for block or nonblock-mode