Analogtv-plugin

Aus VDR Wiki
Wechseln zu: Navigation, Suche

Inhaltsverzeichnis

Beschreibung

Autor: Andreas Kool

Mit diesem Plugin ist es möglich, analoges TV mit VDR zu benutzen. Die Ausgabe erfolgt über das DVB-Ausgabegerät, d.h. das Plugin verhält sich dem VDR gegenüber wie eine Budget-DVB-Karte.

Unterstützt werden analoge TV-Karten (mit und ohne Hardware-MPEG-encoder) und Video-Grabber Karten, es kann also vom analogen TV-Tuner, Videorekorder o.ä. angeschaut und aufgezeichnet werden.

Bilder

Einstellungen

Hardwareanforderungen

  • Man benötigt eine Analog-TV-Karte. Diese Karte muss entweder vom bttv Treiber, dem ivtv Treiber oder dem pvrusb2 Treiber unterstützt werden.
  • Weiterhin ist ein Realtime MPEG-Encoder nötig, entweder in Hardware, s.h. Hauppauge PVR250/350/PVR USB2, oder als Software (s.u.).

Softwareanforderungen

  • Wenn kein Hardware-MPEG-Encoder mit linux-Treiberunterstützung auf der TV-Karte drauf ist, ist ein Software-Encoder nötig. Idealerweise mp1e oder ffmpeg.
  • Bei PVR 250/350 neuesten Treiber von ivtvdriver.org. Beim Laden sicherstellen, dass ivtv vor den dvb Treibern geladen wird oder aber die channels.conf entsprechend angepaßt wird.
  • libdvb
  • Video4Linux2 (v4l2) (entfällt für PVR Karten)
  • ALSA (entfällt für PVR Karten)

Installation

cd $SOURCEDIR
tar xvzf libdvb-<VERSION>.tar.gz
cd libdvb-<VERSION>
make
make install
ldconfig

Plugin ist zu patchen (damit erspart man sich das Patchen der libdvb wie im Plugin-README eigentlich beschrieben).

--- VDR.org/PLUGINS/src/analogtv-0.9.37/player-analogtv.c	2005-07-07 16:32:50.000000000 +0200
+++ VDR/PLUGINS/src/analogtv-0.9.37/player-analogtv.c	2005-07-07 16:36:30.000000000 +0200
@@ -28,7 +28,6 @@
 #include <sys/soundcard.h>

 #include <transform.h>
-extern void pes_in_ts(p2p *p);
 #undef MIN
 #undef MAX

@@ -828,7 +827,7 @@
                 pes++;
                 spes += r;
 
-                get_pes(buffer, r, &p2t, pes_in_ts); // PES -> TS
+                kpes_to_ts(&p2t, buffer, r);
               }
             }
           }
@@ -937,7 +936,7 @@
       spes += r;

       if (r > 0)
-        get_pes(buffer, r, &p2t, pes_in_ts); // PES -> TS
+        kpes_to_ts(&p2t, buffer, r); // PES -> TS
     }
   }

Der Rest der Installation folgt der README und README.de des Plugins. Hinweis: Für ivtv > 0.1.9 muss VPID=301, APID=300 in der channels.conf verwendet werden.

Ein Grundgerüst für eine analoge channels.conf findet sich hier.


Probleme

diff -ur analogtv-0.9.37/memcpy.c analogtv-0.9.37-new/memcpy.c
--- analogtv-0.9.37/memcpy.c    2005-01-09 19:16:09.000000000 +0100
+++ analogtv-0.9.37-new/memcpy.c        2005-11-14 22:17:22.000000000 +0100
@@ -211,8 +211,8 @@
         "movntps %%xmm2, 32(%1)\n"
         "movntps %%xmm3, 48(%1)\n"
         :: "r" (from), "r" (to) : "memory");
-        ((const unsigned char *)from)+=64;
-        ((unsigned char *)to)+=64;
+        from=((const unsigned char*)from)+64;
+        to=((unsigned char *)to)+64;
       }
     else
       /*
@@ -233,8 +233,8 @@
         "movntps %%xmm2, 32(%1)\n"
         "movntps %%xmm3, 48(%1)\n"
         :: "r" (from), "r" (to) : "memory");
-        ((const unsigned char *)from)+=64;
-        ((unsigned char *)to)+=64;
+        from=((const unsigned char *)from)+64;
+        to=((unsigned char *)to)+64;
       }
     /* since movntq is weakly-ordered, a "sfence"
      * is needed to become ordered again. */
@@ -288,8 +288,8 @@
       "movq %%mm6, 48(%1)\n"
       "movq %%mm7, 56(%1)\n"
       :: "r" (from), "r" (to) : "memory");
-      ((const unsigned char *)from)+=64;
-      ((unsigned char *)to)+=64;
+      from=((const unsigned char *)from)+64;
+      to=((unsigned char *)to)+64;
     }
     __asm__ __volatile__ ("emms":::"memory");
   }
@@ -349,8 +349,8 @@
       "movntq %%mm6, 48(%1)\n"
       "movntq %%mm7, 56(%1)\n"
       :: "r" (from), "r" (to) : "memory");
-      ((const unsigned char *)from)+=64;
-      ((unsigned char *)to)+=64;
+      from=((const unsigned char *)from)+64;
+      to=((unsigned char *)to)+64;
     }
      /* since movntq is weakly-ordered, a "sfence"
      * is needed to become ordered again. */
  • Klasse cDevice unbekannt bei Einsatz eines aktuellen VDR 1.3.x: Abhilfe bringt folgender Patch:
diff -ur analogtv-0.9.37/device.h analogtv-0.9.37-new/device.h
--- analogtv-0.9.37/device.h    2005-01-09 19:16:08.000000000 +0100
+++ analogtv-0.9.37-new/device.h        2005-11-14 21:26:59.000000000 +0100
@@ -14,7 +14,8 @@
 #ifndef DEVICE_H
 #define DEVICE_H

 #include <vdr/plugin.h>
+#include <vdr/device.h>

 #include "redremote.h"

  • Compilerfehler cpu_accel.c:63: error: can't find a register in class `BREG' while reloading `asm' : Abhilfe: Patch für die cpuid Funktion, damit diese sich mit -fPIC kompilieren läßt:
diff -ru analogtv-0.9.37.orig/cpu_accel.c analogtv-0.9.37/cpu_accel.c
--- analogtv-0.9.37.orig/cpu_accel.c	2005-05-13 23:49:38.000000000 +0200
+++ analogtv-0.9.37/cpu_accel.c	2005-05-13 23:57:49.000000000 +0200
@@ -50,30 +50,44 @@
     int AMD;
     uint32_t caps;
 
+#if !defined(PIC) && !defined(__PIC__)
 #define cpuid(op,eax,ebx,ecx,edx)	\
-    asm ("cpuid"			\
+    __asm__ ("cpuid"			\
 	 : "=a" (eax),			\
 	   "=b" (ebx),			\
 	   "=c" (ecx),			\
 	   "=d" (edx)			\
 	 : "a" (op)			\
 	 : "cc")
+#else   /* PIC version : save ebx */
+#define cpuid(op,eax,ebx,ecx,edx)       \
+    __asm__ ("push %%ebx\n\t"           \
+             "cpuid\n\t"                \
+             "movl %%ebx,%1\n\t"        \
+             "pop %%ebx"                \
+             : "=a" (eax),              \
+               "=r" (ebx),              \
+               "=c" (ecx),              \
+               "=d" (edx)               \
+             : "a" (op)                 \
+             : "cc")
+#endif
 
     
-    asm ("pushfl\n\t"
-	 "pushfl\n\t"
-	 "popl %0\n\t"
-	 "movl %0,%1\n\t"
-	 "xorl $0x200000,%0\n\t"
-	 "pushl %0\n\t"
-	 "popfl\n\t"
-	 "pushfl\n\t"
-	 "popl %0\n\t"
-	 "popfl"
-         : "=a" (eax),
-	   "=b" (ebx)
-	 :
-	 : "cc");
+   __asm__ ("pushf\n\t"
+             "pushf\n\t"
+             "pop %0\n\t"
+             "movl %0,%1\n\t"
+             "xorl $0x200000,%0\n\t"
+             "push %0\n\t"
+             "popf\n\t"
+             "pushf\n\t"
+             "pop %0\n\t"
+             "popf"
+             : "=r" (eax),
+               "=r" (ebx)
+             :
+             : "cc");
 
     if (eax == ebx)		/* no cpuid */
       return 0; 
  • Compilerfehler: cpuinfo.c:72: error: PIC register ‘%ebx’ clobbered in ‘asm’
    • Abhilfe: Der folgende patch, oder Deaktivieren der kompletten Routinen durch Deaktiveren von HAVE_FAST_MEMCPY im Makefile
diff -uprN new/cpuinfo.c orig/cpuinfo.c
--- new/cpuinfo.c	2005-12-11 14:22:27.000000000 +0100
+++ orig/cpuinfo.c	2005-12-11 14:10:21.000000000 +0100
@@ -62,18 +62,15 @@ typedef struct cpuid_regs {
     unsigned int edx;
 } cpuid_regs_t;
 
-static cpuid_regs_t
-cpuid(int func) {
-	cpuid_regs_t regs;
-#define	CPUID	".byte 0x0f, 0xa2; "
-	asm("push %%ebx; "
-	    "movl %4,%%eax; " CPUID
-	    "movl %%eax,%0; movl %%ebx,%1; movl %%ecx,%2; movl %%edx,%3; "
-	    "pop %%ebx"
-		: "=m" (regs.eax), "=m" (regs.ebx), "=m" (regs.ecx), "=m" (regs.edx)
-		: "g" (func)
-		: "%eax", "%ecx", "%edx");
-	return regs;
+static cpuid_regs_t cpuid( int func ) {
+    cpuid_regs_t regs;
+#define CPUID ".byte 0x0f, 0xa2; "
+    asm("movl %4,%%eax; " CPUID
+        "movl %%eax,%0; movl %%ebx,%1; movl %%ecx,%2; movl %%edx,%3"
+            : "=m" (regs.eax), "=m" (regs.ebx), "=m" (regs.ecx), "=m" (regs.edx)
+            : "g" (func)
+            : "%eax", "%ebx", "%ecx", "%edx");
+    return regs;
 }
 
 #define X86_VENDOR_INTEL 0
diff -uprN new/memcpy.c orig/memcpy.c
--- new/memcpy.c	2005-12-11 14:03:54.000000000 +0100
+++ orig/memcpy.c	2005-12-11 14:10:21.000000000 +0100
@@ -168,11 +168,9 @@ int d0, d1, d2;
 /* SSE note: i tried to move 128 bytes a time instead of 64 but it
 didn't make any measureable difference. i'm using 64 for the sake of
 simplicity. [MF] */
-static void * sse_memcpy(void * into, const void * infrom, size_t len)
+static void * sse_memcpy(void * to, const void * from, size_t len)
 {
   void *retval;
-  unsigned char* to=(unsigned char*)into;
-  unsigned char* from=(unsigned char*)infrom;
   size_t i;
   retval = to;
     
@@ -213,8 +211,8 @@ static void * sse_memcpy(void * into, co
         "movntps %%xmm2, 32(%1)\n"
         "movntps %%xmm3, 48(%1)\n"
         :: "r" (from), "r" (to) : "memory");
-        *from+=64;
-        *to+=64;
+        ((const unsigned char *)from)+=64;
+        ((unsigned char *)to)+=64;
       }
     else 
       /*
@@ -235,8 +233,8 @@ static void * sse_memcpy(void * into, co
         "movntps %%xmm2, 32(%1)\n"
         "movntps %%xmm3, 48(%1)\n"
         :: "r" (from), "r" (to) : "memory");
-        *from+=64;
-        *to+=64;
+        ((const unsigned char *)from)+=64;
+        ((unsigned char *)to)+=64;
       }
     /* since movntq is weakly-ordered, a "sfence"
      * is needed to become ordered again. */
@@ -251,11 +249,9 @@ static void * sse_memcpy(void * into, co
   return retval;
 }
 
-static void * mmx_memcpy(void * into, const void * infrom, size_t len)
+static void * mmx_memcpy(void * to, const void * from, size_t len)
 {
   void *retval;
-  unsigned char* to=(unsigned char*)into;
-  unsigned char* from=(unsigned char*)infrom;
   size_t i;
   retval = to;
 
@@ -292,8 +288,8 @@ static void * mmx_memcpy(void * into, co
       "movq %%mm6, 48(%1)\n"
       "movq %%mm7, 56(%1)\n"
       :: "r" (from), "r" (to) : "memory");
-      *from+=64;
-      *to+=64;
+      ((const unsigned char *)from)+=64;
+      ((unsigned char *)to)+=64;
     }
     __asm__ __volatile__ ("emms":::"memory");
   }
@@ -304,11 +300,9 @@ static void * mmx_memcpy(void * into, co
   return retval;
 }
 
-void * mmx2_memcpy(void * into, const void * infrom, size_t len)
+void * mmx2_memcpy(void * to, const void * from, size_t len)
 {
   void *retval;
-  unsigned char* to=(unsigned char*)into;
-  unsigned char* from=(unsigned char*)infrom;
   size_t i;
   retval = to;
 
@@ -355,8 +349,8 @@ void * mmx2_memcpy(void * into, const vo
       "movntq %%mm6, 48(%1)\n"
       "movntq %%mm7, 56(%1)\n"
       :: "r" (from), "r" (to) : "memory");
-      *from+=64;
-      *to+=64;
+      ((const unsigned char *)from)+=64;
+      ((unsigned char *)to)+=64;
     }
      /* since movntq is weakly-ordered, a "sfence"
      * is needed to become ordered again. */


Snapshot

cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/vdr-analogtv login
cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/vdr-analogtv co analogtv

Links

[1] http://www.akool.homepage.t-online.de/index.html Homepage des Plugins
[2] http://sourceforge.net/projects/vdr-analogtv Projektseite auf Sourceforge
[3] http://www.ivtvdriver.org/index.php/Main_Page neue IVTV Treiber
[4] http://www.metzlerbros.org/dvb/index.html Libdvb
[5] Kanalliste Pal Zuordnung Kanal-Frequenz
[6] http://ivtv.writeme.ch IVTV Wiki
[7] channels.conf analog Grundgerüst analoge channels.conf
In anderen Sprachen