Revision 0a8cd696 ffplay.c

View differences:

ffplay.c
422 422

  
423 423
#define BPP 1
424 424

  
425
static void blend_subrect(AVPicture *dst, const AVSubtitleRect *rect, int imgw, int imgh,
426
                          float scalex, float scaley)
425
static void blend_subrect(AVPicture *dst, const AVSubtitleRect *rect, int imgw, int imgh)
427 426
{
428 427
    int wrap, wrap3, width2, skip2;
429 428
    int y, u, v, a, u1, v1, a1, w, h;
......
432 431
    const uint32_t *pal;
433 432
    int dstx, dsty, dstw, dsth;
434 433

  
435
    dstx = FFMIN(scalex * FFMAX(rect->x, 0), imgw);
434
    dstx = FFMIN(FFMAX(rect->x, 0), imgw);
436 435
    dstw = FFMIN(FFMAX(rect->w, 0), imgw - dstx);
437
    dsty = FFMIN(scaley * FFMAX(rect->y, 0), imgh);
436
    dsty = FFMIN(FFMAX(rect->y, 0), imgh);
438 437
    dsth = FFMIN(FFMAX(rect->h, 0), imgh - dsty);
439 438
    lum = dst->data[0] + dsty * dst->linesize[0];
440 439
    cb = dst->data[1] + (dsty >> 1) * dst->linesize[1];
......
700 699

  
701 700
                if (vp->pts >= sp->pts + ((float) sp->sub.start_display_time / 1000))
702 701
                {
703
                    float scalex = 1, scaley = 1;
704 702
                    SDL_LockYUVOverlay (vp->bmp);
705 703

  
706 704
                    pict.data[0] = vp->bmp->pixels[0];
......
711 709
                    pict.linesize[1] = vp->bmp->pitches[2];
712 710
                    pict.linesize[2] = vp->bmp->pitches[1];
713 711

  
714
                    if (is->subtitle_st->codec->width)
715
                        scalex = (float)vp->bmp->w / is->subtitle_st->codec->width;
716
                    if (is->subtitle_st->codec->height)
717
                        scaley = (float)vp->bmp->h / is->subtitle_st->codec->height;
718 712
                    for (i = 0; i < sp->sub.num_rects; i++)
719 713
                        blend_subrect(&pict, &sp->sub.rects[i],
720
                                      vp->bmp->w, vp->bmp->h,
721
                                      scalex, scaley);
714
                                      vp->bmp->w, vp->bmp->h);
722 715

  
723 716
                    SDL_UnlockYUVOverlay (vp->bmp);
724 717
                }

Also available in: Unified diff