[vlc-commits] [Git][videolan/vlc][master] vout: use designated initializers for display ops
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Sat Jul 10 15:48:27 UTC 2021
Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC
Commits:
6208d519 by Romain Vimont at 2021-07-10T15:16:50+00:00
vout: use designated initializers for display ops
Benefits of *not* using designated initializers:
- we can't forget a callback
- it's the same in C and C++ (<20)
Benefits of using designated initializers:
- the order of callbacks may not be wrong
- we can read immediately which function is assigned to which callback
(especially if some are NULL)
- an optional callback may be added without modifying all the modules
- we can grep a callback name to find its assignments easily
- it is consistent with others xxx_operations in the codebase
- - - - -
21 changed files:
- modules/hw/mmal/vout.c
- modules/hw/vdpau/display.c
- modules/video_output/android/display.c
- modules/video_output/caca.c
- modules/video_output/fb.c
- modules/video_output/flaschen.c
- modules/video_output/kms.c
- modules/video_output/kva.c
- modules/video_output/libplacebo/display.c
- modules/video_output/opengl/display.c
- modules/video_output/splitter.c
- modules/video_output/vdummy.c
- modules/video_output/vmem.c
- modules/video_output/wayland/shm.c
- modules/video_output/win32/direct3d11.c
- modules/video_output/win32/direct3d9.c
- modules/video_output/win32/glwin32.c
- modules/video_output/win32/wingdi.c
- modules/video_output/xcb/render.c
- modules/video_output/xcb/x11.c
- modules/video_output/yuv.c
Changes:
=====================================
modules/hw/mmal/vout.c
=====================================
@@ -1087,7 +1087,11 @@ static int find_display_num(const char * name)
}
static const struct vlc_display_operations ops = {
- CloseMmalVout, vd_prepare, vd_display, vd_control, vd_reset_pictures, NULL,
+ .close = CloseMmalVout,
+ .prepare = vd_prepare,
+ .display = vd_display,
+ .control = vd_control,
+ .reset_pictures = vd_reset_pictures,
};
static int OpenMmalVout(vout_display_t *vd, const vout_display_cfg_t *cfg,
=====================================
modules/hw/vdpau/display.c
=====================================
@@ -286,7 +286,11 @@ static int Control(vout_display_t *vd, int query)
}
static const struct vlc_display_operations ops = {
- Close, Queue, Wait, Control, ResetPictures, NULL,
+ .close = Close,
+ .prepare = Queue,
+ .display = Wait,
+ .control = Control,
+ .reset_pictures = ResetPictures,
};
static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
=====================================
modules/video_output/android/display.c
=====================================
@@ -477,7 +477,11 @@ static void SetRGBMask(video_format_t *p_fmt)
}
static const struct vlc_display_operations ops = {
- Close, Prepare, Display, Control, NULL, NULL,
+ .close = Close,
+ .prepare = Prepare,
+ .display = Display,
+ .control = Control,
+ .set_viewpoint = NULL,
};
static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
=====================================
modules/video_output/caca.c
=====================================
@@ -371,7 +371,10 @@ static void Close(vout_display_t *vd)
}
static const struct vlc_display_operations ops = {
- Close, Prepare, PictureDisplay, Control, NULL, NULL,
+ .close = Close,
+ .prepare = Prepare,
+ .display = PictureDisplay,
+ .control = Control,
};
/**
=====================================
modules/video_output/fb.c
=====================================
@@ -160,7 +160,9 @@ static void ClearScreen(vout_display_sys_t *sys)
}
static const struct vlc_display_operations ops = {
- Close, NULL, Display, Control, NULL, NULL,
+ .close = Close,
+ .display = Display,
+ .control = Control,
};
/**
=====================================
modules/video_output/flaschen.c
=====================================
@@ -82,7 +82,9 @@ static void Display(vout_display_t *, picture_t *);
static int Control(vout_display_t *, int);
static const struct vlc_display_operations ops = {
- Close, NULL, Display, Control, NULL, NULL,
+ .close = Close,
+ .display = Display,
+ .control = Control,
};
/*****************************************************************************
=====================================
modules/video_output/kms.c
=====================================
@@ -667,7 +667,10 @@ static void Close(vout_display_t *vd)
}
static const struct vlc_display_operations ops = {
- Close, Prepare, Display, Control, NULL, NULL,
+ .close = Close,
+ .prepare = Prepare,
+ .display = Display,
+ .control = Control,
};
/**
=====================================
modules/video_output/kva.c
=====================================
@@ -154,7 +154,10 @@ static void Prepare(vout_display_t *vd, picture_t *pic, subpicture_t *subpic, vl
}
static const struct vlc_display_operations ops = {
- Close, Prepare, Display, Control, NULL, NULL,
+ .close = Close,
+ .prepare = Prepare,
+ .display = Display,
+ .control = Control,
};
static void PMThread( void *arg )
=====================================
modules/video_output/libplacebo/display.c
=====================================
@@ -89,7 +89,10 @@ static void Close(vout_display_t *);
static void UpdateParams(vout_display_t *);
static const struct vlc_display_operations ops = {
- Close, PictureRender, PictureDisplay, Control, NULL, NULL,
+ .close = Close,
+ .prepare = PictureRender,
+ .display = PictureDisplay,
+ .control = Control,
};
static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
=====================================
modules/video_output/opengl/display.c
=====================================
@@ -94,7 +94,11 @@ static int SetViewpoint(vout_display_t *vd, const vlc_viewpoint_t *vp)
}
static const struct vlc_display_operations ops = {
- Close, PictureRender, PictureDisplay, Control, NULL, SetViewpoint,
+ .close = Close,
+ .prepare = PictureRender,
+ .display = PictureDisplay,
+ .control = Control,
+ .set_viewpoint = SetViewpoint,
};
static void
=====================================
modules/video_output/splitter.c
=====================================
@@ -224,7 +224,10 @@ static vout_window_t *video_splitter_CreateWindow(vlc_object_t *obj,
}
static const struct vlc_display_operations ops = {
- vlc_vidsplit_Close, vlc_vidsplit_Prepare, vlc_vidsplit_Display, vlc_vidsplit_Control, NULL, NULL,
+ .close = vlc_vidsplit_Close,
+ .prepare = vlc_vidsplit_Prepare,
+ .display = vlc_vidsplit_Display,
+ .control = vlc_vidsplit_Control,
};
static int vlc_vidsplit_Open(vout_display_t *vd,
=====================================
modules/video_output/vdummy.c
=====================================
@@ -85,7 +85,7 @@ static void Open(vout_display_t *vd, video_format_t *fmt)
}
static const struct vlc_display_operations ops_dummy = {
- NULL, NULL, NULL, Control, NULL, NULL,
+ .control = Control,
};
static int OpenDummy(vout_display_t *vd, const vout_display_cfg_t *cfg,
@@ -98,7 +98,8 @@ static int OpenDummy(vout_display_t *vd, const vout_display_cfg_t *cfg,
}
static const struct vlc_display_operations ops_stats = {
- NULL, NULL, DisplayStat, Control, NULL, NULL,
+ .display = DisplayStat,
+ .control = Control,
};
static int OpenStats(vout_display_t *vd, const vout_display_cfg_t *cfg,
=====================================
modules/video_output/vmem.c
=====================================
@@ -103,7 +103,10 @@ static void Display(vout_display_t *, picture_t *);
static int Control(vout_display_t *, int);
static const struct vlc_display_operations ops = {
- Close, Prepare, Display, Control, NULL, NULL,
+ .close = Close,
+ .prepare = Prepare,
+ .display = Display,
+ .control = Control,
};
/*****************************************************************************
=====================================
modules/video_output/wayland/shm.c
=====================================
@@ -263,7 +263,11 @@ static void Close(vout_display_t *vd)
}
static const struct vlc_display_operations ops = {
- Close, Prepare, Display, Control, ResetPictures, NULL,
+ .close = Close,
+ .prepare = Prepare,
+ .display = Display,
+ .control = Control,
+ .reset_pictures = ResetPictures,
};
static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
=====================================
modules/video_output/win32/direct3d11.c
=====================================
@@ -349,7 +349,11 @@ static int UpdateStaging(vout_display_t *vd, const video_format_t *fmt)
}
static const struct vlc_display_operations ops = {
- Close, Prepare, Display, Control, NULL, SetViewpoint,
+ .close = Close,
+ .prepare = Prepare,
+ .display = Display,
+ .control = Control,
+ .set_viewpoint = SetViewpoint,
};
static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
=====================================
modules/video_output/win32/direct3d9.c
=====================================
@@ -1765,7 +1765,10 @@ static void LocalSwapchainSwap( void *opaque )
}
static const struct vlc_display_operations ops = {
- Close, Prepare, Display, Control, NULL, NULL,
+ .close = Close,
+ .prepare = Prepare,
+ .display = Display,
+ .control = Control,
};
/**
=====================================
modules/video_output/win32/glwin32.c
=====================================
@@ -109,7 +109,11 @@ static vout_window_t *EmbedVideoWindow_Create(vout_display_t *vd)
}
static const struct vlc_display_operations ops = {
- Close, Prepare, Display, Control, NULL, SetViewpoint,
+ .close = Close,
+ .prepare = Prepare,
+ .display = Display,
+ .control = Control,
+ .set_viewpoint = SetViewpoint,
};
/**
=====================================
modules/video_output/win32/wingdi.c
=====================================
@@ -104,7 +104,10 @@ static int Control(vout_display_t *vd, int query)
}
static const struct vlc_display_operations ops = {
- Close, Prepare, Display, Control, NULL, NULL,
+ .close = Close,
+ .prepare = Prepare,
+ .display = Display,
+ .control = Control,
};
/* */
=====================================
modules/video_output/xcb/render.c
=====================================
@@ -541,7 +541,10 @@ FindVisual(const xcb_setup_t *setup, const xcb_screen_t *scr,
}
static const struct vlc_display_operations ops = {
- Close, Prepare, Display, Control, NULL, NULL,
+ .close = Close,
+ .prepare = Prepare,
+ .display = Display,
+ .control = Control,
};
/**
=====================================
modules/video_output/xcb/x11.c
=====================================
@@ -251,7 +251,11 @@ static xcb_visualid_t ScreenToFormat(const xcb_setup_t *setup,
}
static const struct vlc_display_operations ops = {
- Close, Prepare, Display, Control, ResetPictures, NULL,
+ .close = Close,
+ .prepare = Prepare,
+ .display = Display,
+ .control = Control,
+ .reset_pictures = ResetPictures,
};
/**
=====================================
modules/video_output/yuv.c
=====================================
@@ -87,7 +87,9 @@ typedef struct vout_display_sys_t {
} vout_display_sys_t;
static const struct vlc_display_operations ops = {
- Close, NULL, Display, Control, NULL, NULL,
+ .close = Close,
+ .display = Display,
+ .control = Control,
};
/* */
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/6208d519af83a7833d63dc819e9ef23cbc77777d
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/6208d519af83a7833d63dc819e9ef23cbc77777d
You're receiving this email because of your account on code.videolan.org.
More information about the vlc-commits
mailing list