Mailing List archive

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

[vdr] Re: VDR 1.3.18 Problems with converted ts streams



Klaus Schmidinger wrote:
HGM.bg (GMX) wrote:

Klaus Schmidinger wrote:


HGM.bg (GMX) wrote:


Due to missing recording capacity, i'm doing recordings with my dbox2
via nfs. These are ts-mpegs which i'm converting with Project X into
the vdr-format.
/hgm.bg

The VDR recording format hasn't been changed lately.

However, what did change is the way VDR actually handles PES packets
when replaying them. Maybe that's causing your problems, although I
can't imagine why...


But it's definitly a big difference, may i send you a short piece of
such a converted file, so you can check on your own ? This is definitly
a reason to stay with 1.3.17.

Maybe you could make some 10MB of data available for download somewhere?

Klaus
The attached patch fixes this.

Apparently cDvbDevice::PlayVideo() didn't behave as requested (either
play the entire data block or nothing at all). Since VDR's own PES packets
are always <=2084 byte and the driver apparently accepts such packets either
entirely or not at all, this didn't matter for files recorded with VDR.
However, in your file the video PES packets were larger than 2048 byte.

Klaus
--- dvbdevice.c	2005/01/14 14:00:44	1.114
+++ dvbdevice.c	2005/01/16 11:36:47
@@ -1130,12 +1130,12 @@
 
 int cDvbDevice::PlayVideo(const uchar *Data, int Length)
 {
-  return write(fd_video, Data, Length);
+  return WriteAllOrNothing(fd_video, Data, Length, 1000, 10);
 }
 
 int cDvbDevice::PlayAudio(const uchar *Data, int Length)
 {
-  return write(fd_audio, Data, Length);
+  return WriteAllOrNothing(fd_audio, Data, Length, 1000, 10);
 }
 
 bool cDvbDevice::OpenDvr(void)
--- tools.h	2005/01/04 11:09:51	1.64
+++ tools.h	2005/01/16 11:39:58
@@ -71,6 +71,10 @@
 ssize_t safe_read(int filedes, void *buffer, size_t size);
 ssize_t safe_write(int filedes, const void *buffer, size_t size);
 void writechar(int filedes, char c);
+int WriteAllOrNothing(int fd, const uchar *Data, int Length, int TimeoutMs = 0, int RetryMs = 0);
+    ///< Writes either all Data to the given file descriptor, or nothing at all.
+    ///< If TimeoutMs is greater than 0, it will only retry for that long, otherwise
+    ///< it will retry forever. RetryMs defines the time between two retries.
 char *strcpyrealloc(char *dest, const char *src);
 char *strn0cpy(char *dest, const char *src, size_t n);
 char *strreplace(char *s, char c1, char c2);
--- tools.c	2005/01/04 11:06:45	1.87
+++ tools.c	2005/01/16 11:47:44
@@ -65,6 +65,30 @@
   safe_write(filedes, &c, sizeof(c));
 }
 
+int WriteAllOrNothing(int fd, const uchar *Data, int Length, int TimeoutMs, int RetryMs)
+{
+  int written = 0;
+  while (Length > 0) {
+        int w = write(fd, Data + written, Length);
+        if (w > 0) {
+           Length -= w;
+           written += w;
+           }
+        else if (written > 0 && !FATALERRNO) {
+           // we've started writing, so we must finish it!
+           cTimeMs t;
+           cPoller Poller(fd, true);
+           Poller.Poll(RetryMs);
+           if (TimeoutMs > 0 && (TimeoutMs -= t.Elapsed()) <= 0)
+              break;
+           }
+        else
+           // nothing written yet (or fatal error), so we can just return the error code:
+           return w;
+        }
+  return written;
+}
+
 char *strcpyrealloc(char *dest, const char *src)
 {
   if (src) {

Home | Main Index | Thread Index