summaryrefslogtreecommitdiffstats
path: root/mplayer.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-07-29 18:48:50 +0200
committerwm4 <wm4@nowhere>2012-07-30 01:42:54 +0200
commit614f847516b7ed98784b8d491a417e037ff2f391 (patch)
treec258f29d0c25158d5ae994719df34b02d8146668 /mplayer.c
parent7349d39938ae61b90778ddef5cf427e37cd96c75 (diff)
downloadmpv-614f847516b7ed98784b8d491a417e037ff2f391.tar.bz2
mpv-614f847516b7ed98784b8d491a417e037ff2f391.tar.xz
mplayer: remove Linux RTC support
This used /dev/rtc for timing. /dev/rtc root only by default, and I have a hard time believing that the standard OS functions are not good enough. (Even if not, support for POSIX high resolution timers should be added instead, see clock_gettime() and others.)
Diffstat (limited to 'mplayer.c')
-rw-r--r--mplayer.c91
1 files changed, 14 insertions, 77 deletions
diff --git a/mplayer.c b/mplayer.c
index c15ad7db17..aabc0de936 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -109,16 +109,6 @@ float start_volume = -1;
char *heartbeat_cmd;
-#ifdef HAVE_RTC
-#ifdef __linux__
-#include <linux/rtc.h>
-#else
-#include <rtc.h>
-#define RTC_IRQP_SET RTCIO_IRQP_SET
-#define RTC_PIE_ON RTCIO_PIE_ON
-#endif /* __linux__ */
-#endif /* HAVE_RTC */
-
#include "stream/tv.h"
#include "stream/stream_radio.h"
#ifdef CONFIG_DVBIN
@@ -1975,41 +1965,22 @@ static int check_framedrop(struct MPContext *mpctx, double frame_time)
return 0;
}
-
-#ifdef HAVE_RTC
-int rtc_fd = -1;
-#endif
-
static float timing_sleep(struct MPContext *mpctx, float time_frame)
{
-#ifdef HAVE_RTC
- if (rtc_fd >= 0) {
- // -------- RTC -----------
- while (time_frame > 0.000) {
- unsigned long rtc_ts;
- if (read(rtc_fd, &rtc_ts, sizeof(rtc_ts)) <= 0)
- mp_tmsg(MSGT_CPLAYER, MSGL_ERR,
- "Linux RTC read error: %s\n", strerror(errno));
- time_frame -= get_relative_time(mpctx);
- }
- } else
-#endif
- {
- // assume kernel HZ=100 for softsleep, works with larger HZ but with
- // unnecessarily high CPU usage
- struct MPOpts *opts = &mpctx->opts;
- float margin = opts->softsleep ? 0.011 : 0;
- while (time_frame > margin) {
- usec_sleep(1000000 * (time_frame - margin));
- time_frame -= get_relative_time(mpctx);
- }
- if (opts->softsleep) {
- if (time_frame < 0)
- mp_tmsg(MSGT_AVSYNC, MSGL_WARN,
- "Warning! Softsleep underflow!\n");
- while (time_frame > 0)
- time_frame -= get_relative_time(mpctx); // burn the CPU
- }
+ // assume kernel HZ=100 for softsleep, works with larger HZ but with
+ // unnecessarily high CPU usage
+ struct MPOpts *opts = &mpctx->opts;
+ float margin = opts->softsleep ? 0.011 : 0;
+ while (time_frame > margin) {
+ usec_sleep(1000000 * (time_frame - margin));
+ time_frame -= get_relative_time(mpctx);
+ }
+ if (opts->softsleep) {
+ if (time_frame < 0)
+ mp_tmsg(MSGT_AVSYNC, MSGL_WARN,
+ "Warning! Softsleep underflow!\n");
+ while (time_frame > 0)
+ time_frame -= get_relative_time(mpctx); // burn the CPU
}
return time_frame;
}
@@ -3872,40 +3843,6 @@ int main(int argc, char *argv[])
mpctx->osd = osd_create(opts, mpctx->ass_library);
-#ifdef HAVE_RTC
- if (opts->rtc) {
- char *rtc_device = opts->rtc_device;
- // seteuid(0); /* Can't hurt to try to get root here */
- if ((rtc_fd = open(rtc_device ? rtc_device : "/dev/rtc", O_RDONLY)) < 0)
- mp_tmsg(MSGT_CPLAYER, MSGL_WARN, "Failed to open %s: %s "
- "(it should be readable by the user.)\n",
- rtc_device ? rtc_device : "/dev/rtc", strerror(errno));
- else {
- unsigned long irqp = 1024; /* 512 seemed OK. 128 is jerky. */
-
- if (ioctl(rtc_fd, RTC_IRQP_SET, irqp) < 0) {
- mp_tmsg(MSGT_CPLAYER, MSGL_WARN, "Linux RTC init error in "
- "ioctl (rtc_irqp_set %lu): %s\n",
- irqp, strerror(errno));
- mp_tmsg(MSGT_CPLAYER, MSGL_HINT, "Try adding \"echo %lu > /proc/sys/dev/rtc/max-user-freq\" to your system startup scripts.\n", irqp);
- close(rtc_fd);
- rtc_fd = -1;
- } else if (ioctl(rtc_fd, RTC_PIE_ON, 0) < 0) {
- /* variable only by the root */
- mp_tmsg(MSGT_CPLAYER, MSGL_ERR, "Linux RTC init error in "
- "ioctl (rtc_pie_on): %s\n", strerror(errno));
- close(rtc_fd);
- rtc_fd = -1;
- } else
- mp_tmsg(MSGT_CPLAYER, MSGL_V,
- "Using Linux hardware RTC timing (%ldHz).\n", irqp);
- }
- }
- if (rtc_fd < 0)
-#endif /* HAVE_RTC */
- mp_msg(MSGT_CPLAYER, MSGL_V, "Using %s timing\n",
- opts->softsleep ? "software" : timer_name);
-
#ifdef HAVE_TERMCAP
load_termcap(NULL); // load key-codes
#endif