[vlc-devel] [RFC] vout: subtitles outside the video area in direct3d9

Salah-Eddin Shaban salah at videolan.org
Sat Feb 25 16:20:03 CET 2017


On Sat, Feb 25, 2017 at 4:56 PM, Rémi Denis-Courmont <remi at remlab.net> wrote:
> Le lauantaina 25. helmikuuta 2017, 16.40.43 EET Salah-Eddin Shaban a écrit :
>> ---
>>  include/vlc_vout_display.h             |  1 +
>>  modules/video_output/win32/common.c    | 14 +++++++++++++-
>>  modules/video_output/win32/direct3d9.c | 20 ++++++++++++--------
>>  src/video_output/video_output.c        |  9 +++++++++
>>  4 files changed, 35 insertions(+), 9 deletions(-)
>>
>> diff --git a/include/vlc_vout_display.h b/include/vlc_vout_display.h
>> index 46825be..05ea39b 100644
>> --- a/include/vlc_vout_display.h
>> +++ b/include/vlc_vout_display.h
>> @@ -131,6 +131,7 @@ typedef struct {
>>      bool has_hide_mouse;                    /* Is mouse automatically
>> hidden */ bool has_pictures_invalid;              /* Will
>> VOUT_DISPLAY_EVENT_PICTURES_INVALID be used */ bool needs_event_thread
>> VLC_DEPRECATED; /* Will events (key at least) be emitted using an
>> independent thread */
>> +    bool scale_spu_to_display;              /*
>> Subpictures not restricted to video area */ const vlc_fourcc_t
>> *subpicture_chromas; /* List of supported chromas for subpicture rendering.
>> */ } vout_display_info_t;
>
> That does not seem right. Why is a flag needed, and how is it supposed to
> work?
>

Because the core renders the subpicture, in:

    subpicture_t *subpic = spu_Render(vout->p->spu,
                                      subpicture_chromas, &fmt_spu_rot,
                                      &vd->source,
                                      render_subtitle_date, render_osd_date,
                                      do_snapshot);

here fmt_spu_rot specifies the destination dimensions. And the d3d9
module matches them in the call:

-        /* Map the subpicture to sys->sys.rect_dest */
-        const RECT video = sys->sys.rect_dest;
-        const float scale_w = (float)(video.right  - video.left) /
subpicture->i_original_picture_width;
-        const float scale_h = (float)(video.bottom - video.top)  /
subpicture->i_original_picture_height;
+        /* Map the subpicture to the display */
+        RECT display = { 0, 0, vd->cfg->display.width,
vd->cfg->display.height };
+        const float scale_w = (float)(display.right  - display.left)
/ subpicture->i_original_picture_width;
+        const float scale_h = (float)(display.bottom - display.top)
/ subpicture->i_original_picture_height;

The core should know whether to create the spu in display dimensions
or video dimensions.


More information about the vlc-devel mailing list