summaryrefslogtreecommitdiffstats
path: root/media/audio/linux/alsa_wrapper.h
diff options
context:
space:
mode:
authorspang@chromium.org <spang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-28 06:00:33 +0000
committerspang@chromium.org <spang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-28 06:00:33 +0000
commit8117a12e805a3243141cf3c7cb0f2cdd0538b47f (patch)
tree77ca52f1d5086608d87064fa4e500d793b528fb5 /media/audio/linux/alsa_wrapper.h
parent0a72447fb90b7d8ab0ab07119098a46ba84f0c86 (diff)
downloadchromium_src-8117a12e805a3243141cf3c7cb0f2cdd0538b47f.zip
chromium_src-8117a12e805a3243141cf3c7cb0f2cdd0538b47f.tar.gz
chromium_src-8117a12e805a3243141cf3c7cb0f2cdd0538b47f.tar.bz2
Support use_alsa==0 on Linux
This moves the ALSA audio code from media/audio/linux to media/audio/alsa and splits Linux's CreateAudioManager() into a new file. This function chooses which AudioManager subclass to use on Linux. When use_alsa==0 on Linux, the fallback audio manager is changed from ALSA to a new fake implementation that always has an empty set of devices and will only return fake streams. This allows us to compile with no audio support on Linux. In particular, we can compile for targets that don't have the ALSA libraries available. Obviously, it's not (yet) possible to play audio in this configuration. BUG=318315, 318413 Review URL: https://codereview.chromium.org/89793003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@237696 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/audio/linux/alsa_wrapper.h')
-rw-r--r--media/audio/linux/alsa_wrapper.h81
1 files changed, 0 insertions, 81 deletions
diff --git a/media/audio/linux/alsa_wrapper.h b/media/audio/linux/alsa_wrapper.h
deleted file mode 100644
index 30d9463..0000000
--- a/media/audio/linux/alsa_wrapper.h
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// AlsaWrapper is a simple stateless class that wraps the alsa library commands
-// we want to use. It's purpose is to allow injection of a mock so that the
-// higher level code is testable.
-
-#include <alsa/asoundlib.h>
-
-#include "base/basictypes.h"
-#include "media/base/media_export.h"
-
-namespace media {
-
-class MEDIA_EXPORT AlsaWrapper {
- public:
- AlsaWrapper();
- virtual ~AlsaWrapper();
-
- virtual int DeviceNameHint(int card, const char* iface, void*** hints);
- virtual char* DeviceNameGetHint(const void* hint, const char* id);
- virtual int DeviceNameFreeHint(void** hints);
- virtual int CardNext(int* rcard);
-
- virtual int PcmOpen(snd_pcm_t** handle, const char* name,
- snd_pcm_stream_t stream, int mode);
- virtual int PcmClose(snd_pcm_t* handle);
- virtual int PcmPrepare(snd_pcm_t* handle);
- virtual int PcmDrop(snd_pcm_t* handle);
- virtual int PcmDelay(snd_pcm_t* handle, snd_pcm_sframes_t* delay);
- virtual snd_pcm_sframes_t PcmWritei(snd_pcm_t* handle,
- const void* buffer,
- snd_pcm_uframes_t size);
- virtual snd_pcm_sframes_t PcmReadi(snd_pcm_t* handle,
- void* buffer,
- snd_pcm_uframes_t size);
- virtual int PcmRecover(snd_pcm_t* handle, int err, int silent);
- virtual int PcmSetParams(snd_pcm_t* handle, snd_pcm_format_t format,
- snd_pcm_access_t access, unsigned int channels,
- unsigned int rate, int soft_resample,
- unsigned int latency);
- virtual int PcmGetParams(snd_pcm_t* handle, snd_pcm_uframes_t* buffer_size,
- snd_pcm_uframes_t* period_size);
- virtual const char* PcmName(snd_pcm_t* handle);
- virtual snd_pcm_sframes_t PcmAvailUpdate(snd_pcm_t* handle);
- virtual snd_pcm_state_t PcmState(snd_pcm_t* handle);
- virtual int PcmStart(snd_pcm_t* handle);
-
- virtual int MixerOpen(snd_mixer_t** mixer, int mode);
- virtual int MixerAttach(snd_mixer_t* mixer, const char* name);
- virtual int MixerElementRegister(snd_mixer_t* mixer,
- struct snd_mixer_selem_regopt* options,
- snd_mixer_class_t** classp);
- virtual void MixerFree(snd_mixer_t* mixer);
- virtual int MixerDetach(snd_mixer_t* mixer, const char* name);
- virtual int MixerClose(snd_mixer_t* mixer);
- virtual int MixerLoad(snd_mixer_t* mixer);
- virtual snd_mixer_elem_t* MixerFirstElem(snd_mixer_t* mixer);
- virtual snd_mixer_elem_t* MixerNextElem(snd_mixer_elem_t* elem);
- virtual int MixerSelemIsActive(snd_mixer_elem_t* elem);
- virtual const char* MixerSelemName(snd_mixer_elem_t* elem);
- virtual int MixerSelemSetCaptureVolumeAll(snd_mixer_elem_t* elem, long value);
- virtual int MixerSelemGetCaptureVolume(snd_mixer_elem_t* elem,
- snd_mixer_selem_channel_id_t channel,
- long* value);
- virtual int MixerSelemHasCaptureVolume(snd_mixer_elem_t* elem);
- virtual int MixerSelemGetCaptureVolumeRange(snd_mixer_elem_t* elem,
- long* min, long* max);
-
- virtual const char* StrError(int errnum);
-
- private:
- int ConfigureHwParams(snd_pcm_t* handle, snd_pcm_hw_params_t* hw_params,
- snd_pcm_format_t format, snd_pcm_access_t access,
- unsigned int channels, unsigned int rate,
- int soft_resample, unsigned int latency);
- DISALLOW_COPY_AND_ASSIGN(AlsaWrapper);
-};
-
-} // namespace media