~ubuntu-branches/ubuntu/wily/openal-soft/wily-proposed

« back to all changes in this revision

Viewing changes to Alc/backends/sndio.c

  • Committer: Package Import Robot
  • Author(s): Bret Curtis
  • Date: 2014-07-16 08:35:25 UTC
  • mfrom: (0.2.10)
  • Revision ID: package-import@ubuntu.com-20140716083525-5rldbuk4mo211l1a
Tags: 1:1.15.1-1
* Added openal-info binary. (Closes: 659198)
* Added makehrtf binary.
* Added 'audio' to short description. (Closes: 598064) 
* Added FLAGS fixes for cmake in rules for hardening.
* Added man pages for the two binaries.
* New upstream release. (Closes: 731159)
* Removed libsndio-dlopen-change.patch, no longer required.
* Removed no-fpuextended.patch, macros no longer used.
* Removed need for lintian overrides.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
#include <stdio.h>
24
24
#include <stdlib.h>
25
25
#include <string.h>
 
26
 
26
27
#include "alMain.h"
27
 
#include "AL/al.h"
28
 
#include "AL/alc.h"
 
28
#include "alu.h"
29
29
 
30
30
#include <sndio.h>
31
31
 
33
33
static const ALCchar sndio_device[] = "SndIO Default";
34
34
 
35
35
 
36
 
#ifdef HAVE_DYNLOAD
37
 
static void *sndio_handle;
38
 
#define MAKE_FUNC(x) static typeof(x) * p##x
39
 
MAKE_FUNC(sio_initpar);
40
 
MAKE_FUNC(sio_open);
41
 
MAKE_FUNC(sio_close);
42
 
MAKE_FUNC(sio_setpar);
43
 
MAKE_FUNC(sio_getpar);
44
 
MAKE_FUNC(sio_getcap);
45
 
MAKE_FUNC(sio_onmove);
46
 
MAKE_FUNC(sio_write);
47
 
MAKE_FUNC(sio_read);
48
 
MAKE_FUNC(sio_start);
49
 
MAKE_FUNC(sio_stop);
50
 
MAKE_FUNC(sio_nfds);
51
 
MAKE_FUNC(sio_pollfd);
52
 
MAKE_FUNC(sio_revents);
53
 
MAKE_FUNC(sio_eof);
54
 
MAKE_FUNC(sio_setvol);
55
 
MAKE_FUNC(sio_onvol);
56
 
 
57
 
#define sio_initpar psio_initpar
58
 
#define sio_open psio_open
59
 
#define sio_close psio_close
60
 
#define sio_setpar psio_setpar
61
 
#define sio_getpar psio_getpar
62
 
#define sio_getcap psio_getcap
63
 
#define sio_onmove psio_onmove
64
 
#define sio_write psio_write
65
 
#define sio_read psio_read
66
 
#define sio_start psio_start
67
 
#define sio_stop psio_stop
68
 
#define sio_nfds psio_nfds
69
 
#define sio_pollfd psio_pollfd
70
 
#define sio_revents psio_revents
71
 
#define sio_eof psio_eof
72
 
#define sio_setvol psio_setvol
73
 
#define sio_onvol psio_onvol
74
 
#endif
75
 
 
76
 
 
77
36
static ALCboolean sndio_load(void)
78
37
{
79
 
#ifdef HAVE_DYNLOAD
80
 
    if(!sndio_handle)
81
 
    {
82
 
        sndio_handle = LoadLib("libsndio.so.2");
83
 
        if(!sndio_handle)
84
 
            return ALC_FALSE;
85
 
 
86
 
#define LOAD_FUNC(f) do {                                                     \
87
 
    p##f = GetSymbol(sndio_handle, #f);                                       \
88
 
    if(p##f == NULL) {                                                        \
89
 
        CloseLib(sndio_handle);                                               \
90
 
        sndio_handle = NULL;                                                  \
91
 
        return ALC_FALSE;                                                     \
92
 
    }                                                                         \
93
 
} while(0)
94
 
        LOAD_FUNC(sio_initpar);
95
 
        LOAD_FUNC(sio_open);
96
 
        LOAD_FUNC(sio_close);
97
 
        LOAD_FUNC(sio_setpar);
98
 
        LOAD_FUNC(sio_getpar);
99
 
        LOAD_FUNC(sio_getcap);
100
 
        LOAD_FUNC(sio_onmove);
101
 
        LOAD_FUNC(sio_write);
102
 
        LOAD_FUNC(sio_read);
103
 
        LOAD_FUNC(sio_start);
104
 
        LOAD_FUNC(sio_stop);
105
 
        LOAD_FUNC(sio_nfds);
106
 
        LOAD_FUNC(sio_pollfd);
107
 
        LOAD_FUNC(sio_revents);
108
 
        LOAD_FUNC(sio_eof);
109
 
        LOAD_FUNC(sio_setvol);
110
 
        LOAD_FUNC(sio_onvol);
111
 
#undef LOAD_FUNC
112
 
    }
113
 
#endif
114
38
    return ALC_TRUE;
115
39
}
116
40
 
149
73
            if(wrote == 0)
150
74
            {
151
75
                ERR("sio_write failed\n");
 
76
                ALCdevice_Lock(device);
152
77
                aluHandleDisconnect(device);
 
78
                ALCdevice_Unlock(device);
153
79
                break;
154
80
            }
155
81
 
183
109
        return ALC_INVALID_VALUE;
184
110
    }
185
111
 
186
 
    device->szDeviceName = strdup(deviceName);
 
112
    device->DeviceName = strdup(deviceName);
187
113
    device->ExtraData = data;
188
114
 
189
115
    return ALC_NO_ERROR;
339
265
    NULL,
340
266
    NULL,
341
267
    NULL,
342
 
    NULL
 
268
    NULL,
 
269
    ALCdevice_LockDefault,
 
270
    ALCdevice_UnlockDefault,
 
271
    ALCdevice_GetLatencyDefault
343
272
};
344
273
 
345
274
ALCboolean alc_sndio_init(BackendFuncs *func_list)
352
281
 
353
282
void alc_sndio_deinit(void)
354
283
{
355
 
#ifdef HAVE_DYNLOAD
356
 
    if(sndio_handle)
357
 
        CloseLib(sndio_handle);
358
 
    sndio_handle = NULL;
359
 
#endif
360
284
}
361
285
 
362
286
void alc_sndio_probe(enum DevProbe type)
364
288
    switch(type)
365
289
    {
366
290
        case ALL_DEVICE_PROBE:
367
 
            AppendAllDeviceList(sndio_device);
 
291
            AppendAllDevicesList(sndio_device);
368
292
            break;
369
293
        case CAPTURE_DEVICE_PROBE:
370
294
            break;