Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: VDR Admin GRAB command



On Sun, Sep 14, 2003 at 06:20:51PM -0700, Dirk Essl wrote:
>
>
> Hi everybody,
>
> I got a problem while using the "TV" Window in VDR Admin
> it grabs a frame from my Hauppauge WinTV, and not from the DVB Card.
> The bttv09 module is loaded before the DVB driver, because only this way
> it works at my system.

Use this patch:

---8<-----if--you--cut--here--you--will--probably--destroy--your--monitor---
--- dvbdevice.c.orig	2003-08-26 18:15:51.000000000 +0200
+++ dvbdevice.c	2003-08-26 18:13:50.000000000 +0200
@@ -583,7 +583,35 @@
 bool cDvbDevice::GrabImage(const char *FileName, bool Jpeg, int Quality, int SizeX, int SizeY)
 {
   char buffer[PATH_MAX];
-  snprintf(buffer, sizeof(buffer), "%s%d", DEV_VIDEO, CardIndex());
+  static int ofs = -1;
+  FILE *f;
+
+  if (ofs == -1) { // firsttime
+    while (1) {
+      snprintf(buffer, sizeof buffer, "/proc/video/dev/video%d", ++ofs);
+
+      if ((f = fopen(buffer, "r")) == (FILE *)NULL) { // does not exist?
+        ofs = 0;
+        break;
+      }
+
+      if (fgets(buffer, sizeof buffer, f)) {
+        if (strstr(buffer, "DVB Board")) // found the _first_ DVB card
+          break;
+      }
+      else {
+        ofs = 0;
+        break;
+      }
+
+      fclose(f);
+    }
+
+    fclose(f);
+
+  }
+
+  snprintf(buffer, sizeof(buffer), "%s%d", DEV_VIDEO, CardIndex() + ofs);
   isyslog("grabbing from %s", buffer);
   int videoDev = open(buffer, O_RDWR);
   if (videoDev < 0)
---8<-----if--you--cut--here--you--will--probably--destroy--your--monitor---

> --
> Dirk Essl <de@floydworld.de>

Ciao,
Andreas
--
Andreas Kool (akool<nospam>@</nospam>gmx.de * http://akool.bei.t-online.de)


-- 
Info:
To unsubscribe send a mail to ecartis@linuxtv.org with "unsubscribe vdr" as subject.



Home | Main Index | Thread Index