summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2013-07-12 12:03:20 -0400
committerMichael Sevakis <jethead71@rockbox.org>2013-07-12 21:39:06 -0400
commitffa8626b0c93f8a65e0e17190917f7f173160842 (patch)
treed6d9498cdaa0cfff06bc5e079a195f2c63dd1237
parentd85f796890f496cc89e0dd2588f123432638ab64 (diff)
downloadrockbox-ffa8626b0c93f8a65e0e17190917f7f173160842.tar.gz
rockbox-ffa8626b0c93f8a65e0e17190917f7f173160842.tar.bz2
rockbox-ffa8626b0c93f8a65e0e17190917f7f173160842.zip
Fix whitespace in files for following commit.
Change-Id: I4adb8a152e9b99fcd26d95da7334d7d0cbe2a036
-rw-r--r--apps/gui/wps.c40
-rw-r--r--apps/main.c34
-rw-r--r--apps/menus/playback_menu.c18
-rw-r--r--apps/misc.c20
-rw-r--r--apps/mpeg.c162
-rw-r--r--apps/playback.h2
-rw-r--r--apps/scrobbler.c2
-rw-r--r--apps/tagtree.c414
8 files changed, 346 insertions, 346 deletions
diff --git a/apps/gui/wps.c b/apps/gui/wps.c
index 1acd00d120..a3d7a1bcf1 100644
--- a/apps/gui/wps.c
+++ b/apps/gui/wps.c
@@ -68,7 +68,7 @@
#define RESTORE_WPS_INSTANTLY 0l
#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 */
#define MIN_FF_REWIND_STEP 500
@@ -170,7 +170,7 @@ void unpause_action(bool may_fade, bool updatewps)
#endif
(void)may_fade;
-}
+}
#if CONFIG_CODEC != SWCODEC
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 */
audio_resume();
-
+
if (updatewps)
update_non_static();
@@ -227,7 +227,7 @@ void fade(bool fade_in, bool updatewps)
sound_set_volume(global_settings.volume);
}
}
-#endif /* SWCODEC */
+#endif /* SWCODEC */
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)
{
- unsigned int step = 0; /* current ff/rewind step */
- unsigned int max_step = 0; /* maximum ff/rewind step */
+ unsigned int step = 0; /* current ff/rewind step */
+ unsigned int max_step = 0; /* maximum ff/rewind step */
int ff_rewind_count = 0; /* current ff/rewind count (in ticks) */
int direction = -1; /* forward=1 or backward=-1 */
bool exit = false;
@@ -323,7 +323,7 @@ bool ffwd_rew(int button)
if (direction == 1)
{
/* 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 +
ff_rewind_count)) *
FF_REWIND_MAX_PERCENT / 100;
@@ -360,7 +360,7 @@ bool ffwd_rew(int button)
FOR_NB_SCREENS(i)
skin_get_gwps(WPS, i)->display->stop_scroll();
#endif
- if (direction > 0)
+ if (direction > 0)
status_set_ffmode(STATUS_FASTFORWARD);
else
status_set_ffmode(STATUS_FASTBACKWARD);
@@ -489,8 +489,8 @@ static void change_dir(int direction)
audio_prev_dir();
else if (direction > 0)
audio_next_dir();
- /* prevent the next dir to immediatly start being ffw'd */
- action_wait_for_release();
+ /* prevent the next dir to immediatly start being ffw'd */
+ action_wait_for_release();
}
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));
#endif
viewportmanager_theme_undo(i, skin_has_sbs(i, skin_get_gwps(WPS, i)->data));
-
+
}
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
@@ -676,7 +676,7 @@ static void gwps_enter_wps(void)
#if LCD_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);
if (svp)
{
@@ -722,7 +722,7 @@ void wps_do_playpause(bool updatewps)
#endif
}
}
-
+
/* The WPS can be left in two ways:
* 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();
#endif
wps_state_init();
-
+
while ( 1 )
{
bool audio_paused = (audio_status() & AUDIO_STATUS_PAUSE)?true:false;
@@ -773,7 +773,7 @@ long gui_wps_show(void)
#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);
/* 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;
gwps_leave_wps();
- int retval = onplay(state->id3->path,
+ int retval = onplay(state->id3->path,
FILE_ATTR_AUDIO, CONTEXT_WPS, hotkey);
/* if music is stopped in the context menu we want to exit the wps */
- if (retval == ONPLAY_MAINMENU
+ if (retval == ONPLAY_MAINMENU
|| !audio_status())
return GO_TO_ROOT;
else if (retval == ONPLAY_PLAYLIST)
return GO_TO_PLAYLIST_VIEWER;
#ifdef HAVE_PICTUREFLOW_INTEGRATION
else if (retval == ONPLAY_PICTUREFLOW)
- return GO_TO_PICTUREFLOW;
+ return GO_TO_PICTUREFLOW;
#endif
restore = true;
}
@@ -860,7 +860,7 @@ long gui_wps_show(void)
global_settings.volume--;
vol_changed = true;
break;
- /* fast forward
+ /* fast forward
OR next dir if this is straight after ACTION_WPS_SKIPNEXT */
case ACTION_WPS_SEEKFWD:
if (global_settings.party_mode)
@@ -880,7 +880,7 @@ long gui_wps_show(void)
ffwd_rew(ACTION_WPS_SEEKFWD);
last_right = last_left = 0;
break;
- /* fast rewind
+ /* fast rewind
OR prev dir if this is straight after ACTION_WPS_SKIPPREV,*/
case ACTION_WPS_SEEKBACK:
if (global_settings.party_mode)
diff --git a/apps/main.c b/apps/main.c
index 57257aff66..7f44d89a6a 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -183,7 +183,7 @@ int main(void)
#ifdef AUTOROCK
{
char filename[MAX_PATH];
- const char *file =
+ const char *file =
#ifdef APPLICATION
ROCKBOX_DIR
#else
@@ -210,15 +210,15 @@ static int init_dircache(bool preinit)
#ifdef HAVE_DIRCACHE
int result = 0;
bool clear = false;
-
+
if (preinit)
dircache_init();
-
+
if (!global_settings.dircache)
return 0;
-
+
# ifdef HAVE_EEPROM_SETTINGS
- if (firmware_settings.initialized && firmware_settings.disk_clean
+ if (firmware_settings.initialized && firmware_settings.disk_clean
&& preinit)
{
result = dircache_load();
@@ -233,7 +233,7 @@ static int init_dircache(bool preinit)
splash(0, str(LANG_SCANNING_DISK));
clear = true;
}
-
+
dircache_build(global_status.dircache_size);
}
}
@@ -242,7 +242,7 @@ static int init_dircache(bool preinit)
{
if (preinit)
return -1;
-
+
if (!dircache_is_enabled()
&& !dircache_is_initializing())
{
@@ -253,7 +253,7 @@ static int init_dircache(bool preinit)
}
result = dircache_build(global_status.dircache_size);
}
-
+
if (result < 0)
{
/* Initialization of dircache failed. Manual action is
@@ -263,7 +263,7 @@ static int init_dircache(bool preinit)
global_settings.dircache = false;
}
}
-
+
if (clear)
{
backlight_on();
@@ -271,7 +271,7 @@ static int init_dircache(bool preinit)
global_status.dircache_size = dircache_get_cache_size();
status_save();
}
-
+
return result;
#else
(void)preinit;
@@ -288,7 +288,7 @@ static void init_tagcache(void)
long talked_tick = 0;
#endif
tagcache_init();
-
+
while (!tagcache_is_initialized())
{
int ret = tagcache_get_commit_step();
@@ -322,7 +322,7 @@ static void init_tagcache(void)
}
#else
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());
lcd_update();
#endif
@@ -370,7 +370,7 @@ static void init(void)
#if (CONFIG_PLATFORM & PLATFORM_ANDROID)
notification_init();
#endif
- lang_init(core_language_builtin, language_strings,
+ lang_init(core_language_builtin, language_strings,
LANG_LAST_INDEX_IN_ARRAY);
#ifdef DEBUG
debug_init();
@@ -452,7 +452,7 @@ static void init(void)
#endif
i2c_init();
-
+
power_init();
enable_irq();
@@ -471,13 +471,13 @@ static void init(void)
global_status.font_id[i] = FONT_SYSFIXED;
font_init();
#endif
-
+
settings_reset();
CHART(">show_logo");
show_logo();
CHART("<show_logo");
- lang_init(core_language_builtin, language_strings,
+ lang_init(core_language_builtin, language_strings,
LANG_LAST_INDEX_IN_ARRAY);
#ifdef DEBUG
@@ -676,7 +676,7 @@ static void init(void)
}
CHART(">settings_apply(true)");
- settings_apply(true);
+ settings_apply(true);
CHART("<settings_apply(true)");
CHART(">init_dircache(false)");
init_dircache(false);
diff --git a/apps/menus/playback_menu.c b/apps/menus/playback_menu.c
index 89472d45b9..dbfb44f15d 100644
--- a/apps/menus/playback_menu.c
+++ b/apps/menus/playback_menu.c
@@ -62,7 +62,7 @@ static int setcrossfadeonexit_callback(int action,const struct menu_item_ex *thi
/***********************************/
/* PLAYBACK MENU */
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(repeat_mode, &global_settings.repeat_mode, playback_callback);
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;
}
-#else
+#else
# define buffermargin_callback NULL
#endif
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;
switch (action)
{
- case ACTION_EXIT_MENUITEM: /* on exit */
+ case ACTION_EXIT_MENUITEM: /* on exit */
replaygain_update();
break;
}
@@ -137,7 +137,7 @@ MENUITEM_SETTING(replaygain_preamp,
replaygain_callback);
MAKE_MENU(replaygain_settings_menu,ID2P(LANG_REPLAYGAIN),0, Icon_NOICON,
&replaygain_type, &replaygain_noclip, &replaygain_preamp);
-
+
MENUITEM_SETTING(beep, &global_settings.beep ,NULL);
#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 */
if (!scrobbler_is_enabled() && global_settings.audioscrobbler)
scrobbler_init();
-
+
if(scrobbler_is_enabled() && !global_settings.audioscrobbler)
scrobbler_shutdown();
break;
@@ -205,13 +205,13 @@ MAKE_MENU(playback_settings,ID2P(LANG_PLAYBACK),0,
Icon_Playback_menu,
&shuffle_item, &repeat_mode, &play_selected,
&ff_rewind_settings_menu,
-#ifdef HAVE_DISK_STORAGE
+#ifdef HAVE_DISK_STORAGE
&buffer_margin,
#endif
&fade_on_stop, &party_mode,
-
+
#if (CONFIG_CODEC == SWCODEC) && defined(HAVE_CROSSFADE)
- &crossfade_settings_menu,
+ &crossfade_settings_menu,
#endif
#if CONFIG_CODEC == SWCODEC
@@ -235,7 +235,7 @@ MAKE_MENU(playback_settings,ID2P(LANG_PLAYBACK),0,
,&play_frequency
#endif
);
-
+
static int playback_callback(int action,const struct menu_item_ex *this_item)
{
static bool old_shuffle = false;
diff --git a/apps/misc.c b/apps/misc.c
index d7d4bdd2f9..91244f2c39 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -1,10 +1,10 @@
/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
* $Id$
*
* 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 (charger_inserted())
+ if (charger_inserted())
{
charging_splash();
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;
const char * const sign = &"-"[t < 0 ? 0 : 1];
- if ( hours == 0 )
+ if ( hours == 0 )
{
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)screen;
-
+
#ifdef HAVE_LCD_COLOR
if (screens[screen].depth > 2)
{
@@ -1214,7 +1214,7 @@ int clamp_value_wrap(int value, int max, int min)
#endif
#endif
#define MAX_ACTIVITY_DEPTH 12
-static enum current_activity
+static enum current_activity
current_activity[MAX_ACTIVITY_DEPTH] = {ACTIVITY_UNKNOWN};
static int current_activity_top = 0;
void push_current_activity(enum current_activity screen)
diff --git a/apps/mpeg.c b/apps/mpeg.c
index 0ecf68fc53..5c206c79f1 100644
--- a/apps/mpeg.c
+++ b/apps/mpeg.c
@@ -382,7 +382,7 @@ static void set_elapsed(struct mp3entry* id3)
break;
}
}
-
+
i--;
if (i < 0)
i = 0;
@@ -395,7 +395,7 @@ static void set_elapsed(struct mp3entry* id3)
}
else
{
- nextpos = 256;
+ nextpos = 256;
}
remainder = id3->offset - (relpos * (id3->filesize / 256));
@@ -425,7 +425,7 @@ int audio_get_file_pos(void)
{
int pos = -1;
struct mp3entry *id3 = audio_current_track();
-
+
if (id3->vbr)
{
if (id3->has_toc)
@@ -433,20 +433,20 @@ int audio_get_file_pos(void)
/* Use the TOC to find the new position */
unsigned int percent, remainder;
int curtoc, nexttoc, plen;
-
+
percent = (id3->elapsed*100)/id3->length;
if (percent > 99)
percent = 99;
-
+
curtoc = id3->toc[percent];
-
+
if (percent < 99)
nexttoc = id3->toc[percent+1];
else
nexttoc = 256;
-
+
pos = (id3->filesize/256)*curtoc;
-
+
/* Use the remainder to get a more accurate position */
remainder = (id3->elapsed*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 */
pos = id3->first_frame_offset;
}
- return pos;
+ return pos;
}
unsigned long mpeg_get_last_header(void)
@@ -637,9 +637,9 @@ static void recalculate_watermark(int bitrate)
and set a high threshold */
if(bitrate == 0)
bitrate = 320;
-
+
bytes_per_sec = bitrate * 1000 / 8;
-
+
if(time)
{
/* 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)
{
/* We are using timer 2 */
-
+
TSTR &= ~0x04; /* Stop the timer */
TSNC &= ~0x04; /* No synchronization */
TMDR &= ~0x44; /* Operate normally */
@@ -813,7 +813,7 @@ void rec_tick(void)
}
data = *(unsigned char *)0x04000000; /* read data byte */
-
+
xor_b(0x08, &PADRH); /* Set PR inactive */
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;
if(audiobuf_read >= audiobuflen)
audiobuf_read = 0;
-
+
/* First, check if we are on a track boundary */
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();
-
+
space_until_end_of_buffer = audiobuflen - audiobuf_read;
-
+
if(!filling && unplayed_space_left < low_watermark)
{
filling = true;
queue_post(&mpeg_queue, MPEG_NEED_DATA, GENERATE_UNBUFFER_EVENTS);
}
-
+
if(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 */
if(unplayed_space_left < lowest_watermark_level)
lowest_watermark_level = unplayed_space_left;
-
+
DEBUGF("DMA underrun.\n");
dma_underrun = true;
}
@@ -975,7 +975,7 @@ static struct trackdata *add_track_to_tag_list(const char *filename)
{
struct trackdata *track;
bool send_nid3_event;
-
+
if(num_tracks_in_memory() >= MAX_TRACK_ENTRIES)
{
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];
-
+
/* grab id3 tag of new file and
remember where in memory it starts */
if(mp3info(&track->id3, filename))
@@ -1032,14 +1032,14 @@ static int new_file(int steps)
start += track->load_ahead_index;
}
}
-
+
do {
trackname = playlist_peek(start + steps, name_buf, sizeof(name_buf));
if ( !trackname )
return -1;
-
+
DEBUGF("Loading %s\n", trackname);
-
+
mpeg_file = open(trackname, O_RDONLY);
if(mpeg_file < 0) {
DEBUGF("Couldn't open file: %s\n",trackname);
@@ -1065,7 +1065,7 @@ static int new_file(int steps)
else
{
/* skip past id3v2 tag */
- lseek(mpeg_file,
+ lseek(mpeg_file,
track->id3.first_frame_offset,
SEEK_SET);
track->id3.index = steps;
@@ -1079,7 +1079,7 @@ static int new_file(int steps)
else
recalculate_watermark(
track->id3.bitrate);
-
+
}
}
@@ -1212,7 +1212,7 @@ static void start_playback_if_ready(void)
playable_space = audiobuf_swapwrite - audiobuf_read;
if(playable_space < 0)
playable_space += audiobuflen;
-
+
/* See if we have started playing yet. If not, do it. */
if(play_pending || dma_underrun)
{
@@ -1273,7 +1273,7 @@ static bool swap_one_chunk(void)
else
amount_to_swap = MIN(MPEG_SWAP_CHUNKSIZE, free_space_left);
}
-
+
if(audiobuf_write < audiobuf_swapwrite)
amount_to_swap = MIN(audiobuflen - audiobuf_swapwrite,
amount_to_swap);
@@ -1342,7 +1342,7 @@ static void mpeg_thread(void)
}
start_playback_if_ready();
-
+
switch(ev.id)
{
case MPEG_PLAY:
@@ -1376,8 +1376,8 @@ static void mpeg_thread(void)
}
else {
/* skip past id3v2 tag */
- lseek(mpeg_file,
- get_trackdata(0)->id3.first_frame_offset,
+ lseek(mpeg_file,
+ get_trackdata(0)->id3.first_frame_offset,
SEEK_SET);
}
@@ -1421,7 +1421,7 @@ static void mpeg_thread(void)
if ( current_track_counter == pause_track )
last_dma_tick += current_tick - pause_tick;
else
- last_dma_tick = current_tick;
+ last_dma_tick = current_tick;
pause_tick = 0;
mp3_play_pause(true);
}
@@ -1481,7 +1481,7 @@ static void mpeg_thread(void)
/* Make it read more data */
filling = true;
queue_post(&mpeg_queue, MPEG_NEED_DATA, 0);
-
+
/* Tell the file loading code that we want
to start playing as soon as we have some data */
play_pending = true;
@@ -1498,7 +1498,7 @@ static void mpeg_thread(void)
if (!playlist_check(-1))
break;
-
+
/* stop the current stream */
end_current_track();
@@ -1540,7 +1540,7 @@ static void mpeg_thread(void)
id3->elapsed = oldtime;
break;
}
-
+
if (mpeg_file >= 0)
curpos = lseek(mpeg_file, 0, SEEK_CUR);
else
@@ -1581,7 +1581,7 @@ static void mpeg_thread(void)
hasn't yet advanced up to the new location of the read
pointer. We just move it, there is no need to swap
data that won't be played anyway. */
-
+
if (unswapped_space_left > unplayed_space_left)
{
DEBUGF("Moved swapwrite\n");
@@ -1599,9 +1599,9 @@ static void mpeg_thread(void)
else
{
/* resume will start at new position */
- last_dma_chunk_size =
+ last_dma_chunk_size =
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);
dma_underrun = false;
}
@@ -1696,7 +1696,7 @@ static void mpeg_thread(void)
/* Make sure that we don't fill the entire buffer */
free_space_left -= MPEG_HIGH_WATER;
-
+
if (ev.data == GENERATE_UNBUFFER_EVENTS)
generate_unbuffer_events();
@@ -1748,12 +1748,12 @@ static void mpeg_thread(void)
static const unsigned char tag[] = "TAG";
int taglen = 128;
int tagptr = audiobuf_write + len - 128;
-
+
/* Really rare case: entire potential tag wasn't
read in this call AND audiobuf_write < 128 */
if (tagptr < 0)
tagptr += audiobuflen;
-
+
for(i = 0;i < 3;i++)
{
if(tagptr >= audiobuflen)
@@ -1801,10 +1801,10 @@ static void mpeg_thread(void)
{
DEBUGF("MPEG read error\n");
}
-
+
close(mpeg_file);
mpeg_file = -1;
-
+
if(new_file(1) < 0)
{
/* No more data to play */
@@ -1819,7 +1819,7 @@ static void mpeg_thread(void)
}
}
break;
-
+
case MPEG_TRACK_CHANGE:
track_change();
break;
@@ -1838,7 +1838,7 @@ static void mpeg_thread(void)
usb_wait_for_disconnect(&mpeg_queue);
break;
#endif /* !USB_NONE */
-
+
#if CONFIG_CODEC == MAS3587F
case MPEG_INIT_RECORDING:
init_recording();
@@ -1876,7 +1876,7 @@ static void mpeg_thread(void)
mpeg_audiobuf+startpos, startpos);
saved_header = mpeg_get_last_header();
-
+
mem_find_next_frame(startpos, &offset, 1800,
saved_header, mpeg_audiobuf,
audiobuflen);
@@ -1912,10 +1912,10 @@ static void mpeg_thread(void)
/* delayed until buffer is saved, don't open yet */
strcpy(delayed_filename, recording_filename);
- mpeg_file = -1;
+ mpeg_file = -1;
break;
-
+
case MPEG_STOP:
DEBUGF("MPEG_STOP\n");
@@ -1974,7 +1974,7 @@ static void mpeg_thread(void)
mas_readmem(MAS_BANK_D0, MAS_D0_MPEG_FRAME_COUNT,
&frame_count_end, 1);
-
+
last_rec_time = current_tick - record_start_time;
record_start_time = current_tick;
if (paused)
@@ -2014,7 +2014,7 @@ static void mpeg_thread(void)
queue_post(&mpeg_queue, MPEG_SAVE_DATA, 0);
break;
- case MPEG_SAVE_DATA:
+ case MPEG_SAVE_DATA:
if (saving_status == BUFFER_FULL)
save_endpos = audiobuf_write;
@@ -2098,7 +2098,7 @@ static void mpeg_thread(void)
queue_post(&mpeg_queue, MPEG_SAVE_DATA, 0);
break;
-
+
case MPEG_PRERECORDING_TICK:
if(!is_prerecording)
break;
@@ -2118,21 +2118,21 @@ static void mpeg_thread(void)
break;
case MPEG_INIT_PLAYBACK:
- /* Stop the prerecording */
+ /* Stop the prerecording */
stop_recording();
reset_mp3_buffer();
mp3_play_init();
init_playback_done = true;
break;
-
+
case MPEG_PAUSE_RECORDING:
pause_recording();
break;
-
+
case MPEG_RESUME_RECORDING:
resume_recording();
break;
-
+
case SYS_USB_CONNECTED:
/* We can safely go to USB mode if no recording
is taking place */
@@ -2142,11 +2142,11 @@ static void mpeg_thread(void)
function, to put the MAS in monitoring mode,
to save power. */
stop_recording();
-
+
/* Tell the USB thread that we are safe */
DEBUGF("mpeg_thread got SYS_USB_CONNECTED\n");
usb_acknowledge(SYS_USB_CONNECTED_ACK);
-
+
/* Wait until the USB cable is extracted again */
usb_wait_for_disconnect(&mpeg_queue);
}
@@ -2166,7 +2166,7 @@ struct mp3entry* audio_current_track(void)
if(num_tracks_in_memory())
{
struct mp3entry *id3 = &get_trackdata(0)->id3;
-#endif
+#endif
if (!checked_for_cuesheet && curr_cuesheet && id3->cuesheet == NULL)
{
checked_for_cuesheet = true; /* only check once per track */
@@ -2239,9 +2239,9 @@ static void init_recording(void)
is_prerecording = false;
mpeg_stop_done = true;
-
+
mas_reset();
-
+
/* Enable the audio CODEC and the DSP core, max analog voltage range */
rc = mas_direct_config_write(MAS_CONTROL, 0x8c00);
if(rc < 0)
@@ -2257,7 +2257,7 @@ static void init_recording(void)
/* Perform black magic as described by the data sheet */
if((mas_version_code & 0x0fff) == 0x0102)
- {
+ {
DEBUGF("Performing MAS black magic for B2 version\n");
mas_writereg(0xa3, 0x98);
mas_writereg(0x94, 0xfffff);
@@ -2272,7 +2272,7 @@ static void init_recording(void)
/* Copy left channel to right (mono mode) */
mas_codec_writereg(8, 0x8000);
-
+
/* ADC scale 0%, DSP scale 100%
We use the DSP output for monitoring, because it works with all
sources including S/PDIF */
@@ -2282,7 +2282,7 @@ static void init_recording(void)
/* No mute */
shadow_soft_mute = 0;
mas_writemem(MAS_BANK_D0, MAS_D0_SOFT_MUTE, &shadow_soft_mute, 1);
-
+
#ifdef HAVE_SPDIF_OUT
val = 0x09; /* Disable SDO and SDI, low impedance S/PDIF outputs */
#else
@@ -2308,7 +2308,7 @@ static void init_recording(void)
DMA transfer has taken place.
Now let's wait for some data to be encoded. */
sleep(HZ/5);
-
+
/* Now set it to Monitoring mode as default, saves power */
shadow_io_control_main = 0x525;
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)
{
mpeg_errno = 0;
-
+
strlcpy(recording_filename, filename, MAX_PATH);
queue_post(&mpeg_queue, MPEG_RECORD, 0);
@@ -2412,13 +2412,13 @@ static void start_prerecording(void)
unsigned long val;
DEBUGF("Starting prerecording\n");
-
+
prerecord_index = 0;
prerecord_count = 0;
prerecord_timeout = current_tick + HZ;
memset(prerecord_buffer, 0, sizeof(prerecord_buffer));
reset_mp3_buffer();
-
+
is_prerecording = true;
/* 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);
} while(val & 1);
-
+
is_recording = true;
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);
} while(val & 1);
}
-
+
is_recording = true;
saving_status = NOT_SAVING;
paused = false;
@@ -2493,7 +2493,7 @@ static void pause_recording(void)
static void resume_recording(void)
{
paused = false;
-
+
/* Clear the pause bit */
shadow_soft_mute &= ~2;
mas_writemem(MAS_BANK_D0, MAS_D0_SOFT_MUTE, &shadow_soft_mute, 1);
@@ -2515,7 +2515,7 @@ static void stop_recording(void)
if(!paused)
pause_recording();
sleep(HZ/5);
-
+
demand_irq_enable(false);
is_recording = false;
@@ -2529,7 +2529,7 @@ static void stop_recording(void)
shadow_io_control_main |= (1 << 10);
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);
-
+
/* Wait until the DSP has accepted the settings */
do
{
@@ -2565,7 +2565,7 @@ void audio_set_recording_options(struct audio_recording_options *options)
mas_store_pllfreq(24576000);
else
mas_store_pllfreq(22579000);
-#endif
+#endif
shadow_soft_mute = options->rec_editable?4:0;
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)
return prerecord_count * HZ;
-
+
if(is_recording)
{
if(paused)
@@ -2663,7 +2663,7 @@ unsigned long audio_num_recorded_bytes(void)
{
int num_bytes;
int index;
-
+
if(is_recording)
{
if(is_prerecording)
@@ -2671,11 +2671,11 @@ unsigned long audio_num_recorded_bytes(void)
index = prerecord_index - prerecord_count;
if(index < 0)
index += prerecording_max_seconds;
-
+
num_bytes = audiobuf_write - prerecord_buffer[index].mempos;
if(num_bytes < 0)
num_bytes += audiobuflen;
-
+
return num_bytes;
}
else
@@ -2796,7 +2796,7 @@ void audio_play(long offset)
int steps=0;
is_playing = true;
-
+
do {
trackname = playlist_peek(steps, name_buf, sizeof(name_buf));
if (!trackname)
@@ -2849,7 +2849,7 @@ void audio_stop(void)
/* dummy */
void audio_stop_recording(void)
{
- audio_stop();
+ audio_stop();
}
void audio_hard_stop(void)
@@ -2966,7 +2966,7 @@ int audio_status(void)
if(paused)
ret |= AUDIO_STATUS_PAUSE;
-
+
#if (CONFIG_CODEC == MAS3587F) && !defined(SIMULATOR)
if(is_recording && !is_prerecording)
ret |= AUDIO_STATUS_RECORD;
@@ -2977,7 +2977,7 @@ int audio_status(void)
if(mpeg_errno)
ret |= AUDIO_STATUS_ERROR;
-
+
return ret;
}
diff --git a/apps/playback.h b/apps/playback.h
index 865e9a313b..0a9d22cde2 100644
--- a/apps/playback.h
+++ b/apps/playback.h
@@ -58,7 +58,7 @@ int playback_claim_aa_slot(struct dim *dim);
/*
* Releases the albumart slot with given id
- *
+ *
* Save to call from other threads */
void playback_release_aa_slot(int slot);
diff --git a/apps/scrobbler.c b/apps/scrobbler.c
index 1a0ad9390e..be60cc15af 100644
--- a/apps/scrobbler.c
+++ b/apps/scrobbler.c
@@ -140,7 +140,7 @@ static void write_cache(void)
fd = open(scrobbler_file, O_WRONLY | O_APPEND);
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 */
char temp_buf[SCROBBLER_CACHE_LEN];
for ( i=0; i < cache_pos; i++ )
diff --git a/apps/tagtree.c b/apps/tagtree.c
index 5766d2892e..6b0c6aa3dd 100644
--- a/apps/tagtree.c
+++ b/apps/tagtree.c
@@ -19,7 +19,7 @@
*
****************************************************************************/
-/**
+/**
* Basic structure on this file was copied from dbtree.c and modified to
* support the tag cache interface.
*/
@@ -117,13 +117,13 @@ static bool sort_inverse;
/*
* "%3d. %s" autoscore title %sort = "inverse" %limit = "100"
- *
+ *
* valid = true
* formatstr = "%-3d. %s"
* tags[0] = tag_autoscore
* tags[1] = tag_title
* tag_count = 2
- *
+ *
* limit = 100
* sort_inverse = true
*/
@@ -135,7 +135,7 @@ struct display_format {
int group_id;
int tags[MAX_TAGS];
int tag_count;
-
+
int limit;
int strip;
bool sort_inverse;
@@ -288,17 +288,17 @@ static int get_token_str(char *buf, int size)
if (*strp == '\0' || *(++strp) == '\0')
return -1;
-
+
/* Read the data. */
while (*strp != '"' && *strp != '\0' && --size > 0)
*(buf++) = *(strp++);
-
+
*buf = '\0';
if (*strp != '"')
return -2;
-
+
strp++;
-
+
return 0;
}
@@ -345,11 +345,11 @@ static int get_tag(int *tag)
};
char buf[128];
unsigned int i;
-
+
/* Find the start. */
while ((*strp == ' ' || *strp == '>') && *strp != '\0')
strp++;
-
+
if (*strp == '\0' || *strp == '?')
return 0;
@@ -433,16 +433,16 @@ static bool read_clause(struct tagcache_search_clause *clause)
{
char buf[SEARCHSTR_SIZE];
unsigned int i;
-
+
if (get_tag(&clause->tag) <= 0)
return false;
-
+
if (get_clause(&clause->type) <= 0)
return false;
-
+
if (get_token_str(buf, sizeof buf) < 0)
return false;
-
+
for (i=0; i<ARRAYLEN(id3_to_search_mapping); i++)
{
if (!strcasecmp(buf, id3_to_search_mapping[i].string))
@@ -453,13 +453,13 @@ static bool read_clause(struct tagcache_search_clause *clause)
{
clause->source = source_runtime+i;
clause->str = tagtree_alloc(SEARCHSTR_SIZE);
- }
- else
+ }
+ else
{
clause->source = source_constant;
clause->str = tagtree_strdup(buf);
- }
-
+ }
+
if (TAGCACHE_IS_NUMERIC(clause->tag))
{
clause->numeric = true;
@@ -468,24 +468,24 @@ static bool read_clause(struct tagcache_search_clause *clause)
else
clause->numeric = false;
- logf("got clause: %d/%d [%s]", clause->tag, clause->type, clause->str);
-
+ logf("got clause: %d/%d [%s]", clause->tag, clause->type, clause->str);
+
return true;
}
static bool read_variable(char *buf, int size)
{
int condition;
-
+
if (!get_clause(&condition))
return false;
-
+
if (condition != clause_is)
return false;
-
+
if (get_token_str(buf, size) < 0)
return false;
-
+
return true;
}
@@ -495,12 +495,12 @@ static int get_format_str(struct display_format *fmt)
int ret;
char buf[128];
int i;
-
+
memset(fmt, 0, sizeof(struct display_format));
-
+
if (get_token_str(fmt->name, sizeof fmt->name) < 0)
return -10;
-
+
/* Determine the group id */
fmt->group_id = 0;
for (i = 0; i < format_count; i++)
@@ -510,30 +510,30 @@ static int get_format_str(struct display_format *fmt)
fmt->group_id = formats[i]->group_id;
break;
}
-
+
if (formats[i]->group_id > fmt->group_id)
fmt->group_id = formats[i]->group_id;
}
-
+
if (i == format_count)
fmt->group_id++;
-
+
logf("format: (%d) %s", fmt->group_id, fmt->name);
-
+
if (get_token_str(buf, sizeof buf) < 0)
return -10;
-
+
fmt->formatstr = tagtree_strdup(buf);
-
+
while (fmt->tag_count < MAX_TAGS)
{
ret = get_tag(&fmt->tags[fmt->tag_count]);
if (ret < 0)
return -11;
-
+
if (ret == 0)
break;
-
+
switch (fmt->tags[fmt->tag_count]) {
case var_sorttype:
if (!read_variable(buf, sizeof buf))
@@ -541,24 +541,24 @@ static int get_format_str(struct display_format *fmt)
if (!strcasecmp("inverse", buf))
fmt->sort_inverse = true;
break;
-
+
case var_limit:
if (!read_variable(buf, sizeof buf))
return -13;
fmt->limit = atoi(buf);
break;
-
+
case var_strip:
if (!read_variable(buf, sizeof buf))
return -14;
fmt->strip = atoi(buf);
break;
-
+
default:
fmt->tag_count++;
}
}
-
+
return 1;
}
@@ -571,17 +571,17 @@ static int add_format(const char *buf)
}
strp = buf;
-
+
if (formats[format_count] == NULL)
formats[format_count] = tagtree_alloc0(sizeof(struct display_format));
-
+
if (get_format_str(formats[format_count]) < 0)
{
logf("get_format_str() parser failed!");
memset(formats[format_count], 0, sizeof(struct display_format));
return -4;
}
-
+
while (*strp != '\0' && *strp != '?')
strp++;
@@ -594,28 +594,28 @@ static int add_format(const char *buf)
while (1)
{
struct tagcache_search_clause *newclause;
-
+
if (clause_count >= TAGCACHE_MAX_CLAUSES)
{
logf("too many clauses");
break;
}
-
+
newclause = tagtree_alloc(sizeof(struct tagcache_search_clause));
-
+
formats[format_count]->clause[clause_count] = newclause;
if (!read_clause(newclause))
break;
-
+
clause_count++;
}
tagtree_unlock();
-
+
formats[format_count]->clause_count = clause_count;
}
-
+
format_count++;
-
+
return 1;
}
@@ -624,28 +624,28 @@ static int get_condition(struct search_instruction *inst)
struct tagcache_search_clause *new_clause;
int clause_count;
char buf[128];
-
+
switch (*strp)
{
case '=':
{
int i;
-
+
if (get_token_str(buf, sizeof buf) < 0)
return -1;
-
+
for (i = 0; i < format_count; i++)
{
if (!strcasecmp(formats[i]->name, buf))
break;
}
-
+
if (i == format_count)
{
logf("format not found: %s", buf);
return -2;
}
-
+
inst->format_id[inst->tagorder_count] = formats[i]->group_id;
return 1;
}
@@ -665,10 +665,10 @@ static int get_condition(struct search_instruction *inst)
logf("Too many clauses");
return false;
}
-
+
new_clause = tagtree_alloc(sizeof(struct tagcache_search_clause));
inst->clause[inst->tagorder_count][clause_count] = new_clause;
-
+
if (*strp == '|')
{
strp++;
@@ -683,7 +683,7 @@ static int get_condition(struct search_instruction *inst)
return -1;
}
inst->clause_count[inst->tagorder_count]++;
-
+
return 1;
}
@@ -702,25 +702,25 @@ static bool parse_search(struct menu_entry *entry, const char *str)
struct search_instruction *inst = &entry->si;
char buf[MAX_PATH];
int i;
-
+
strp = str;
-
+
/* Parse entry name */
if (get_token_str(entry->name, sizeof entry->name) < 0)
{
logf("No name found.");
return false;
}
-
+
/* Parse entry type */
if (get_tag(&entry->type) <= 0)
return false;
-
+
if (entry->type == menu_load)
{
if (get_token_str(buf, sizeof buf) < 0)
return false;
-
+
/* Find the matching root menu or "create" it */
for (i = 0; i < menu_count; i++)
{
@@ -730,38 +730,38 @@ static bool parse_search(struct menu_entry *entry, const char *str)
return true;
}
}
-
+
if (menu_count >= TAGMENU_MAX_MENUS)
{
logf("max menucount reached");
return false;
}
-
+
/* Allocate a new menu unless link is found. */
menus[menu_count] = tagtree_alloc0(sizeof(struct menu_root));
strlcpy(menus[menu_count]->id, buf, MAX_MENU_ID_SIZE);
entry->link = menu_count;
++menu_count;
-
+
return true;
}
-
+
if (entry->type != menu_next)
return false;
-
+
while (inst->tagorder_count < MAX_TAGS)
{
ret = get_tag(&inst->tagorder[inst->tagorder_count]);
- if (ret < 0)
+ if (ret < 0)
{
logf("Parse error #1");
logf("%s", strp);
return false;
}
-
+
if (ret == 0)
break ;
-
+
logf("tag: %d", inst->tagorder[inst->tagorder_count]);
tagtree_lock();
@@ -772,11 +772,11 @@ static bool parse_search(struct menu_entry *entry, const char *str)
return false;
inst->tagorder_count++;
-
+
if (get_tag(&type) <= 0 || type != menu_next)
break;
}
-
+
return true;
}
@@ -787,7 +787,7 @@ static int compare(const void *p1, const void *p2)
if (sort_inverse)
return strncasecmp(e2->name, e1->name, MAX_PATH);
-
+
return strncasecmp(e1->name, e2->name, MAX_PATH);
}
@@ -795,13 +795,13 @@ static void tagtree_buffer_event(void *data)
{
struct tagcache_search tcs;
struct mp3entry *id3 = (struct mp3entry*)data;
-
+
/* Do not gather data unless proper setting has been enabled. */
if (!global_settings.runtimedb && !global_settings.autoresume_enable)
return;
logf("be:%s", id3->path);
-
+
while (! tagcache_is_fully_initialized())
yield();
@@ -810,7 +810,7 @@ static void tagtree_buffer_event(void *data)
logf("tc stat: not found: %s", id3->path);
return;
}
-
+
if (global_settings.runtimedb)
{
id3->playcount = tagcache_get_numeric(&tcs, tag_playcount);
@@ -819,11 +819,11 @@ static void tagtree_buffer_event(void *data)
id3->lastplayed = tagcache_get_numeric(&tcs, tag_lastplayed);
id3->score = tagcache_get_numeric(&tcs, tag_virt_autoscore) / 10;
id3->playtime = tagcache_get_numeric(&tcs, tag_playtime);
-
+
logf("-> %ld/%ld", id3->playcount, id3->playtime);
}
-
- #if CONFIG_CODEC == SWCODEC
+
+ #if CONFIG_CODEC == SWCODEC
if (global_settings.autoresume_enable)
{
/* Load current file resume offset if not already defined (by
@@ -832,15 +832,15 @@ static void tagtree_buffer_event(void *data)
{
id3->offset = tagcache_get_numeric(&tcs, tag_lastoffset);
- logf("tagtree_buffer_event: Set offset for %s to %lX\n",
+ logf("tagtree_buffer_event: Set offset for %s to %lX\n",
str_or_empty(id3->title), id3->offset);
}
}
#endif
-
+
/* Store our tagcache index pointer. */
id3->tagcache_idx = tcs.idx_id+1;
-
+
tagcache_search_finish(&tcs);
}
@@ -849,14 +849,14 @@ static void tagtree_track_finish_event(void *data)
long lastplayed;
long tagcache_idx;
struct mp3entry *id3 = (struct mp3entry*)data;
-
+
/* Do not gather data unless proper setting has been enabled. */
if (!global_settings.runtimedb && !global_settings.autoresume_enable)
{
logf("runtimedb gathering and autoresume not enabled");
return;
}
-
+
tagcache_idx=id3->tagcache_idx;
if (!tagcache_idx)
{
@@ -864,7 +864,7 @@ static void tagtree_track_finish_event(void *data)
return;
}
tagcache_idx--;
-
+
/* Don't process unplayed tracks, or tracks interrupted within the
first 15 seconds. */
if (id3->elapsed == 0
@@ -876,24 +876,24 @@ static void tagtree_track_finish_event(void *data)
logf("not logging unplayed or skipped track");
return;
}
-
+
lastplayed = tagcache_increase_serial();
if (lastplayed < 0)
{
logf("incorrect tc serial:%ld", lastplayed);
return;
}
-
+
if (global_settings.runtimedb)
{
long playcount;
long playtime;
playcount = id3->playcount + 1;
-
+
/* Ignore the last 15s (crossfade etc.) */
playtime = id3->playtime + MIN(id3->length, id3->elapsed + 15 * 1000);
-
+
logf("ube:%s", id3->path);
logf("-> %ld/%ld", playcount, playtime);
logf("-> %ld/%ld/%ld", id3->elapsed, id3->length,
@@ -905,7 +905,7 @@ static void tagtree_track_finish_event(void *data)
tagcache_update_numeric(tagcache_idx, tag_lastplayed, lastplayed);
}
-#if CONFIG_CODEC == SWCODEC
+#if CONFIG_CODEC == SWCODEC
if (global_settings.autoresume_enable)
{
unsigned long offset
@@ -913,7 +913,7 @@ static void tagtree_track_finish_event(void *data)
tagcache_update_numeric(tagcache_idx, tag_lastoffset, offset);
- logf("tagtree_track_finish_event: Save offset for %s: %lX",
+ logf("tagtree_track_finish_event: Save offset for %s: %lX",
str_or_empty(id3->title), offset);
}
#endif
@@ -922,13 +922,13 @@ static void tagtree_track_finish_event(void *data)
bool tagtree_export(void)
{
struct tagcache_search tcs;
-
+
splash(0, str(LANG_CREATING));
if (!tagcache_create_changelog(&tcs))
{
splash(HZ*2, ID2P(LANG_FAILED));
}
-
+
return false;
}
@@ -939,7 +939,7 @@ bool tagtree_import(void)
{
splash(HZ*2, ID2P(LANG_FAILED));
}
-
+
return false;
}
@@ -952,16 +952,16 @@ static int parse_line(int n, char *buf, void *parameters)
static bool read_menu;
int i;
char *p;
-
+
(void)parameters;
-
+
/* Strip possible <CR> at end of line. */
p = strchr(buf, '\r');
if (p != NULL)
*p = '\0';
-
+
logf("parse:%d/%s", n, buf);
-
+
/* First line, do initialisation. */
if (n == 0)
{
@@ -970,13 +970,13 @@ static int parse_line(int n, char *buf, void *parameters)
logf("Version mismatch");
return -1;
}
-
+
read_menu = false;
}
-
+
if (buf[0] == '#')
return 0;
-
+
if (buf[0] == '\0')
{
if (read_menu)
@@ -986,13 +986,13 @@ static int parse_line(int n, char *buf, void *parameters)
}
return 0;
}
-
+
if (!read_menu)
{
strp = buf;
if (get_tag(&variable) <= 0)
return 0;
-
+
switch (variable)
{
case var_format:
@@ -1001,33 +1001,33 @@ static int parse_line(int n, char *buf, void *parameters)
logf("Format add fail: %s", data);
}
break;
-
+
case var_include:
if (get_token_str(data, sizeof(data)) < 0)
{
logf("%%include empty");
return 0;
}
-
+
if (!parse_menu(data))
{
logf("Load menu fail: %s", data);
}
break;
-
+
case var_menu_start:
if (menu_count >= TAGMENU_MAX_MENUS)
{
logf("max menucount reached");
return 0;
}
-
+
if (get_token_str(data, sizeof data) < 0)
{
logf("%%menu_start id empty");
return 0;
}
-
+
menu = NULL;
for (i = 0; i < menu_count; i++)
{
@@ -1036,15 +1036,15 @@ static int parse_line(int n, char *buf, void *parameters)
menu = menus[i];
}
}
-
- if (menu == NULL)
+
+ if (menu == NULL)
{
menus[menu_count] = tagtree_alloc0(sizeof(struct menu_root));
menu = menus[menu_count];
++menu_count;
strlcpy(menu->id, data, MAX_MENU_ID_SIZE);
}
-
+
if (get_token_str(menu->title, sizeof(menu->title)) < 0)
{
logf("%%menu_start title empty");
@@ -1053,18 +1053,18 @@ static int parse_line(int n, char *buf, void *parameters)
logf("menu: %s", menu->title);
read_menu = true;
break;
-
+
case var_rootmenu:
/* Only set root menu once. */
if (rootmenu >= 0)
break;
-
+
if (get_token_str(data, sizeof(data)) < 0)
{
logf("%%rootmenu empty");
return 0;
}
-
+
for (i = 0; i < menu_count; i++)
{
if (!strcasecmp(menus[i]->id, data))
@@ -1074,16 +1074,16 @@ static int parse_line(int n, char *buf, void *parameters)
}
break;
}
-
+
return 0;
}
-
+
if (menu->itemcount >= TAGMENU_MAX_ITEMS)
{
logf("max itemcount reached");
return 0;
}
-
+
/* Allocate */
if (menu->items[menu->itemcount] == NULL)
menu->items[menu->itemcount] = tagtree_alloc0(sizeof(struct menu_entry));
@@ -1106,18 +1106,18 @@ static bool parse_menu(const char *filename)
logf("max menucount reached");
return false;
}
-
+
fd = open(filename, O_RDONLY);
if (fd < 0)
{
logf("Search instruction file not found.");
return false;
}
-
+
/* Now read file for real, parsing into si */
fast_readline(fd, buf, sizeof buf, NULL, parse_line);
close(fd);
-
+
return true;
}
@@ -1136,7 +1136,7 @@ void tagtree_init(void)
sizeof(struct tagentry), sizeof(struct entry));
if (lock_count > 0)
panicf("tagtree locked after parsing");
-
+
/* If no root menu is set, assume it's the first single menu
* we have. That shouldn't normally happen. */
if (rootmenu < 0)
@@ -1151,14 +1151,14 @@ void tagtree_init(void)
static bool show_search_progress(bool init, int count)
{
static int last_tick = 0;
-
+
/* Don't show splashes for 1/2 second after starting search */
if (init)
{
last_tick = current_tick + HZ/2;
return true;
}
-
+
/* Update progress every 1/10 of a second */
if (TIME_AFTER(current_tick, last_tick + HZ/10))
{
@@ -1168,7 +1168,7 @@ static bool show_search_progress(bool init, int count)
last_tick = current_tick;
yield();
}
-
+
return true;
}
@@ -1181,7 +1181,7 @@ static int format_str(struct tagcache_search *tcs, struct display_format *fmt,
int parpos = 0;
int buf_pos = 0;
int i;
-
+
memset(buf, 0, buf_size);
for (i = 0; fmt->formatstr[i] != '\0'; i++)
{
@@ -1195,7 +1195,7 @@ static int format_str(struct tagcache_search *tcs, struct display_format *fmt,
return -1;
}
}
-
+
char formatchar = fmt->formatstr[i];
if (read_format)
@@ -1260,16 +1260,16 @@ static int format_str(struct tagcache_search *tcs, struct display_format *fmt,
}
else
buf[buf_pos++] = formatchar;
-
+
if (buf_pos >= buf_size - 1) /* need at least one more byte for \0 */
{
logf("buffer overflow");
return -4;
}
}
-
+
buf[buf_pos++] = '\0';
-
+
return 0;
}
@@ -1312,19 +1312,19 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init)
if (!tagcache_search(&tcs, tag))
return -1;
-
+
/* Prevent duplicate entries in the search list. */
tagcache_search_set_uniqbuf(&tcs, uniqbuf, UNIQBUF_SIZE);
-
+
if (level || csi->clause_count[0] || TAGCACHE_IS_NUMERIC(tag))
sort = true;
-
+
for (i = 0; i < level; i++)
{
if (TAGCACHE_IS_NUMERIC(csi->tagorder[i]))
{
static struct tagcache_search_clause cc;
-
+
memset(&cc, 0, sizeof(struct tagcache_search_clause));
cc.tag = csi->tagorder[i];
cc.type = clause_is;
@@ -1334,7 +1334,7 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init)
}
else
{
- tagcache_search_add_filter(&tcs, csi->tagorder[i],
+ tagcache_search_add_filter(&tcs, csi->tagorder[i],
csi->result_seek[i]);
}
}
@@ -1345,15 +1345,15 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init)
for (i = 0; i <= level; i++)
{
int j;
-
+
for (j = 0; j < csi->clause_count[i]; j++)
tagcache_search_add_clause(&tcs, csi->clause[i][j]);
}
-
+
current_offset = offset;
current_entry_count = 0;
c->dirfull = false;
-
+
fmt = NULL;
for (i = 0; i < format_count; i++)
{
@@ -1374,7 +1374,7 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init)
sort_limit = 0;
strip = 0;
}
-
+
/* lock buflib out due to possible yields */
tree_lock_cache(c);
struct tagentry *dptr = core_get_data(c->cache.entries_handle);
@@ -1401,12 +1401,12 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init)
total_count += 2;
}
-
+
while (tagcache_get_next(&tcs))
{
if (total_count++ < offset)
continue;
-
+
dptr->newtable = NAVIBROWSE;
if (tag == tag_title || tag == tag_filename)
{
@@ -1415,7 +1415,7 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init)
}
else
dptr->extraseek = tcs.result_seek;
-
+
fmt = NULL;
/* Check the format */
tagtree_lock();
@@ -1423,7 +1423,7 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init)
{
if (formats[i]->group_id != csi->format_id[level])
continue;
-
+
if (tagcache_check_clauses(&tcs, formats[i]->clause,
formats[i]->clause_count))
{
@@ -1439,11 +1439,11 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init)
tcs.result_len = strlen(tcs.result);
tcs.ramresult = true;
}
-
+
if (!tcs.ramresult || fmt)
{
dptr->name = core_get_data(c->cache.name_buffer_handle)+namebufused;
-
+
if (fmt)
{
int ret = format_str(&tcs, fmt, dptr->name,
@@ -1482,7 +1482,7 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init)
}
else
dptr->name = tcs.result;
-
+
dptr++;
current_entry_count++;
@@ -1493,7 +1493,7 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init)
sort = false;
break ;
}
-
+
if (init && !tcs.ramsearch)
{
if (!show_search_progress(false, total_count))
@@ -1505,7 +1505,7 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init)
}
}
}
-
+
if (sort)
{
struct tagentry *entries = get_entries(c);
@@ -1513,7 +1513,7 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init)
current_entry_count - special_entry_count,
sizeof(struct tagentry), compare);
}
-
+
if (!init)
{
tagcache_search_finish(&tcs);
@@ -1521,7 +1521,7 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init)
tagtree_unlock();
return current_entry_count;
}
-
+
while (tagcache_get_next(&tcs))
{
if (!tcs.ramsearch)
@@ -1531,7 +1531,7 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init)
}
total_count++;
}
-
+
tagcache_search_finish(&tcs);
tree_unlock_cache(c);
tagtree_unlock();
@@ -1542,42 +1542,42 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init)
logf("Too small dir buffer");
return 0;
}
-
+
if (sort_limit)
total_count = MIN(total_count, sort_limit);
-
+
if (strip)
{
dptr = get_entries(c);
for (i = special_entry_count; i < current_entry_count; i++, dptr++)
{
int len = strlen(dptr->name);
-
+
if (len < strip)
continue;
-
+
dptr->name = &dptr->name[strip];
}
}
return total_count;
-
+
}
static int load_root(struct tree_context *c)
{
struct tagentry *dptr = core_get_data(c->cache.entries_handle);
int i;
-
+
tc = c;
c->currtable = ROOT;
if (c->dirlevel == 0)
c->currextra = rootmenu;
-
+
menu = menus[c->currextra];
if (menu == NULL)
return 0;
-
+
for (i = 0; i < menu->itemcount; i++)
{
dptr->name = menu->items[i]->name;
@@ -1587,7 +1587,7 @@ static int load_root(struct tree_context *c)
dptr->newtable = NAVIBROWSE;
dptr->extraseek = i;
break;
-
+
case menu_load:
dptr->newtable = ROOT;
dptr->extraseek = menu->items[i]->link;
@@ -1596,10 +1596,10 @@ static int load_root(struct tree_context *c)
dptr++;
}
-
+
current_offset = 0;
current_entry_count = i;
-
+
return i;
}
@@ -1607,7 +1607,7 @@ int tagtree_load(struct tree_context* c)
{
int count;
int table = c->currtable;
-
+
c->dirsindir = 0;
if (!table)
@@ -1618,7 +1618,7 @@ int tagtree_load(struct tree_context* c)
c->currextra = rootmenu;
}
- switch (table)
+ switch (table)
{
case ROOT:
count = load_root(c);
@@ -1631,12 +1631,12 @@ int tagtree_load(struct tree_context* c)
count = retrieve_entries(c, 0, true);
cpu_boost(false);
break;
-
+
default:
logf("Unsupported table %d\n", table);
return -1;
}
-
+
if (count < 0)
{
c->dirlevel = 0;
@@ -1646,7 +1646,7 @@ int tagtree_load(struct tree_context* c)
/* The _total_ numer of entries available. */
c->dirlength = c->filesindir = count;
-
+
return count;
}
@@ -1660,10 +1660,10 @@ int tagtree_enter(struct tree_context* c)
int source;
dptr = tagtree_get_entry(c, c->selected_item);
-
+
c->dirfull = false;
- seek = dptr->extraseek;
- if (seek == -1)
+ seek = dptr->extraseek;
+ if (seek == -1)
{
if(c->filesindir<=2)
return 0;
@@ -1685,27 +1685,27 @@ int tagtree_enter(struct tree_context* c)
/* lock buflib for possible I/O to protect dptr */
tree_lock_cache(c);
tagtree_lock();
-
+
switch (c->currtable) {
case ROOT:
c->currextra = newextra;
-
+
if (newextra == ROOT)
{
menu = menus[seek];
c->currextra = seek;
}
-
+
else if (newextra == NAVIBROWSE)
{
int i, j;
-
+
csi = &menu->items[seek]->si;
c->currextra = 0;
-
- strlcpy(current_title[c->currextra], dptr->name,
+
+ strlcpy(current_title[c->currextra], dptr->name,
sizeof(current_title[0]));
-
+
/* Read input as necessary. */
for (i = 0; i < csi->tagorder_count; i++)
{
@@ -1717,13 +1717,13 @@ int tagtree_enter(struct tree_context* c)
continue;
source = csi->clause[i][j]->source;
-
+
if (source == source_constant)
continue;
searchstring=csi->clause[i][j]->str;
- *searchstring = '\0';
-
+ *searchstring = '\0';
+
id3 = audio_current_track();
if (source == source_current_path && id3)
@@ -1736,7 +1736,7 @@ int tagtree_enter(struct tree_context* c)
}
else if (source > source_runtime && id3)
{
-
+
int k = source-source_runtime;
int offset = id3_to_search_mapping[k].id3_offset;
char **src = (char**)((char*)id3 + offset);
@@ -1757,9 +1757,9 @@ int tagtree_enter(struct tree_context* c)
}
if (csi->clause[i][j]->numeric)
csi->clause[i][j]->numeric_data = atoi(searchstring);
- }
-
-
+ }
+
+
}
}
}
@@ -1791,18 +1791,18 @@ int tagtree_enter(struct tree_context* c)
c->currextra++;
else
c->dirlevel--;
-
+
/* Update the statusbar title */
- strlcpy(current_title[c->currextra], dptr->name,
+ strlcpy(current_title[c->currextra], dptr->name,
sizeof(current_title[0]));
break;
-
+
default:
c->dirlevel--;
break;
}
-
+
c->selected_item=0;
gui_synclist_select_item(&tree_lists, c->selected_item);
tree_unlock_cache(c);
@@ -1827,7 +1827,7 @@ int tagtree_get_filename(struct tree_context* c, char *buf, int buflen)
{
struct tagcache_search tcs;
int extraseek = tagtree_get_entry(c, c->selected_item)->extraseek;
-
+
if (!tagcache_search(&tcs, tag_filename))
return -1;
@@ -1839,7 +1839,7 @@ int tagtree_get_filename(struct tree_context* c, char *buf, int buflen)
}
tagcache_search_finish(&tcs);
-
+
return 0;
}
@@ -1858,7 +1858,7 @@ static bool insert_all_playlist(struct tree_context *c, int position, bool queue
cpu_boost(false);
return false;
}
-
+
if (position == PLAYLIST_REPLACE)
{
if (playlist_remove_all_tracks(NULL) == 0)
@@ -1882,14 +1882,14 @@ static bool insert_all_playlist(struct tree_context *c, int position, bool queue
to = c->filesindir;
direction = 1;
}
-
+
for (i = from; i != to; i += direction)
{
/* Count back to zero */
if (!show_search_progress(false, files_left--))
break;
-
- if (!tagcache_retrieve(&tcs, tagtree_get_entry(c, i)->extraseek,
+
+ if (!tagcache_retrieve(&tcs, tagtree_get_entry(c, i)->extraseek,
tcs.type, buf, sizeof buf))
{
continue;
@@ -1905,7 +1905,7 @@ static bool insert_all_playlist(struct tree_context *c, int position, bool queue
playlist_sync(NULL);
tagcache_search_finish(&tcs);
cpu_boost(false);
-
+
return true;
}
@@ -1923,10 +1923,10 @@ bool tagtree_insert_selection_playlist(int position, bool queue)
#endif
, 0);
-
+
/* We need to set the table to allsubentries. */
newtable = tagtree_get_entry(tc, tc->selected_item)->newtable;
-
+
/* Insert a single track? */
if (newtable == PLAYTRACK)
{
@@ -1936,10 +1936,10 @@ bool tagtree_insert_selection_playlist(int position, bool queue)
return false;
}
playlist_insert_track(NULL, buf, position, queue, true);
-
+
return true;
}
-
+
if (newtable == NAVIBROWSE)
{
tagtree_enter(tc);
@@ -1951,14 +1951,14 @@ bool tagtree_insert_selection_playlist(int position, bool queue)
logf("unsupported table: %d", newtable);
return false;
}
-
+
/* Now the current table should be allsubentries. */
if (newtable != PLAYTRACK)
{
tagtree_enter(tc);
tagtree_load(tc);
newtable = tagtree_get_entry(tc, tc->selected_item)->newtable;
-
+
/* And now the newtable should be playtrack. */
if (newtable != PLAYTRACK)
{
@@ -1976,12 +1976,12 @@ bool tagtree_insert_selection_playlist(int position, bool queue)
if (!insert_all_playlist(tc, position, queue))
splash(HZ*2, ID2P(LANG_FAILED));
}
-
+
/* Finally return the dirlevel to its original value. */
while (tc->dirlevel > dirlevel)
tagtree_exit(tc);
tagtree_load(tc);
-
+
return true;
}
@@ -1995,7 +1995,7 @@ static int tagtree_play_folder(struct tree_context* c)
if (!insert_all_playlist(c, PLAYLIST_INSERT_LAST, false))
return -2;
-
+
if (global_settings.playlist_shuffle)
c->selected_item = playlist_shuffle(current_tick, c->selected_item);
if (!global_settings.play_selected)
@@ -2011,7 +2011,7 @@ static struct tagentry* tagtree_get_entry(struct tree_context *c, int id)
{
struct tagentry *entry;
int realid = id - current_offset;
-
+
/* Load the next chunk if necessary. */
if (realid >= current_entry_count || realid < 0)
{
@@ -2048,12 +2048,12 @@ char *tagtree_get_title(struct tree_context* c)
{
case ROOT:
return menu->title;
-
+
case NAVIBROWSE:
case ALLSUBENTRIES:
return current_title[c->currextra];
}
-
+
return "?";
}
@@ -2072,7 +2072,7 @@ int tagtree_get_attr(struct tree_context* c)
case ALLSUBENTRIES:
attr = FILE_ATTR_AUDIO;
break;
-
+
default:
attr = ATTR_DIRECTORY;
break;