dev builds
themes manual
device status forums
mailing lists
IRC bugs
dev guide

Rockbox mail archive

Subject: Re: Newbie API questions

Re: Newbie API questions

From: Daniel Stenberg <>
Date: Fri, 2 May 2003 08:46:13 +0200 (CEST)

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?


> 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?


> 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

  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 -- --
Received on 2003-05-02

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy