FreeBSD compatibility (#435)

Modified Files:
	Makefile common.h libdvbmpeg/ctools.c server/connectionVTP.c
	tools/socket.c
This commit is contained in:
schmirl 2008-03-12 09:36:27 +00:00
parent eb6fbd3bbe
commit efeac825cc
5 changed files with 44 additions and 6 deletions

View File

@ -1,7 +1,7 @@
#
# Makefile for a Video Disk Recorder plugin
#
# $Id: Makefile,v 1.9 2008/02/11 16:13:46 schmirl Exp $
# $Id: Makefile,v 1.10 2008/03/12 09:36:27 schmirl Exp $
# The official name of this plugin.
# This name will be used in the '-P...' option of VDR to load the plugin.
@ -116,7 +116,7 @@ endif
### Targets:
libdvbmpeg/libdvbmpegtools.a: libdvbmpeg/*.c libdvbmpeg/*.cc libdvbmpeg/*.h libdvbmpeg/*.hh
make -C ./libdvbmpeg libdvbmpegtools.a
$(MAKE) -C ./libdvbmpeg libdvbmpegtools.a
libvdr-$(PLUGIN)-client.so: $(CLIENTOBJS) $(COMMONOBJS) libdvbmpeg/libdvbmpegtools.a
@ -136,4 +136,4 @@ dist: clean
clean:
@-rm -f $(COMMONOBJS) $(CLIENTOBJS) $(SERVEROBJS) $(DEPFILE) *.so *.tgz core* *~
make -C ./libdvbmpeg clean
$(MAKE) -C ./libdvbmpeg clean

View File

@ -1,10 +1,16 @@
/*
* $Id: common.h,v 1.8 2007/04/24 10:50:13 schmirl Exp $
* $Id: common.h,v 1.9 2008/03/12 09:36:27 schmirl Exp $
*/
#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 <vdr/tools.h>
#include <vdr/plugin.h>

View File

@ -2060,7 +2060,11 @@ void split_mpg(char *name, uint64_t size)
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 @@ void split_mpg(char *name, uint64_t size)
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 @@ void split_mpg(char *name, uint64_t size)
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 @@ void cut_mpg(char *name, uint64_t size)
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 @@ void cut_mpg(char *name, uint64_t size)
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 @@ void cut_mpg(char *name, uint64_t size)
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);

View File

@ -1,5 +1,5 @@
/*
* $Id: connectionVTP.c,v 1.15 2007/09/21 12:45:31 schmirl Exp $
* $Id: connectionVTP.c,v 1.16 2008/03/12 09:36:27 schmirl Exp $
*/
#include "server/connectionVTP.h"
@ -186,7 +186,11 @@ bool cLSTEHandler::Next(bool &Last)
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 @@ bool cLSTEHandler::Next(bool &Last)
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;

View File

@ -153,5 +153,5 @@ bool cTBSocket::Shutdown(int how) {
bool cTBSocket::SetDSCP(void) {
int dscp = STREAMDEV_DSCP;
return ::setsockopt(*this, SOL_IP, IP_TOS, &dscp, sizeof(dscp)) != -1;
return ::setsockopt(*this, IPPROTO_IP, IP_TOS, &dscp, sizeof(dscp)) != -1;
}