changeset 22948:0f9bd35f971a

Rework of *BSD BT848 detection for radio:// to reuse recently added BT848 interface headers detection code.
author voroshil
date Wed, 11 Apr 2007 05:39:09 +0000
parents ca7c2ec2c66b
children 6613c5397aba
files configure stream/stream_radio.c
diffstat 2 files changed, 29 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/configure	Tue Apr 10 17:54:02 2007 +0000
+++ b/configure	Wed Apr 11 05:39:09 2007 +0000
@@ -6876,29 +6876,31 @@
 echores "$_radio_v4l"
 
 if bsd && test "$_radio" = yes && test "$_radio_bsdbt848" = auto ; then
-echocheck "*BSD BrookTree 848 Radio interface header"
-  for file in "dev/ic/bt8xx.h" \
-              "machine/ioctl_bt848.h" \
-              "dev/bktr/ioctl_bt848.h" \
-              "dev/video/bktr/ioctl_bt848.h" ; do
+echocheck "*BSD BrookTree 848 Radio interface"
+   _radio_bsdbt848=no
     cat > $TMPC <<EOF
 #include <sys/types.h>
-#include <$file>
-int main(void) { return 0; }
-EOF
-    cc_check && _radio_bsdbt848_hdr=$file
-  done
-echores "$_radio_bsdbt848_hdr"
+$_def_ioctl_bt848_h_name
+#ifdef IOCTL_BT848_H_NAME
+#include IOCTL_BT848_H_NAME
+#endif
+int main(void){
+ ioctl(0, RADIO_GETFREQ, 0);
+ return 0; 
+}
+EOF
+    cc_check && _radio_bsdbt848=yes
+echores "$_radio_bsdbt848"
 fi #if bsd && radio && radio_bsdbt848
 
-if test -n "$_radio_bsdbt848_hdr"  ; then
-  _def_radio_bsdbt848="#define RADIO_BSDBT848_HDR <$_radio_bsdbt848_hdr>"
-else
-  _def_radio_bsdbt848='#undef RADIO_BSDBT848_HDR '
+if test "$_radio_bsdbt848" = yes ; then
+  _def_radio_bsdbt848='#define HAVE_RADIO_BSDBT848 1'
+else
+  _def_radio_bsdbt848='#undef HAVE_RADIO_BSDBT848'
 fi
 
 if test "$_radio_v4l" = no && test "$_radio_v4l2" = no && \
-   test -z "$_radio_bsdbt848_hdr" && test "$_radio" = yes ; then
+   test "$_radio_bsdbt848" = no && test "$_radio" = yes ; then
     die "Radio driver requires BSD BT848,  V4L or V4L2!"
 fi
 
--- a/stream/stream_radio.c	Tue Apr 10 17:54:02 2007 +0000
+++ b/stream/stream_radio.c	Wed Apr 11 05:39:09 2007 +0000
@@ -34,11 +34,13 @@
 #include <errno.h>
 #include <unistd.h>
 
-#ifdef RADIO_BSDBT848_HDR
+#ifdef HAVE_RADIO_BSDBT848
 #include <sys/param.h>
-#include RADIO_BSDBT848_HDR
+#ifdef IOCTL_BT848_H_NAME
+#include IOCTL_BT848_H_NAME
+#endif
 
-#else // RADIO_BSDBT848_HDR
+#else // HAVE_RADIO_BSDBT848
 
 #include <linux/types.h>
 
@@ -51,7 +53,7 @@
 #warning  "V4L is deprecated and will be removed in future"
 #endif
 
-#endif // !RADIO_BSDBT848_HDR
+#endif // !IOCTL_BT848_H_NAME
 
 
 #include "stream.h"
@@ -85,7 +87,7 @@
     struct radio_channels_s * prev;
 } radio_channels_t;
 
-#ifdef RADIO_BSDBT848_HDR
+#ifdef HAVE_RADIO_BSDBT848
 /** (device,string, "/dev/tuner0") name of radio device file */
 char*   radio_param_device="/dev/tuner0";
 /** radio_param_freq_min (freq_min,float,87.5) minimal allowed frequency */
@@ -552,7 +554,8 @@
     get_frequency_v4l
 };
 #endif //HAVE_RADIO_V4L
-#ifdef RADIO_BSDBT848_HDR
+#ifdef HAVE_RADIO_BSDBT848
+
 /*****************************************************************
  * \brief get fraction value for using in set_frequency and get_frequency
  * \return STREAM_OK if success, STREAM_ERROR otherwise
@@ -662,7 +665,7 @@
     set_frequency_bsdbt848,
     get_frequency_bsdbt848
 };
-#endif //RADIO_BSDBT848_HDR
+#endif //HAVE_RADIO_BSDBT848
 
 static inline int init_frac(radio_priv_t* priv){ 
     return priv->driver->init_frac(priv);
@@ -1087,7 +1090,7 @@
  when no driver explicitly specified first available will be used
  */
 static const radio_driver_t* radio_drivers[]={
-#ifdef RADIO_BSDBT848_HDR
+#ifdef HAVE_RADIO_BSDBT848
     &radio_driver_bsdbt848,
 #endif
 #ifdef HAVE_RADIO_V4L2