[FFmpeg-devel] [PATCH] make sure blending the subtitle does not write outside buffer

Reimar Döffinger Reimar.Doeffinger
Sun Aug 5 13:09:01 CEST 2007


Hello,
On Sun, Aug 05, 2007 at 12:50:28PM +0200, Michael Niedermayer wrote:
> On Sun, Aug 05, 2007 at 12:36:34PM +0200, Reimar D?ffinger wrote:
> > On Sun, Aug 05, 2007 at 12:12:26PM +0200, Michael Niedermayer wrote:
> > > On Sun, Aug 05, 2007 at 11:00:04AM +0200, Reimar D?ffinger wrote:
> > > > attached patch fixes the subtitle rectangles so they do not lie outside
> > > > the video, which can cause crashes.
> > > 
> > > hmm, this seems like a hack to me
> > > shouldnt blend_subrect "skip" the parts of a rectange which are outside
> > > of the image?
> > 
> > well, unfortunately blend_subrect does not currently know the size of
> > the image. But more importantly, what is the point of showing half-cut
> > subtitles? At least I don't have any use for subtitles where I can read
> > e.g. only the upper half.
> 
> A. the x/y/w/h of the subtitle is wrong
> -> fix the code so its not wrong

Well, this patch fixes it in ffplay :-P. The problem is, how should this
be fixed? In the subtitle decoder? Not only don't I think the decoder
should mess with it, it also misses two essential pieces of information:
1) The resolution of the video being played (easy to fix but maybe hackish)
2) The resolution for which the subtitles were created (impossible in
the general case).

> B. the x/y/w/h of the subtitle is correct
> -> you should display the subtitle at that position
> 
> if the video for example is croped then i would argue that the x/y/w/h
> of the subtitle is wrong if its not moved to a more appropriate place
> 
> but if on a non croped video some subtitle lets say moves off the screen
> slowly forcing that to stay on the screen is not correct

I disagree. Maybe the subtitle was created for a device that always has
a large border to the right or the bottom? Is it really a good idea to
not show that part of the subtitle at all, possibly making it entirely
useless or is it better to ignore the position information instead?

Greetings,
Reimar D?ffinger




More information about the ffmpeg-devel mailing list