Chromium Code Reviews| Index: content/common/media/encoded_video_capture_messages.h |
| diff --git a/content/common/media/encoded_video_capture_messages.h b/content/common/media/encoded_video_capture_messages.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a762c1aa1c8bef3229f3e3fe9fada0d89d18f4f8 |
| --- /dev/null |
| +++ b/content/common/media/encoded_video_capture_messages.h |
| @@ -0,0 +1,128 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
|
palmer
2013/06/19 20:24:08
2013
hshi1
2013/06/19 21:16:25
Done.
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "base/memory/shared_memory.h" |
| +#include "ipc/ipc_message_macros.h" |
| +#include "media/video/capture/video_capture_types.h" |
| +#include "media/video/video_encode_types.h" |
| + |
| +#undef IPC_MESSAGE_EXPORT |
| +#define IPC_MESSAGE_EXPORT CONTENT_EXPORT |
| +#define IPC_MESSAGE_START EncodedVideoCaptureMsgStart |
| + |
| +#if !defined(OS_ANDROID) |
| +IPC_ENUM_TRAITS(media::VideoCodec) |
| +#endif // !defined(OS_ANDROID) |
| + |
| +IPC_STRUCT_TRAITS_BEGIN(media::VideoEncodingConfig) |
| + IPC_STRUCT_TRAITS_MEMBER(codec_type) |
| + IPC_STRUCT_TRAITS_MEMBER(codec_name) |
| + IPC_STRUCT_TRAITS_MEMBER(max_resolution) |
| + IPC_STRUCT_TRAITS_MEMBER(max_frames_per_second) |
| + IPC_STRUCT_TRAITS_MEMBER(max_bitrate) |
| +IPC_STRUCT_TRAITS_END() |
| + |
| +IPC_STRUCT_TRAITS_BEGIN(media::RuntimeVideoEncodingParameters) |
| + IPC_STRUCT_TRAITS_MEMBER(target_bitrate) |
| + IPC_STRUCT_TRAITS_MEMBER(max_bitrate) |
| + IPC_STRUCT_TRAITS_MEMBER(frames_per_second) |
| +IPC_STRUCT_TRAITS_END() |
| + |
| +IPC_STRUCT_TRAITS_BEGIN(media::VideoEncodingParameters) |
| + IPC_STRUCT_TRAITS_MEMBER(codec_name) |
| + IPC_STRUCT_TRAITS_MEMBER(resolution) |
| + IPC_STRUCT_TRAITS_MEMBER(runtime_params) |
| +IPC_STRUCT_TRAITS_END() |
| + |
| +IPC_STRUCT_TRAITS_BEGIN(media::BufferEncodingMetadata) |
| + IPC_STRUCT_TRAITS_MEMBER(timestamp) |
| + IPC_STRUCT_TRAITS_MEMBER(key_frame) |
| +IPC_STRUCT_TRAITS_END() |
| + |
| +//------------------------------------------------------------------------------ |
| +// Renderer Source Messages |
| +// These are messages from the Renderer to the Browser process. |
| + |
| +// Queries the encoding capabilities for the device. A successful request |
| +// results in EncoderVideoSourceMessage_CapabilitiesAvailable message. |
| +IPC_MESSAGE_CONTROL2(EncodedVideoCaptureHostMsg_GetCapabilities, |
| + int /* device_id */, |
| + media::VideoCaptureSessionId /* session_id */) |
|
piman
2013/06/19 18:23:58
Where is the browser side of all these messages?
I
hshi1
2013/06/19 18:25:44
The browser side are implemented in a separate CL
|
| + |
| +// Message from Renderer to Browser process to create a bitstream with specific |
| +// parameters. A successful request results in beginning of streaming and |
| +// EncoderVideoCaptureMsg_BitstreamCreated message to Renderer. A failed request |
| +// triggers EncodedVideoCaptureMsg_BitstreamDestroyed message. |session_id| is |
| +// the capture session id returned by the MediaStreamManager. The renderer is |
| +// responsible for generating unique |device_id| within its context that will be |
| +// used to identify bitstreams in IPC. |
| +IPC_MESSAGE_CONTROL3(EncodedVideoCaptureHostMsg_OpenBitstream, |
| + int /* device_id */, |
| + media::VideoCaptureSessionId /* session_id */, |
| + media::VideoEncodingParameters /* params */) |
| + |
| +// Stops streaming a bitstream. When Browser has finalized the bitstream it will |
| +// trigger EncodedVideoCaptureMsg_BitstreamClosed message back to Renderer. |
| +// Renderer must be prepared to receive EncodedVideoCaptureMsg_BitstreamReady |
| +// messages until it receives EncodedVideoCaptureMsg_BitstreamClosed message. |
| +IPC_MESSAGE_CONTROL1(EncodedVideoCaptureHostMsg_CloseBitstream, |
| + int /* device_id */) |
| + |
| +// Sets a stream's bitstream configuration. Will always result in |
| +// EncodedVideoCaptureMsg_BitstreamConfigChanged message containing |
| +// currently active parameters, regardless of whether this call succeeded or |
| +// not. |
| +IPC_MESSAGE_CONTROL2(EncodedVideoCaptureHostMsg_TryConfigureBitstream, |
| + int /* device_id */, |
| + media::RuntimeVideoEncodingParameters /* params */) |
| + |
| +// Notifies that the data within a buffer has been processed and it can be |
| +// reused to encode upcoming bitstream. |
| +IPC_MESSAGE_CONTROL2(EncodedVideoCaptureHostMsg_BitstreamBufferConsumed, |
| + int /* device_id */, |
| + int /* buffer_id */) |
| + |
| +//------------------------------------------------------------------------------ |
| +// Renderer Messages |
| +// These are messages from the Browser to the Renderer process. |
| + |
| +// Reports the encoding capabilities of the device. |
| +IPC_MESSAGE_CONTROL2(EncodedVideoCaptureMsg_CapabilitiesAvailable, |
| + int /* device_id */, |
| + media::VideoEncodingCapabilities /* capabilities */) |
| + |
| +// Acknowledges a request to open an encoded video bitstream. When this message |
| +// occurs, bitstream can be considered to be streaming, and Renderer should be |
|
palmer
2013/06/19 20:24:08
Nit: I would rather not capitalize "renderer", and
hshi1
2013/06/19 21:16:25
Done.
|
| +// ready to start accepting EncodedVideoCaptureMsg_BitstreamReady messages and |
| +// buffers contained within them. Shared memory buffers used to deliver the |
| +// bitstream are assigned with buffer ids as specified by the buffers parameter. |
| +// All buffers have the same size as indicated by |buffer_size|. |
| +IPC_MESSAGE_CONTROL4(EncodedVideoCaptureMsg_BitstreamOpened, |
| + int /* device_id */, |
| + media::VideoEncodingParameters /* params */, |
| + std::vector<base::SharedMemoryHandle> /* buffers */, |
| + uint32 /* buffer_size */) |
| + |
| +// Acknowledges a request to close an encoded video bitstream. |
| +IPC_MESSAGE_CONTROL1(EncodedVideoCaptureMsg_BitstreamClosed, |
| + int /* device_id */) |
| + |
| +// Informs the clients of the current encoding parameters, regardless of whether |
| +// the previous request to change them has been successful or not. It is usually |
| +// called in response to EncodedVideoCaptureHostMsg_TryConfigureBitstream |
| +// at runtime, but can occur also as a result of config change initiated by |
| +// encoder or other clients in the system, e.g. if there are multiple clients |
| +// and bitstream config change is requested from one client, all clients should |
| +// be prepared to handle the configuration change. |
| +IPC_MESSAGE_CONTROL2(EncodedVideoCaptureMsg_BitstreamConfigChanged, |
| + int /* device_id */, |
| + media::RuntimeVideoEncodingParameters /* current_params */) |
| + |
| +// Indicates that a bitstream buffer is available for the stream. The value of |
| +// |size| indicates the amount of valid bitstream data (in bytes). |
| +IPC_MESSAGE_CONTROL4(EncodedVideoCaptureMsg_BitstreamReady, |
| + int /* device_id */, |
| + int /* buffer_id */, |
| + uint32 /* size */, |
| + media::BufferEncodingMetadata /* metadata */) |