diff options
Diffstat (limited to 'video/out')
-rw-r--r-- | video/out/gl_common.c | 50 | ||||
-rw-r--r-- | video/out/gl_common.h | 2 | ||||
-rw-r--r-- | video/out/gl_lcms.c | 4 | ||||
-rw-r--r-- | video/out/gl_video.c | 16 | ||||
-rw-r--r-- | video/out/vo.c | 36 | ||||
-rw-r--r-- | video/out/vo.h | 3 | ||||
-rw-r--r-- | video/out/wayland_common.c | 3 | ||||
-rw-r--r-- | video/out/x11_common.c | 2 |
8 files changed, 56 insertions, 60 deletions
diff --git a/video/out/gl_common.c b/video/out/gl_common.c index 4ed76caeeb..243f442b4d 100644 --- a/video/out/gl_common.c +++ b/video/out/gl_common.c @@ -156,17 +156,17 @@ struct gl_functions { int ver_core; // introduced as required function int ver_removed; // removed as required function (no replacement) bool partial_ok; // loading only some functions is ok - struct gl_function *functions; + const struct gl_function *functions; }; #define MAX_FN_COUNT 50 // max functions per gl_functions section -struct gl_functions gl_functions[] = { +static const struct gl_functions gl_functions[] = { // GL functions which are always available anywhere at least since 1.1 { .ver_core = MPGL_VER(1, 1), .provides = MPGL_CAP_GL, - .functions = (struct gl_function[]) { + .functions = (const struct gl_function[]) { DEF_FN(Viewport), DEF_FN(Clear), DEF_FN(GenTextures), @@ -204,7 +204,7 @@ struct gl_functions gl_functions[] = { { .ver_core = MPGL_VER(2, 0), .provides = MPGL_CAP_GL2, - .functions = (struct gl_function[]) { + .functions = (const struct gl_function[]) { DEF_FN(GenBuffers), DEF_FN(DeleteBuffers), DEF_FN(BindBuffer), @@ -248,7 +248,7 @@ struct gl_functions gl_functions[] = { { .ver_core = MPGL_VER(2, 1), .provides = MPGL_CAP_GL21, - .functions = (struct gl_function[]) { + .functions = (const struct gl_function[]) { DEF_FN(UniformMatrix4x3fv), {0} }, @@ -257,7 +257,7 @@ struct gl_functions gl_functions[] = { { .ver_core = MPGL_VER(3, 0), .provides = MPGL_CAP_GL3 | MPGL_CAP_SRGB_TEX | MPGL_CAP_SRGB_FB, - .functions = (struct gl_function[]) { + .functions = (const struct gl_function[]) { DEF_FN(GetStringi), {0} }, @@ -267,7 +267,7 @@ struct gl_functions gl_functions[] = { .ver_core = MPGL_VER(3, 0), .extension = "GL_ARB_framebuffer_object", .provides = MPGL_CAP_FB, - .functions = (struct gl_function[]) { + .functions = (const struct gl_function[]) { DEF_FN(BindFramebuffer), DEF_FN(GenFramebuffers), DEF_FN(DeleteFramebuffers), @@ -281,7 +281,7 @@ struct gl_functions gl_functions[] = { .ver_removed = MPGL_VER(3, 0), // don't touch these fn names in 3.x .extension = "GL_EXT_framebuffer_object", .provides = MPGL_CAP_FB, - .functions = (struct gl_function[]) { + .functions = (const struct gl_function[]) { DEF_FN_NAMES(BindFramebuffer, "glBindFramebufferEXT"), DEF_FN_NAMES(GenFramebuffers, "glGenFramebuffersEXT"), DEF_FN_NAMES(DeleteFramebuffers, "glDeleteFramebuffersEXT"), @@ -295,7 +295,7 @@ struct gl_functions gl_functions[] = { .ver_core = MPGL_VER(3, 0), .extension = "GL_ARB_vertex_array_object", .provides = MPGL_CAP_VAO, - .functions = (struct gl_function[]) { + .functions = (const struct gl_function[]) { DEF_FN(GenVertexArrays), DEF_FN(BindVertexArray), DEF_FN(DeleteVertexArrays), @@ -307,33 +307,33 @@ struct gl_functions gl_functions[] = { .ver_core = MPGL_VER(3, 0), .extension = "GL_EXT_texture_sRGB", .provides = MPGL_CAP_SRGB_TEX, - .functions = (struct gl_function[]) {{0}}, + .functions = (const struct gl_function[]) {{0}}, }, // sRGB framebuffers, extension in GL 2.x, core in GL 3.x core. { .ver_core = MPGL_VER(3, 0), .extension = "GL_EXT_framebuffer_sRGB", .provides = MPGL_CAP_SRGB_FB, - .functions = (struct gl_function[]) {{0}}, + .functions = (const struct gl_function[]) {{0}}, }, // Float textures, extension in GL 2.x, core in GL 3.x core. { .ver_core = MPGL_VER(3, 0), .extension = "GL_ARB_texture_float", .provides = MPGL_CAP_FLOAT_TEX, - .functions = (struct gl_function[]) {{0}}, + .functions = (const struct gl_function[]) {{0}}, }, // GL_RED / GL_RG textures, extension in GL 2.x, core in GL 3.x core. { .ver_core = MPGL_VER(3, 0), .extension = "GL_ARB_texture_rg", .provides = MPGL_CAP_TEX_RG, - .functions = (struct gl_function[]) {{0}}, + .functions = (const struct gl_function[]) {{0}}, }, // Swap control, always an OS specific extension { .extension = "_swap_control", - .functions = (struct gl_function[]) { + .functions = (const struct gl_function[]) { DEF_FN_NAMES(SwapInterval, "glXSwapIntervalSGI", "glXSwapInterval", "wglSwapIntervalSGI", "wglSwapInterval", "wglSwapIntervalEXT"), @@ -345,7 +345,7 @@ struct gl_functions gl_functions[] = { .ver_core = MPGL_VER(1, 1), .ver_removed = MPGL_VER(3, 0), .provides = MPGL_CAP_GL_LEGACY, - .functions = (struct gl_function[]) { + .functions = (const struct gl_function[]) { DEF_FN(Begin), DEF_FN(End), DEF_FN(MatrixMode), @@ -381,7 +381,7 @@ struct gl_functions gl_functions[] = { { .ver_removed = MPGL_VER(2, 1), .partial_ok = true, - .functions = (struct gl_function[]) { + .functions = (const struct gl_function[]) { DEF_FN_NAMES(GenBuffers, "glGenBuffers", "glGenBuffersARB"), DEF_FN_NAMES(DeleteBuffers, "glDeleteBuffers", "glDeleteBuffersARB"), DEF_FN_NAMES(BindBuffer, "glBindBuffer", "glBindBufferARB"), @@ -399,7 +399,7 @@ struct gl_functions gl_functions[] = { { .extension = "_program", .ver_removed = MPGL_VER(3, 0), - .functions = (struct gl_function[]) { + .functions = (const struct gl_function[]) { DEF_FN_NAMES(GenPrograms, "glGenProgramsARB"), DEF_FN_NAMES(DeletePrograms, "glDeleteProgramsARB"), DEF_FN_NAMES(BindProgram, "glBindProgramARB"), @@ -413,7 +413,7 @@ struct gl_functions gl_functions[] = { { .extension = "ATI_fragment_shader", .ver_removed = MPGL_VER(3, 0), - .functions = (struct gl_function[]) { + .functions = (const struct gl_function[]) { DEF_FN_NAMES(BeginFragmentShader, "glBeginFragmentShaderATI"), DEF_FN_NAMES(EndFragmentShader, "glEndFragmentShaderATI"), DEF_FN_NAMES(SampleMap, "glSampleMapATI"), @@ -428,7 +428,7 @@ struct gl_functions gl_functions[] = { { .extension = "GL_NV_vdpau_interop", .provides = MPGL_CAP_VDPAU, - .functions = (struct gl_function[]) { + .functions = (const struct gl_function[]) { // (only functions needed by us) DEF_FN(VDPAUInitNV), DEF_FN(VDPAUFiniNV), @@ -446,7 +446,7 @@ struct gl_functions gl_functions[] = { { .extension = "GL_APPLE_rgb_422", .provides = MPGL_CAP_APPLE_RGB_422, - .functions = (struct gl_function[]) { + .functions = (const struct gl_function[]) { {0} }, }, @@ -529,7 +529,7 @@ void mpgl_load_functions(GL *gl, void *(*getProcAddress)(const GLubyte *), mp_dbg(log, "Combined OpenGL extensions string:\n%s\n", gl->extensions); for (int n = 0; n < sizeof(gl_functions) / sizeof(gl_functions[0]); n++) { - struct gl_functions *section = &gl_functions[n]; + const struct gl_functions *section = &gl_functions[n]; // With has_legacy, the legacy functions are still available, and // functions are never actually removed. (E.g. the context could be at @@ -558,7 +558,7 @@ void mpgl_load_functions(GL *gl, void *(*getProcAddress)(const GLubyte *), bool all_loaded = true; for (int i = 0; section->functions[i].funcnames[0]; i++) { - struct gl_function *fn = §ion->functions[i]; + const struct gl_function *fn = §ion->functions[i]; void *ptr = NULL; for (int x = 0; fn->funcnames[x]; x++) { ptr = getProcAddress((const GLubyte *)fn->funcnames[x]); @@ -583,7 +583,7 @@ void mpgl_load_functions(GL *gl, void *(*getProcAddress)(const GLubyte *), if (all_loaded || section->partial_ok) { gl->mpgl_caps |= section->provides; for (int i = 0; section->functions[i].funcnames[0]; i++) { - struct gl_function *fn = §ion->functions[i]; + const struct gl_function *fn = §ion->functions[i]; void **funcptr = (void**)(((char*)gl) + fn->offset); if (loaded[i]) *funcptr = loaded[i]; @@ -853,7 +853,7 @@ struct backend { MPGLSetBackendFn init; }; -static struct backend backends[] = { +static const struct backend backends[] = { #if HAVE_GL_COCOA {"cocoa", mpgl_set_backend_cocoa}, #endif @@ -1014,7 +1014,7 @@ extern const struct gl_hwdec_driver gl_hwdec_vaglx; extern const struct gl_hwdec_driver gl_hwdec_vda; extern const struct gl_hwdec_driver gl_hwdec_vdpau; -const struct gl_hwdec_driver *mpgl_hwdec_drivers[] = { +const struct gl_hwdec_driver *const mpgl_hwdec_drivers[] = { #if HAVE_VAAPI_GLX &gl_hwdec_vaglx, #endif diff --git a/video/out/gl_common.h b/video/out/gl_common.h index 622f1f2659..75ff0d5dfd 100644 --- a/video/out/gl_common.h +++ b/video/out/gl_common.h @@ -206,7 +206,7 @@ struct gl_hwdec_driver { void (*destroy)(struct gl_hwdec *hw); }; -extern const struct gl_hwdec_driver *mpgl_hwdec_drivers[]; +extern const struct gl_hwdec_driver *const mpgl_hwdec_drivers[]; void mpgl_load_functions(GL *gl, void *(*getProcAddress)(const GLubyte *), const char *ext2, struct mp_log *log); diff --git a/video/out/gl_lcms.c b/video/out/gl_lcms.c index ad1bd1bb96..adda52b145 100644 --- a/video/out/gl_lcms.c +++ b/video/out/gl_lcms.c @@ -69,7 +69,7 @@ static int validate_3dlut_size_opt(struct mp_log *log, const m_option_t *opt, #define OPT_BASE_STRUCT struct mp_icc_opts const struct m_sub_options mp_icc_conf = { - .opts = (m_option_t[]) { + .opts = (const m_option_t[]) { OPT_STRING("icc-profile", profile, 0), OPT_FLAG("icc-profile-auto", profile_auto, 0), OPT_STRING("icc-cache", cache, 0), @@ -250,7 +250,7 @@ error_exit: #else /* HAVE_LCMS2 */ const struct m_sub_options mp_icc_conf = { - .opts = (m_option_t[]) { {0} }, + .opts = (const m_option_t[]) { {0} }, .size = sizeof(struct mp_icc_opts), .defaults = &(const struct mp_icc_opts) {0}, }; diff --git a/video/out/gl_video.c b/video/out/gl_video.c index ab56ca51a8..1b83d416ce 100644 --- a/video/out/gl_video.c +++ b/video/out/gl_video.c @@ -55,7 +55,7 @@ static const char vo_opengl_shaders[] = // lscale/cscale arguments that map directly to shader filter routines. // Note that the convolution filters are not included in this list. -static const char *fixed_scale_filters[] = { +static const char *const fixed_scale_filters[] = { "bilinear", "bicubic_fast", "sharpen3", @@ -73,7 +73,7 @@ struct lut_tex_format { // This must match the weightsN functions in the shader. // Each entry uses (size+3)/4 pixels per LUT entry, and size/pixels components // per pixel. -struct lut_tex_format lut_tex_formats[] = { +const struct lut_tex_format lut_tex_formats[] = { [2] = {1, GL_RG16F, GL_RG}, [4] = {1, GL_RGBA16F, GL_RGBA}, [6] = {2, GL_RGB16F, GL_RGB}, @@ -271,7 +271,7 @@ static const struct packed_fmt_entry mp_packed_formats[] = { {0}, }; -static const char *osd_shaders[SUBBITMAP_COUNT] = { +static const char *const osd_shaders[SUBBITMAP_COUNT] = { [SUBBITMAP_LIBASS] = "frag_osd_libass", [SUBBITMAP_RGBA] = "frag_osd_rgba", }; @@ -303,7 +303,7 @@ static int validate_scaler_opt(struct mp_log *log, const m_option_t *opt, #define OPT_BASE_STRUCT struct gl_video_opts const struct m_sub_options gl_video_conf = { - .opts = (m_option_t[]) { + .opts = (const m_option_t[]) { OPT_FLOATRANGE("gamma", gamma, 0, 0.0, 10.0), OPT_FLAG("srgb", srgb, 0), OPT_FLAG("approx-gamma", approx_gamma, 0), @@ -1046,7 +1046,7 @@ static void init_scaler(struct gl_video *p, struct scaler *scaler) int size = scaler->kernel->size; assert(size < FF_ARRAY_ELEMS(lut_tex_formats)); - struct lut_tex_format *fmt = &lut_tex_formats[size]; + const struct lut_tex_format *fmt = &lut_tex_formats[size]; bool use_2d = fmt->pixels > 1; bool is_luma = scaler->index == 0; scaler->lut_name = use_2d @@ -1854,7 +1854,7 @@ static bool test_fbo(struct gl_video *p, GLenum format) 0xFFFFFF / (float)(1 << 25), // float mantissa 2, // out of range value }; - static const char *val_names[] = { + static const char *const val_names[] = { "8-bit precision", "16-bit precision", "full float", @@ -2237,7 +2237,7 @@ static const char* handle_scaler_opt(const char *name) if (can_use_filter_kernel(kernel)) return kernel->name; - for (const char **filter = fixed_scale_filters; *filter; filter++) { + for (const char *const *filter = fixed_scale_filters; *filter; filter++) { if (strcmp(*filter, name) == 0) return *filter; } @@ -2289,7 +2289,7 @@ static int validate_scaler_opt(struct mp_log *log, const m_option_t *opt, { if (bstr_equals0(param, "help")) { mp_info(log, "Available scalers:\n"); - for (const char **filter = fixed_scale_filters; *filter; filter++) + for (const char *const *filter = fixed_scale_filters; *filter; filter++) mp_info(log, " %s\n", *filter); for (int n = 0; mp_filter_kernels[n].name; n++) mp_info(log, " %s\n", mp_filter_kernels[n].name); diff --git a/video/out/vo.c b/video/out/vo.c index 60ee2ac8bd..76f980ce5a 100644 --- a/video/out/vo.c +++ b/video/out/vo.c @@ -47,24 +47,24 @@ // // Externally visible list of all vo drivers // -extern struct vo_driver video_out_x11; -extern struct vo_driver video_out_vdpau; -extern struct vo_driver video_out_xv; -extern struct vo_driver video_out_opengl; -extern struct vo_driver video_out_opengl_hq; -extern struct vo_driver video_out_opengl_old; -extern struct vo_driver video_out_null; -extern struct vo_driver video_out_image; -extern struct vo_driver video_out_lavc; -extern struct vo_driver video_out_caca; -extern struct vo_driver video_out_direct3d; -extern struct vo_driver video_out_direct3d_shaders; -extern struct vo_driver video_out_sdl; -extern struct vo_driver video_out_corevideo; -extern struct vo_driver video_out_vaapi; -extern struct vo_driver video_out_wayland; - -const struct vo_driver *video_out_drivers[] = +extern const struct vo_driver video_out_x11; +extern const struct vo_driver video_out_vdpau; +extern const struct vo_driver video_out_xv; +extern const struct vo_driver video_out_opengl; +extern const struct vo_driver video_out_opengl_hq; +extern const struct vo_driver video_out_opengl_old; +extern const struct vo_driver video_out_null; +extern const struct vo_driver video_out_image; +extern const struct vo_driver video_out_lavc; +extern const struct vo_driver video_out_caca; +extern const struct vo_driver video_out_direct3d; +extern const struct vo_driver video_out_direct3d_shaders; +extern const struct vo_driver video_out_sdl; +extern const struct vo_driver video_out_corevideo; +extern const struct vo_driver video_out_vaapi; +extern const struct vo_driver video_out_wayland; + +const struct vo_driver *const video_out_drivers[] = { #if HAVE_VDPAU &video_out_vdpau, diff --git a/video/out/vo.h b/video/out/vo.h index 1a7fdb4901..83e819d8e6 100644 --- a/video/out/vo.h +++ b/video/out/vo.h @@ -288,9 +288,6 @@ void vo_destroy(struct vo *vo); const char *vo_get_window_title(struct vo *vo); -// NULL terminated array of all drivers -extern const struct vo_driver *video_out_drivers[]; - struct mp_keymap { int from; int to; diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c index 19ddb16cbf..80b5ca7f29 100644 --- a/video/out/wayland_common.c +++ b/video/out/wayland_common.c @@ -596,8 +596,7 @@ static const struct wl_registry_listener registry_listener = { static int lookupkey(int key) { - static const char *passthrough_keys - = " -+*/<>`~!@#$%^&()_{}:;\"\',.?\\|=[]"; + const char *passthrough_keys = " -+*/<>`~!@#$%^&()_{}:;\"\',.?\\|=[]"; int mpkey = 0; if ((key >= 'a' && key <= 'z') || diff --git a/video/out/x11_common.c b/video/out/x11_common.c index 90333e8a7c..56ee4833fb 100644 --- a/video/out/x11_common.c +++ b/video/out/x11_common.c @@ -513,7 +513,7 @@ static const struct mp_keymap keymap[] = { static int vo_x11_lookupkey(int key) { - static const char *passthrough_keys = " -+*/<>`~!@#$%^&()_{}:;\"\',.?\\|=[]"; + const char *passthrough_keys = " -+*/<>`~!@#$%^&()_{}:;\"\',.?\\|=[]"; int mpkey = 0; if ((key >= 'a' && key <= 'z') || (key >= 'A' && key <= 'Z') || |