Chromium Code Reviews

Unified Diff: media/audio/pulse/pulse_util.h

Issue 10952024: Adding pulseaudio input support to chrome (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: switched to dynamic linking and addressed Andrew's comments. Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: media/audio/pulse/pulse_util.h
diff --git a/media/audio/pulse/pulse_util.h b/media/audio/pulse/pulse_util.h
new file mode 100644
index 0000000000000000000000000000000000000000..b7fbcfdcd2ec044cc8ef1107b1b66624e0912f34
--- /dev/null
+++ b/media/audio/pulse/pulse_util.h
@@ -0,0 +1,48 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MEDIA_AUDIO_PULSE_PULSE_UTIL_H_
+#define MEDIA_AUDIO_PULSE_PULSE_UTIL_H_
+
+#include <pulse/pulseaudio.h>
+
+#include "base/basictypes.h"
+#include "media/audio/audio_device_name.h"
+//#include "media/audio/pulse/pulse_wrapper.h"
+#include "media/base/channel_layout.h"
+
+namespace media {
+
+class PulseWrapper;
+
+// A helper class that acquires pa_threaded_mainloop_lock() while in scope.
+class AutoPulseLock {
+ public:
+ AutoPulseLock(PulseWrapper* wrapper, pa_threaded_mainloop* pa_mainloop);
+ ~AutoPulseLock();
+
+ private:
+ PulseWrapper* wrapper_;
+ pa_threaded_mainloop* pa_mainloop_;
+ DISALLOW_COPY_AND_ASSIGN(AutoPulseLock);
+};
+
+pa_sample_format_t BitsToPASampleFormat(PulseWrapper* wrapper,
+ int bits_per_sample);
+
+pa_channel_map ChannelLayoutToPAChannelMap(PulseWrapper* wrapper,
+ ChannelLayout channel_layout);
+
+void WaitForOperationCompletion(PulseWrapper* wrapper,
+ pa_threaded_mainloop* pa_mainloop,
+ pa_operation* operation);
+
+int GetHardwareLatencyInBytes(PulseWrapper* wrapper,
+ pa_stream* stream,
+ int sample_rate,
+ int bytes_per_frame);
+
+} // namespace media
+
+#endif // MEDIA_AUDIO_PULSE_PULSE_UTIL_H_

Powered by Google App Engine