mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-09-19 20:32:15 +02:00
libobs,libobs-opengl,obs-ffmpeg-mux: Calm deprecation warnings on *nix
Calm libobs-opengl deprecation warnings on macOS. Calm FFmpeg deprecation warning with LIBAVFORMAT_VERSION_MAJOR < 59.
This commit is contained in:
parent
541b3292e9
commit
c648222332
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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 <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user