Rockbox.org home
Downloads
Release release
Dev builds dev builds
Extras extras
themes themes
Documentation
Manual manual
Wiki wiki
Device Status device status
Support
Forums forums
Mailing lists mailing lists
IRC IRC
Development
Bugs bugs
Patches patches
Dev Guide dev guide
Search



Donate

Rockbox Technical Forums


Login with username, password and session length
Home Help Search Staff List Login Register
News:

Rockbox Ports are now being developed for various digital audio players!

+  Rockbox Technical Forums
|-+  Support and General Use
| |-+  Audio Playback, Database and Playlists
| | |-+  more than 10 "recent bookmarks" possible?
« previous next »
  • Print
Pages: [1]

Author Topic: more than 10 "recent bookmarks" possible?  (Read 4988 times)

Offline scott082565

  • Member
  • *
  • Posts: 2
more than 10 "recent bookmarks" possible?
« on: August 25, 2014, 09:41:18 PM »

does anyone know if this is possible? searched the forum, could not find an answer.

i am using rockbox on a Sansa Clip Zip, thanks.
Logged

Online nick_p

  • Member
  • *
  • Posts: 115
Re: more than 10 "recent bookmarks" possible?
« Reply #1 on: August 26, 2014, 01:23:37 AM »
It looks like it's hard-coded;

http://git.rockbox.org/?p=rockbox.git;a=blob;f=apps/bookmark.c;hb=HEAD#l46

Unless I'm wrong, you'd have to change this define and recompile.
Logged

Offline TAC109

  • Member
  • *
  • Posts: 86
Re: more than 10 "recent bookmarks" possible?
« Reply #2 on: August 26, 2014, 04:59:57 PM »
It's an arbitrary, hard coded limit, probably for historic reasons. There is no reason why it can't be set to a larger number in the code, such as 100.
Logged

Offline scott082565

  • Member
  • *
  • Posts: 2
Re: more than 10 "recent bookmarks" possible?
« Reply #3 on: September 02, 2014, 10:55:00 PM »
does hard coded mean i can't change it myself? or can i poke around the install and rockbox files and change?
Logged

Online nick_p

  • Member
  • *
  • Posts: 115
Re: more than 10 "recent bookmarks" possible?
« Reply #4 on: September 03, 2014, 09:55:51 AM »
You can change it yourself, but it's going to mean recompiling Rockbox. Depending on your experience, this might mean quite a lot of effort.

http://www.rockbox.org/wiki/DevelopmentGuide
Logged

Offline __builtin

  • Developer
  • Member
  • *
  • Posts: 385
  • iPod 6G, c200v1 (RIP), e200v1 (RIP)
    • FWEI.TK
Re: more than 10 "recent bookmarks" possible?
« Reply #5 on: September 03, 2014, 05:21:14 PM »
Just change line 46 of http://git.rockbox.org/?p=rockbox.git;a=blob;f=apps/bookmark.c;hb=HEAD#l46 to read
Code: [Select]
#define MAX_BOOKMARKS 100
... or any other number you want, and (re)-compile+install.
Logged
No support questions by PM, please.

Offline [Saint]

  • Rockbox Expert
  • Member
  • *
  • Posts: 1662
  • Hayden Pearce
    • Google+
Re: more than 10 "recent bookmarks" possible?
« Reply #6 on: September 03, 2014, 07:31:04 PM »
If I put on my speculation hat (as I'm not particularly interested in testing the exact limitations here), I would posit that at some point you're going to flood a stack if you increase this number to a ridiculous level.


[Saint]
Logged
Using PMs to annoy devs about bugs/patches is not a good way to have the issue looked at.

Offline fredex

  • Member
  • *
  • Posts: 52
Re: more than 10 "recent bookmarks" possible?
« Reply #7 on: September 23, 2014, 09:43:55 AM »
Saint would know a lot more than I, as I'm not a RB developer, but I AM a C programmer:

static char global_read_buffer[MAX_BOOKMARK_SIZE];
static char global_bookmark[MAX_BOOKMARK_SIZE];

these are the only two items in the file nick_p mentions that allocate space based on MAX_BOOKMARK_SIZE.

these two items don't go on the stack (or at least for a "normal" C compiler they don't, I'll assume the one used in RB follows that convention) since they are file-scoped static variables. they probably end up somewhere in the heap. therefore they shouldn't cause any problems with the stack (except: if the stack grows so large--from other causes-- that it collides with the heap, then you're in a world of hurt, so putting two larger arrays on the heap could make that collision more likely, given the fixed, small amounts of RAM these embedded systems contain.)
Logged

Offline gevaerts

  • Administrator
  • Member
  • *
  • Posts: 1053
Re: more than 10 "recent bookmarks" possible?
« Reply #8 on: September 23, 2014, 10:06:34 AM »
Quote from: fredex on September 23, 2014, 09:43:55 AM
Saint would know a lot more than I, as I'm not a RB developer, but I AM a C programmer:

Saint isn't :)

Quote
static char global_read_buffer[MAX_BOOKMARK_SIZE];
static char global_bookmark[MAX_BOOKMARK_SIZE];

these are the only two items in the file nick_p mentions that allocate space based on MAX_BOOKMARK_SIZE.

these two items don't go on the stack (or at least for a "normal" C compiler they don't, I'll assume the one used in RB follows that convention) since they are file-scoped static variables. they probably end up somewhere in the heap. therefore they shouldn't cause any problems with the stack (except: if the stack grows so large--from other causes-- that it collides with the heap, then you're in a world of hurt, so putting two larger arrays on the heap could make that collision more likely, given the fixed, small amounts of RAM these embedded systems contain.)

There's also MAX_BOOKMARKS, but at first sight the same applies and I'm fairly sure your analysis is correct.

There's no stack/heap collision as such to fear for. Both these arrays and the stacks are allocated statically and have a fixed size. There's a regular check for stack overflow (every tick) using a sentinel value at the bottom of the stack.

Of course, there *is* such a thing as using so much memory there isn't enough left to buffer audio, but you're going to have to go for fairly insane values here to get to that point on most devices.
Logged

Offline TAC109

  • Member
  • *
  • Posts: 86
Re: more than 10 "recent bookmarks" possible?
« Reply #9 on: September 23, 2014, 04:37:47 PM »
The only place MAX_BOOKMARKS is used is when adding a new bookmark to the bookmark file. In this process, the file is copied to a temp file, stopping when MAX_BOOKMARKS number of records have been copied, then the original bookmark file is deleted and the temp file renamed to the original bookmark file name.

There is no impact on stack or memory, only on disk storage space. And frankly, limiting the file to 10 entries of a maximum size of 350 bytes in these days of gigabyte drives is ridiculous.
Logged

Offline saratoga

  • Developer
  • Member
  • *
  • Posts: 8974
Re: more than 10 "recent bookmarks" possible?
« Reply #10 on: September 23, 2014, 04:58:32 PM »
Quote from: TAC109 on September 23, 2014, 04:37:47 PM
There is no impact on stack or memory, only on disk storage space. And frankly, limiting the file to 10 entries of a maximum size of 350 bytes in these days of gigabyte drives is ridiculous.

Hard disk space isn't important.  Its RAM that limits you.  Some SWCODEC targets have only 2MBs, while very popular ones like the Clip+ have just 8 MB. 
Logged

Offline TAC109

  • Member
  • *
  • Posts: 86
Re: more than 10 "recent bookmarks" possible?
« Reply #11 on: September 24, 2014, 12:03:22 AM »
Quote from: saratoga on September 23, 2014, 04:58:32 PM
Quote from: TAC109 on September 23, 2014, 04:37:47 PM
There is no impact on stack or memory, only on disk storage space. And frankly, limiting the file to 10 entries of a maximum size of 350 bytes in these days of gigabyte drives is ridiculous.
Hard disk space isn't important.  Its RAM that limits you.  Some SWCODEC targets have only 2MBs, while very popular ones like the Clip+ have just 8 MB.

No limits in this case. The records are copied one record at a time. As I said, no impact on stack or memory (=RAM). My unsupported build 2.5.1 for the Archos Recorder (2MB RAM) has MAX_BOOKMARKS set to 100 without any adverse effects.
« Last Edit: September 24, 2014, 12:07:36 AM by TAC109 »
Logged

Offline gevaerts

  • Administrator
  • Member
  • *
  • Posts: 1053
Re: more than 10 "recent bookmarks" possible?
« Reply #12 on: September 24, 2014, 03:07:02 AM »
I think that if you're going to increase this, it has to be a setting. I for one don't actually want a long list of recent bookmarks.
Logged

Offline TAC109

  • Member
  • *
  • Posts: 86
Re: more than 10 "recent bookmarks" possible?
« Reply #13 on: September 25, 2014, 11:42:16 PM »
Quote from: gevaerts on September 24, 2014, 03:07:02 AM
I think that if you're going to increase this, it has to be a setting. I for one don't actually want a long list of recent bookmarks.

New (and replaced) bookmarks are placed at the start of the file and will show in the user interface on the first page(s). You could simply ignore any subsequent pages.
Logged

  • Print
Pages: [1]
« previous next »
+  Rockbox Technical Forums
|-+  Support and General Use
| |-+  Audio Playback, Database and Playlists
| | |-+  more than 10 "recent bookmarks" possible?
 

  • SMF 2.0.17 | SMF © 2019, Simple Machines
  • Rockbox Privacy Policy
  • XHTML
  • RSS
  • WAP2

Page created in 0.121 seconds with 15 queries.