Roll src/third_party/WebKit eac3800:0237a66 (svn 202606:202607)
[chromium-blink-merge.git] / content / common / media / media_stream_messages.h
blob8975355309456c269b94ec12ece1c2f19363338d
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 media streaming.
6 // Multiply-included message file, hence no include guard.
8 #include <string>
10 #include "content/common/content_export.h"
11 #include "content/common/media/media_stream_options.h"
12 #include "ipc/ipc_message_macros.h"
13 #include "ipc/ipc_platform_file.h"
14 #include "url/gurl.h"
16 #undef IPC_MESSAGE_EXPORT
17 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
18 #define IPC_MESSAGE_START MediaStreamMsgStart
20 IPC_ENUM_TRAITS_MAX_VALUE(content::MediaStreamType,
21 content::NUM_MEDIA_TYPES - 1)
23 IPC_ENUM_TRAITS_MAX_VALUE(content::VideoFacingMode,
24 content::NUM_MEDIA_VIDEO_FACING_MODE - 1)
26 IPC_ENUM_TRAITS_MAX_VALUE(content::MediaStreamRequestResult,
27 content::NUM_MEDIA_REQUEST_RESULTS - 1)
29 IPC_STRUCT_TRAITS_BEGIN(content::StreamOptions::Constraint)
30 IPC_STRUCT_TRAITS_MEMBER(name)
31 IPC_STRUCT_TRAITS_MEMBER(value)
32 IPC_STRUCT_TRAITS_END()
34 IPC_STRUCT_TRAITS_BEGIN(content::StreamOptions)
35 IPC_STRUCT_TRAITS_MEMBER(audio_requested)
36 IPC_STRUCT_TRAITS_MEMBER(mandatory_audio)
37 IPC_STRUCT_TRAITS_MEMBER(optional_audio)
38 IPC_STRUCT_TRAITS_MEMBER(video_requested)
39 IPC_STRUCT_TRAITS_MEMBER(mandatory_video)
40 IPC_STRUCT_TRAITS_MEMBER(optional_video)
41 IPC_STRUCT_TRAITS_END()
43 IPC_STRUCT_TRAITS_BEGIN(content::StreamDeviceInfo)
44 IPC_STRUCT_TRAITS_MEMBER(device.type)
45 IPC_STRUCT_TRAITS_MEMBER(device.name)
46 IPC_STRUCT_TRAITS_MEMBER(device.id)
47 IPC_STRUCT_TRAITS_MEMBER(device.video_facing)
48 IPC_STRUCT_TRAITS_MEMBER(device.matched_output_device_id)
49 IPC_STRUCT_TRAITS_MEMBER(device.input.sample_rate)
50 IPC_STRUCT_TRAITS_MEMBER(device.input.channel_layout)
51 IPC_STRUCT_TRAITS_MEMBER(device.input.frames_per_buffer)
52 IPC_STRUCT_TRAITS_MEMBER(device.input.effects)
53 IPC_STRUCT_TRAITS_MEMBER(device.input.mic_positions)
54 IPC_STRUCT_TRAITS_MEMBER(device.matched_output.sample_rate)
55 IPC_STRUCT_TRAITS_MEMBER(device.matched_output.channel_layout)
56 IPC_STRUCT_TRAITS_MEMBER(device.matched_output.frames_per_buffer)
57 IPC_STRUCT_TRAITS_MEMBER(session_id)
58 IPC_STRUCT_TRAITS_END()
60 // Message sent from the browser to the renderer
62 // The browser has generated a stream successfully.
63 IPC_MESSAGE_ROUTED4(MediaStreamMsg_StreamGenerated,
64 int /* request id */,
65 std::string /* label */,
66 content::StreamDeviceInfoArray /* audio_device_list */,
67 content::StreamDeviceInfoArray /* video_device_list */)
69 // The browser has failed to generate a stream.
70 IPC_MESSAGE_ROUTED2(MediaStreamMsg_StreamGenerationFailed,
71 int /* request id */,
72 content::MediaStreamRequestResult /* result */)
74 // The browser reports that a media device has been stopped. Stopping was
75 // triggered from the browser process.
76 IPC_MESSAGE_ROUTED2(MediaStreamMsg_DeviceStopped,
77 std::string /* label */,
78 content::StreamDeviceInfo /* the device */)
80 // The browser has enumerated devices. If no devices are found
81 // |device_list| is empty.
82 // Used by Pepper and WebRTC.
83 IPC_MESSAGE_ROUTED2(MediaStreamMsg_DevicesEnumerated,
84 int /* request id */,
85 content::StreamDeviceInfoArray /* device_list */)
87 // TODO(wjia): should DeviceOpen* messages be merged with
88 // StreamGenerat* ones?
89 // The browser has opened a device successfully.
90 IPC_MESSAGE_ROUTED3(MediaStreamMsg_DeviceOpened,
91 int /* request id */,
92 std::string /* label */,
93 content::StreamDeviceInfo /* the device */)
95 // The browser has failed to open a device.
96 IPC_MESSAGE_ROUTED1(MediaStreamMsg_DeviceOpenFailed,
97 int /* request id */)
99 // Messages sent from the renderer to the browser.
101 // Request a new media stream.
102 IPC_MESSAGE_CONTROL5(MediaStreamHostMsg_GenerateStream,
103 int /* render frame id */,
104 int /* request id */,
105 content::StreamOptions /* components */,
106 GURL /* security origin */,
107 bool /* user_gesture */)
109 // Request to cancel the request for a new media stream.
110 IPC_MESSAGE_CONTROL2(MediaStreamHostMsg_CancelGenerateStream,
111 int /* render frame id */,
112 int /* request id */)
114 // Request to close a device that has been opened by GenerateStream.
115 IPC_MESSAGE_CONTROL2(MediaStreamHostMsg_StopStreamDevice,
116 int /* render frame id */,
117 std::string /*device_id*/)
119 // Request to enumerate devices.
120 // Used by Pepper and WebRTC.
121 IPC_MESSAGE_CONTROL4(MediaStreamHostMsg_EnumerateDevices,
122 int /* render frame id */,
123 int /* request id */,
124 content::MediaStreamType /* type */,
125 GURL /* security origin */)
127 // Request to stop enumerating devices.
128 IPC_MESSAGE_CONTROL2(MediaStreamHostMsg_CancelEnumerateDevices,
129 int /* render frame id */,
130 int /* request id */)
132 // Request to open the device.
133 IPC_MESSAGE_CONTROL5(MediaStreamHostMsg_OpenDevice,
134 int /* render frame id */,
135 int /* request id */,
136 std::string /* device_id */,
137 content::MediaStreamType /* type */,
138 GURL /* security origin */)
140 // Request to close a device.
141 IPC_MESSAGE_CONTROL2(MediaStreamHostMsg_CloseDevice,
142 int /* render frame id */,
143 std::string /*label*/)