Fix whitespace in files for following commit.
Change-Id: I4adb8a152e9b99fcd26d95da7334d7d0cbe2a036
This commit is contained in:
parent
d85f796890
commit
ffa8626b0c
8 changed files with 346 additions and 346 deletions
|
@ -68,7 +68,7 @@
|
||||||
#define RESTORE_WPS_INSTANTLY 0l
|
#define RESTORE_WPS_INSTANTLY 0l
|
||||||
#define RESTORE_WPS_NEXT_SECOND ((long)(HZ+current_tick))
|
#define RESTORE_WPS_NEXT_SECOND ((long)(HZ+current_tick))
|
||||||
|
|
||||||
#define FF_REWIND_MAX_PERCENT 3 /* cap ff/rewind step size at max % of file */
|
#define FF_REWIND_MAX_PERCENT 3 /* cap ff/rewind step size at max % of file */
|
||||||
/* 3% of 30min file == 54s step size */
|
/* 3% of 30min file == 54s step size */
|
||||||
#define MIN_FF_REWIND_STEP 500
|
#define MIN_FF_REWIND_STEP 500
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ void unpause_action(bool may_fade, bool updatewps)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
(void)may_fade;
|
(void)may_fade;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CONFIG_CODEC != SWCODEC
|
#if CONFIG_CODEC != SWCODEC
|
||||||
void fade(bool fade_in, bool updatewps)
|
void fade(bool fade_in, bool updatewps)
|
||||||
|
@ -189,7 +189,7 @@ void fade(bool fade_in, bool updatewps)
|
||||||
|
|
||||||
sleep(HZ/10); /* let audio thread run */
|
sleep(HZ/10); /* let audio thread run */
|
||||||
audio_resume();
|
audio_resume();
|
||||||
|
|
||||||
if (updatewps)
|
if (updatewps)
|
||||||
update_non_static();
|
update_non_static();
|
||||||
|
|
||||||
|
@ -227,7 +227,7 @@ void fade(bool fade_in, bool updatewps)
|
||||||
sound_set_volume(global_settings.volume);
|
sound_set_volume(global_settings.volume);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* SWCODEC */
|
#endif /* SWCODEC */
|
||||||
|
|
||||||
static bool update_onvol_change(enum screen_type screen)
|
static bool update_onvol_change(enum screen_type screen)
|
||||||
{
|
{
|
||||||
|
@ -298,8 +298,8 @@ static int skintouch_to_wps(struct wps_data *data)
|
||||||
|
|
||||||
bool ffwd_rew(int button)
|
bool ffwd_rew(int button)
|
||||||
{
|
{
|
||||||
unsigned int step = 0; /* current ff/rewind step */
|
unsigned int step = 0; /* current ff/rewind step */
|
||||||
unsigned int max_step = 0; /* maximum ff/rewind step */
|
unsigned int max_step = 0; /* maximum ff/rewind step */
|
||||||
int ff_rewind_count = 0; /* current ff/rewind count (in ticks) */
|
int ff_rewind_count = 0; /* current ff/rewind count (in ticks) */
|
||||||
int direction = -1; /* forward=1 or backward=-1 */
|
int direction = -1; /* forward=1 or backward=-1 */
|
||||||
bool exit = false;
|
bool exit = false;
|
||||||
|
@ -323,7 +323,7 @@ bool ffwd_rew(int button)
|
||||||
if (direction == 1)
|
if (direction == 1)
|
||||||
{
|
{
|
||||||
/* fast forwarding, calc max step relative to end */
|
/* fast forwarding, calc max step relative to end */
|
||||||
max_step = (skin_get_global_state()->id3->length -
|
max_step = (skin_get_global_state()->id3->length -
|
||||||
(skin_get_global_state()->id3->elapsed +
|
(skin_get_global_state()->id3->elapsed +
|
||||||
ff_rewind_count)) *
|
ff_rewind_count)) *
|
||||||
FF_REWIND_MAX_PERCENT / 100;
|
FF_REWIND_MAX_PERCENT / 100;
|
||||||
|
@ -360,7 +360,7 @@ bool ffwd_rew(int button)
|
||||||
FOR_NB_SCREENS(i)
|
FOR_NB_SCREENS(i)
|
||||||
skin_get_gwps(WPS, i)->display->stop_scroll();
|
skin_get_gwps(WPS, i)->display->stop_scroll();
|
||||||
#endif
|
#endif
|
||||||
if (direction > 0)
|
if (direction > 0)
|
||||||
status_set_ffmode(STATUS_FASTFORWARD);
|
status_set_ffmode(STATUS_FASTFORWARD);
|
||||||
else
|
else
|
||||||
status_set_ffmode(STATUS_FASTBACKWARD);
|
status_set_ffmode(STATUS_FASTBACKWARD);
|
||||||
|
@ -489,8 +489,8 @@ static void change_dir(int direction)
|
||||||
audio_prev_dir();
|
audio_prev_dir();
|
||||||
else if (direction > 0)
|
else if (direction > 0)
|
||||||
audio_next_dir();
|
audio_next_dir();
|
||||||
/* prevent the next dir to immediatly start being ffw'd */
|
/* prevent the next dir to immediatly start being ffw'd */
|
||||||
action_wait_for_release();
|
action_wait_for_release();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void prev_track(unsigned long skip_thresh)
|
static void prev_track(unsigned long skip_thresh)
|
||||||
|
@ -644,7 +644,7 @@ static void gwps_leave_wps(void)
|
||||||
skin_backdrop_show(sb_get_backdrop(i));
|
skin_backdrop_show(sb_get_backdrop(i));
|
||||||
#endif
|
#endif
|
||||||
viewportmanager_theme_undo(i, skin_has_sbs(i, skin_get_gwps(WPS, i)->data));
|
viewportmanager_theme_undo(i, skin_has_sbs(i, skin_get_gwps(WPS, i)->data));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
|
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
|
||||||
|
@ -676,7 +676,7 @@ static void gwps_enter_wps(void)
|
||||||
#if LCD_DEPTH > 1
|
#if LCD_DEPTH > 1
|
||||||
if (display->depth > 1)
|
if (display->depth > 1)
|
||||||
{
|
{
|
||||||
struct skin_viewport *svp = skin_find_item(VP_DEFAULT_LABEL_STRING,
|
struct skin_viewport *svp = skin_find_item(VP_DEFAULT_LABEL_STRING,
|
||||||
SKIN_FIND_VP, gwps->data);
|
SKIN_FIND_VP, gwps->data);
|
||||||
if (svp)
|
if (svp)
|
||||||
{
|
{
|
||||||
|
@ -722,7 +722,7 @@ void wps_do_playpause(bool updatewps)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* The WPS can be left in two ways:
|
/* The WPS can be left in two ways:
|
||||||
* a) call a function, which draws over the wps. In this case, the wps
|
* a) call a function, which draws over the wps. In this case, the wps
|
||||||
|
@ -755,7 +755,7 @@ long gui_wps_show(void)
|
||||||
ab_reset_markers();
|
ab_reset_markers();
|
||||||
#endif
|
#endif
|
||||||
wps_state_init();
|
wps_state_init();
|
||||||
|
|
||||||
while ( 1 )
|
while ( 1 )
|
||||||
{
|
{
|
||||||
bool audio_paused = (audio_status() & AUDIO_STATUS_PAUSE)?true:false;
|
bool audio_paused = (audio_status() & AUDIO_STATUS_PAUSE)?true:false;
|
||||||
|
@ -773,7 +773,7 @@ long gui_wps_show(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
button = skin_wait_for_action(WPS, CONTEXT_WPS|ALLOW_SOFTLOCK,
|
button = skin_wait_for_action(WPS, CONTEXT_WPS|ALLOW_SOFTLOCK,
|
||||||
restore ? 1 : HZ/5);
|
restore ? 1 : HZ/5);
|
||||||
|
|
||||||
/* Exit if audio has stopped playing. This happens e.g. at end of
|
/* Exit if audio has stopped playing. This happens e.g. at end of
|
||||||
|
@ -820,17 +820,17 @@ long gui_wps_show(void)
|
||||||
{
|
{
|
||||||
bool hotkey = button == ACTION_WPS_HOTKEY;
|
bool hotkey = button == ACTION_WPS_HOTKEY;
|
||||||
gwps_leave_wps();
|
gwps_leave_wps();
|
||||||
int retval = onplay(state->id3->path,
|
int retval = onplay(state->id3->path,
|
||||||
FILE_ATTR_AUDIO, CONTEXT_WPS, hotkey);
|
FILE_ATTR_AUDIO, CONTEXT_WPS, hotkey);
|
||||||
/* if music is stopped in the context menu we want to exit the wps */
|
/* if music is stopped in the context menu we want to exit the wps */
|
||||||
if (retval == ONPLAY_MAINMENU
|
if (retval == ONPLAY_MAINMENU
|
||||||
|| !audio_status())
|
|| !audio_status())
|
||||||
return GO_TO_ROOT;
|
return GO_TO_ROOT;
|
||||||
else if (retval == ONPLAY_PLAYLIST)
|
else if (retval == ONPLAY_PLAYLIST)
|
||||||
return GO_TO_PLAYLIST_VIEWER;
|
return GO_TO_PLAYLIST_VIEWER;
|
||||||
#ifdef HAVE_PICTUREFLOW_INTEGRATION
|
#ifdef HAVE_PICTUREFLOW_INTEGRATION
|
||||||
else if (retval == ONPLAY_PICTUREFLOW)
|
else if (retval == ONPLAY_PICTUREFLOW)
|
||||||
return GO_TO_PICTUREFLOW;
|
return GO_TO_PICTUREFLOW;
|
||||||
#endif
|
#endif
|
||||||
restore = true;
|
restore = true;
|
||||||
}
|
}
|
||||||
|
@ -860,7 +860,7 @@ long gui_wps_show(void)
|
||||||
global_settings.volume--;
|
global_settings.volume--;
|
||||||
vol_changed = true;
|
vol_changed = true;
|
||||||
break;
|
break;
|
||||||
/* fast forward
|
/* fast forward
|
||||||
OR next dir if this is straight after ACTION_WPS_SKIPNEXT */
|
OR next dir if this is straight after ACTION_WPS_SKIPNEXT */
|
||||||
case ACTION_WPS_SEEKFWD:
|
case ACTION_WPS_SEEKFWD:
|
||||||
if (global_settings.party_mode)
|
if (global_settings.party_mode)
|
||||||
|
@ -880,7 +880,7 @@ long gui_wps_show(void)
|
||||||
ffwd_rew(ACTION_WPS_SEEKFWD);
|
ffwd_rew(ACTION_WPS_SEEKFWD);
|
||||||
last_right = last_left = 0;
|
last_right = last_left = 0;
|
||||||
break;
|
break;
|
||||||
/* fast rewind
|
/* fast rewind
|
||||||
OR prev dir if this is straight after ACTION_WPS_SKIPPREV,*/
|
OR prev dir if this is straight after ACTION_WPS_SKIPPREV,*/
|
||||||
case ACTION_WPS_SEEKBACK:
|
case ACTION_WPS_SEEKBACK:
|
||||||
if (global_settings.party_mode)
|
if (global_settings.party_mode)
|
||||||
|
|
34
apps/main.c
34
apps/main.c
|
@ -183,7 +183,7 @@ int main(void)
|
||||||
#ifdef AUTOROCK
|
#ifdef AUTOROCK
|
||||||
{
|
{
|
||||||
char filename[MAX_PATH];
|
char filename[MAX_PATH];
|
||||||
const char *file =
|
const char *file =
|
||||||
#ifdef APPLICATION
|
#ifdef APPLICATION
|
||||||
ROCKBOX_DIR
|
ROCKBOX_DIR
|
||||||
#else
|
#else
|
||||||
|
@ -210,15 +210,15 @@ static int init_dircache(bool preinit)
|
||||||
#ifdef HAVE_DIRCACHE
|
#ifdef HAVE_DIRCACHE
|
||||||
int result = 0;
|
int result = 0;
|
||||||
bool clear = false;
|
bool clear = false;
|
||||||
|
|
||||||
if (preinit)
|
if (preinit)
|
||||||
dircache_init();
|
dircache_init();
|
||||||
|
|
||||||
if (!global_settings.dircache)
|
if (!global_settings.dircache)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
# ifdef HAVE_EEPROM_SETTINGS
|
# ifdef HAVE_EEPROM_SETTINGS
|
||||||
if (firmware_settings.initialized && firmware_settings.disk_clean
|
if (firmware_settings.initialized && firmware_settings.disk_clean
|
||||||
&& preinit)
|
&& preinit)
|
||||||
{
|
{
|
||||||
result = dircache_load();
|
result = dircache_load();
|
||||||
|
@ -233,7 +233,7 @@ static int init_dircache(bool preinit)
|
||||||
splash(0, str(LANG_SCANNING_DISK));
|
splash(0, str(LANG_SCANNING_DISK));
|
||||||
clear = true;
|
clear = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
dircache_build(global_status.dircache_size);
|
dircache_build(global_status.dircache_size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -242,7 +242,7 @@ static int init_dircache(bool preinit)
|
||||||
{
|
{
|
||||||
if (preinit)
|
if (preinit)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (!dircache_is_enabled()
|
if (!dircache_is_enabled()
|
||||||
&& !dircache_is_initializing())
|
&& !dircache_is_initializing())
|
||||||
{
|
{
|
||||||
|
@ -253,7 +253,7 @@ static int init_dircache(bool preinit)
|
||||||
}
|
}
|
||||||
result = dircache_build(global_status.dircache_size);
|
result = dircache_build(global_status.dircache_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
{
|
{
|
||||||
/* Initialization of dircache failed. Manual action is
|
/* Initialization of dircache failed. Manual action is
|
||||||
|
@ -263,7 +263,7 @@ static int init_dircache(bool preinit)
|
||||||
global_settings.dircache = false;
|
global_settings.dircache = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clear)
|
if (clear)
|
||||||
{
|
{
|
||||||
backlight_on();
|
backlight_on();
|
||||||
|
@ -271,7 +271,7 @@ static int init_dircache(bool preinit)
|
||||||
global_status.dircache_size = dircache_get_cache_size();
|
global_status.dircache_size = dircache_get_cache_size();
|
||||||
status_save();
|
status_save();
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
#else
|
#else
|
||||||
(void)preinit;
|
(void)preinit;
|
||||||
|
@ -288,7 +288,7 @@ static void init_tagcache(void)
|
||||||
long talked_tick = 0;
|
long talked_tick = 0;
|
||||||
#endif
|
#endif
|
||||||
tagcache_init();
|
tagcache_init();
|
||||||
|
|
||||||
while (!tagcache_is_initialized())
|
while (!tagcache_is_initialized())
|
||||||
{
|
{
|
||||||
int ret = tagcache_get_commit_step();
|
int ret = tagcache_get_commit_step();
|
||||||
|
@ -322,7 +322,7 @@ static void init_tagcache(void)
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
lcd_double_height(false);
|
lcd_double_height(false);
|
||||||
lcd_putsf(0, 1, " DB [%d/%d]", ret,
|
lcd_putsf(0, 1, " DB [%d/%d]", ret,
|
||||||
tagcache_get_max_commit_step());
|
tagcache_get_max_commit_step());
|
||||||
lcd_update();
|
lcd_update();
|
||||||
#endif
|
#endif
|
||||||
|
@ -370,7 +370,7 @@ static void init(void)
|
||||||
#if (CONFIG_PLATFORM & PLATFORM_ANDROID)
|
#if (CONFIG_PLATFORM & PLATFORM_ANDROID)
|
||||||
notification_init();
|
notification_init();
|
||||||
#endif
|
#endif
|
||||||
lang_init(core_language_builtin, language_strings,
|
lang_init(core_language_builtin, language_strings,
|
||||||
LANG_LAST_INDEX_IN_ARRAY);
|
LANG_LAST_INDEX_IN_ARRAY);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug_init();
|
debug_init();
|
||||||
|
@ -452,7 +452,7 @@ static void init(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
i2c_init();
|
i2c_init();
|
||||||
|
|
||||||
power_init();
|
power_init();
|
||||||
|
|
||||||
enable_irq();
|
enable_irq();
|
||||||
|
@ -471,13 +471,13 @@ static void init(void)
|
||||||
global_status.font_id[i] = FONT_SYSFIXED;
|
global_status.font_id[i] = FONT_SYSFIXED;
|
||||||
font_init();
|
font_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
settings_reset();
|
settings_reset();
|
||||||
|
|
||||||
CHART(">show_logo");
|
CHART(">show_logo");
|
||||||
show_logo();
|
show_logo();
|
||||||
CHART("<show_logo");
|
CHART("<show_logo");
|
||||||
lang_init(core_language_builtin, language_strings,
|
lang_init(core_language_builtin, language_strings,
|
||||||
LANG_LAST_INDEX_IN_ARRAY);
|
LANG_LAST_INDEX_IN_ARRAY);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
@ -676,7 +676,7 @@ static void init(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
CHART(">settings_apply(true)");
|
CHART(">settings_apply(true)");
|
||||||
settings_apply(true);
|
settings_apply(true);
|
||||||
CHART("<settings_apply(true)");
|
CHART("<settings_apply(true)");
|
||||||
CHART(">init_dircache(false)");
|
CHART(">init_dircache(false)");
|
||||||
init_dircache(false);
|
init_dircache(false);
|
||||||
|
|
|
@ -62,7 +62,7 @@ static int setcrossfadeonexit_callback(int action,const struct menu_item_ex *thi
|
||||||
/***********************************/
|
/***********************************/
|
||||||
/* PLAYBACK MENU */
|
/* PLAYBACK MENU */
|
||||||
static int playback_callback(int action,const struct menu_item_ex *this_item);
|
static int playback_callback(int action,const struct menu_item_ex *this_item);
|
||||||
|
|
||||||
MENUITEM_SETTING(shuffle_item, &global_settings.playlist_shuffle, playback_callback);
|
MENUITEM_SETTING(shuffle_item, &global_settings.playlist_shuffle, playback_callback);
|
||||||
MENUITEM_SETTING(repeat_mode, &global_settings.repeat_mode, playback_callback);
|
MENUITEM_SETTING(repeat_mode, &global_settings.repeat_mode, playback_callback);
|
||||||
MENUITEM_SETTING(play_selected, &global_settings.play_selected, NULL);
|
MENUITEM_SETTING(play_selected, &global_settings.play_selected, NULL);
|
||||||
|
@ -84,7 +84,7 @@ static int buffermargin_callback(int action,const struct menu_item_ex *this_item
|
||||||
}
|
}
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
# define buffermargin_callback NULL
|
# define buffermargin_callback NULL
|
||||||
#endif
|
#endif
|
||||||
MENUITEM_SETTING(buffer_margin, &global_settings.buffer_margin,
|
MENUITEM_SETTING(buffer_margin, &global_settings.buffer_margin,
|
||||||
|
@ -120,7 +120,7 @@ static int replaygain_callback(int action,const struct menu_item_ex *this_item)
|
||||||
(void)this_item;
|
(void)this_item;
|
||||||
switch (action)
|
switch (action)
|
||||||
{
|
{
|
||||||
case ACTION_EXIT_MENUITEM: /* on exit */
|
case ACTION_EXIT_MENUITEM: /* on exit */
|
||||||
replaygain_update();
|
replaygain_update();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,7 @@ MENUITEM_SETTING(replaygain_preamp,
|
||||||
replaygain_callback);
|
replaygain_callback);
|
||||||
MAKE_MENU(replaygain_settings_menu,ID2P(LANG_REPLAYGAIN),0, Icon_NOICON,
|
MAKE_MENU(replaygain_settings_menu,ID2P(LANG_REPLAYGAIN),0, Icon_NOICON,
|
||||||
&replaygain_type, &replaygain_noclip, &replaygain_preamp);
|
&replaygain_type, &replaygain_noclip, &replaygain_preamp);
|
||||||
|
|
||||||
MENUITEM_SETTING(beep, &global_settings.beep ,NULL);
|
MENUITEM_SETTING(beep, &global_settings.beep ,NULL);
|
||||||
#endif /* CONFIG_CODEC == SWCODEC */
|
#endif /* CONFIG_CODEC == SWCODEC */
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ static int audioscrobbler_callback(int action,const struct menu_item_ex *this_it
|
||||||
case ACTION_EXIT_MENUITEM: /* on exit */
|
case ACTION_EXIT_MENUITEM: /* on exit */
|
||||||
if (!scrobbler_is_enabled() && global_settings.audioscrobbler)
|
if (!scrobbler_is_enabled() && global_settings.audioscrobbler)
|
||||||
scrobbler_init();
|
scrobbler_init();
|
||||||
|
|
||||||
if(scrobbler_is_enabled() && !global_settings.audioscrobbler)
|
if(scrobbler_is_enabled() && !global_settings.audioscrobbler)
|
||||||
scrobbler_shutdown();
|
scrobbler_shutdown();
|
||||||
break;
|
break;
|
||||||
|
@ -205,13 +205,13 @@ MAKE_MENU(playback_settings,ID2P(LANG_PLAYBACK),0,
|
||||||
Icon_Playback_menu,
|
Icon_Playback_menu,
|
||||||
&shuffle_item, &repeat_mode, &play_selected,
|
&shuffle_item, &repeat_mode, &play_selected,
|
||||||
&ff_rewind_settings_menu,
|
&ff_rewind_settings_menu,
|
||||||
#ifdef HAVE_DISK_STORAGE
|
#ifdef HAVE_DISK_STORAGE
|
||||||
&buffer_margin,
|
&buffer_margin,
|
||||||
#endif
|
#endif
|
||||||
&fade_on_stop, &party_mode,
|
&fade_on_stop, &party_mode,
|
||||||
|
|
||||||
#if (CONFIG_CODEC == SWCODEC) && defined(HAVE_CROSSFADE)
|
#if (CONFIG_CODEC == SWCODEC) && defined(HAVE_CROSSFADE)
|
||||||
&crossfade_settings_menu,
|
&crossfade_settings_menu,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CONFIG_CODEC == SWCODEC
|
#if CONFIG_CODEC == SWCODEC
|
||||||
|
@ -235,7 +235,7 @@ MAKE_MENU(playback_settings,ID2P(LANG_PLAYBACK),0,
|
||||||
,&play_frequency
|
,&play_frequency
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
|
|
||||||
static int playback_callback(int action,const struct menu_item_ex *this_item)
|
static int playback_callback(int action,const struct menu_item_ex *this_item)
|
||||||
{
|
{
|
||||||
static bool old_shuffle = false;
|
static bool old_shuffle = false;
|
||||||
|
|
20
apps/misc.c
20
apps/misc.c
|
@ -1,10 +1,10 @@
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* __________ __ ___.
|
* __________ __ ___.
|
||||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
* \/ \/ \/ \/ \/
|
* \/ \/ \/ \/ \/
|
||||||
* $Id$
|
* $Id$
|
||||||
*
|
*
|
||||||
* Copyright (C) 2002 by Daniel Stenberg
|
* Copyright (C) 2002 by Daniel Stenberg
|
||||||
|
@ -424,7 +424,7 @@ bool list_stop_handler(void)
|
||||||
|
|
||||||
if (TIME_BEFORE(current_tick, last_off + HZ/2))
|
if (TIME_BEFORE(current_tick, last_off + HZ/2))
|
||||||
{
|
{
|
||||||
if (charger_inserted())
|
if (charger_inserted())
|
||||||
{
|
{
|
||||||
charging_splash();
|
charging_splash();
|
||||||
ret = true; /* screen is dirty, caller needs to refresh */
|
ret = true; /* screen is dirty, caller needs to refresh */
|
||||||
|
@ -1064,7 +1064,7 @@ void format_time(char* buf, int buf_size, long t)
|
||||||
int const seconds = time % 60;
|
int const seconds = time % 60;
|
||||||
const char * const sign = &"-"[t < 0 ? 0 : 1];
|
const char * const sign = &"-"[t < 0 ? 0 : 1];
|
||||||
|
|
||||||
if ( hours == 0 )
|
if ( hours == 0 )
|
||||||
{
|
{
|
||||||
snprintf(buf, buf_size, "%s%d:%02d", sign, minutes, seconds);
|
snprintf(buf, buf_size, "%s%d:%02d", sign, minutes, seconds);
|
||||||
}
|
}
|
||||||
|
@ -1177,7 +1177,7 @@ bool parse_color(enum screen_type screen, char *text, int *value)
|
||||||
{
|
{
|
||||||
(void)text; (void)value; /* silence warnings on mono bitmap */
|
(void)text; (void)value; /* silence warnings on mono bitmap */
|
||||||
(void)screen;
|
(void)screen;
|
||||||
|
|
||||||
#ifdef HAVE_LCD_COLOR
|
#ifdef HAVE_LCD_COLOR
|
||||||
if (screens[screen].depth > 2)
|
if (screens[screen].depth > 2)
|
||||||
{
|
{
|
||||||
|
@ -1214,7 +1214,7 @@ int clamp_value_wrap(int value, int max, int min)
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#define MAX_ACTIVITY_DEPTH 12
|
#define MAX_ACTIVITY_DEPTH 12
|
||||||
static enum current_activity
|
static enum current_activity
|
||||||
current_activity[MAX_ACTIVITY_DEPTH] = {ACTIVITY_UNKNOWN};
|
current_activity[MAX_ACTIVITY_DEPTH] = {ACTIVITY_UNKNOWN};
|
||||||
static int current_activity_top = 0;
|
static int current_activity_top = 0;
|
||||||
void push_current_activity(enum current_activity screen)
|
void push_current_activity(enum current_activity screen)
|
||||||
|
|
162
apps/mpeg.c
162
apps/mpeg.c
|
@ -382,7 +382,7 @@ static void set_elapsed(struct mp3entry* id3)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
i--;
|
i--;
|
||||||
if (i < 0)
|
if (i < 0)
|
||||||
i = 0;
|
i = 0;
|
||||||
|
@ -395,7 +395,7 @@ static void set_elapsed(struct mp3entry* id3)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
nextpos = 256;
|
nextpos = 256;
|
||||||
}
|
}
|
||||||
|
|
||||||
remainder = id3->offset - (relpos * (id3->filesize / 256));
|
remainder = id3->offset - (relpos * (id3->filesize / 256));
|
||||||
|
@ -425,7 +425,7 @@ int audio_get_file_pos(void)
|
||||||
{
|
{
|
||||||
int pos = -1;
|
int pos = -1;
|
||||||
struct mp3entry *id3 = audio_current_track();
|
struct mp3entry *id3 = audio_current_track();
|
||||||
|
|
||||||
if (id3->vbr)
|
if (id3->vbr)
|
||||||
{
|
{
|
||||||
if (id3->has_toc)
|
if (id3->has_toc)
|
||||||
|
@ -433,20 +433,20 @@ int audio_get_file_pos(void)
|
||||||
/* Use the TOC to find the new position */
|
/* Use the TOC to find the new position */
|
||||||
unsigned int percent, remainder;
|
unsigned int percent, remainder;
|
||||||
int curtoc, nexttoc, plen;
|
int curtoc, nexttoc, plen;
|
||||||
|
|
||||||
percent = (id3->elapsed*100)/id3->length;
|
percent = (id3->elapsed*100)/id3->length;
|
||||||
if (percent > 99)
|
if (percent > 99)
|
||||||
percent = 99;
|
percent = 99;
|
||||||
|
|
||||||
curtoc = id3->toc[percent];
|
curtoc = id3->toc[percent];
|
||||||
|
|
||||||
if (percent < 99)
|
if (percent < 99)
|
||||||
nexttoc = id3->toc[percent+1];
|
nexttoc = id3->toc[percent+1];
|
||||||
else
|
else
|
||||||
nexttoc = 256;
|
nexttoc = 256;
|
||||||
|
|
||||||
pos = (id3->filesize/256)*curtoc;
|
pos = (id3->filesize/256)*curtoc;
|
||||||
|
|
||||||
/* Use the remainder to get a more accurate position */
|
/* Use the remainder to get a more accurate position */
|
||||||
remainder = (id3->elapsed*100)%id3->length;
|
remainder = (id3->elapsed*100)%id3->length;
|
||||||
remainder = (remainder*100)/id3->length;
|
remainder = (remainder*100)/id3->length;
|
||||||
|
@ -478,7 +478,7 @@ int audio_get_file_pos(void)
|
||||||
/* skip past id3v2 tag and other leading garbage */
|
/* skip past id3v2 tag and other leading garbage */
|
||||||
pos = id3->first_frame_offset;
|
pos = id3->first_frame_offset;
|
||||||
}
|
}
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long mpeg_get_last_header(void)
|
unsigned long mpeg_get_last_header(void)
|
||||||
|
@ -637,9 +637,9 @@ static void recalculate_watermark(int bitrate)
|
||||||
and set a high threshold */
|
and set a high threshold */
|
||||||
if(bitrate == 0)
|
if(bitrate == 0)
|
||||||
bitrate = 320;
|
bitrate = 320;
|
||||||
|
|
||||||
bytes_per_sec = bitrate * 1000 / 8;
|
bytes_per_sec = bitrate * 1000 / 8;
|
||||||
|
|
||||||
if(time)
|
if(time)
|
||||||
{
|
{
|
||||||
/* No drive spins up faster than 3.5s */
|
/* No drive spins up faster than 3.5s */
|
||||||
|
@ -693,7 +693,7 @@ void audio_get_debugdata(struct audio_debug *dbgdata)
|
||||||
static void dbg_timer_start(void)
|
static void dbg_timer_start(void)
|
||||||
{
|
{
|
||||||
/* We are using timer 2 */
|
/* We are using timer 2 */
|
||||||
|
|
||||||
TSTR &= ~0x04; /* Stop the timer */
|
TSTR &= ~0x04; /* Stop the timer */
|
||||||
TSNC &= ~0x04; /* No synchronization */
|
TSNC &= ~0x04; /* No synchronization */
|
||||||
TMDR &= ~0x44; /* Operate normally */
|
TMDR &= ~0x44; /* Operate normally */
|
||||||
|
@ -813,7 +813,7 @@ void rec_tick(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
data = *(unsigned char *)0x04000000; /* read data byte */
|
data = *(unsigned char *)0x04000000; /* read data byte */
|
||||||
|
|
||||||
xor_b(0x08, &PADRH); /* Set PR inactive */
|
xor_b(0x08, &PADRH); /* Set PR inactive */
|
||||||
|
|
||||||
mpeg_audiobuf[audiobuf_write++] = data;
|
mpeg_audiobuf[audiobuf_write++] = data;
|
||||||
|
@ -888,7 +888,7 @@ static void transfer_end(const void** ppbuf, size_t* psize)
|
||||||
audiobuf_read += last_dma_chunk_size;
|
audiobuf_read += last_dma_chunk_size;
|
||||||
if(audiobuf_read >= audiobuflen)
|
if(audiobuf_read >= audiobuflen)
|
||||||
audiobuf_read = 0;
|
audiobuf_read = 0;
|
||||||
|
|
||||||
/* First, check if we are on a track boundary */
|
/* First, check if we are on a track boundary */
|
||||||
if (num_tracks_in_memory() > 1)
|
if (num_tracks_in_memory() > 1)
|
||||||
{
|
{
|
||||||
|
@ -901,17 +901,17 @@ static void transfer_end(const void** ppbuf, size_t* psize)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unplayed_space_left = get_unplayed_space();
|
unplayed_space_left = get_unplayed_space();
|
||||||
|
|
||||||
space_until_end_of_buffer = audiobuflen - audiobuf_read;
|
space_until_end_of_buffer = audiobuflen - audiobuf_read;
|
||||||
|
|
||||||
if(!filling && unplayed_space_left < low_watermark)
|
if(!filling && unplayed_space_left < low_watermark)
|
||||||
{
|
{
|
||||||
filling = true;
|
filling = true;
|
||||||
queue_post(&mpeg_queue, MPEG_NEED_DATA, GENERATE_UNBUFFER_EVENTS);
|
queue_post(&mpeg_queue, MPEG_NEED_DATA, GENERATE_UNBUFFER_EVENTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(unplayed_space_left)
|
if(unplayed_space_left)
|
||||||
{
|
{
|
||||||
last_dma_chunk_size = MIN(0x2000, unplayed_space_left);
|
last_dma_chunk_size = MIN(0x2000, unplayed_space_left);
|
||||||
|
@ -953,7 +953,7 @@ static void transfer_end(const void** ppbuf, size_t* psize)
|
||||||
/* Update the watermark debug level */
|
/* Update the watermark debug level */
|
||||||
if(unplayed_space_left < lowest_watermark_level)
|
if(unplayed_space_left < lowest_watermark_level)
|
||||||
lowest_watermark_level = unplayed_space_left;
|
lowest_watermark_level = unplayed_space_left;
|
||||||
|
|
||||||
DEBUGF("DMA underrun.\n");
|
DEBUGF("DMA underrun.\n");
|
||||||
dma_underrun = true;
|
dma_underrun = true;
|
||||||
}
|
}
|
||||||
|
@ -975,7 +975,7 @@ static struct trackdata *add_track_to_tag_list(const char *filename)
|
||||||
{
|
{
|
||||||
struct trackdata *track;
|
struct trackdata *track;
|
||||||
bool send_nid3_event;
|
bool send_nid3_event;
|
||||||
|
|
||||||
if(num_tracks_in_memory() >= MAX_TRACK_ENTRIES)
|
if(num_tracks_in_memory() >= MAX_TRACK_ENTRIES)
|
||||||
{
|
{
|
||||||
DEBUGF("Tag memory is full\n");
|
DEBUGF("Tag memory is full\n");
|
||||||
|
@ -983,7 +983,7 @@ static struct trackdata *add_track_to_tag_list(const char *filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
track = &trackdata[track_write_idx];
|
track = &trackdata[track_write_idx];
|
||||||
|
|
||||||
/* grab id3 tag of new file and
|
/* grab id3 tag of new file and
|
||||||
remember where in memory it starts */
|
remember where in memory it starts */
|
||||||
if(mp3info(&track->id3, filename))
|
if(mp3info(&track->id3, filename))
|
||||||
|
@ -1032,14 +1032,14 @@ static int new_file(int steps)
|
||||||
start += track->load_ahead_index;
|
start += track->load_ahead_index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
trackname = playlist_peek(start + steps, name_buf, sizeof(name_buf));
|
trackname = playlist_peek(start + steps, name_buf, sizeof(name_buf));
|
||||||
if ( !trackname )
|
if ( !trackname )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
DEBUGF("Loading %s\n", trackname);
|
DEBUGF("Loading %s\n", trackname);
|
||||||
|
|
||||||
mpeg_file = open(trackname, O_RDONLY);
|
mpeg_file = open(trackname, O_RDONLY);
|
||||||
if(mpeg_file < 0) {
|
if(mpeg_file < 0) {
|
||||||
DEBUGF("Couldn't open file: %s\n",trackname);
|
DEBUGF("Couldn't open file: %s\n",trackname);
|
||||||
|
@ -1065,7 +1065,7 @@ static int new_file(int steps)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* skip past id3v2 tag */
|
/* skip past id3v2 tag */
|
||||||
lseek(mpeg_file,
|
lseek(mpeg_file,
|
||||||
track->id3.first_frame_offset,
|
track->id3.first_frame_offset,
|
||||||
SEEK_SET);
|
SEEK_SET);
|
||||||
track->id3.index = steps;
|
track->id3.index = steps;
|
||||||
|
@ -1079,7 +1079,7 @@ static int new_file(int steps)
|
||||||
else
|
else
|
||||||
recalculate_watermark(
|
recalculate_watermark(
|
||||||
track->id3.bitrate);
|
track->id3.bitrate);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1212,7 +1212,7 @@ static void start_playback_if_ready(void)
|
||||||
playable_space = audiobuf_swapwrite - audiobuf_read;
|
playable_space = audiobuf_swapwrite - audiobuf_read;
|
||||||
if(playable_space < 0)
|
if(playable_space < 0)
|
||||||
playable_space += audiobuflen;
|
playable_space += audiobuflen;
|
||||||
|
|
||||||
/* See if we have started playing yet. If not, do it. */
|
/* See if we have started playing yet. If not, do it. */
|
||||||
if(play_pending || dma_underrun)
|
if(play_pending || dma_underrun)
|
||||||
{
|
{
|
||||||
|
@ -1273,7 +1273,7 @@ static bool swap_one_chunk(void)
|
||||||
else
|
else
|
||||||
amount_to_swap = MIN(MPEG_SWAP_CHUNKSIZE, free_space_left);
|
amount_to_swap = MIN(MPEG_SWAP_CHUNKSIZE, free_space_left);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(audiobuf_write < audiobuf_swapwrite)
|
if(audiobuf_write < audiobuf_swapwrite)
|
||||||
amount_to_swap = MIN(audiobuflen - audiobuf_swapwrite,
|
amount_to_swap = MIN(audiobuflen - audiobuf_swapwrite,
|
||||||
amount_to_swap);
|
amount_to_swap);
|
||||||
|
@ -1342,7 +1342,7 @@ static void mpeg_thread(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
start_playback_if_ready();
|
start_playback_if_ready();
|
||||||
|
|
||||||
switch(ev.id)
|
switch(ev.id)
|
||||||
{
|
{
|
||||||
case MPEG_PLAY:
|
case MPEG_PLAY:
|
||||||
|
@ -1376,8 +1376,8 @@ static void mpeg_thread(void)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* skip past id3v2 tag */
|
/* skip past id3v2 tag */
|
||||||
lseek(mpeg_file,
|
lseek(mpeg_file,
|
||||||
get_trackdata(0)->id3.first_frame_offset,
|
get_trackdata(0)->id3.first_frame_offset,
|
||||||
SEEK_SET);
|
SEEK_SET);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1421,7 +1421,7 @@ static void mpeg_thread(void)
|
||||||
if ( current_track_counter == pause_track )
|
if ( current_track_counter == pause_track )
|
||||||
last_dma_tick += current_tick - pause_tick;
|
last_dma_tick += current_tick - pause_tick;
|
||||||
else
|
else
|
||||||
last_dma_tick = current_tick;
|
last_dma_tick = current_tick;
|
||||||
pause_tick = 0;
|
pause_tick = 0;
|
||||||
mp3_play_pause(true);
|
mp3_play_pause(true);
|
||||||
}
|
}
|
||||||
|
@ -1481,7 +1481,7 @@ static void mpeg_thread(void)
|
||||||
/* Make it read more data */
|
/* Make it read more data */
|
||||||
filling = true;
|
filling = true;
|
||||||
queue_post(&mpeg_queue, MPEG_NEED_DATA, 0);
|
queue_post(&mpeg_queue, MPEG_NEED_DATA, 0);
|
||||||
|
|
||||||
/* Tell the file loading code that we want
|
/* Tell the file loading code that we want
|
||||||
to start playing as soon as we have some data */
|
to start playing as soon as we have some data */
|
||||||
play_pending = true;
|
play_pending = true;
|
||||||
|
@ -1498,7 +1498,7 @@ static void mpeg_thread(void)
|
||||||
|
|
||||||
if (!playlist_check(-1))
|
if (!playlist_check(-1))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* stop the current stream */
|
/* stop the current stream */
|
||||||
end_current_track();
|
end_current_track();
|
||||||
|
|
||||||
|
@ -1540,7 +1540,7 @@ static void mpeg_thread(void)
|
||||||
id3->elapsed = oldtime;
|
id3->elapsed = oldtime;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mpeg_file >= 0)
|
if (mpeg_file >= 0)
|
||||||
curpos = lseek(mpeg_file, 0, SEEK_CUR);
|
curpos = lseek(mpeg_file, 0, SEEK_CUR);
|
||||||
else
|
else
|
||||||
|
@ -1581,7 +1581,7 @@ static void mpeg_thread(void)
|
||||||
hasn't yet advanced up to the new location of the read
|
hasn't yet advanced up to the new location of the read
|
||||||
pointer. We just move it, there is no need to swap
|
pointer. We just move it, there is no need to swap
|
||||||
data that won't be played anyway. */
|
data that won't be played anyway. */
|
||||||
|
|
||||||
if (unswapped_space_left > unplayed_space_left)
|
if (unswapped_space_left > unplayed_space_left)
|
||||||
{
|
{
|
||||||
DEBUGF("Moved swapwrite\n");
|
DEBUGF("Moved swapwrite\n");
|
||||||
|
@ -1599,9 +1599,9 @@ static void mpeg_thread(void)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* resume will start at new position */
|
/* resume will start at new position */
|
||||||
last_dma_chunk_size =
|
last_dma_chunk_size =
|
||||||
MIN(0x2000, get_unplayed_space_current_song());
|
MIN(0x2000, get_unplayed_space_current_song());
|
||||||
mp3_play_data(mpeg_audiobuf + audiobuf_read,
|
mp3_play_data(mpeg_audiobuf + audiobuf_read,
|
||||||
last_dma_chunk_size, transfer_end);
|
last_dma_chunk_size, transfer_end);
|
||||||
dma_underrun = false;
|
dma_underrun = false;
|
||||||
}
|
}
|
||||||
|
@ -1696,7 +1696,7 @@ static void mpeg_thread(void)
|
||||||
|
|
||||||
/* Make sure that we don't fill the entire buffer */
|
/* Make sure that we don't fill the entire buffer */
|
||||||
free_space_left -= MPEG_HIGH_WATER;
|
free_space_left -= MPEG_HIGH_WATER;
|
||||||
|
|
||||||
if (ev.data == GENERATE_UNBUFFER_EVENTS)
|
if (ev.data == GENERATE_UNBUFFER_EVENTS)
|
||||||
generate_unbuffer_events();
|
generate_unbuffer_events();
|
||||||
|
|
||||||
|
@ -1748,12 +1748,12 @@ static void mpeg_thread(void)
|
||||||
static const unsigned char tag[] = "TAG";
|
static const unsigned char tag[] = "TAG";
|
||||||
int taglen = 128;
|
int taglen = 128;
|
||||||
int tagptr = audiobuf_write + len - 128;
|
int tagptr = audiobuf_write + len - 128;
|
||||||
|
|
||||||
/* Really rare case: entire potential tag wasn't
|
/* Really rare case: entire potential tag wasn't
|
||||||
read in this call AND audiobuf_write < 128 */
|
read in this call AND audiobuf_write < 128 */
|
||||||
if (tagptr < 0)
|
if (tagptr < 0)
|
||||||
tagptr += audiobuflen;
|
tagptr += audiobuflen;
|
||||||
|
|
||||||
for(i = 0;i < 3;i++)
|
for(i = 0;i < 3;i++)
|
||||||
{
|
{
|
||||||
if(tagptr >= audiobuflen)
|
if(tagptr >= audiobuflen)
|
||||||
|
@ -1801,10 +1801,10 @@ static void mpeg_thread(void)
|
||||||
{
|
{
|
||||||
DEBUGF("MPEG read error\n");
|
DEBUGF("MPEG read error\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
close(mpeg_file);
|
close(mpeg_file);
|
||||||
mpeg_file = -1;
|
mpeg_file = -1;
|
||||||
|
|
||||||
if(new_file(1) < 0)
|
if(new_file(1) < 0)
|
||||||
{
|
{
|
||||||
/* No more data to play */
|
/* No more data to play */
|
||||||
|
@ -1819,7 +1819,7 @@ static void mpeg_thread(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MPEG_TRACK_CHANGE:
|
case MPEG_TRACK_CHANGE:
|
||||||
track_change();
|
track_change();
|
||||||
break;
|
break;
|
||||||
|
@ -1838,7 +1838,7 @@ static void mpeg_thread(void)
|
||||||
usb_wait_for_disconnect(&mpeg_queue);
|
usb_wait_for_disconnect(&mpeg_queue);
|
||||||
break;
|
break;
|
||||||
#endif /* !USB_NONE */
|
#endif /* !USB_NONE */
|
||||||
|
|
||||||
#if CONFIG_CODEC == MAS3587F
|
#if CONFIG_CODEC == MAS3587F
|
||||||
case MPEG_INIT_RECORDING:
|
case MPEG_INIT_RECORDING:
|
||||||
init_recording();
|
init_recording();
|
||||||
|
@ -1876,7 +1876,7 @@ static void mpeg_thread(void)
|
||||||
mpeg_audiobuf+startpos, startpos);
|
mpeg_audiobuf+startpos, startpos);
|
||||||
|
|
||||||
saved_header = mpeg_get_last_header();
|
saved_header = mpeg_get_last_header();
|
||||||
|
|
||||||
mem_find_next_frame(startpos, &offset, 1800,
|
mem_find_next_frame(startpos, &offset, 1800,
|
||||||
saved_header, mpeg_audiobuf,
|
saved_header, mpeg_audiobuf,
|
||||||
audiobuflen);
|
audiobuflen);
|
||||||
|
@ -1912,10 +1912,10 @@ static void mpeg_thread(void)
|
||||||
|
|
||||||
/* delayed until buffer is saved, don't open yet */
|
/* delayed until buffer is saved, don't open yet */
|
||||||
strcpy(delayed_filename, recording_filename);
|
strcpy(delayed_filename, recording_filename);
|
||||||
mpeg_file = -1;
|
mpeg_file = -1;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MPEG_STOP:
|
case MPEG_STOP:
|
||||||
DEBUGF("MPEG_STOP\n");
|
DEBUGF("MPEG_STOP\n");
|
||||||
|
|
||||||
|
@ -1974,7 +1974,7 @@ static void mpeg_thread(void)
|
||||||
|
|
||||||
mas_readmem(MAS_BANK_D0, MAS_D0_MPEG_FRAME_COUNT,
|
mas_readmem(MAS_BANK_D0, MAS_D0_MPEG_FRAME_COUNT,
|
||||||
&frame_count_end, 1);
|
&frame_count_end, 1);
|
||||||
|
|
||||||
last_rec_time = current_tick - record_start_time;
|
last_rec_time = current_tick - record_start_time;
|
||||||
record_start_time = current_tick;
|
record_start_time = current_tick;
|
||||||
if (paused)
|
if (paused)
|
||||||
|
@ -2014,7 +2014,7 @@ static void mpeg_thread(void)
|
||||||
queue_post(&mpeg_queue, MPEG_SAVE_DATA, 0);
|
queue_post(&mpeg_queue, MPEG_SAVE_DATA, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MPEG_SAVE_DATA:
|
case MPEG_SAVE_DATA:
|
||||||
if (saving_status == BUFFER_FULL)
|
if (saving_status == BUFFER_FULL)
|
||||||
save_endpos = audiobuf_write;
|
save_endpos = audiobuf_write;
|
||||||
|
|
||||||
|
@ -2098,7 +2098,7 @@ static void mpeg_thread(void)
|
||||||
queue_post(&mpeg_queue, MPEG_SAVE_DATA, 0);
|
queue_post(&mpeg_queue, MPEG_SAVE_DATA, 0);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MPEG_PRERECORDING_TICK:
|
case MPEG_PRERECORDING_TICK:
|
||||||
if(!is_prerecording)
|
if(!is_prerecording)
|
||||||
break;
|
break;
|
||||||
|
@ -2118,21 +2118,21 @@ static void mpeg_thread(void)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MPEG_INIT_PLAYBACK:
|
case MPEG_INIT_PLAYBACK:
|
||||||
/* Stop the prerecording */
|
/* Stop the prerecording */
|
||||||
stop_recording();
|
stop_recording();
|
||||||
reset_mp3_buffer();
|
reset_mp3_buffer();
|
||||||
mp3_play_init();
|
mp3_play_init();
|
||||||
init_playback_done = true;
|
init_playback_done = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MPEG_PAUSE_RECORDING:
|
case MPEG_PAUSE_RECORDING:
|
||||||
pause_recording();
|
pause_recording();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MPEG_RESUME_RECORDING:
|
case MPEG_RESUME_RECORDING:
|
||||||
resume_recording();
|
resume_recording();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SYS_USB_CONNECTED:
|
case SYS_USB_CONNECTED:
|
||||||
/* We can safely go to USB mode if no recording
|
/* We can safely go to USB mode if no recording
|
||||||
is taking place */
|
is taking place */
|
||||||
|
@ -2142,11 +2142,11 @@ static void mpeg_thread(void)
|
||||||
function, to put the MAS in monitoring mode,
|
function, to put the MAS in monitoring mode,
|
||||||
to save power. */
|
to save power. */
|
||||||
stop_recording();
|
stop_recording();
|
||||||
|
|
||||||
/* Tell the USB thread that we are safe */
|
/* Tell the USB thread that we are safe */
|
||||||
DEBUGF("mpeg_thread got SYS_USB_CONNECTED\n");
|
DEBUGF("mpeg_thread got SYS_USB_CONNECTED\n");
|
||||||
usb_acknowledge(SYS_USB_CONNECTED_ACK);
|
usb_acknowledge(SYS_USB_CONNECTED_ACK);
|
||||||
|
|
||||||
/* Wait until the USB cable is extracted again */
|
/* Wait until the USB cable is extracted again */
|
||||||
usb_wait_for_disconnect(&mpeg_queue);
|
usb_wait_for_disconnect(&mpeg_queue);
|
||||||
}
|
}
|
||||||
|
@ -2166,7 +2166,7 @@ struct mp3entry* audio_current_track(void)
|
||||||
if(num_tracks_in_memory())
|
if(num_tracks_in_memory())
|
||||||
{
|
{
|
||||||
struct mp3entry *id3 = &get_trackdata(0)->id3;
|
struct mp3entry *id3 = &get_trackdata(0)->id3;
|
||||||
#endif
|
#endif
|
||||||
if (!checked_for_cuesheet && curr_cuesheet && id3->cuesheet == NULL)
|
if (!checked_for_cuesheet && curr_cuesheet && id3->cuesheet == NULL)
|
||||||
{
|
{
|
||||||
checked_for_cuesheet = true; /* only check once per track */
|
checked_for_cuesheet = true; /* only check once per track */
|
||||||
|
@ -2239,9 +2239,9 @@ static void init_recording(void)
|
||||||
is_prerecording = false;
|
is_prerecording = false;
|
||||||
|
|
||||||
mpeg_stop_done = true;
|
mpeg_stop_done = true;
|
||||||
|
|
||||||
mas_reset();
|
mas_reset();
|
||||||
|
|
||||||
/* Enable the audio CODEC and the DSP core, max analog voltage range */
|
/* Enable the audio CODEC and the DSP core, max analog voltage range */
|
||||||
rc = mas_direct_config_write(MAS_CONTROL, 0x8c00);
|
rc = mas_direct_config_write(MAS_CONTROL, 0x8c00);
|
||||||
if(rc < 0)
|
if(rc < 0)
|
||||||
|
@ -2257,7 +2257,7 @@ static void init_recording(void)
|
||||||
|
|
||||||
/* Perform black magic as described by the data sheet */
|
/* Perform black magic as described by the data sheet */
|
||||||
if((mas_version_code & 0x0fff) == 0x0102)
|
if((mas_version_code & 0x0fff) == 0x0102)
|
||||||
{
|
{
|
||||||
DEBUGF("Performing MAS black magic for B2 version\n");
|
DEBUGF("Performing MAS black magic for B2 version\n");
|
||||||
mas_writereg(0xa3, 0x98);
|
mas_writereg(0xa3, 0x98);
|
||||||
mas_writereg(0x94, 0xfffff);
|
mas_writereg(0x94, 0xfffff);
|
||||||
|
@ -2272,7 +2272,7 @@ static void init_recording(void)
|
||||||
|
|
||||||
/* Copy left channel to right (mono mode) */
|
/* Copy left channel to right (mono mode) */
|
||||||
mas_codec_writereg(8, 0x8000);
|
mas_codec_writereg(8, 0x8000);
|
||||||
|
|
||||||
/* ADC scale 0%, DSP scale 100%
|
/* ADC scale 0%, DSP scale 100%
|
||||||
We use the DSP output for monitoring, because it works with all
|
We use the DSP output for monitoring, because it works with all
|
||||||
sources including S/PDIF */
|
sources including S/PDIF */
|
||||||
|
@ -2282,7 +2282,7 @@ static void init_recording(void)
|
||||||
/* No mute */
|
/* No mute */
|
||||||
shadow_soft_mute = 0;
|
shadow_soft_mute = 0;
|
||||||
mas_writemem(MAS_BANK_D0, MAS_D0_SOFT_MUTE, &shadow_soft_mute, 1);
|
mas_writemem(MAS_BANK_D0, MAS_D0_SOFT_MUTE, &shadow_soft_mute, 1);
|
||||||
|
|
||||||
#ifdef HAVE_SPDIF_OUT
|
#ifdef HAVE_SPDIF_OUT
|
||||||
val = 0x09; /* Disable SDO and SDI, low impedance S/PDIF outputs */
|
val = 0x09; /* Disable SDO and SDI, low impedance S/PDIF outputs */
|
||||||
#else
|
#else
|
||||||
|
@ -2308,7 +2308,7 @@ static void init_recording(void)
|
||||||
DMA transfer has taken place.
|
DMA transfer has taken place.
|
||||||
Now let's wait for some data to be encoded. */
|
Now let's wait for some data to be encoded. */
|
||||||
sleep(HZ/5);
|
sleep(HZ/5);
|
||||||
|
|
||||||
/* Now set it to Monitoring mode as default, saves power */
|
/* Now set it to Monitoring mode as default, saves power */
|
||||||
shadow_io_control_main = 0x525;
|
shadow_io_control_main = 0x525;
|
||||||
mas_writemem(MAS_BANK_D0, MAS_D0_IO_CONTROL_MAIN, &shadow_io_control_main, 1);
|
mas_writemem(MAS_BANK_D0, MAS_D0_IO_CONTROL_MAIN, &shadow_io_control_main, 1);
|
||||||
|
@ -2331,7 +2331,7 @@ static void init_recording(void)
|
||||||
void audio_record(const char *filename)
|
void audio_record(const char *filename)
|
||||||
{
|
{
|
||||||
mpeg_errno = 0;
|
mpeg_errno = 0;
|
||||||
|
|
||||||
strlcpy(recording_filename, filename, MAX_PATH);
|
strlcpy(recording_filename, filename, MAX_PATH);
|
||||||
|
|
||||||
queue_post(&mpeg_queue, MPEG_RECORD, 0);
|
queue_post(&mpeg_queue, MPEG_RECORD, 0);
|
||||||
|
@ -2412,13 +2412,13 @@ static void start_prerecording(void)
|
||||||
unsigned long val;
|
unsigned long val;
|
||||||
|
|
||||||
DEBUGF("Starting prerecording\n");
|
DEBUGF("Starting prerecording\n");
|
||||||
|
|
||||||
prerecord_index = 0;
|
prerecord_index = 0;
|
||||||
prerecord_count = 0;
|
prerecord_count = 0;
|
||||||
prerecord_timeout = current_tick + HZ;
|
prerecord_timeout = current_tick + HZ;
|
||||||
memset(prerecord_buffer, 0, sizeof(prerecord_buffer));
|
memset(prerecord_buffer, 0, sizeof(prerecord_buffer));
|
||||||
reset_mp3_buffer();
|
reset_mp3_buffer();
|
||||||
|
|
||||||
is_prerecording = true;
|
is_prerecording = true;
|
||||||
|
|
||||||
/* Stop monitoring and start the encoder */
|
/* Stop monitoring and start the encoder */
|
||||||
|
@ -2431,7 +2431,7 @@ static void start_prerecording(void)
|
||||||
{
|
{
|
||||||
mas_readmem(MAS_BANK_D0, MAS_D0_IO_CONTROL_MAIN, &val,1);
|
mas_readmem(MAS_BANK_D0, MAS_D0_IO_CONTROL_MAIN, &val,1);
|
||||||
} while(val & 1);
|
} while(val & 1);
|
||||||
|
|
||||||
is_recording = true;
|
is_recording = true;
|
||||||
saving_status = NOT_SAVING;
|
saving_status = NOT_SAVING;
|
||||||
|
|
||||||
|
@ -2463,7 +2463,7 @@ static void start_recording(void)
|
||||||
mas_readmem(MAS_BANK_D0, MAS_D0_IO_CONTROL_MAIN, &val,1);
|
mas_readmem(MAS_BANK_D0, MAS_D0_IO_CONTROL_MAIN, &val,1);
|
||||||
} while(val & 1);
|
} while(val & 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
is_recording = true;
|
is_recording = true;
|
||||||
saving_status = NOT_SAVING;
|
saving_status = NOT_SAVING;
|
||||||
paused = false;
|
paused = false;
|
||||||
|
@ -2493,7 +2493,7 @@ static void pause_recording(void)
|
||||||
static void resume_recording(void)
|
static void resume_recording(void)
|
||||||
{
|
{
|
||||||
paused = false;
|
paused = false;
|
||||||
|
|
||||||
/* Clear the pause bit */
|
/* Clear the pause bit */
|
||||||
shadow_soft_mute &= ~2;
|
shadow_soft_mute &= ~2;
|
||||||
mas_writemem(MAS_BANK_D0, MAS_D0_SOFT_MUTE, &shadow_soft_mute, 1);
|
mas_writemem(MAS_BANK_D0, MAS_D0_SOFT_MUTE, &shadow_soft_mute, 1);
|
||||||
|
@ -2515,7 +2515,7 @@ static void stop_recording(void)
|
||||||
if(!paused)
|
if(!paused)
|
||||||
pause_recording();
|
pause_recording();
|
||||||
sleep(HZ/5);
|
sleep(HZ/5);
|
||||||
|
|
||||||
demand_irq_enable(false);
|
demand_irq_enable(false);
|
||||||
|
|
||||||
is_recording = false;
|
is_recording = false;
|
||||||
|
@ -2529,7 +2529,7 @@ static void stop_recording(void)
|
||||||
shadow_io_control_main |= (1 << 10);
|
shadow_io_control_main |= (1 << 10);
|
||||||
mas_writemem(MAS_BANK_D0, MAS_D0_IO_CONTROL_MAIN, &shadow_io_control_main, 1);
|
mas_writemem(MAS_BANK_D0, MAS_D0_IO_CONTROL_MAIN, &shadow_io_control_main, 1);
|
||||||
DEBUGF("mas_writemem(MAS_BANK_D0, IO_CONTROL_MAIN, %x)\n", shadow_io_control_main);
|
DEBUGF("mas_writemem(MAS_BANK_D0, IO_CONTROL_MAIN, %x)\n", shadow_io_control_main);
|
||||||
|
|
||||||
/* Wait until the DSP has accepted the settings */
|
/* Wait until the DSP has accepted the settings */
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -2565,7 +2565,7 @@ void audio_set_recording_options(struct audio_recording_options *options)
|
||||||
mas_store_pllfreq(24576000);
|
mas_store_pllfreq(24576000);
|
||||||
else
|
else
|
||||||
mas_store_pllfreq(22579000);
|
mas_store_pllfreq(22579000);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
shadow_soft_mute = options->rec_editable?4:0;
|
shadow_soft_mute = options->rec_editable?4:0;
|
||||||
mas_writemem(MAS_BANK_D0, MAS_D0_SOFT_MUTE, &shadow_soft_mute,1);
|
mas_writemem(MAS_BANK_D0, MAS_D0_SOFT_MUTE, &shadow_soft_mute,1);
|
||||||
|
@ -2647,7 +2647,7 @@ unsigned long audio_recorded_time(void)
|
||||||
{
|
{
|
||||||
if(is_prerecording)
|
if(is_prerecording)
|
||||||
return prerecord_count * HZ;
|
return prerecord_count * HZ;
|
||||||
|
|
||||||
if(is_recording)
|
if(is_recording)
|
||||||
{
|
{
|
||||||
if(paused)
|
if(paused)
|
||||||
|
@ -2663,7 +2663,7 @@ unsigned long audio_num_recorded_bytes(void)
|
||||||
{
|
{
|
||||||
int num_bytes;
|
int num_bytes;
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
if(is_recording)
|
if(is_recording)
|
||||||
{
|
{
|
||||||
if(is_prerecording)
|
if(is_prerecording)
|
||||||
|
@ -2671,11 +2671,11 @@ unsigned long audio_num_recorded_bytes(void)
|
||||||
index = prerecord_index - prerecord_count;
|
index = prerecord_index - prerecord_count;
|
||||||
if(index < 0)
|
if(index < 0)
|
||||||
index += prerecording_max_seconds;
|
index += prerecording_max_seconds;
|
||||||
|
|
||||||
num_bytes = audiobuf_write - prerecord_buffer[index].mempos;
|
num_bytes = audiobuf_write - prerecord_buffer[index].mempos;
|
||||||
if(num_bytes < 0)
|
if(num_bytes < 0)
|
||||||
num_bytes += audiobuflen;
|
num_bytes += audiobuflen;
|
||||||
|
|
||||||
return num_bytes;
|
return num_bytes;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2796,7 +2796,7 @@ void audio_play(long offset)
|
||||||
int steps=0;
|
int steps=0;
|
||||||
|
|
||||||
is_playing = true;
|
is_playing = true;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
trackname = playlist_peek(steps, name_buf, sizeof(name_buf));
|
trackname = playlist_peek(steps, name_buf, sizeof(name_buf));
|
||||||
if (!trackname)
|
if (!trackname)
|
||||||
|
@ -2849,7 +2849,7 @@ void audio_stop(void)
|
||||||
/* dummy */
|
/* dummy */
|
||||||
void audio_stop_recording(void)
|
void audio_stop_recording(void)
|
||||||
{
|
{
|
||||||
audio_stop();
|
audio_stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void audio_hard_stop(void)
|
void audio_hard_stop(void)
|
||||||
|
@ -2966,7 +2966,7 @@ int audio_status(void)
|
||||||
|
|
||||||
if(paused)
|
if(paused)
|
||||||
ret |= AUDIO_STATUS_PAUSE;
|
ret |= AUDIO_STATUS_PAUSE;
|
||||||
|
|
||||||
#if (CONFIG_CODEC == MAS3587F) && !defined(SIMULATOR)
|
#if (CONFIG_CODEC == MAS3587F) && !defined(SIMULATOR)
|
||||||
if(is_recording && !is_prerecording)
|
if(is_recording && !is_prerecording)
|
||||||
ret |= AUDIO_STATUS_RECORD;
|
ret |= AUDIO_STATUS_RECORD;
|
||||||
|
@ -2977,7 +2977,7 @@ int audio_status(void)
|
||||||
|
|
||||||
if(mpeg_errno)
|
if(mpeg_errno)
|
||||||
ret |= AUDIO_STATUS_ERROR;
|
ret |= AUDIO_STATUS_ERROR;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ int playback_claim_aa_slot(struct dim *dim);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Releases the albumart slot with given id
|
* Releases the albumart slot with given id
|
||||||
*
|
*
|
||||||
* Save to call from other threads */
|
* Save to call from other threads */
|
||||||
void playback_release_aa_slot(int slot);
|
void playback_release_aa_slot(int slot);
|
||||||
|
|
||||||
|
|
|
@ -140,7 +140,7 @@ static void write_cache(void)
|
||||||
fd = open(scrobbler_file, O_WRONLY | O_APPEND);
|
fd = open(scrobbler_file, O_WRONLY | O_APPEND);
|
||||||
if(fd >= 0)
|
if(fd >= 0)
|
||||||
{
|
{
|
||||||
logf("SCROBBLER: writing %d entries", cache_pos);
|
logf("SCROBBLER: writing %d entries", cache_pos);
|
||||||
/* copy data to temporary storage in case data moves during I/O */
|
/* copy data to temporary storage in case data moves during I/O */
|
||||||
char temp_buf[SCROBBLER_CACHE_LEN];
|
char temp_buf[SCROBBLER_CACHE_LEN];
|
||||||
for ( i=0; i < cache_pos; i++ )
|
for ( i=0; i < cache_pos; i++ )
|
||||||
|
|
414
apps/tagtree.c
414
apps/tagtree.c
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue