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

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

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

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

  
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;
712 718
                    for (i = 0; i < sp->sub.num_rects; i++)
713 719
                        blend_subrect(&pict, &sp->sub.rects[i],
714
                                      vp->bmp->w, vp->bmp->h);
720
                                      vp->bmp->w, vp->bmp->h,
721
                                      scalex, scaley);
715 722

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

Also available in: Unified diff