Mailing List archive

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

[vdr] Re: VDR Admin GRAB command



Andreas Kool wrote:
> 
> 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---

I'm not sure whether this is a real _solution_ to the problem.
It _may_ work, if the primary device id the _first_ DVB card.
But what if it isn't?

The real problem is that the /dev/dvb/... devices can have completely
different numbers than the related /dev/video... devices. What we would
need is a way of having the DVB device tell VDR which /dev/video device
belongs to it.

Klaus


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



Home | Main Index | Thread Index