[content shell] hook up testRunner.dumpEditingCallbacks
[chromium-blink-merge.git] / content / common / media / audio_messages.h
blobe78cfddfb8859a8c2bd32b786d7c9a813ab1d249
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // IPC messages for the audio.
6 // Multiply-included message file, hence no include guard.
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/shared_memory.h"
12 #include "base/sync_socket.h"
13 #include "content/common/content_export.h"
14 #include "content/common/media/audio_param_traits.h"
15 #include "ipc/ipc_message_macros.h"
16 #include "media/audio/audio_buffers_state.h"
17 #include "media/audio/audio_input_ipc.h"
18 #include "media/audio/audio_output_ipc.h"
19 #include "media/audio/audio_parameters.h"
21 #undef IPC_MESSAGE_EXPORT
22 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
23 #define IPC_MESSAGE_START AudioMsgStart
25 IPC_ENUM_TRAITS(media::AudioInputIPCDelegate::State)
26 IPC_ENUM_TRAITS(media::AudioOutputIPCDelegate::State)
28 // Messages sent from the browser to the renderer.
30 // Tell the renderer process that an audio stream has been created.
31 // The renderer process is given a shared memory handle for the audio data
32 // buffer it shares with the browser process. It is also given a SyncSocket that
33 // it uses to communicate with the browser process about the state of the
34 // buffered audio data.
35 #if defined(OS_WIN)
36 IPC_MESSAGE_CONTROL4(AudioMsg_NotifyStreamCreated,
37 int /* stream id */,
38 base::SharedMemoryHandle /* handle */,
39 base::SyncSocket::Handle /* socket handle */,
40 uint32 /* length */)
41 #else
42 IPC_MESSAGE_CONTROL4(AudioMsg_NotifyStreamCreated,
43 int /* stream id */,
44 base::SharedMemoryHandle /* handle */,
45 base::FileDescriptor /* socket handle */,
46 uint32 /* length */)
47 #endif
49 // Tell the renderer process that an audio input stream has been created.
50 // The renderer process would be given a SyncSocket that it should read
51 // from from then on.
52 #if defined(OS_WIN)
53 IPC_MESSAGE_CONTROL4(AudioInputMsg_NotifyStreamCreated,
54 int /* stream id */,
55 base::SharedMemoryHandle /* handle */,
56 base::SyncSocket::Handle /* socket handle */,
57 uint32 /* length */)
58 #else
59 IPC_MESSAGE_CONTROL4(AudioInputMsg_NotifyStreamCreated,
60 int /* stream id */,
61 base::SharedMemoryHandle /* handle */,
62 base::FileDescriptor /* socket handle */,
63 uint32 /* length */)
64 #endif
66 // Notification message sent from AudioRendererHost to renderer for state
67 // update after the renderer has requested a Create/Start/Close.
68 IPC_MESSAGE_CONTROL2(AudioMsg_NotifyStreamStateChanged,
69 int /* stream id */,
70 media::AudioOutputIPCDelegate::State /* new state */)
72 // Notification message sent from browser to renderer for state update.
73 IPC_MESSAGE_CONTROL2(AudioInputMsg_NotifyStreamStateChanged,
74 int /* stream id */,
75 media::AudioInputIPCDelegate::State /* new state */)
77 IPC_MESSAGE_CONTROL2(AudioInputMsg_NotifyStreamVolume,
78 int /* stream id */,
79 double /* volume */)
81 IPC_MESSAGE_CONTROL2(AudioInputMsg_NotifyDeviceStarted,
82 int /* stream id */,
83 std::string /* device_id */)
85 // Messages sent from the renderer to the browser.
87 // Request that got sent to browser for creating an audio output stream
88 IPC_MESSAGE_CONTROL3(AudioHostMsg_CreateStream,
89 int /* stream_id */,
90 media::AudioParameters, /* params */
91 int /* input_channels */)
93 // Request that got sent to browser for creating an audio input stream
94 IPC_MESSAGE_CONTROL4(AudioInputHostMsg_CreateStream,
95 int /* stream_id */,
96 media::AudioParameters /* params */,
97 std::string /* device_id */,
98 bool /* automatic_gain_control */)
100 // Indicate that audio for a stream is produced by the specified render view.
101 IPC_MESSAGE_CONTROL2(AudioHostMsg_AssociateStreamWithProducer,
102 int /* stream_id */,
103 int /* render_view_id */)
105 // Indicate that audio for a stream is consumed by the specified render view.
106 IPC_MESSAGE_CONTROL2(AudioInputHostMsg_AssociateStreamWithConsumer,
107 int /* stream_id */,
108 int /* render_view_id */)
110 // Start buffering and play the audio stream specified by stream_id.
111 IPC_MESSAGE_CONTROL1(AudioHostMsg_PlayStream,
112 int /* stream_id */)
114 // Start recording the audio input stream specified by stream_id.
115 IPC_MESSAGE_CONTROL1(AudioInputHostMsg_RecordStream,
116 int /* stream_id */)
118 // Pause the audio stream specified by stream_id.
119 IPC_MESSAGE_CONTROL1(AudioHostMsg_PauseStream,
120 int /* stream_id */)
122 // Discard all buffered audio data for the specified audio stream.
123 IPC_MESSAGE_CONTROL1(AudioHostMsg_FlushStream,
124 int /* stream_id */)
126 // Close an audio stream specified by stream_id.
127 IPC_MESSAGE_CONTROL1(AudioHostMsg_CloseStream,
128 int /* stream_id */)
130 // Close an audio input stream specified by stream_id.
131 IPC_MESSAGE_CONTROL1(AudioInputHostMsg_CloseStream,
132 int /* stream_id */)
134 // Set audio volume of the stream specified by stream_id.
135 // TODO(hclam): change this to vector if we have channel numbers other than 2.
136 IPC_MESSAGE_CONTROL2(AudioHostMsg_SetVolume,
137 int /* stream_id */,
138 double /* volume */)
140 // Set audio volume of the input stream specified by stream_id.
141 IPC_MESSAGE_CONTROL2(AudioInputHostMsg_SetVolume,
142 int /* stream_id */,
143 double /* volume */)
145 // Start the device referenced by the session_id for the input stream specified
146 // by stream_id.
147 IPC_MESSAGE_CONTROL2(AudioInputHostMsg_StartDevice,
148 int /* stream_id */,
149 int /* session_id */)