| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/memory/shared_memory.h" | 5 #include "base/memory/shared_memory.h" |
| 6 #include "content/common/content_export.h" | 6 #include "content/common/content_export.h" |
| 7 #include "content/common/media/video_capture.h" | 7 #include "content/common/media/video_capture.h" |
| 8 #include "content/public/common/common_param_traits.h" | 8 #include "content/public/common/common_param_traits.h" |
| 9 #include "gpu/command_buffer/common/mailbox_holder.h" | 9 #include "gpu/command_buffer/common/mailbox_holder.h" |
| 10 #include "ipc/ipc_message_macros.h" | 10 #include "ipc/ipc_message_macros.h" |
| 11 #include "media/base/video_capture_types.h" | 11 #include "media/base/video_capture_types.h" |
| 12 #include "media/base/video_frame.h" | 12 #include "media/base/video_frame.h" |
| 13 #include "ui/gfx/gpu_memory_buffer.h" |
| 13 | 14 |
| 14 #undef IPC_MESSAGE_EXPORT | 15 #undef IPC_MESSAGE_EXPORT |
| 15 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT | 16 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT |
| 16 #define IPC_MESSAGE_START VideoCaptureMsgStart | 17 #define IPC_MESSAGE_START VideoCaptureMsgStart |
| 17 | 18 |
| 18 IPC_ENUM_TRAITS_MAX_VALUE(content::VideoCaptureState, | 19 IPC_ENUM_TRAITS_MAX_VALUE(content::VideoCaptureState, |
| 19 content::VIDEO_CAPTURE_STATE_LAST) | 20 content::VIDEO_CAPTURE_STATE_LAST) |
| 20 IPC_ENUM_TRAITS_MAX_VALUE(media::ResolutionChangePolicy, | 21 IPC_ENUM_TRAITS_MAX_VALUE(media::ResolutionChangePolicy, |
| 21 media::RESOLUTION_POLICY_LAST) | 22 media::RESOLUTION_POLICY_LAST) |
| 22 IPC_ENUM_TRAITS_MAX_VALUE(media::VideoPixelFormat, media::PIXEL_FORMAT_MAX) | 23 IPC_ENUM_TRAITS_MAX_VALUE(media::VideoPixelFormat, media::PIXEL_FORMAT_MAX) |
| (...skipping 10 matching lines...) Expand all Loading... |
| 33 | 34 |
| 34 IPC_STRUCT_BEGIN(VideoCaptureMsg_BufferReady_Params) | 35 IPC_STRUCT_BEGIN(VideoCaptureMsg_BufferReady_Params) |
| 35 IPC_STRUCT_MEMBER(int, device_id) | 36 IPC_STRUCT_MEMBER(int, device_id) |
| 36 IPC_STRUCT_MEMBER(int, buffer_id) | 37 IPC_STRUCT_MEMBER(int, buffer_id) |
| 37 IPC_STRUCT_MEMBER(base::TimeTicks, timestamp) | 38 IPC_STRUCT_MEMBER(base::TimeTicks, timestamp) |
| 38 IPC_STRUCT_MEMBER(base::DictionaryValue, metadata) | 39 IPC_STRUCT_MEMBER(base::DictionaryValue, metadata) |
| 39 IPC_STRUCT_MEMBER(media::VideoPixelFormat, pixel_format) | 40 IPC_STRUCT_MEMBER(media::VideoPixelFormat, pixel_format) |
| 40 IPC_STRUCT_MEMBER(media::VideoFrame::StorageType, storage_type) | 41 IPC_STRUCT_MEMBER(media::VideoFrame::StorageType, storage_type) |
| 41 IPC_STRUCT_MEMBER(gfx::Size, coded_size) | 42 IPC_STRUCT_MEMBER(gfx::Size, coded_size) |
| 42 IPC_STRUCT_MEMBER(gfx::Rect, visible_rect) | 43 IPC_STRUCT_MEMBER(gfx::Rect, visible_rect) |
| 43 IPC_STRUCT_MEMBER(gpu::MailboxHolder, mailbox_holder) | 44 IPC_STRUCT_MEMBER(std::vector<gpu::MailboxHolder>, mailbox_holders) |
| 44 IPC_STRUCT_END() | 45 IPC_STRUCT_END() |
| 45 | 46 |
| 46 // TODO(nick): device_id in these messages is basically just a route_id. We | 47 // TODO(nick): device_id in these messages is basically just a route_id. We |
| 47 // should shift to IPC_MESSAGE_ROUTED and use MessageRouter in the filter impls. | 48 // should shift to IPC_MESSAGE_ROUTED and use MessageRouter in the filter impls. |
| 48 | 49 |
| 49 // Notify the renderer process about the state update such as | 50 // Notify the renderer process about the state update such as |
| 50 // Start/Pause/Stop. | 51 // Start/Pause/Stop. |
| 51 IPC_MESSAGE_CONTROL2(VideoCaptureMsg_StateChanged, | 52 IPC_MESSAGE_CONTROL2(VideoCaptureMsg_StateChanged, |
| 52 int /* device id */, | 53 int /* device id */, |
| 53 content::VideoCaptureState /* new state */) | 54 content::VideoCaptureState /* new state */) |
| 54 | 55 |
| 55 // Tell the renderer process that a new buffer is allocated for video capture. | 56 // Tell the renderer process that a new buffer is allocated for video capture. |
| 56 IPC_MESSAGE_CONTROL4(VideoCaptureMsg_NewBuffer, | 57 IPC_MESSAGE_CONTROL4(VideoCaptureMsg_NewBuffer, |
| 57 int /* device id */, | 58 int /* device id */, |
| 58 base::SharedMemoryHandle /* handle */, | 59 base::SharedMemoryHandle /* handle */, |
| 59 int /* length */, | 60 int /* length */, |
| 60 int /* buffer_id */) | 61 int /* buffer_id */) |
| 61 | 62 |
| 63 // Tell the renderer process that a new GpuMemoryBuffer backed buffer is |
| 64 // allocated for video capture. |
| 65 IPC_MESSAGE_CONTROL4(VideoCaptureMsg_NewGpuMemoryBuffer, |
| 66 int /* device id */, |
| 67 std::vector<gfx::GpuMemoryBufferHandle> /* gmb_handles */, |
| 68 gfx::Size /* dimensions */, |
| 69 int /* buffer_id */) |
| 70 |
| 62 // Tell the renderer process that it should release a buffer previously | 71 // Tell the renderer process that it should release a buffer previously |
| 63 // allocated by VideoCaptureMsg_NewBuffer. | 72 // allocated by VideoCaptureMsg_NewBuffer. |
| 64 IPC_MESSAGE_CONTROL2(VideoCaptureMsg_FreeBuffer, | 73 IPC_MESSAGE_CONTROL2(VideoCaptureMsg_FreeBuffer, |
| 65 int /* device id */, | 74 int /* device id */, |
| 66 int /* buffer_id */) | 75 int /* buffer_id */) |
| 67 | 76 |
| 68 // Tell the renderer process that a Buffer is available from video capture, and | 77 // Tell the renderer process that a Buffer is available from video capture, and |
| 69 // send the associated VideoFrame constituient parts as IPC parameters. | 78 // send the associated VideoFrame constituient parts as IPC parameters. |
| 70 IPC_MESSAGE_CONTROL1(VideoCaptureMsg_BufferReady, | 79 IPC_MESSAGE_CONTROL1(VideoCaptureMsg_BufferReady, |
| 71 VideoCaptureMsg_BufferReady_Params) | 80 VideoCaptureMsg_BufferReady_Params) |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 | 123 |
| 115 // Get the formats supported by a device referenced by |capture_session_id|. | 124 // Get the formats supported by a device referenced by |capture_session_id|. |
| 116 IPC_MESSAGE_CONTROL2(VideoCaptureHostMsg_GetDeviceSupportedFormats, | 125 IPC_MESSAGE_CONTROL2(VideoCaptureHostMsg_GetDeviceSupportedFormats, |
| 117 int /* device_id */, | 126 int /* device_id */, |
| 118 media::VideoCaptureSessionId /* session_id */) | 127 media::VideoCaptureSessionId /* session_id */) |
| 119 | 128 |
| 120 // Get the format(s) in use by a device referenced by |capture_session_id|. | 129 // Get the format(s) in use by a device referenced by |capture_session_id|. |
| 121 IPC_MESSAGE_CONTROL2(VideoCaptureHostMsg_GetDeviceFormatsInUse, | 130 IPC_MESSAGE_CONTROL2(VideoCaptureHostMsg_GetDeviceFormatsInUse, |
| 122 int /* device_id */, | 131 int /* device_id */, |
| 123 media::VideoCaptureSessionId /* session_id */) | 132 media::VideoCaptureSessionId /* session_id */) |
| OLD | NEW |