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/encoded_video_source.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 EncodedVideoSourceMsgStart |
| 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 // Need to typedef BitstreamBufferMap in order to prevent the IPC message macros |
| 43 // from choking on the comma. |
| 44 typedef std::map<int, base::SharedMemoryHandle> BitstreamBufferMap; |
| 45 |
| 46 //------------------------------------------------------------------------------ |
| 47 // Renderer Source Messages |
| 48 // These are messages from the Renderer to the Browser process. |
| 49 |
| 50 // Queries the encoding capabilities for the device. A successful request |
| 51 // results in EncoderVideoSourceMessage_CapabilitiesAvailable message. |
| 52 IPC_MESSAGE_CONTROL1(EncodedVideoSourceHostMsg_GetCapabilities, |
| 53 int /* device_id */) |
| 54 |
| 55 // Opens a bitstream with specific parameters. A successful request results in |
| 56 // beginning of streaming and EncoderVideoSourceMsg_BitstreamOpened message. |
| 57 // A failed request triggers EncodedVideoSourceMsg_BitstreamClosed message. As |
| 58 // this set of messages is designed to work with existing device, device_id is |
| 59 // determined on the basis which device is providing the encoded video source |
| 60 // functionality. Only one bitstream can be opened for a given device. |
| 61 IPC_MESSAGE_CONTROL2(EncodedVideoSourceHostMsg_OpenBitstream, |
| 62 int /* device_id */, |
| 63 media::VideoEncodingParameters /* params */) |
| 64 |
| 65 // Stops streaming a bitstream. When Browser has finalized the bitstream it will |
| 66 // trigger EncodedVideoSourceMsg_BitstreamClosed message back to Renderer. |
| 67 // Renderer must be prepared to receive EncodedVideoSourceMsg_BitstreamReady |
| 68 // messages until it receives the EncodedVideoSourceMsg_BitstreamClosed message. |
| 69 IPC_MESSAGE_CONTROL1(EncodedVideoSourceHostMsg_CloseBitstream, |
| 70 int /* device_id */) |
| 71 |
| 72 // Sets a stream's bitstream configuration. Will always result in |
| 73 // EncodedVideoSourceMsg_BitstreamConfigChanged message containing |
| 74 // currently active parameters, regardless of whether this call succeeded or |
| 75 // not. |
| 76 IPC_MESSAGE_CONTROL2(EncodedVideoSourceHostMsg_TryConfigureBitstream, |
| 77 int /* device_id */, |
| 78 media::RuntimeVideoEncodingParameters /* params */) |
| 79 |
| 80 // Notifies that the data within a buffer has been processed and it can be |
| 81 // reused to encode upcoming bitstream. |
| 82 IPC_MESSAGE_CONTROL2(EncodedVideoSourceHostMsg_BitstreamBufferConsumed, |
| 83 int /* device_id */, |
| 84 int /* buffer_id */) |
| 85 |
| 86 //------------------------------------------------------------------------------ |
| 87 // Renderer Messages |
| 88 // These are messages from the Browser to the Renderer process. |
| 89 |
| 90 // Reports the encoding capabilities of the device. |
| 91 IPC_MESSAGE_CONTROL2(EncodedVideoSourceMsg_CapabilitiesAvailable, |
| 92 int /* device id */, |
| 93 media::VideoEncodingCapabilities /* capabilities */) |
| 94 |
| 95 // Acknowledges a request to open an encoded video bitstream. When this message |
| 96 // occurs, bitstream can be considered to be streaming, and Renderer should be |
| 97 // ready to start accepting EncodedVideoSourceMsg_BitstreamReady messages and |
| 98 // buffers contained within them. Shared memory buffers used to deliver the |
| 99 // bitstream are assigned with buffer ids as specified by the buffers parameter. |
| 100 IPC_MESSAGE_CONTROL3(EncodedVideoSourceMsg_BitstreamOpened, |
| 101 int /* device_id */, |
| 102 media::VideoEncodingParameters /* params */, |
| 103 BitstreamBufferMap /* buffers */) |
| 104 |
| 105 // Acknowledges a request to close an encoded video bitstream. |
| 106 IPC_MESSAGE_CONTROL1(EncodedVideoSourceMsg_BitstreamClosed, |
| 107 int /* device_id */) |
| 108 |
| 109 // Informs the clients of the current encoding parameters, regardless of whether |
| 110 // the previous request to change them has been successful or not. This is |
| 111 // called usually in response to EncodedVideoSourceHostMsg_TryConfigureBitstream |
| 112 // at runtime, but can occur also as a result of config change initiated by |
| 113 // encoder or other clients in the system, e.g. if there are multiple clients |
| 114 // and bitstream config change is requested from one client, all clients should |
| 115 // be prepared to handle the configuration change. |
| 116 IPC_MESSAGE_CONTROL2(EncodedVideoSourceMsg_BitstreamConfigChanged, |
| 117 int /* device_id */, |
| 118 media::RuntimeVideoEncodingParameters /* current_params */) |
| 119 |
| 120 // Indicates that a bitstream buffer is available for the stream. The value of |
| 121 // |size| indicates the amount of valid bitstream data (in bytes). |
| 122 IPC_MESSAGE_CONTROL4(EncodedVideoSourceMsg_BitstreamReady, |
| 123 int /* device_id */, |
| 124 int /* buffer_id */, |
| 125 int /* size */, |
| 126 media::BufferEncodingMetadata /* metadata */) |
OLD | NEW |