mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-05-12 11:43:16 -04:00
send iap status change notifications
install iap event notification callbacks in various locations Change-Id: I637a3ad18cb07ca056ad9b678400ba11d2f8faad
This commit is contained in:
parent
e50ad40814
commit
fad99773e3
7 changed files with 36 additions and 3 deletions
|
|
@ -43,6 +43,7 @@
|
|||
#include "file.h"
|
||||
#include "pathfuncs.h"
|
||||
#include "playlist_menu.h"
|
||||
#include "iap-usb.h"
|
||||
|
||||
/*#define LOGF_ENABLE*/
|
||||
#include "logf.h"
|
||||
|
|
@ -1125,7 +1126,9 @@ static bool play_bookmark(const char* bookmark)
|
|||
if (parse_bookmark(fnamebuf, sizeof(fnamebuf), bookmark, &resume_info, true))
|
||||
{
|
||||
global_settings.repeat_mode = resume_info.repeat_mode;
|
||||
iap_on_repeat_state(global_settings.repeat_mode);
|
||||
global_settings.playlist_shuffle = resume_info.shuffle;
|
||||
iap_on_shuffle_state(global_settings.playlist_shuffle);
|
||||
#if defined(HAVE_PITCHCONTROL)
|
||||
sound_set_pitch(resume_info.pitch);
|
||||
dsp_set_timestretch(resume_info.speed);
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
#include "playlist.h"
|
||||
#include "dsp_misc.h"
|
||||
#include "playback.h"
|
||||
#include "iap-usb.h"
|
||||
|
||||
/** Disarms all touchregions. */
|
||||
void skin_disarm_touchregions(struct gui_wps *gwps)
|
||||
|
|
@ -344,6 +345,7 @@ int skin_get_touchaction(struct gui_wps *gwps, int* edge_offset)
|
|||
|
||||
case ACTION_TOUCH_SHUFFLE:
|
||||
global_settings.playlist_shuffle = !global_settings.playlist_shuffle;
|
||||
iap_on_shuffle_state(global_settings.playlist_shuffle);
|
||||
replaygain_update();
|
||||
if (global_settings.playlist_shuffle)
|
||||
playlist_randomise(NULL, current_tick, true);
|
||||
|
|
@ -358,6 +360,7 @@ int skin_get_touchaction(struct gui_wps *gwps, int* edge_offset)
|
|||
const struct settings_list *rep_setting =
|
||||
find_setting(&global_settings.repeat_mode);
|
||||
option_select_next_val(rep_setting, false, true);
|
||||
iap_on_repeat_state(global_settings.repeat_mode);
|
||||
audio_flush_and_reload_tracks();
|
||||
action = ACTION_REDRAW;
|
||||
} break;
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
#include "system.h"
|
||||
#include "lcd.h"
|
||||
#include "language.h" /* is_lang_rtl() */
|
||||
#include "iap-usb.h"
|
||||
|
||||
#ifdef HAVE_DIRCACHE
|
||||
#include "dircache.h"
|
||||
|
|
@ -870,6 +871,7 @@ void check_bootfile(bool do_rolo)
|
|||
void setvol(void)
|
||||
{
|
||||
sound_set_volume(global_status.volume);
|
||||
iap_on_volume(global_status.volume);
|
||||
global_status.last_volume_change = current_tick;
|
||||
status_save(false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@
|
|||
#include "settings.h"
|
||||
#include "audiohw.h"
|
||||
#include "general.h"
|
||||
#include "iap-usb.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef HAVE_TAGCACHE
|
||||
|
|
@ -1411,6 +1412,7 @@ static void audio_playlist_track_change(void)
|
|||
{
|
||||
send_track_event(PLAYBACK_EVENT_TRACK_CHANGE,
|
||||
track_event_flags, id3);
|
||||
iap_on_track_playback_index(playlist_get_display_index() - 1, false);
|
||||
}
|
||||
|
||||
position_key = pcmbuf_get_position_key();
|
||||
|
|
@ -2319,6 +2321,8 @@ static int audio_finish_load_track(struct track_info *infop)
|
|||
by the time PLAYBACK_EVENT_TRACK_CHANGE is sent */
|
||||
send_track_event(PLAYBACK_EVENT_CUR_TRACK_READY, 0,
|
||||
id3_get(PLAYING_ID3));
|
||||
/* Also send pending notification */
|
||||
iap_on_track_playback_index(playlist_get_display_index() - 1, true);
|
||||
}
|
||||
|
||||
#ifdef HAVE_CODEC_BUFFERING
|
||||
|
|
@ -2746,6 +2750,7 @@ static void audio_finalise_track_change(void)
|
|||
if (pause_on_track_change || single_mode_do_pause(info.id3_hid))
|
||||
{
|
||||
play_status = PLAY_PAUSED;
|
||||
iap_on_play_status(play_status);
|
||||
pcmbuf_pause(true);
|
||||
pause_on_track_change = false;
|
||||
}
|
||||
|
|
@ -3079,6 +3084,7 @@ static void audio_start_playback(const struct audio_resume_info *resume_info,
|
|||
|
||||
/* Update our state */
|
||||
play_status = PLAY_PLAYING;
|
||||
iap_on_play_status(play_status);
|
||||
}
|
||||
|
||||
/* Codec's position should be available as soon as it knows it */
|
||||
|
|
@ -3166,6 +3172,7 @@ static void audio_stop_playback(void)
|
|||
/* Update our state */
|
||||
ff_rw_mode = false;
|
||||
play_status = PLAY_STOPPED;
|
||||
iap_on_play_status(play_status);
|
||||
|
||||
wipe_track_metadata(true);
|
||||
#ifdef HAVE_ALBUMART
|
||||
|
|
@ -3187,6 +3194,7 @@ static void audio_on_pause(bool pause)
|
|||
return;
|
||||
|
||||
play_status = pause ? PLAY_PAUSED : PLAY_PLAYING;
|
||||
iap_on_play_status(play_status);
|
||||
|
||||
if (!pause && codec_skip_pending)
|
||||
{
|
||||
|
|
@ -3828,6 +3836,7 @@ void audio_pcmbuf_position_callback(unsigned long elapsed, off_t offset,
|
|||
struct mp3entry *id3 = id3_get(PLAYING_ID3);
|
||||
id3->elapsed = elapsed;
|
||||
id3->offset = offset;
|
||||
iap_on_track_time_position(elapsed);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -107,6 +107,7 @@
|
|||
#include "rbunicode.h"
|
||||
#include "root_menu.h"
|
||||
#include "plugin.h" /* To borrow a temp buffer to rewrite a .m3u8 file */
|
||||
#include "iap-usb.h"
|
||||
#include "logdiskf.h"
|
||||
#ifdef HAVE_DIRCACHE
|
||||
#include "dircache.h"
|
||||
|
|
@ -1217,6 +1218,8 @@ static int remove_all_tracks_unlocked(struct playlist_info *playlist)
|
|||
playlist->amount = 1;
|
||||
playlist->indices[0] |= PLAYLIST_QUEUED;
|
||||
playlist->flags = 0; /* Reset dirplay and modified flags */
|
||||
if (playlist == ¤t_playlist)
|
||||
iap_on_tracks_count(playlist->amount);
|
||||
|
||||
if (playlist->last_insert_pos == 0)
|
||||
playlist->last_insert_pos = -1;
|
||||
|
|
@ -1424,6 +1427,8 @@ static int add_track_to_playlist_unlocked(struct playlist_info* playlist,
|
|||
dc_init_filerefs(playlist, insert_position, 1);
|
||||
|
||||
playlist->amount++;
|
||||
if (playlist == ¤t_playlist)
|
||||
iap_on_tracks_count(playlist->amount);
|
||||
|
||||
return insert_position;
|
||||
}
|
||||
|
|
@ -1506,6 +1511,9 @@ static void find_and_set_playlist_index_unlocked(struct playlist_info* playlist,
|
|||
{
|
||||
playlist->index = playlist->first_index = i;
|
||||
|
||||
if (playlist == ¤t_playlist)
|
||||
iap_on_track_playback_index(rotate_index(playlist, playlist->index), true);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -2949,6 +2957,7 @@ int playlist_next(int steps)
|
|||
sort_playlist_unlocked(playlist, false, false);
|
||||
randomise_playlist_unlocked(playlist, current_tick, false, true);
|
||||
global_settings.playlist_shuffle = true;
|
||||
iap_on_shuffle_state(global_settings.playlist_shuffle);
|
||||
|
||||
playlist->started = true;
|
||||
playlist->index = 0;
|
||||
|
|
@ -3537,8 +3546,9 @@ int playlist_resume(void)
|
|||
}
|
||||
}
|
||||
|
||||
if (global_status.resume_index != -1)
|
||||
if (global_status.resume_index != -1) {
|
||||
playlist->index = global_status.resume_index;
|
||||
}
|
||||
|
||||
out:
|
||||
playlist_write_unlock(playlist);
|
||||
|
|
@ -4047,8 +4057,10 @@ static int pl_save_update_control(struct playlist_info* playlist,
|
|||
|
||||
/* Reset shuffle seed */
|
||||
playlist->seed = 0;
|
||||
if (playlist == ¤t_playlist)
|
||||
if (playlist == ¤t_playlist) {
|
||||
global_settings.playlist_shuffle = false;
|
||||
iap_on_shuffle_state(global_settings.playlist_shuffle);
|
||||
}
|
||||
|
||||
pl_close_control(playlist);
|
||||
close(old_fd);
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@
|
|||
#endif
|
||||
#include "playlist.h"
|
||||
#include "tree.h"
|
||||
#include "iap-usb.h"
|
||||
|
||||
#include "voice_thread.h"
|
||||
|
||||
|
|
@ -790,15 +791,17 @@ static void shuffle_playlist_callback(bool shuffle)
|
|||
}
|
||||
}
|
||||
}
|
||||
iap_on_shuffle_state(shuffle);
|
||||
}
|
||||
|
||||
static void repeat_mode_callback(int repeat)
|
||||
{
|
||||
(void)repeat;
|
||||
if ((audio_status() & AUDIO_STATUS_PLAY) == AUDIO_STATUS_PLAY)
|
||||
{
|
||||
audio_flush_and_reload_tracks();
|
||||
}
|
||||
(void)repeat;
|
||||
iap_on_repeat_state(repeat);
|
||||
}
|
||||
|
||||
static void treesort_callback(int value)
|
||||
|
|
|
|||
|
|
@ -333,6 +333,7 @@ static struct usb_class_driver drivers[USB_NUM_DRIVERS] =
|
|||
#endif
|
||||
.set_interface = usb_iap_set_interface,
|
||||
.get_interface = usb_iap_get_interface,
|
||||
.notify_event = usb_iap_notify_event,
|
||||
},
|
||||
#endif
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue