diff options
author | nanahi <130121847+na-na-hi@users.noreply.github.com> | 2024-03-08 02:34:23 -0500 |
---|---|---|
committer | Kacper Michajłow <kasper93@gmail.com> | 2024-03-19 08:58:18 +0100 |
commit | a6f8d1d961022e669196a5e68febc1a48747e46a (patch) | |
tree | 6b6f1ab8ed59dff51e07e40029f991f1c8d07a97 | |
parent | 59f23f5c2933f3bf2806a41ac7234e33318f7466 (diff) | |
download | mpv-a6f8d1d961022e669196a5e68febc1a48747e46a.tar.bz2 mpv-a6f8d1d961022e669196a5e68febc1a48747e46a.tar.xz |
vo_gpu_next: fix -Wembedded-directive warning
warning: embedding a directive within macro arguments has undefined behavior
-rw-r--r-- | video/out/gpu_next/context.c | 19 | ||||
-rw-r--r-- | video/out/vo_gpu_next.c | 18 |
2 files changed, 19 insertions, 18 deletions
diff --git a/video/out/gpu_next/context.c b/video/out/gpu_next/context.c index 597d6d6ed9..2c7c9fa21e 100644 --- a/video/out/gpu_next/context.c +++ b/video/out/gpu_next/context.c @@ -143,18 +143,17 @@ struct gpu_ctx *gpu_ctx_create(struct vo *vo, struct ra_ctx_opts *ctx_opts) #if HAVE_GL && defined(PL_HAVE_OPENGL) if (ra_is_gl(ctx->ra_ctx->ra)) { struct GL *gl = ra_gl_get(ctx->ra_ctx->ra); - pl_opengl opengl = pl_opengl_create(ctx->pllog, - pl_opengl_params( - .debug = ctx_opts->debug, - .allow_software = ctx_opts->allow_sw, - .get_proc_addr_ex = (void *) gl->get_fn, - .proc_ctx = gl->fn_ctx, + struct pl_opengl_params params = *pl_opengl_params( + .debug = ctx_opts->debug, + .allow_software = ctx_opts->allow_sw, + .get_proc_addr_ex = (void *) gl->get_fn, + .proc_ctx = gl->fn_ctx, + ); # if HAVE_EGL - .egl_display = eglGetCurrentDisplay(), - .egl_context = eglGetCurrentContext(), + params.egl_display = eglGetCurrentDisplay(); + params.egl_context = eglGetCurrentContext(); # endif - ) - ); + pl_opengl opengl = pl_opengl_create(ctx->pllog, ¶ms); if (!opengl) goto err_out; ctx->gpu = opengl->gpu; diff --git a/video/out/vo_gpu_next.c b/video/out/vo_gpu_next.c index 8a11e073cf..3c5f558473 100644 --- a/video/out/vo_gpu_next.c +++ b/video/out/vo_gpu_next.c @@ -1002,14 +1002,15 @@ static void draw_frame(struct vo *vo, struct vo_frame *frame) if (!should_draw || !pl_swapchain_start_frame(p->sw, &swframe)) { if (frame->current) { // Advance the queue state to the current PTS to discard unused frames - pl_queue_update(p->queue, NULL, pl_queue_params( + struct pl_queue_params qparams = *pl_queue_params( .pts = frame->current->pts + pts_offset, .radius = pl_frame_mix_radius(¶ms), .vsync_duration = can_interpolate ? frame->ideal_frame_vsync_duration : 0, + ); #if PL_API_VER >= 340 - .drift_compensation = 0, + qparams.drift_compensation = 0; #endif - )); + pl_queue_update(p->queue, NULL, &qparams); } return; } @@ -1035,10 +1036,10 @@ static void draw_frame(struct vo *vo, struct vo_frame *frame) .radius = pl_frame_mix_radius(¶ms), .vsync_duration = can_interpolate ? frame->ideal_frame_vsync_duration : 0, .interpolation_threshold = opts->interpolation_threshold, + ); #if PL_API_VER >= 340 - .drift_compensation = 0, + qparams.drift_compensation = 0; #endif - ); // Depending on the vsync ratio, we may be up to half of the vsync // duration before the current frame time. This works fine because @@ -1295,12 +1296,13 @@ static void video_screenshot(struct vo *vo, struct voctrl_screenshot *args) // Retrieve the current frame from the frame queue struct pl_frame_mix mix; enum pl_queue_status status; - status = pl_queue_update(p->queue, &mix, pl_queue_params( + struct pl_queue_params qparams = *pl_queue_params( .pts = p->last_pts, + ); #if PL_API_VER >= 340 - .drift_compensation = 0, + qparams.drift_compensation = 0; #endif - )); + status = pl_queue_update(p->queue, &mix, &qparams); assert(status != PL_QUEUE_EOF); if (status == PL_QUEUE_ERR) { MP_ERR(vo, "Unknown error occurred while trying to take screenshot!\n"); |