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 "libmythbase/mythconfig.h"
23 
24 #include "audioinput.h"
25 #include "audioinputalsa.h"
26 #include "audioinputoss.h"
27 
28 #define LOC QString("AudioIn: ")
29 
30 AudioInput *AudioInput::CreateDevice(const QByteArray &device)
31 {
32  AudioInput *audio = nullptr;
33  if (CONFIG_AUDIO_OSS && device.startsWith("/"))
34  {
35 #if defined( CONFIG_AUDIO_OSS ) && (CONFIG_AUDIO_OSS==1)
36  audio = new AudioInputOSS(device);
37 #endif
38  }
39  else if (CONFIG_AUDIO_ALSA && device.startsWith("ALSA:"))
40  {
41 #if defined( CONFIG_AUDIO_ALSA ) && (CONFIG_AUDIO_ALSA==1)
42  audio = new AudioInputALSA(device);
43 #endif
44  }
45  else if (device == "NULL")
46  {
47  LOG(VB_GENERAL, LOG_INFO, LOC + "creating NULL audio device");
48  }
49  else
50  {
51  LOG(VB_GENERAL, LOG_ERR, LOC +
52  "unknown or unsupported audio input device '" + device + "'");
53  }
54 
55  return audio;
56 }
57 /* vim: set expandtab tabstop=4 shiftwidth=4: */
audioinputalsa.h
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:39
AudioInput
Definition: audioinput.h:27
LOC
#define LOC
Definition: audioinput.cpp:28
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:30