diff options
Diffstat (limited to 'chrome/common')
-rw-r--r-- | chrome/common/render_messages.h | 87 | ||||
-rw-r--r-- | chrome/common/render_messages_internal.h | 29 |
2 files changed, 116 insertions, 0 deletions
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index 689918e..c96d787 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -21,6 +21,7 @@ #include "chrome/common/modal_dialog_event.h" #include "chrome/common/page_transition_types.h" #include "googleurl/src/gurl.h" +#include "media/audio/audio_output.h" #include "net/base/upload_data.h" #include "net/url_request/url_request_status.h" #include "webkit/glue/autofill_form.h" @@ -324,6 +325,23 @@ enum ViewHostMsg_ImeControl { IME_COMPLETE_COMPOSITION, }; +// Parameters for creating an audio output stream. +struct ViewHostMsg_Audio_CreateStream { + // Format request for the stream. + AudioManager::Format format; + + // Number of channels. + int channels; + + // Sampling rate (frequency) of the output stream. + int sample_rate; + + // Number of bits per sample; + int bits_per_sample; + + // Number of bytes per packet. + size_t packet_size; +}; namespace IPC { @@ -1587,6 +1605,75 @@ struct ParamTraits<ModalDialogEvent> { } }; +// Traits for AudioManager::Format. +template <> +struct ParamTraits<AudioManager::Format> { + typedef AudioManager::Format param_type; + static void Write(Message* m, const param_type& p) { + m->WriteInt(p); + } + static bool Read(const Message* m, void** iter, param_type* p) { + int type; + if (!m->ReadInt(iter, &type)) + return false; + *p = static_cast<AudioManager::Format>(type); + return true; + } + static void Log(const param_type& p, std::wstring* l) { + std::wstring format; + switch (p) { + case AudioManager::AUDIO_PCM_LINEAR: + format = L"AUDIO_PCM_LINEAR"; + break; + case AudioManager::AUDIO_PCM_DELTA: + format = L"AUDIO_PCM_DELTA"; + break; + case AudioManager::AUDIO_MOCK: + format = L"AUDIO_MOCK"; + break; + default: + format = L"AUDIO_LAST_FORMAT"; + break; + } + LogParam(format, l); + } +}; + +// Traits for ViewHostMsg_Audio_CreateStream. +template <> +struct ParamTraits<ViewHostMsg_Audio_CreateStream> { + typedef ViewHostMsg_Audio_CreateStream param_type; + static void Write(Message* m, const param_type& p) { + WriteParam(m, p.format); + WriteParam(m, p.channels); + WriteParam(m, p.sample_rate); + WriteParam(m, p.bits_per_sample); + WriteParam(m, p.packet_size); + } + static bool Read(const Message* m, void** iter, param_type* p) { + return + ReadParam(m, iter, &p->format) && + ReadParam(m, iter, &p->channels) && + ReadParam(m, iter, &p->sample_rate) && + ReadParam(m, iter, &p->bits_per_sample) && + ReadParam(m, iter, &p->packet_size); + } + static void Log(const param_type& p, std::wstring* l) { + l->append(L"<ViewHostMsg_Audio_CreateStream>("); + LogParam(p.format, l); + l->append(L", "); + LogParam(p.channels, l); + l->append(L", "); + LogParam(p.sample_rate, l); + l->append(L", "); + LogParam(p.bits_per_sample, l); + l->append(L", "); + LogParam(p.packet_size, l); + l->append(L")"); + } +}; + + #if defined(OS_POSIX) // TODO(port): this shouldn't exist. However, the plugin stuff is really using diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h index 915f8c7..4310f3f 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -1109,4 +1109,33 @@ IPC_BEGIN_MESSAGES(ViewHost) int /* network error */, std::string /* proxy list */) + // Request that got sent to browser for creating an audio output stream + IPC_MESSAGE_ROUTED2(ViewHostMsg_CreateAudioStream, + int /* stream_id */, + ViewHostMsg_Audio_CreateStream) + + // Tell the browser the audio buffer prepared for stream + // (render_view_id, stream_id) is filled and is ready to be consumed. + IPC_MESSAGE_ROUTED1(ViewHostMsg_NotifyAudioPacketReady, + int /* stream_id */) + + // Start playing the audio stream specified by (render_view_id, stream_id). + IPC_MESSAGE_ROUTED1(ViewHostMsg_StartAudioStream, + int /* stream_id */) + + // Close an audio stream specified by (render_view_id, stream_id). + IPC_MESSAGE_ROUTED1(ViewHostMsg_CloseAudioStream, + int /* stream_id */) + + // Get audio volume of the stream specified by (render_view_id, stream_id). + IPC_MESSAGE_ROUTED1(ViewHostMsg_GetAudioVolume, + 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_ROUTED3(ViewHostMsg_SetAudioVolume, + int /* stream_id */, + double /* left_channel */, + double /* right_channel */) + IPC_END_MESSAGES(ViewHost) |