diff --git a/libobs-opengl/gl-cocoa.m b/libobs-opengl/gl-cocoa.m index 599ba9525..a3c19ca10 100644 --- a/libobs-opengl/gl-cocoa.m +++ b/libobs-opengl/gl-cocoa.m @@ -92,7 +92,10 @@ struct gl_platform *gl_platform_create(gs_device_t *device, uint32_t adapter) [context makeCurrentContext]; GLint interval = 0; + PRAGMA_WARN_PUSH + PRAGMA_WARN_DEPRECATION [context setValues:&interval forParameter:NSOpenGLCPSwapInterval]; + PRAGMA_WARN_POP const bool success = gladLoadGL() != 0; if (!success) { @@ -138,10 +141,13 @@ bool gl_platform_init_swapchain(struct gs_swap_chain *swap) CGLLockContext(context_obj); [context makeCurrentContext]; + PRAGMA_WARN_PUSH + PRAGMA_WARN_DEPRECATION [context setView:swap->wi->view]; GLint interval = 0; [context setValues:&interval forParameter:NSOpenGLCPSwapInterval]; + PRAGMA_WARN_POP gl_gen_framebuffers(1, &swap->wi->fbo); gl_bind_framebuffer(GL_FRAMEBUFFER, swap->wi->fbo); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, @@ -199,7 +205,10 @@ struct gl_windowinfo *gl_windowinfo_create(const struct gs_init_data *info) wi->view = info->window.view; wi->view.window.colorSpace = NSColorSpace.sRGBColorSpace; + PRAGMA_WARN_PUSH + PRAGMA_WARN_DEPRECATION wi->view.wantsBestResolutionOpenGLSurface = YES; + PRAGMA_WARN_POP return wi; } diff --git a/libobs/obs-nix-platform.c b/libobs/obs-nix-platform.c index 52a8d841f..0db6dd0d4 100644 --- a/libobs/obs-nix-platform.c +++ b/libobs/obs-nix-platform.c @@ -25,7 +25,10 @@ static void *obs_nix_platform_display = NULL; void obs_set_nix_platform(enum obs_nix_platform_type platform) { + PRAGMA_WARN_PUSH + PRAGMA_WARN_DEPRECATION assert(platform != OBS_NIX_PLATFORM_X11_GLX); + PRAGMA_WARN_POP obs_nix_platform = platform; } diff --git a/libobs/util/c99defs.h b/libobs/util/c99defs.h index 6d1fabf0c..a05a1cdfc 100644 --- a/libobs/util/c99defs.h +++ b/libobs/util/c99defs.h @@ -51,6 +51,26 @@ #define EXPORT __attribute__((visibility("default"))) #endif +#ifdef _MSC_VER +#define PRAGMA_WARN_PUSH __pragma(warning(push)) +#define PRAGMA_WARN_POP __pragma(warning(pop)) +#define PRAGMA_WARN_DEPRECATION +#elif defined(__clang__) +#define PRAGMA_WARN_PUSH _Pragma("clang diagnostic push") +#define PRAGMA_WARN_POP _Pragma("clang diagnostic pop") +#define PRAGMA_WARN_DEPRECATION \ + _Pragma("clang diagnostic warning \"-Wdeprecated-declarations\"") +#elif defined(__GNUC__) +#define PRAGMA_WARN_PUSH _Pragma("GCC diagnostic push") +#define PRAGMA_WARN_POP _Pragma("GCC diagnostic pop") +#define PRAGMA_WARN_DEPRECATION \ + _Pragma("GCC diagnostic warning \"-Wdeprecated-declarations\"") +#else +#define PRAGMA_WARN_PUSH +#define PRAGMA_WARN_POP +#define PRAGMA_WARN_DEPRECATION +#endif + #include #include #include diff --git a/plugins/obs-ffmpeg/ffmpeg-mux/ffmpeg-mux.c b/plugins/obs-ffmpeg/ffmpeg-mux/ffmpeg-mux.c index 0f7bc5450..a2287a66d 100644 --- a/plugins/obs-ffmpeg/ffmpeg-mux/ffmpeg-mux.c +++ b/plugins/obs-ffmpeg/ffmpeg-mux/ffmpeg-mux.c @@ -472,7 +472,10 @@ static void create_video_stream(struct ffmpeg_mux *ffm) ffm->video_stream->time_base = context->time_base; #if LIBAVFORMAT_VERSION_MAJOR < 59 // codec->time_base may still be used if LIBAVFORMAT_VERSION_MAJOR < 59 + PRAGMA_WARN_PUSH + PRAGMA_WARN_DEPRECATION ffm->video_stream->codec->time_base = context->time_base; + PRAGMA_WARN_POP #endif ffm->video_stream->avg_frame_rate = av_inv_q(context->time_base);