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 "gpu/command_buffer/common/mailbox_holder.h"
10 #include "ipc/ipc_message_macros.h"
11 #include "media/video/capture/video_capture_types.h"
13 #undef IPC_MESSAGE_EXPORT
14 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
15 #define IPC_MESSAGE_START VideoCaptureMsgStart
17 IPC_ENUM_TRAITS_MAX_VALUE(content::VideoCaptureState
,
18 content::VIDEO_CAPTURE_STATE_LAST
)
20 IPC_ENUM_TRAITS_MAX_VALUE(media::ResolutionChangePolicy
,
21 media::RESOLUTION_POLICY_LAST
)
23 IPC_STRUCT_TRAITS_BEGIN(media::VideoCaptureParams
)
24 IPC_STRUCT_TRAITS_MEMBER(requested_format
)
25 IPC_STRUCT_TRAITS_MEMBER(resolution_change_policy
)
26 IPC_STRUCT_TRAITS_END()
28 // TODO(nick): device_id in these messages is basically just a route_id. We
29 // should shift to IPC_MESSAGE_ROUTED and use MessageRouter in the filter impls.
31 // Notify the renderer process about the state update such as
33 IPC_MESSAGE_CONTROL2(VideoCaptureMsg_StateChanged
,
35 content::VideoCaptureState
/* new state */)
37 // Tell the renderer process that a new buffer is allocated for video capture.
38 IPC_MESSAGE_CONTROL4(VideoCaptureMsg_NewBuffer
,
40 base::SharedMemoryHandle
/* handle */,
44 // Tell the renderer process that it should release a buffer previously
45 // allocated by VideoCaptureMsg_NewBuffer.
46 IPC_MESSAGE_CONTROL2(VideoCaptureMsg_FreeBuffer
,
50 // Tell the renderer process that a buffer is available from video capture.
51 IPC_MESSAGE_CONTROL5(VideoCaptureMsg_BufferReady
,
54 media::VideoCaptureFormat
/* format */,
55 gfx::Rect
/* visible_rect */,
56 base::TimeTicks
/* timestamp */)
58 // Tell the renderer process that a texture mailbox buffer is available from
60 IPC_MESSAGE_CONTROL5(VideoCaptureMsg_MailboxBufferReady
,
63 gpu::MailboxHolder
/* mailbox_holder */,
64 media::VideoCaptureFormat
/* format */,
65 base::TimeTicks
/* timestamp */)
67 // Notify the renderer about a device's supported formats; this is a response
68 // to a VideoCaptureHostMsg_GetDeviceSupportedFormats request.
69 IPC_MESSAGE_CONTROL2(VideoCaptureMsg_DeviceSupportedFormatsEnumerated
,
71 media::VideoCaptureFormats
/* supported_formats */)
73 // Notify the renderer about a device's format(s) in use; this is a response
74 // to a VideoCaptureHostMsg_GetDeviceFormatInUse request.
75 IPC_MESSAGE_CONTROL2(VideoCaptureMsg_DeviceFormatsInUseReceived
,
77 media::VideoCaptureFormats
/* formats_in_use */)
79 // Start a video capture as |device_id|, a new id picked by the renderer
80 // process. The session to be started is determined by |params.session_id|.
81 IPC_MESSAGE_CONTROL3(VideoCaptureHostMsg_Start
,
83 media::VideoCaptureSessionId
, /* session_id */
84 media::VideoCaptureParams
/* params */)
86 // Pause the video capture specified by |device_id|.
87 IPC_MESSAGE_CONTROL1(VideoCaptureHostMsg_Pause
,
90 // Resume the video capture specified by |device_id|, |session_id| and
92 IPC_MESSAGE_CONTROL3(VideoCaptureHostMsg_Resume
,
94 media::VideoCaptureSessionId
, /* session_id */
95 media::VideoCaptureParams
/* params */)
97 // Close the video capture specified by |device_id|.
98 IPC_MESSAGE_CONTROL1(VideoCaptureHostMsg_Stop
,
101 // Tell the browser process that the renderer has finished reading from
102 // a buffer previously delivered by VideoCaptureMsg_BufferReady.
103 IPC_MESSAGE_CONTROL3(VideoCaptureHostMsg_BufferReady
,
106 uint32
/* syncpoint */)
108 // Get the formats supported by a device referenced by |capture_session_id|.
109 IPC_MESSAGE_CONTROL2(VideoCaptureHostMsg_GetDeviceSupportedFormats
,
111 media::VideoCaptureSessionId
/* session_id */)
113 // Get the format(s) in use by a device referenced by |capture_session_id|.
114 IPC_MESSAGE_CONTROL2(VideoCaptureHostMsg_GetDeviceFormatsInUse
,
116 media::VideoCaptureSessionId
/* session_id */)