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 #include "base/memory/shared_memory.h"
6 #include "content/common/content_export.h"
7 #include "content/common/media/video_capture.h"
8 #include "content/public/common/common_param_traits.h"
9 #include "ipc/ipc_message_macros.h"
10 #include "media/video/capture/video_capture_types.h"
12 #undef IPC_MESSAGE_EXPORT
13 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
14 #define IPC_MESSAGE_START VideoCaptureMsgStart
16 IPC_ENUM_TRAITS_MAX_VALUE(content::VideoCaptureState,
17 content::VIDEO_CAPTURE_STATE_LAST)
19 IPC_STRUCT_TRAITS_BEGIN(media::VideoCaptureParams)
20 IPC_STRUCT_TRAITS_MEMBER(requested_format)
21 IPC_STRUCT_TRAITS_MEMBER(allow_resolution_change)
22 IPC_STRUCT_TRAITS_END()
24 // TODO(nick): device_id in these messages is basically just a route_id. We
25 // should shift to IPC_MESSAGE_ROUTED and use MessageRouter in the filter impls.
27 // Notify the renderer process about the state update such as
29 IPC_MESSAGE_CONTROL2(VideoCaptureMsg_StateChanged,
31 content::VideoCaptureState /* new state */)
33 // Tell the renderer process that a new buffer is allocated for video capture.
34 IPC_MESSAGE_CONTROL4(VideoCaptureMsg_NewBuffer,
36 base::SharedMemoryHandle /* handle */,
40 // Tell the renderer process that it should release a buffer previously
41 // allocated by VideoCaptureMsg_NewBuffer.
42 IPC_MESSAGE_CONTROL2(VideoCaptureMsg_FreeBuffer,
46 // Tell the renderer process that a buffer is available from video capture.
47 IPC_MESSAGE_CONTROL4(VideoCaptureMsg_BufferReady,
50 base::TimeTicks /* timestamp */,
51 media::VideoCaptureFormat /* resolution */)
53 // Notify the renderer about a device's supported formats; this is a response
54 // to a VideoCaptureHostMsg_GetDeviceSupportedFormats request.
55 IPC_MESSAGE_CONTROL2(VideoCaptureMsg_DeviceSupportedFormatsEnumerated,
57 media::VideoCaptureFormats /* supported_formats */)
59 // Notify the renderer about a device's format(s) in use; this is a response
60 // to a VideoCaptureHostMsg_GetDeviceFormatInUse request.
61 IPC_MESSAGE_CONTROL2(VideoCaptureMsg_DeviceFormatsInUseReceived,
63 media::VideoCaptureFormats /* formats_in_use */)
65 // Start a video capture as |device_id|, a new id picked by the renderer
66 // process. The session to be started is determined by |params.session_id|.
67 IPC_MESSAGE_CONTROL3(VideoCaptureHostMsg_Start,
69 media::VideoCaptureSessionId, /* session_id */
70 media::VideoCaptureParams /* params */)
72 // Pause the video capture specified by |device_id|.
73 IPC_MESSAGE_CONTROL1(VideoCaptureHostMsg_Pause,
76 // Close the video capture specified by |device_id|.
77 IPC_MESSAGE_CONTROL1(VideoCaptureHostMsg_Stop,
80 // Tell the browser process that the renderer has finished reading from
81 // a buffer previously delivered by VideoCaptureMsg_BufferReady.
82 IPC_MESSAGE_CONTROL2(VideoCaptureHostMsg_BufferReady,
86 // Get the formats supported by a device referenced by |capture_session_id|.
87 IPC_MESSAGE_CONTROL2(VideoCaptureHostMsg_GetDeviceSupportedFormats,
89 media::VideoCaptureSessionId /* session_id */)
91 // Get the format(s) in use by a device referenced by |capture_session_id|.
92 IPC_MESSAGE_CONTROL2(VideoCaptureHostMsg_GetDeviceFormatsInUse,
94 media::VideoCaptureSessionId /* session_id */)