diff options
author | arpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-08-22 23:03:51 +0000 |
---|---|---|
committer | arpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-08-22 23:03:51 +0000 |
commit | 4ae1571dda7f29737939a91445bef2885bd0ebea (patch) | |
tree | 68fb4755bab37729823af59c011f06333cabd1e2 /libvo/video_out.c | |
parent | 0e6edc2840af15cd9d175219521627bbc94454b2 (diff) | |
download | mpv-4ae1571dda7f29737939a91445bef2885bd0ebea.tar.bz2 mpv-4ae1571dda7f29737939a91445bef2885bd0ebea.tar.xz |
General Timing Formula algorithm from a scratch.
vo_vesa.c so now adjust the timing to highest possible refresh rate using
the monitor capabilities from a config file.
patch by Rudolf Marek <MAREKR2@cs.felk.cvut.cz>
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@7070 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo/video_out.c')
-rw-r--r-- | libvo/video_out.c | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/libvo/video_out.c b/libvo/video_out.c index ad4aaf489c..8e4539a814 100644 --- a/libvo/video_out.c +++ b/libvo/video_out.c @@ -201,3 +201,85 @@ void libvo_register_options(void* cfg) { vo_dxr2_register_options(cfg); #endif } +#if defined(HAVE_FBDEV)||defined(HAVE_VESA) +/* Borrowed from vo_fbdev.c +Monitor ranges related functions*/ + +char *monitor_hfreq_str = NULL; +char *monitor_vfreq_str = NULL; +char *monitor_dotclock_str = NULL; + +float range_max(range_t *r) +{ +float max = 0; + + for (/* NOTHING */; (r->min != -1 && r->max != -1); r++) + if (max < r->max) max = r->max; + return max; +} + + +int in_range(range_t *r, float f) +{ + for (/* NOTHING */; (r->min != -1 && r->max != -1); r++) + if (f >= r->min && f <= r->max) + return 1; + return 0; +} + +range_t *str2range(char *s) +{ + float tmp_min, tmp_max; + char *endptr = s; // to start the loop + range_t *r = NULL; + int i; + + if (!s) + return NULL; + for (i = 0; *endptr; i++) { + if (*s == ',') + goto out_err; + if (!(r = (range_t *) realloc(r, sizeof(*r) * (i + 2)))) { + printf("can't realloc 'r'\n"); + return NULL; + } + tmp_min = strtod(s, &endptr); + if (*endptr == 'k' || *endptr == 'K') { + tmp_min *= 1000.0; + endptr++; + } else if (*endptr == 'm' || *endptr == 'M') { + tmp_min *= 1000000.0; + endptr++; + } + if (*endptr == '-') { + tmp_max = strtod(endptr + 1, &endptr); + if (*endptr == 'k' || *endptr == 'K') { + tmp_max *= 1000.0; + endptr++; + } else if (*endptr == 'm' || *endptr == 'M') { + tmp_max *= 1000000.0; + endptr++; + } + if (*endptr != ',' && *endptr) + goto out_err; + } else if (*endptr == ',' || !*endptr) { + tmp_max = tmp_min; + } else + goto out_err; + r[i].min = tmp_min; + r[i].max = tmp_max; + if (r[i].min < 0 || r[i].max < 0) + goto out_err; + s = endptr + 1; + } + r[i].min = r[i].max = -1; + return r; +out_err: + if (r) + free(r); + return NULL; +} + +/* Borrowed from vo_fbdev.c END */ +#endif + |