[MPlayer-dev-eng] [PATCH] -- FreeBSD RTC Support

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Sun Dec 26 11:29:41 CET 2004


Hi,
> > > Hi, This patch enables RTC support for FreeBSD.
> > > I've personally been using rtc with mplayer for almost a year and
> > > it works really well and this has been an option in FreeBSD ports for 
> > > over 9 months now.
> > 
> >    --disable-rtc          disable RTC (/dev/rtc) on Linux [autodetect]
> > +  --disable-bsdrtc       disable BSD style RTC (/dev/rtc) [autodetect]
> 
> I don't like this solution.  Adding another check/option to configure is
> superfluous IMHO.  We should just extend the normal RTC check.  I'll give
> this a shot myself.

Better start with the attached patch... The problem is that those two
are quite different, I see no way you could do this with just one check
and one define...

Greetings,
Reimar Döffinger
-------------- next part --------------
Index: configure
===================================================================
RCS file: /cvsroot/mplayer/main/configure,v
retrieving revision 1.946
diff -u -r1.946 configure
--- configure	23 Dec 2004 15:36:00 -0000	1.946
+++ configure	25 Dec 2004 16:48:37 -0000
@@ -167,6 +167,7 @@
   --disable-tv-bsdbt848  disable BSD BT848 Interface support [autodetect]
   --disable-edl          disable EDL (edit decision list) support [enable]
   --disable-rtc          disable RTC (/dev/rtc) on Linux [autodetect]
+  --disable-bsdrtc       disable BSD style RTC (/dev/rtc) [autodetect]
   --disable-network      disable network support (for: http/mms/rtp) [enable]
   --enable-winsock2      enable winsock2 usage [autodetect]
   --enable-smb           enable Samba (SMB) input support [autodetect]
@@ -1300,6 +1302,7 @@
 _iconv=auto
 _langinfo=auto
 _rtc=auto
+_bsdrtc=auto
 _ossaudio=auto
 _arts=auto
 _esd=auto
@@ -1472,6 +1476,8 @@
   --disable-langinfo)	_langinfo=no	;;
   --enable-rtc)	        _rtc=yes	;;
   --disable-rtc)	_rtc=no	        ;;
+  --enable-bsdrtc)	_bsdrtc=yes	;;
+  --disable-bsdrtc)	_bsdrtc=no      ;;
   --enable-mp1e)	_mp1e=yes	;;
   --disable-mp1e)	_mp1e=no	;;
   --enable-libdv)	_libdv=yes	;;
@@ -5000,7 +5012,6 @@
 
 
 echocheck "RTC"
-if linux ; then
   if test "$_rtc" = auto ; then
     cat > $TMPC << EOF
 #include <sys/ioctl.h>
@@ -5010,17 +5021,36 @@
     _rtc=no
     cc_check && _rtc=yes
   fi
-  echores "$_rtc"
-else
-  _rtc=no
-  echores "no (Linux specific feature)"
-fi
 if test "$_rtc" = yes ; then
   _def_rtc='#define HAVE_RTC 1'
+  _bsdrtc=no
 else
   _def_rtc='#undef HAVE_RTC'
 fi
 
+if test "$_bsdrtc" = auto ; then
+    cat > $TMPC << EOF
+#include <sys/ioctl.h>
+#include <rtc.h>
+int main(void) { return RTCIO_IRQP_SET; }
+EOF
+    _bsdrtc=no
+    cc_check && _bsdrtc=yes
+fi
+if test "$_bsdrtc" = yes ; then
+  _def_bsdrtc='#define HAVE_BSDRTC 1'
+  _def_rtc='#define HAVE_RTC 1'
+else
+  _def_bsdrtc='#undef HAVE_BSDRTC'
+fi
+
+if test "$_rtc" = yes ; then
+  echores "yes"
+elif test "$_bsdrtc" = yes ; then
+  echores "yes (BSD style)"
+else
+  echores "no"
+fi
 
 echocheck "external liblzo support"
 if test "$_liblzo" = auto ; then
@@ -6841,9 +6871,13 @@
 /* define this to use nl_langinfo function */
 $_def_langinfo
 
-/* define this to use RTC (/dev/rtc) for video timers (LINUX only) */
+/* define this to use RTC (/dev/rtc) for video timers */
 $_def_rtc
 
+/* define this, together with the above,
+   if you have BSD style RTC headers (RTCIO_*) */
+$_def_bsdrtc
+
 /* set up max. outburst. use 65536 for ALSA 0.5, for others 16384 is enough */
 #define MAX_OUTBURST 65536
 
Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.821
diff -u -r1.821 mplayer.c
--- mplayer.c	21 Dec 2004 12:25:58 -0000	1.821
+++ mplayer.c	25 Dec 2004 16:48:51 -0000
@@ -93,8 +93,14 @@
 #define ROUND(x) ((int)((x)<0 ? (x)-0.5 : (x)+0.5))
 
 #ifdef HAVE_RTC
+#ifdef HAVE_BSDRTC
+#include <rtc.h>
+#define RTC_IRQP_SET RTCIO_IRQP_SET
+#define RTC_PIE_ON RTCIO_PIE_ON
+#else
 #include <linux/rtc.h>
 #endif
+#endif
 
 #ifdef USE_TV
 #include "libmpdemux/tv.h"


More information about the MPlayer-dev-eng mailing list