Home | History | Annotate | Download | only in media
      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(content::VideoCaptureState)
     17 
     18 IPC_STRUCT_TRAITS_BEGIN(media::VideoCaptureParams)
     19   IPC_STRUCT_TRAITS_MEMBER(requested_format)
     20   IPC_STRUCT_TRAITS_MEMBER(allow_resolution_change)
     21 IPC_STRUCT_TRAITS_END()
     22 
     23 // TODO(nick): device_id in these messages is basically just a route_id. We
     24 // should shift to IPC_MESSAGE_ROUTED and use MessageRouter in the filter impls.
     25 
     26 // Notify the renderer process about the state update such as
     27 // Start/Pause/Stop.
     28 IPC_MESSAGE_CONTROL2(VideoCaptureMsg_StateChanged,
     29                      int /* device id */,
     30                      content::VideoCaptureState /* new state */)
     31 
     32 // Tell the renderer process that a new buffer is allocated for video capture.
     33 IPC_MESSAGE_CONTROL4(VideoCaptureMsg_NewBuffer,
     34                      int /* device id */,
     35                      base::SharedMemoryHandle /* handle */,
     36                      int /* length */,
     37                      int /* buffer_id */)
     38 
     39 // Tell the renderer process that it should release a buffer previously
     40 // allocated by VideoCaptureMsg_NewBuffer.
     41 IPC_MESSAGE_CONTROL2(VideoCaptureMsg_FreeBuffer,
     42                      int /* device id */,
     43                      int /* buffer_id */)
     44 
     45 // Tell the renderer process that a buffer is available from video capture.
     46 IPC_MESSAGE_CONTROL4(VideoCaptureMsg_BufferReady,
     47                      int /* device id */,
     48                      int /* buffer_id */,
     49                      base::Time /* timestamp */,
     50                      media::VideoCaptureFormat /* resolution */)
     51 
     52 // Start a video capture as |device_id|, a new id picked by the renderer
     53 // process. The session to be started is determined by |params.session_id|.
     54 IPC_MESSAGE_CONTROL3(VideoCaptureHostMsg_Start,
     55                      int /* device_id */,
     56                      media::VideoCaptureSessionId, /* session_id */
     57                      media::VideoCaptureParams /* params */)
     58 
     59 // Pause the video capture specified by |device_id|.
     60 IPC_MESSAGE_CONTROL1(VideoCaptureHostMsg_Pause,
     61                      int /* device_id */)
     62 
     63 // Close the video capture specified by |device_id|.
     64 IPC_MESSAGE_CONTROL1(VideoCaptureHostMsg_Stop,
     65                      int /* device_id */)
     66 
     67 // Tell the browser process that the renderer has finished reading from
     68 // a buffer previously delivered by VideoCaptureMsg_BufferReady.
     69 IPC_MESSAGE_CONTROL2(VideoCaptureHostMsg_BufferReady,
     70                      int /* device_id */,
     71                      int /* buffer_id */)
     72