Changeset a83a3579b82d4e219f5f7be58d9036d42f7cbb85
- Timestamp:
- 10/10/07 05:41:17
(1 year ago)
- Author:
- Bernie Purcell <bitmap@videolan.org>
- git-committer:
- Bernie Purcell <bitmap@videolan.org> 1191987677 +0000
- git-parent:
[8418d9e545cfc04cc9f07dad7e18826939bdd249]
- git-author:
- Bernie Purcell <bitmap@videolan.org> 1191987677 +0000
- Message:
Attempt to stop subtitles going off screen in some formats, when
width and height are specified in the subtitles stream. This may
result in chunkier text in some instances, but it should get it
back on screen at least. Will look into smoothing it out next.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rf325f88 |
ra83a357 |
|
| 525 | 525 | int k; |
|---|
| 526 | 526 | |
|---|
| | 527 | /* If the source video and subtitles stream agree on the size of |
|---|
| | 528 | * the video then disregard all further references to the subtitle |
|---|
| | 529 | * stream. |
|---|
| | 530 | */ |
|---|
| | 531 | if( ( i_source_video_height == p_subpic->i_original_picture_height ) && |
|---|
| | 532 | ( i_source_video_width == p_subpic->i_original_picture_width ) ) |
|---|
| | 533 | { |
|---|
| | 534 | p_subpic->i_original_picture_height = 0; |
|---|
| | 535 | p_subpic->i_original_picture_width = 0; |
|---|
| | 536 | } |
|---|
| | 537 | |
|---|
| 527 | 538 | for( k = 0; k < SCALE_SIZE ; k++ ) |
|---|
| 528 | 539 | pi_subpic_x[ k ] = p_subpic->i_x; |
|---|
| … | … | |
| 600 | 611 | ( ( p_text_region->i_align & SUBPICTURE_RENDERED ) == 0 ) ) |
|---|
| 601 | 612 | { |
|---|
| 602 | | p_spu->p_text->fmt_out.video.i_width = |
|---|
| 603 | | p_spu->p_text->fmt_out.video.i_visible_width = |
|---|
| 604 | | p_fmt->i_width; |
|---|
| 605 | | p_spu->p_text->fmt_out.video.i_height = |
|---|
| 606 | | p_spu->p_text->fmt_out.video.i_visible_height = |
|---|
| 607 | | p_fmt->i_height; |
|---|
| | 613 | if( (p_subpic->i_original_picture_height > 0) && |
|---|
| | 614 | (p_subpic->i_original_picture_width > 0) ) |
|---|
| | 615 | { |
|---|
| | 616 | p_spu->p_text->fmt_out.video.i_width = |
|---|
| | 617 | p_spu->p_text->fmt_out.video.i_visible_width = |
|---|
| | 618 | p_subpic->i_original_picture_width; |
|---|
| | 619 | p_spu->p_text->fmt_out.video.i_height = |
|---|
| | 620 | p_spu->p_text->fmt_out.video.i_visible_height = |
|---|
| | 621 | p_subpic->i_original_picture_height; |
|---|
| | 622 | } |
|---|
| | 623 | else |
|---|
| | 624 | { |
|---|
| | 625 | p_spu->p_text->fmt_out.video.i_width = |
|---|
| | 626 | p_spu->p_text->fmt_out.video.i_visible_width = |
|---|
| | 627 | p_fmt->i_width; |
|---|
| | 628 | p_spu->p_text->fmt_out.video.i_height = |
|---|
| | 629 | p_spu->p_text->fmt_out.video.i_visible_height = |
|---|
| | 630 | p_fmt->i_height; |
|---|
| | 631 | } |
|---|
| 608 | 632 | } |
|---|
| 609 | 633 | } |
|---|
| … | … | |
| 619 | 643 | p_spu->p_text->fmt_out.video.i_height; |
|---|
| 620 | 644 | } |
|---|
| | 645 | /* If we have an explicit size plane to render to, then turn off |
|---|
| | 646 | * the fontsize rescaling. |
|---|
| | 647 | */ |
|---|
| | 648 | if( (p_subpic->i_original_picture_height > 0) && |
|---|
| | 649 | (p_subpic->i_original_picture_width > 0) ) |
|---|
| | 650 | { |
|---|
| | 651 | i_scale_width_orig = 1000; |
|---|
| | 652 | i_scale_height_orig = 1000; |
|---|
| | 653 | } |
|---|
| 621 | 654 | |
|---|
| 622 | 655 | for( k = 0; k < SCALE_SIZE ; k++ ) |
|---|
| 623 | 656 | { |
|---|
| | 657 | /* Case of both width and height being specified has been dealt with |
|---|
| | 658 | * above by instead rendering to an output pane of the explicit |
|---|
| | 659 | * dimensions specified - we don't need to scale it. |
|---|
| | 660 | */ |
|---|
| 624 | 661 | if( (p_subpic->i_original_picture_height > 0) && |
|---|
| 625 | | (p_subpic->i_original_picture_width > 0) ) |
|---|
| 626 | | { |
|---|
| 627 | | pi_scale_width[ k ] = pi_scale_width[ k ] * i_source_video_width / |
|---|
| 628 | | p_subpic->i_original_picture_width; |
|---|
| 629 | | pi_scale_height[ k ] = pi_scale_height[ k ] * i_source_video_height / |
|---|
| 630 | | p_subpic->i_original_picture_height; |
|---|
| 631 | | } |
|---|
| 632 | | else if( p_subpic->i_original_picture_height > 0 ) |
|---|
| | 662 | (p_subpic->i_original_picture_width <= 0) ) |
|---|
| 633 | 663 | { |
|---|
| 634 | 664 | pi_scale_height[ k ] = pi_scale_height[ k ] * i_source_video_height / |
|---|
| … | … | |
| 638 | 668 | } |
|---|
| 639 | 669 | } |
|---|
| | 670 | |
|---|
| 640 | 671 | |
|---|
| 641 | 672 | /* Set default subpicture aspect ratio */ |
|---|