Revert "Omit calls to set composing region when pasting image."
[chromium-blink-merge.git] / media / audio / audio_logging.h
blob4d7551f2021d9eb770e887dd80c25a18caa4a753
1 // Copyright 2013 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.
5 #ifndef MEDIA_AUDIO_AUDIO_LOGGING_H_
6 #define MEDIA_AUDIO_AUDIO_LOGGING_H_
8 #include <string>
10 #include "base/memory/scoped_ptr.h"
12 namespace media {
13 class AudioParameters;
15 // AudioLog logs state information about an active audio component. Each method
16 // takes a |component_id| along with method specific information. Its methods
17 // are safe to call from any thread.
18 class AudioLog {
19 public:
20 virtual ~AudioLog() {}
22 // Called when an audio component is created. |params| are the parameters of
23 // the created stream. |device_id| is the id of the audio device opened by
24 // the created stream.
25 virtual void OnCreated(int component_id,
26 const media::AudioParameters& params,
27 const std::string& device_id) = 0;
29 // Called when an audio component is started, generally this is synonymous
30 // with "playing."
31 virtual void OnStarted(int component_id) = 0;
33 // Called when an audio component is stopped, generally this is synonymous
34 // with "paused."
35 virtual void OnStopped(int component_id) = 0;
37 // Called when an audio component is closed, generally this is synonymous
38 // with "deleted."
39 virtual void OnClosed(int component_id) = 0;
41 // Called when an audio component encounters an error.
42 virtual void OnError(int component_id) = 0;
44 // Called when an audio component changes volume. |volume| is the new volume.
45 virtual void OnSetVolume(int component_id, double volume) = 0;
47 // Called when an audio component switches output device. |device_id| is the
48 // new audio output device.
49 virtual void OnSwitchOutputDevice(int component_id,
50 const std::string& device_id) = 0;
53 // AudioLogFactory dispenses AudioLog instances to owning classes for tracking
54 // AudioComponent behavior. All AudioComponents have the concept of an owning
55 // class:
57 // - AudioInputRendererHost for AudioInputController
58 // - AudioRendererHost for AudioOutputController
59 // - AudioOutputDispatcherImpl for AudioOutputStream
61 // Each of these owning classes may own multiple instances of each component, as
62 // such each AudioLog supports logging for multiple instances.
63 class AudioLogFactory {
64 public:
65 enum AudioComponent {
66 // Input controllers have a 1:1 mapping with streams, so there's no need to
67 // track both controllers and streams.
68 AUDIO_INPUT_CONTROLLER,
69 // Output controllers may or may not be backed by an active stream, so we
70 // need to track both controllers and streams.
71 AUDIO_OUTPUT_CONTROLLER,
72 AUDIO_OUTPUT_STREAM,
73 AUDIO_COMPONENT_MAX
76 // Create a new AudioLog object for tracking the behavior for one or more
77 // instances of the given component. Each instance of an "owning" class must
78 // create its own AudioLog.
79 virtual scoped_ptr<AudioLog> CreateAudioLog(AudioComponent component) = 0;
81 protected:
82 virtual ~AudioLogFactory() {}
85 } // namespace media
87 #endif // MEDIA_AUDIO_AUDIO_LOGGING_H_