Mailing List archive

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

[vdr] Re: Playing DVD ?



On Saturday 30 August 2003 03:31, Oliver Endriss wrote:
> On Wednesday 27 August 2003 13:13, Oliver Endriss wrote:
> > I'll take this issue to the dvb mailing list. But first we should have
> > a solution which makes vdr happy. ;-)
> 
> Update:  
> My driver patch will probably not be accepted, since the API does not
> allow PES data in VIDEO_STILLPICTURE ioctl calls.
> 
> So I created a patch which fixes the problem in vdr:
> ...

I just noticed that the &-mask should be 0xf0, not 0xe0.
As stream ids 0xf0..0xff are not used in vdr recordings, it will make
no difference. Anyway:

---------------------------------------------------------------------
--- dvbdevice.c.org	Sat Aug 30 02:56:25 2003
+++ dvbdevice.c	Sat Aug 30 02:53:05 2003
@@ -897,10 +897,60 @@ void cDvbDevice::StillPicture(const ucha
    could be used, please let me know!
    kls 2002-03-23
 */
-//#define VIDEO_STILLPICTURE_WORKS_WITH_VDR_FRAMES
+#define VIDEO_STILLPICTURE_WORKS_WITH_VDR_FRAMES
 #ifdef VIDEO_STILLPICTURE_WORKS_WITH_VDR_FRAMES
-  video_still_picture sp = { (char *)Data, Length };
-  CHECK(ioctl(fd_video, VIDEO_STILLPICTURE, &sp));
+
+  if (Data[0] == 0x00 && Data[1] == 0x00 &&
+      Data[2] == 0x01 && (Data[3] & 0xf0) == 0xe0)
+  {
+      // PES data
+      char *buf;
+      int i = 0;
+      int blen = 0;
+
+      buf = (char *) malloc(Length);
+      if (!buf)
+          return;
+	       
+      while (i < Length-4)
+      {
+          if (Data[i] == 0x00 && Data[i+1] == 0x00 && 
+              Data[i+2] == 0x01 && (Data[i+3] & 0xf0) == 0xe0)
+          {
+              // skip PES header
+              int offs = i+6;
+              int len = Data[i+4]*256 + Data[i+5];
+
+              // skip header extension
+              if ((Data[i+6] & 0xc0) == 0x80)
+              {
+                  offs += 3;
+                  offs += Data[i+8];
+                  len -= 3;
+                  len -= Data[i+8];
+              }
+
+              memcpy (&buf[blen], &Data[offs], len);
+
+              i = offs+len;
+              blen += len;
+          }
+          else
+              i++;
+      }
+
+      video_still_picture sp = { buf, blen };
+      CHECK(ioctl(fd_video, VIDEO_STILLPICTURE, &sp));
+
+      free(buf);
+  }
+  else
+  {
+      // non-PES data
+      video_still_picture sp = { (char *)Data, Length };
+      CHECK(ioctl(fd_video, VIDEO_STILLPICTURE, &sp));
+  }
+
 #else
 #define MIN_IFRAME 400000
   for (int i = MIN_IFRAME / Length + 1; i > 0; i--) {
---------------------------------------------------------------------

Oliver


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



Home | Main Index | Thread Index