[PATCH] Rendering SSA/ASS subtitles via libass - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32) +--- Forum: Kodi Application (https://forum.kodi.tv/forumdisplay.php?fid=93) +--- Thread: [PATCH] Rendering SSA/ASS subtitles via libass (/showthread.php?tid=32634) |
[PATCH] Rendering SSA/ASS subtitles via libass - Rudd - 2008-04-15 I've decided to try my hand at adding libass support to dvdplayer for my gsoc qualification task. I posted the patch here: http://sourceforge.net/tracker/index.php?func=detail&aid=1943420&group_id=87054&atid=581840 Some notes: tested against revision 12670 of linuxport libass requires the fontconfig library The files created are: DVDSubtitleParserSSA.cpp - Handles parsing the .ass/ssa file DVDOverlaySSA .cpp - overlay containing libass structures Files modified are: DVDOverlayRenderer.cpp - added a function to handle rendering SSA overlays DVDFactorySubtitle.cpp - to detect the ass/ssa file Included in the file is a compiled version of libass as well as a test ssa file with some karaoke/positioning effects. I'm not used to working with large MakeFile projects, so please feel free to call me an idiot and tell me what i did wrong - spiff - 2008-04-16 cool as. now, i'm too tired to actually think so let's just do the sillies. http://dureks.dyndns.org:8080/libass.patch.comments tip; open your diff in a decent editor (like vim or emacs or whatever) and set the tabsize to something != 2 - makes them very easy to spot. you need to update the browsable sub extension list in CGUIDialogAudioAndSubtitleSettings.cpp - and possible CUtil::CacheSubtitles (not sure if .ass is in there) will look at the actual code later unless somebody beats me to it - first impression it looks good - elupus - 2008-04-16 sweet: will look at the code later but... do you think you could create an aas decoder in the same fashion as vobsubs...... ah forget it. i need to combine those two things somehow as otherwise we'll have to maintain two paths depending on if the aas subs are internal in mkv or as en external file. * just forget my ramblings * - elupus - 2008-04-16 one note. ditch the now pts in the overlay structure, make that a parameter to the render function instead. - bmfrosty - 2008-04-17 I know I'm a bit off topic here, but please excuse me while I dance. - topfs2 - 2008-04-18 I've tried this patch and it works for me. - Rudd - 2008-04-18 Spiff: Sorry about not getting back to you about the nits/problems earlier, I've had 2 tests in as many days. I'll try and fix the nits and have another patch for you to look over tonight. - elupus - 2008-04-21 Quote:+bool CDVDSubtitleParserSSA::Open(CDVDStreamInfo &hints) ass_track = ass_read_file(ass_library, (char*)m_strFileName.c_str(), 0); Also the current code leaks memory. There is nothing freeing the libass structures is there? One simple solution could be to add a ref counted wrapper around the libass pointers, which destroys it when done (christ I want the new shared_ptr of new c++ standards). should probably also have a criticalsection which is locked when used. - elupus - 2008-04-21 Quote:+CDVDSubtitleParserSSA::CDVDSubtitleParserSSA(CDVDSubtitleStream* pStream, const string& strFile) How can strPath be anything but empty at the call of exists? - elupus - 2008-04-21 The whole parsefile function seems useless (and with it the entire inputstream)? Doesn't the libass structure contain all the timing info you need? - Rudd - 2008-04-21 As for the first point: thanks that didn't occur to me, haha. The second point: I am actually not completey sure. there are some calls to ass_library_done and ass_track_done that i've since added that I forgot in the patch, but I do not know if it correctly frees all of its pointers. Regardng the exists call: D'oh! i'll fix that. The parsefile function: You are actually correct, the ass_track contains all necessary timing info, however I wasn't sure how to make it play nicely with how subtitles are currently done. The reason I still parse the file is to make Overlay objects with current times so. Is there another way you might reccomend? Thanks for the comments! |