diff options
author | scop <scop> | 2005-03-22 20:29:23 +0000 |
---|---|---|
committer | scop <scop> | 2005-03-22 20:29:23 +0000 |
commit | a59471ab622166ad2e39cfa7bd56c42db9f5a26d (patch) | |
tree | ca245129ff73667f80688e17de38f11d7704c66c | |
parent | edd619a95864d1d9dd47a334ded14326b0172c81 (diff) | |
download | vdr-plugin-dxr3-a59471ab622166ad2e39cfa7bd56c42db9f5a26d.tar.gz vdr-plugin-dxr3-a59471ab622166ad2e39cfa7bd56c42db9f5a26d.tar.bz2 |
Fix open() return value checks for em8300-* fifos.
-rw-r--r-- | HISTORY | 4 | ||||
-rw-r--r-- | dxr3interface.c | 31 |
2 files changed, 17 insertions, 18 deletions
@@ -269,8 +269,8 @@ NOTE: I havent found time to include all of the languages, will be done in pre2 dxr3interface.c, removed not needed #includes (Christian Gmeiner) - fixed OSD getting pink (bug #1022810, Christian Gmeiner) - added support for VDR 1.3.13 and later (Luca Olivetti, Peter Dittmann) -- if we cant open control fifo, plugin now returns a correct error message - (Christian Gmeiner) +- 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 4211048..8f34d08 100644 --- a/dxr3interface.c +++ b/dxr3interface.c @@ -61,18 +61,18 @@ static int Dxr3Open(const char *Name, int n, int Mode) if (fd < 0) { cLog::Instance() << "Unable to open " << FileName << "\n"; - return 0; } return fd; } // ================================== //! 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() << "Please check if the dxr3 modules are loaded!\n"; exit(1); @@ -87,9 +87,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); } @@ -141,19 +141,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); } @@ -798,10 +798,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; @@ -881,7 +881,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); @@ -890,8 +890,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; |