diff options
Diffstat (limited to 'apps/recorder/recording.c')
-rw-r--r-- | apps/recorder/recording.c | 38 |
1 files changed, 14 insertions, 24 deletions
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index d38856db23..4c2b00c33c 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c | |||
@@ -34,7 +34,10 @@ | |||
34 | #include "pcm_playback.h" | 34 | #include "pcm_playback.h" |
35 | #include "playback.h" | 35 | #include "playback.h" |
36 | #include "enc_config.h" | 36 | #include "enc_config.h" |
37 | #if defined(HAVE_SPDIF_IN) || defined(HAVE_SPDIF_OUT) | ||
38 | #include "spdif.h" | ||
37 | #endif | 39 | #endif |
40 | #endif /* CONFIG_CODEC == SWCODEC */ | ||
38 | #ifdef HAVE_UDA1380 | 41 | #ifdef HAVE_UDA1380 |
39 | #include "uda1380.h" | 42 | #include "uda1380.h" |
40 | #endif | 43 | #endif |
@@ -587,12 +590,6 @@ static void rec_boost(bool state) | |||
587 | #define ac_set_monitor tlv320_set_monitor | 590 | #define ac_set_monitor tlv320_set_monitor |
588 | #endif | 591 | #endif |
589 | 592 | ||
590 | #ifdef HAVE_SPDIF_IN | ||
591 | #define rec_spdif_set_monitor(m) audio_spdif_set_monitor(m) | ||
592 | #else | ||
593 | #define rec_spdif_set_monitor(m) | ||
594 | #endif | ||
595 | |||
596 | void rec_set_source(int source, unsigned flags) | 593 | void rec_set_source(int source, unsigned flags) |
597 | { | 594 | { |
598 | /* Prevent pops from unneeded switching */ | 595 | /* Prevent pops from unneeded switching */ |
@@ -613,15 +610,23 @@ void rec_set_source(int source, unsigned flags) | |||
613 | /* Always boost for SPDIF */ | 610 | /* Always boost for SPDIF */ |
614 | if ((source == AUDIO_SRC_SPDIF) != (source == last_source)) | 611 | if ((source == AUDIO_SRC_SPDIF) != (source == last_source)) |
615 | rec_boost(source == AUDIO_SRC_SPDIF); | 612 | rec_boost(source == AUDIO_SRC_SPDIF); |
613 | #endif /* HAVE_SPDIF_IN */ | ||
616 | 614 | ||
617 | #ifdef HAVE_SPDIF_POWER | 615 | #ifdef HAVE_SPDIF_POWER |
618 | /* Check if S/PDIF output power should be switched off or on. NOTE: assumes | 616 | /* Check if S/PDIF output power should be switched off or on. NOTE: assumes |
619 | both optical in and out is controlled by the same power source, which is | 617 | both optical in and out is controlled by the same power source, which is |
620 | the case on H1x0. */ | 618 | the case on H1x0. */ |
621 | spdif_power_enable((source == AUDIO_SRC_SPDIF) || | 619 | spdif_power_enable((source == AUDIO_SRC_SPDIF) || |
622 | audio_get_spdif_power_setting()); | 620 | global_settings.spdif_enable); |
621 | /* Set the appropriate feed for spdif output */ | ||
622 | #ifdef HAVE_SPDIF_OUT | ||
623 | spdif_set_output_source(source, global_settings.spdif_enable); | ||
623 | #endif | 624 | #endif |
625 | #else /* !HAVE_SPDIF_POWER */ | ||
626 | #ifdef HAVE_SPDIF_OUT | ||
627 | spdif_set_output_source(source, true); | ||
624 | #endif | 628 | #endif |
629 | #endif /* !HAVE_SPDIF_POWER */ | ||
625 | 630 | ||
626 | /** Tuner **/ | 631 | /** Tuner **/ |
627 | #ifdef CONFIG_TUNER | 632 | #ifdef CONFIG_TUNER |
@@ -645,7 +650,6 @@ void rec_set_source(int source, unsigned flags) | |||
645 | ac_disable_recording(); | 650 | ac_disable_recording(); |
646 | ac_set_monitor(false); | 651 | ac_set_monitor(false); |
647 | pcm_rec_mux(0); /* line in */ | 652 | pcm_rec_mux(0); /* line in */ |
648 | rec_spdif_set_monitor(-1); /* silence it */ | ||
649 | break; | 653 | break; |
650 | 654 | ||
651 | case AUDIO_SRC_MIC: /* recording only */ | 655 | case AUDIO_SRC_MIC: /* recording only */ |
@@ -653,7 +657,6 @@ void rec_set_source(int source, unsigned flags) | |||
653 | break; | 657 | break; |
654 | ac_enable_recording(true); /* source mic */ | 658 | ac_enable_recording(true); /* source mic */ |
655 | pcm_rec_mux(0); /* line in */ | 659 | pcm_rec_mux(0); /* line in */ |
656 | rec_spdif_set_monitor(0); | ||
657 | break; | 660 | break; |
658 | 661 | ||
659 | case AUDIO_SRC_LINEIN: /* recording only */ | 662 | case AUDIO_SRC_LINEIN: /* recording only */ |
@@ -661,7 +664,6 @@ void rec_set_source(int source, unsigned flags) | |||
661 | break; | 664 | break; |
662 | pcm_rec_mux(0); /* line in */ | 665 | pcm_rec_mux(0); /* line in */ |
663 | ac_enable_recording(false); /* source line */ | 666 | ac_enable_recording(false); /* source line */ |
664 | rec_spdif_set_monitor(0); | ||
665 | break; | 667 | break; |
666 | 668 | ||
667 | #ifdef HAVE_SPDIF_IN | 669 | #ifdef HAVE_SPDIF_IN |
@@ -669,7 +671,6 @@ void rec_set_source(int source, unsigned flags) | |||
669 | if (source == last_source) | 671 | if (source == last_source) |
670 | break; | 672 | break; |
671 | ac_disable_recording(); | 673 | ac_disable_recording(); |
672 | audio_spdif_set_monitor(1); | ||
673 | break; | 674 | break; |
674 | #endif /* HAVE_SPDIF_IN */ | 675 | #endif /* HAVE_SPDIF_IN */ |
675 | 676 | ||
@@ -690,7 +691,6 @@ void rec_set_source(int source, unsigned flags) | |||
690 | break; | 691 | break; |
691 | /* I2S recording and playback */ | 692 | /* I2S recording and playback */ |
692 | uda1380_enable_recording(false); /* source line */ | 693 | uda1380_enable_recording(false); /* source line */ |
693 | uda1380_set_monitor(true); | ||
694 | #endif | 694 | #endif |
695 | #ifdef HAVE_TLV320 | 695 | #ifdef HAVE_TLV320 |
696 | /* I2S recording and analog playback */ | 696 | /* I2S recording and analog playback */ |
@@ -707,8 +707,6 @@ void rec_set_source(int source, unsigned flags) | |||
707 | tlv320_set_monitor(true); /* analog bypass */ | 707 | tlv320_set_monitor(true); /* analog bypass */ |
708 | } | 708 | } |
709 | #endif | 709 | #endif |
710 | |||
711 | rec_spdif_set_monitor(0); | ||
712 | break; | 710 | break; |
713 | /* #elif defined(CONFIG_TUNER) */ | 711 | /* #elif defined(CONFIG_TUNER) */ |
714 | /* Have radio but cannot record it */ | 712 | /* Have radio but cannot record it */ |
@@ -745,18 +743,10 @@ void rec_set_recording_options(struct audio_recording_options *options) | |||
745 | #if CONFIG_CODEC != SWCODEC | 743 | #if CONFIG_CODEC != SWCODEC |
746 | if (global_settings.rec_prerecord_time) | 744 | if (global_settings.rec_prerecord_time) |
747 | talk_buffer_steal(); /* will use the mp3 buffer */ | 745 | talk_buffer_steal(); /* will use the mp3 buffer */ |
748 | #endif | 746 | #else /* == SWOCODEC */ |
749 | |||
750 | #ifdef HAVE_SPDIF_IN | ||
751 | #ifdef HAVE_SPDIF_POWER | ||
752 | audio_set_spdif_power_setting(global_settings.spdif_enable); | ||
753 | #endif | ||
754 | #endif | ||
755 | |||
756 | #if CONFIG_CODEC == SWCODEC | ||
757 | rec_set_source(options->rec_source, | 747 | rec_set_source(options->rec_source, |
758 | options->rec_source_flags | SRCF_RECORDING); | 748 | options->rec_source_flags | SRCF_RECORDING); |
759 | #endif | 749 | #endif /* CONFIG_CODEC != SWCODEC */ |
760 | 750 | ||
761 | audio_set_recording_options(options); | 751 | audio_set_recording_options(options); |
762 | } | 752 | } |