Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / content / common / media / video_capture_messages.h
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 #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"
11
12 #undef IPC_MESSAGE_EXPORT
13 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
14 #define IPC_MESSAGE_START VideoCaptureMsgStart
15
16 IPC_ENUM_TRAITS_MAX_VALUE(content::VideoCaptureState,
17                           content::VIDEO_CAPTURE_STATE_LAST)
18
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()
23
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.
26
27 // Notify the renderer process about the state update such as
28 // Start/Pause/Stop.
29 IPC_MESSAGE_CONTROL2(VideoCaptureMsg_StateChanged,
30                      int /* device id */,
31                      content::VideoCaptureState /* new state */)
32
33 // Tell the renderer process that a new buffer is allocated for video capture.
34 IPC_MESSAGE_CONTROL4(VideoCaptureMsg_NewBuffer,
35                      int /* device id */,
36                      base::SharedMemoryHandle /* handle */,
37                      int /* length */,
38                      int /* buffer_id */)
39
40 // Tell the renderer process that it should release a buffer previously
41 // allocated by VideoCaptureMsg_NewBuffer.
42 IPC_MESSAGE_CONTROL2(VideoCaptureMsg_FreeBuffer,
43                      int /* device id */,
44                      int /* buffer_id */)
45
46 // Tell the renderer process that a buffer is available from video capture.
47 IPC_MESSAGE_CONTROL4(VideoCaptureMsg_BufferReady,
48                      int /* device id */,
49                      int /* buffer_id */,
50                      base::TimeTicks /* timestamp */,
51                      media::VideoCaptureFormat /* resolution */)
52
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,
56                      int /* device_id */,
57                      media::VideoCaptureFormats /* supported_formats */)
58
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,
62                      int /* device_id */,
63                      media::VideoCaptureFormats /* formats_in_use */)
64
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,
68                      int /* device_id */,
69                      media::VideoCaptureSessionId, /* session_id */
70                      media::VideoCaptureParams /* params */)
71
72 // Pause the video capture specified by |device_id|.
73 IPC_MESSAGE_CONTROL1(VideoCaptureHostMsg_Pause,
74                      int /* device_id */)
75
76 // Close the video capture specified by |device_id|.
77 IPC_MESSAGE_CONTROL1(VideoCaptureHostMsg_Stop,
78                      int /* device_id */)
79
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,
83                      int /* device_id */,
84                      int /* buffer_id */)
85
86 // Get the formats supported by a device referenced by |capture_session_id|.
87 IPC_MESSAGE_CONTROL2(VideoCaptureHostMsg_GetDeviceSupportedFormats,
88                      int /* device_id */,
89                      media::VideoCaptureSessionId /* session_id */)
90
91 // Get the format(s) in use by a device referenced by |capture_session_id|.
92 IPC_MESSAGE_CONTROL2(VideoCaptureHostMsg_GetDeviceFormatsInUse,
93                      int /* device_id */,
94                      media::VideoCaptureSessionId /* session_id */)