OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 PPAPI_SHARED_IMPL_AUDIO_INPUT_IMPL_H_ | 5 #ifndef PPAPI_SHARED_IMPL_PPB_AUDIO_INPUT_SHARED_H_ |
6 #define PPAPI_SHARED_IMPL_AUDIO_INPUT_IMPL_H_ | 6 #define PPAPI_SHARED_IMPL_PPB_AUDIO_INPUT_SHARED_H_ |
7 | 7 |
| 8 #include "base/basictypes.h" |
8 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
9 #include "base/shared_memory.h" | 10 #include "base/shared_memory.h" |
10 #include "base/sync_socket.h" | 11 #include "base/sync_socket.h" |
11 #include "base/threading/simple_thread.h" | 12 #include "base/threading/simple_thread.h" |
12 #include "ppapi/c/dev/ppb_audio_input_dev.h" | 13 #include "ppapi/c/dev/ppb_audio_input_dev.h" |
13 #include "ppapi/shared_impl/resource.h" | 14 #include "ppapi/shared_impl/resource.h" |
14 #include "ppapi/thunk/ppb_audio_input_api.h" | 15 #include "ppapi/thunk/ppb_audio_input_api.h" |
15 | 16 |
16 namespace ppapi { | 17 namespace ppapi { |
17 | 18 |
18 // Implements the logic to map shared memory and run the audio thread signaled | 19 // Implements the logic to map shared memory and run the audio thread signaled |
19 // from the sync socket. Both the proxy and the renderer implementation use | 20 // from the sync socket. Both the proxy and the renderer implementation use |
20 // this code. | 21 // this code. |
21 class PPAPI_SHARED_EXPORT AudioInputImpl | 22 class PPAPI_SHARED_EXPORT PPB_AudioInput_Shared |
22 : public thunk::PPB_AudioInput_API, | 23 : public thunk::PPB_AudioInput_API, |
23 public base::DelegateSimpleThread::Delegate { | 24 public base::DelegateSimpleThread::Delegate { |
24 public: | 25 public: |
25 AudioInputImpl(); | 26 PPB_AudioInput_Shared(); |
26 virtual ~AudioInputImpl(); | 27 virtual ~PPB_AudioInput_Shared(); |
27 | 28 |
28 bool capturing() const { return capturing_; } | 29 bool capturing() const { return capturing_; } |
29 | 30 |
30 // Sets the callback information that the background thread will use. This | 31 // Sets the callback information that the background thread will use. This |
31 // is optional. Without a callback, the thread will not be run. This | 32 // is optional. Without a callback, the thread will not be run. This |
32 // non-callback mode is used in the renderer with the proxy, since the proxy | 33 // non-callback mode is used in the renderer with the proxy, since the proxy |
33 // handles the callback entirely within the plugin process. | 34 // handles the callback entirely within the plugin process. |
34 void SetCallback(PPB_AudioInput_Callback callback, void* user_data); | 35 void SetCallback(PPB_AudioInput_Callback callback, void* user_data); |
35 | 36 |
36 // Configures the current state to be playing or not. The caller is | 37 // Configures the current state to be playing or not. The caller is |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 size_t shared_memory_size_; | 75 size_t shared_memory_size_; |
75 | 76 |
76 // When the callback is set, this thread is spawned for calling it. | 77 // When the callback is set, this thread is spawned for calling it. |
77 scoped_ptr<base::DelegateSimpleThread> audio_input_thread_; | 78 scoped_ptr<base::DelegateSimpleThread> audio_input_thread_; |
78 | 79 |
79 // Callback to call when audio is ready to produce new samples. | 80 // Callback to call when audio is ready to produce new samples. |
80 PPB_AudioInput_Callback callback_; | 81 PPB_AudioInput_Callback callback_; |
81 | 82 |
82 // User data pointer passed verbatim to the callback function. | 83 // User data pointer passed verbatim to the callback function. |
83 void* user_data_; | 84 void* user_data_; |
| 85 |
| 86 DISALLOW_COPY_AND_ASSIGN(PPB_AudioInput_Shared); |
84 }; | 87 }; |
85 | 88 |
86 } // namespace ppapi | 89 } // namespace ppapi |
87 | 90 |
88 #endif // PPAPI_SHARED_IMPL_AUDIO_INPUT_IMPL_H_ | 91 #endif // PPAPI_SHARED_IMPL_PPB_AUDIO_INPUT_SHARED_H_ |
OLD | NEW |