diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | dxr3.c | 4 | ||||
-rw-r--r-- | dxr3audio-oss.c | 130 | ||||
-rw-r--r-- | dxr3audio-oss.h | 44 | ||||
-rw-r--r-- | dxr3device.c | 6 | ||||
-rw-r--r-- | settings.c | 2 | ||||
-rw-r--r-- | settings.h | 5 |
7 files changed, 5 insertions, 188 deletions
@@ -86,7 +86,7 @@ OBJS = $(PLUGIN).o dxr3multichannelaudio.o \ dxr3audiodecoder.o dxr3blackframe.o dxr3audio.o \ dxr3pesframe.o settings.o \ dxr3device.o dxr3osd.o dxr3spudecoder.o \ - dxr3audio-oss.o dxr3audio-alsa.o dxr3audio-pa.o \ + dxr3audio-alsa.o dxr3audio-pa.o \ spuencoder.o spuregion.o scaler.o ### Default target: @@ -181,11 +181,11 @@ const char *cPluginDxr3::CommandLineHelp() { return " -f --firmware-loading Enable automatic firmware loading\n" \ " -a DRIVER --audio-driver=DRIVER Select wanted audio driver" \ - " - alsa " + " - alsa (default)" #ifdef PULSEAUDIO " - pa (PulseAudio)" #endif - " - oss (default)"; + ; } bool cPluginDxr3::ProcessArgs(int argc, char *argv[]) diff --git a/dxr3audio-oss.c b/dxr3audio-oss.c deleted file mode 100644 index 8b2494d..0000000 --- a/dxr3audio-oss.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - * - * Copyright (C) 2009 Christian Gmeiner - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -#include <sys/soundcard.h> -#include <unistd.h> // for close -#include <sys/ioctl.h> - -#include "dxr3audio-oss.h" -#include "dxr3device.h" -#include "settings.h" - -static const char *DEV_DXR3_OSS = "_ma"; - -void cAudioOss::openDevice() -{ - if (open) - return; - - fd = cDxr3Device::Dxr3Open(DEV_DXR3_OSS, O_RDWR | O_NONBLOCK); - - if (!fd) { - esyslog("[dxr3-audio-oss] failed to open dxr3 audio subdevice"); - exit(1); - } - - open = true; -} - -void cAudioOss::releaseDevice() -{ - if (!open) - return; - - close(fd); - - open = false; -} - -void cAudioOss::setup(int channels, int samplerate) -{ - if (!open) - return; - - // set sample rate - if (curContext.samplerate != samplerate) { - dsyslog("[dxr3-audio-oss] changing samplerate to %d (old %d) ", samplerate, curContext.samplerate); - curContext.samplerate = samplerate; - CHECK( ioctl(fd, SNDCTL_DSP_SAMPLESIZE, &samplerate)); - } - - // set channels - if (curContext.channels != channels) { - dsyslog("[dxr3-audio-oss] changing num of channels to %d (old %d)", channels, curContext.channels); - curContext.channels = channels; - CHECK( ioctl(fd, SNDCTL_DSP_CHANNELS, &channels)); - } -} - -void cAudioOss::write(uchar* data, size_t size) -{ - if (!open || !enabled) - return; - - size_t ret = WriteAllOrNothing(fd, data, size, 1000, 10); - - if (ret != size) { - dsyslog("[dxr3-audio-oss] writing audio failed"); - } -} - -void cAudioOss::flush() -{ - CHECK(cDxr3Device::instance()->ossFlush()); -} - -void cAudioOss::poll(cPoller &poller) -{ - poller.Add(fd, true); -} - -void cAudioOss::setDigitalAudio(bool on) -{ - if (digitalAudio == on) - return; - - reconfigure(); - - digitalAudio = on; -} - -void cAudioOss::reconfigure() -{ - uint32_t ioval = 0; - dsyslog("[dxr3-oss] reconfigure"); - - // this is quite an imporant part, as we need to - // decide how we set the audiomode of oss device. - if (digitalAudio) { - ioval = EM8300_AUDIOMODE_DIGITALAC3; - } else { - - // digital or analog pcm? - if (cSettings::instance()->useDigitalOut()) { - ioval = EM8300_AUDIOMODE_DIGITALPCM; - } else { - ioval = EM8300_AUDIOMODE_ANALOG; - } - } - - // we need to do it this way, as we dont have access - // to the file handle for the conrtol sub device. - cDxr3Device::instance()->ossSetPlayMode(ioval); -} diff --git a/dxr3audio-oss.h b/dxr3audio-oss.h deleted file mode 100644 index 6cdc691..0000000 --- a/dxr3audio-oss.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * - * Copyright (C) 2009 Christian Gmeiner - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -#ifndef _AUDIO_OSS_H_ -#define _AUDIO_OSS_H_ - -#include "dxr3audio.h" - -class cAudioOss : public iAudio { -public: - cAudioOss() : iAudio(), fd(-1) {} - ~cAudioOss() {} - - virtual void openDevice(); - virtual void releaseDevice(); - virtual void setup(int channels, int samplerate); - virtual void write(uchar* data, size_t size); - virtual void flush(); - virtual void poll(cPoller &poller); - virtual void setDigitalAudio(bool on); - virtual void reconfigure(); - -private: - int fd; -}; - -#endif /*_AUDIO_OSS_H_*/ diff --git a/dxr3device.c b/dxr3device.c index 7c8b8fa..95ab812 100644 --- a/dxr3device.c +++ b/dxr3device.c @@ -30,7 +30,6 @@ #include "dxr3device.h" #include "dxr3tools.h" #include "dxr3osd.h" -#include "dxr3audio-oss.h" #include "dxr3audio-alsa.h" #include "dxr3audio-pa.h" #include "dxr3pesframe.h" @@ -54,11 +53,6 @@ cDxr3Device::cDxr3Device() : spuDecoder(NULL), pluginOn(true), vPts(0), scrSet(f claimDevices(); switch (cSettings::instance()->audioDriver()) { - case OSS: - isyslog("[dxr3-device] using oss audio driver"); - audioOut = new cAudioOss(); - break; - case ALSA: isyslog("[dxr3-device] using alsa audio driver"); audioOut = new cAudioAlsa(); @@ -47,8 +47,6 @@ bool cSettings::processArgs(int argc, char *argv[]) case 'a': if (optarg && strcmp(optarg, "alsa") == 0) { audioDriver(ALSA); - } else if (optarg && strcmp(optarg, "oss") == 0) { - audioDriver(OSS); #ifdef PULSEAUDIO } else if (optarg && strcmp(optarg, "pa") == 0) { audioDriver(PA); @@ -42,8 +42,7 @@ enum eVideoMode }; enum AudioDriver { - OSS = 0, - ALSA, + ALSA = 0, #ifdef PULSEAUDIO PA #endif @@ -75,7 +74,7 @@ class cSettings : public Singleton<cSettings> public: cSettings() : useDigitalOut(0), card(0), forceLetterBox(0), videoMode(PAL), brightness(500), contrast(500), saturation(500), - useWss(0), loadFirmware(false), audioDriver(OSS), + useWss(0), loadFirmware(false), audioDriver(ALSA), ac3AudioMode(PCM_ENCAPSULATION) {} bool processArgs(int argc, char *argv[]); |