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. 4 5 // IPC messages for the media streaming. 6 // Multiply-included message file, hence no include guard. 7 8 #include <string> 9 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 "url/gurl.h" 14 15 #undef IPC_MESSAGE_EXPORT 16 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT 17 #define IPC_MESSAGE_START MediaStreamMsgStart 18 19 IPC_ENUM_TRAITS_MAX_VALUE(content::MediaStreamType, 20 content::NUM_MEDIA_TYPES - 1) 21 22 IPC_STRUCT_TRAITS_BEGIN(content::StreamOptions) 23 IPC_STRUCT_TRAITS_MEMBER(audio_type) 24 IPC_STRUCT_TRAITS_MEMBER(audio_device_id) 25 IPC_STRUCT_TRAITS_MEMBER(video_type) 26 IPC_STRUCT_TRAITS_MEMBER(video_device_id) 27 IPC_STRUCT_TRAITS_END() 28 29 IPC_STRUCT_TRAITS_BEGIN(content::StreamDeviceInfo) 30 IPC_STRUCT_TRAITS_MEMBER(device.type) 31 IPC_STRUCT_TRAITS_MEMBER(device.name) 32 IPC_STRUCT_TRAITS_MEMBER(device.id) 33 IPC_STRUCT_TRAITS_MEMBER(device.sample_rate) 34 IPC_STRUCT_TRAITS_MEMBER(device.channel_layout) 35 IPC_STRUCT_TRAITS_MEMBER(in_use) 36 IPC_STRUCT_TRAITS_MEMBER(session_id) 37 IPC_STRUCT_TRAITS_END() 38 39 // Message sent from the browser to the renderer 40 41 // The browser has generated a stream successfully. 42 IPC_MESSAGE_ROUTED4(MediaStreamMsg_StreamGenerated, 43 int /* request id */, 44 std::string /* label */, 45 content::StreamDeviceInfoArray /* audio_device_list */, 46 content::StreamDeviceInfoArray /* video_device_list */) 47 48 // The browser has failed to generate a stream. 49 IPC_MESSAGE_ROUTED1(MediaStreamMsg_StreamGenerationFailed, 50 int /* request id */) 51 52 // The browser requests to stop streaming. 53 // Note that this differs from MediaStreamHostMsg_StopGeneratedStream below 54 // which is a request from the renderer. 55 IPC_MESSAGE_ROUTED1(MediaStreamMsg_StopGeneratedStream, 56 std::string /* label */) 57 58 // The browser has enumerated devices successfully. 59 // Used by Pepper. 60 // TODO(vrk,wjia): Move this to pepper code. 61 IPC_MESSAGE_ROUTED3(MediaStreamMsg_DevicesEnumerated, 62 int /* request id */, 63 std::string /* label */, 64 content::StreamDeviceInfoArray /* device_list */) 65 66 // The browser has failed to enumerate devices. 67 IPC_MESSAGE_ROUTED1(MediaStreamMsg_DevicesEnumerationFailed, 68 int /* request id */) 69 70 // TODO(wjia): should DeviceOpen* messages be merged with 71 // StreamGenerat* ones? 72 // The browser has opened a device successfully. 73 IPC_MESSAGE_ROUTED3(MediaStreamMsg_DeviceOpened, 74 int /* request id */, 75 std::string /* label */, 76 content::StreamDeviceInfo /* the device */) 77 78 // The browser has failed to open a device. 79 IPC_MESSAGE_ROUTED1(MediaStreamMsg_DeviceOpenFailed, 80 int /* request id */) 81 82 // Response to enumerate devices request. 83 IPC_MESSAGE_CONTROL2(MediaStreamMsg_GetSourcesACK, 84 int /* request id */, 85 content::StreamDeviceInfoArray /* device_list */) 86 87 // Messages sent from the renderer to the browser. 88 89 // Request a new media stream. 90 IPC_MESSAGE_CONTROL4(MediaStreamHostMsg_GenerateStream, 91 int /* render view id */, 92 int /* request id */, 93 content::StreamOptions /* components */, 94 GURL /* security origin */) 95 96 // Request to cancel the request for a new media stream. 97 IPC_MESSAGE_CONTROL2(MediaStreamHostMsg_CancelGenerateStream, 98 int /* render view id */, 99 int /* request id */) 100 101 // Request to stop streaming from the media stream. 102 IPC_MESSAGE_CONTROL2(MediaStreamHostMsg_StopGeneratedStream, 103 int /* render view id */, 104 std::string /* label */) 105 106 // Request to enumerate devices. 107 // Used by Pepper. 108 // TODO(vrk,wjia): Move this to pepper code. 109 IPC_MESSAGE_CONTROL4(MediaStreamHostMsg_EnumerateDevices, 110 int /* render view id */, 111 int /* request id */, 112 content::MediaStreamType /* type */, 113 GURL /* security origin */) 114 115 // Request to open the device. 116 IPC_MESSAGE_CONTROL5(MediaStreamHostMsg_OpenDevice, 117 int /* render view id */, 118 int /* request id */, 119 std::string /* device_id */, 120 content::MediaStreamType /* type */, 121 GURL /* security origin */) 122 123 // Request to enumerate devices. 124 IPC_MESSAGE_CONTROL2(MediaStreamHostMsg_GetSources, 125 int /* request id */, 126 GURL /* origin */) 127