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.
This commit is contained in:
sfan5 2024-03-11 21:13:39 +01:00
parent aa75a0e9d2
commit 830f6ccd6b
2 changed files with 7 additions and 6 deletions

View File

@ -24,7 +24,6 @@
#include <unistd.h>
#include <drm_fourcc.h>
#include <libswscale/swscale.h>
#include "common/msg.h"
#include "drm_atomic.h"
@ -422,7 +421,8 @@ err:
static int query_format(struct vo *vo, int format)
{
return sws_isSupportedInput(imgfmt2pixfmt(format));
struct priv *p = vo->priv;
return mp_sws_supports_formats(p->sws, p->imgfmt, format) ? 1 : 0;
}
static int control(struct vo *vo, uint32_t request, void *arg)

View File

@ -21,8 +21,6 @@
#include <time.h>
#include <unistd.h>
#include <libswscale/swscale.h>
#include "osdep/endian.h"
#include "present_sync.h"
#include "sub/osd.h"
@ -32,6 +30,8 @@
#include "vo.h"
#include "wayland_common.h"
#define IMGFMT_WL_RGB MP_SELECT_LE_BE(IMGFMT_BGR0, IMGFMT_0RGB)
struct buffer {
struct vo *vo;
size_t size;
@ -164,7 +164,8 @@ err:
static int query_format(struct vo *vo, int format)
{
return sws_isSupportedInput(imgfmt2pixfmt(format));
struct priv *p = vo->priv;
return mp_sws_supports_formats(p->sws, IMGFMT_WL_RGB, format) ? 1 : 0;
}
static int reconfig(struct vo *vo, struct mp_image_params *params)
@ -197,7 +198,7 @@ static int resize(struct vo *vo)
vo_get_src_dst_rects(vo, &p->src, &p->dst, &p->osd);
p->sws->dst = (struct mp_image_params) {
.imgfmt = MP_SELECT_LE_BE(IMGFMT_BGR0, IMGFMT_0RGB),
.imgfmt = IMGFMT_WL_RGB,
.w = width,
.h = height,
.p_w = 1,