img_format: minor simplification

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

No files matched your search

+1 -1
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));
+1 -3
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;
}
+1 -1
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))