[mythtv] SSA/ASS sub support(with patches)

Shawn King shawnking at optusnet.com.au
Sun Nov 21 00:02:13 UTC 2010


On 11/19/2010 10:56 PM, Mark Kendall wrote:
> On 19 November 2010 20:18, Shawn King<shawnking at optusnet.com.au>  wrote:
>    
>> FFMPEG has now gotten ASS/SSA sub decoders is there any plans on adding
>> support?
>>
>> attached is some patches that i have been using for a few days now w/out
>> issues it doesnt support any SSA override codes but most other stuff is in
>> there(myth-03-SubtitleScreenSSASubSupport.patch is very wip atm)
>>
>> the ffmpeg-* patches is the backported ASS/SSA subtitle code with 1
>> bugfix(ASS dialog line wasn't null terminated not sure if FFMPEG guys know
>> about it yet)
>> myth-01-AVFormatFontSupport.patch adds support for loading embedded fonts
>> into mythtv's fontmanager for use in the subs
>> myth-02-AVFormatSubtitleHeaderSupport.patch adds support for getting the
>> subtitle headers
>> and myth-03-SubtitleScreenSSASubSupport.patch adds all the code for
>> displaying the subs and is quite messy(and prob wrong at parts)
>>
>> it isnt good enough to be considered for commiting i know but it is a start
>>      
> To be honest - looks like a pretty good start:)
>
> Clearly there is a decision to be made about backporting the ffmpeg
> changes (and I'd suggest it would be preferable to have them broken
> out into the original ffmpeg versions and separate additional fixes -
> to help tracking) - but I have no idea when the next ffmpeg merge is
> planned.
>
> The decoder stuff looks straightforward enough - though somebody else
> will need to comment on the font code.
>
> As far as the subtitlescreen patch goes :-
>
>   - I'd suggest just rolling SSASubUtils into SubtitleScreen
>   - look at using the the Qt::Alignment flags directly rather than
> adding the new alignment enums
>   - there is some extra code needed to handle the fontstretch property,
> otherwise the fonts may not look correct with XVideo rendering.
>
> regards
>
> Mark
> _______________________________________________
> mythtv-dev mailing list
> mythtv-dev at mythtv.org
> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev
>
>
>    

the FFmpeg patches was just for anyone who wanted to use/test this its 
better to wait for a merge then to backport features the bug fix wasnt a 
big one all it is is this line in avcodec/ass.c:
     rects[sub->num_rects]->ass  = av_malloc(len + dlen + 1);
changed to
     rects[sub->num_rects]->ass  = av_mallocz(len + dlen + 1);
so you don't get gibberish on the end of the subtitles

i have moved the mythfontmanager.h include from the 
libs/libmythtv/avformatdecoder.h header to the sourcefile in the font 
support patch

the 3rd patch now has the following changes
   - changed the alignment code to use the Qt::Alignment flags
   - added the fontstretch code back
   - Changed the SubtitleScreen::InitialiseSSAStyles function to 
hopefully parse out some of the [scriptinfo] section and hopefully 
support the older style version(i have no vids that use the older style 
but if the spec is correct it should work)
   - added some comments about the ASS specs to some of the functions to 
aid in development
   - removed the * from the front of style names im not sure what it 
does but this is how libass handles it and it isnt in the specs
   - changed the outline to use the backcolor instead of the outline 
color libass does this too and it does seem to improve visibility
   - changed the SubtitleScreen::DrawSSASubtitles code to use split to 
seperate the values instead of section i dont know if its faster or not 
im assuming it is SubtitleScreen::InitialiseSSAStyles might get the same 
treatment
   - the margin overrides in the dialogue line should work now too
   - added the alpha channel to the colorcode function(it should 
hopefully be optional since the older sub version doesn't have alpha)

i did have the SSASubutils in the subtitlescreen class in a previous 
patch but i couldnt use the colorcode function in the static 
SubtitleScreen::InitialiseSSAStyles function like that
the next thing that really needs to be done is to scale the pixelsize 
and margins compared to playresY(and maybe playresX i don't know if they 
can be different from the actual video maybe we can use its original 
video size instead) because a 50px font might look ok with 1080P video 
on a 1080P screen but it doesn't look as good when videos been scaled 
down for a 1024x768 screen

other then that its only SSA override codes in the subtext(for drawing 
boxes/changing fonts midtext/bold and italics midtext) i think is 
lacking and thats prob above my ability to do
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: myth-03-SubtitleScreenSSASubSupportV2.patch
URL: <http://mythtv.org/pipermail/mythtv-dev/attachments/20101121/78e86e78/attachment.asc>


More information about the mythtv-dev mailing list