~ubuntu-branches/ubuntu/karmic/pulseaudio/karmic-updates

« back to all changes in this revision

Viewing changes to src/modules/module-cli.c

  • Committer: Bazaar Package Importer
  • Author(s): Luke Yelavich, Daniel T Chen, Luke Yelavich
  • Date: 2009-09-21 10:28:25 UTC
  • mfrom: (1.14.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20090921102825-dn0svrgwo8w19bc8
Tags: 1:0.9.18-0ubuntu1
[ Daniel T Chen ]
* New upstream bugfix release
* debian/patches/:
  - 0052-backport-56b6e18030.patch: Drop
  - 0053-fix-output-element.patch: Drop, applied upstream
  - 0090-use-volume-ignore-for-analog-output.patch: Stop applying
    this patch. Too many people are confused as to why PCM isn't
    being changed when they adjust PA's volume.
  + 0060-backport-c194d.patch: Backport fixes from 0.9.18-stable
    branch (to changeset c194db71b0ff853b4f46df26e135edf63b215451)
  + 0090-disable-flat-volumes.patch: Many people seem uncomfortable
    with PA's new default volume adjustment routine, so disable it
    in favour of the existing behaviour known in previous Ubuntu
    releases. The downside is that the user again has many knobs to
    fiddle; the upside is that applications can no longer drop the
    volume floor. This addresses LP: #403859, #433209.

[ Luke Yelavich ]
* debian/pulse-alsa.conf: Expose the pulse device to the ALSA name hint API.
  Thanks to David Henningsson <launchpad.web@epost.diwic.se> for the patch.
* Add epoch to shlibs version definitions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
 
26
26
#include <stdio.h>
27
27
#include <unistd.h>
 
28
#include <fcntl.h>
 
29
#include <errno.h>
28
30
 
29
31
#include <pulsecore/module.h>
30
32
#include <pulsecore/iochannel.h>
33
35
#include <pulsecore/log.h>
34
36
#include <pulsecore/modargs.h>
35
37
#include <pulsecore/macro.h>
 
38
#include <pulsecore/core-util.h>
 
39
#include <pulsecore/core-error.h>
36
40
 
37
41
#include "module-cli-symdef.h"
38
42
 
69
73
    pa_iochannel *io;
70
74
    pa_modargs *ma;
71
75
    pa_bool_t exit_on_eof = FALSE;
 
76
    int fd;
72
77
 
73
78
    pa_assert(m);
74
79
 
88
93
    }
89
94
 
90
95
    if (pa_stdio_acquire() < 0) {
91
 
        pa_log("STDIN/STDUSE already in use.");
 
96
        pa_log("STDIN/STDOUT already in use.");
92
97
        goto fail;
93
98
    }
94
99
 
95
 
    io = pa_iochannel_new(m->core->mainloop, STDIN_FILENO, STDOUT_FILENO);
96
 
    pa_iochannel_set_noclose(io, 1);
 
100
    /* We try to open the controlling tty anew here. This has the
 
101
     * benefit of giving us a new fd that doesn't share the O_NDELAY
 
102
     * flag with fds 0, 1, or 2. Since pa_iochannel_xxx needs O_NDELAY
 
103
     * on its fd using those fds directly could set O_NDELAY which
 
104
     * fprintf() doesn't really like, resulting in truncated output
 
105
     * of log messages, particularly because if stdout and stderr are
 
106
     * dup'ed they share the same O_NDELAY, too. */
 
107
 
 
108
    if ((fd = open("/dev/tty", O_RDWR|O_CLOEXEC|O_NONBLOCK)) >= 0) {
 
109
        io = pa_iochannel_new(m->core->mainloop, fd, fd);
 
110
        pa_log_debug("Managed to open /dev/tty.");
 
111
    } else {
 
112
        io = pa_iochannel_new(m->core->mainloop, STDIN_FILENO, STDOUT_FILENO);
 
113
        pa_iochannel_set_noclose(io, TRUE);
 
114
        pa_log_debug("Failed to open /dev/tty, using stdin/stdout fds instead.");
 
115
    }
97
116
 
98
117
    m->userdata = pa_cli_new(m->core, io, m);
99
 
 
100
118
    pa_cli_set_eof_callback(m->userdata, exit_on_eof ? eof_and_exit_cb : eof_and_unload_cb, m);
101
119
 
102
120
    pa_modargs_free(ma);
114
132
void pa__done(pa_module*m) {
115
133
    pa_assert(m);
116
134
 
117
 
    if (m->core->running_as_daemon == 0) {
 
135
    if (m->userdata) {
118
136
        pa_cli_free(m->userdata);
119
137
        pa_stdio_release();
120
138
    }