Index: media/audio/audio_device_ipc.h |
diff --git a/media/audio/audio_device_ipc.h b/media/audio/audio_device_ipc.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b60d3259d1d329de9beebdc9970f03f1aaf92478 |
--- /dev/null |
+++ b/media/audio/audio_device_ipc.h |
@@ -0,0 +1,59 @@ |
+// 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_AUDIO_DEVICE_IPC_H_ |
+#define MEDIA_AUDIO_AUDIO_DEVICE_IPC_H_ |
+ |
+#include "base/shared_memory.h" |
+#include "base/sync_socket.h" |
+#include "media/audio/audio_parameters.h" |
+ |
+namespace media { |
+ |
+// Current status of the audio output stream in the browser process. Browser |
+// sends information about the current playback state and error to the |
+// renderer process using this type. |
+enum AudioStreamState { |
scherkus (not reviewing)
2012/07/23 22:57:51
define inside Delegate as "State" and drop kAudioS
tommi (sloooow) - chröme
2012/07/24 09:49:44
Done.
|
+ kAudioStreamPlaying, |
+ kAudioStreamPaused, |
+ kAudioStreamError |
+}; |
+ |
+class AudioDeviceIPCDelegate { |
scherkus (not reviewing)
2012/07/23 22:57:51
any thoughts as to replacing this interface with t
tommi (sloooow) - chröme
2012/07/24 09:49:44
I thought about that but decided not to do that ri
|
+ public: |
+ |
scherkus (not reviewing)
2012/07/23 22:57:51
remove blank line
tommi (sloooow) - chröme
2012/07/24 09:49:44
Done.
|
+ // Called when state of an audio stream has changed in the browser process. |
scherkus (not reviewing)
2012/07/23 22:57:51
nit: I'd drop the "in the browser process" bit --
tommi (sloooow) - chröme
2012/07/24 09:49:44
Done.
|
+ virtual void OnStateChanged(AudioStreamState state) = 0; |
+ |
+ // Called when an audio stream has been created in the browser process. |
scherkus (not reviewing)
2012/07/23 22:57:51
ditto
scherkus (not reviewing)
2012/07/23 22:57:51
can we get docs on what these handles and params m
tommi (sloooow) - chröme
2012/07/24 09:49:44
Done.
tommi (sloooow) - chröme
2012/07/24 09:49:44
Done.
|
+ virtual void OnStreamCreated(base::SharedMemoryHandle handle, |
+ base::SyncSocket::Handle socket_handle, |
+ uint32 length) = 0; |
+ protected: |
+ virtual ~AudioDeviceIPCDelegate() {} |
scherkus (not reviewing)
2012/07/23 22:57:51
even this it's OK to inline ctor/dtor in this part
tommi (sloooow) - chröme
2012/07/24 09:49:44
ah, wasn't aware of that. Thanks for the heads up.
|
+}; |
+ |
+class AudioDeviceIPC { |
scherkus (not reviewing)
2012/07/23 22:57:51
needs docs
tommi (sloooow) - chröme
2012/07/24 09:49:44
Done.
|
+ public: |
+ // Registers an AudioDeviceIPCDelegate and returns a stream_id that must |
scherkus (not reviewing)
2012/07/23 22:57:51
|stream_id|
tommi (sloooow) - chröme
2012/07/24 09:49:44
Done.
|
+ // be used with all other IPC functions in this interface. |
+ virtual int AddDelegate(AudioDeviceIPCDelegate* sink) = 0; |
scherkus (not reviewing)
2012/07/23 22:57:51
s/sink/delegate?
tommi (sloooow) - chröme
2012/07/24 09:49:44
Done.
|
+ |
+ // Remove a delegate referenced by |stream_id| from the map. |
scherkus (not reviewing)
2012/07/23 22:57:51
map? what map!? (update docs :))
tommi (sloooow) - chröme
2012/07/24 09:49:44
Done.
|
+ virtual void RemoveDelegate(int stream_id) = 0; |
+ |
+ virtual void CreateStream(int stream_id, const AudioParameters& params) = 0; |
scherkus (not reviewing)
2012/07/23 22:57:51
docs?
tommi (sloooow) - chröme
2012/07/24 09:49:44
Done.
|
+ virtual void PlayStream(int stream_id) = 0; |
+ virtual void PauseStream(int stream_id) = 0; |
+ virtual void FlushStream(int stream_id) = 0; |
+ virtual void CloseStream(int stream_id) = 0; |
+ virtual void SetVolume(int stream_id, double volume) = 0; |
+ |
+ protected: |
+ virtual ~AudioDeviceIPC() {} |
scherkus (not reviewing)
2012/07/23 22:57:51
ditto
tommi (sloooow) - chröme
2012/07/24 09:49:44
Done.
|
+}; |
+ |
+} // namespace media |
+ |
+#endif // MEDIA_AUDIO_AUDIO_DEVICE_IPC_H_ |