]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/commitdiff
Display subtitles within the display area.
authormichael <michael@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Sat, 3 Jan 2009 17:50:00 +0000 (17:50 +0000)
committermichael <michael@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Sat, 3 Jan 2009 17:50:00 +0000 (17:50 +0000)
Fixes dvd-subtitle-problem.vob. (problem likely is that the video
resolution is smaller than what the subtitles expect)

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@16411 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

ffplay.c

index a802cc1483055950aa118cc4fcfb5a6f8e6aba69..69b1fa1d83cb309b15121eb8b3a4f99448250db6 100644 (file)
--- a/ffplay.c
+++ b/ffplay.c
@@ -441,10 +441,10 @@ static void blend_subrect(AVPicture *dst, const AVSubtitleRect *rect, int imgw,
     const uint32_t *pal;
     int dstx, dsty, dstw, dsth;
 
-    dstx = FFMIN(FFMAX(rect->x, 0), imgw);
-    dstw = FFMIN(FFMAX(rect->w, 0), imgw - dstx);
-    dsty = FFMIN(FFMAX(rect->y, 0), imgh);
-    dsth = FFMIN(FFMAX(rect->h, 0), imgh - dsty);
+    dstw = av_clip(rect->w, 0, imgw);
+    dsth = av_clip(rect->h, 0, imgh);
+    dstx = av_clip(rect->x, 0, imgw - dstw);
+    dsty = av_clip(rect->y, 0, imgh - dsth);
     lum = dst->data[0] + dsty * dst->linesize[0];
     cb = dst->data[1] + (dsty >> 1) * dst->linesize[1];
     cr = dst->data[2] + (dsty >> 1) * dst->linesize[2];