Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(895)

Side by Side Diff: media/audio/pulse/pulse_output.h

Issue 8499029: make pulseaudio available for all posix platforms because it's not linux only (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // Creates an audio output stream based on the PulseAudio asynchronous API. 5 // Creates an audio output stream based on the PulseAudio asynchronous API.
6 // 6 //
7 // If the stream is successfully opened, Close() must be called before the 7 // If the stream is successfully opened, Close() must be called before the
8 // stream is deleted as Close() is responsible for ensuring resource cleanup 8 // stream is deleted as Close() is responsible for ensuring resource cleanup
9 // occurs. 9 // occurs.
10 // 10 //
(...skipping 13 matching lines...) Expand all
24 #include "base/memory/scoped_ptr.h" 24 #include "base/memory/scoped_ptr.h"
25 #include "base/memory/weak_ptr.h" 25 #include "base/memory/weak_ptr.h"
26 #include "base/task.h" 26 #include "base/task.h"
27 #include "media/audio/audio_io.h" 27 #include "media/audio/audio_io.h"
28 #include "media/base/channel_layout.h" 28 #include "media/base/channel_layout.h"
29 29
30 namespace media { 30 namespace media {
31 class SeekableBuffer; 31 class SeekableBuffer;
32 } 32 }
33 33
34 #if defined(OS_LINUX)
scherkus (not reviewing) 2011/11/09 01:10:54 Does using the base class AudioManager work here?
Robert Nagy 2011/11/09 07:44:39 Unfortunately i still need to have class AudioMana
34 class AudioManagerLinux; 35 class AudioManagerLinux;
36 #elif defined(OS_OPENBSD)
37 class AudioManagerOpenBSD;
38 #endif
35 struct AudioParameters; 39 struct AudioParameters;
36 class MessageLoop; 40 class MessageLoop;
37 41
38 class PulseAudioOutputStream : public AudioOutputStream { 42 class PulseAudioOutputStream : public AudioOutputStream {
39 public: 43 public:
40 PulseAudioOutputStream(const AudioParameters& params, 44 PulseAudioOutputStream(const AudioParameters& params,
45 #if defined(OS_LINUX)
41 AudioManagerLinux* manager, 46 AudioManagerLinux* manager,
47 #elif defined(OS_OPENBSD)
48 AudioManagerOpenBSD* manager,
49 #endif
42 MessageLoop* message_loop); 50 MessageLoop* message_loop);
43 51
44 virtual ~PulseAudioOutputStream(); 52 virtual ~PulseAudioOutputStream();
45 53
46 // Implementation of AudioOutputStream. 54 // Implementation of AudioOutputStream.
47 virtual bool Open(); 55 virtual bool Open();
48 virtual void Close(); 56 virtual void Close();
49 virtual void Start(AudioSourceCallback* callback); 57 virtual void Start(AudioSourceCallback* callback);
50 virtual void Stop(); 58 virtual void Stop();
51 virtual void SetVolume(double volume); 59 virtual void SetVolume(double volume);
(...skipping 27 matching lines...) Expand all
79 87
80 // Configuration constants from the constructor. Referencable by all threads 88 // Configuration constants from the constructor. Referencable by all threads
81 // since they are constants. 89 // since they are constants.
82 const ChannelLayout channel_layout_; 90 const ChannelLayout channel_layout_;
83 const uint32 channel_count_; 91 const uint32 channel_count_;
84 const pa_sample_format_t sample_format_; 92 const pa_sample_format_t sample_format_;
85 const uint32 sample_rate_; 93 const uint32 sample_rate_;
86 const uint32 bytes_per_frame_; 94 const uint32 bytes_per_frame_;
87 95
88 // Audio manager that created us. Used to report that we've closed. 96 // Audio manager that created us. Used to report that we've closed.
97 #if defined(OS_LINUX)
89 AudioManagerLinux* manager_; 98 AudioManagerLinux* manager_;
99 #elif defined(OS_OPENBSD)
100 AudioManagerOpenBSD* manager_;
101 #endif
90 102
91 // PulseAudio API structs. 103 // PulseAudio API structs.
92 pa_context* pa_context_; 104 pa_context* pa_context_;
93 pa_mainloop* pa_mainloop_; 105 pa_mainloop* pa_mainloop_;
94 106
95 // Handle to the actual PulseAudio playback stream. 107 // Handle to the actual PulseAudio playback stream.
96 pa_stream* playback_handle_; 108 pa_stream* playback_handle_;
97 109
98 // Device configuration data. Populated after Open() completes. 110 // Device configuration data. Populated after Open() completes.
99 uint32 packet_size_; 111 uint32 packet_size_;
(...skipping 22 matching lines...) Expand all
122 // bound by its lifetime. 134 // bound by its lifetime.
123 base::WeakPtrFactory<PulseAudioOutputStream> weak_factory_; 135 base::WeakPtrFactory<PulseAudioOutputStream> weak_factory_;
124 136
125 // Callback to audio data source. 137 // Callback to audio data source.
126 AudioSourceCallback* source_callback_; 138 AudioSourceCallback* source_callback_;
127 139
128 DISALLOW_COPY_AND_ASSIGN(PulseAudioOutputStream); 140 DISALLOW_COPY_AND_ASSIGN(PulseAudioOutputStream);
129 }; 141 };
130 142
131 #endif // MEDIA_AUDIO_LINUX_PULSE_OUTPUT_H_ 143 #endif // MEDIA_AUDIO_LINUX_PULSE_OUTPUT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698