OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | |
bbudge
2017/03/23 18:05:45
nit: 2017
Xing
2017/03/29 21:14:32
Done.
| |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef PPAPI_CPP_DEV_AUDIO_OUTPUT_DEV_H_ | |
6 #define PPAPI_CPP_DEV_AUDIO_OUTPUT_DEV_H_ | |
7 | |
8 #include <stdint.h> | |
9 | |
10 #include <vector> | |
11 | |
12 #include "ppapi/c/dev/ppb_audio_output_dev.h" | |
13 #include "ppapi/cpp/audio_config.h" | |
14 #include "ppapi/cpp/completion_callback.h" | |
15 #include "ppapi/cpp/dev/device_ref_dev.h" | |
16 #include "ppapi/cpp/resource.h" | |
17 | |
18 namespace pp { | |
19 | |
20 class InstanceHandle; | |
21 | |
22 class AudioOutput_Dev : public Resource { | |
23 public: | |
24 // An empty constructor for an AudioOutput resource. | |
25 AudioOutput_Dev(); | |
26 | |
27 // Constructor to create an audio output resource. | |
28 explicit AudioOutput_Dev(const InstanceHandle& instance); | |
29 | |
30 virtual ~AudioOutput_Dev(); | |
31 | |
32 // Static function for determining whether the browser supports the required | |
33 // AudioOutput interface. | |
34 // | |
35 // @return true if the interface is available, false otherwise. | |
36 static bool IsAvailable(); | |
37 | |
38 int32_t EnumerateDevices( | |
39 const CompletionCallbackWithOutput<std::vector<DeviceRef_Dev> >& | |
40 callback); | |
41 | |
42 int32_t MonitorDeviceChange(PP_MonitorDeviceChangeCallback callback, | |
43 void* user_data); | |
44 | |
45 // If |device_ref| is null (i.e., is_null() returns true), the default device | |
46 // will be used. | |
47 int32_t Open(const DeviceRef_Dev& device_ref, | |
48 const AudioConfig& config, | |
49 PPB_AudioOutput_Callback audio_output_callback, | |
50 void* user_data, | |
51 const CompletionCallback& callback); | |
52 | |
53 // Getter function for returning the internal <code>PPB_AudioConfig</code> | |
54 // struct. | |
55 // | |
56 // @return A mutable reference to the PPB_AudioConfig struct. | |
57 AudioConfig& config() { return config_; } | |
58 | |
59 // Getter function for returning the internal <code>PPB_AudioConfig</code> | |
60 // struct. | |
61 // | |
62 // @return A const reference to the internal <code>PPB_AudioConfig</code> | |
63 // struct. | |
64 const AudioConfig& config() const { return config_; } | |
65 | |
66 // StartPlayback() starts playback of audio. | |
67 // | |
68 // @return true if successful, otherwise false. | |
69 bool StartPlayback(); | |
70 | |
71 // StopPlayback stops playback of audio. | |
72 // | |
73 // @return true if successful, otherwise false. | |
74 bool StopPlayback(); | |
75 | |
76 // Close closes the audio output device. | |
77 void Close(); | |
78 | |
79 private: | |
80 AudioConfig config_; | |
81 }; | |
82 | |
83 } // namespace pp | |
84 | |
85 #endif // PPAPI_CPP_DEV_AUDIO_OUTPUT_DEV_H_ | |
OLD | NEW |