| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MEDIA_AUDIO_AUDIO_OUTPUT_IPC_H_ | 5 #ifndef MEDIA_AUDIO_AUDIO_OUTPUT_IPC_H_ |
| 6 #define MEDIA_AUDIO_AUDIO_OUTPUT_IPC_H_ | 6 #define MEDIA_AUDIO_AUDIO_OUTPUT_IPC_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
| 11 #include "base/sync_socket.h" | 11 #include "base/sync_socket.h" |
| 12 #include "media/audio/audio_parameters.h" | 12 #include "media/audio/audio_parameters.h" |
| 13 #include "media/base/media_export.h" | 13 #include "media/base/media_export.h" |
| 14 #include "url/gurl.h" | 14 #include "url/gurl.h" |
| 15 | 15 |
| 16 namespace media { | 16 namespace media { |
| 17 | 17 |
| 18 // Result of an audio output device switch operation | 18 // Result of an audio output device switch operation |
| 19 enum SwitchOutputDeviceResult { | 19 enum SwitchOutputDeviceResult { |
| 20 SWITCH_OUTPUT_DEVICE_RESULT_SUCCESS = 0, | 20 SWITCH_OUTPUT_DEVICE_RESULT_SUCCESS = 0, |
| 21 SWITCH_OUTPUT_DEVICE_RESULT_ERROR_NOT_FOUND, | 21 SWITCH_OUTPUT_DEVICE_RESULT_ERROR_NOT_FOUND, |
| 22 SWITCH_OUTPUT_DEVICE_RESULT_ERROR_NOT_AUTHORIZED, | 22 SWITCH_OUTPUT_DEVICE_RESULT_ERROR_NOT_AUTHORIZED, |
| 23 SWITCH_OUTPUT_DEVICE_RESULT_ERROR_OBSOLETE, | 23 SWITCH_OUTPUT_DEVICE_RESULT_ERROR_OBSOLETE, |
| 24 SWITCH_OUTPUT_DEVICE_RESULT_ERROR_NOT_SUPPORTED, | 24 SWITCH_OUTPUT_DEVICE_RESULT_ERROR_NOT_SUPPORTED, |
| 25 SWITCH_OUTPUT_DEVICE_RESULT_LAST = | 25 SWITCH_OUTPUT_DEVICE_RESULT_LAST = |
| 26 SWITCH_OUTPUT_DEVICE_RESULT_ERROR_NOT_SUPPORTED, | 26 SWITCH_OUTPUT_DEVICE_RESULT_ERROR_NOT_SUPPORTED, |
| 27 }; | 27 }; |
| 28 | 28 |
| 29 // Current status of the audio output stream in the browser process. Browser |
| 30 // sends information about the current playback state and error to the |
| 31 // renderer process using this type. |
| 32 enum AudioOutputIPCDelegateState { |
| 33 AUDIO_OUTPUT_IPC_DELEGATE_STATE_PLAYING, |
| 34 AUDIO_OUTPUT_IPC_DELEGATE_STATE_PAUSED, |
| 35 AUDIO_OUTPUT_IPC_DELEGATE_STATE_ERROR, |
| 36 AUDIO_OUTPUT_IPC_DELEGATE_STATE_LAST = AUDIO_OUTPUT_IPC_DELEGATE_STATE_ERROR |
| 37 }; |
| 38 |
| 29 // Contains IPC notifications for the state of the server side | 39 // Contains IPC notifications for the state of the server side |
| 30 // (AudioOutputController) audio state changes and when an AudioOutputController | 40 // (AudioOutputController) audio state changes and when an AudioOutputController |
| 31 // has been created. Implemented by AudioOutputDevice. | 41 // has been created. Implemented by AudioOutputDevice. |
| 32 class MEDIA_EXPORT AudioOutputIPCDelegate { | 42 class MEDIA_EXPORT AudioOutputIPCDelegate { |
| 33 public: | 43 public: |
| 34 // Current status of the audio output stream in the browser process. Browser | |
| 35 // sends information about the current playback state and error to the | |
| 36 // renderer process using this type. | |
| 37 enum State { | |
| 38 kPlaying, | |
| 39 kPaused, | |
| 40 kError, | |
| 41 kStateLast = kError | |
| 42 }; | |
| 43 | 44 |
| 44 // Called when state of an audio stream has changed. | 45 // Called when state of an audio stream has changed. |
| 45 virtual void OnStateChanged(State state) = 0; | 46 virtual void OnStateChanged(AudioOutputIPCDelegateState state) = 0; |
| 46 | 47 |
| 47 // Called when an audio stream has been created. | 48 // Called when an audio stream has been created. |
| 48 // The shared memory |handle| points to a memory section that's used to | 49 // The shared memory |handle| points to a memory section that's used to |
| 49 // transfer audio buffers from the AudioOutputIPCDelegate back to the | 50 // transfer audio buffers from the AudioOutputIPCDelegate back to the |
| 50 // AudioRendererHost. The implementation of OnStreamCreated takes ownership. | 51 // AudioRendererHost. The implementation of OnStreamCreated takes ownership. |
| 51 // The |socket_handle| is used by AudioRendererHost to signal requests for | 52 // The |socket_handle| is used by AudioRendererHost to signal requests for |
| 52 // audio data to be written into the shared memory. The AudioOutputIPCDelegate | 53 // audio data to be written into the shared memory. The AudioOutputIPCDelegate |
| 53 // must read from this socket and provide audio whenever data (search for | 54 // must read from this socket and provide audio whenever data (search for |
| 54 // "pending_bytes") is received. | 55 // "pending_bytes") is received. |
| 55 virtual void OnStreamCreated(base::SharedMemoryHandle handle, | 56 virtual void OnStreamCreated(base::SharedMemoryHandle handle, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 // AudioOutputController in the peer process. | 97 // AudioOutputController in the peer process. |
| 97 virtual void CloseStream() = 0; | 98 virtual void CloseStream() = 0; |
| 98 | 99 |
| 99 // Sets the volume of the audio stream. | 100 // Sets the volume of the audio stream. |
| 100 virtual void SetVolume(double volume) = 0; | 101 virtual void SetVolume(double volume) = 0; |
| 101 }; | 102 }; |
| 102 | 103 |
| 103 } // namespace media | 104 } // namespace media |
| 104 | 105 |
| 105 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_IPC_H_ | 106 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_IPC_H_ |
| OLD | NEW |