diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2003-10-04 12:42:58 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2003-10-04 12:42:58 +0200 |
commit | 3f12ebbccb3c23b5722d591fe21d65134ff87f93 (patch) | |
tree | 7e1754dd6b9b3a9af11cd0e0ce4bd48e40a64c85 | |
parent | 944ffee0a18e1a33770ef35f12bbe0e77850476c (diff) | |
download | vdr-3f12ebbccb3c23b5722d591fe21d65134ff87f93.tar.gz vdr-3f12ebbccb3c23b5722d591fe21d65134ff87f93.tar.bz2 |
Fixed detecting the /dev/videoN devices for GRAB in case there are others before the DVB devices
-rw-r--r-- | CONTRIBUTORS | 2 | ||||
-rw-r--r-- | HISTORY | 2 | ||||
-rw-r--r-- | dvbdevice.c | 40 | ||||
-rw-r--r-- | dvbdevice.h | 5 |
4 files changed, 44 insertions, 5 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 501ebcde..19b39dce 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -568,6 +568,8 @@ Andreas Kool <akool@akool.de> for his help in keeping 'channels.conf.cable' up to date for fixing the TS to PES repacker so that it works with MPEG1 streams for reporting a problem with empty values in setup.conf + for fixing detecting the /dev/videoN devices for GRAB in case there are others + before the DVB devices Guy Roussin <guy.roussin@teledetection.fr> for suggesting not to display channel group delimiters without text @@ -2411,3 +2411,5 @@ Video Disk Recorder Revision History to Andreas Trauer). - Fixed handling a channels.conf that contains a ":@nnn" line as its last entry (thanks to Ralf Klueber). +- Fixed detecting the /dev/videoN devices for GRAB in case there are others + before the DVB devices (thanks to Andreas Kool). diff --git a/dvbdevice.c b/dvbdevice.c index f29745b2..8c4c7264 100644 --- a/dvbdevice.c +++ b/dvbdevice.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: dvbdevice.c 1.64 2003/09/06 13:19:33 kls Exp $ + * $Id: dvbdevice.c 1.65 2003/10/04 12:31:15 kls Exp $ */ #include "dvbdevice.h" @@ -307,6 +307,8 @@ void cDvbTuner::Action(void) // --- cDvbDevice ------------------------------------------------------------ +int cDvbDevice::devVideoOffset = -1; + cDvbDevice::cDvbDevice(int n) { dvbTuner = NULL; @@ -317,8 +319,7 @@ cDvbDevice::cDvbDevice(int n) // Devices that are present on all card types: - int fd_frontend = DvbOpen(DEV_DVB_FRONTEND, n, O_RDWR | O_NONBLOCK); - + int fd_frontend = DvbOpen(DEV_DVB_FRONTEND, n, O_RDWR | O_NONBLOCK); // Devices that are only present on cards with decoders: fd_osd = DvbOpen(DEV_DVB_OSD, n, O_RDWR); @@ -329,6 +330,35 @@ cDvbDevice::cDvbDevice(int n) fd_dvr = -1; + // The offset of the /dev/video devices: + + if (devVideoOffset < 0) { // the first one checks this + FILE *f = NULL; + char buffer[PATH_MAX]; + for (int ofs = 0; ofs < 100; ofs++) { + snprintf(buffer, sizeof(buffer), "/proc/video/dev/video%d", ofs); + if ((f = fopen(buffer, "r")) != NULL) { + if (fgets(buffer, sizeof(buffer), f)) { + if (strstr(buffer, "DVB Board")) { // found the _first_ DVB card + devVideoOffset = ofs; + dsyslog("video device offset is %d", devVideoOffset); + break; + } + } + else + break; + fclose(f); + } + else + break; + } + if (devVideoOffset < 0) + devVideoOffset = 0; + if (f) + fclose(f); + } + devVideoIndex = (devVideoOffset >= 0 && HasDecoder()) ? devVideoOffset++ : -1; + // Video format: SetVideoFormat(Setup.VideoFormat ? VIDEO_FORMAT_16_9 : VIDEO_FORMAT_4_3); @@ -427,8 +457,10 @@ cSpuDecoder *cDvbDevice::GetSpuDecoder(void) bool cDvbDevice::GrabImage(const char *FileName, bool Jpeg, int Quality, int SizeX, int SizeY) { + if (devVideoIndex < 0) + return false; char buffer[PATH_MAX]; - snprintf(buffer, sizeof(buffer), "%s%d", DEV_VIDEO, CardIndex()); + snprintf(buffer, sizeof(buffer), "%s%d", DEV_VIDEO, devVideoIndex); int videoDev = open(buffer, O_RDWR); if (videoDev < 0) LOG_ERROR_STR(buffer); diff --git a/dvbdevice.h b/dvbdevice.h index aab20fdd..78df221b 100644 --- a/dvbdevice.h +++ b/dvbdevice.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: dvbdevice.h 1.22 2003/08/15 12:34:55 kls Exp $ + * $Id: dvbdevice.h 1.23 2003/10/04 11:54:50 kls Exp $ */ #ifndef __DVBDEVICE_H @@ -73,6 +73,9 @@ protected: // Image Grab facilities +private: + static int devVideoOffset; + int devVideoIndex; public: virtual bool GrabImage(const char *FileName, bool Jpeg = true, int Quality = -1, int SizeX = -1, int SizeY = -1); |