Yet another four files with the same "issue": server/change.c, server/thread.c, server/process.c and server/queue.c. This time found by fgrep(1), so no more similar files left in server directory, I believe.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/5503#note_68027
It turned out that the `master_socket_fd_ops` in server/request.c has the same "issue".
Therefore, 1c68e8ed960 (Fix initialization of the master_socket_fd_ops, 2024-04-17) was added into this merge request.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/5503#note_68012
Since we are adding more and more media formats to wg_format, the current wg_format struct is getting ugly.
Everytime we add a video format, we need to duplicate width, height, fps. Everytime we add a audio format, we need to duplicate channels, rate. So it would be better if we could share width, height, fps fields between different video formats, also share channels and rate fields between different audio formats.
What makes me found the current wg_format is not in a good shape is when I was writting code for Proton, I found that I need to write some code like this if want to get width/height/fps from a wg_format:
```
static bool get_video_info_from_wg_format(struct wg_format *format,
int32_t *width, int32_t *height, uint32_t *fps_n, uint32_t *fps_d)
{
switch (format->major_type)
{
case WG_MAJOR_TYPE_VIDEO:
*width = format->u.video.width;
*height = format->u.video.height;
*fps_n = format->u.video.fps_n;
*fps_d = format->u.video.fps_d;
return true;
case WG_MAJOR_TYPE_VIDEO_CINEPAK:
*width = format->u.video_cinepak.width;
*height = format->u.video_cinepak.height;
*fps_n = format->u.video_cinepak.fps_n;
*fps_d = format->u.video_cinepak.fps_d;
return true;
case WG_MAJOR_TYPE_VIDEO_H264:
*width = format->u.video_h264.width;
*height = format->u.video_h264.height;
*fps_n = format->u.video_h264.fps_n;
*fps_d = format->u.video_h264.fps_d;
return true;
case WG_MAJOR_TYPE_VIDEO_WMV:
*width = format->u.video_wmv.width;
*height = format->u.video_wmv.height;
*fps_n = format->u.video_wmv.fps_n;
*fps_d = format->u.video_wmv.fps_d;
return true;
case WG_MAJOR_TYPE_VIDEO_INDEO:
*width = format->u.video_indeo.width;
*height = format->u.video_indeo.height;
*fps_n = format->u.video_indeo.fps_n;
*fps_d = format->u.video_indeo.fps_d;
return true;
case WG_MAJOR_TYPE_VIDEO_MPEG1:
*width = format->u.video_mpeg1.width;
*height = format->u.video_mpeg1.height;
*fps_n = format->u.video_mpeg1.fps_n;
*fps_d = format->u.video_mpeg1.fps_d;
return true;
default:
GST_ERROR("Type %d is not a video format.\n", format->major_type);
return false;
}
}
```
Apparently, the code above is ugly. By refactoring wg_format, we can avoid code like this.
This patch is a draft now, it only contains unixlib.h code.
Zeb, I'd like to confirm that if this refactoring would be acceptable for you. If do, I'll continue finishing the remaining parts.
--
v6: winegstreamer: Refactor wg_format.
https://gitlab.winehq.org/wine/wine/-/merge_requests/5369
On Tue Apr 16 22:41:34 2024 +0000, Elizabeth Figura wrote:
> This is now causing a test failure in test_swapchain_resize() due to a
> no longer skipped test; I imagine we want to add a todo_wine there (and
> possibly change the skip to a win_skip).
Thanks, that should be fixed now.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/5484#note_67974