1
mirror of https://github.com/mpv-player/mpv synced 2024-10-30 04:46:41 +01:00

img_format: minor simplification

This commit is contained in:
wm4 2017-06-18 13:58:42 +02:00
parent c680cfd18a
commit 32833fa3d1
3 changed files with 3 additions and 5 deletions

View File

@ -2069,7 +2069,7 @@ static int parse_imgfmt(struct mp_log *log, const m_option_t *opt,
return M_OPT_EXIT;
}
unsigned int fmt = mp_imgfmt_from_name(param, true);
unsigned int fmt = mp_imgfmt_from_name(param);
if (!fmt && !(accept_no && bstr_equals0(param, "no"))) {
mp_err(log, "Option %.*s: unknown format name: '%.*s'\n",
BSTR_P(name), BSTR_P(param));

View File

@ -58,7 +58,7 @@ char **mp_imgfmt_name_list(void)
return list;
}
int mp_imgfmt_from_name(bstr name, bool allow_hwaccel)
int mp_imgfmt_from_name(bstr name)
{
int img_fmt = 0;
for (const struct mp_imgfmt_entry *p = mp_imgfmt_list; p->name; ++p) {
@ -72,8 +72,6 @@ int mp_imgfmt_from_name(bstr name, bool allow_hwaccel)
img_fmt = pixfmt2imgfmt(av_get_pix_fmt(t));
talloc_free(t);
}
if (!allow_hwaccel && IMGFMT_IS_HWACCEL(img_fmt))
return 0;
return img_fmt;
}

View File

@ -236,7 +236,7 @@ static inline bool IMGFMT_IS_RGB(int fmt)
#define IMGFMT_RGB_DEPTH(fmt) (mp_imgfmt_get_desc(fmt).plane_bits)
#define IMGFMT_IS_HWACCEL(fmt) (mp_imgfmt_get_desc(fmt).flags & MP_IMGFLAG_HWACCEL)
int mp_imgfmt_from_name(bstr name, bool allow_hwaccel);
int mp_imgfmt_from_name(bstr name);
char *mp_imgfmt_to_name_buf(char *buf, size_t buf_size, int fmt);
#define mp_imgfmt_to_name(fmt) mp_imgfmt_to_name_buf((char[16]){0}, 16, (fmt))