From c465997b6da112f817f30a0d3ed94bc00c31008f Mon Sep 17 00:00:00 2001 From: woodsb02 Date: Tue, 10 May 2016 15:35:19 +0000 Subject: multimedia/vdr-plugin-markad: Fix build with ffmpeg 3.0.x - Update patch of command/decoder.cpp to allow vdr-plugin-markad to build successfully once multimedia/ffmpeg is updated to 3.0.x. Note that multimedia/ffmpeg is currently still on the 2.8.x branch, however this patch is backwards compatible with ffmpeg 2.8.x. The additional changes to this file were based on upstream bug report #1898 [1], and also the requirement to replace s/avcodec_alloc_frame/av_frame_alloc/g. - Regenerate patches with makepatch (pet portlint), and remove PATCH_STRIP=-p1 from Makefile. [1] https://projects.vdr-developer.org/issues/1898 PR: 209386 Reported by: antoine (PR207547) Reviewed by: mat (mentor) Approved by: adamw (mentor) Differential Revision: https://reviews.freebsd.org/D6283 --- multimedia/vdr-plugin-markad/Makefile | 1 - multimedia/vdr-plugin-markad/files/patch-Makefile | 4 +- .../vdr-plugin-markad/files/patch-command-Makefile | 48 ------ .../files/patch-command-decoder.cpp | 36 ----- .../files/patch-command-decoder.cpp-ffmpeg1 | 11 -- .../files/patch-command-markad-standalone.cpp | 138 ----------------- .../vdr-plugin-markad/files/patch-command_Makefile | 48 ++++++ .../files/patch-command_decoder.cpp | 165 +++++++++++++++++++++ .../files/patch-command_decoder.h | 10 ++ .../files/patch-command_markad-standalone.cpp | 138 +++++++++++++++++ .../vdr-plugin-markad/files/patch-plugin-Makefile | 22 --- .../files/patch-plugin-markad.cpp | 19 --- .../files/patch-plugin-status.cpp | 113 -------------- .../vdr-plugin-markad/files/patch-plugin_Makefile | 22 +++ .../files/patch-plugin_markad.cpp | 19 +++ .../files/patch-plugin_status.cpp | 113 ++++++++++++++ .../files/patch-vdr-markad-0.1.4-libav9 | 40 ----- 17 files changed, 517 insertions(+), 430 deletions(-) delete mode 100644 multimedia/vdr-plugin-markad/files/patch-command-Makefile delete mode 100644 multimedia/vdr-plugin-markad/files/patch-command-decoder.cpp delete mode 100644 multimedia/vdr-plugin-markad/files/patch-command-decoder.cpp-ffmpeg1 delete mode 100644 multimedia/vdr-plugin-markad/files/patch-command-markad-standalone.cpp create mode 100644 multimedia/vdr-plugin-markad/files/patch-command_Makefile create mode 100644 multimedia/vdr-plugin-markad/files/patch-command_decoder.cpp create mode 100644 multimedia/vdr-plugin-markad/files/patch-command_decoder.h create mode 100644 multimedia/vdr-plugin-markad/files/patch-command_markad-standalone.cpp delete mode 100644 multimedia/vdr-plugin-markad/files/patch-plugin-Makefile delete mode 100644 multimedia/vdr-plugin-markad/files/patch-plugin-markad.cpp delete mode 100644 multimedia/vdr-plugin-markad/files/patch-plugin-status.cpp create mode 100644 multimedia/vdr-plugin-markad/files/patch-plugin_Makefile create mode 100644 multimedia/vdr-plugin-markad/files/patch-plugin_markad.cpp create mode 100644 multimedia/vdr-plugin-markad/files/patch-plugin_status.cpp delete mode 100644 multimedia/vdr-plugin-markad/files/patch-vdr-markad-0.1.4-libav9 (limited to 'multimedia') diff --git a/multimedia/vdr-plugin-markad/Makefile b/multimedia/vdr-plugin-markad/Makefile index 2ab72615df76..8c9a3ff5c531 100644 --- a/multimedia/vdr-plugin-markad/Makefile +++ b/multimedia/vdr-plugin-markad/Makefile @@ -13,7 +13,6 @@ COMMENT= Video Disk Recorder - MarkAd plugin LIB_DEPENDS+= libavcodec.so:multimedia/ffmpeg USES= execinfo pkgconfig tar:tgz -PATCH_STRIP= -p1 HAVE_CONFIGURE= yes PORTDOCS= COPYING README HISTORY PORTDATA= logos diff --git a/multimedia/vdr-plugin-markad/files/patch-Makefile b/multimedia/vdr-plugin-markad/files/patch-Makefile index ea88f18e6a83..19c2fd44c3a1 100644 --- a/multimedia/vdr-plugin-markad/files/patch-Makefile +++ b/multimedia/vdr-plugin-markad/files/patch-Makefile @@ -1,5 +1,5 @@ ---- a/Makefile -+++ b/Makefile +--- Makefile.orig 2012-09-11 07:55:41 UTC ++++ Makefile @@ -13,10 +13,10 @@ ARCHIVE = markad-$(VERSION) PACKAGE = vdr-$(ARCHIVE) diff --git a/multimedia/vdr-plugin-markad/files/patch-command-Makefile b/multimedia/vdr-plugin-markad/files/patch-command-Makefile deleted file mode 100644 index a2982c81f707..000000000000 --- a/multimedia/vdr-plugin-markad/files/patch-command-Makefile +++ /dev/null @@ -1,48 +0,0 @@ ---- a/command/Makefile -+++ b/command/Makefile -@@ -16,6 +16,10 @@ CXXFLAGS ?= -g -rdynamic -O3 -funroll-lo - PKG-CONFIG ?= pkg-config - STRIP ?= strip - -+ifdef FREEBSD -+LIBS+=-lintl -lexecinfo -+endif -+ - ### Includes and Defines (add further entries here): - - PKG-LIBS += libavcodec libavutil -@@ -86,17 +90,34 @@ markad: $(OBJS) - $(CXX) $(CXXFLAGS) $(OBJS) $(LIBS) -o $@ - - -+ifdef FREEBSD -+MANDIR = $(PREFIX)/man -+else - MANDIR = $(DESTDIR)/usr/share/man -+endif - install-doc: -+ifdef FREEBSD -+ @mkdir -p ${DESTDIR}$(MANDIR)/man1 -+ @gzip -c markad.1 > ${DESTDIR}$(MANDIR)/man1/markad.1.gz -+else - @mkdir -p $(MANDIR)/man1 - @gzip -c markad.1 > $(MANDIR)/man1/markad.1.gz -+endif - - install: install-doc markad $(I18Nmsgs) -+ifdef FREEBSD -+ @mkdir -p ${DESTDIR}$(PREFIX)/bin -+ @cp -f markad ${DESTDIR}$(PREFIX)/bin/markad -+ @$(STRIP) ${DESTDIR}$(PREFIX)/bin/markad -+ @mkdir -p ${DESTDIR}$(DATADIR)/logos -+ @cp logos/* ${DESTDIR}$(DATADIR)/logos -+else - @mkdir -p $(DESTDIR)/usr/bin - @cp --remove-destination markad $(DESTDIR)/usr/bin/markad - @$(STRIP) $(DESTDIR)/usr/bin/markad - @mkdir -p $(DESTDIR)/var/lib/markad - @cp -a logos/* $(DESTDIR)/var/lib/markad -+endif - @echo markad installed - - clean: diff --git a/multimedia/vdr-plugin-markad/files/patch-command-decoder.cpp b/multimedia/vdr-plugin-markad/files/patch-command-decoder.cpp deleted file mode 100644 index d66a0b13e4f7..000000000000 --- a/multimedia/vdr-plugin-markad/files/patch-command-decoder.cpp +++ /dev/null @@ -1,36 +0,0 @@ ---- a/command/decoder.cpp -+++ b/command/decoder.cpp -@@ -6,7 +6,12 @@ - */ - - #include -+#ifndef __FreeBSD__ - #include -+#else -+#include -+#include -+#endif - #include - #include - #include -@@ -107,6 +112,7 @@ cMarkAdDecoder::cMarkAdDecoder(bool useH - noticeERRMP2=false; - noticeERRAC3=false; - -+#ifndef __FreeBSD__ - cpu_set_t cpumask; - uint len = sizeof(cpumask); - int cpucount; -@@ -118,6 +124,12 @@ cMarkAdDecoder::cMarkAdDecoder(bool useH - { - cpucount=CPU_COUNT(&cpumask); - } -+#else -+ int cpucount; -+ size_t cpus_size = sizeof(cpucount); -+ if (sysctlbyname("hw.ncpu", &cpucount, &cpus_size, NULL, 0) == -1) -+ cpucount = 1; -+#endif - - if (Threads==-1) - { diff --git a/multimedia/vdr-plugin-markad/files/patch-command-decoder.cpp-ffmpeg1 b/multimedia/vdr-plugin-markad/files/patch-command-decoder.cpp-ffmpeg1 deleted file mode 100644 index 22203237a4cd..000000000000 --- a/multimedia/vdr-plugin-markad/files/patch-command-decoder.cpp-ffmpeg1 +++ /dev/null @@ -1,11 +0,0 @@ ---- a/command/decoder.cpp -+++ b/command/decoder.cpp -@@ -164,7 +164,7 @@ cMarkAdDecoder::cMarkAdDecoder(bool useH - } - - video_codec=NULL; -- CodecID video_codecid; -+ AVCodecID video_codecid; - - if (useH264) - { diff --git a/multimedia/vdr-plugin-markad/files/patch-command-markad-standalone.cpp b/multimedia/vdr-plugin-markad/files/patch-command-markad-standalone.cpp deleted file mode 100644 index 6a2c72b5fb6c..000000000000 --- a/multimedia/vdr-plugin-markad/files/patch-command-markad-standalone.cpp +++ /dev/null @@ -1,138 +0,0 @@ ---- a/command/markad-standalone.cpp -+++ b/command/markad-standalone.cpp -@@ -24,7 +24,13 @@ - #include - #include - #include -+#ifndef __FreeBSD__ - #include -+#else -+#include -+#include -+#include -+#endif - #include - #include - #include -@@ -1428,6 +1434,7 @@ bool cMarkAdStandalone::SaveInfo() - time_t cMarkAdStandalone::GetBroadcastStart(time_t start, int fd) - { - // get broadcast start from atime of directory (if the volume is mounted with noatime) -+#ifndef __FreeBSD__ - struct mntent *ent; - struct stat statbuf; - FILE *mounts=setmntent(_PATH_MOUNTED,"r"); -@@ -1454,6 +1461,14 @@ time_t cMarkAdStandalone::GetBroadcastSt - } - } - endmntent(mounts); -+#else -+ struct stat statbuf; -+ struct statfs statfsbuf; -+ bool useatime=false; -+ if ((statfs(directory, &statfsbuf) == 0) && -+ !(statfsbuf.f_flags & MNT_NOATIME)) -+ useatime=true; -+#endif - - if ((useatime) && (stat(directory,&statbuf)!=-1)) - { -@@ -1554,6 +1569,16 @@ bool cMarkAdStandalone::LoadInfo() - if (lf) *lf=0; - char *cr=strchr(macontext.Info.ChannelName,13); - if (cr) *cr=0; -+#if 1 -+ int len = strlen(macontext.Info.ChannelName); -+ if (len > 5 && -+ (!strcmp(macontext.Info.ChannelName + len - 4, " (A)") || -+ !strcmp(macontext.Info.ChannelName + len - 4, " (C)") || -+ !strcmp(macontext.Info.ChannelName + len - 4, " (S)") || -+ !strcmp(macontext.Info.ChannelName + len - 4, " (T)") || -+ !strcmp(macontext.Info.ChannelName + len - 4, " (I)"))) -+ macontext.Info.ChannelName[len - 4] = '\0'; -+#endif - for (int i=0; i<(int) strlen(macontext.Info.ChannelName); i++) - { - if (macontext.Info.ChannelName[i]==' ') macontext.Info.ChannelName[i]='_'; -@@ -1961,10 +1986,14 @@ bool cMarkAdStandalone::CreatePidfile() - int pid; - if (fscanf(oldpid,"%10i\n",&pid)==1) - { -+#ifndef __FreeBSD__ - char procname[256]=""; - snprintf(procname,sizeof(procname),"/proc/%i",pid); - struct stat statbuf; - if (stat(procname,&statbuf)!=-1) -+#else -+ if (kill(pid, 0) == 0) -+#endif - { - // found another, running markad - fprintf(stderr,"another instance is running on %s",directory); -@@ -2081,6 +2110,7 @@ cMarkAdStandalone::cMarkAdStandalone(con - } - } - -+#ifndef __FreeBSD__ - long lb; - errno=0; - lb=sysconf(_SC_LONG_BIT); -@@ -2089,6 +2119,7 @@ cMarkAdStandalone::cMarkAdStandalone(con - isyslog("starting v%s (%libit)",VERSION,lb); - } - else -+#endif - { - isyslog("starting v%s",VERSION); - } -@@ -2319,7 +2350,7 @@ cMarkAdStandalone::~cMarkAdStandalone() - RemovePidfile(); - } - --bool isnumber(const char *s) -+bool str_isnumber(const char *s) - { - while (*s) - { -@@ -2345,7 +2376,11 @@ int usage(int svdrpport) - " ignores hints from info(.vdr) file\n" - " 4 = ignore timer info\n" - "-l --logocachedir\n" -+#ifdef DATADIR -+ " directory where logos stored, default " DATADIR "/logos\n" -+#else - " directory where logos stored, default /var/lib/markad\n" -+#endif - "-p --priority=\n" - " software priority of markad when running in background\n" - " from -20...19, default 19\n" -@@ -2489,7 +2524,11 @@ int main(int argc, char *argv[]) - config.logoHeight=-1; - config.threads=-1; - strcpy(config.svdrphost,"127.0.0.1"); -+#ifdef DATADIR -+ strcpy(config.logoDirectory,DATADIR "/logos"); -+#else - strcpy(config.logoDirectory,"/var/lib/markad"); -+#endif - - struct servent *serv=getservbyname("svdrp","tcp"); - if (serv) -@@ -2620,7 +2659,7 @@ int main(int argc, char *argv[]) - - case 'p': - // --priority -- if (isnumber(optarg) || *optarg=='-') -+ if (str_isnumber(optarg) || *optarg=='-') - niceLevel = atoi(optarg); - else - { -@@ -2806,7 +2845,7 @@ int main(int argc, char *argv[]) - break; - - case 9: // --svdrpport -- if (isnumber(optarg) && atoi(optarg) > 0 && atoi(optarg) < 65536) -+ if (str_isnumber(optarg) && atoi(optarg) > 0 && atoi(optarg) < 65536) - { - config.svdrpport=atoi(optarg); - } diff --git a/multimedia/vdr-plugin-markad/files/patch-command_Makefile b/multimedia/vdr-plugin-markad/files/patch-command_Makefile new file mode 100644 index 000000000000..d849bfda235c --- /dev/null +++ b/multimedia/vdr-plugin-markad/files/patch-command_Makefile @@ -0,0 +1,48 @@ +--- command/Makefile.orig 2012-09-11 07:54:03 UTC ++++ command/Makefile +@@ -16,6 +16,10 @@ CXXFLAGS ?= -g -rdynamic -O3 -funroll-lo + PKG-CONFIG ?= pkg-config + STRIP ?= strip + ++ifdef FREEBSD ++LIBS+=-lintl -lexecinfo ++endif ++ + ### Includes and Defines (add further entries here): + + PKG-LIBS += libavcodec libavutil +@@ -86,17 +90,34 @@ markad: $(OBJS) + $(CXX) $(CXXFLAGS) $(OBJS) $(LIBS) -o $@ + + ++ifdef FREEBSD ++MANDIR = $(PREFIX)/man ++else + MANDIR = $(DESTDIR)/usr/share/man ++endif + install-doc: ++ifdef FREEBSD ++ @mkdir -p ${DESTDIR}$(MANDIR)/man1 ++ @gzip -c markad.1 > ${DESTDIR}$(MANDIR)/man1/markad.1.gz ++else + @mkdir -p $(MANDIR)/man1 + @gzip -c markad.1 > $(MANDIR)/man1/markad.1.gz ++endif + + install: install-doc markad $(I18Nmsgs) ++ifdef FREEBSD ++ @mkdir -p ${DESTDIR}$(PREFIX)/bin ++ @cp -f markad ${DESTDIR}$(PREFIX)/bin/markad ++ @$(STRIP) ${DESTDIR}$(PREFIX)/bin/markad ++ @mkdir -p ${DESTDIR}$(DATADIR)/logos ++ @cp logos/* ${DESTDIR}$(DATADIR)/logos ++else + @mkdir -p $(DESTDIR)/usr/bin + @cp --remove-destination markad $(DESTDIR)/usr/bin/markad + @$(STRIP) $(DESTDIR)/usr/bin/markad + @mkdir -p $(DESTDIR)/var/lib/markad + @cp -a logos/* $(DESTDIR)/var/lib/markad ++endif + @echo markad installed + + clean: diff --git a/multimedia/vdr-plugin-markad/files/patch-command_decoder.cpp b/multimedia/vdr-plugin-markad/files/patch-command_decoder.cpp new file mode 100644 index 000000000000..b426eaf4567a --- /dev/null +++ b/multimedia/vdr-plugin-markad/files/patch-command_decoder.cpp @@ -0,0 +1,165 @@ +--- command/decoder.cpp.orig 2012-04-02 19:41:15 UTC ++++ command/decoder.cpp +@@ -6,11 +6,17 @@ + */ + + #include ++#ifndef __FreeBSD__ + #include ++#else ++#include ++#include ++#endif + #include + #include + #include + #include ++#include + + #include "decoder.h" + +@@ -113,6 +119,7 @@ cMarkAdDecoder::cMarkAdDecoder(bool useH + + noticeERRVID=false; + ++#ifndef __FreeBSD__ + cpu_set_t cpumask; + uint len = sizeof(cpumask); + int cpucount=1; +@@ -120,6 +127,12 @@ cMarkAdDecoder::cMarkAdDecoder(bool useH + { + cpucount=CPU_COUNT(&cpumask); + } ++#else ++ int cpucount; ++ size_t cpus_size = sizeof(cpucount); ++ if (sysctlbyname("hw.ncpu", &cpucount, &cpus_size, NULL, 0) == -1) ++ cpucount = 1; ++#endif + + if (Threads==-1) + { +@@ -151,28 +164,28 @@ cMarkAdDecoder::cMarkAdDecoder(bool useH + } + + video_codec=NULL; +- CodecID video_codecid; ++ AVCodecID video_codecid; + + if (useH264) + { +- video_codecid=CODEC_ID_H264; ++ video_codecid=AV_CODEC_ID_H264; + } + else + { +- video_codecid=CODEC_ID_MPEG2VIDEO_XVMC; ++ video_codecid=AV_CODEC_ID_MPEG2VIDEO_XVMC; + } + + video_codec = avcodec_find_decoder(video_codecid); +- if ((!video_codec) && (video_codecid==CODEC_ID_MPEG2VIDEO_XVMC)) ++ if ((!video_codec) && (video_codecid==AV_CODEC_ID_MPEG2VIDEO_XVMC)) + { + // fallback to MPEG2VIDEO +- video_codecid=CODEC_ID_MPEG2VIDEO; ++ video_codecid=AV_CODEC_ID_MPEG2VIDEO; + video_codec=avcodec_find_decoder(video_codecid); + } + + if (video_codec) + { +- video_context = avcodec_alloc_context(); ++ video_context = avcodec_alloc_context3(NULL); + if (video_context) + { + if (video_codec->capabilities & CODEC_CAP_TRUNCATED) +@@ -183,7 +196,7 @@ cMarkAdDecoder::cMarkAdDecoder(bool useH + + av_log_set_level(AV_LOG_FATAL); // silence decoder output + +- if (video_codecid==CODEC_ID_H264) ++ if (video_codecid==AV_CODEC_ID_H264) + { + video_context->flags2|=CODEC_FLAG2_CHUNKS; // needed for H264! + } +@@ -198,15 +211,15 @@ cMarkAdDecoder::cMarkAdDecoder(bool useH + #else + int ret=avcodec_open(video_context, video_codec); + #endif +- if ((ret < 0) && (video_codecid==CODEC_ID_MPEG2VIDEO_XVMC)) ++ if ((ret < 0) && (video_codecid==AV_CODEC_ID_MPEG2VIDEO_XVMC)) + { + // fallback to MPEG2VIDEO +- video_codecid=CODEC_ID_MPEG2VIDEO; ++ video_codecid=AV_CODEC_ID_MPEG2VIDEO; + video_codec=avcodec_find_decoder(video_codecid); + if (video_codec) + { + video_context->codec_type=AVMEDIA_TYPE_UNKNOWN; +- video_context->codec_id=CODEC_ID_NONE; ++ video_context->codec_id=AV_CODEC_ID_NONE; + video_context->codec_tag=0; + memset(video_context->codec_name,0,sizeof(video_context->codec_name)); + #if LIBAVCODEC_VERSION_INT >= ((53<<16)+(5<<8)+0) +@@ -225,13 +238,13 @@ cMarkAdDecoder::cMarkAdDecoder(bool useH + { + switch (video_codecid) + { +- case CODEC_ID_H264: ++ case AV_CODEC_ID_H264: + esyslog("could not open codec for H264"); + break; +- case CODEC_ID_MPEG2VIDEO_XVMC: ++ case AV_CODEC_ID_MPEG2VIDEO_XVMC: + esyslog("could not open codec MPEG2 (XVMC)"); + break; +- case CODEC_ID_MPEG2VIDEO: ++ case AV_CODEC_ID_MPEG2VIDEO: + esyslog("could not open codec MPEG2"); + break; + default: +@@ -256,7 +269,7 @@ cMarkAdDecoder::cMarkAdDecoder(bool useH + } + #endif + +- video_frame = avcodec_alloc_frame(); ++ video_frame = av_frame_alloc(); + if (!video_frame) + { + esyslog("could not allocate frame"); +@@ -286,13 +299,13 @@ cMarkAdDecoder::cMarkAdDecoder(bool useH + { + switch (video_codecid) + { +- case CODEC_ID_H264: ++ case AV_CODEC_ID_H264: + esyslog("codec for H264 not found"); + break; +- case CODEC_ID_MPEG2VIDEO_XVMC: ++ case AV_CODEC_ID_MPEG2VIDEO_XVMC: + esyslog("codec for MPEG2 (XVMC) not found"); + break; +- case CODEC_ID_MPEG2VIDEO: ++ case AV_CODEC_ID_MPEG2VIDEO: + esyslog("codec for MPEG2 not found"); + break; + default: +@@ -321,7 +334,7 @@ bool cMarkAdDecoder::Clear() + { + avcodec_flush_buffers(video_context); + AVCodecContext *dest; +- dest=avcodec_alloc_context(); ++ dest=avcodec_alloc_context3(NULL); + if (dest) + { + if (avcodec_copy_context(dest,video_context)!=0) ret=false; +@@ -384,7 +397,7 @@ bool cMarkAdDecoder::DecodeVideo(MarkAdC + if (!video_frame) return false; + maContext->Video.Data.Valid=false; + +- if ((video_context->codec_id==CODEC_ID_H264) && (!video_context->skip_frame)) ++ if ((video_context->codec_id==AV_CODEC_ID_H264) && (!video_context->skip_frame)) + { + // with H264 we cannot set skip_frame just to NONKEY, is depends on Interlaced... + if (maContext->Video.Info.Height) diff --git a/multimedia/vdr-plugin-markad/files/patch-command_decoder.h b/multimedia/vdr-plugin-markad/files/patch-command_decoder.h new file mode 100644 index 000000000000..52e1c7124424 --- /dev/null +++ b/multimedia/vdr-plugin-markad/files/patch-command_decoder.h @@ -0,0 +1,10 @@ +--- command/decoder.h.orig 2012-02-24 20:08:34 UTC ++++ command/decoder.h +@@ -18,6 +18,7 @@ extern "C" + #include + #else + #include ++#include + #endif + + #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) diff --git a/multimedia/vdr-plugin-markad/files/patch-command_markad-standalone.cpp b/multimedia/vdr-plugin-markad/files/patch-command_markad-standalone.cpp new file mode 100644 index 000000000000..3417fbdee961 --- /dev/null +++ b/multimedia/vdr-plugin-markad/files/patch-command_markad-standalone.cpp @@ -0,0 +1,138 @@ +--- command/markad-standalone.cpp.orig 2012-09-11 11:06:28 UTC ++++ command/markad-standalone.cpp +@@ -24,7 +24,13 @@ + #include + #include + #include ++#ifndef __FreeBSD__ + #include ++#else ++#include ++#include ++#include ++#endif + #include + #include + #include +@@ -1428,6 +1434,7 @@ bool cMarkAdStandalone::SaveInfo() + time_t cMarkAdStandalone::GetBroadcastStart(time_t start, int fd) + { + // get broadcast start from atime of directory (if the volume is mounted with noatime) ++#ifndef __FreeBSD__ + struct mntent *ent; + struct stat statbuf; + FILE *mounts=setmntent(_PATH_MOUNTED,"r"); +@@ -1454,6 +1461,14 @@ time_t cMarkAdStandalone::GetBroadcastSt + } + } + endmntent(mounts); ++#else ++ struct stat statbuf; ++ struct statfs statfsbuf; ++ bool useatime=false; ++ if ((statfs(directory, &statfsbuf) == 0) && ++ !(statfsbuf.f_flags & MNT_NOATIME)) ++ useatime=true; ++#endif + + if ((useatime) && (stat(directory,&statbuf)!=-1)) + { +@@ -1554,6 +1569,16 @@ bool cMarkAdStandalone::LoadInfo() + if (lf) *lf=0; + char *cr=strchr(macontext.Info.ChannelName,13); + if (cr) *cr=0; ++#if 1 ++ int len = strlen(macontext.Info.ChannelName); ++ if (len > 5 && ++ (!strcmp(macontext.Info.ChannelName + len - 4, " (A)") || ++ !strcmp(macontext.Info.ChannelName + len - 4, " (C)") || ++ !strcmp(macontext.Info.ChannelName + len - 4, " (S)") || ++ !strcmp(macontext.Info.ChannelName + len - 4, " (T)") || ++ !strcmp(macontext.Info.ChannelName + len - 4, " (I)"))) ++ macontext.Info.ChannelName[len - 4] = '\0'; ++#endif + for (int i=0; i<(int) strlen(macontext.Info.ChannelName); i++) + { + if (macontext.Info.ChannelName[i]==' ') macontext.Info.ChannelName[i]='_'; +@@ -1961,10 +1986,14 @@ bool cMarkAdStandalone::CreatePidfile() + int pid; + if (fscanf(oldpid,"%10i\n",&pid)==1) + { ++#ifndef __FreeBSD__ + char procname[256]=""; + snprintf(procname,sizeof(procname),"/proc/%i",pid); + struct stat statbuf; + if (stat(procname,&statbuf)!=-1) ++#else ++ if (kill(pid, 0) == 0) ++#endif + { + // found another, running markad + fprintf(stderr,"another instance is running on %s",directory); +@@ -2081,6 +2110,7 @@ cMarkAdStandalone::cMarkAdStandalone(con + } + } + ++#ifndef __FreeBSD__ + long lb; + errno=0; + lb=sysconf(_SC_LONG_BIT); +@@ -2089,6 +2119,7 @@ cMarkAdStandalone::cMarkAdStandalone(con + isyslog("starting v%s (%libit)",VERSION,lb); + } + else ++#endif + { + isyslog("starting v%s",VERSION); + } +@@ -2319,7 +2350,7 @@ cMarkAdStandalone::~cMarkAdStandalone() + RemovePidfile(); + } + +-bool isnumber(const char *s) ++bool str_isnumber(const char *s) + { + while (*s) + { +@@ -2345,7 +2376,11 @@ int usage(int svdrpport) + " ignores hints from info(.vdr) file\n" + " 4 = ignore timer info\n" + "-l --logocachedir\n" ++#ifdef DATADIR ++ " directory where logos stored, default " DATADIR "/logos\n" ++#else + " directory where logos stored, default /var/lib/markad\n" ++#endif + "-p --priority=\n" + " software priority of markad when running in background\n" + " from -20...19, default 19\n" +@@ -2489,7 +2524,11 @@ int main(int argc, char *argv[]) + config.logoHeight=-1; + config.threads=-1; + strcpy(config.svdrphost,"127.0.0.1"); ++#ifdef DATADIR ++ strcpy(config.logoDirectory,DATADIR "/logos"); ++#else + strcpy(config.logoDirectory,"/var/lib/markad"); ++#endif + + struct servent *serv=getservbyname("svdrp","tcp"); + if (serv) +@@ -2620,7 +2659,7 @@ int main(int argc, char *argv[]) + + case 'p': + // --priority +- if (isnumber(optarg) || *optarg=='-') ++ if (str_isnumber(optarg) || *optarg=='-') + niceLevel = atoi(optarg); + else + { +@@ -2806,7 +2845,7 @@ int main(int argc, char *argv[]) + break; + + case 9: // --svdrpport +- if (isnumber(optarg) && atoi(optarg) > 0 && atoi(optarg) < 65536) ++ if (str_isnumber(optarg) && atoi(optarg) > 0 && atoi(optarg) < 65536) + { + config.svdrpport=atoi(optarg); + } diff --git a/multimedia/vdr-plugin-markad/files/patch-plugin-Makefile b/multimedia/vdr-plugin-markad/files/patch-plugin-Makefile deleted file mode 100644 index 528e9cc30d1a..000000000000 --- a/multimedia/vdr-plugin-markad/files/patch-plugin-Makefile +++ /dev/null @@ -1,22 +0,0 @@ ---- a/plugin/Makefile -+++ b/plugin/Makefile -@@ -99,11 +99,19 @@ i18n: $(I18Nmsgs) $(I18Npot) - ### Targets: - - install: all -+ifdef FREEBSD -+ ${INSTALL_PROGRAM} $(LIBDIR)/libvdr-$(PLUGIN).so.$(APIVERSION) ${DESTDIR}$(PREFIX)/lib/vdr/libvdr-$(PLUGIN).so.$(APIVERSION) -+else - cp --remove-destination libvdr-$(PLUGIN).so $(LIBDIR)/libvdr-$(PLUGIN).so.$(APIVERSION) -+endif - - libvdr-$(PLUGIN).so: $(OBJS) - $(CXX) $(CXXFLAGS) -shared $(OBJS) $(LIBS) -o $@ -+ifdef FREEBSD -+ cp -f libvdr-$(PLUGIN).so $(LIBDIR)/libvdr-$(PLUGIN).so.$(APIVERSION) -+else - cp --remove-destination libvdr-$(PLUGIN).so $(LIBDIR)/libvdr-$(PLUGIN).so.$(APIVERSION) -+endif - - clean: - @-rm -f $(OBJS) $(DEPFILE) *.so *.so.* *.tgz core* *~ $(PODIR)/*.mo $(PODIR)/*.pot diff --git a/multimedia/vdr-plugin-markad/files/patch-plugin-markad.cpp b/multimedia/vdr-plugin-markad/files/patch-plugin-markad.cpp deleted file mode 100644 index 3bafd37e0f4b..000000000000 --- a/multimedia/vdr-plugin-markad/files/patch-plugin-markad.cpp +++ /dev/null @@ -1,19 +0,0 @@ ---- a/plugin/markad.cpp -+++ b/plugin/markad.cpp -@@ -15,8 +15,16 @@ - - #include "markad.h" - -+#ifdef PREFIX -+#define DEF_BINDIR PREFIX "/bin" -+#else - #define DEF_BINDIR "/usr/bin" -+#endif -+#ifdef DATADIR -+#define DEF_LOGODIR DATADIR "/logos" -+#else - #define DEF_LOGODIR "/var/lib/markad" -+#endif - - cPluginMarkAd::cPluginMarkAd(void) - { diff --git a/multimedia/vdr-plugin-markad/files/patch-plugin-status.cpp b/multimedia/vdr-plugin-markad/files/patch-plugin-status.cpp deleted file mode 100644 index 3d0d09b8d64c..000000000000 --- a/multimedia/vdr-plugin-markad/files/patch-plugin-status.cpp +++ /dev/null @@ -1,113 +0,0 @@ ---- a/plugin/status.cpp -+++ b/plugin/status.cpp -@@ -6,6 +6,12 @@ - */ - - #include -+#ifdef __FreeBSD__ -+#include -+#include -+#include -+#include -+#endif - - #include "status.h" - -@@ -135,7 +141,12 @@ bool cStatusMarkAd::LogoExists(const cha - cTimer *timer=NULL; - for (cTimer *Timer = Timers.First(); Timer; Timer=Timers.Next(Timer)) - { -+#if 1 -+ if (Timer->Recording() && -+ (!strcmp(Timer->ToDescr(),Name) || !strcmp(Timer->File(),Name))) -+#else - if (Timer->Recording() && (!strcmp(Timer->ToDescr(),Name))) -+#endif - { - timer=Timer; - break; -@@ -150,6 +161,16 @@ bool cStatusMarkAd::LogoExists(const cha - if (!chan) return false; - char *cname=strdup(chan->Name()); - if (!cname) return false; -+#if 1 -+ int len = strlen(cname); -+ if (len > 5 && -+ (!strcmp(cname + len - 4, " (A)") || -+ !strcmp(cname + len - 4, " (C)") || -+ !strcmp(cname + len - 4, " (S)") || -+ !strcmp(cname + len - 4, " (T)") || -+ !strcmp(cname + len - 4, " (I)"))) -+ cname[len - 4] = '\0'; -+#endif - for (int i=0; i<(int) strlen(cname); i++) - { - if (cname[i]==' ') cname[i]='_'; -@@ -233,6 +254,7 @@ bool cStatusMarkAd::getStatus(int Positi - if (Position<0) return false; - if (!recs[Position].Pid) return false; - int ret=0; -+#ifndef __FreeBSD__ - char procname[256]=""; - snprintf(procname,sizeof(procname),"/proc/%i/stat",recs[Position].Pid); - FILE *fstat=fopen(procname,"r"); -@@ -252,6 +274,59 @@ bool cStatusMarkAd::getStatus(int Positi - } - } - return (ret==1); -+#else -+ int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PID, recs[Position].Pid}; -+ size_t len = 0; -+ struct kinfo_proc *kipp = NULL; -+ if (sysctl(mib, sizeof(mib)/sizeof(*mib), NULL, &len, NULL, 0) >= 0 && -+ (kipp = (kinfo_proc *)malloc(len)) != NULL && -+ sysctl(mib, sizeof(mib)/sizeof(*mib), kipp, &len, NULL, 0) >= 0 && -+ len == sizeof(*kipp) && kipp->ki_structsize == sizeof(*kipp) && -+ kipp->ki_pid == recs[Position].Pid) { -+ -+ int tdflags = kipp->ki_tdflags; /* XXXKSE */ -+ -+ ret = 1; -+ -+ switch (kipp->ki_stat) { -+ -+ case SSTOP: -+ recs[Position].Status = 'T'; -+ break; -+ -+ case SSLEEP: -+ if (tdflags & TDF_SINTR) /* interruptable (long) */ -+ recs[Position].Status = /* kipp->ki_slptime >= MAXSLP ? 'I' : */ 'S'; -+ else -+ recs[Position].Status = 'D'; -+ break; -+ -+ case SRUN: -+ case SIDL: -+ recs[Position].Status = 'R'; -+ break; -+ -+ case SWAIT: -+ recs[Position].Status = 'W'; -+ break; -+ -+ case SLOCK: -+ recs[Position].Status = 'L'; -+ break; -+ -+ case SZOMB: -+ recs[Position].Status = 'Z'; -+ break; -+ -+ default: -+ recs[Position].Status = '?'; -+ } -+ } else { -+ Remove(Position); -+ } -+ free(kipp); -+ return ret; -+#endif - } - - bool cStatusMarkAd::getPid(int Position) diff --git a/multimedia/vdr-plugin-markad/files/patch-plugin_Makefile b/multimedia/vdr-plugin-markad/files/patch-plugin_Makefile new file mode 100644 index 000000000000..6471e82124d7 --- /dev/null +++ b/multimedia/vdr-plugin-markad/files/patch-plugin_Makefile @@ -0,0 +1,22 @@ +--- plugin/Makefile.orig 2012-02-13 19:32:27 UTC ++++ plugin/Makefile +@@ -99,11 +99,19 @@ i18n: $(I18Nmsgs) $(I18Npot) + ### Targets: + + install: all ++ifdef FREEBSD ++ ${INSTALL_PROGRAM} $(LIBDIR)/libvdr-$(PLUGIN).so.$(APIVERSION) ${DESTDIR}$(PREFIX)/lib/vdr/libvdr-$(PLUGIN).so.$(APIVERSION) ++else + cp --remove-destination libvdr-$(PLUGIN).so $(LIBDIR)/libvdr-$(PLUGIN).so.$(APIVERSION) ++endif + + libvdr-$(PLUGIN).so: $(OBJS) + $(CXX) $(CXXFLAGS) -shared $(OBJS) $(LIBS) -o $@ ++ifdef FREEBSD ++ cp -f libvdr-$(PLUGIN).so $(LIBDIR)/libvdr-$(PLUGIN).so.$(APIVERSION) ++else + cp --remove-destination libvdr-$(PLUGIN).so $(LIBDIR)/libvdr-$(PLUGIN).so.$(APIVERSION) ++endif + + clean: + @-rm -f $(OBJS) $(DEPFILE) *.so *.so.* *.tgz core* *~ $(PODIR)/*.mo $(PODIR)/*.pot diff --git a/multimedia/vdr-plugin-markad/files/patch-plugin_markad.cpp b/multimedia/vdr-plugin-markad/files/patch-plugin_markad.cpp new file mode 100644 index 000000000000..86a4a947806e --- /dev/null +++ b/multimedia/vdr-plugin-markad/files/patch-plugin_markad.cpp @@ -0,0 +1,19 @@ +--- plugin/markad.cpp.orig 2012-09-10 12:45:12 UTC ++++ plugin/markad.cpp +@@ -15,8 +15,16 @@ + + #include "markad.h" + ++#ifdef PREFIX ++#define DEF_BINDIR PREFIX "/bin" ++#else + #define DEF_BINDIR "/usr/bin" ++#endif ++#ifdef DATADIR ++#define DEF_LOGODIR DATADIR "/logos" ++#else + #define DEF_LOGODIR "/var/lib/markad" ++#endif + + cPluginMarkAd::cPluginMarkAd(void) + { diff --git a/multimedia/vdr-plugin-markad/files/patch-plugin_status.cpp b/multimedia/vdr-plugin-markad/files/patch-plugin_status.cpp new file mode 100644 index 000000000000..82f6f6224b82 --- /dev/null +++ b/multimedia/vdr-plugin-markad/files/patch-plugin_status.cpp @@ -0,0 +1,113 @@ +--- plugin/status.cpp.orig 2012-09-09 23:00:32 UTC ++++ plugin/status.cpp +@@ -6,6 +6,12 @@ + */ + + #include ++#ifdef __FreeBSD__ ++#include ++#include ++#include ++#include ++#endif + + #include "status.h" + +@@ -135,7 +141,12 @@ bool cStatusMarkAd::LogoExists(const cha + cTimer *timer=NULL; + for (cTimer *Timer = Timers.First(); Timer; Timer=Timers.Next(Timer)) + { ++#if 1 ++ if (Timer->Recording() && ++ (!strcmp(Timer->ToDescr(),Name) || !strcmp(Timer->File(),Name))) ++#else + if (Timer->Recording() && (!strcmp(Timer->ToDescr(),Name))) ++#endif + { + timer=Timer; + break; +@@ -150,6 +161,16 @@ bool cStatusMarkAd::LogoExists(const cha + if (!chan) return false; + char *cname=strdup(chan->Name()); + if (!cname) return false; ++#if 1 ++ int len = strlen(cname); ++ if (len > 5 && ++ (!strcmp(cname + len - 4, " (A)") || ++ !strcmp(cname + len - 4, " (C)") || ++ !strcmp(cname + len - 4, " (S)") || ++ !strcmp(cname + len - 4, " (T)") || ++ !strcmp(cname + len - 4, " (I)"))) ++ cname[len - 4] = '\0'; ++#endif + for (int i=0; i<(int) strlen(cname); i++) + { + if (cname[i]==' ') cname[i]='_'; +@@ -233,6 +254,7 @@ bool cStatusMarkAd::getStatus(int Positi + if (Position<0) return false; + if (!recs[Position].Pid) return false; + int ret=0; ++#ifndef __FreeBSD__ + char procname[256]=""; + snprintf(procname,sizeof(procname),"/proc/%i/stat",recs[Position].Pid); + FILE *fstat=fopen(procname,"r"); +@@ -252,6 +274,59 @@ bool cStatusMarkAd::getStatus(int Positi + } + } + return (ret==1); ++#else ++ int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PID, recs[Position].Pid}; ++ size_t len = 0; ++ struct kinfo_proc *kipp = NULL; ++ if (sysctl(mib, sizeof(mib)/sizeof(*mib), NULL, &len, NULL, 0) >= 0 && ++ (kipp = (kinfo_proc *)malloc(len)) != NULL && ++ sysctl(mib, sizeof(mib)/sizeof(*mib), kipp, &len, NULL, 0) >= 0 && ++ len == sizeof(*kipp) && kipp->ki_structsize == sizeof(*kipp) && ++ kipp->ki_pid == recs[Position].Pid) { ++ ++ int tdflags = kipp->ki_tdflags; /* XXXKSE */ ++ ++ ret = 1; ++ ++ switch (kipp->ki_stat) { ++ ++ case SSTOP: ++ recs[Position].Status = 'T'; ++ break; ++ ++ case SSLEEP: ++ if (tdflags & TDF_SINTR) /* interruptable (long) */ ++ recs[Position].Status = /* kipp->ki_slptime >= MAXSLP ? 'I' : */ 'S'; ++ else ++ recs[Position].Status = 'D'; ++ break; ++ ++ case SRUN: ++ case SIDL: ++ recs[Position].Status = 'R'; ++ break; ++ ++ case SWAIT: ++ recs[Position].Status = 'W'; ++ break; ++ ++ case SLOCK: ++ recs[Position].Status = 'L'; ++ break; ++ ++ case SZOMB: ++ recs[Position].Status = 'Z'; ++ break; ++ ++ default: ++ recs[Position].Status = '?'; ++ } ++ } else { ++ Remove(Position); ++ } ++ free(kipp); ++ return ret; ++#endif + } + + bool cStatusMarkAd::getPid(int Position) diff --git a/multimedia/vdr-plugin-markad/files/patch-vdr-markad-0.1.4-libav9 b/multimedia/vdr-plugin-markad/files/patch-vdr-markad-0.1.4-libav9 deleted file mode 100644 index fca9cbb49e35..000000000000 --- a/multimedia/vdr-plugin-markad/files/patch-vdr-markad-0.1.4-libav9 +++ /dev/null @@ -1,40 +0,0 @@ -diff -urN markad-0.1.4.old/command/decoder.cpp markad-0.1.4/command/decoder.cpp ---- markad-0.1.4.old/command/decoder.cpp 2013-06-17 21:52:44.333367552 +0200 -+++ markad-0.1.4/command/decoder.cpp 2013-06-17 21:53:03.708366863 +0200 -@@ -11,6 +11,7 @@ - #include - #include - #include -+#include - - #include "decoder.h" - -@@ -172,7 +173,7 @@ - - if (video_codec) - { -- video_context = avcodec_alloc_context(); -+ video_context = avcodec_alloc_context3(NULL); - if (video_context) - { - if (video_codec->capabilities & CODEC_CAP_TRUNCATED) -@@ -321,7 +322,7 @@ - { - avcodec_flush_buffers(video_context); - AVCodecContext *dest; -- dest=avcodec_alloc_context(); -+ dest=avcodec_alloc_context3(NULL); - if (dest) - { - if (avcodec_copy_context(dest,video_context)!=0) ret=false; -diff -urN markad-0.1.4.old/command/decoder.h markad-0.1.4/command/decoder.h ---- markad-0.1.4.old/command/decoder.h 2013-06-17 21:52:44.333367552 +0200 -+++ markad-0.1.4/command/decoder.h 2013-06-17 21:53:03.708366863 +0200 -@@ -18,6 +18,7 @@ - #include - #else - #include -+#include - #endif - - #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) -- cgit