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

Rafał Miłecki zajec5 at gmail.com
Wed Dec 24 12:45:59 CET 2008


2008/12/22 Uoti Urpala <uoti.urpala at pp1.inet.fi>:
> On Mon, 2008-12-22 at 21:48 +0100, Rafał Miłecki wrote:
>> Currently it is almost not possible to control position of subtitles
>> when using libass. OK, libass respects position from .ass file but
>
> So this is primarily for rendering plain non-ass subtitle formats with
> libass?

Mostly yes, however I think it would be nice to make possible forcing
libass to ignore Alignment from .ass subtitle and respect sub_pos.


>> This patch does:
>> 1) Change default Alignment to 14 (0x1110) which is /invalid valign/
>> and HALIGN_CENTER.
>> 2) Respects sub_pos in case of invalid value of (Alignment & 0x1100)
>
> At least the position value should be set in the style struct rather
> than read from a global. Especially so because libass is used in other
> projects and should not use MPlayer-specific globals.

Oh, for sure! Yeah, I made this in quite stupid way.


> The preferred interface could depend on how libass is used in other
> projects; I'm not too familiar with those.

Hm, would be nice to receive some comment from someone familiar with
other projects using libass.



2008/12/23 Evgeniy Stepanov <eugeni.stepanov at gmail.com>:
>> On Mon, 2008-12-22 at 21:48 +0100, Rafał Miłecki wrote:
>> > This patch does:
>> > 1) Change default Alignment to 14 (0x1110) which is /invalid valign/
>> > and HALIGN_CENTER.
>
> 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;
}


>> 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?


>> 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.


-- 
Rafał Miłecki


More information about the MPlayer-dev-eng mailing list