MythTV  master
audioinput.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2007 Anand K. Mistry
3  * Copyright (C) 2008 Alan Calvert
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18  * 02110-1301, USA.
19  */
20 
21 #include "mythlogging.h"
22 #include "mythconfig.h"
23 #include "audioinput.h"
24 #include "audioinputoss.h"
25 #include "audioinputalsa.h"
26 
27 #define LOC QString("AudioIn: ")
28 
29 AudioInput *AudioInput::CreateDevice(const QByteArray &device)
30 {
31  AudioInput *audio = nullptr;
32  if (CONFIG_AUDIO_OSS && device.startsWith("/"))
33  {
34 #if defined( CONFIG_AUDIO_OSS ) && (CONFIG_AUDIO_OSS==1)
35  audio = new AudioInputOSS(device);
36 #endif
37  }
38  else if (CONFIG_AUDIO_ALSA && device.startsWith("ALSA:"))
39  {
40 #if defined( CONFIG_AUDIO_ALSA ) && (CONFIG_AUDIO_ALSA==1)
41  audio = new AudioInputALSA(device);
42 #endif
43  }
44  else if (device == "NULL")
45  {
46  LOG(VB_GENERAL, LOG_INFO, LOC + "creating NULL audio device");
47  }
48  else
49  {
50  LOG(VB_GENERAL, LOG_ERR, LOC +
51  "unknown or unsupported audio input device '" + device + "'");
52  }
53 
54  return audio;
55 }
56 /* vim: set expandtab tabstop=4 shiftwidth=4: */
audioinputalsa.h
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:23
AudioInput
Definition: audioinput.h:27
LOC
#define LOC
Definition: audioinput.cpp:27
mythlogging.h
AudioInputOSS
Definition: audioinputoss.h:27
audioinputoss.h
AudioInputALSA
Definition: audioinputalsa.h:33
audioinput.h
AudioInput::CreateDevice
static AudioInput * CreateDevice(const QByteArray &device)
Definition: audioinput.cpp:29