Rockbox Development > Starting Development and Compiling
Implementation of clipped MP3 (begin/end) for playback of DAISY Books
daniel.weck:
Hi all !
I am investigating the feasibility of porting / writing a DAISY Digital Talking Book player for Rockbox.
My Toshiba Gigabeat F60 is probably the best candidate for a full text+audio player, but I appreciate that most DAPs would be limited to audio-only books (albeit with the full Daisy navigation features).
The 2 main problematic areas are XML parsing and synchronized audio playback.
I believe that XML parsing is possible, but requires some porting effort to get rid of the dynamic malloc/free memory allocation. I am thinking about the MiniXML library, which has a small SAX event-based implementation (we don't need a full-fledge in-memory DOM document).
My immediate concern is the ability to play a portion ("clip") of an MP3 file, starting at a "begin" time and stopping at an "end" time (time offsets are relative to the beginning of the audio content).
The function "play_audio_data()" (available to plugins) takes a buffer of encoded mp3 data it seems, but I do not see how to convert a time offset to a byte offset.
I would basically want to implement something like that:
play_mp3("/books/part1.mp3", "00:00:30.0", "00:02:45.8");
Thanks for your help !
Kind regards, Dan.
bluebrother:
you might want to check how seeking to a specific position works when using bookmarks -- it's also starting playback at a given position. And passing the offset as int holding the seconds (or 10th of seconds or similar) should be much easier than passing a formatted time string.
daniel.weck:
--- Quote from: bluebrother on September 10, 2007, 02:43:01 PM ---you might want to check how seeking to a specific position works when using bookmarks -- it's also starting playback at a given position.
--- End quote ---
Good idea. I found some code to restart the audio stream for the last paused position, but this was using a byte offset. I am glad to hear that bookmarks use a time-based position.
This should also help me with calculating the byte offset corresponding to the end marker.
--- Quote from: bluebrother on September 10, 2007, 02:43:01 PM ---And passing the offset as int holding the seconds (or 10th of seconds or similar) should be much easier than passing a formatted time string.
--- End quote ---
Of course, I was just showing this example to match what a SMIL[1] player would typically do when reading DAISY content (time values would be pre-parsed on Rockbox).
[1] http://w3.org/AudioVideo
e.g.:
--- Code: ---<audio src="./test.wav" clipBegin="npt:00:00:00.0" clipEnd="npt:00:00:50.0"/>
--- End code ---
Thanks for your help !
Dan
bluebrother:
--- Quote from: daniel.weck on September 10, 2007, 03:06:28 PM ---Good idea. I found some code to restart the audio stream for the last paused position, but this was using a byte offset. I am glad to hear that bookmarks use a time-based position.
--- End quote ---
Well, I'm not sure if the code uses time offsets at all -- but I could imagine. I don't know that part of the code, so take my hints with caution.
--- Quote ---This should also help me with calculating the byte offset corresponding to the end marker.
--- End quote ---
for CBR file this should be trivial at all anyway. I believe cuesheets work similarly by giving time offsets so that might be a good starting point as well.
Btw: your e.g. line isn't displayed properly because of the brackets -- I think that's an issue with the forum software.
daniel.weck:
--- Quote from: bluebrother on September 10, 2007, 03:38:32 PM ---Well, I'm not sure if the code uses time offsets at all -- but I could imagine. I don't know that part of the code, so take my hints with caution.
--- End quote ---
I just had a look, it seems all byte-offset-based, not time-based.
see playback.c --> audio_thread() --> Q_AUDIO_PLAY --> audio_play_start((size_t)ev.data);
--- Quote from: bluebrother on September 10, 2007, 03:38:32 PM ---for CBR file this should be trivial at all anyway. I believe cuesheets work similarly by giving time offsets so that might be a good starting point as well.
--- End quote ---
I'll now have a look at cuesheets. thx.
Navigation
[0] Message Index
[#] Next page
Go to full version