Mailing List archive

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

[vdr] Re: Re : VDR files to vob



On Monday 15 July 2002 17:38, Andreas Schultz wrote:

[...]

> The attached patch against vdr-1.1.4 crudly adds the PS header before

ok, forgot that attaching doesn't work, so lets try it again:

===== remux.c 1.2 vs edited =====
--- 1.2/remux.c	Mon May 13 20:31:38 2002
+++ edited/remux.c	Mon Jul 15 16:56:40 2002
@@ -105,7 +105,7 @@
 #define MAX_PLENGTH 0xFFFF
 #define MMAX_PLENGTH (4*MAX_PLENGTH)
 
-#define IPACKS 2048
+#define IPACKS 2034
 
 // Start codes:
 #define SC_PICTURE 0x00  // "picture header"
===== recorder.c 1.1 vs edited =====
--- 1.1/recorder.c	Sat Jun 22 18:45:47 2002
+++ edited/recorder.c	Mon Jul 15 17:27:02 2002
@@ -110,9 +110,21 @@
 {
   dsyslog("recording thread started (pid=%d)", getpid());
 
+  uint8_t PSheadr[] = {
+      0x00, 0x00, 0x01, 0xba,              // packet start code- PES packet
+      0x44, 0x00, 0x04, 0x04, 0x94, 0xab,  // SCR
+      0x01, 0x89, 0xc3,                    // MUX rate
+      0xf8                                 // stuffing length
+  };
+
+  uint8_t pktzero[2048];
+  
   uchar b[MINVIDEODATA];
   int r = 0;
+  int rest = 0;
   active = true;
+  memset(pktzero, 0, sizeof(pktzero));
+  
   while (active) {
         int g = ringBuffer->Get(b + r, sizeof(b) - r);
         if (g > 0)
@@ -127,11 +139,21 @@
               if (NextFile()) {
                  if (index && pictureType != NO_PICTURE)
                     index->Write(pictureType, fileName->Number(), fileSize);
+                 if (safe_write(recordFile, PSheadr, sizeof(PSheadr)) < 0) {
+                    LOG_ERROR_STR(fileName->Name());
+                    break;
+                    }
                  if (safe_write(recordFile, p, Result) < 0) {
                     LOG_ERROR_STR(fileName->Name());
                     break;
                     }
-                 fileSize += Result;
+		 if ((rest = 2034 - Result) > 0) {
+		     if (safe_write(recordFile, pktzero, rest) < 0) {
+			 LOG_ERROR_STR(fileName->Name());
+			 break;
+		     }
+		 }
+                 fileSize += 2048;
                  }
               else
                  break;

-- 
Andreas Schultz <aschultz@cs.uni-magdeburg.de>
Student of computer science

"In accordance with plans for Linux OS world domination
      infiltration of governments is vital (:-))."




Home | Main Index | Thread Index