[MPlayer-dev-eng] [PATCH] Review please: support sub_pos in libass

Evgeniy Stepanov eugeni.stepanov at gmail.com
Wed Dec 24 15:25:27 CET 2008


On Wednesday 24 December 2008 14:45:59 Rafał Miłecki wrote:
> > You'd better give it a name, like VALIGN_PERCENTPOS, and keep that "else"
> > branch for traditional ASS subtitles (VALIGN_SUB). Less likely to break
> > something this way.
>
> Now I wonder if this is good idea to use this new invalid value. Maybe
> I just should add new variable tracking if Alignment was got from
> subtitles file? Something like:
>
> int Respect_sub_pos;
> style->Respect_sub_pos = 1;
>
> and in case of finding alignment in subtitle:
> {
> style->Alignment = new_alignment_value;
> style->Respect_sub_pos = 0;
> }

It's not invalid, we can call it an mplayer extension of SSA/ASS. What you are 
suggesting is to add one more variable to ass_style_t without real benefits.

> >> One possibility would be to add an alignment type that reads the exact
> >> position from another variable in the struct,
> >
> > Probably percentage of image height, not the exact pixel position.
>
> Sorry, I don't understand that. What do you mean by adding "alignment
> type"? Some new struct? On field in existing struct?

VALIGN_PERCENTPOS constant. And a variable ass_style_t.percent_pos, storing 
the value of sub_pos.

> >> and then allow replacing
> >> the default style with another (would that be any harder than changing
> >> just the alignment?).
> >
> > I think we should have a global set of styles for plaintext tracks.When
> > subs are switched to another plaintext track, new track's styles are
> > replaced with a copy of the global set. Updates from events go to both
> > the global set and the current track's styles.
>
> Hm, if I understand this correctly it's not only related to alignment,
> right? The problem is that styles are not switched to default for
> plaintext subtitle after displaying any styled, right? I mean it's
> about color, outline, etc.

Styles are stored with every track. The problem is, how to make sure that 
every plaintext track has the same set of styles, and that it is updated on 
the fly from keyboard events.

Now I think we can avoid this global set mess. Just keep current user settings 
(like sub_pos) in global variables. It is already done this way. Create a 
function that will update the styles of the current track from these settings, 
and call it when either settings change or the track is switched.




More information about the MPlayer-dev-eng mailing list