| 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 // AlsaWrapper is a simple stateless class that wraps the alsa library commands | 5 // AlsaWrapper is a simple stateless class that wraps the alsa library commands |
| 6 // we want to use. It's purpose is to allow injection of a mock so that the | 6 // we want to use. It's purpose is to allow injection of a mock so that the |
| 7 // higher level code is testable. | 7 // higher level code is testable. |
| 8 | 8 |
| 9 #include <alsa/asoundlib.h> | 9 #include <alsa/asoundlib.h> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "media/base/media_export.h" | 12 #include "media/base/media_export.h" |
| 13 | 13 |
| 14 namespace media { | 14 namespace media { |
| 15 | 15 |
| 16 class MEDIA_EXPORT AlsaWrapper { | 16 class MEDIA_EXPORT AlsaWrapper { |
| 17 public: | 17 public: |
| 18 AlsaWrapper(); | 18 AlsaWrapper(); |
| 19 virtual ~AlsaWrapper(); | 19 virtual ~AlsaWrapper(); |
| 20 | 20 |
| 21 virtual int DeviceNameHint(int card, const char* iface, void*** hints); | 21 virtual int DeviceNameHint(int card, const char* iface, void*** hints); |
| 22 virtual char* DeviceNameGetHint(const void* hint, const char* id); | 22 virtual char* DeviceNameGetHint(const void* hint, const char* id); |
| 23 virtual int DeviceNameFreeHint(void** hints); | 23 virtual int DeviceNameFreeHint(void** hints); |
| 24 virtual int CardNext(int* rcard); | 24 virtual int CardNext(int* rcard); |
| 25 | 25 |
| 26 virtual int PcmOpen(snd_pcm_t** handle, const char* name, | 26 virtual int PcmOpen(snd_pcm_t** handle, const char* name, |
| 27 snd_pcm_stream_t stream, int mode); | 27 snd_pcm_stream_t stream, int mode); |
| 28 virtual int PcmClose(snd_pcm_t* handle); | 28 virtual int PcmClose(snd_pcm_t* handle); |
| 29 virtual int PcmPrepare(snd_pcm_t* handle); | 29 virtual int PcmPrepare(snd_pcm_t* handle); |
| 30 virtual int PcmDrain(snd_pcm_t* handle); | |
| 31 virtual int PcmDrop(snd_pcm_t* handle); | 30 virtual int PcmDrop(snd_pcm_t* handle); |
| 32 virtual int PcmDelay(snd_pcm_t* handle, snd_pcm_sframes_t* delay); | 31 virtual int PcmDelay(snd_pcm_t* handle, snd_pcm_sframes_t* delay); |
| 33 virtual snd_pcm_sframes_t PcmWritei(snd_pcm_t* handle, | 32 virtual snd_pcm_sframes_t PcmWritei(snd_pcm_t* handle, |
| 34 const void* buffer, | 33 const void* buffer, |
| 35 snd_pcm_uframes_t size); | 34 snd_pcm_uframes_t size); |
| 36 virtual snd_pcm_sframes_t PcmReadi(snd_pcm_t* handle, | 35 virtual snd_pcm_sframes_t PcmReadi(snd_pcm_t* handle, |
| 37 void* buffer, | 36 void* buffer, |
| 38 snd_pcm_uframes_t size); | 37 snd_pcm_uframes_t size); |
| 39 virtual int PcmRecover(snd_pcm_t* handle, int err, int silent); | 38 virtual int PcmRecover(snd_pcm_t* handle, int err, int silent); |
| 40 virtual int PcmSetParams(snd_pcm_t* handle, snd_pcm_format_t format, | 39 virtual int PcmSetParams(snd_pcm_t* handle, snd_pcm_format_t format, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 | 72 |
| 74 private: | 73 private: |
| 75 int ConfigureHwParams(snd_pcm_t* handle, snd_pcm_hw_params_t* hw_params, | 74 int ConfigureHwParams(snd_pcm_t* handle, snd_pcm_hw_params_t* hw_params, |
| 76 snd_pcm_format_t format, snd_pcm_access_t access, | 75 snd_pcm_format_t format, snd_pcm_access_t access, |
| 77 unsigned int channels, unsigned int rate, | 76 unsigned int channels, unsigned int rate, |
| 78 int soft_resample, unsigned int latency); | 77 int soft_resample, unsigned int latency); |
| 79 DISALLOW_COPY_AND_ASSIGN(AlsaWrapper); | 78 DISALLOW_COPY_AND_ASSIGN(AlsaWrapper); |
| 80 }; | 79 }; |
| 81 | 80 |
| 82 } // namespace media | 81 } // namespace media |
| OLD | NEW |