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

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Francois Marier
  • Date: 2011-11-25 13:24:12 UTC
  • mfrom: (4.1.10 sid)
  • Revision ID: package-import@ubuntu.com-20111125132412-dc4qvhyosk74cd42
Tags: 1.0.1-4
Don't assume that arch:all packages will get built (closes: #649726)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010, 2011 Savoir-Faire Linux Inc.
 
3
 *  Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
 
4
 *
 
5
 *  This program is free software; you can redistribute it and/or modify
 
6
 *  it under the terms of the GNU General Public License as published by
 
7
 *  the Free Software Foundation; either version 3 of the License, or
 
8
 *  (at your option) any later version.
 
9
 *
 
10
 *  This program is distributed in the hope that it will be useful,
 
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 *  GNU General Public License for more details.
 
14
 *
 
15
 *  You should have received a copy of the GNU General Public License
 
16
 *  along with this program; if not, write to the Free Software
 
17
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
18
 *
 
19
 *  Additional permission under GNU GPL version 3 section 7:
 
20
 *
 
21
 *  If you modify this program, or any covered work, by linking or
 
22
 *  combining it with the OpenSSL project's OpenSSL library (or a
 
23
 *  modified version of that library), containing parts covered by the
 
24
 *  terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
 
25
 *  grants you additional permission to convey the resulting work.
 
26
 *  Corresponding Source for a non-source form of such a combination
 
27
 *  shall include the source code for the parts of OpenSSL used as well
 
28
 *  as that of the covered work.
 
29
 */
 
30
 
 
31
#ifndef _AUDIO_STREAM_H
 
32
#define _AUDIO_STREAM_H
 
33
 
 
34
#include <pulse/pulseaudio.h>
 
35
#include <string>
 
36
#include "noncopyable.h"
 
37
 
 
38
/**
 
39
 * This data structure contains the different king of audio streams available
 
40
 */
 
41
enum STREAM_TYPE {
 
42
    PLAYBACK_STREAM, CAPTURE_STREAM, RINGTONE_STREAM
 
43
};
 
44
 
 
45
class AudioStream {
 
46
    public:
 
47
 
 
48
        /**
 
49
         * Constructor
 
50
         *
 
51
         * @param context pulseaudio's application context.
 
52
         * @param mainloop pulseaudio's main loop
 
53
         * @param description
 
54
         * @param types
 
55
         * @param audio sampling rate
 
56
         * @param device name
 
57
         */
 
58
        AudioStream(pa_context *, pa_threaded_mainloop *, const char *, int, int, std::string *);
 
59
 
 
60
        ~AudioStream();
 
61
 
 
62
        /**
 
63
         * Accessor: Get the pulseaudio stream object
 
64
         * @return pa_stream* The stream
 
65
         */
 
66
        pa_stream* pulseStream() {
 
67
            return audiostream_;
 
68
        }
 
69
 
 
70
        bool isReady();
 
71
 
 
72
    private:
 
73
        NON_COPYABLE(AudioStream);
 
74
 
 
75
        /**
 
76
         * Mandatory asynchronous callback on the audio stream state
 
77
         */
 
78
        static void stream_state_callback(pa_stream* s, void* user_data);
 
79
 
 
80
        /**
 
81
         * The pulse audio object
 
82
         */
 
83
        pa_stream* audiostream_;
 
84
 
 
85
        /**
 
86
         * A pointer to the opaque threaded main loop object
 
87
         */
 
88
        pa_threaded_mainloop * mainloop_;
 
89
};
 
90
 
 
91
#endif // _AUDIO_STREAM_H