Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(124)

Side by Side Diff: media/audio/linux/audio_manager_linux.h

Issue 9570014: Move some generic functions to AudioManagerBase to be inherited by platform-specific AudioManager*** (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix the memory leak in the alsa unittests Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 MEDIA_AUDIO_LINUX_AUDIO_MANAGER_LINUX_H_ 5 #ifndef MEDIA_AUDIO_LINUX_AUDIO_MANAGER_LINUX_H_
6 #define MEDIA_AUDIO_LINUX_AUDIO_MANAGER_LINUX_H_ 6 #define MEDIA_AUDIO_LINUX_AUDIO_MANAGER_LINUX_H_
7 7
8 #include <string> 8 #include <string>
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/threading/thread.h" 11 #include "base/threading/thread.h"
12 #include "media/audio/audio_manager_base.h" 12 #include "media/audio/audio_manager_base.h"
13 13
14 class AlsaWrapper; 14 class AlsaWrapper;
15 15
16 class MEDIA_EXPORT AudioManagerLinux : public AudioManagerBase { 16 class MEDIA_EXPORT AudioManagerLinux : public AudioManagerBase {
17 public: 17 public:
18 AudioManagerLinux(); 18 AudioManagerLinux();
19 19
20 // Call before using a newly created AudioManagerLinux instance. 20 // Call before using a newly created AudioManagerLinux instance.
21 virtual void Init() OVERRIDE; 21 virtual void Init() OVERRIDE;
22 22
23 // Implementation of AudioManager. 23 // Implementation of AudioManager.
24 virtual bool HasAudioOutputDevices() OVERRIDE; 24 virtual bool HasAudioOutputDevices() OVERRIDE;
25 virtual bool HasAudioInputDevices() OVERRIDE; 25 virtual bool HasAudioInputDevices() OVERRIDE;
26 virtual AudioOutputStream* MakeAudioOutputStream(
27 const AudioParameters& params) OVERRIDE;
28 virtual AudioInputStream* MakeAudioInputStream(
29 const AudioParameters& params, const std::string& device_id) OVERRIDE;
30 virtual bool CanShowAudioInputSettings() OVERRIDE; 26 virtual bool CanShowAudioInputSettings() OVERRIDE;
31 virtual void ShowAudioInputSettings() OVERRIDE; 27 virtual void ShowAudioInputSettings() OVERRIDE;
32 virtual void GetAudioInputDeviceNames(media::AudioDeviceNames* device_names) 28 virtual void GetAudioInputDeviceNames(media::AudioDeviceNames* device_names)
33 OVERRIDE; 29 OVERRIDE;
34
35 virtual void MuteAll() OVERRIDE; 30 virtual void MuteAll() OVERRIDE;
36 virtual void UnMuteAll() OVERRIDE; 31 virtual void UnMuteAll() OVERRIDE;
37 32
38 virtual void ReleaseOutputStream(AudioOutputStream* stream); 33 // Implementation of AudioManagerBase.
34 virtual int GetMaxAudioOutputStreamsAllowed() OVERRIDE;
35 virtual AudioOutputStream* MakeAudioLinearOutputStream(
36 const AudioParameters& params) OVERRIDE;
37 virtual AudioOutputStream* MakeAudioLowLatencyOutputStream(
38 const AudioParameters& params) OVERRIDE;
39 virtual AudioInputStream* MakeAudioLinearInputStream(
40 const AudioParameters& params, const std::string& device_id) OVERRIDE;
41 virtual AudioInputStream* MakeAudioLowLatencyInputStream(
42 const AudioParameters& params, const std::string& device_id) OVERRIDE;
39 43
40 protected: 44 protected:
41 virtual ~AudioManagerLinux(); 45 virtual ~AudioManagerLinux();
42 46
43 private: 47 private:
44 enum StreamType { 48 enum StreamType {
45 kStreamPlayback = 0, 49 kStreamPlayback = 0,
46 kStreamCapture, 50 kStreamCapture,
47 }; 51 };
48 52
49 // Gets a list of available ALSA input devices. 53 // Gets a list of available ALSA input devices.
50 void GetAlsaAudioInputDevices(media::AudioDeviceNames* device_names); 54 void GetAlsaAudioInputDevices(media::AudioDeviceNames* device_names);
51 55
52 // Gets the ALSA devices' names and ids. 56 // Gets the ALSA devices' names and ids.
53 void GetAlsaDevicesInfo(void** hint, media::AudioDeviceNames* device_names); 57 void GetAlsaDevicesInfo(void** hint, media::AudioDeviceNames* device_names);
54 58
55 // Checks if the specific ALSA device is available. 59 // Checks if the specific ALSA device is available.
56 bool IsAlsaDeviceAvailable(const char* device_name); 60 bool IsAlsaDeviceAvailable(const char* device_name);
57 61
58 // Returns true if a device is present for the given stream type. 62 // Returns true if a device is present for the given stream type.
59 bool HasAnyAlsaAudioDevice(StreamType stream); 63 bool HasAnyAlsaAudioDevice(StreamType stream);
60 64
65 // Called by MakeAudioLinearOutputStream and MakeAudioLowLatencyOutputStream.
66 AudioOutputStream* MakeOutputStream(const AudioParameters& params);
67
68 // Called by MakeAudioLinearInputStream and MakeAudioLowLatencyInputStream.
69 AudioInputStream* MakeInputStream(const AudioParameters& params,
70 const std::string& device_id);
71
61 scoped_ptr<AlsaWrapper> wrapper_; 72 scoped_ptr<AlsaWrapper> wrapper_;
62 73
63 size_t active_output_stream_count_;
64
65 DISALLOW_COPY_AND_ASSIGN(AudioManagerLinux); 74 DISALLOW_COPY_AND_ASSIGN(AudioManagerLinux);
66 }; 75 };
67 76
68 #endif // MEDIA_AUDIO_LINUX_AUDIO_MANAGER_LINUX_H_ 77 #endif // MEDIA_AUDIO_LINUX_AUDIO_MANAGER_LINUX_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698