mirror of https://github.com/mpv-player/mpv
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.)
This commit is contained in:
parent
7349d39938
commit
614f847516
|
@ -880,10 +880,6 @@ const m_option_t mplayer_opts[]={
|
||||||
OPT_INTRANGE("autosync", autosync, 0, 0, 10000),
|
OPT_INTRANGE("autosync", autosync, 0, 0, 10000),
|
||||||
|
|
||||||
OPT_FLAG_ON("softsleep", softsleep, 0),
|
OPT_FLAG_ON("softsleep", softsleep, 0),
|
||||||
#ifdef HAVE_RTC
|
|
||||||
OPT_MAKE_FLAGS("rtc", rtc, 0),
|
|
||||||
OPT_STRING("rtc-device", rtc_device, 0),
|
|
||||||
#endif
|
|
||||||
|
|
||||||
OPT_CHOICE("term-osd", term_osd, M_OPT_IMPLICIT_DEFAULT,
|
OPT_CHOICE("term-osd", term_osd, M_OPT_IMPLICIT_DEFAULT,
|
||||||
({"force", 1},
|
({"force", 1},
|
||||||
|
|
|
@ -309,7 +309,6 @@ Optional features:
|
||||||
--disable-tv-v4l2 disable Video4Linux2 TV interface [autodetect]
|
--disable-tv-v4l2 disable Video4Linux2 TV interface [autodetect]
|
||||||
--disable-tv-bsdbt848 disable BSD BT848 interface [autodetect]
|
--disable-tv-bsdbt848 disable BSD BT848 interface [autodetect]
|
||||||
--disable-pvr disable Video4Linux2 MPEG PVR [autodetect]
|
--disable-pvr disable Video4Linux2 MPEG PVR [autodetect]
|
||||||
--disable-rtc disable RTC (/dev/rtc) on Linux [autodetect]
|
|
||||||
--disable-networking disable networking [enable]
|
--disable-networking disable networking [enable]
|
||||||
--enable-winsock2_h enable winsock2_h [autodetect]
|
--enable-winsock2_h enable winsock2_h [autodetect]
|
||||||
--enable-smb enable Samba (SMB) input [autodetect]
|
--enable-smb enable Samba (SMB) input [autodetect]
|
||||||
|
@ -486,7 +485,6 @@ _dvb=auto
|
||||||
_v4l2=auto
|
_v4l2=auto
|
||||||
_iconv=auto
|
_iconv=auto
|
||||||
_langinfo=auto
|
_langinfo=auto
|
||||||
_rtc=auto
|
|
||||||
_ossaudio=auto
|
_ossaudio=auto
|
||||||
_rsound=auto
|
_rsound=auto
|
||||||
_pulse=auto
|
_pulse=auto
|
||||||
|
@ -737,8 +735,6 @@ for ac_option do
|
||||||
--disable-iconv) _iconv=no ;;
|
--disable-iconv) _iconv=no ;;
|
||||||
--enable-langinfo) _langinfo=yes ;;
|
--enable-langinfo) _langinfo=yes ;;
|
||||||
--disable-langinfo) _langinfo=no ;;
|
--disable-langinfo) _langinfo=no ;;
|
||||||
--enable-rtc) _rtc=yes ;;
|
|
||||||
--disable-rtc) _rtc=no ;;
|
|
||||||
--enable-libdv) _libdv=yes ;;
|
--enable-libdv) _libdv=yes ;;
|
||||||
--disable-libdv) _libdv=no ;;
|
--disable-libdv) _libdv=no ;;
|
||||||
--enable-ossaudio) _ossaudio=yes ;;
|
--enable-ossaudio) _ossaudio=yes ;;
|
||||||
|
@ -3389,30 +3385,6 @@ fi
|
||||||
echores "$_zlib"
|
echores "$_zlib"
|
||||||
|
|
||||||
|
|
||||||
echocheck "RTC"
|
|
||||||
if test "$_rtc" = auto ; then
|
|
||||||
cat > $TMPC << EOF
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
#ifdef __linux__
|
|
||||||
#include <linux/rtc.h>
|
|
||||||
#else
|
|
||||||
#include <rtc.h>
|
|
||||||
#define RTC_PIE_ON RTCIO_PIE_ON
|
|
||||||
#endif
|
|
||||||
int main(void) { return RTC_PIE_ON; }
|
|
||||||
EOF
|
|
||||||
_rtc=no
|
|
||||||
cc_check && _rtc=yes
|
|
||||||
ppc && _rtc=no
|
|
||||||
fi
|
|
||||||
if test "$_rtc" = yes ; then
|
|
||||||
def_rtc='#define HAVE_RTC 1'
|
|
||||||
else
|
|
||||||
def_rtc='#undef HAVE_RTC'
|
|
||||||
fi
|
|
||||||
echores "$_rtc"
|
|
||||||
|
|
||||||
|
|
||||||
echocheck "mad support"
|
echocheck "mad support"
|
||||||
if test "$_mad" = auto ; then
|
if test "$_mad" = auto ; then
|
||||||
_mad=no
|
_mad=no
|
||||||
|
@ -4629,7 +4601,6 @@ $def_macosx_finder
|
||||||
$def_priority
|
$def_priority
|
||||||
$def_quicktime
|
$def_quicktime
|
||||||
$def_restrict_keyword
|
$def_restrict_keyword
|
||||||
$def_rtc
|
|
||||||
|
|
||||||
|
|
||||||
/* configurable options */
|
/* configurable options */
|
||||||
|
|
91
mplayer.c
91
mplayer.c
|
@ -109,16 +109,6 @@ float start_volume = -1;
|
||||||
|
|
||||||
char *heartbeat_cmd;
|
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/tv.h"
|
||||||
#include "stream/stream_radio.h"
|
#include "stream/stream_radio.h"
|
||||||
#ifdef CONFIG_DVBIN
|
#ifdef CONFIG_DVBIN
|
||||||
|
@ -1975,41 +1965,22 @@ static int check_framedrop(struct MPContext *mpctx, double frame_time)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_RTC
|
|
||||||
int rtc_fd = -1;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static float timing_sleep(struct MPContext *mpctx, float time_frame)
|
static float timing_sleep(struct MPContext *mpctx, float time_frame)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_RTC
|
// assume kernel HZ=100 for softsleep, works with larger HZ but with
|
||||||
if (rtc_fd >= 0) {
|
// unnecessarily high CPU usage
|
||||||
// -------- RTC -----------
|
struct MPOpts *opts = &mpctx->opts;
|
||||||
while (time_frame > 0.000) {
|
float margin = opts->softsleep ? 0.011 : 0;
|
||||||
unsigned long rtc_ts;
|
while (time_frame > margin) {
|
||||||
if (read(rtc_fd, &rtc_ts, sizeof(rtc_ts)) <= 0)
|
usec_sleep(1000000 * (time_frame - margin));
|
||||||
mp_tmsg(MSGT_CPLAYER, MSGL_ERR,
|
time_frame -= get_relative_time(mpctx);
|
||||||
"Linux RTC read error: %s\n", strerror(errno));
|
}
|
||||||
time_frame -= get_relative_time(mpctx);
|
if (opts->softsleep) {
|
||||||
}
|
if (time_frame < 0)
|
||||||
} else
|
mp_tmsg(MSGT_AVSYNC, MSGL_WARN,
|
||||||
#endif
|
"Warning! Softsleep underflow!\n");
|
||||||
{
|
while (time_frame > 0)
|
||||||
// assume kernel HZ=100 for softsleep, works with larger HZ but with
|
time_frame -= get_relative_time(mpctx); // burn the CPU
|
||||||
// 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;
|
return time_frame;
|
||||||
}
|
}
|
||||||
|
@ -3872,40 +3843,6 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
mpctx->osd = osd_create(opts, mpctx->ass_library);
|
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
|
#ifdef HAVE_TERMCAP
|
||||||
load_termcap(NULL); // load key-codes
|
load_termcap(NULL); // load key-codes
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -62,8 +62,6 @@ typedef struct MPOpts {
|
||||||
float hr_seek_demuxer_offset;
|
float hr_seek_demuxer_offset;
|
||||||
int autosync;
|
int autosync;
|
||||||
int softsleep;
|
int softsleep;
|
||||||
int rtc;
|
|
||||||
char *rtc_device;
|
|
||||||
int term_osd;
|
int term_osd;
|
||||||
char *term_osd_esc;
|
char *term_osd_esc;
|
||||||
char *playing_msg;
|
char *playing_msg;
|
||||||
|
|
Loading…
Reference in New Issue