Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / content / common / media / audio_messages.h
blobd3df85976fe0decab8fd53e43f511891b8e431ed
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_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 stream has been created.
48 // The renderer process is given a shared memory handle for the audio data
49 // buffer it shares with the browser process. It is also given a SyncSocket that
50 // it uses to communicate with the browser process about the state of the
51 // buffered audio data.
52 IPC_MESSAGE_CONTROL4(
53 AudioMsg_NotifyStreamCreated,
54 int /* stream id */,
55 base::SharedMemoryHandle /* handle */,
56 base::SyncSocket::TransitDescriptor /* socket descriptor */,
57 uint32 /* length */)
59 // Tell the renderer process that an audio input stream has been created.
60 // The renderer process would be given a SyncSocket that it should read
61 // from from then on. It is also given number of segments in shared memory.
62 IPC_MESSAGE_CONTROL5(
63 AudioInputMsg_NotifyStreamCreated,
64 int /* stream id */,
65 base::SharedMemoryHandle /* handle */,
66 base::SyncSocket::TransitDescriptor /* socket descriptor */,
67 uint32 /* length */,
68 uint32 /* segment count */)
70 // Notification message sent from AudioRendererHost to renderer for state
71 // update after the renderer has requested a Create/Start/Close.
72 IPC_MESSAGE_CONTROL2(AudioMsg_NotifyStreamStateChanged,
73 int /* stream id */,
74 media::AudioOutputIPCDelegateState /* new state */)
76 // Notification message sent from browser to renderer for state update.
77 IPC_MESSAGE_CONTROL2(AudioInputMsg_NotifyStreamStateChanged,
78 int /* stream id */,
79 media::AudioInputIPCDelegateState /* new state */)
81 IPC_MESSAGE_CONTROL2(AudioInputMsg_NotifyStreamVolume,
82 int /* stream id */,
83 double /* volume */)
85 // Notification message sent from AudioRendererHost to renderer for state
86 // update after the renderer has requested a SwitchOutputDevice.
87 IPC_MESSAGE_CONTROL3(AudioMsg_NotifyOutputDeviceSwitched,
88 int /* stream id */,
89 int /* request id */,
90 media::SwitchOutputDeviceResult /* result */)
92 // Messages sent from the renderer to the browser.
94 // Request that is sent to the browser for creating an audio output stream.
95 // |render_frame_id| is the routing ID for the RenderFrame producing the audio
96 // data.
97 IPC_MESSAGE_CONTROL4(AudioHostMsg_CreateStream,
98 int /* stream_id */,
99 int /* render_frame_id */,
100 int /* session_id */,
101 media::AudioParameters /* params */)
103 // Request that is sent to the browser for creating an audio input stream.
104 // |render_frame_id| is the routing ID for the RenderFrame consuming the audio
105 // data.
106 IPC_MESSAGE_CONTROL4(AudioInputHostMsg_CreateStream,
107 int /* stream_id */,
108 int /* render_frame_id */,
109 int /* session_id */,
110 AudioInputHostMsg_CreateStream_Config)
112 // Start buffering and play the audio stream specified by stream_id.
113 IPC_MESSAGE_CONTROL1(AudioHostMsg_PlayStream,
114 int /* stream_id */)
116 // Start recording the audio input stream specified by stream_id.
117 IPC_MESSAGE_CONTROL1(AudioInputHostMsg_RecordStream,
118 int /* stream_id */)
120 // Pause the audio stream specified by stream_id.
121 IPC_MESSAGE_CONTROL1(AudioHostMsg_PauseStream,
122 int /* stream_id */)
124 // Close an audio stream specified by stream_id.
125 IPC_MESSAGE_CONTROL1(AudioHostMsg_CloseStream,
126 int /* stream_id */)
128 // Close an audio input stream specified by stream_id.
129 IPC_MESSAGE_CONTROL1(AudioInputHostMsg_CloseStream,
130 int /* stream_id */)
132 // Set audio volume of the stream specified by stream_id.
133 // TODO(hclam): change this to vector if we have channel numbers other than 2.
134 IPC_MESSAGE_CONTROL2(AudioHostMsg_SetVolume,
135 int /* stream_id */,
136 double /* volume */)
138 // Set audio volume of the input stream specified by stream_id.
139 IPC_MESSAGE_CONTROL2(AudioInputHostMsg_SetVolume,
140 int /* stream_id */,
141 double /* volume */)
143 // Switch the output device of the stream specified by stream_id.
144 IPC_MESSAGE_CONTROL5(AudioHostMsg_SwitchOutputDevice,
145 int /* stream_id */,
146 int /* render_frame_id */,
147 std::string /* device_id */,
148 GURL /* security_origin */,
149 int /* request_id */)