[vlc-commits] [Git][videolan/vlc][master] 6 commits: es_format: initialize the mask in video_format_Setup()

Steve Lhomme (@robUx4) gitlab at videolan.org
Wed Aug 23 09:34:38 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
e55ff74d by Steve Lhomme at 2023-08-23T09:04:19+00:00
es_format: initialize the mask in video_format_Setup()

In case the caller doesn't force its own mask for formats with a mask.
If it did, it was after the call to video_format_Setup() so it would
still overwrite the "default" value.

- - - - -
4a211005 by Steve Lhomme at 2023-08-23T09:04:19+00:00
screen/gdi: use video_format_Setup() to initialize the format

- - - - -
6c069b06 by Steve Lhomme at 2023-08-23T09:04:19+00:00
screen/xcb: use video_format_Setup() to initialize the format

- - - - -
4be29e38 by Steve Lhomme at 2023-08-23T09:04:19+00:00
access/rdp: use video_format_Setup() to initialize the format

- - - - -
55989e6d by Steve Lhomme at 2023-08-23T09:04:19+00:00
access/shm: use video_format_Setup() to initialize the format

- - - - -
d1b3bbf3 by Steve Lhomme at 2023-08-23T09:04:19+00:00
screen/dxgi: use video_format_Setup() to initialize the format

- - - - -


6 changed files:

- modules/access/rdp.c
- modules/access/screen/dxgi.cpp
- modules/access/screen/win32.c
- modules/access/screen/xcb.c
- modules/access/shm.c
- src/misc/es_format.c


Changes:

=====================================
modules/access/rdp.c
=====================================
@@ -159,12 +159,9 @@ static BOOL desktopResizeHandler( rdpContext *p_context )
     }
     es_format_t fmt;
     es_format_Init( &fmt, VIDEO_ES, i_chroma );
+    video_format_Setup( &fmt.video, i_chroma, p_gdi->width, p_gdi->height,
+                        p_gdi->width, p_gdi->height, 1, 1)
 
-    fmt.video.i_chroma = i_chroma;
-    fmt.video.i_visible_width =
-    fmt.video.i_width = p_gdi->width;
-    fmt.video.i_visible_height =
-    fmt.video.i_height = p_gdi->height;
     fmt.video.i_frame_rate_base = 1000;
     fmt.video.i_frame_rate = 1000 * p_sys->f_fps;
     if ( umul_overflow( p_gdi->width, p_gdi->height, &p_sys->i_framebuffersize ) &&


=====================================
modules/access/screen/dxgi.cpp
=====================================
@@ -259,13 +259,9 @@ int screen_InitCaptureDXGI(demux_t *p_demux)
         goto error;
 
     es_format_Init( &p_sys->fmt, VIDEO_ES, p_data->output_format->fourcc );
-    p_sys->fmt.video.i_visible_width    =
-    p_sys->fmt.video.i_width            = outDesc.ModeDesc.Width;
-    p_sys->fmt.video.i_visible_height   =
-    p_sys->fmt.video.i_height           = outDesc.ModeDesc.Height;
-    p_sys->fmt.video.i_bits_per_pixel   = 4 * p_data->output_format->bitsPerChannel; /* FIXME */
-    p_sys->fmt.video.i_sar_num = p_sys->fmt.video.i_sar_den = 1;
-    p_sys->fmt.video.i_chroma           = p_sys->fmt.i_codec;
+    video_format_Setup( &p_sys->fmt.video, p_sys->fmt.i_codec,
+                        outDesc.ModeDesc.Width, outDesc.ModeDesc.Height,
+                        outDesc.ModeDesc.Width, outDesc.ModeDesc.Height, 1, 1);
     p_sys->fmt.video.color_range        = COLOR_RANGE_FULL;
     p_sys->fmt.video.i_frame_rate       = outDesc.ModeDesc.RefreshRate.Numerator;
     p_sys->fmt.video.i_frame_rate_base  = outDesc.ModeDesc.RefreshRate.Denominator;


=====================================
modules/access/screen/win32.c
=====================================
@@ -143,39 +143,14 @@ int screen_InitCaptureGDI( demux_t *p_demux )
         return VLC_EGENERIC;
     }
 
+    int screen_width  = GetSystemMetrics( SM_CXVIRTUALSCREEN );
+    int screen_height = GetSystemMetrics( SM_CYVIRTUALSCREEN );
     es_format_Init( &p_sys->fmt, VIDEO_ES, i_chroma );
-    p_sys->fmt.video.i_visible_width  =
-    p_sys->fmt.video.i_width          = GetSystemMetrics( SM_CXVIRTUALSCREEN );
-    p_sys->fmt.video.i_visible_height =
-    p_sys->fmt.video.i_height         = GetSystemMetrics( SM_CYVIRTUALSCREEN );
-    p_sys->fmt.video.i_bits_per_pixel = i_bits_per_pixel;
-    p_sys->fmt.video.i_sar_num = p_sys->fmt.video.i_sar_den = 1;
-    p_sys->fmt.video.i_chroma         = i_chroma;
+    video_format_Setup( &p_sys->fmt.video, i_chroma, screen_width, screen_height,
+                        screen_width, screen_width, 1, 1 );
     p_sys->fmt.video.transfer         = TRANSFER_FUNC_SRGB;
     p_sys->fmt.video.color_range      = COLOR_RANGE_FULL;
 
-    switch( i_chroma )
-    {
-    case VLC_CODEC_RGB15:
-        p_sys->fmt.video.i_rmask = 0x7c00;
-        p_sys->fmt.video.i_gmask = 0x03e0;
-        p_sys->fmt.video.i_bmask = 0x001f;
-        break;
-    case VLC_CODEC_RGB24:
-        p_sys->fmt.video.i_rmask = 0x00ff0000;
-        p_sys->fmt.video.i_gmask = 0x0000ff00;
-        p_sys->fmt.video.i_bmask = 0x000000ff;
-        break;
-    case VLC_CODEC_RGB32:
-        p_sys->fmt.video.i_rmask = 0x00ff0000;
-        p_sys->fmt.video.i_gmask = 0x0000ff00;
-        p_sys->fmt.video.i_bmask = 0x000000ff;
-        break;
-    default:
-        msg_Warn( p_demux, "Unknown RGB masks" );
-        break;
-    }
-
     p_data->ptl.x = - GetSystemMetrics( SM_XVIRTUALSCREEN );
     p_data->ptl.y = - GetSystemMetrics( SM_YVIRTUALSCREEN );
 


=====================================
modules/access/screen/xcb.c
=====================================
@@ -568,13 +568,9 @@ static es_out_id_t *InitES (demux_t *demux, uint_fast16_t width,
     es_format_t fmt;
 
     es_format_Init (&fmt, VIDEO_ES, chroma);
-    fmt.video.i_chroma = chroma;
-    fmt.video.i_bits_per_pixel = *bpp;
-    fmt.video.i_sar_num = fmt.video.i_sar_den = 1;
+    video_format_Setup(&fmt.video, chroma, width, height, width, height, 1, 1);
     fmt.video.i_frame_rate = 1000 * p_sys->rate;
     fmt.video.i_frame_rate_base = 1000;
-    fmt.video.i_visible_width = fmt.video.i_width = width;
-    fmt.video.i_visible_height = fmt.video.i_height = height;
 
     return es_out_Add (demux->out, &fmt);
 }


=====================================
modules/access/shm.c
=====================================
@@ -231,13 +231,9 @@ static int Open (vlc_object_t *obj)
 
     es_format_t fmt;
     es_format_Init (&fmt, VIDEO_ES, chroma);
-    fmt.video.i_chroma = chroma;
-    fmt.video.i_bits_per_pixel = bpp;
-    fmt.video.i_sar_num = fmt.video.i_sar_den = 1;
+    video_format_Setup(&fmt.video, chroma, width, height, width, height, 1, 1);
     fmt.video.i_frame_rate = 1000 * rate;
     fmt.video.i_frame_rate_base = 1000;
-    fmt.video.i_visible_width = fmt.video.i_width = width;
-    fmt.video.i_visible_height = fmt.video.i_height = height;
 
     sys->es = es_out_Add (demux->out, &fmt);
 


=====================================
src/misc/es_format.c
=====================================
@@ -85,6 +85,7 @@ void video_format_Setup( video_format_t *p_fmt, vlc_fourcc_t i_chroma,
     p_fmt->orientation      = ORIENT_NORMAL;
     vlc_ureduce( &p_fmt->i_sar_num, &p_fmt->i_sar_den,
                  i_sar_num, i_sar_den, 0 );
+    video_format_FixRgb( p_fmt );
 
     switch( p_fmt->i_chroma )
     {



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/702278564b99d355885bfd63df8e361a1e18a8cb...d1b3bbf3ed7a8b0de1a6fec21762e1cddcc22e50

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/702278564b99d355885bfd63df8e361a1e18a8cb...d1b3bbf3ed7a8b0de1a6fec21762e1cddcc22e50
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list