Mailing List archive

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

[vdr] Re: Playing DVD ?



Oliver Endriss wrote:
> 
> 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:
> > ...

Looks pretty good!

Normal still pictures from VDR's recordings appear to work fine
(e.g. when moving or jumping between editing marks), and also
DVD navigation works a lot better, at least for the DVDs I have
been able to test with. There are still cases where a still menu
picture isn't displayed correctly, but the vast majority works
now :-)

I've taken the liberty to format the patch to the VDR coding style,
so here it is again, in the way I'll adopt it in VDR 1.2.5 (I hope
I didn't break anything in the process):

--- dvbdevice.c 2003/08/24 14:23:12     1.62
+++ dvbdevice.c 2003/08/30 11:40:41
@@ -896,11 +896,49 @@
    If anybody ever finds out what could be changed so that VIDEO_STILLPICTURE
    could be used, please let me know!
    kls 2002-03-23
+   2003-08-30: apparently the driver can't handle PES data, so Oliver Endriss
+               <o.endriss@gmx.de> has changed this to strip all PES headers
+               and send pure ES data to the driver. Seems to work just fine!
+               Let's drop the VIDEO_STILLPICTURE_WORKS_WITH_VDR_FRAMES stuff
+               once this has proven to work in all cases.
 */
-//#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 = MALLOC(char, Length);
+     if (!buf)
+        return;
+     int i = 0;
+     int blen = 0;
+     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--) {



Klaus


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



Home | Main Index | Thread Index