diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/misc.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/apps/misc.c b/apps/misc.c index b6b0a79b06..6f34e50a54 100644 --- a/apps/misc.c +++ b/apps/misc.c | |||
@@ -862,24 +862,35 @@ void car_adapter_mode_init(void) | |||
862 | #ifdef HAVE_HEADPHONE_DETECTION | 862 | #ifdef HAVE_HEADPHONE_DETECTION |
863 | static void unplug_change(bool inserted) | 863 | static void unplug_change(bool inserted) |
864 | { | 864 | { |
865 | static bool headphone_caused_pause = false; | ||
866 | |||
865 | if (global_settings.unplug_mode) | 867 | if (global_settings.unplug_mode) |
866 | { | 868 | { |
869 | int audio_stat = audio_status(); | ||
867 | if (inserted) | 870 | if (inserted) |
868 | { | 871 | { |
869 | if ( global_settings.unplug_mode > 1 ) | 872 | if ((audio_stat & AUDIO_STATUS_PLAY) && |
873 | headphone_caused_pause && | ||
874 | global_settings.unplug_mode > 1 ) | ||
870 | audio_resume(); | 875 | audio_resume(); |
871 | backlight_on(); | 876 | backlight_on(); |
877 | headphone_caused_pause = false; | ||
872 | } else { | 878 | } else { |
873 | audio_pause(); | 879 | if ((audio_stat & AUDIO_STATUS_PLAY) && |
874 | 880 | !(audio_stat & AUDIO_STATUS_PAUSE)) | |
875 | if (global_settings.unplug_rw) | ||
876 | { | 881 | { |
877 | if ( audio_current_track()->elapsed > | 882 | headphone_caused_pause = true; |
878 | (unsigned long)(global_settings.unplug_rw*1000)) | 883 | audio_pause(); |
879 | audio_ff_rewind(audio_current_track()->elapsed - | 884 | |
880 | (global_settings.unplug_rw*1000)); | 885 | if (global_settings.unplug_rw) |
881 | else | 886 | { |
882 | audio_ff_rewind(0); | 887 | if (audio_current_track()->elapsed > |
888 | (unsigned long)(global_settings.unplug_rw*1000)) | ||
889 | audio_ff_rewind(audio_current_track()->elapsed - | ||
890 | (global_settings.unplug_rw*1000)); | ||
891 | else | ||
892 | audio_ff_rewind(0); | ||
893 | } | ||
883 | } | 894 | } |
884 | } | 895 | } |
885 | } | 896 | } |