~ubuntu-branches/ubuntu/wily/sflphone/wily

« back to all changes in this revision

Viewing changes to daemon/src/audio/pulseaudio/pulselayer.h

  • Committer: Package Import Robot
  • Author(s): Francois Marier, Francois Marier, Mark Purcell
  • Date: 2014-10-18 15:08:50 UTC
  • mfrom: (1.1.12)
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20141018150850-2exfk34ckb15pcwi
Tags: 1.4.1-0.1
[ Francois Marier ]
* Non-maintainer upload
* New upstream release (closes: #759576, #741130)
  - debian/rules +PJPROJECT_VERSION := 2.2.1
  - add upstream patch to fix broken TLS support
  - add patch to fix pjproject regression

[ Mark Purcell ]
* Build-Depends:
  - sflphone-daemon + libavformat-dev, libavcodec-dev, libswscale-dev,
  libavdevice-dev, libavutil-dev
  - sflphone-gnome + libclutter-gtk-1.0-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
typedef struct PaDeviceInfos {
52
52
        uint32_t index;
53
53
        std::string name;
 
54
        std::string description;
54
55
        pa_sample_spec sample_spec;
55
56
        pa_channel_map channel_map;
56
57
 
57
 
        PaDeviceInfos(unsigned idx, const char* ep_name, const pa_sample_spec &samp_spec, const pa_channel_map &chan_map)
58
 
            : index(idx), name(ep_name), sample_spec(samp_spec), channel_map(chan_map) {}
59
 
        virtual ~PaDeviceInfos() {}
 
58
        PaDeviceInfos(const pa_source_info& source) :
 
59
            index(source.index),
 
60
            name(source.name),
 
61
            description(source.description),
 
62
            sample_spec(source.sample_spec),
 
63
            channel_map(source.channel_map) {}
 
64
 
 
65
        PaDeviceInfos(const pa_sink_info& source) :
 
66
            index(source.index),
 
67
            name(source.name),
 
68
            description(source.description),
 
69
            sample_spec(source.sample_spec),
 
70
            channel_map(source.channel_map) {}
60
71
 
61
72
        /**
62
73
         * Unary function to search for a device by name in a list using std functions.
63
74
         */
64
 
        class nameComparator {
 
75
        class NameComparator {
65
76
            public:
66
 
                explicit nameComparator(const std::string &ref) : baseline(ref) {}
 
77
                explicit NameComparator(const std::string &ref) : baseline(ref) {}
67
78
                bool operator()(const PaDeviceInfos &arg) {
68
79
                    return arg.name == baseline;
69
80
                }
70
81
            private:
71
82
                const std::string &baseline;
72
83
        };
 
84
 
 
85
        class DescriptionComparator {
 
86
            public:
 
87
                explicit DescriptionComparator(const std::string &ref) : baseline(ref) {}
 
88
                bool operator()(const PaDeviceInfos &arg) {
 
89
                    return arg.description == baseline;
 
90
                }
 
91
            private:
 
92
                const std::string &baseline;
 
93
        };
73
94
} PaDeviceInfos;
74
95
 
75
96
class PulseMainLoopLock {
96
117
        void writeToSpeaker();
97
118
        void ringtoneToSpeaker();
98
119
 
99
 
 
100
120
        void updateSinkList();
101
 
 
102
121
        void updateSourceList();
103
122
 
104
123
        bool inSinkList(const std::string &deviceName);
105
 
 
106
124
        bool inSourceList(const std::string &deviceName);
107
125
 
108
126
        virtual std::vector<std::string> getCaptureDeviceList() const;
109
127
        virtual std::vector<std::string> getPlaybackDeviceList() const;
110
 
        int getAudioDeviceIndex(const std::string& name) const;
 
128
        int getAudioDeviceIndex(const std::string& descr, DeviceType type) const;
 
129
        int getAudioDeviceIndexByName(const std::string& name, DeviceType type) const;
111
130
 
112
 
        std::string getAudioDeviceName(int index, PCMType type) const;
 
131
        std::string getAudioDeviceName(int index, DeviceType type) const;
113
132
 
114
133
        virtual void startStream();
115
 
 
116
134
        virtual void stopStream();
117
135
 
118
136
    private:
127
145
                                             const pa_sink_info *i,
128
146
                                             int eol, void *userdata);
129
147
 
130
 
        virtual void updatePreference(AudioPreference &pref, int index, PCMType type);
 
148
        virtual void updatePreference(AudioPreference &pref, int index, DeviceType type);
131
149
 
132
150
        virtual int getIndexCapture() const;
133
151
        virtual int getIndexPlayback() const;
147
165
        void disconnectAudioStream();
148
166
 
149
167
        /**
 
168
         * Returns a pointer to the PaEndpointInfos with the given name in sourceList_, or nullptr if not found.
 
169
         */
 
170
        const PaDeviceInfos* getDeviceInfos(const std::vector<PaDeviceInfos>&, const std::string& name) const;
 
171
 
 
172
        /**
150
173
         * A stream object to handle the pulseaudio playback stream
151
174
         */
152
175
        AudioStream* playback_;
171
194
         */
172
195
        std::vector<PaDeviceInfos> sourceList_;
173
196
 
174
 
        /**
175
 
         * Returns a pointer to the PaEndpointInfos with the given name in sourceList_, or nullptr if not found.
176
 
         */
177
 
        const PaDeviceInfos* getDeviceInfos(const std::vector<PaDeviceInfos>&, const std::string& name) const;
178
 
 
179
197
        /*
180
198
         * Buffers used to avoid doing malloc/free in the audio thread
181
199
         */