Apply _RELATIVE relocations ahead of others.
[chromium-blink-merge.git] / content / common / media / audio_messages.h
blobcdc35211288d47a64e492c37e60e5e8344601a29
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 "base/basictypes.h"
9 #include "base/memory/shared_memory.h"
10 #include "base/sync_socket.h"
11 #include "content/common/content_export.h"
12 #include "content/common/media/media_param_traits.h"
13 #include "ipc/ipc_message_macros.h"
14 #include "media/audio/audio_input_ipc.h"
15 #include "media/audio/audio_output_ipc.h"
16 #include "media/audio/audio_parameters.h"
18 #undef IPC_MESSAGE_EXPORT
19 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
20 #define IPC_MESSAGE_START AudioMsgStart
22 IPC_ENUM_TRAITS_MAX_VALUE(media::AudioInputIPCDelegate::State,
23 media::AudioInputIPCDelegate::kStateLast)
25 IPC_ENUM_TRAITS_MAX_VALUE(media::AudioOutputIPCDelegate::State,
26 media::AudioOutputIPCDelegate::kStateLast)
28 IPC_STRUCT_BEGIN(AudioInputHostMsg_CreateStream_Config)
29 IPC_STRUCT_MEMBER(media::AudioParameters, params)
30 IPC_STRUCT_MEMBER(bool, automatic_gain_control)
31 IPC_STRUCT_MEMBER(uint32, shared_memory_count)
32 IPC_STRUCT_END()
34 // Messages sent from the browser to the renderer.
36 // Tell the renderer process that an audio stream has been created.
37 // The renderer process is given a shared memory handle for the audio data
38 // buffer it shares with the browser process. It is also given a SyncSocket that
39 // it uses to communicate with the browser process about the state of the
40 // buffered audio data.
41 IPC_MESSAGE_CONTROL4(
42 AudioMsg_NotifyStreamCreated,
43 int /* stream id */,
44 base::SharedMemoryHandle /* handle */,
45 base::SyncSocket::TransitDescriptor /* socket descriptor */,
46 uint32 /* length */)
48 // Tell the renderer process that an audio input stream has been created.
49 // The renderer process would be given a SyncSocket that it should read
50 // from from then on. It is also given number of segments in shared memory.
51 IPC_MESSAGE_CONTROL5(
52 AudioInputMsg_NotifyStreamCreated,
53 int /* stream id */,
54 base::SharedMemoryHandle /* handle */,
55 base::SyncSocket::TransitDescriptor /* socket descriptor */,
56 uint32 /* length */,
57 uint32 /* segment count */)
59 // Notification message sent from AudioRendererHost to renderer after an output
60 // device change has occurred.
61 IPC_MESSAGE_CONTROL3(AudioMsg_NotifyDeviceChanged,
62 int /* stream_id */,
63 int /* new_buffer_size */,
64 int /* new_sample_rate */)
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 // Messages sent from the renderer to the browser.
83 // Request that is sent to the browser for creating an audio output stream.
84 // |render_view_id| is the routing ID for the render view producing the audio
85 // data.
86 IPC_MESSAGE_CONTROL5(AudioHostMsg_CreateStream,
87 int /* stream_id */,
88 int /* render_view_id */,
89 int /* render_frame_id */,
90 int /* session_id */,
91 media::AudioParameters /* params */)
93 // Request that is sent to the browser for creating an audio input stream.
94 // |render_view_id| is the routing ID for the render view consuming the audio
95 // data.
96 IPC_MESSAGE_CONTROL4(AudioInputHostMsg_CreateStream,
97 int /* stream_id */,
98 int /* render_view_id */,
99 int /* session_id */,
100 AudioInputHostMsg_CreateStream_Config)
102 // Start buffering and play the audio stream specified by stream_id.
103 IPC_MESSAGE_CONTROL1(AudioHostMsg_PlayStream,
104 int /* stream_id */)
106 // Start recording the audio input stream specified by stream_id.
107 IPC_MESSAGE_CONTROL1(AudioInputHostMsg_RecordStream,
108 int /* stream_id */)
110 // Pause the audio stream specified by stream_id.
111 IPC_MESSAGE_CONTROL1(AudioHostMsg_PauseStream,
112 int /* stream_id */)
114 // Close an audio stream specified by stream_id.
115 IPC_MESSAGE_CONTROL1(AudioHostMsg_CloseStream,
116 int /* stream_id */)
118 // Close an audio input stream specified by stream_id.
119 IPC_MESSAGE_CONTROL1(AudioInputHostMsg_CloseStream,
120 int /* stream_id */)
122 // Set audio volume of the stream specified by stream_id.
123 // TODO(hclam): change this to vector if we have channel numbers other than 2.
124 IPC_MESSAGE_CONTROL2(AudioHostMsg_SetVolume,
125 int /* stream_id */,
126 double /* volume */)
128 // Set audio volume of the input stream specified by stream_id.
129 IPC_MESSAGE_CONTROL2(AudioInputHostMsg_SetVolume,
130 int /* stream_id */,
131 double /* volume */)