Roll ANGLE e754fb8..6ffeb74
[chromium-blink-merge.git] / content / common / media / audio_messages.h
blobbfa51da1b77aa42bebb8f1965984ff00fccce34a
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/memory/shared_memory.h"
12 #include "base/sync_socket.h"
13 #include "content/common/content_export.h"
14 #include "content/common/media/media_param_traits.h"
15 #include "ipc/ipc_message_macros.h"
16 #include "media/audio/audio_input_ipc.h"
17 #include "media/audio/audio_output_ipc.h"
18 #include "media/audio/audio_parameters.h"
19 #include "url/gurl.h"
21 #undef IPC_MESSAGE_EXPORT
22 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
23 #define IPC_MESSAGE_START AudioMsgStart
25 IPC_ENUM_TRAITS_MAX_VALUE(media::AudioInputIPCDelegateState,
26 media::AUDIO_INPUT_IPC_DELEGATE_STATE_LAST)
28 IPC_ENUM_TRAITS_MAX_VALUE(media::AudioOutputIPCDelegateState,
29 media::AUDIO_OUTPUT_IPC_DELEGATE_STATE_LAST)
31 IPC_ENUM_TRAITS_MAX_VALUE(media::SwitchOutputDeviceResult,
32 media::SWITCH_OUTPUT_DEVICE_RESULT_LAST)
34 IPC_STRUCT_BEGIN(AudioInputHostMsg_CreateStream_Config)
35 IPC_STRUCT_MEMBER(media::AudioParameters, params)
36 IPC_STRUCT_MEMBER(bool, automatic_gain_control)
37 IPC_STRUCT_MEMBER(uint32, shared_memory_count)
38 IPC_STRUCT_END()
40 // Messages sent from the browser to the renderer.
42 // Tell the renderer process that an audio stream has been created.
43 // The renderer process is given a shared memory handle for the audio data
44 // buffer it shares with the browser process. It is also given a SyncSocket that
45 // it uses to communicate with the browser process about the state of the
46 // buffered audio data.
47 IPC_MESSAGE_CONTROL4(
48 AudioMsg_NotifyStreamCreated,
49 int /* stream id */,
50 base::SharedMemoryHandle /* handle */,
51 base::SyncSocket::TransitDescriptor /* socket descriptor */,
52 uint32 /* length */)
54 // Tell the renderer process that an audio input stream has been created.
55 // The renderer process would be given a SyncSocket that it should read
56 // from from then on. It is also given number of segments in shared memory.
57 IPC_MESSAGE_CONTROL5(
58 AudioInputMsg_NotifyStreamCreated,
59 int /* stream id */,
60 base::SharedMemoryHandle /* handle */,
61 base::SyncSocket::TransitDescriptor /* socket descriptor */,
62 uint32 /* length */,
63 uint32 /* segment count */)
65 // Notification message sent from AudioRendererHost to renderer for state
66 // update after the renderer has requested a Create/Start/Close.
67 IPC_MESSAGE_CONTROL2(AudioMsg_NotifyStreamStateChanged,
68 int /* stream id */,
69 media::AudioOutputIPCDelegateState /* new state */)
71 // Notification message sent from browser to renderer for state update.
72 IPC_MESSAGE_CONTROL2(AudioInputMsg_NotifyStreamStateChanged,
73 int /* stream id */,
74 media::AudioInputIPCDelegateState /* new state */)
76 IPC_MESSAGE_CONTROL2(AudioInputMsg_NotifyStreamVolume,
77 int /* stream id */,
78 double /* volume */)
80 // Notification message sent from AudioRendererHost to renderer for state
81 // update after the renderer has requested a SwitchOutputDevice.
82 IPC_MESSAGE_CONTROL3(AudioMsg_NotifyOutputDeviceSwitched,
83 int /* stream id */,
84 int /* request id */,
85 media::SwitchOutputDeviceResult /* result */)
87 // Messages sent from the renderer to the browser.
89 // Request that is sent to the browser for creating an audio output stream.
90 // |render_frame_id| is the routing ID for the RenderFrame producing the audio
91 // data.
92 IPC_MESSAGE_CONTROL4(AudioHostMsg_CreateStream,
93 int /* stream_id */,
94 int /* render_frame_id */,
95 int /* session_id */,
96 media::AudioParameters /* params */)
98 // Request that is sent to the browser for creating an audio input stream.
99 // |render_frame_id| is the routing ID for the RenderFrame consuming the audio
100 // data.
101 IPC_MESSAGE_CONTROL4(AudioInputHostMsg_CreateStream,
102 int /* stream_id */,
103 int /* render_frame_id */,
104 int /* session_id */,
105 AudioInputHostMsg_CreateStream_Config)
107 // Start buffering and play the audio stream specified by stream_id.
108 IPC_MESSAGE_CONTROL1(AudioHostMsg_PlayStream,
109 int /* stream_id */)
111 // Start recording the audio input stream specified by stream_id.
112 IPC_MESSAGE_CONTROL1(AudioInputHostMsg_RecordStream,
113 int /* stream_id */)
115 // Pause the audio stream specified by stream_id.
116 IPC_MESSAGE_CONTROL1(AudioHostMsg_PauseStream,
117 int /* stream_id */)
119 // Close an audio stream specified by stream_id.
120 IPC_MESSAGE_CONTROL1(AudioHostMsg_CloseStream,
121 int /* stream_id */)
123 // Close an audio input stream specified by stream_id.
124 IPC_MESSAGE_CONTROL1(AudioInputHostMsg_CloseStream,
125 int /* stream_id */)
127 // Set audio volume of the stream specified by stream_id.
128 // TODO(hclam): change this to vector if we have channel numbers other than 2.
129 IPC_MESSAGE_CONTROL2(AudioHostMsg_SetVolume,
130 int /* stream_id */,
131 double /* volume */)
133 // Set audio volume of the input stream specified by stream_id.
134 IPC_MESSAGE_CONTROL2(AudioInputHostMsg_SetVolume,
135 int /* stream_id */,
136 double /* volume */)
138 // Switch the output device of the stream specified by stream_id.
139 IPC_MESSAGE_CONTROL5(AudioHostMsg_SwitchOutputDevice,
140 int /* stream_id */,
141 int /* render_frame_id */,
142 std::string /* device_id */,
143 GURL /* security_origin */,
144 int /* request_id */)