Mailing List archive

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

[vdr] Re: Playing DVD ?



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:
---------------------------------------------------------------------
--- 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] & 0xe0) == 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] & 0xe0) == 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--) {
---------------------------------------------------------------------

The patch removes all PES headers and passes ES to the driver.
It should work with CVS drivers 2003-08-23 or later.

For driver release 1.0.0 the following patch is required:
---------------------------------------------------------------------
--- /tmp/linuxtv-dvb-1.0.0/driver/av7110/av7110.c	Tue Jul 22 17:13:18 2003
+++ av7110.c	Sat Aug 30 03:20:26 2003
@@ -4241,9 +4241,10 @@ play_iframe(av7110_t *av7110, u8 *buf, u
                 if (AV_StartPlay(av7110, RP_VIDEO) < 0) {
 			return -EBUSY;
 		}
-                n=MIN_IFRAME/len+1;
         }
 
+        n=MIN_IFRAME/len+1;
+
 	/* FIXME: nonblock? */
 	dvb_play(av7110, iframe_header, sizeof(iframe_header), 0, 1, 0);
 
---------------------------------------------------------------------
 
Have fun,

Oliver


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



Home | Main Index | Thread Index