Roll src/third_party/WebKit eac3800:0237a66 (svn 202606:202607)
[chromium-blink-merge.git] / content / common / media / audio_messages.h
blobce26bcaa0363cb9141889458007da9b46dd5200f
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/origin.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_ENUM_TRAITS_MAX_VALUE(media::AudioParameters::Format,
35 media::AudioParameters::AUDIO_FORMAT_LAST)
37 IPC_ENUM_TRAITS_MAX_VALUE(media::ChannelLayout, media::CHANNEL_LAYOUT_MAX)
39 IPC_STRUCT_BEGIN(AudioInputHostMsg_CreateStream_Config)
40 IPC_STRUCT_MEMBER(media::AudioParameters, params)
41 IPC_STRUCT_MEMBER(bool, automatic_gain_control)
42 IPC_STRUCT_MEMBER(uint32, shared_memory_count)
43 IPC_STRUCT_END()
45 // Messages sent from the browser to the renderer.
47 // Tell the renderer process that an audio output device has been authorized
48 // for a given stream. The renderer is given the output parameters for the
49 // authorized device.
50 IPC_MESSAGE_CONTROL3(AudioMsg_NotifyDeviceAuthorized,
51 int /* stream id */,
52 bool /* success */,
53 media::AudioParameters /* output parameters */)
55 // Tell the renderer process that an audio stream has been created.
56 // The renderer process is given a shared memory handle for the audio data
57 // buffer it shares with the browser process. It is also given a SyncSocket that
58 // it uses to communicate with the browser process about the state of the
59 // buffered audio data.
60 IPC_MESSAGE_CONTROL4(
61 AudioMsg_NotifyStreamCreated,
62 int /* stream id */,
63 base::SharedMemoryHandle /* handle */,
64 base::SyncSocket::TransitDescriptor /* socket descriptor */,
65 uint32 /* length */)
67 // Tell the renderer process that an audio input stream has been created.
68 // The renderer process would be given a SyncSocket that it should read
69 // from from then on. It is also given number of segments in shared memory.
70 IPC_MESSAGE_CONTROL5(
71 AudioInputMsg_NotifyStreamCreated,
72 int /* stream id */,
73 base::SharedMemoryHandle /* handle */,
74 base::SyncSocket::TransitDescriptor /* socket descriptor */,
75 uint32 /* length */,
76 uint32 /* segment count */)
78 // Notification message sent from AudioRendererHost to renderer for state
79 // update after the renderer has requested a Create/Start/Close.
80 IPC_MESSAGE_CONTROL2(AudioMsg_NotifyStreamStateChanged,
81 int /* stream id */,
82 media::AudioOutputIPCDelegateState /* new state */)
84 // Notification message sent from browser to renderer for state update.
85 IPC_MESSAGE_CONTROL2(AudioInputMsg_NotifyStreamStateChanged,
86 int /* stream id */,
87 media::AudioInputIPCDelegateState /* new state */)
89 IPC_MESSAGE_CONTROL2(AudioInputMsg_NotifyStreamVolume,
90 int /* stream id */,
91 double /* volume */)
93 // Notification message sent from AudioRendererHost to renderer for state
94 // update after the renderer has requested a SwitchOutputDevice.
95 IPC_MESSAGE_CONTROL2(AudioMsg_NotifyOutputDeviceSwitched,
96 int /* stream id */,
97 media::SwitchOutputDeviceResult /* result */)
99 // Messages sent from the renderer to the browser.
101 // Message sent to the browser to request the use of an audio output
102 // device. |render_frame_id| is the routing ID for the RenderFrame producing
103 // the audio data.
104 IPC_MESSAGE_CONTROL5(AudioHostMsg_RequestDeviceAuthorization,
105 int /* stream_id */,
106 int /* render_frame_id */,
107 int /* session_id */,
108 std::string /* device_id */,
109 url::Origin /* security_origin */)
111 // Request that is sent to the browser for creating an audio output stream.
112 IPC_MESSAGE_CONTROL3(AudioHostMsg_CreateStream,
113 int /* stream_id */,
114 int /* render_frame_id */,
115 media::AudioParameters /* params */)
117 // Request that is sent to the browser for creating an audio input stream.
118 // |render_frame_id| is the routing ID for the RenderFrame consuming the audio
119 // data.
120 IPC_MESSAGE_CONTROL4(AudioInputHostMsg_CreateStream,
121 int /* stream_id */,
122 int /* render_frame_id */,
123 int /* session_id */,
124 AudioInputHostMsg_CreateStream_Config)
126 // Start buffering and play the audio stream specified by stream_id.
127 IPC_MESSAGE_CONTROL1(AudioHostMsg_PlayStream,
128 int /* stream_id */)
130 // Start recording the audio input stream specified by stream_id.
131 IPC_MESSAGE_CONTROL1(AudioInputHostMsg_RecordStream,
132 int /* stream_id */)
134 // Pause the audio stream specified by stream_id.
135 IPC_MESSAGE_CONTROL1(AudioHostMsg_PauseStream,
136 int /* stream_id */)
138 // Close an audio stream specified by stream_id.
139 IPC_MESSAGE_CONTROL1(AudioHostMsg_CloseStream,
140 int /* stream_id */)
142 // Close an audio input stream specified by stream_id.
143 IPC_MESSAGE_CONTROL1(AudioInputHostMsg_CloseStream,
144 int /* stream_id */)
146 // Set audio volume of the stream specified by stream_id.
147 // TODO(hclam): change this to vector if we have channel numbers other than 2.
148 IPC_MESSAGE_CONTROL2(AudioHostMsg_SetVolume,
149 int /* stream_id */,
150 double /* volume */)
152 // Set audio volume of the input stream specified by stream_id.
153 IPC_MESSAGE_CONTROL2(AudioInputHostMsg_SetVolume,
154 int /* stream_id */,
155 double /* volume */)
157 // Switch the output device of the stream specified by stream_id.
158 IPC_MESSAGE_CONTROL4(AudioHostMsg_SwitchOutputDevice,
159 int /* stream_id */,
160 int /* render_frame_id */,
161 std::string /* device_id */,
162 url::Origin /* security_origin */)