Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: Re: Newbie API questions
From: Daniel Stenberg (daniel_at_haxx.se)
Date: 2003-05-02


On Thu, 1 May 2003, ds2list wrote:

> 1) Given a pathname to an mp3 file, what sequence of function calls
> (pseudo-code description is ok) does one need to do in order to
> play the file? From what I can see in the code, it builds a
> playlist for an entire directory when it plays a file, then
> calls mpeg_play() on it. Is this right?

Yes, that's right. There's basicly only one place in the code where we start
playing a specific song, and that is when you select it on the dir browser.
That function makes a playlist of the full dir first. It makes that to
proceed with the next song when the selected one ends.

> Could I build a playlist for just one file if I wanted to?

Certainly.

> 2) How are directories and files addressed in the API?

For files: open() / close() / read() / write()

For dirs: opendir() / readdir() / closedir()

> Is it by file/directory name string?

Yes.

> I see lots of integers seeming to represent directories in the code.

Those are file descriptors as returned by one of the function calls above, as
in:

  int fd = open("/myfile.txt", O_RDONLY);
  if(fd >= 0) {
    /* we have the file opened, do something */

    close(fd); /* close file again */
  }
  else {
    /* failed to open the file */
  }

-- 
 Daniel Stenberg -- http://rockbox.haxx.se/ -- http://daniel.haxx.se/



Page was last modified "Jan 10 2012" The Rockbox Crew
aaa