Browse Source

video_output: allow the display to scale the SPU

Don't do it for text based subpictures so they are rendered at the proper
resolution.
pull/83/head
Steve Lhomme 8 years ago
parent
commit
ba2d739a19
  1. 5
      include/vlc_spu.h
  2. 1
      include/vlc_vout_display.h
  3. 2
      modules/stream_out/transcode/video.c
  4. 3
      src/video_output/video_output.c
  5. 30
      src/video_output/vout_subpictures.c

5
include/vlc_spu.h

@ -73,7 +73,10 @@ VLC_API void spu_PutSubpicture( spu_t *, subpicture_t * );
*
* The returned value if non NULL must be released by subpicture_Delete().
*/
VLC_API subpicture_t * spu_Render( spu_t *, const vlc_fourcc_t *p_chroma_list, const video_format_t *p_fmt_dst, const video_format_t *p_fmt_src, vlc_tick_t render_subtitle_date, vlc_tick_t render_osd_date, bool ignore_osd );
VLC_API subpicture_t * spu_Render( spu_t *, const vlc_fourcc_t *p_chroma_list,
const video_format_t *p_fmt_dst, const video_format_t *p_fmt_src,
vlc_tick_t render_subtitle_date, vlc_tick_t render_osd_date,
bool ignore_osd, bool external_scale );
/**
* It registers a new SPU channel.

1
include/vlc_vout_display.h

@ -112,6 +112,7 @@ typedef struct {
bool is_slow; /* The picture memory has slow read/write */
bool has_double_click; /* Is double-click generated */
bool has_pictures_invalid; /* Will VOUT_DISPLAY_EVENT_PICTURES_INVALID be used */
bool can_scale_spu; /* Handles subpictures with a non default zoom factor */
const vlc_fourcc_t *subpicture_chromas; /* List of supported chromas for subpicture rendering. */
} vout_display_info_t;

2
modules/stream_out/transcode/video.c

@ -406,7 +406,7 @@ static picture_t * RenderSubpictures( sout_stream_t *p_stream, sout_stream_id_sy
subpicture_t *p_subpic = spu_Render( id->p_spu, NULL, &fmt,
&outfmt,
p_pic->date, p_pic->date, false );
p_pic->date, p_pic->date, false, false );
/* Overlay subpicture */
if( p_subpic )

3
src/video_output/video_output.c

@ -1115,7 +1115,8 @@ static int ThreadDisplayRenderPicture(vout_thread_t *vout, bool is_forced)
subpicture_chromas, &fmt_spu_rot,
&vd->source,
render_subtitle_date, render_osd_date,
do_snapshot);
do_snapshot,
vd->info.can_scale_spu);
/*
* Perform rendering
*

30
src/video_output/vout_subpictures.c

@ -1010,7 +1010,8 @@ static subpicture_t *SpuRenderSubpictures(spu_t *spu,
const video_format_t *fmt_dst,
const video_format_t *fmt_src,
vlc_tick_t render_subtitle_date,
vlc_tick_t render_osd_date)
vlc_tick_t render_osd_date,
bool external_scale)
{
spu_private_t *sys = spu->p;
@ -1114,14 +1115,33 @@ static subpicture_t *SpuRenderSubpictures(spu_t *spu,
if (scale.w <= 0 || scale.h <= 0)
continue;
const bool do_external_scale = external_scale && region->fmt.i_chroma != VLC_CODEC_TEXT;
spu_scale_t virtual_scale = external_scale ? (spu_scale_t){ SCALE_UNIT, SCALE_UNIT } : scale;
/* */
SpuRenderRegion(spu, output_last_ptr, &area,
subpic, region, scale,
subpic, region, virtual_scale,
chroma_list, fmt_dst,
subtitle_area, subtitle_area_count,
subpic->b_subtitle ? render_subtitle_date : render_osd_date);
if (*output_last_ptr)
{
if (do_external_scale)
{
if (scale.h != SCALE_UNIT)
{
(*output_last_ptr)->zoom_h.num = scale.h;
(*output_last_ptr)->zoom_h.den = SCALE_UNIT;
}
if (scale.w != SCALE_UNIT)
{
(*output_last_ptr)->zoom_v.num = scale.w;
(*output_last_ptr)->zoom_v.den = SCALE_UNIT;
}
}
output_last_ptr = &(*output_last_ptr)->p_next;
}
if (subpic->b_subtitle) {
area = spu_area_unscaled(area, scale);
@ -1512,7 +1532,8 @@ subpicture_t *spu_Render(spu_t *spu,
const video_format_t *fmt_src,
vlc_tick_t render_subtitle_date,
vlc_tick_t render_osd_date,
bool ignore_osd)
bool ignore_osd,
bool external_scale)
{
spu_private_t *sys = spu->p;
@ -1596,7 +1617,8 @@ subpicture_t *spu_Render(spu_t *spu,
fmt_dst,
fmt_src,
render_subtitle_date,
render_osd_date);
render_osd_date,
external_scale);
vlc_mutex_unlock(&sys->lock);
return render;

Loading…
Cancel
Save