diff options
author | scop <scop> | 2005-03-22 20:23:26 +0000 |
---|---|---|
committer | scop <scop> | 2005-03-22 20:23:26 +0000 |
commit | b1926c1b432829d3190ebb049b57e08ac480f639 (patch) | |
tree | 2dbb62b92e26271717e228bf6dc212044e574a73 | |
parent | 39051d714ec33ee8858a57d2e938e658b1e55eaa (diff) | |
download | vdr-plugin-dxr3-b1926c1b432829d3190ebb049b57e08ac480f639.tar.gz vdr-plugin-dxr3-b1926c1b432829d3190ebb049b57e08ac480f639.tar.bz2 |
Fix open() return value checks for em8300-* fifos.
-rw-r--r-- | HISTORY | 2 | ||||
-rw-r--r-- | dxr3interface.c | 32 |
2 files changed, 18 insertions, 16 deletions
@@ -255,6 +255,8 @@ NOTE: I havent found time to include all of the languages, will be done in pre2 - fixed #includes: moved #include "dxr3osd.h" from dxr3interface.h to dxr3interface.c, removed not needed #includes (Christian Gmeiner) - added support for VDR 1.3.13 and later (Luca Olivetti, Peter Dittmann) +- fixed checking of return falues when opening the em8300-* fifos + (Christian Gmeiner, Ville Skyttä) - removed explicit linking with zlib (Christian Gmeiner) - compiles now with 3.4.x gcc's (Christian Gmeiner, Ville Skyttä) - use $CXX for generating dependencies instead of hardcoded g++ (Ville Skyttä) diff --git a/dxr3interface.c b/dxr3interface.c index 05e175f..c6b557e 100644 --- a/dxr3interface.c +++ b/dxr3interface.c @@ -58,14 +58,15 @@ static int Dxr3Open(const char *Name, int n, int Mode) // ================================== //! constructor -cDxr3Interface::cDxr3Interface() +cDxr3Interface::cDxr3Interface() : +m_fdControl(-1), m_fdVideo(-1), m_fdAudio(-1), m_fdSpu(-1) { // open control stream m_fdControl = Dxr3Open("", cDxr3ConfigData::Instance().GetDxr3Card(), O_WRONLY | O_SYNC); - if (!m_fdControl) + if (m_fdControl < 0) { - cLog::Instance() << "Unable to open the control stream!\n"; cLog::Instance() << "Please check if the dxr3 modules are loaded!\n"; + exit(1); } // upload microcode to dxr3 @@ -77,9 +78,9 @@ cDxr3Interface::cDxr3Interface() m_fdSpu = Dxr3Open("_sp", cDxr3ConfigData::Instance().GetDxr3Card(), O_WRONLY | O_SYNC); // everything ok? - if (!m_fdVideo || !m_fdAudio || !m_fdSpu) + if (m_fdVideo < 0 || m_fdAudio < 0 || m_fdSpu < 0) { - cLog::Instance() << "Unable to open one of the 'mulitmedia' streams!\n"; + cLog::Instance() << "Unable to open one of the 'multimedia' streams!\n"; exit(1); } @@ -132,19 +133,19 @@ cDxr3Interface::cDxr3Interface() cDxr3Interface::~cDxr3Interface() { // close filehandles - if (m_fdControl) + if (m_fdControl > -1) { close(m_fdControl); } - if (m_fdVideo) + if (m_fdVideo > -1) { close(m_fdVideo); } - if (m_fdSpu) + if (m_fdSpu > -1) { close(m_fdSpu); } - if (m_fdAudio) + if (m_fdAudio > -1) { close(m_fdAudio); } @@ -744,10 +745,10 @@ void cDxr3Interface::ExternalReleaseDevices() if (!m_ExternalReleased) { - if (m_fdControl > 0) close(m_fdControl); - if (m_fdVideo > 0) close(m_fdVideo); - if (m_fdSpu > 0) close(m_fdSpu); - if (m_fdAudio > 0) close(m_fdAudio); + if (m_fdControl > -1) close(m_fdControl); + if (m_fdVideo > -1) close(m_fdVideo); + if (m_fdSpu > -1) close(m_fdSpu); + if (m_fdAudio > -1) close(m_fdAudio); m_fdControl = m_fdVideo = m_fdSpu = m_fdAudio = -1; m_ExternalReleased = true; @@ -828,7 +829,7 @@ void cDxr3Interface::ReOpenAudio() if (!m_ExternalReleased) { - if (m_fdAudio > 0) + if (m_fdAudio > -1) { int bufsize = 0; ioctl(m_fdAudio, SNDCTL_DSP_GETODELAY, &bufsize); @@ -837,8 +838,7 @@ void cDxr3Interface::ReOpenAudio() delete m_pClock; close(m_fdAudio); - m_fdAudio = open("/dev/em8300_ma-0", O_WRONLY | O_SYNC); - + m_fdAudio = Dxr3Open("_ma", cDxr3ConfigData::Instance().GetDxr3Card(), O_WRONLY | O_SYNC); uint32_t tmpAudioDataRate = m_audioDataRate; uint32_t tmpAudioChannelCount = m_audioChannelCount; |