diff options
author | wm4 <wm4@mplayer2.org> | 2011-10-22 23:44:27 +0200 |
---|---|---|
committer | wm4 <wm4@mplayer2.org> | 2012-03-17 20:58:16 +0100 |
commit | 0d929bc53211ed9bc8f8c3efe538698dd7b7b401 (patch) | |
tree | f84e38d7b4bb2b34dff7c52a9d8b93a2a2017535 | |
parent | c9ba8ac9d76d92821868fba0ec3b3dc9ab16f048 (diff) | |
download | mpv-0d929bc53211ed9bc8f8c3efe538698dd7b7b401.tar.bz2 mpv-0d929bc53211ed9bc8f8c3efe538698dd7b7b401.tar.xz |
vo_direct3d: minor cleanup
The code assumed the last format passed to query_format will be the one
that is used on playback. This is probably true and thus didn't cause any
bugs, but make query_format side effect free just like the other VOs.
-rw-r--r-- | libvo/vo_direct3d.c | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/libvo/vo_direct3d.c b/libvo/vo_direct3d.c index 2fb40d0398..02763734cd 100644 --- a/libvo/vo_direct3d.c +++ b/libvo/vo_direct3d.c @@ -609,12 +609,7 @@ skip_upload: return VO_TRUE; } - -/** @brief Query if movie colorspace is supported by the HW. - * @return 0 on failure, device capabilities (not probed - * currently) on success. - */ -static int query_format(uint32_t movie_fmt) +static const struct_fmt_table *check_format(uint32_t movie_fmt) { int i; for (i = 0; i < DISPLAY_FORMAT_TABLE_ENTRIES; i++) { @@ -628,21 +623,33 @@ static int query_format(uint32_t movie_fmt) priv->desktop_fmt))) { mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>Rejected image format: %s\n", vo_format_name(fmt_table[i].mplayer_fmt)); - return 0; + return NULL; } - priv->movie_src_fmt = fmt_table[i].fourcc; mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>Accepted image format: %s\n", vo_format_name(fmt_table[i].mplayer_fmt)); - return (VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW - | VFCAP_OSD | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN); + return &fmt_table[i]; } } return 0; } + +/** @brief Query if movie colorspace is supported by the HW. + * @return 0 on failure, device capabilities (not probed + * currently) on success. + */ +static int query_format(uint32_t movie_fmt) +{ + if (!check_format(movie_fmt)) + return 0; + + return (VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW + | VFCAP_OSD | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN); +} + /**************************************************************************** * * * * @@ -825,6 +832,12 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, priv->src_width = width; priv->src_height = height; + const struct_fmt_table *fmt_entry = check_format(format); + if (!fmt_entry) + return VO_ERROR; + + priv->movie_src_fmt = fmt_entry->fourcc; + /* w32_common framework call. Creates window on the screen with * the given coordinates. */ |