]> git.pld-linux.org Git - packages/xine-lib.git/blob - xine-lib-devfs.patch
- runtime devfs detection instead of linux/config.h-based
[packages/xine-lib.git] / xine-lib-devfs.patch
1 --- xine-lib-1-rc3a/src/audio_out/audio_oss_out.c.orig  2003-12-14 23:13:22.000000000 +0100
2 +++ xine-lib-1-rc3a/src/audio_out/audio_oss_out.c       2003-12-31 02:07:58.260704624 +0100
3 @@ -57,10 +57,8 @@
4  #   include <sys/soundcard.h>
5  #  endif
6  #else
7 -# if defined(__linux__)
8 -#  include <linux/config.h> /* Check for DEVFS */
9 -# endif
10  # include <sys/soundcard.h>
11 +# include <sys/stat.h>
12  #endif
13  #include <sys/ioctl.h>
14  #include <inttypes.h>
15 @@ -108,11 +106,8 @@
16  #define OSS_SYNC_SOFTSYNC     3
17  #define OSS_SYNC_PROBEBUFFER  4
18  
19 -#ifdef CONFIG_DEVFS_FS
20 -#define DSP_TEMPLATE "/dev/sound/dsp%d"
21 -#else
22 -#define DSP_TEMPLATE "/dev/dsp%d"
23 -#endif
24 +#define DSP_TEMPLATE_DEVFS "/dev/sound/dsp%d"
25 +#define DSP_TEMPLATE_DEV "/dev/dsp%d"
26  
27  typedef struct oss_driver_s {
28  
29 @@ -684,17 +679,15 @@
30    config_values_t *config = class->config;
31    oss_driver_t    *this;
32    int              caps;
33 -#ifdef CONFIG_DEVFS_FS
34    char             devname[] = "/dev/sound/dsp\0\0\0";
35 -#else
36 -  char             devname[] = "/dev/dsp\0\0\0";
37 -#endif
38    int              best_rate;
39    int              rate ;
40    int              devnum;
41    int              audio_fd;
42    int              num_channels, bits, status, arg;
43    static char     *sync_methods[] = {"auto", "getodelay", "getoptr", "softsync", "probebuffer", NULL};
44 +  struct stat      statbuf;
45 +  int              havedevfs = 0;
46    
47    this = (oss_driver_t *) xine_xmalloc (sizeof (oss_driver_t));
48  
49 @@ -709,8 +702,11 @@
50                                  _("/dev/dsp# device to use for oss output, -1 => auto_detect"),
51                                  NULL, 10, NULL, NULL);
52  
53 +  if (!stat("/dev/sound", &statbuf) && (statbuf.st_mode & S_IFDIR))
54 +    havedevfs = 1;
55 +
56    if (devnum >= 0) {
57 -    sprintf (this->audio_dev, DSP_TEMPLATE, devnum);
58 +    sprintf (this->audio_dev, (havedevfs ? DSP_TEMPLATE_DEVFS : DSP_TEMPLATE_DEV), devnum);
59      devnum = 30; /* skip while loop */
60    } else {
61      devnum = 0;
62 @@ -738,7 +734,7 @@
63              this->audio_dev, strerror(errno));
64              */
65  
66 -    sprintf(devname, DSP_TEMPLATE, devnum);
67 +    sprintf(devname, (havedevfs ? DSP_TEMPLATE_DEVFS : DSP_TEMPLATE_DEV), devnum);
68      devnum++;
69    }
70  
This page took 0.068238 seconds and 3 git commands to generate.