From patchwork Thu Mar 6 18:49:29 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Pulz X-Patchwork-Id: 12622 Received: from mailhost.frm2.tum.de ([129.187.179.12]) by www.linuxtv.org with esmtp (Exim 4.63) (envelope-from ) id 1JXLAB-0000CI-5L for vdr@linuxtv.org; Thu, 06 Mar 2008 19:50:00 +0100 Received: from localhost (mailhost.frm2.tum.de [129.187.179.12]) by mailhost.frm2.tum.de (8.13.8/8.13.8) with ESMTP id m26InpCY023083 for ; Thu, 6 Mar 2008 19:49:51 +0100 (CET) (envelope-from Joerg.Pulz@frm2.tum.de) X-Virus-Scanned: at mailhost.frm2.tum.de Received: from hades.admin.frm2 (hades.admin.frm2 [172.25.1.10]) (authenticated bits=0) by mailhost.frm2.tum.de (8.13.8/8.13.8) with ESMTP id m26InWkV023059 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Thu, 6 Mar 2008 19:49:32 +0100 (CET) (envelope-from Joerg.Pulz@frm2.tum.de) Date: Thu, 6 Mar 2008 19:49:29 +0100 (CET) From: Joerg Pulz To: vdr@linuxtv.org Message-ID: <20080306191453.B44873@unqrf.nqzva.sez2> MIME-Version: 1.0 X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-3.0 (mailhost.frm2.tum.de [129.187.179.12]); Thu, 06 Mar 2008 19:49:32 +0100 (CET) X-LSpam-Score: 0.0 (/) Subject: [vdr] portability or VDR on FreeBSD X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.9 Precedence: list Reply-To: VDR Mailing List List-Id: VDR Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Mar 2008 18:50:00 -0000 Status: O X-Status: X-Keywords: X-UID: 15998 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello list. As the subject already says, this is about VDR portability, or how to get VDR up and running on a FreeBSD system. In times where we have such really nice plugins like softdevice and streamdev, we no longer need real MPEG2 or DVB hardware in a VDR system. As i want to use my FreeBSD systems to watch TV or play VDR recordings i decided to give porting VDR to FreeBSD a try. Attached you can find the results. In short terms: It simply works! The only missing feature right now is, starting VDR as root and switching to another user (-u command line option). For now it is possible to watch any recording made by a VDR with real hardware if the video directory is directly accessible over the network (mountable by the client) or the use the streamdev plugin to stream VDR to VDR. All tests where done using a Linux system with two FF-DVB-S devices, streamdev-server plugin and NFS exported video directory plus a wired and a wireless FreeBSD-7.0 client running VDR with streamdev-client and softdevice plugin. As far as i could test the whole setup until now, everything works the same way on FreeBSD as it does under Linux and i now have real channel-hopping. The patches are made in a way that a patched VDR will still compile under Linux. Every modification, to the source or to the Makefiles is ifdef'd out. So unless you say you want to compile VDR for FreeBSD you have an unmodified version of source. In case the ML software strips the attachments, the files are also available for download at: ftp://ftp.frm2.tum.de/pub/jpulz/VDR/ Thoughts or comments from others are welcome. regards Joerg - -- The beginning is the most important part of the work. -Plato -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4 (FreeBSD) iD8DBQFH0Dy8SPOsGF+KA+MRAmVBAJ9Tzfxg0zWNN/fEX8vfeMOW2muvSACgivha raTzC4R92jZ+Petp9Mqwr9E= =f08n -----END PGP SIGNATURE----- diff -ur streamdev-20070921.orig/Makefile streamdev-20070921/Makefile --- streamdev-20070921.orig/Makefile 2007-09-21 13:18:40.000000000 +0200 +++ streamdev-20070921/Makefile 2008-03-06 19:12:39.000000000 +0100 @@ -86,7 +86,11 @@ endif libdvbmpeg/libdvbmpegtools.a: libdvbmpeg/*.c libdvbmpeg/*.cc libdvbmpeg/*.h libdvbmpeg/*.hh +ifdef FREEBSD + gmake -C ./libdvbmpeg libdvbmpegtools.a FREEBSD=1 +else make -C ./libdvbmpeg libdvbmpegtools.a +endif ### Implicit rules: @@ -132,4 +136,8 @@ clean: @-rm -f $(COMMONOBJS) $(CLIENTOBJS) $(SERVEROBJS) $(DEPFILE) *.so *.tgz core* *~ +ifdef FREEBSD + gmake -C ./libdvbmpeg clean FREEBSD=1 +else make -C ./libdvbmpeg clean +endif diff -ur streamdev-20070921.orig/common.h streamdev-20070921/common.h --- streamdev-20070921.orig/common.h 2007-09-21 13:18:40.000000000 +0200 +++ streamdev-20070921/common.h 2008-03-06 19:13:28.000000000 +0100 @@ -5,6 +5,12 @@ #ifndef VDR_STREAMDEV_COMMON_H #define VDR_STREAMDEV_COMMON_H +/* FreeBSD has it's own version of isnumber(), + but VDR's version is incompatible */ +#ifdef FreeBSD +#undef isnumber +#endif + #include #include diff -ur streamdev-20070921.orig/libdvbmpeg/Makefile streamdev-20070921/libdvbmpeg/Makefile --- streamdev-20070921.orig/libdvbmpeg/Makefile 2005-02-08 16:21:19.000000000 +0100 +++ streamdev-20070921/libdvbmpeg/Makefile 2008-03-06 18:38:38.000000000 +0100 @@ -5,6 +5,9 @@ SRC = $(wildcard *.c) CPPSRC = $(wildcard *.cpp) CSRC = $(wildcard *.cc) +ifdef FREEBSD +DEFINES += -DFreeBSD +endif DESTDIR = /usr/local diff -ur streamdev-20070921.orig/libdvbmpeg/ctools.c streamdev-20070921/libdvbmpeg/ctools.c --- streamdev-20070921.orig/libdvbmpeg/ctools.c 2007-03-19 13:05:25.000000000 +0100 +++ streamdev-20070921/libdvbmpeg/ctools.c 2008-03-06 18:29:52.000000000 +0100 @@ -2060,7 +2060,11 @@ if (break_up_filename(name,base_name,path,ext) < 0) exit(1); +#ifdef FreeBSD + if ( (fdin = open(name, O_RDONLY)) < 0){ +#else if ( (fdin = open(name, O_RDONLY|O_LARGEFILE)) < 0){ +#endif fprintf(stderr,"Can't open %s\n",name); exit(1); } @@ -2101,8 +2105,12 @@ sprintf(new_name,"%s-%03d.%s",base_name,i,ext); printf("writing %s\n",new_name); +#ifdef FreeBSD + if ( (fdout = open(new_name,O_WRONLY|O_CREAT|O_TRUNC, +#else if ( (fdout = open(new_name,O_WRONLY|O_CREAT|O_TRUNC |O_LARGEFILE, +#endif S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP| S_IROTH|S_IWOTH)) < 0){ fprintf(stderr,"Can't open %s\n",new_name); @@ -2114,8 +2122,12 @@ sprintf(new_name,"%s-%03d.%s",base_name,i,ext); printf("writing %s\n",new_name); +#ifdef FreeBSD + if ( (fdout = open(new_name,O_WRONLY|O_CREAT|O_TRUNC, +#else if ( (fdout = open(new_name,O_WRONLY|O_CREAT|O_TRUNC |O_LARGEFILE, +#endif S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP| S_IROTH|S_IWOTH)) < 0){ fprintf(stderr,"Can't open %s\n",new_name); @@ -2144,7 +2156,11 @@ if (break_up_filename(name,base_name,path,ext) < 0) exit(1); +#ifdef FreeBSD + if ( (fdin = open(name, O_RDONLY)) < 0){ +#else if ( (fdin = open(name, O_RDONLY|O_LARGEFILE)) < 0){ +#endif fprintf(stderr,"Can't open %s\n",name); exit(1); } @@ -2182,8 +2198,12 @@ sprintf(new_name,"%s-1.%s",base_name,ext); printf("writing %s\n",new_name); +#ifdef FreeBSD + if ( (fdout = open(new_name,O_WRONLY|O_CREAT|O_TRUNC, +#else if ( (fdout = open(new_name,O_WRONLY|O_CREAT|O_TRUNC |O_LARGEFILE, +#endif S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP| S_IROTH|S_IWOTH)) < 0){ fprintf(stderr,"Can't open %s\n",new_name); @@ -2195,8 +2215,12 @@ sprintf(new_name,"%s-2.%s",base_name,ext); printf("writing %s\n",new_name); +#ifdef FreeBSD + if ( (fdout = open(new_name,O_WRONLY|O_CREAT|O_TRUNC, +#else if ( (fdout = open(new_name,O_WRONLY|O_CREAT|O_TRUNC |O_LARGEFILE, +#endif S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP| S_IROTH|S_IWOTH)) < 0){ fprintf(stderr,"Can't open %s\n",new_name); diff -ur streamdev-20070921.orig/server/connectionVTP.c streamdev-20070921/server/connectionVTP.c --- streamdev-20070921.orig/server/connectionVTP.c 2007-09-21 14:46:33.000000000 +0200 +++ streamdev-20070921/server/connectionVTP.c 2008-03-06 19:05:45.000000000 +0100 @@ -186,7 +186,11 @@ case Event: if (m_Event != NULL) { m_State = Title; +#ifdef FreeBSD + return m_Client->Respond(-215, "E %u %d %d %X", m_Event->EventID(), +#else return m_Client->Respond(-215, "E %u %ld %d %X", m_Event->EventID(), +#endif m_Event->StartTime(), m_Event->Duration(), m_Event->TableID()); } else { @@ -225,7 +229,11 @@ case Vps: m_State = EndEvent; if (m_Event->Vps()) +#ifdef FreeBSD + return m_Client->Respond(-215, "V %d", m_Event->Vps()); +#else return m_Client->Respond(-215, "V %ld", m_Event->Vps()); +#endif else return Next(Last); break; diff -ur streamdev-20070921.orig/tools/socket.c streamdev-20070921/tools/socket.c --- streamdev-20070921.orig/tools/socket.c 2007-09-21 13:18:42.000000000 +0200 +++ streamdev-20070921/tools/socket.c 2008-03-06 18:24:27.000000000 +0100 @@ -153,5 +153,9 @@ bool cTBSocket::SetDSCP(void) { int dscp = STREAMDEV_DSCP; +#ifdef FreeBSD + return ::setsockopt(*this, IPPROTO_IP, IP_TOS, &dscp, sizeof(dscp)) != -1; +#else return ::setsockopt(*this, SOL_IP, IP_TOS, &dscp, sizeof(dscp)) != -1; +#endif }