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

Michael Niedermayer michaelni
Sun Aug 5 13:34:46 CEST 2007


Hi

On Sun, Aug 05, 2007 at 01:09:01PM +0200, Reimar D?ffinger wrote:
> 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).

the decoder should do what the spec says ...
if you have no spec then the behavior of a binary decoder can be used as
hint to what is intended ...

besides this i agree that croping to a unintenteded display size does not
belong in the decoder neiter does scaling if the video is scaled, ...


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

neither, you need to know these details and place the subs according to
how they are supposed to be placed
if you really lack all this details then how does a binary player display
it properly?


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

While the State exists there can be no freedom; when there is freedom there
will be no State. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070805/1b7049d0/attachment.pgp>



More information about the ffmpeg-devel mailing list