OLD | NEW |
(Empty) | |
| 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 "ipc/ipc_message_macros.h" |
| 6 #include "media/video/capture/video_capture_types.h" |
| 7 #include "media/video/video_encode_types.h" |
| 8 |
| 9 #undef IPC_MESSAGE_EXPORT |
| 10 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT |
| 11 #define IPC_MESSAGE_START EncodedVideoCaptureMsgStart |
| 12 |
| 13 #if !defined(OS_ANDROID) |
| 14 IPC_ENUM_TRAITS(media::VideoCodec) |
| 15 #endif // !defined(OS_ANDROID) |
| 16 |
| 17 IPC_STRUCT_TRAITS_BEGIN(media::VideoEncodingConfig) |
| 18 IPC_STRUCT_TRAITS_MEMBER(codec_type) |
| 19 IPC_STRUCT_TRAITS_MEMBER(codec_name) |
| 20 IPC_STRUCT_TRAITS_MEMBER(max_resolution) |
| 21 IPC_STRUCT_TRAITS_MEMBER(max_frames_per_second) |
| 22 IPC_STRUCT_TRAITS_MEMBER(max_bitrate) |
| 23 IPC_STRUCT_TRAITS_END() |
| 24 |
| 25 IPC_STRUCT_TRAITS_BEGIN(media::RuntimeVideoEncodingParameters) |
| 26 IPC_STRUCT_TRAITS_MEMBER(target_bitrate) |
| 27 IPC_STRUCT_TRAITS_MEMBER(max_bitrate) |
| 28 IPC_STRUCT_TRAITS_MEMBER(frames_per_second) |
| 29 IPC_STRUCT_TRAITS_END() |
| 30 |
| 31 IPC_STRUCT_TRAITS_BEGIN(media::VideoEncodingParameters) |
| 32 IPC_STRUCT_TRAITS_MEMBER(codec_name) |
| 33 IPC_STRUCT_TRAITS_MEMBER(resolution) |
| 34 IPC_STRUCT_TRAITS_MEMBER(runtime_params) |
| 35 IPC_STRUCT_TRAITS_END() |
| 36 |
| 37 IPC_STRUCT_TRAITS_BEGIN(media::BufferEncodingMetadata) |
| 38 IPC_STRUCT_TRAITS_MEMBER(timestamp) |
| 39 IPC_STRUCT_TRAITS_MEMBER(key_frame) |
| 40 IPC_STRUCT_TRAITS_END() |
| 41 |
| 42 //------------------------------------------------------------------------------ |
| 43 // Renderer Source Messages |
| 44 // These are messages from the Renderer to the Browser process. |
| 45 |
| 46 // Queries the encoding capabilities for the device. A successful request |
| 47 // results in EncoderVideoSourceMessage_CapabilitiesAvailable message. |
| 48 IPC_MESSAGE_CONTROL1(EncodedVideoCaptureHostMsg_GetCapabilities, |
| 49 int /* device_id */) |
| 50 |
| 51 // Opens a bitstream with specific parameters. A successful request results in |
| 52 // beginning of streaming and EncoderVideoSourceMsg_BitstreamOpened message. |
| 53 // A failed request triggers EncodedVideoCaptureMsg_BitstreamClosed message. As |
| 54 // this set of messages is designed to work with existing device, device_id is |
| 55 // determined on the basis which device is providing the encoded video source |
| 56 // functionality. Only one bitstream can be opened for a given device. |
| 57 IPC_MESSAGE_CONTROL2(EncodedVideoCaptureHostMsg_OpenBitstream, |
| 58 int /* device_id */, |
| 59 media::VideoEncodingParameters /* params */) |
| 60 |
| 61 // Stops streaming a bitstream. When Browser has finalized the bitstream it will |
| 62 // trigger EncodedVideoCaptureMsg_BitstreamClosed message back to Renderer. |
| 63 // Renderer must be prepared to receive EncodedVideoCaptureMsg_BitstreamReady |
| 64 // messages until it receives EncodedVideoCaptureMsg_BitstreamClosed message. |
| 65 IPC_MESSAGE_CONTROL1(EncodedVideoCaptureHostMsg_CloseBitstream, |
| 66 int /* device_id */) |
| 67 |
| 68 // Sets a stream's bitstream configuration. Will always result in |
| 69 // EncodedVideoCaptureMsg_BitstreamConfigChanged message containing |
| 70 // currently active parameters, regardless of whether this call succeeded or |
| 71 // not. |
| 72 IPC_MESSAGE_CONTROL2(EncodedVideoCaptureHostMsg_TryConfigureBitstream, |
| 73 int /* device_id */, |
| 74 media::RuntimeVideoEncodingParameters /* params */) |
| 75 |
| 76 // Notifies that the data within a buffer has been processed and it can be |
| 77 // reused to encode upcoming bitstream. |
| 78 IPC_MESSAGE_CONTROL2(EncodedVideoCaptureHostMsg_BitstreamBufferConsumed, |
| 79 int /* device_id */, |
| 80 int /* buffer_id */) |
| 81 |
| 82 //------------------------------------------------------------------------------ |
| 83 // Renderer Messages |
| 84 // These are messages from the Browser to the Renderer process. |
| 85 |
| 86 // Reports the encoding capabilities of the device. |
| 87 IPC_MESSAGE_CONTROL2(EncodedVideoCaptureMsg_CapabilitiesAvailable, |
| 88 int /* device_id */, |
| 89 media::VideoEncodingCapabilities /* capabilities */) |
| 90 |
| 91 // Acknowledges a request to open an encoded video bitstream. When this message |
| 92 // occurs, bitstream can be considered to be streaming, and Renderer should be |
| 93 // ready to start accepting EncodedVideoCaptureMsg_BitstreamReady messages and |
| 94 // buffers contained within them. Shared memory buffers used to deliver the |
| 95 // bitstream are assigned with buffer ids as specified by the buffers parameter. |
| 96 // All buffers have the same size as indicated by |buffer_size|. |
| 97 IPC_MESSAGE_CONTROL4(EncodedVideoCaptureMsg_BitstreamOpened, |
| 98 int /* device_id */, |
| 99 media::VideoEncodingParameters /* params */, |
| 100 std::vector<base::SharedMemoryHandle> /* buffers */, |
| 101 int /* buffer_size */) |
| 102 |
| 103 // Acknowledges a request to close an encoded video bitstream. |
| 104 IPC_MESSAGE_CONTROL1(EncodedVideoCaptureMsg_BitstreamClosed, |
| 105 int /* device_id */) |
| 106 |
| 107 // Informs the clients of the current encoding parameters, regardless of whether |
| 108 // the previous request to change them has been successful or not. It is usually |
| 109 // called in response to EncodedVideoCaptureHostMsg_TryConfigureBitstream |
| 110 // at runtime, but can occur also as a result of config change initiated by |
| 111 // encoder or other clients in the system, e.g. if there are multiple clients |
| 112 // and bitstream config change is requested from one client, all clients should |
| 113 // be prepared to handle the configuration change. |
| 114 IPC_MESSAGE_CONTROL2(EncodedVideoCaptureMsg_BitstreamConfigChanged, |
| 115 int /* device_id */, |
| 116 media::RuntimeVideoEncodingParameters /* current_params */) |
| 117 |
| 118 // Indicates that a bitstream buffer is available for the stream. The value of |
| 119 // |size| indicates the amount of valid bitstream data (in bytes). |
| 120 IPC_MESSAGE_CONTROL4(EncodedVideoCaptureMsg_BitstreamReady, |
| 121 int /* device_id */, |
| 122 int /* buffer_id */, |
| 123 int /* size */, |
| 124 media::BufferEncodingMetadata /* metadata */) |
OLD | NEW |