• Status New
  • Percent Complete
  • Task Type Patches
  • Category Video
  • Assigned To No-one
  • Operating System All players
  • Severity Low
  • Priority Very Low
  • Reported Version Daily build (which?)
  • Due in Version Undecided
  • Due Date Undecided
  • Votes 2
  • Private
Attached to Project: Rockbox
Opened by dionoea - 2007-06-02
Last edited by dionoea - 2007-10-14

FS#7252 - SubRip (srt) subtitle support in MPEG Player. (Edit: +overlay timebar)

This patch adds SubRip subtitle support to MPEG Player.

Files need to have the same name as the video file with a “.srt” extension.

I know that the OSD rendering is not implement in a way that linuxstb and jhMikeS would like but I still wanted to post the patch here in case anyone felt like adapting it. (Current OSD only renders on top of the video area, it can be adapted to add other OSD channels … like display a seek bar, volume control, playback state, etc.)


Edit: I’ve also added a timebar display (when changing the volume)

Anonymous Submitter commented on 2007-06-02 20:30

I miss fast forward and rewind more than every other feature like sub titles…but it sounds nice.

I just posted a request for this!!
then I discovered the Patches section and found this!
I´ll try it as soon as I discover how to install it

Is this available in any precompiled build? Does it work with recent versions of the code?

Has to be synced, i think.

Updated patch to make it apply with latest SVN (r14918).

Can it be applied together with the new mpegplayer ?
It fails for me (applying the 7487 before this patch).

I can't tell if it will … depends if those two patches change the same lines of code or not. (+ due to recent mpegplayer changes, the patch might need a re-sync. I'll probably update it this week end)

ok, I'll keep looking at your updates and try again !

Updated to work with revision 15105.

Added a time bar display (enabled for 3 seconds when any volume related button is pressed … I didn't want to add another button).

Fix date function used. (Fixes subs when starting the video after seeking)

I tried to apply it, it seems to successfuly patch but doesn't compile.
I patch from the /path_to_source/apps/plugins/mpegplayer directory and when compiling I get this error :

subtitles.c: In function `uint8_buffer_putsxyofs':
subtitles.c:320: error: too few arguments to function
subtitles.c:328: error: too few arguments to function
make[3]: * [/home/user/rockbox15TEC/testBuid/apps/plugins/mpegplayer/subtitles.o] Error 1
* [mpegplayer] Error 2
make[1]: * [rocks] Error 2
* [build] Error 2

Was that applied on a clean svn checkout? (Are you using something like the multifont patch? I've seen reports on the unsupported builds forum that my patch doesn't work with it and your error seems to be on font related functions)

I'm trying on a clean SVN right now

OK, this time it compiles, but the simulator "segmentation-faults" when I launch a video, maybe it is usual on the simulator.
I'll try to combine it with other patches, excluding the multifont.

It worked fine on the iPod Video simulator yesterday (well … I had segfaults some of the time when changing the start point, not sure if they're subs related though)

Edit: you could try runing the sim in gdb to see where it segfaults (and post a backtrace here … or fix it yourself :) )

What device are you using for your tests ?
I just tried on my Gigabeat F40 for real and it displayed the 1st sentence of my .srt file. Then at the time of displaying the 2nd, the device froze totally.
I can give you the mini-clip and srt file, I did the srt myself just for testing, it's some crap text :

I don't knwo if this has an importance but the file was made with a unix carriage return software.

The subs file looks valid. I'll give it a try when I get back home (the only issue might be a segfault when the last sub line is read … since I never really tested it all the way to the end of the movie).

This patch add lots of error checking in the subs parsing function (which fixes all the segfaults I was able to come up with while editing the subtitles file).
It also restricts overlay rendering to normal video playback (== it's disabled for video thumbnails when setting the start time)

I guess that the next step(s) would be to:
* Make it possible to configure a delay (in case subs and video/audio aren't exactly synced)
* Make it possible to choose the subtitle's position on the video (ie: at the bottom of the screen instead of at the top …)
* …

Edit: Updated patch to make sure that the last line was always displayed. (Nice test video btw :) )

About the multifont patch, if you're applying it with this patch you'll need to add a 3rd argument of rb→get_lcdgetcurfont() (or maybe just 0) to the two functions which trigger a compile error (font_get_bits and font_get_width).

Benoit, have you been able to test the patch again? (and get it to work correctly)

Synced to current SVN.

Currently when seeking in a file, you will see all subtitles up to that point in the video quickly flash by. This should be very simple to fix.

Oops. Now based on the patch from 15th Oct, with timebar removed. Works correctly when seeking as well.

Just tried it. Works pretty well, although I would prefer the text on the bottom of the screen and lines longer than the screen width are broken off. Maybe I should work on it :)


Available keyboard shortcuts


Task Details

Task Editing