History

vo_{drm,wlshm}: make query_format checks more correct

We're using mp_sws here, so we should ask it for format support and not the underlying library (usually swscale) directly.

sfan5 committed 2 years ago

Commit 830f6cc1 parent aa75a0e2 files · +7 −6Browse files

Unified · Split

2 files
  1. video/out/vo_drm.c +2 −2
  2. video/out/vo_wlshm.c +5 −4
video/out/vo_drm.c+2−2
@@ -24,7 +24,6 @@ · 23 unmodified lines
2424 #include <unistd.h>
2525
2626 #include <drm_fourcc.h>
27−#include <libswscale/swscale.h>
2827
2928 #include "common/msg.h"
3029 #include "drm_atomic.h"
@@ -422,7 +421,8 @@ err: · 391 unmodified lines
422421
423422 static int query_format(struct vo *vo, int format)
424423 {
425− return sws_isSupportedInput(imgfmt2pixfmt(format));
424+ struct priv *p = vo->priv;
425+ return mp_sws_supports_formats(p->sws, p->imgfmt, format) ? 1 : 0;
426426 }
427427
428428 static int control(struct vo *vo, uint32_t request, void *arg)
video/out/vo_wlshm.c+5−4
@@ -21,8 +21,6 @@ · 20 unmodified lines
2121 #include <time.h>
2222 #include <unistd.h>
2323
24−#include <libswscale/swscale.h>
25−
2624 #include "osdep/endian.h"
2725 #include "present_sync.h"
2826 #include "sub/osd.h"
@@ -32,6 +30,8 @@ · 3 unmodified lines
3230 #include "vo.h"
3331 #include "wayland_common.h"
3432
33+#define IMGFMT_WL_RGB MP_SELECT_LE_BE(IMGFMT_BGR0, IMGFMT_0RGB)
34+
3535 struct buffer {
3636 struct vo *vo;
3737 size_t size;
@@ -164,7 +164,8 @@ err: · 126 unmodified lines
164164
165165 static int query_format(struct vo *vo, int format)
166166 {
167− return sws_isSupportedInput(imgfmt2pixfmt(format));
167+ struct priv *p = vo->priv;
168+ return mp_sws_supports_formats(p->sws, IMGFMT_WL_RGB, format) ? 1 : 0;
168169 }
169170
170171 static int reconfig(struct vo *vo, struct mp_image_params *params)
@@ -197,7 +198,7 @@ static int resize(struct vo *vo) · 26 unmodified lines
197198 vo_get_src_dst_rects(vo, &p->src, &p->dst, &p->osd);
198199
199200 p->sws->dst = (struct mp_image_params) {
200− .imgfmt = MP_SELECT_LE_BE(IMGFMT_BGR0, IMGFMT_0RGB),
201+ .imgfmt = IMGFMT_WL_RGB,
201202 .w = width,
202203 .h = height,
203204 .p_w = 1,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t