diff options
author | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-17 17:20:25 +0000 |
---|---|---|
committer | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-17 17:20:25 +0000 |
commit | 9f1f2b2c088e7a63e31b24a6761a758678fd2a0a (patch) | |
tree | eac7b35a7819841d73dd2982a9c470bf9cbecc55 /content/common/media | |
parent | 3d19a5357ffa400a6c276619b81f75b5e06fa973 (diff) | |
download | chromium_src-9f1f2b2c088e7a63e31b24a6761a758678fd2a0a.zip chromium_src-9f1f2b2c088e7a63e31b24a6761a758678fd2a0a.tar.gz chromium_src-9f1f2b2c088e7a63e31b24a6761a758678fd2a0a.tar.bz2 |
Move media-related IPC message definitions from content/common/ to content/common/media.
BUG=none
TEST=compiles
Review URL: http://codereview.chromium.org/7170007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89502 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common/media')
-rw-r--r-- | content/common/media/OWNERS | 9 | ||||
-rw-r--r-- | content/common/media/audio_messages.h | 164 | ||||
-rw-r--r-- | content/common/media/audio_stream_state.h | 18 | ||||
-rw-r--r-- | content/common/media/video_capture_messages.h | 61 |
4 files changed, 252 insertions, 0 deletions
diff --git a/content/common/media/OWNERS b/content/common/media/OWNERS new file mode 100644 index 0000000..d37c12f --- /dev/null +++ b/content/common/media/OWNERS @@ -0,0 +1,9 @@ +acolwell@chromium.org +annacc@chromium.org +ddorwin@chormium.org +fischman@chromium.org +imasaki@chromium.org +scherkus@chromium.org +sjl@chromium.org +vrk@chromium.org +wjia@chromium.org diff --git a/content/common/media/audio_messages.h b/content/common/media/audio_messages.h new file mode 100644 index 0000000..41da486 --- /dev/null +++ b/content/common/media/audio_messages.h @@ -0,0 +1,164 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// IPC messages for the audio. +// Multiply-included message file, hence no include guard. + +#include "base/shared_memory.h" +#include "base/sync_socket.h" +#include "content/common/media/audio_stream_state.h" +#include "ipc/ipc_message_macros.h" +#include "media/audio/audio_buffers_state.h" +#include "media/audio/audio_parameters.h" + +#define IPC_MESSAGE_START AudioMsgStart + +IPC_ENUM_TRAITS(AudioStreamState) +IPC_ENUM_TRAITS(AudioParameters::Format) +IPC_ENUM_TRAITS(ChannelLayout) + +IPC_STRUCT_TRAITS_BEGIN(AudioBuffersState) + IPC_STRUCT_TRAITS_MEMBER(pending_bytes) + IPC_STRUCT_TRAITS_MEMBER(hardware_delay_bytes) + IPC_STRUCT_TRAITS_MEMBER(timestamp) +IPC_STRUCT_TRAITS_END() + +IPC_STRUCT_TRAITS_BEGIN(AudioParameters) + IPC_STRUCT_TRAITS_MEMBER(format) + IPC_STRUCT_TRAITS_MEMBER(channel_layout) + IPC_STRUCT_TRAITS_MEMBER(sample_rate) + IPC_STRUCT_TRAITS_MEMBER(bits_per_sample) + IPC_STRUCT_TRAITS_MEMBER(samples_per_packet) + IPC_STRUCT_TRAITS_MEMBER(channels) +IPC_STRUCT_TRAITS_END() + +// Messages sent from the browser to the renderer. + +// Sent by AudioRendererHost to renderer to request an audio packet. +IPC_MESSAGE_ROUTED2(AudioMsg_RequestPacket, + int /* stream id */, + AudioBuffersState) + +// Tell the renderer process that the audio stream has been created, renderer +// process would be given a ShareMemoryHandle that it should write to from +// then on. +IPC_MESSAGE_ROUTED3(AudioMsg_NotifyStreamCreated, + int /* stream id */, + base::SharedMemoryHandle /* handle */, + uint32 /* length */) + +// Tell the renderer process that a low latency audio stream has been created, +// renderer process would be given a SyncSocket that it should write to from +// then on. +#if defined(OS_WIN) +IPC_MESSAGE_ROUTED4(AudioMsg_NotifyLowLatencyStreamCreated, + int /* stream id */, + base::SharedMemoryHandle /* handle */, + base::SyncSocket::Handle /* socket handle */, + uint32 /* length */) +#else +IPC_MESSAGE_ROUTED4(AudioMsg_NotifyLowLatencyStreamCreated, + int /* stream id */, + base::SharedMemoryHandle /* handle */, + base::FileDescriptor /* socket handle */, + uint32 /* length */) +#endif + +// Tell the renderer process that a low latency audio input stream has been +// created, renderer process would be given a SyncSocket that it should read +// from from then on. +#if defined(OS_WIN) +IPC_MESSAGE_ROUTED4(AudioInputMsg_NotifyLowLatencyStreamCreated, + int /* stream id */, + base::SharedMemoryHandle /* handle */, + base::SyncSocket::Handle /* socket handle */, + uint32 /* length */) +#else +IPC_MESSAGE_ROUTED4(AudioInputMsg_NotifyLowLatencyStreamCreated, + int /* stream id */, + base::SharedMemoryHandle /* handle */, + base::FileDescriptor /* socket handle */, + uint32 /* length */) +#endif + +// Notification message sent from AudioRendererHost to renderer for state +// update after the renderer has requested a Create/Start/Close. +IPC_MESSAGE_ROUTED2(AudioMsg_NotifyStreamStateChanged, + int /* stream id */, + AudioStreamState /* new state */) + +IPC_MESSAGE_ROUTED2(AudioMsg_NotifyStreamVolume, + int /* stream id */, + double /* volume */) + +IPC_MESSAGE_ROUTED2(AudioInputMsg_NotifyStreamVolume, + int /* stream id */, + double /* volume */) + +// Messages sent from the renderer to the browser. + +// Request that got sent to browser for creating an audio output stream +IPC_MESSAGE_ROUTED3(AudioHostMsg_CreateStream, + int /* stream_id */, + AudioParameters /* params */, + bool /* low-latency */) + +// Request that got sent to browser for creating an audio input stream +IPC_MESSAGE_ROUTED3(AudioInputHostMsg_CreateStream, + int /* stream_id */, + AudioParameters /* params */, + bool /* low-latency */) + +// Tell the browser the audio buffer prepared for stream +// (render_view_id, stream_id) is filled and is ready to be consumed. +IPC_MESSAGE_ROUTED2(AudioHostMsg_NotifyPacketReady, + int /* stream_id */, + uint32 /* packet size */) + +// Start buffering and play the audio stream specified by +// (render_view_id, stream_id). +IPC_MESSAGE_ROUTED1(AudioHostMsg_PlayStream, + int /* stream_id */) + +// Start recording the audio input stream specified by +// (render_view_id, stream_id). +IPC_MESSAGE_ROUTED1(AudioInputHostMsg_RecordStream, + int /* stream_id */) + +// Pause the audio stream specified by (render_view_id, stream_id). +IPC_MESSAGE_ROUTED1(AudioHostMsg_PauseStream, + int /* stream_id */) + +// Discard all buffered audio data for the specified audio stream. +IPC_MESSAGE_ROUTED1(AudioHostMsg_FlushStream, + int /* stream_id */) + +// Close an audio stream specified by (render_view_id, stream_id). +IPC_MESSAGE_ROUTED1(AudioHostMsg_CloseStream, + int /* stream_id */) + +// Close an audio input stream specified by (render_view_id, stream_id). +IPC_MESSAGE_ROUTED1(AudioInputHostMsg_CloseStream, + int /* stream_id */) + +// Get audio volume of the stream specified by (render_view_id, stream_id). +IPC_MESSAGE_ROUTED1(AudioHostMsg_GetVolume, + int /* stream_id */) + +// Get audio volume of the input stream specified by +// (render_view_id, stream_id). +IPC_MESSAGE_ROUTED1(AudioInputHostMsg_GetVolume, + int /* stream_id */) + +// Set audio volume of the stream specified by (render_view_id, stream_id). +// TODO(hclam): change this to vector if we have channel numbers other than 2. +IPC_MESSAGE_ROUTED2(AudioHostMsg_SetVolume, + int /* stream_id */, + double /* volume */) + +// Set audio volume of the input stream specified by +// (render_view_id, stream_id). +IPC_MESSAGE_ROUTED2(AudioInputHostMsg_SetVolume, + int /* stream_id */, + double /* volume */) diff --git a/content/common/media/audio_stream_state.h b/content/common/media/audio_stream_state.h new file mode 100644 index 0000000..fd42db5 --- /dev/null +++ b/content/common/media/audio_stream_state.h @@ -0,0 +1,18 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_COMMON_MEDIA_AUDIO_STREAM_STATE_H_ +#define CONTENT_COMMON_MEDIA_AUDIO_STREAM_STATE_H_ +#pragma once + +// Current status of the audio output stream in the browser process. Browser +// sends information about the current playback state and error to the +// renderer process using this type. +enum AudioStreamState { + kAudioStreamPlaying, + kAudioStreamPaused, + kAudioStreamError +}; + +#endif // CONTENT_COMMON_MEDIA_AUDIO_STREAM_STATE_H_ diff --git a/content/common/media/video_capture_messages.h b/content/common/media/video_capture_messages.h new file mode 100644 index 0000000..7b5b8d9 --- /dev/null +++ b/content/common/media/video_capture_messages.h @@ -0,0 +1,61 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/common/common_param_traits.h" +#include "ipc/ipc_message_macros.h" +#include "media/video/capture/video_capture.h" + +#define IPC_MESSAGE_START VideoCaptureMsgStart + +IPC_ENUM_TRAITS(media::VideoCapture::State) + +IPC_STRUCT_TRAITS_BEGIN(media::VideoCaptureParams) + IPC_STRUCT_TRAITS_MEMBER(width) + IPC_STRUCT_TRAITS_MEMBER(height) + IPC_STRUCT_TRAITS_MEMBER(frame_per_second) + IPC_STRUCT_TRAITS_MEMBER(session_id) +IPC_STRUCT_TRAITS_END() + +// Notify the renderer process about the state update such as +// Start/Pause/Stop. +IPC_MESSAGE_ROUTED2(VideoCaptureMsg_StateChanged, + int /* device id */, + media::VideoCapture::State /* new state */) + +// Tell the renderer process that a new buffer is allocated for video capture. +IPC_MESSAGE_ROUTED4(VideoCaptureMsg_NewBuffer, + int /* device id */, + base::SharedMemoryHandle /* handle */, + int /* length */, + int /* buffer_id */) + +// Tell the renderer process that a buffer is available from video capture. +IPC_MESSAGE_ROUTED3(VideoCaptureMsg_BufferReady, + int /* device id */, + int /* buffer_id */, + base::Time /* timestamp */) + +// Tell the renderer process the width, height and frame rate the camera use. +IPC_MESSAGE_ROUTED2(VideoCaptureMsg_DeviceInfo, + int /* device_id */, + media::VideoCaptureParams) + +// Start the video capture specified by (routing_id, device_id). +IPC_MESSAGE_ROUTED2(VideoCaptureHostMsg_Start, + int /* device_id */, + media::VideoCaptureParams) + +// Pause the video capture specified by (routing_id, device_id). +IPC_MESSAGE_ROUTED1(VideoCaptureHostMsg_Pause, + int /* device_id */) + +// Close the video capture specified by (routing_id, device_id). +IPC_MESSAGE_ROUTED1(VideoCaptureHostMsg_Stop, + int /* device_id */) + +// Tell the browser process that the video frame buffer |handle| is ready for +// device (routing_id, device_id) to fill up. +IPC_MESSAGE_ROUTED2(VideoCaptureHostMsg_BufferReady, + int /* device_id */, + int /* buffer_id */) |