Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
48e64493
Commit
48e64493
authored
Feb 12, 2011
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed subpicture rendering when render size != source size.
parent
92d7c046
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
44 deletions
+32
-44
src/video_output/vout_subpictures.c
src/video_output/vout_subpictures.c
+32
-44
No files found.
src/video_output/vout_subpictures.c
View file @
48e64493
...
...
@@ -326,7 +326,7 @@ static spu_scale_t spu_scale_unit( void )
{
return
spu_scale_create
(
SCALE_UNIT
,
SCALE_UNIT
);
}
static
spu_scale_t
spu_scale_createq
(
int
wn
,
int
wd
,
int
hn
,
in
t
hd
)
static
spu_scale_t
spu_scale_createq
(
int
64_t
wn
,
int64_t
wd
,
int64_t
hn
,
int64_
t
hd
)
{
return
spu_scale_create
(
wn
*
SCALE_UNIT
/
wd
,
hn
*
SCALE_UNIT
/
hd
);
...
...
@@ -1075,8 +1075,6 @@ static subpicture_t *SpuRenderSubpictures( spu_t *p_spu,
p_subtitle_area
=
calloc
(
i_subtitle_region_count
,
sizeof
(
*
p_subtitle_area
)
);
/* Process all subpictures and regions (in the right order) */
const
int
i_source_video_width
=
p_fmt_src
->
i_width
;
const
int
i_source_video_height
=
p_fmt_src
->
i_height
;
for
(
unsigned
int
i_index
=
0
;
i_index
<
i_subpicture
;
i_index
++
)
{
subpicture_t
*
p_subpic
=
pp_subpicture
[
i_index
];
...
...
@@ -1085,59 +1083,33 @@ static subpicture_t *SpuRenderSubpictures( spu_t *p_spu,
if
(
!
p_subpic
->
p_region
)
continue
;
/* FIXME when possible use a better rendering size than source size
* (max of display size and source size for example) FIXME */
int
i_render_width
=
p_subpic
->
i_original_picture_width
;
int
i_render_height
=
p_subpic
->
i_original_picture_height
;
if
(
!
i_render_width
||
!
i_render_height
)
if
(
p_subpic
->
i_original_picture_width
<=
0
||
p_subpic
->
i_original_picture_height
<=
0
)
{
if
(
i_render_width
!=
0
||
i_render_height
!=
0
)
msg_Err
(
p_spu
,
"unsupported original picture size %dx%d"
,
i_render_width
,
i_render_height
);
if
(
p_subpic
->
i_original_picture_width
>
0
||
p_subpic
->
i_original_picture_height
>
0
)
msg_Err
(
p_spu
,
"original picture size %dx%d is unsupported"
,
p_subpic
->
i_original_picture_width
,
p_subpic
->
i_original_picture_height
);
else
msg_Warn
(
p_spu
,
"original picture size is undefined"
);
p_subpic
->
i_original_picture_width
=
i_render_width
=
i_source_video
_width
;
p_subpic
->
i_original_picture_height
=
i_render_height
=
i_source_video
_height
;
p_subpic
->
i_original_picture_width
=
p_fmt_src
->
i
_width
;
p_subpic
->
i_original_picture_height
=
p_fmt_src
->
i
_height
;
}
if
(
p_sys
->
p_text
)
{
/* FIXME aspect ratio ? */
p_sys
->
p_text
->
fmt_out
.
video
.
i_width
=
p_sys
->
p_text
->
fmt_out
.
video
.
i_visible_width
=
i_render
_width
;
p_sys
->
p_text
->
fmt_out
.
video
.
i_visible_width
=
p_subpic
->
i_original_picture
_width
;
p_sys
->
p_text
->
fmt_out
.
video
.
i_height
=
p_sys
->
p_text
->
fmt_out
.
video
.
i_visible_height
=
i_render
_height
;
p_sys
->
p_text
->
fmt_out
.
video
.
i_visible_height
=
p_subpic
->
i_original_picture
_height
;
var_SetInteger
(
p_sys
->
p_text
,
"scale"
,
SCALE_UNIT
);
}
/* Compute scaling from picture to source size */
spu_scale_t
scale
=
spu_scale_createq
(
i_source_video_width
,
i_render_width
,
i_source_video_height
,
i_render_height
);
/* Update scaling from source size to display size(p_fmt_dst) */
scale
.
w
=
scale
.
w
*
p_fmt_dst
->
i_width
/
i_source_video_width
;
scale
.
h
=
scale
.
h
*
p_fmt_dst
->
i_height
/
i_source_video_height
;
/* Set default subpicture aspect ratio
* FIXME if we only handle 1 aspect ratio per picture, why is it set per
* region ? */
p_region
=
p_subpic
->
p_region
;
if
(
!
p_region
->
fmt
.
i_sar_num
||
!
p_region
->
fmt
.
i_sar_den
)
{
p_region
->
fmt
.
i_sar_den
=
p_fmt_src
->
i_sar_den
;
p_region
->
fmt
.
i_sar_num
=
p_fmt_src
->
i_sar_num
;
}
/* Take care of the aspect ratio */
if
(
p_region
->
fmt
.
i_sar_num
*
p_fmt_src
->
i_sar_den
!=
p_region
->
fmt
.
i_sar_den
*
p_fmt_src
->
i_sar_num
)
{
/* FIXME FIXME what about region->i_x/i_y ? */
scale
.
w
=
scale
.
w
*
(
int64_t
)
p_region
->
fmt
.
i_sar_num
*
p_fmt_dst
->
i_sar_den
/
p_region
->
fmt
.
i_sar_den
/
p_fmt_dst
->
i_sar_num
;
}
/* Render all regions
* We always transform non absolute subtitle into absolute one on the
* first rendering to allow good subtitle overlap support.
...
...
@@ -1146,6 +1118,23 @@ static subpicture_t *SpuRenderSubpictures( spu_t *p_spu,
{
spu_area_t
area
;
/* Compute region scale AR */
video_format_t
region_fmt
=
p_region
->
fmt
;
if
(
region_fmt
.
i_sar_num
<=
0
||
region_fmt
.
i_sar_den
<=
0
)
{
region_fmt
.
i_sar_num
=
p_fmt_src
->
i_sar_num
;
region_fmt
.
i_sar_den
=
p_fmt_src
->
i_sar_den
;
}
/* Compute scaling from original size to destination size
* FIXME The current scaling ensure that the heights match, the width being
* cropped.
*/
spu_scale_t
scale
=
spu_scale_createq
(
(
int64_t
)
p_fmt_dst
->
i_height
*
p_fmt_dst
->
i_sar_den
*
region_fmt
.
i_sar_num
,
(
int64_t
)
p_subpic
->
i_original_picture_height
*
p_fmt_dst
->
i_sar_num
*
region_fmt
.
i_sar_den
,
p_fmt_dst
->
i_height
,
p_subpic
->
i_original_picture_height
);
/* Check scale validity */
if
(
scale
.
w
<=
0
||
scale
.
h
<=
0
)
continue
;
...
...
@@ -1156,7 +1145,6 @@ static subpicture_t *SpuRenderSubpictures( spu_t *p_spu,
p_chroma_list
,
p_fmt_dst
,
p_subtitle_area
,
i_subtitle_area
,
p_subpic
->
b_subtitle
?
render_subtitle_date
:
render_osd_date
);
if
(
*
pp_output_last
)
pp_output_last
=
&
(
*
pp_output_last
)
->
p_next
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment