|
Rockbox mail archiveSubject: RE: Playing a FileRE: Playing a File
From: Hardeep Sidhu <hardeeps_at_pobox.com>
Date: Wed, 8 Jan 2003 22:29:58 -0800 Hi Benjamin, If you want to play a track in a directory, you first need to call apps/tree.c:build_playlist(). Secondly, your assumptions about play_list() are not quite correct. If you want to play a track in a directory, the arguments would be: int play_list(char *dir, // Absolute pathname of directory (NOT the mp3 file) char *file, // NULL int start_index, // Index, in directory, of the track you want to play bool shuffled_index, // FALSE (only needed for shuffle play) int start_offset, // file offset int random_seed, // 0 (only needed for shuffle play) int first_index, // 0 (index to first track in playlist) int queue_resume, // FALSE (only needed for queue mode) int queue_resume_index ) // 0 (only needed for queue mode) Take a look at apps/tree.c:start_resume() to see how play_list() is used for both directories and playlist files. -Hardeep > -----Original Message----- > From: owner-rockbox_at_cool.haxx.se [mailto:owner-rockbox_at_cool.haxx.se]On > Behalf Of Benjamin > Sent: Wednesday, January 08, 2003 9:24 PM > To: rockbox_at_cool.haxx.se > Subject: RE: Playing a File > > > You'd think so :-). Actually that's what I first tried, but when I try > to use it, nothing actually plays (again, I don't have debug output). > Perhaps I'm a little confused by it, but I made the following > assumptions/questions: > > int play_list(char *dir, // Is this the MP3? > char *file, // This would be NULL if using an MP3 > int start_index, // This out be 0 to play a single file > or the first file in the play list > bool shuffled_index, // By default I would use FALSE > int start_offset, // file offset > int random_seed, // Not sure what this is for > int first_index ) // Not sure what this is for or how it > differs from start_index > > > Ben > -----Original Message----- > From: owner-rockbox_at_cool.haxx.se [mailto:owner-rockbox_at_cool.haxx.se] On > Behalf Of Hardeep Sidhu > Sent: Wednesday, January 08, 2003 5:41 PM > To: rockbox_at_cool.haxx.se > Subject: Re: Playing a File > > > Hi Benjamin, > > The play_list() function in apps/playlist.c should be sufficient for > you. You can see how it's used by the resume code in > apps/tree.c:start_resume(). > > -Hardeep > > --- Benjamin <mailinglists_at_samuraipanda.com> wrote: > > Hi all, > > I'm developing a bookmark capability for Rockbox. I > > can write the > > bookmark file without any issue, but when I go to > > load it, I'm not > > quiet sure how to get RockBox to play it. > > > > I've looked over the code, but I can't seem to find > > a function that > > would accept a file name (mp3 or m3u), an index in > > that file (to > > handle playlists), and the offset into the MP3 file. > > I've written > > a function that leverages the resume capability of > > RockBox to do > > this, but I'm not having much success. Below is > > that code. > > > > void Play_File(char* filename, int playlist_index, > > int file_offset) > > { > > int temp_resume = global_settings.resume; > > > > global_settings.resume = RESUME_ON; //Keeps the > > user from being > > prompted. > > strncpy(global_settings.resume_file,filename, > > MAX_PATH); > > global_settings.resume_index = playlist_index; > > global_settings.resume_offset = file_offset; > > > > start_resume(); > > global_settings.resume = temp_resume; > > //restores original resume > > setting. > > } > > > > filename will be a full path to a MP3 or M3U file > > (i.e. \spoken\speech. > > mp3) > > playlist_index will be the index of the file to play > > in a M3U. > > file_offset will be the file offset in the MP3 at > > which to start. > > > > The basic idea is to leverage the existing resume > > capability to handle > > the bookmark playback. > > > > I don't have the ability to debug (I can't get the > > pesky win32 uisimulator > > to compile. Can anyone supply me with one), so any > > help is appreciated. > > I put the full bookmark source at: > > http://www.samuraipanda.com/bookmark. > > zip, which is based off of rockbox-daily-20030106. > > > > Ben > > > > > > > > > > > > > > > > > > > > > Received on 2003-01-09 Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy |