forked from len0rd/rockbox
skin: don't calculate id3->elapsed+state->ff_rewind_count each time. remove trailing spaces.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25045 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
f79b45d8bb
commit
1fbdd91333
9 changed files with 77 additions and 95 deletions
|
@ -93,7 +93,7 @@ char* skin_backdrop_load(char* backdrop, char *bmpdir, enum screen_type screen)
|
||||||
{
|
{
|
||||||
return backdrops[i].buffer;
|
return backdrops[i].buffer;
|
||||||
}
|
}
|
||||||
else if (backdrops[i].buffer == NULL)
|
else if (!bdrop && backdrops[i].buffer == NULL)
|
||||||
{
|
{
|
||||||
bdrop = &backdrops[i];
|
bdrop = &backdrops[i];
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,6 @@ char* skin_backdrop_load(char* backdrop, char *bmpdir, enum screen_type screen)
|
||||||
loaded = screens[screen].backdrop_load(filename, bdrop->buffer);
|
loaded = screens[screen].backdrop_load(filename, bdrop->buffer);
|
||||||
bdrop->screen = screen;
|
bdrop->screen = screen;
|
||||||
strlcpy(bdrop->name, backdrop, MAX_FILENAME+1);
|
strlcpy(bdrop->name, backdrop, MAX_FILENAME+1);
|
||||||
bdrop->name[MAX_FILENAME] = '\0';
|
|
||||||
|
|
||||||
return loaded ? bdrop->buffer : NULL;
|
return loaded ? bdrop->buffer : NULL;
|
||||||
}
|
}
|
||||||
|
@ -117,4 +116,3 @@ void skin_backdrop_init(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -116,13 +116,13 @@ void skin_statusbar_changed(struct gui_wps *skin)
|
||||||
|
|
||||||
static void draw_progressbar(struct gui_wps *gwps,
|
static void draw_progressbar(struct gui_wps *gwps,
|
||||||
struct skin_viewport *wps_vp)
|
struct skin_viewport *wps_vp)
|
||||||
{
|
{
|
||||||
struct screen *display = gwps->display;
|
struct screen *display = gwps->display;
|
||||||
struct wps_state *state = gwps->state;
|
struct wps_state *state = gwps->state;
|
||||||
struct progressbar *pb = wps_vp->pb;
|
struct progressbar *pb = wps_vp->pb;
|
||||||
struct mp3entry *id3 = state->id3;
|
struct mp3entry *id3 = state->id3;
|
||||||
int y = pb->y;
|
int y = pb->y, height = pb->height;
|
||||||
int height = pb->height;
|
unsigned long length, elapsed;
|
||||||
|
|
||||||
if (pb->height < 0 && !pb->have_bitmap_pb)
|
if (pb->height < 0 && !pb->have_bitmap_pb)
|
||||||
height = font_get(wps_vp->vp.font)->height;
|
height = font_get(wps_vp->vp.font)->height;
|
||||||
|
@ -136,39 +136,39 @@ static void draw_progressbar(struct gui_wps *gwps,
|
||||||
y = (-y -1)*line_height + (0 > center ? 0 : center);
|
y = (-y -1)*line_height + (0 > center ? 0 : center);
|
||||||
}
|
}
|
||||||
|
|
||||||
int elapsed, length;
|
if (id3 && id3->length)
|
||||||
if (id3)
|
|
||||||
{
|
{
|
||||||
elapsed = id3->elapsed;
|
|
||||||
length = id3->length;
|
length = id3->length;
|
||||||
|
elapsed = id3->elapsed + state->ff_rewind_count;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
length = 1;
|
||||||
elapsed = 0;
|
elapsed = 0;
|
||||||
length = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pb->have_bitmap_pb)
|
if (pb->have_bitmap_pb)
|
||||||
gui_bitmap_scrollbar_draw(display, pb->bm,
|
gui_bitmap_scrollbar_draw(display, pb->bm,
|
||||||
pb->x, y, pb->width, pb->bm.height,
|
pb->x, y, pb->width, pb->bm.height,
|
||||||
length ? length : 1, 0,
|
length, 0, elapsed, HORIZONTAL);
|
||||||
length ? elapsed + state->ff_rewind_count : 0,
|
|
||||||
HORIZONTAL);
|
|
||||||
else
|
else
|
||||||
gui_scrollbar_draw(display, pb->x, y, pb->width, height,
|
gui_scrollbar_draw(display, pb->x, y, pb->width, height,
|
||||||
length ? length : 1, 0,
|
length, 0, elapsed, HORIZONTAL);
|
||||||
length ? elapsed + state->ff_rewind_count : 0,
|
|
||||||
HORIZONTAL);
|
if (id3 && id3->length)
|
||||||
|
{
|
||||||
#ifdef AB_REPEAT_ENABLE
|
#ifdef AB_REPEAT_ENABLE
|
||||||
if ( ab_repeat_mode_enabled() && length != 0 )
|
if (ab_repeat_mode_enabled())
|
||||||
ab_draw_markers(display, length,
|
ab_draw_markers(display, id3->length,
|
||||||
pb->x, pb->x + pb->width, y, height);
|
pb->x, pb->x + pb->width, y, height);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (id3 && id3->cuesheet)
|
if (id3->cuesheet)
|
||||||
cue_draw_markers(display, state->id3->cuesheet, length,
|
cue_draw_markers(display, id3->cuesheet, id3->length,
|
||||||
pb->x, pb->x + pb->width, y+1, height-2);
|
pb->x, pb->x + pb->width, y+1, height-2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool audio_peek_track(struct mp3entry* id3, int offset);
|
bool audio_peek_track(struct mp3entry* id3, int offset);
|
||||||
static void draw_playlist_viewer_list(struct gui_wps *gwps,
|
static void draw_playlist_viewer_list(struct gui_wps *gwps,
|
||||||
struct playlistviewer *viewer)
|
struct playlistviewer *viewer)
|
||||||
|
@ -185,11 +185,10 @@ static void draw_playlist_viewer_list(struct gui_wps *gwps,
|
||||||
struct mp3entry *pid3;
|
struct mp3entry *pid3;
|
||||||
#if CONFIG_CODEC == SWCODEC
|
#if CONFIG_CODEC == SWCODEC
|
||||||
struct mp3entry id3;
|
struct mp3entry id3;
|
||||||
#endif
|
#endif
|
||||||
char buf[MAX_PATH*2], tempbuf[MAX_PATH];
|
char buf[MAX_PATH*2], tempbuf[MAX_PATH];
|
||||||
unsigned int buf_used = 0;
|
unsigned int buf_used = 0;
|
||||||
|
|
||||||
|
|
||||||
gwps->display->set_viewport(viewer->vp);
|
gwps->display->set_viewport(viewer->vp);
|
||||||
for(i=start_item; (i-start_item)<lines && i<playlist_amount(); i++)
|
for(i=start_item; (i-start_item)<lines && i<playlist_amount(); i++)
|
||||||
{
|
{
|
||||||
|
@ -211,8 +210,8 @@ static void draw_playlist_viewer_list(struct gui_wps *gwps,
|
||||||
{
|
{
|
||||||
pid3 = NULL;
|
pid3 = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int line = pid3 ? TRACK_HAS_INFO : TRACK_HAS_NO_INFO;
|
int line = pid3 ? TRACK_HAS_INFO : TRACK_HAS_NO_INFO;
|
||||||
int j = 0, cur_string = 0;
|
int j = 0, cur_string = 0;
|
||||||
char *filename = playlist_peek(i-cur_playlist_pos);
|
char *filename = playlist_peek(i-cur_playlist_pos);
|
||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
|
@ -267,7 +266,7 @@ static void draw_playlist_viewer_list(struct gui_wps *gwps,
|
||||||
}
|
}
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
|
|
||||||
int vpwidth = viewer->vp->width;
|
int vpwidth = viewer->vp->width;
|
||||||
length = gwps->display->getstringsize(buf, NULL, NULL);
|
length = gwps->display->getstringsize(buf, NULL, NULL);
|
||||||
if (viewer->lines[line].scroll && length >= vpwidth)
|
if (viewer->lines[line].scroll && length >= vpwidth)
|
||||||
|
@ -275,7 +274,7 @@ static void draw_playlist_viewer_list(struct gui_wps *gwps,
|
||||||
gwps->display->puts_scroll(0, (i-start_item), buf );
|
gwps->display->puts_scroll(0, (i-start_item), buf );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (length >= vpwidth)
|
if (length >= vpwidth)
|
||||||
x = 0;
|
x = 0;
|
||||||
else
|
else
|
||||||
|
@ -307,7 +306,7 @@ static void draw_playlist_viewer_list(struct gui_wps *gwps,
|
||||||
x = 0;
|
x = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gwps->display->putsxy(x, (i-start_item)*line_height, buf );
|
gwps->display->putsxy(x, (i-start_item)*line_height, buf );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1088,8 +1087,8 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode)
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < 8; i++)
|
for (i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
if (data->wps_progress_pat[i] == 0)
|
if (data->wps_progress_pat[i] == 0)
|
||||||
data->wps_progress_pat[i] = display->get_locked_pattern();
|
data->wps_progress_pat[i] = display->get_locked_pattern();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,7 @@ int skin_font_load(char* font_name)
|
||||||
|
|
||||||
if (font->font_id < 0)
|
if (font->font_id < 0)
|
||||||
return -1;
|
return -1;
|
||||||
font->ref_count = 1;
|
font->ref_count = 1;
|
||||||
|
|
||||||
return font->font_id;
|
return font->font_id;
|
||||||
}
|
}
|
||||||
|
@ -128,13 +128,8 @@ void skin_font_unload(int font_id)
|
||||||
font_unload(font_id);
|
font_unload(font_id);
|
||||||
font_table[i].font_id = -1;
|
font_table[i].font_id = -1;
|
||||||
font_table[i].name[0] = '\0';
|
font_table[i].name[0] = '\0';
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -41,5 +41,4 @@ int skin_font_load(char* font_name);
|
||||||
/* unload a skin font. If a font has been loaded more than once it wont actually
|
/* unload a skin font. If a font has been loaded more than once it wont actually
|
||||||
* be unloaded untill all references have been unloaded */
|
* be unloaded untill all references have been unloaded */
|
||||||
void skin_font_unload(int font_id);
|
void skin_font_unload(int font_id);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -380,7 +380,7 @@ static const struct wps_tag all_tags[] = {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{ WPS_TOKEN_SETTING, "St", WPS_REFRESH_DYNAMIC,
|
{ WPS_TOKEN_SETTING, "St", WPS_REFRESH_DYNAMIC,
|
||||||
parse_setting_and_lang },
|
parse_setting_and_lang },
|
||||||
{ WPS_TOKEN_TRANSLATEDSTRING, "Sx", WPS_REFRESH_STATIC,
|
{ WPS_TOKEN_TRANSLATEDSTRING, "Sx", WPS_REFRESH_STATIC,
|
||||||
parse_setting_and_lang },
|
parse_setting_and_lang },
|
||||||
{ WPS_TOKEN_LANG_IS_RTL , "Sr", WPS_REFRESH_STATIC, NULL },
|
{ WPS_TOKEN_LANG_IS_RTL , "Sr", WPS_REFRESH_STATIC, NULL },
|
||||||
|
@ -388,8 +388,8 @@ static const struct wps_tag all_tags[] = {
|
||||||
{ WPS_TOKEN_LASTTOUCH, "Tl", WPS_REFRESH_DYNAMIC, parse_timeout },
|
{ WPS_TOKEN_LASTTOUCH, "Tl", WPS_REFRESH_DYNAMIC, parse_timeout },
|
||||||
{ WPS_TOKEN_CURRENT_SCREEN, "cs", WPS_REFRESH_DYNAMIC, NULL },
|
{ WPS_TOKEN_CURRENT_SCREEN, "cs", WPS_REFRESH_DYNAMIC, NULL },
|
||||||
{ WPS_NO_TOKEN, "T", 0, parse_touchregion },
|
{ WPS_NO_TOKEN, "T", 0, parse_touchregion },
|
||||||
|
|
||||||
|
|
||||||
/* Recording Tokens */
|
/* Recording Tokens */
|
||||||
{ WPS_TOKEN_HAVE_RECORDING, "Rp", WPS_REFRESH_STATIC, NULL },
|
{ WPS_TOKEN_HAVE_RECORDING, "Rp", WPS_REFRESH_STATIC, NULL },
|
||||||
#ifdef HAVE_RECORDING
|
#ifdef HAVE_RECORDING
|
||||||
|
@ -827,12 +827,12 @@ static int parse_playlistview_text(struct playlistviewer *viewer,
|
||||||
taglen = i;
|
taglen = i;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (tag->parse_func)
|
if (tag->parse_func)
|
||||||
{
|
{
|
||||||
/* unsupported tag, reject */
|
/* unsupported tag, reject */
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
taglen = strlen(tag->name);
|
taglen = strlen(tag->name);
|
||||||
viewer->lines[line].tokens[viewer->lines[line].count++] = tag->type;
|
viewer->lines[line].tokens[viewer->lines[line].count++] = tag->type;
|
||||||
}
|
}
|
||||||
|
@ -857,7 +857,7 @@ static int parse_playlistview_text(struct playlistviewer *viewer,
|
||||||
}
|
}
|
||||||
return text - start;
|
return text - start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int parse_playlistview(const char *wps_bufptr,
|
static int parse_playlistview(const char *wps_bufptr,
|
||||||
struct wps_token *token, struct wps_data *wps_data)
|
struct wps_token *token, struct wps_data *wps_data)
|
||||||
|
@ -874,10 +874,10 @@ static int parse_playlistview(const char *wps_bufptr,
|
||||||
viewer->start_offset = atoi(ptr+1);
|
viewer->start_offset = atoi(ptr+1);
|
||||||
token->value.data = (void*)viewer;
|
token->value.data = (void*)viewer;
|
||||||
ptr = strchr(ptr+1, '|');
|
ptr = strchr(ptr+1, '|');
|
||||||
length = parse_playlistview_text(viewer, TRACK_HAS_INFO, ptr);
|
length = parse_playlistview_text(viewer, TRACK_HAS_INFO, ptr);
|
||||||
if (length < 0)
|
if (length < 0)
|
||||||
return WPS_ERROR_INVALID_PARAM;
|
return WPS_ERROR_INVALID_PARAM;
|
||||||
length = parse_playlistview_text(viewer, TRACK_HAS_NO_INFO, ptr+length);
|
length = parse_playlistview_text(viewer, TRACK_HAS_NO_INFO, ptr+length);
|
||||||
if (length < 0)
|
if (length < 0)
|
||||||
return WPS_ERROR_INVALID_PARAM;
|
return WPS_ERROR_INVALID_PARAM;
|
||||||
|
|
||||||
|
@ -909,8 +909,7 @@ static int parse_viewport(const char *wps_bufptr,
|
||||||
curr_line = NULL;
|
curr_line = NULL;
|
||||||
if (!skin_start_new_line(skin_vp, wps_data->num_tokens))
|
if (!skin_start_new_line(skin_vp, wps_data->num_tokens))
|
||||||
return WPS_ERROR_INVALID_PARAM;
|
return WPS_ERROR_INVALID_PARAM;
|
||||||
|
|
||||||
|
|
||||||
if (*ptr == 'i')
|
if (*ptr == 'i')
|
||||||
{
|
{
|
||||||
skin_vp->label = VP_INFO_LABEL;
|
skin_vp->label = VP_INFO_LABEL;
|
||||||
|
@ -940,7 +939,7 @@ static int parse_viewport(const char *wps_bufptr,
|
||||||
/* format: %V|x|y|width|height|font|fg_pattern|bg_pattern| */
|
/* format: %V|x|y|width|height|font|fg_pattern|bg_pattern| */
|
||||||
if (!(ptr = viewport_parse_viewport(vp, curr_screen, ptr, '|')))
|
if (!(ptr = viewport_parse_viewport(vp, curr_screen, ptr, '|')))
|
||||||
return WPS_ERROR_INVALID_PARAM;
|
return WPS_ERROR_INVALID_PARAM;
|
||||||
|
|
||||||
/* Check for trailing | */
|
/* Check for trailing | */
|
||||||
if (*ptr != '|')
|
if (*ptr != '|')
|
||||||
return WPS_ERROR_INVALID_PARAM;
|
return WPS_ERROR_INVALID_PARAM;
|
||||||
|
@ -975,9 +974,8 @@ static int parse_image_special(const char *wps_bufptr,
|
||||||
|
|
||||||
pos = strchr(wps_bufptr + 1, '|');
|
pos = strchr(wps_bufptr + 1, '|');
|
||||||
newline = strchr(wps_bufptr, '\n');
|
newline = strchr(wps_bufptr, '\n');
|
||||||
|
|
||||||
error = (pos > newline);
|
error = (pos > newline);
|
||||||
|
|
||||||
|
|
||||||
#if LCD_DEPTH > 1
|
#if LCD_DEPTH > 1
|
||||||
if (token->type == WPS_TOKEN_IMAGE_BACKDROP)
|
if (token->type == WPS_TOKEN_IMAGE_BACKDROP)
|
||||||
|
@ -1386,7 +1384,7 @@ static int parse_albumart_load(const char *wps_bufptr,
|
||||||
aa->height = 0;
|
aa->height = 0;
|
||||||
else if (aa->height > LCD_HEIGHT)
|
else if (aa->height > LCD_HEIGHT)
|
||||||
aa->height = LCD_HEIGHT;
|
aa->height = LCD_HEIGHT;
|
||||||
|
|
||||||
if (swap_for_rtl)
|
if (swap_for_rtl)
|
||||||
aa->x = LCD_WIDTH - (aa->x + aa->width);
|
aa->x = LCD_WIDTH - (aa->x + aa->width);
|
||||||
|
|
||||||
|
@ -1689,7 +1687,7 @@ static int check_feature_tag(const char *wps_bufptr, const int type)
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
return find_false_branch(wps_bufptr);
|
return find_false_branch(wps_bufptr);
|
||||||
#endif
|
#endif
|
||||||
default: /* not a tag we care about, just don't skip */
|
default: /* not a tag we care about, just don't skip */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2083,8 +2081,8 @@ static bool load_skin_bitmaps(struct wps_data *wps_data, char *bmpdir)
|
||||||
if (wps_data->backdrop)
|
if (wps_data->backdrop)
|
||||||
{
|
{
|
||||||
bool needed = wps_data->backdrop[0] != '-';
|
bool needed = wps_data->backdrop[0] != '-';
|
||||||
wps_data->backdrop = skin_backdrop_load(wps_data->backdrop,
|
wps_data->backdrop = skin_backdrop_load(wps_data->backdrop,
|
||||||
bmpdir, curr_screen);
|
bmpdir, curr_screen);
|
||||||
if (!wps_data->backdrop && needed)
|
if (!wps_data->backdrop && needed)
|
||||||
retval = false;
|
retval = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -158,6 +158,8 @@ const char *get_id3_token(struct wps_token *token, struct mp3entry *id3,
|
||||||
struct wps_state *state = &wps_state;
|
struct wps_state *state = &wps_state;
|
||||||
if (id3)
|
if (id3)
|
||||||
{
|
{
|
||||||
|
unsigned long length = id3->length;
|
||||||
|
unsigned long elapsed = id3->elapsed + state->ff_rewind_count;
|
||||||
switch (token->type)
|
switch (token->type)
|
||||||
{
|
{
|
||||||
case WPS_TOKEN_METADATA_ARTIST:
|
case WPS_TOKEN_METADATA_ARTIST:
|
||||||
|
@ -216,9 +218,9 @@ const char *get_id3_token(struct wps_token *token, struct mp3entry *id3,
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
case WPS_TOKEN_METADATA_COMMENT:
|
case WPS_TOKEN_METADATA_COMMENT:
|
||||||
return id3->comment;
|
return id3->comment;
|
||||||
case WPS_TOKEN_FILE_PATH:
|
case WPS_TOKEN_FILE_PATH:
|
||||||
return id3->path;
|
return id3->path;
|
||||||
case WPS_TOKEN_FILE_BITRATE:
|
case WPS_TOKEN_FILE_BITRATE:
|
||||||
if(id3->bitrate)
|
if(id3->bitrate)
|
||||||
snprintf(buf, buf_size, "%d", id3->bitrate);
|
snprintf(buf, buf_size, "%d", id3->bitrate);
|
||||||
|
@ -226,31 +228,26 @@ const char *get_id3_token(struct wps_token *token, struct mp3entry *id3,
|
||||||
return "?";
|
return "?";
|
||||||
return buf;
|
return buf;
|
||||||
case WPS_TOKEN_TRACK_TIME_ELAPSED:
|
case WPS_TOKEN_TRACK_TIME_ELAPSED:
|
||||||
format_time(buf, buf_size,
|
format_time(buf, buf_size, elapsed);
|
||||||
id3->elapsed + state->ff_rewind_count);
|
|
||||||
return buf;
|
return buf;
|
||||||
|
|
||||||
case WPS_TOKEN_TRACK_TIME_REMAINING:
|
case WPS_TOKEN_TRACK_TIME_REMAINING:
|
||||||
format_time(buf, buf_size,
|
format_time(buf, buf_size, length - elapsed);
|
||||||
id3->length - id3->elapsed -
|
|
||||||
state->ff_rewind_count);
|
|
||||||
return buf;
|
return buf;
|
||||||
|
|
||||||
case WPS_TOKEN_TRACK_LENGTH:
|
case WPS_TOKEN_TRACK_LENGTH:
|
||||||
format_time(buf, buf_size, id3->length);
|
format_time(buf, buf_size, length);
|
||||||
return buf;
|
return buf;
|
||||||
|
|
||||||
case WPS_TOKEN_TRACK_ELAPSED_PERCENT:
|
case WPS_TOKEN_TRACK_ELAPSED_PERCENT:
|
||||||
if (id3->length <= 0)
|
if (length <= 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (intval)
|
if (intval)
|
||||||
{
|
{
|
||||||
*intval = limit * (id3->elapsed + state->ff_rewind_count)
|
*intval = limit * elapsed / length + 1;
|
||||||
/ id3->length + 1;
|
|
||||||
}
|
}
|
||||||
snprintf(buf, buf_size, "%d",
|
snprintf(buf, buf_size, "%d", 100 * elapsed / length);
|
||||||
100*(id3->elapsed + state->ff_rewind_count) / id3->length);
|
|
||||||
return buf;
|
return buf;
|
||||||
|
|
||||||
|
|
||||||
|
@ -295,7 +292,7 @@ const char *get_id3_token(struct wps_token *token, struct mp3entry *id3,
|
||||||
return (id3->vbr) ? "(avg)" : NULL;
|
return (id3->vbr) ? "(avg)" : NULL;
|
||||||
case WPS_TOKEN_FILE_DIRECTORY:
|
case WPS_TOKEN_FILE_DIRECTORY:
|
||||||
return get_dir(buf, buf_size, id3->path, token->value.i);
|
return get_dir(buf, buf_size, id3->path, token->value.i);
|
||||||
|
|
||||||
#ifdef HAVE_TAGCACHE
|
#ifdef HAVE_TAGCACHE
|
||||||
case WPS_TOKEN_DATABASE_PLAYCOUNT:
|
case WPS_TOKEN_DATABASE_PLAYCOUNT:
|
||||||
if (intval)
|
if (intval)
|
||||||
|
@ -313,7 +310,7 @@ const char *get_id3_token(struct wps_token *token, struct mp3entry *id3,
|
||||||
snprintf(buf, buf_size, "%ld", id3->score);
|
snprintf(buf, buf_size, "%ld", id3->score);
|
||||||
return buf;
|
return buf;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -326,7 +323,7 @@ const char *get_id3_token(struct wps_token *token, struct mp3entry *id3,
|
||||||
* The ones that expect "0" need to be handled */
|
* The ones that expect "0" need to be handled */
|
||||||
case WPS_TOKEN_FILE_FREQUENCY:
|
case WPS_TOKEN_FILE_FREQUENCY:
|
||||||
case WPS_TOKEN_FILE_FREQUENCY_KHZ:
|
case WPS_TOKEN_FILE_FREQUENCY_KHZ:
|
||||||
case WPS_TOKEN_FILE_SIZE:
|
case WPS_TOKEN_FILE_SIZE:
|
||||||
#ifdef HAVE_TAGCACHE
|
#ifdef HAVE_TAGCACHE
|
||||||
case WPS_TOKEN_DATABASE_PLAYCOUNT:
|
case WPS_TOKEN_DATABASE_PLAYCOUNT:
|
||||||
case WPS_TOKEN_DATABASE_RATING:
|
case WPS_TOKEN_DATABASE_RATING:
|
||||||
|
@ -443,7 +440,8 @@ const char *get_token_value(struct gui_wps *gwps,
|
||||||
snprintf(buf, buf_size, "%d", global_settings.volume);
|
snprintf(buf, buf_size, "%d", global_settings.volume);
|
||||||
if (intval)
|
if (intval)
|
||||||
{
|
{
|
||||||
if (global_settings.volume == sound_min(SOUND_VOLUME))
|
int minvol = sound_min(SOUND_VOLUME);
|
||||||
|
if (global_settings.volume == minvol)
|
||||||
{
|
{
|
||||||
*intval = 1;
|
*intval = 1;
|
||||||
}
|
}
|
||||||
|
@ -457,9 +455,8 @@ const char *get_token_value(struct gui_wps *gwps,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*intval = (limit - 3) * (global_settings.volume
|
*intval = (limit-3) * (global_settings.volume - minvol - 1)
|
||||||
- sound_min(SOUND_VOLUME) - 1)
|
/ (-1 - minvol) + 2;
|
||||||
/ (-1 - sound_min(SOUND_VOLUME)) + 2;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return buf;
|
return buf;
|
||||||
|
@ -473,7 +470,7 @@ const char *get_token_value(struct gui_wps *gwps,
|
||||||
|
|
||||||
case WPS_TOKEN_ALBUMART_DISPLAY:
|
case WPS_TOKEN_ALBUMART_DISPLAY:
|
||||||
if (!data->albumart)
|
if (!data->albumart)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (!data->albumart->draw)
|
if (!data->albumart->draw)
|
||||||
data->albumart->draw = true;
|
data->albumart->draw = true;
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -801,7 +798,7 @@ const char *get_token_value(struct gui_wps *gwps,
|
||||||
id3->album_gain_string != NULL);
|
id3->album_gain_string != NULL);
|
||||||
else
|
else
|
||||||
type = -1;
|
type = -1;
|
||||||
|
|
||||||
if (type < 0)
|
if (type < 0)
|
||||||
val = 6; /* no tag */
|
val = 6; /* no tag */
|
||||||
else
|
else
|
||||||
|
@ -923,7 +920,7 @@ const char *get_token_value(struct gui_wps *gwps,
|
||||||
int sound_setting = s->sound_setting->setting;
|
int sound_setting = s->sound_setting->setting;
|
||||||
/* settings with decimals can't be used in conditionals */
|
/* settings with decimals can't be used in conditionals */
|
||||||
if (sound_numdecimals(sound_setting) == 0)
|
if (sound_numdecimals(sound_setting) == 0)
|
||||||
{
|
{
|
||||||
*intval = (*(int*)s->setting-sound_min(sound_setting))
|
*intval = (*(int*)s->setting-sound_min(sound_setting))
|
||||||
/sound_steps(sound_setting) + 1;
|
/sound_steps(sound_setting) + 1;
|
||||||
}
|
}
|
||||||
|
@ -999,7 +996,7 @@ const char *get_token_value(struct gui_wps *gwps,
|
||||||
rec_freq = 0;
|
rec_freq = 0;
|
||||||
while (rec_freq < SAMPR_NUM_FREQ &&
|
while (rec_freq < SAMPR_NUM_FREQ &&
|
||||||
audio_master_sampr_list[rec_freq] != samprk)
|
audio_master_sampr_list[rec_freq] != samprk)
|
||||||
{
|
{
|
||||||
rec_freq++;
|
rec_freq++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1053,7 +1050,7 @@ const char *get_token_value(struct gui_wps *gwps,
|
||||||
#else /* HWCODEC */
|
#else /* HWCODEC */
|
||||||
|
|
||||||
static const char * const freq_strings[] =
|
static const char * const freq_strings[] =
|
||||||
{"--", "44", "48", "32", "22", "24", "16"};
|
{"--", "44", "48", "32", "22", "24", "16"};
|
||||||
int freq = 1 + global_settings.rec_frequency;
|
int freq = 1 + global_settings.rec_frequency;
|
||||||
#ifdef HAVE_SPDIF_REC
|
#ifdef HAVE_SPDIF_REC
|
||||||
if (global_settings.rec_source == AUDIO_SRC_SPDIF)
|
if (global_settings.rec_source == AUDIO_SRC_SPDIF)
|
||||||
|
@ -1069,7 +1066,7 @@ const char *get_token_value(struct gui_wps *gwps,
|
||||||
#endif
|
#endif
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
#if CONFIG_CODEC == SWCODEC
|
#if CONFIG_CODEC == SWCODEC
|
||||||
case WPS_TOKEN_REC_ENCODER:
|
case WPS_TOKEN_REC_ENCODER:
|
||||||
{
|
{
|
||||||
int rec_format = global_settings.rec_format+1; /* WAV, AIFF, WV, MPEG */
|
int rec_format = global_settings.rec_format+1; /* WAV, AIFF, WV, MPEG */
|
||||||
|
@ -1092,7 +1089,7 @@ const char *get_token_value(struct gui_wps *gwps,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
case WPS_TOKEN_REC_BITRATE:
|
case WPS_TOKEN_REC_BITRATE:
|
||||||
#if CONFIG_CODEC == SWCODEC
|
#if CONFIG_CODEC == SWCODEC
|
||||||
if (global_settings.rec_format == REC_FORMAT_MPA_L3)
|
if (global_settings.rec_format == REC_FORMAT_MPA_L3)
|
||||||
{
|
{
|
||||||
if (intval)
|
if (intval)
|
||||||
|
@ -1201,7 +1198,6 @@ const char *get_token_value(struct gui_wps *gwps,
|
||||||
}
|
}
|
||||||
if (intval)
|
if (intval)
|
||||||
{
|
{
|
||||||
|
|
||||||
*intval = curr_screen;
|
*intval = curr_screen;
|
||||||
}
|
}
|
||||||
snprintf(buf, buf_size, "%d", curr_screen);
|
snprintf(buf, buf_size, "%d", curr_screen);
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#define _SKIN_TOKENS_H_
|
#define _SKIN_TOKENS_H_
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
|
||||||
enum wps_token_type {
|
enum wps_token_type {
|
||||||
|
|
||||||
|
@ -235,13 +235,12 @@ struct wps_token {
|
||||||
void* data;
|
void* data;
|
||||||
} value;
|
} value;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct skin_token_list {
|
struct skin_token_list {
|
||||||
struct wps_token *token;
|
struct wps_token *token;
|
||||||
struct skin_token_list *next;
|
struct skin_token_list *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
char* get_dir(char* buf, int buf_size, const char* path, int level);
|
char* get_dir(char* buf, int buf_size, const char* path, int level);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ struct debug_token_table tokens[] = {
|
||||||
{ X(TOKEN_MARKER_DATABASE) },
|
{ X(TOKEN_MARKER_DATABASE) },
|
||||||
{ X(TOKEN_MARKER_FILE) },
|
{ X(TOKEN_MARKER_FILE) },
|
||||||
{ X(TOKEN_MARKER_IMAGES) },
|
{ X(TOKEN_MARKER_IMAGES) },
|
||||||
{ X(TOKEN_MARKER_METADATA) },
|
{ X(TOKEN_MARKER_METADATA) },
|
||||||
{ X(TOKEN_MARKER_PLAYBACK_INFO) },
|
{ X(TOKEN_MARKER_PLAYBACK_INFO) },
|
||||||
{ X(TOKEN_MARKER_PLAYLIST) },
|
{ X(TOKEN_MARKER_PLAYLIST) },
|
||||||
{ X(TOKEN_MARKER_MISC) },
|
{ X(TOKEN_MARKER_MISC) },
|
||||||
|
@ -194,7 +194,7 @@ static char *get_token_desc(struct wps_token *token, char *buf,
|
||||||
case WPS_TOKEN_PLAYBACK_STATUS:
|
case WPS_TOKEN_PLAYBACK_STATUS:
|
||||||
snprintf(buf, bufsize, "mode playback");
|
snprintf(buf, bufsize, "mode playback");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WPS_TOKEN_RTC_PRESENT:
|
case WPS_TOKEN_RTC_PRESENT:
|
||||||
snprintf(buf, bufsize, "rtc: present?");
|
snprintf(buf, bufsize, "rtc: present?");
|
||||||
break;
|
break;
|
||||||
|
@ -500,7 +500,7 @@ static char *get_token_desc(struct wps_token *token, char *buf,
|
||||||
break;
|
break;
|
||||||
case WPS_TOKEN_SETTING:
|
case WPS_TOKEN_SETTING:
|
||||||
snprintf(buf, bufsize, "Setting value: '%s'",
|
snprintf(buf, bufsize, "Setting value: '%s'",
|
||||||
settings[token->value.i].cfg_name);
|
settings[token->value.i].cfg_name);
|
||||||
break;
|
break;
|
||||||
case WPS_TOKEN_LANG_IS_RTL:
|
case WPS_TOKEN_LANG_IS_RTL:
|
||||||
snprintf(buf, bufsize, "lang: is_rtl?");
|
snprintf(buf, bufsize, "lang: is_rtl?");
|
||||||
|
@ -514,7 +514,7 @@ static char *get_token_desc(struct wps_token *token, char *buf,
|
||||||
token->type - tokens[i-1].start_marker);
|
token->type - tokens[i-1].start_marker);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -649,5 +649,4 @@ void debug_skin_usage(void)
|
||||||
(unsigned long)(skin_buffer_usage() + skin_buffer_freespace()));
|
(unsigned long)(skin_buffer_usage() + skin_buffer_freespace()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* DEBUG || SIMULATOR */
|
#endif /* DEBUG || SIMULATOR */
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
#include "skin_tokens.h"
|
#include "skin_tokens.h"
|
||||||
|
|
||||||
|
|
||||||
/* TODO: sort this mess out */
|
/* TODO: sort this mess out */
|
||||||
|
|
||||||
#include "screen_access.h"
|
#include "screen_access.h"
|
||||||
|
@ -245,7 +245,6 @@ struct playlistviewer {
|
||||||
bool scroll;
|
bool scroll;
|
||||||
} lines[2];
|
} lines[2];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_ALBUMART
|
#ifdef HAVE_ALBUMART
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue