commit ce230f8af6746a8342c08a1e499c4a373c02b21a
Author: Martin Gansser <mgansser(a)online.de>
Date: Fri Mar 13 20:37:04 2020 +0100
Replace 03-markad-decoder-V0-59.diff by 03-markad-decoder-V0-59.diff
Dropped 00-markad-libavcodec58-V0-02.diff
Dropped 01-markad-Makefile-V0-06.diff
Dropped 02-markad-deprecated-V0-05.diff
00-markad-libavcodec58-V0-02.diff | 176 ---
01-markad-Makefile-V0-06.diff | 272 -----
02-markad-deprecated-V0-05.diff | 74 --
...oder-V0-59.diff => 03-markad-decoder-V1-00.diff | 1254 ++++++++++++++------
vdr-markad.spec | 16 +-
5 files changed, 892 insertions(+), 900 deletions(-)
---
diff --git a/03-markad-decoder-V0-59.diff b/03-markad-decoder-V1-00.diff
similarity index 77%
rename from 03-markad-decoder-V0-59.diff
rename to 03-markad-decoder-V1-00.diff
index 1babed7..bb81ebd 100644
--- a/03-markad-decoder-V0-59.diff
+++ b/03-markad-decoder-V1-00.diff
@@ -1,193 +1,114 @@
-diff -u --new-file '--exclude=version.h' a/plugin/Makefile b/plugin/Makefile
---- a/plugin/Makefile 2020-01-11 12:26:37.427878242 +0000
-+++ b/plugin/Makefile 2020-01-11 12:26:37.607880056 +0000
-@@ -27,6 +27,10 @@
-
- export CFLAGS = $(call PKGCFG,cflags)
- export CXXFLAGS = $(call PKGCFG,cxxflags)
-+CXXVERION=$(shell $(CXX) -dumpversion)
-+ifeq ($(CXXVERION),4.8)
-+export CXXFLAGS += -std=c++11 # to prevent a lot of compiler warnings with Ubuntu
14.04
-+endif
-
- ### The version number of VDR's plugin API:
-
-diff -u --new-file '--exclude=version.h' a/plugin/markad.cpp b/plugin/markad.cpp
---- a/plugin/markad.cpp 2020-01-11 10:19:55.247477749 +0000
-+++ b/plugin/markad.cpp 2020-01-11 12:26:37.607880056 +0000
-@@ -54,10 +54,15 @@
- const char *cPluginMarkAd::CommandLineHelp(void)
- {
- // Return a string that describes all known command line options.
-- return " -b DIR, --bindir=DIR use DIR as location for markad
executable\n"
-- " (default: /usr/bin)\n"
-- " -l DIR --logocachedir=DIR use DIR as location for markad
logos\n"
-- " (default: /var/lib/markad)\n";
-+ return " -b DIR, --bindir=DIR use DIR as location for markad
executable\n"
-+ " (default: /usr/bin)\n"
-+ " -l DIR --logocachedir=DIR use DIR as location for markad
logos\n"
-+ " (default: /var/lib/markad)\n"
-+ " --loglevel=<level> sets loglevel to the specified
value\n"
-+ " <level> 1=error 2=info 3=debug
4=trace\n"
-+ " --astopoffs=<value> (default is 100)\n"
-+ " assumed stop offset in seconds range
from 0 to 240\n"
-+ " --cDecoder use new cDecoder class)\n";
- }
-
- bool cPluginMarkAd::ProcessArgs(int argc, char *argv[])
-@@ -65,9 +70,11 @@
- // Command line argument processing
- static struct option long_options[] =
- {
-- { "bindir", required_argument, NULL, 'b'
-- },
-- { "logocachedir", required_argument, NULL, 'l'},
-+ { "bindir", required_argument, NULL, 'b'},
-+ { "logocachedir", required_argument, NULL, 'l'},
-+ { "loglevel", required_argument, NULL, '1'},
-+ { "astopoffs", required_argument, NULL, '2'},
-+ { "cDecoder", no_argument, NULL, '3'},
- { NULL, 0, NULL, 0 }
- };
-
-@@ -103,6 +110,15 @@
- return false;
- }
- break;
-+ case '1':
-+ loglevel=atoi(optarg);
-+ break;
-+ case '2':
-+ astopoffs=atoi(optarg);
-+ break;
-+ case '3':
-+ cDecoder=true;
-+ break;
- default:
- return false;
- }
-@@ -132,6 +148,13 @@
- // Start any background activities the plugin shall perform.
- lastcheck=0;
- setup.PluginName=Name();
-+ if (loglevel)
-+ if(! asprintf(&setup.LogLevel," --loglevel=%i ",loglevel))
-+ esyslog("markad: asprintf ouf of memory");
-+ if (astopoffs>=0)
-+ if(! asprintf(&setup.aStopOffs," --astopoffs=%i ",astopoffs))
-+ esyslog("markad: asprintf ouf of memory");
-+ setup.cDecoder=cDecoder;
- setup.LogoDir=logodir;
- statusMonitor = new cStatusMarkAd(bindir,logodir,&setup);
- return (statusMonitor!=NULL);
-diff -u --new-file '--exclude=version.h' a/plugin/markad.h b/plugin/markad.h
---- a/plugin/markad.h 2020-01-11 10:19:55.247477749 +0000
-+++ b/plugin/markad.h 2020-01-11 12:26:37.607880056 +0000
-@@ -23,6 +23,9 @@
- cStatusMarkAd *statusMonitor;
- char *bindir;
- char *logodir;
-+ int loglevel=0;
-+ int astopoffs=-1;
-+ bool cDecoder=false;
- struct setup setup;
- char title[80];
- time_t lastcheck;
-diff -u --new-file '--exclude=version.h' a/plugin/setup.h b/plugin/setup.h
---- a/plugin/setup.h 2020-01-11 10:19:55.247477749 +0000
-+++ b/plugin/setup.h 2020-01-11 12:26:37.607880056 +0000
-@@ -25,6 +25,9 @@
- bool LogoOnly;
- bool DeferredShutdown;
- const char *LogoDir;
-+ char *LogLevel=NULL;
-+ char *aStopOffs=NULL;
-+ bool cDecoder=false;
- const char *PluginName;
- };
-
-diff -u --new-file '--exclude=version.h' a/plugin/status.cpp b/plugin/status.cpp
---- a/plugin/status.cpp 2020-01-11 10:19:55.247477749 +0000
-+++ b/plugin/status.cpp 2020-01-11 12:26:37.607880056 +0000
-@@ -72,7 +72,7 @@
- {
- if ((Direct) && (Get(FileName)!=-1)) return false;
-
-- cString cmd = cString::sprintf("\"%s\"/markad %s%s%s%s%s%s%s -l
\"%s\" %s \"%s\"",
-+ cString cmd = cString::sprintf("\"%s\"/markad %s%s%s%s%s%s%s%s%s%s -l
\"%s\" %s \"%s\"",
- bindir,
- setup->Verbose ? " -v " : "",
- setup->SaveInfo ? " -I " :
"",
-@@ -85,7 +85,11 @@
- setup->NoMargins ? " -i 4 " :
"",
- setup->SecondPass ? "" : "
--pass1only ",
- setup->Log2Rec ? " -R " : "",
-- logodir,Direct ? "-O after" :
"--online=2 before",
-+ setup->LogLevel ? setup->LogLevel : "",
-+ setup->aStopOffs ? setup->aStopOffs : "",
-+ setup->cDecoder ? " --cDecoder " : "",
-+ logodir,
-+ Direct ? "-O after" : "--online=2 before",
- FileName);
- usleep(1000000); // wait 1 second
- if (SystemExec(cmd)!=-1)
-@@ -152,12 +156,13 @@
- #endif
- {
- #if APIVERSNUM>=10722
-- if (Timer->Recording() && const_cast<cDevice
*>(Device)->IsTunedToTransponder(Timer->Channel()) &&
-- (difftime(time(NULL),Timer->StartTime())<60))
-- {
-- timer=Timer;
-- break;
-- }
-+ if (Timer->Recording() && const_cast<cDevice
*>(Device)->IsTunedToTransponder(Timer->Channel()))
-+ if (difftime(time(NULL),Timer->StartTime())<60)
-+ {
-+ timer=Timer;
-+ break;
-+ }
-+ else esyslog("markad: recording start is later than timer start,
ignoring");
- #else
- if (Timer->Recording() &&
Device->IsTunedToTransponder(Timer->Channel()) &&
- (difftime(time(NULL),Timer->StartTime())<60))
-@@ -301,9 +306,10 @@
- char *buf;
- if (asprintf(&buf,"%s/markad.pid",recs[Position].FileName)==-1) return
false;
-
-+ usleep(500*1000); // wait 500ms to give markad time to create pid file
- FILE *fpid=fopen(buf,"r");
- if (fpid)
-- {
-+ {
- free(buf);
- int pid;
- ret=fscanf(fpid,"%10i\n",&pid);
-@@ -312,6 +318,7 @@
- }
- else
- {
-+ esyslog("markad: failed to open pid file %s with errno %i", buf, errno);
- if (errno==ENOENT)
- {
- // no such file or directory -> markad done or crashed
-diff -u --new-file '--exclude=version.h' a/command/Makefile b/command/Makefile
---- a/command/Makefile 2020-01-11 12:26:37.427878242 +0000
-+++ b/command/Makefile 2020-01-11 12:26:37.607880056 +0000
-@@ -21,14 +21,17 @@
+diff --git a/.gitignore b/.gitignore
+index c69f42b..69d89aa 100644
+--- a/.gitignore
++++ b/.gitignore
+@@ -1,5 +1,7 @@
+ .gitignore
+
++version.h
++
+ command/markad
+ command/.dependencies
+ command/*.o
+diff --git a/Makefile b/Makefile
+index 52812c1..dcc5960 100644
+--- a/Makefile
++++ b/Makefile
+@@ -4,15 +4,38 @@
+ # dont remove the next line, its needed for the VDR Makefile
+ # $(LIBDIR)/$@.$(APIVERSION)
+
+-DIRS = command plugin
++### The version number of this plugin (taken from the main source file):
+
+-$(shell GITVERSION=`git rev-parse --short HEAD 2> /dev/null`; if [
"$$GITVERSION" ]; then sed "s/\";/ ($$GITVERSION)\";/"
version.dist > version.h; else cp version.dist version.h; fi)
+ VERSION = $(shell grep 'static const char \*VERSION *=' version.h | awk '{
print $$6 }' | sed -e 's/[";]//g')
++GITTAG = $(shell git describe --always 2>/dev/null)
++$(shell GITVERSION=`git rev-parse --short HEAD 2> /dev/null`; if [
"$$GITVERSION" ]; then sed "s/\";/ ($$GITVERSION)\";/"
version.dist > version.h; else cp version.dist version.h; fi)
++
++### The directory environment:
++
++# Use package data if installed...otherwise assume we're under the VDR source
directory:
++PKGCFG = $(if $(VDRDIR),$(shell pkg-config --variable=$(1) $(VDRDIR)/vdr.pc),$(shell
PKG_CONFIG_PATH="$$PKG_CONFIG_PATH:../../.." pkg-config --variable=$(1) vdr))
++LIBDIR = $(call PKGCFG,libdir)
++LOCDIR = $(call PKGCFG,locdir)
++PLGCFG = $(call PKGCFG,plgcfg)
++CFGDIR = $(call PKGCFG,configdir)
++#
++TMPDIR ?= /tmp
++DIRS = command plugin
++
++### The compiler options:
++export CFLAGS = $(call PKGCFG,cflags)
++export CXXFLAGS = $(call PKGCFG,cxxflags)
+
+-TMPDIR = /tmp
+ ARCHIVE = markad-$(VERSION)
+ PACKAGE = vdr-$(ARCHIVE)
+
++### The version number of VDR's plugin API:
++APIVERSION = $(call PKGCFG,apiversion)
++
++### Allow user defined options to overwrite defaults:
++-include $(PLGCFG)
++
++
+ all:
+ for i in $(DIRS); do $(MAKE) -C $$i; done
+
+diff --git a/README b/README
+index e380c4c..d0bba66 100644
+--- a/README
++++ b/README
+@@ -25,3 +25,17 @@ Command line options:
+ (default: /usr/bin)
+ -l DIR --logocachedir=DIR use DIR as location for markad logos
+ (default: /var/lib/markad)
++
++if you want to use the new decoder this are the recommended plugin default settings.
This parameters will pass through to the markad command:
++
++assume stop of the recording at the end of the EPG time. If end marks are to early, try
to add some seconds
++--astopoffs=0
++
++use the new decoder code
++--cDecoder
++
++put these lines into your markad plugin configuration, usually stored in
/etc/vdr/conf.d:
++
++[markad]
++--astopoffs=0
++--cDecoder
+diff --git a/command/Makefile b/command/Makefile
+index 6a445d0..6ad0009 100644
+--- a/command/Makefile
++++ b/command/Makefile
+@@ -10,17 +10,28 @@
+ $(shell GITVERSION=`git rev-parse --short HEAD 2> /dev/null`; if [
"$$GITVERSION" ]; then sed "s/\";/ ($$GITVERSION)\";/"
../version.dist > ../version.h; else cp ../version.dist ../version.h; fi)
+ VERSION = $(shell grep 'static const char \*VERSION *=' ../version.h | awk
'{ print $$6 }' | sed -e 's/[";]//g')
+
+-### The C++ compiler and options:
++# Use package data if installed...otherwise assume we're under the VDR source
directory:
++PKGCFG = $(if $(VDRDIR),$(shell pkg-config --variable=$(1) $(VDRDIR)/vdr.pc),$(shell
PKG_CONFIG_PATH="$$PKG_CONFIG_PATH:../../../.." pkg-config --variable=$(1)
vdr))
++LIBDIR = $(call PKGCFG,libdir)
++LOCDIR = $(call PKGCFG,locdir)
++PLGCFG = $(call PKGCFG,plgcfg)
++CFGDIR = $(call PKGCFG,configdir)
+
++### The C++ compiler and options:
CXX ?= g++
- export CXXFLAGS ?= $(call PKGCFG,cxxflags)
- export CXXFLAGS ?= -g -rdynamic -O3 -funroll-loops -Wall -Wextra -Woverloaded-virtual
-Wno-parentheses
--export CXXFLAGS += -std=c++11 # to prevent a lot of compiler warnings with Ubuntu
14.04
-+CXXVERION=$(shell $(CXX) -dumpversion)
-+ifeq ($(CXXVERION),4.8)
-+export CXXFLAGS += -std=c++11 # to prevent a lot of compiler warnings with Ubuntu
14.04
+-CXXFLAGS ?= -g -rdynamic -O3 -funroll-loops -Wall -Wextra -Woverloaded-virtual
-Wno-parentheses
++export CXXFLAGS ?= $(call PKGCFG,cxxflags)
++export CXXFLAGS ?= -g -rdynamic -O3 -funroll-loops -Wall -Wextra -Woverloaded-virtual
-Wno-parentheses
++CXXVERION=$(shell $(CXX) -dumpversion | cut -d"." -f1)
++ifeq ($(CXXVERION),4)
++export CXXFLAGS += -std=c++11 # to prevent a lot of compiler warnings with g++ V4
+endif
- #
++#
PKG-CONFIG ?= pkg-config
STRIP ?= strip
### Includes and Defines (add further entries here):
+-
-PKG-LIBS += libavcodec libavutil
-PKG-INCLUDES += libavcodec libavutil
+PKG-LIBS += libavcodec libavutil libavformat
@@ -195,19 +116,57 @@ diff -u --new-file '--exclude=version.h' a/command/Makefile
b/command/Makefile
DEFINES += -D_GNU_SOURCE
DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
-@@ -44,7 +47,7 @@
+@@ -36,7 +47,7 @@ LIBS += $(shell $(PKG-CONFIG) --libs $(PKG-LIBS)) -pthread
### The object files (add further files here):
--OBJS = markad-standalone.o decoder.o marks.o streaminfo.o video.o audio.o demux.o
+-OBJS = markad-standalone.o decoder.o marks.o streaminfo.o video.o audio.o demux.o
+OBJS = markad-standalone.o decoder.o marks.o streaminfo.o video.o audio.o demux.o
decoder_new.o
### The main target:
-diff -u --new-file '--exclude=version.h' a/command/audio.cpp b/command/audio.cpp
---- a/command/audio.cpp 2020-01-11 10:19:55.231477591 +0000
-+++ b/command/audio.cpp 2020-01-11 12:26:37.607880056 +0000
-@@ -36,7 +36,7 @@
+@@ -59,9 +70,9 @@ $(DEPFILE): Makefile
+ ### Internationalization (I18N):
+
+ PODIR = po
+-LOCALEDIR = $(DESTDIR)/usr/share/locale
++LOCALEDIR = /usr/share/locale
+ I18Npo = $(wildcard $(PODIR)/*.po)
+-I18Nmsgs = $(addprefix $(LOCALEDIR)/, $(addsuffix /LC_MESSAGES/markad.mo, $(notdir
$(foreach file, $(I18Npo), $(basename $(file))))))
++I18Nmsgs = $(addprefix $(DESTDIR)$(LOCALEDIR)/, $(addsuffix /LC_MESSAGES/markad.mo,
$(notdir $(foreach file, $(I18Npo), $(basename $(file))))))
+ I18Npot = $(PODIR)/markad.pot
+
+ %.mo: %.po
+@@ -74,9 +85,8 @@ $(I18Npot): $(wildcard *.cpp *.h)
+ msgmerge -U --no-wrap --no-location --backup=none -q $@ $<
+ @touch $@
+
+-$(I18Nmsgs): $(LOCALEDIR)/%/LC_MESSAGES/markad.mo: $(PODIR)/%.mo
+- @mkdir -p $(dir $@)
+- cp $< $@
++$(I18Nmsgs): $(DESTDIR)$(LOCALEDIR)/%/LC_MESSAGES/markad.mo: $(PODIR)/%.mo
++ install -D -m644 $< $@
+
+ .PHONY: i18n
+ i18n: $(I18Npot)
+@@ -94,10 +104,9 @@ install-doc:
+
+ install: install-doc markad $(I18Nmsgs)
+ @mkdir -p $(DESTDIR)/usr/bin
+- @cp --remove-destination markad $(DESTDIR)/usr/bin/markad
+- @$(STRIP) $(DESTDIR)/usr/bin/markad
++ install -D markad $(DESTDIR)/usr/bin/markad
+ @mkdir -p $(DESTDIR)/var/lib/markad
+- @cp -u logos/* $(DESTDIR)/var/lib/markad
++ install -D logos/* $(DESTDIR)/var/lib/markad
+ @echo markad installed
+
+ clean:
+diff --git a/command/audio.cpp b/command/audio.cpp
+index 1af0823..c88f902 100644
+--- a/command/audio.cpp
++++ b/command/audio.cpp
+@@ -36,7 +36,7 @@ void cMarkAdAudio::Clear()
void cMarkAdAudio::resetmark()
{
if (!mark.Type) return;
@@ -216,9 +175,10 @@ diff -u --new-file '--exclude=version.h' a/command/audio.cpp
b/command/audio.cpp
}
void cMarkAdAudio::setmark(int type, int position, int channelsbefore, int
channelsafter)
-diff -u --new-file '--exclude=version.h' a/command/decoder.cpp
b/command/decoder.cpp
---- a/command/decoder.cpp 2020-01-11 12:26:37.519879170 +0000
-+++ b/command/decoder.cpp 2020-01-11 12:26:37.607880056 +0000
+diff --git a/command/decoder.cpp b/command/decoder.cpp
+index 6400aa7..2203448 100644
+--- a/command/decoder.cpp
++++ b/command/decoder.cpp
@@ -14,6 +14,8 @@
#include <cstdlib>
@@ -228,14 +188,229 @@ diff -u --new-file '--exclude=version.h'
a/command/decoder.cpp b/command/decoder
#ifndef DECLARE_ALIGNED
#define DECLARE_ALIGNED(n,t,v) t v __attribute__ ((aligned (n)))
-@@ -544,3 +546,4 @@
+@@ -103,18 +105,18 @@ fail:
+ #endif
+
+ #if LIBAVCODEC_VERSION_INT < ((55<<16)+(18<<8)+102)
+-#ifndef AV_CODEC_ID_H264
+-#define AV_CODEC_ID_H264 CODEC_ID_H264
+-#endif
+-#ifndef AV_CODEC_ID_MPEG2VIDEO
+-#define AV_CODEC_ID_MPEG2VIDEO CODEC_ID_MPEG2VIDEO
+-#endif
+-#ifndef AV_CODEC_ID_MPEG2VIDEO_XVMC
+-#define AV_CODEC_ID_MPEG2VIDEO_XVMC CODEC_ID_MPEG2VIDEO_XVMC
+-#endif
+-#ifndef AV_CODEC_ID_NONE
+-#define AV_CODEC_ID_NONE CODEC_ID_NONE
+-#endif
++ #ifndef AV_CODEC_ID_H264
++ #define AV_CODEC_ID_H264 CODEC_ID_H264
++ #endif
++ #ifndef AV_CODEC_ID_MPEG2VIDEO
++ #define AV_CODEC_ID_MPEG2VIDEO CODEC_ID_MPEG2VIDEO
++ #endif
++ #ifndef AV_CODEC_ID_MPEG2VIDEO_XVMC
++ #define AV_CODEC_ID_MPEG2VIDEO_XVMC CODEC_ID_MPEG2VIDEO_XVMC
++ #endif
++ #ifndef AV_CODEC_ID_NONE
++ #define AV_CODEC_ID_NONE CODEC_ID_NONE
++ #endif
+ #endif
+
+ cMarkAdDecoder::cMarkAdDecoder(bool useH264, int Threads)
+@@ -122,7 +124,9 @@ cMarkAdDecoder::cMarkAdDecoder(bool useH264, int Threads)
+ #if LIBAVCODEC_VERSION_INT < ((53<<16)+(7<<8)+1)
+ avcodec_init();
+ #endif
++#if LIBAVCODEC_VERSION_INT < ((58<<16)+(35<<8)+100)
+ avcodec_register_all();
++#endif
+
+ last_qscale_table=NULL;
+ skipframes=true;
+@@ -180,16 +184,21 @@ cMarkAdDecoder::cMarkAdDecoder(bool useH264, int Threads)
+ }
+ else
+ {
++#if LIBAVCODEC_VERSION_INT >= ((58<<16)+(35<<8)+100)
++ video_codecid=AV_CODEC_ID_MPEG2VIDEO;
++#else
+ video_codecid=AV_CODEC_ID_MPEG2VIDEO_XVMC;
++#endif
+ }
+-
+ video_codec = avcodec_find_decoder(video_codecid);
++#if LIBAVCODEC_VERSION_INT < ((58<<16)+(35<<8)+100)
+ if ((!video_codec) && (video_codecid==AV_CODEC_ID_MPEG2VIDEO_XVMC))
+ {
+ // fallback to MPEG2VIDEO
+ video_codecid=AV_CODEC_ID_MPEG2VIDEO;
+ video_codec=avcodec_find_decoder(video_codecid);
+ }
++#endif
+
+ if (video_codec)
+ {
+@@ -200,17 +209,28 @@ cMarkAdDecoder::cMarkAdDecoder(bool useH264, int Threads)
+ #endif
+ if (video_context)
+ {
++#if LIBAVCODEC_VERSION_INT >= ((58<<16)+(35<<8)+100)
++ if (video_codec->capabilities & AV_CODEC_CAP_TRUNCATED)
++ video_context->flags|=AV_CODEC_FLAG_TRUNCATED; // we do not send
complete frames
++ video_context->flags|=AV_CODEC_FLAG_LOW_DELAY;
++ video_context->flags2|=AV_CODEC_FLAG2_FAST; // really?
++#else
+ if (video_codec->capabilities & CODEC_CAP_TRUNCATED)
+ video_context->flags|=CODEC_FLAG_TRUNCATED; // we do not send
complete frames
+ video_context->flags|=CODEC_FLAG_LOW_DELAY;
+ video_context->flags2|=CODEC_FLAG2_FAST; // really?
++#endif
+ video_context->skip_idct=AVDISCARD_ALL;
+
+ if (video_codecid!=AV_CODEC_ID_H264)
+ {
+ video_context->skip_frame=AVDISCARD_NONKEY; // just I-frames
+ } else {
++#if LIBAVCODEC_VERSION_INT >= ((58<<16)+(35<<8)+100)
++ video_context->flags2|=AV_CODEC_FLAG2_CHUNKS;
++#else
+ video_context->flags2|=CODEC_FLAG2_CHUNKS;
++#endif
+ #if LIBAVCODEC_VERSION_INT >= ((52<<16)+(47<<8)+0)
+ av_log_set_level(AV_LOG_FATAL); // silence decoder output
+ #else
+@@ -224,6 +244,7 @@ cMarkAdDecoder::cMarkAdDecoder(bool useH264, int Threads)
+ #else
+ int ret=avcodec_open(video_context, video_codec);
+ #endif
++#if LIBAVCODEC_VERSION_INT < ((58<<16)+(35<<8)+100)
+ if ((ret < 0) && (video_codecid==AV_CODEC_ID_MPEG2VIDEO_XVMC))
+ {
+ // fallback to MPEG2VIDEO
+@@ -234,21 +255,22 @@ cMarkAdDecoder::cMarkAdDecoder(bool useH264, int Threads)
+ video_context->codec_type=AVMEDIA_TYPE_UNKNOWN;
+ video_context->codec_id=AV_CODEC_ID_NONE;
+ video_context->codec_tag=0;
+-#if (LIBAVCODEC_VERSION_MAJOR < 57)
++ #if LIBAVCODEC_VERSION_INT < ((56<<16)+(26<<8)+100)
+
memset(video_context->codec_name,0,sizeof(video_context->codec_name));
+-#endif
+-#if LIBAVCODEC_VERSION_INT >= ((53<<16)+(5<<8)+0)
++ #endif
++ #if LIBAVCODEC_VERSION_INT >= ((53<<16)+(5<<8)+0)
+ video_context->thread_count=threadcount;
+ ret=avcodec_open2(video_context, video_codec, NULL);
+-#else
++ #else
+ ret=avcodec_open(video_context, video_codec);
+-#endif
++ #endif
+ }
+ else
+ {
+ ret=-1;
+ }
+ }
++#endif
+ if (ret < 0)
+ {
+ switch (video_codecid)
+@@ -256,9 +278,11 @@ cMarkAdDecoder::cMarkAdDecoder(bool useH264, int Threads)
+ case AV_CODEC_ID_H264:
+ esyslog("could not open codec for H264");
+ break;
++#if LIBAVCODEC_VERSION_INT < ((58<<16)+(35<<8)+100)
+ case AV_CODEC_ID_MPEG2VIDEO_XVMC:
+ esyslog("could not open codec MPEG2 (XVMC)");
+ break;
++#endif
+ case AV_CODEC_ID_MPEG2VIDEO:
+ esyslog("could not open codec MPEG2");
+ break;
+@@ -322,8 +346,10 @@ cMarkAdDecoder::cMarkAdDecoder(bool useH264, int Threads)
+ case AV_CODEC_ID_H264:
+ esyslog("codec for H264 not found");
+ break;
++#if LIBAVCODEC_VERSION_INT < ((58<<16)+(35<<8)+100)
+ case AV_CODEC_ID_MPEG2VIDEO_XVMC:
+ esyslog("codec for MPEG2 (XVMC) not found");
++#endif
+ break;
+ case AV_CODEC_ID_MPEG2VIDEO:
+ esyslog("codec for MPEG2 not found");
+@@ -361,7 +387,28 @@ bool cMarkAdDecoder::Clear()
+ #endif
+ if (dest)
+ {
++#if LIBAVCODEC_VERSION_INT >= ((57<<16)+(107<<8)+100)
++ AVCodecParameters *par = avcodec_parameters_alloc();
++ int rc = avcodec_parameters_from_context(par,video_context);
++ if ( rc < 0 ) {
++ esyslog("ERROR (%s,%d): avcodec_parameters_from_context() failed
rc=%d", __FILE__, __LINE__, rc);
++ ret = false;
++ }
++ else {
++ rc = avcodec_parameters_to_context(dest,par);
++ if ( rc < 0) {
++ esyslog("ERROR (%s,%d): avcodec_parameters_to_context() failed
rc=%d", __FILE__, __LINE__, rc);
++ ret = false;
++ }
++ }
++ avcodec_parameters_free(&par);
++ dest->skip_frame=video_context->skip_frame;
++ dest->flags=video_context->flags;
++ dest->flags2=video_context->flags2;
++ dest->skip_idct=video_context->skip_idct;
++#else
+ if (avcodec_copy_context(dest,video_context)!=0) ret=false;
++#endif
+ }
+ else
+ {
+@@ -453,11 +500,27 @@ bool cMarkAdDecoder::DecodeVideo(MarkAdContext *maContext,uchar
*pkt, int plen)
+ while (avpkt.size>0)
+ {
+ #if LIBAVCODEC_VERSION_INT < ((52<<16)+(25<<8)+0)
+- len=avcodec_decode_video(video_context,video_frame,&video_frame_ready,
+- avpkt.data,avpkt.size);
++
len=avcodec_decode_video(video_context,video_frame,&video_frame_ready,avpkt.data,avpkt.size);
++#elif LIBAVCODEC_VERSION_INT < ((57<<16)+(107<<8)+100)
++
len=avcodec_decode_video2(video_context,video_frame,&video_frame_ready,&avpkt);
+ #else
+- len=avcodec_decode_video2(video_context,video_frame,&video_frame_ready,
+- &avpkt);
++ len=avcodec_send_packet(video_context,&avpkt);
++ if (len < 0) {
++ if (len == AVERROR(EAGAIN)) dsyslog("avcodec_send_packet error
EAGAIN");
++ if (len == AVERROR(ENOMEM)) dsyslog("avcodec_send_packet error
ENOMEM");
++ if (len == AVERROR(EINVAL)) dsyslog("avcodec_send_packet error
EINVAL");
++ if (len != AVERROR_INVALIDDATA) { // this is normal at the start of the
file
++ esyslog("avcodec_send_packet failed with rc=%i",len);
++ }
++ }
++ len = avcodec_receive_frame(video_context,video_frame);
++ if (len < 0) {
++ if (len == AVERROR(EINVAL)) dsyslog("avcodec_receive_frame error
EINVAL");
++ if (len == AVERROR(EAGAIN)) len=0;
++ }
++ else {
++ video_frame_ready = true;
++ }
+ #endif
+ if (len<0)
+ {
+@@ -483,3 +546,4 @@ bool cMarkAdDecoder::DecodeVideo(MarkAdContext *maContext,uchar *pkt,
int plen)
if (ret) addPkt=false;
return ret;
}
+
-diff -u --new-file '--exclude=version.h' a/command/decoder_new.cpp
b/command/decoder_new.cpp
---- a/command/decoder_new.cpp 1970-01-01 00:00:00.000000000 +0000
-+++ b/command/decoder_new.cpp 2020-01-11 12:28:38.837100097 +0000
+diff --git a/command/decoder_new.cpp b/command/decoder_new.cpp
+new file mode 100644
+index 0000000..fbca3e6
+--- /dev/null
++++ b/command/decoder_new.cpp
@@ -0,0 +1,475 @@
+#include "decoder_new.h"
+extern "C"{
@@ -712,9 +887,11 @@ diff -u --new-file '--exclude=version.h'
a/command/decoder_new.cpp b/command/dec
+ esyslog("cDecoder::GetTimeFromIFrame(): could not find time for frame
%li",iFrame);
+ return 0;
+}
-diff -u --new-file '--exclude=version.h' a/command/decoder_new.h
b/command/decoder_new.h
---- a/command/decoder_new.h 1970-01-01 00:00:00.000000000 +0000
-+++ b/command/decoder_new.h 2020-01-11 12:27:40.788516180 +0000
+diff --git a/command/decoder_new.h b/command/decoder_new.h
+new file mode 100644
+index 0000000..4b304ff
+--- /dev/null
++++ b/command/decoder_new.h
@@ -0,0 +1,67 @@
+#include <vector>
+#include "global.h"
@@ -726,7 +903,7 @@ diff -u --new-file '--exclude=version.h'
a/command/decoder_new.h b/command/decod
+#include <libavutil/file.h>
+}
+
-+#define CDECODERVERSION 59
++#define CDECODERVERSION 100
+#define MAXEAGAINERRORS 10
+
+class cDecoder
@@ -735,40 +912,40 @@ diff -u --new-file '--exclude=version.h'
a/command/decoder_new.h b/command/decod
+ cDecoder();
+ ~cDecoder();
+ bool DecodeDir(const char * recDir);
-+ void Reset();
++ void Reset();
+ bool DecodeFile(const char * filename);
+ int GetVideoHeight();
+ int GetVideoWidth();
+ int GetVideoFramesPerSecond();
-+ int GetVideoRealFrameRate();
++ int GetVideoRealFrameRate();
+ bool GetNextFrame();
-+ bool SeekToFrame(long int iFrame);
++ bool SeekToFrame(long int iFrame);
+ bool GetFrameInfo(MarkAdContext *maContext);
+ bool isVideoStream();
+ bool isVideoIFrame();
-+ bool isAudioStream();
-+ bool isAudioAC3Frame();
++ bool isAudioStream();
++ bool isAudioAC3Frame();
+ long int GetFrameNumber();
-+ long int GetIFrameCount();
-+ bool isInterlacedVideo();
-+ long int GetIFrameRangeCount(long int beginFrame, long int endFrame);
-+ long int GetIFrameBefore(long int iFrame);
++ long int GetIFrameCount();
++ bool isInterlacedVideo();
++ long int GetIFrameRangeCount(long int beginFrame, long int endFrame);
++ long int GetIFrameBefore(long int iFrame);
+ long int GetTimeFromIFrame(long int iFrame);
+
+ private:
-+ char *recordingDir=NULL;
++ char *recordingDir=NULL;
+ int fileNumber=0;
+ AVFormatContext *avctx = NULL;
+ AVPacket avpkt;
+ AVCodec *codec;
+ AVCodecContext *codecCtx;
-+ AVFrame *avFrame = NULL;
++ AVFrame *avFrame = NULL;
+ long int framenumber=-1;
+ long int iFrameCount=0;
-+ long int pts_time_ms_LastFile=0;
++ long int pts_time_ms_LastFile=0;
+ struct iFrameInfo
+ {
-+ int fileNumber=0;
++ int fileNumber=0;
+ long int iFrameNumber=0;
+ long int pts_time_ms=0;
+ };
@@ -778,15 +955,16 @@ diff -u --new-file '--exclude=version.h'
a/command/decoder_new.h b/command/decod
+ uchar *Plane[4]; // picture planes (YUV420)
+ int PlaneLinesize[4]; // size int bytes of each picture plane line
+ } iFrameData;
-+ bool msgDecodeFile=true;
-+ bool msgGetFrameInfo=true;
-+ int interlaced_frame=-1;
-+ bool stateEAGAIN=false;
++ bool msgDecodeFile=true;
++ bool msgGetFrameInfo=true;
++ int interlaced_frame=-1;
++ bool stateEAGAIN=false;
+};
-diff -u --new-file '--exclude=version.h' a/command/demux.cpp b/command/demux.cpp
---- a/command/demux.cpp 2020-01-11 10:19:55.231477591 +0000
-+++ b/command/demux.cpp 2020-01-11 12:26:37.607880056 +0000
-@@ -648,6 +648,7 @@
+diff --git a/command/demux.cpp b/command/demux.cpp
+index 0423f2c..ee17044 100644
+--- a/command/demux.cpp
++++ b/command/demux.cpp
+@@ -648,6 +648,7 @@ bool cTS2Pkt::Process(uchar *TSData, int TSSize, AvPacket *Pkt)
esyslog("sequence error %i->%i
(0x%04x)",counter,tshdr->Counter,pid);
}
Clear(Pkt);
@@ -794,48 +972,45 @@ diff -u --new-file '--exclude=version.h' a/command/demux.cpp
b/command/demux.cpp
skipped+=queue->Skipped();
if (!tshdr->PayloadStart)
{
-diff -u --new-file '--exclude=version.h' a/command/global.h b/command/global.h
---- a/command/global.h 2020-01-11 10:19:55.231477591 +0000
-+++ b/command/global.h 2020-01-11 12:26:37.607880056 +0000
-@@ -29,25 +29,29 @@
+diff --git a/command/global.h b/command/global.h
+index 311d25b..957c651 100644
+--- a/command/global.h
++++ b/command/global.h
+@@ -29,25 +29,29 @@ typedef unsigned char uchar;
#define MT_ASSUMEDSTART (unsigned char) 0x11
#define MT_ASSUMEDSTOP (unsigned char) 0x12
-#define MT_LOGOCHANGE (unsigned char) 0x20
-#define MT_LOGOSTART (unsigned char) 0x21
-#define MT_LOGOSTOP (unsigned char) 0x22
--
--#define MT_HBORDERCHANGE (unsigned char) 0x30
--#define MT_HBORDERSTART (unsigned char) 0x31
--#define MT_HBORDERSTOP (unsigned char) 0x32
--
--#define MT_VBORDERCHANGE (unsigned char) 0x40
--#define MT_VBORDERSTART (unsigned char) 0x41
--#define MT_VBORDERSTOP (unsigned char) 0x42
--
--#define MT_ASPECTCHANGE (unsigned char) 0x50
--#define MT_ASPECTSTART (unsigned char) 0x51
--#define MT_ASPECTSTOP (unsigned char) 0x52
--
--#define MT_CHANNELCHANGE (unsigned char) 0x60
--#define MT_CHANNELSTART (unsigned char) 0x61
--#define MT_CHANNELSTOP (unsigned char) 0x62
+#define MT_BLACKCHANGE (unsigned char) 0x20
+#define MT_NOBLACKSTART (unsigned char) 0x21
+#define MT_NOBLACKSTOP (unsigned char) 0x22
-+
+
+-#define MT_HBORDERCHANGE (unsigned char) 0x30
+-#define MT_HBORDERSTART (unsigned char) 0x31
+-#define MT_HBORDERSTOP (unsigned char) 0x32
+#define MT_LOGOCHANGE (unsigned char) 0x30
+#define MT_LOGOSTART (unsigned char) 0x31
+#define MT_LOGOSTOP (unsigned char) 0x32
-+
+
+-#define MT_VBORDERCHANGE (unsigned char) 0x40
+-#define MT_VBORDERSTART (unsigned char) 0x41
+-#define MT_VBORDERSTOP (unsigned char) 0x42
+#define MT_HBORDERCHANGE (unsigned char) 0x40
+#define MT_HBORDERSTART (unsigned char) 0x41
+#define MT_HBORDERSTOP (unsigned char) 0x42
-+
+
+-#define MT_ASPECTCHANGE (unsigned char) 0x50
+-#define MT_ASPECTSTART (unsigned char) 0x51
+-#define MT_ASPECTSTOP (unsigned char) 0x52
+#define MT_VBORDERCHANGE (unsigned char) 0x50
+#define MT_VBORDERSTART (unsigned char) 0x51
+#define MT_VBORDERSTOP (unsigned char) 0x52
-+
+
+-#define MT_CHANNELCHANGE (unsigned char) 0x60
+-#define MT_CHANNELSTART (unsigned char) 0x61
+-#define MT_CHANNELSTOP (unsigned char) 0x62
+#define MT_ASPECTCHANGE (unsigned char) 0x60
+#define MT_ASPECTSTART (unsigned char) 0x61
+#define MT_ASPECTSTOP (unsigned char) 0x62
@@ -846,7 +1021,7 @@ diff -u --new-file '--exclude=version.h' a/command/global.h
b/command/global.h
#define MT_RECORDINGSTART (unsigned char) 0xD1
#define MT_RECORDINGSTOP (unsigned char) 0xD2
-@@ -68,6 +72,9 @@
+@@ -68,6 +72,9 @@ typedef struct config
int svdrpport;
int threads;
int astopoffs;
@@ -856,7 +1031,7 @@ diff -u --new-file '--exclude=version.h' a/command/global.h
b/command/global.h
bool DecodeVideo;
bool DecodeAudio;
-@@ -88,16 +95,16 @@
+@@ -88,16 +95,16 @@ typedef struct MarkAdPos
typedef struct MarkAdAspectRatio
{
@@ -879,7 +1054,7 @@ diff -u --new-file '--exclude=version.h' a/command/global.h
b/command/global.h
MarkAdAspectRatio AspectRatioBefore;
MarkAdAspectRatio AspectRatioAfter;
} MarkAdMark;
-@@ -116,12 +123,13 @@
+@@ -116,12 +123,13 @@ typedef struct MarkAdMarks
typedef struct MarkAdPid
{
@@ -895,7 +1070,7 @@ diff -u --new-file '--exclude=version.h' a/command/global.h
b/command/global.h
const MarkAdConfig *Config;
struct Info
-@@ -141,6 +149,7 @@
+@@ -141,6 +149,7 @@ typedef struct MarkAdContext
struct Options
{
bool IgnoreAspectRatio;
@@ -903,7 +1078,7 @@ diff -u --new-file '--exclude=version.h' a/command/global.h
b/command/global.h
bool IgnoreLogoDetection;
bool WeakMarksOk;
} Options;
-@@ -153,7 +162,7 @@
+@@ -153,7 +162,7 @@ typedef struct MarkAdContext
int Pix_Fmt; // Pixel format (see libavutil/pixfmt.h)
MarkAdAspectRatio AspectRatio;
double FramesPerSecond;
@@ -912,9 +1087,10 @@ diff -u --new-file '--exclude=version.h' a/command/global.h
b/command/global.h
} Info;
struct Data
-diff -u --new-file '--exclude=version.h' a/command/markad-standalone.cpp
b/command/markad-standalone.cpp
---- a/command/markad-standalone.cpp 2020-01-11 12:26:37.339877356 +0000
-+++ b/command/markad-standalone.cpp 2020-01-11 12:26:37.607880056 +0000
+diff --git a/command/markad-standalone.cpp b/command/markad-standalone.cpp
+index edd5dd7..43e1264 100644
+--- a/command/markad-standalone.cpp
++++ b/command/markad-standalone.cpp
@@ -36,6 +36,7 @@
bool SYSLOG=false;
@@ -923,16 +1099,21 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
cMarkAdStandalone *cmasta=NULL;
int SysLogLevel=2;
-@@ -78,7 +79,7 @@
+@@ -73,11 +74,12 @@ void syslog_with_tid(int priority, const char *format, ...)
+ }
+ else
+ {
+- char buf[255]={0};
++ char buf[27]={0};
+ const time_t now=time(NULL);
if (ctime_r(&now,buf)) {
buf[strlen(buf)-6]=0;
}
-- else dsyslog("ctime_r failed");
+ else dsyslog("ctime_r failed");
char fmt[255];
snprintf(fmt, sizeof(fmt), "%s%s [%d] %s", LOG2REC ?
"":"markad: ",buf, getpid(), format);
va_start(ap, format);
-@@ -233,41 +234,112 @@
+@@ -232,41 +234,112 @@ void cMarkAdStandalone::CalculateCheckPositions(int startframe)
if (!startframe) return;
if (!macontext.Video.Info.FramesPerSecond) return;
@@ -989,7 +1170,7 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
+ end=marks.GetAround(3*delta,iStopA,MT_HBORDERSTOP); // try
MT_HBORDERSTOP
+ if (!end) {
+ dsyslog("no MT_HBORDERSTOP mark found");
-+ end=marks.GetAround(delta,iStopA,MT_LOGOSTOP); // try
MT_LOGOSTOP
++ end=marks.GetAround(3*delta,iStopA+delta,MT_LOGOSTOP); // try
MT_LOGOSTOP
+ if (!end) {
+ dsyslog("no MT_LOGOSTOP mark found");
+ end=marks.GetAround(3*delta,iStopA,MT_STOP,0x0F); // try any type
of stop mark
@@ -1063,7 +1244,7 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
}
else
{
-@@ -281,8 +353,21 @@
+@@ -280,8 +353,21 @@ void cMarkAdStandalone::CheckStop()
void cMarkAdStandalone::CheckStart()
{
@@ -1086,7 +1267,7 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
if ((macontext.Info.Channels) && (macontext.Audio.Info.Channels) &&
(macontext.Info.Channels!=macontext.Audio.Info.Channels))
-@@ -332,8 +417,19 @@
+@@ -331,8 +417,19 @@ void cMarkAdStandalone::CheckStart()
macontext.Video.Options.IgnoreLogoDetection=true;
marks.Del(MT_ASPECTSTART);
marks.Del(MT_ASPECTSTOP);
@@ -1101,14 +1282,14 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
+ dsyslog("found horizontal border and add this as assumed start
(%i)",begin->position);
+ MarkAdMark mark={};
+ mark.Position=begin->position;
-+ mark.Type=MT_ASSUMEDSTART;
++ mark.Type=MT_RECORDINGSTART;
+ AddMark(&mark);
+ }
+ }
}
else
{
-@@ -384,8 +480,28 @@
+@@ -383,8 +480,28 @@ void cMarkAdStandalone::CheckStart()
macontext.Video.Options.IgnoreLogoDetection=true;
marks.Del(MT_CHANNELSTART);
marks.Del(MT_CHANNELSTOP);
@@ -1117,8 +1298,8 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
+ // start mark must be around iStartA
+
begin=marks.GetAround(macontext.Video.Info.FramesPerSecond*(MAXRANGE*4),iStartA,MT_ASPECTSTART);
+ if (begin) {
-+ dsyslog("MT_ASPECTSTART found at (%i)",begin->position);
-+ if (begin->position < abs(iStartA)/4) { // this is not a valid start,
try if there is better start mark
++ dsyslog("MT_ASPECTSTART found at (%i)",begin->position);
++ if (begin->position < abs(iStartA)/4) { // this is not a valid
start, try if there is better start mark
+ clMark
*begin2=marks.GetAround(iStartA,iStartA+delta,MT_START,0x0F);
+ if (begin2) {
+ begin2->type=MT_ASSUMEDSTART; // most types of marks will be
deleted if we do aspect ratio detecetion
@@ -1126,7 +1307,7 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
+ begin=begin2;
+ }
+ }
-+ }
++ }
+ else {
+ dsyslog("no MT_ASPECTSTART found"); // previous is 4:3 too,
try another start mark
+ clMark *begin2=marks.GetAround(iStartA,iStartA+delta,MT_START,0x0F);
@@ -1139,7 +1320,7 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
}
}
-@@ -399,14 +515,55 @@
+@@ -398,14 +515,55 @@ void cMarkAdStandalone::CheckStart()
marks.Del(MT_VBORDERSTART);
marks.Del(MT_VBORDERSTOP);
}
@@ -1163,8 +1344,7 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
+ }
+ }
+ }
-
-- if (!begin)
++
+ if (!begin) { // try logo start mark
+ clMark *lStart=marks.GetAround(iStartA+delta,iStartA+delta,MT_LOGOSTART);
+ if (!lStart) {
@@ -1184,7 +1364,8 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
+ }
+ }
+ }
-+
+
+- if (!begin)
+ if (!begin) // try anything
{
-
begin=marks.GetAround(macontext.Video.Info.FramesPerSecond*(MAXRANGE*2),iStart,MT_START,0x0F);
@@ -1198,7 +1379,7 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
if (begin2->type==MT_ASPECTSTART) {
// special case, only take this mark if aspectratio is 4:3
if ((macontext.Video.Info.AspectRatio.Num==4) &&
-@@ -415,34 +572,91 @@
+@@ -414,34 +572,91 @@ void cMarkAdStandalone::CheckStart()
begin=begin2;
}
} else {
@@ -1208,17 +1389,17 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
+ isyslog("mark on position (%i) stronger than mark on
position (%i) as start mark",begin2->position,begin->position);
+ begin=begin2;
+ }
-+ }
-+ }
-+ }
+ }
+ }
+ }
+ if (begin->type == MT_NOBLACKSTART) { // this is weak, check if there is
a better logo mark
+ clMark
*begin3=marks.GetAround(iStartA+delta,iStartA+delta,MT_LOGOSTART);
+ if (begin3) {
+ if (begin3->position > iStartA/4) {
+ isyslog("mark on position (%i) stronger than mark on
position (%i) as start mark",begin3->position,begin->position);
+ begin=begin3;
- }
- }
++ }
++ }
+ else { // if there is no logo start mark and we do not use logo
detection after start, use blackscreen mark only if it is not to late
+ if (!bDecodeVideo && (begin->position > (iStartA +
macontext.Video.Info.FramesPerSecond*2*MAXRANGE))) { // we are lost, use startframe as
start mark
+ dsyslog("start of black screen to late (%i) setting start to
startframe (%i)", begin->position, iStart);
@@ -1238,7 +1419,7 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
+ dsyslog("changing start position from (%i) to next start mark
(%i)", begin->position, begin4->position);
+ begin=begin4;
+ }
- }
++ }
}
}
if (begin)
@@ -1297,7 +1478,7 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
mark.Position=iStart;
mark.Type=MT_ASSUMEDSTART;
AddMark(&mark);
-@@ -452,19 +666,71 @@
+@@ -451,19 +666,71 @@ void cMarkAdStandalone::CheckStart()
return;
}
@@ -1375,7 +1556,7 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
clMark *tmp=mark;
mark=mark->Next()->Next();
marks.Del(tmp->Next());
-@@ -472,6 +738,13 @@
+@@ -471,6 +738,14 @@ void cMarkAdStandalone::CheckLogoMarks()
continue;
}
}
@@ -1384,12 +1565,13 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
+ if (marks.GetFirst()->position != mark->position) { // do not
delete start mark
+ dsyslog("deleting START mark at the end");
+ marks.Del(mark);
++ break;
+ }
+ }
mark=mark->Next();
}
}
-@@ -492,6 +765,12 @@
+@@ -491,6 +766,12 @@ void cMarkAdStandalone::AddMark(MarkAdMark *Mark)
case MT_ASSUMEDSTOP:
if (asprintf(&comment,"assuming stop (%i)",Mark->Position)==-1)
comment=NULL;
break;
@@ -1402,7 +1584,7 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
case MT_LOGOSTART:
if (asprintf(&comment,"detected logo start
(%i)*",Mark->Position)==-1) comment=NULL;
break;
-@@ -573,18 +852,16 @@
+@@ -572,18 +853,16 @@ void cMarkAdStandalone::AddMark(MarkAdMark *Mark)
}
}
@@ -1426,7 +1608,7 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
if (!macontext.Video.Options.WeakMarksOk) inBroadCast=false;
marks.Del(prev);
if (comment) free(comment);
-@@ -592,9 +869,26 @@
+@@ -591,9 +870,26 @@ void cMarkAdStandalone::AddMark(MarkAdMark *Mark)
}
}
}
@@ -1455,12 +1637,12 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
{
clMark *prev=marks.GetPrev(Mark->Position,(Mark->Type &
0xF0)|MT_START);
if (prev)
-@@ -602,17 +896,16 @@
+@@ -601,17 +897,16 @@ void cMarkAdStandalone::AddMark(MarkAdMark *Mark)
int MARKDIFF;
if ((Mark->Type & 0xF0)==MT_LOGOCHANGE)
{
- MARKDIFF=(int) (macontext.Video.Info.FramesPerSecond*180);
-+ MARKDIFF=(int) (macontext.Video.Info.FramesPerSecond*110);
++ MARKDIFF=(int) (macontext.Video.Info.FramesPerSecond*120);
}
else
{
@@ -1478,7 +1660,7 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
if (!macontext.Video.Options.WeakMarksOk) inBroadCast=false;
marks.Del(prev);
if (comment) free(comment);
-@@ -701,7 +994,7 @@
+@@ -700,7 +995,7 @@ void cMarkAdStandalone::CheckIndexGrowing()
dsyslog("slept too much");
return; // we already slept too much
}
@@ -1487,7 +1669,7 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
bool notenough=true;
do
{
-@@ -712,7 +1005,7 @@
+@@ -711,7 +1006,7 @@ void cMarkAdStandalone::CheckIndexGrowing()
}
return;
}
@@ -1496,7 +1678,7 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
int maxframes=statbuf.st_size/8;
if (maxframes<(framecnt+200))
{
-@@ -723,7 +1016,7 @@
+@@ -722,7 +1017,7 @@ void cMarkAdStandalone::CheckIndexGrowing()
if (time(NULL)>(startTime+(time_t) length))
{
// "old" recording
@@ -1505,7 +1687,7 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
return;
}
else
-@@ -740,7 +1033,7 @@
+@@ -739,7 +1034,7 @@ void cMarkAdStandalone::CheckIndexGrowing()
return;
}
}
@@ -1514,7 +1696,7 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
unsigned int sleeptime=WAITTIME;
time_t sleepstart=time(NULL);
double slepttime=0;
-@@ -813,7 +1106,7 @@
+@@ -812,7 +1107,7 @@ void cMarkAdStandalone::ChangeMarks(clMark **Mark1, clMark **Mark2,
MarkAdPos *N
free(buf);
save=true;
}
@@ -1523,7 +1705,7 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
}
bool cMarkAdStandalone::ProcessFile2ndPass(clMark **Mark1, clMark **Mark2,int Number,
off_t Offset,
-@@ -848,7 +1141,6 @@
+@@ -847,7 +1142,6 @@ bool cMarkAdStandalone::ProcessFile2ndPass(clMark **Mark1, clMark
**Mark2,int Nu
int actframe=Frame;
int framecounter=0;
int pframe=-1;
@@ -1531,7 +1713,7 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
MarkAdPos *pos=NULL;
while (framecounter<Frames)
-@@ -936,7 +1228,7 @@
+@@ -935,7 +1229,7 @@ bool cMarkAdStandalone::ProcessFile2ndPass(clMark **Mark1, clMark
**Mark2,int Nu
if (pframe!=lastiframe)
{
if (pn>mSTART)
pos=video->ProcessOverlap(lastiframe,Frames,(pn==mBEFORE),
@@ -1540,7 +1722,7 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
framecounter++;
}
if ((pos) && (pn==mAFTER))
-@@ -974,6 +1266,100 @@
+@@ -973,6 +1267,100 @@ bool cMarkAdStandalone::ProcessFile2ndPass(clMark **Mark1, clMark
**Mark2,int Nu
return true;
}
@@ -1641,7 +1823,7 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
void cMarkAdStandalone::Process2ndPass()
{
if (abort) return;
-@@ -998,13 +1384,17 @@
+@@ -997,13 +1385,17 @@ void cMarkAdStandalone::Process2ndPass()
clMark *p1=NULL,*p2=NULL;
if (marks.Count()<4) return; // we cannot do much without marks
@@ -1660,7 +1842,7 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
while ((p1) && (p2))
{
if (!infoheader)
-@@ -1015,25 +1405,31 @@
+@@ -1014,25 +1406,31 @@ void cMarkAdStandalone::Process2ndPass()
off_t offset;
int number,frame,iframes;
int frange=macontext.Video.Info.FramesPerSecond*120; // 40s + 80s
@@ -1706,7 +1888,7 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
p1=p2->Next();
if (p1)
{
-@@ -1046,6 +1442,7 @@
+@@ -1045,6 +1443,7 @@ void cMarkAdStandalone::Process2ndPass()
}
}
@@ -1714,7 +1896,7 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
bool cMarkAdStandalone::ProcessFile(int Number)
{
if (!directory) return false;
-@@ -1075,7 +1472,6 @@
+@@ -1074,7 +1473,6 @@ bool cMarkAdStandalone::ProcessFile(int Number)
}
int f=open(fbuf,O_RDONLY);
@@ -1722,7 +1904,7 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
if (f==-1) {
if (isTS) {
dsyslog("failed to open %05i.ts",Number);
-@@ -1084,13 +1480,14 @@
+@@ -1083,13 +1481,14 @@ bool cMarkAdStandalone::ProcessFile(int Number)
}
return false;
}
@@ -1738,7 +1920,7 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
again:
while ((dataread=read(f,data,datalen))>0)
{
-@@ -1183,13 +1580,17 @@
+@@ -1182,13 +1581,17 @@ again:
AddMark(&vmarks->Number[i]);
}
}
@@ -1759,7 +1941,7 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
if (lastiframe>chkSTOP) CheckStop();
}
pframe=lastiframe;
-@@ -1277,28 +1678,128 @@
+@@ -1276,28 +1679,128 @@ bool cMarkAdStandalone::Reset(bool FirstPass)
return ret;
}
@@ -1899,7 +2081,7 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
}
void cMarkAdStandalone::Process()
-@@ -1312,58 +1813,62 @@
+@@ -1311,58 +1814,62 @@ void cMarkAdStandalone::Process()
marks.CloseIndex(directory,isTS);
if (!abort)
{
@@ -2001,7 +2183,7 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
}
}
}
-@@ -1677,6 +2182,8 @@
+@@ -1676,6 +2183,8 @@ bool cMarkAdStandalone::CheckLogo()
int len=strlen(macontext.Info.ChannelName);
if (!len) return false;
@@ -2010,7 +2192,7 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
DIR *dir=opendir(macontext.Config->logoDirectory);
if (!dir) return false;
-@@ -1815,6 +2322,7 @@
+@@ -1814,6 +2323,7 @@ bool cMarkAdStandalone::LoadInfo()
}
}
}
@@ -2018,7 +2200,7 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
if (line) free(line);
if ((length) && (!bIgnoreTimerInfo) && (startTime))
-@@ -1827,9 +2335,10 @@
+@@ -1826,9 +2336,10 @@ bool cMarkAdStandalone::LoadInfo()
{
if (length+tStart>0)
{
@@ -2031,7 +2213,7 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
tStart=1;
}
else
-@@ -2216,7 +2725,7 @@
+@@ -2215,7 +2726,7 @@ cMarkAdStandalone::cMarkAdStandalone(const char *Directory, const
MarkAdConfig *
duplicate=false;
title[0]=0;
@@ -2040,7 +2222,7 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
macontext.Config=config;
bDecodeVideo=config->DecodeVideo;
-@@ -2370,7 +2879,7 @@
+@@ -2369,7 +2880,7 @@ cMarkAdStandalone::cMarkAdStandalone(const char *Directory, const
MarkAdConfig *
if (tStart>1) {
if (tStart<60) tStart=60;
@@ -2049,7 +2231,7 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
}
if (length) isyslog("broadcast length %im",length/60);
-@@ -2580,6 +3089,10 @@
+@@ -2579,6 +3090,10 @@ int usage(int svdrpport)
" port of a remote VDR for OSD messages\n"
" --astopoffs=<value> (default is 100)\n"
" assumed stop offset in seconds range from 0 to
240\n"
@@ -2060,7 +2242,7 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
"\ncmd: one of\n"
"- dummy-parameter if called
directly\n"
"after markad starts to analyze the
recording\n"
-@@ -2655,9 +3168,7 @@
+@@ -2654,9 +3169,7 @@ int main(int argc, char *argv[])
int online=0;
bool bPass2Only=false;
bool bPass1Only=false;
@@ -2071,7 +2253,7 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
// set defaults
config.DecodeVideo=true;
-@@ -2668,6 +3179,7 @@
+@@ -2667,6 +3180,7 @@ int main(int argc, char *argv[])
config.logoHeight=-1;
config.threads=-1;
config.astopoffs=100;
@@ -2079,7 +2261,7 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
strcpy(config.svdrphost,"127.0.0.1");
strcpy(config.logoDirectory,"/var/lib/markad");
-@@ -2688,8 +3200,7 @@
+@@ -2687,8 +3201,7 @@ int main(int argc, char *argv[])
int option_index = 0;
static struct option long_options[] =
{
@@ -2089,7 +2271,7 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
{"background", 0, 0, 'b'},
{"comments", 0, 0, 'c'},
{"disable", 1, 0, 'd'},
-@@ -2705,6 +3216,8 @@
+@@ -2704,6 +3217,8 @@ int main(int argc, char *argv[])
{"asd",0,0,6},
{"astopoffs",1,0,12},
@@ -2098,7 +2280,7 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
{"loglevel",1,0,2},
{"markfile",1,0,1},
{"nopid",0,0,5},
-@@ -2866,8 +3379,10 @@
+@@ -2865,8 +3380,10 @@ int main(int argc, char *argv[])
// --extractlogo
str=optarg;
ntok=0;
@@ -2110,7 +2292,7 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
switch (ntok)
{
case 0:
-@@ -3028,6 +3543,22 @@
+@@ -3027,6 +3544,22 @@ int main(int argc, char *argv[])
}
break;
@@ -2133,7 +2315,7 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
default:
printf ("? getopt returned character code 0%o ? (option_index
%d)\n", c,option_index);
}
-@@ -3063,6 +3594,7 @@
+@@ -3062,6 +3595,7 @@ int main(int argc, char *argv[])
if ( strstr(argv[optind],".rec") != NULL )
{
recDir=realpath(argv[optind],NULL);
@@ -2141,7 +2323,7 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
}
}
optind++;
-@@ -3205,6 +3737,14 @@
+@@ -3204,6 +3738,14 @@ int main(int argc, char *argv[])
cmasta = new cMarkAdStandalone(recDir,&config);
if (!cmasta) return -1;
@@ -2156,10 +2338,11 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.cpp b/comma
if (!bPass2Only) cmasta->Process();
if (!bPass1Only) cmasta->Process2ndPass();
delete cmasta;
-diff -u --new-file '--exclude=version.h' a/command/markad-standalone.h
b/command/markad-standalone.h
---- a/command/markad-standalone.h 2020-01-11 10:19:55.243477710 +0000
-+++ b/command/markad-standalone.h 2020-01-11 12:26:37.611880096 +0000
-@@ -210,8 +210,10 @@
+diff --git a/command/markad-standalone.h b/command/markad-standalone.h
+index 2d1becc..ce7d879 100644
+--- a/command/markad-standalone.h
++++ b/command/markad-standalone.h
+@@ -210,8 +210,10 @@ unsigned Descriptor_Length:
int tStart; // pretimer in seconds
int iStart; // pretimer in frames (negative if unset)
int iStop; // endposition in frames (negative if unset)
@@ -2171,7 +2354,7 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.h b/command
void CheckStop();
void CheckStart();
-@@ -246,8 +248,10 @@
+@@ -246,8 +248,10 @@ unsigned Descriptor_Length:
bool SetFileUID(char *File);
bool RegenerateIndex();
bool ProcessFile2ndPass(clMark **Mark1, clMark **Mark2, int Number, off_t Offset,
int Frame, int Frames);
@@ -2182,9 +2365,10 @@ diff -u --new-file '--exclude=version.h'
a/command/markad-standalone.h b/command
public:
cMarkAdStandalone(const char *Directory, const MarkAdConfig *config);
~cMarkAdStandalone();
-diff -u --new-file '--exclude=version.h' a/command/marks.cpp b/command/marks.cpp
---- a/command/marks.cpp 2020-01-11 10:19:55.243477710 +0000
-+++ b/command/marks.cpp 2020-01-11 12:26:37.611880096 +0000
+diff --git a/command/marks.cpp b/command/marks.cpp
+index c6649ac..5a73795 100644
+--- a/command/marks.cpp
++++ b/command/marks.cpp
@@ -16,6 +16,11 @@
#include <fcntl.h>
@@ -2197,7 +2381,7 @@ diff -u --new-file '--exclude=version.h' a/command/marks.cpp
b/command/marks.cpp
clMark::clMark(int Type, int Position, const char *Comment)
{
-@@ -191,7 +196,12 @@
+@@ -191,7 +196,12 @@ clMark *clMarks::GetAround(int Frames, int Position, int Type, int
Mask)
clMark *m2=GetNext(Position,Type,Mask);
if (!m1 && !m2) return NULL;
@@ -2211,7 +2395,7 @@ diff -u --new-file '--exclude=version.h' a/command/marks.cpp
b/command/marks.cpp
if (m1 && !m2)
{
if (abs(Position-m1->position)>Frames) return NULL;
-@@ -200,10 +210,12 @@
+@@ -200,10 +210,12 @@ clMark *clMarks::GetAround(int Frames, int Position, int Type, int
Mask)
if (abs(m1->position-Position)>abs(m2->position-Position))
{
@@ -2225,7 +2409,7 @@ diff -u --new-file '--exclude=version.h' a/command/marks.cpp
b/command/marks.cpp
return m1;
}
}
-@@ -259,15 +271,19 @@
+@@ -259,15 +271,19 @@ clMark *clMarks::GetNext(int Position, int Type, int Mask)
clMark *clMarks::Add(int Type, int Position,const char *Comment)
{
@@ -2250,7 +2434,7 @@ diff -u --new-file '--exclude=version.h' a/command/marks.cpp
b/command/marks.cpp
return newmark;
}
-@@ -346,12 +362,19 @@
+@@ -346,12 +362,19 @@ clMark *clMarks::Add(int Type, int Position,const char *Comment)
return NULL;
}
@@ -2272,7 +2456,7 @@ diff -u --new-file '--exclude=version.h' a/command/marks.cpp
b/command/marks.cpp
int s = int(Seconds);
int m = s / 60 % 60;
int h = s / 3600;
-@@ -689,7 +712,7 @@
+@@ -689,7 +712,7 @@ bool clMarks::Load(const char *Directory, double FrameRate, bool
isTS)
return true;
}
@@ -2281,7 +2465,7 @@ diff -u --new-file '--exclude=version.h' a/command/marks.cpp
b/command/marks.cpp
{
if (!first) return false;
if ((savedcount==count) && (!Force)) return false;
-@@ -709,7 +732,7 @@
+@@ -709,7 +732,7 @@ bool clMarks::Save(const char *Directory, double FrameRate, bool
isTS, bool Forc
clMark *mark=first;
while (mark)
{
@@ -2290,9 +2474,10 @@ diff -u --new-file '--exclude=version.h'
a/command/marks.cpp b/command/marks.cpp
if (buf)
{
fprintf(mf,"%s %s\n",buf,mark->comment ? mark->comment :
"");
-diff -u --new-file '--exclude=version.h' a/command/marks.h b/command/marks.h
---- a/command/marks.h 2020-01-11 12:26:37.339877356 +0000
-+++ b/command/marks.h 2020-01-11 12:26:37.611880096 +0000
+diff --git a/command/marks.h b/command/marks.h
+index 18e6cc4..1d396c3 100644
+--- a/command/marks.h
++++ b/command/marks.h
@@ -9,6 +9,8 @@
#define __marks_h_
@@ -2302,7 +2487,7 @@ diff -u --new-file '--exclude=version.h' a/command/marks.h
b/command/marks.h
class clMark
{
-@@ -69,7 +71,7 @@
+@@ -69,7 +71,7 @@ uint16_t number:
char filename[1024];
clMark *first,*last;
@@ -2311,7 +2496,18 @@ diff -u --new-file '--exclude=version.h' a/command/marks.h
b/command/marks.h
int count;
int savedcount;
int indexfd;
-@@ -114,7 +116,7 @@
+@@ -89,8 +91,9 @@ public:
+ {
+ if (FileName)
+ {
+- strncpy(filename,FileName,sizeof(filename)-1);
++ strncpy(filename,FileName,sizeof(filename));
+ filename[sizeof(filename)-1]=0;
++
+ }
+ }
+ clMark *Add(int Type, int Position, const char *Comment = NULL);
+@@ -113,7 +116,7 @@ public:
}
bool Backup(const char *Directory, bool isTS);
bool Load(const char *Directory, double FrameRate, bool isTS);
@@ -2320,10 +2516,11 @@ diff -u --new-file '--exclude=version.h' a/command/marks.h
b/command/marks.h
#define IERR_NOTFOUND 1
#define IERR_TOOSHORT 2
#define IERR_SEEK 3
-diff -u --new-file '--exclude=version.h' a/command/video.cpp b/command/video.cpp
---- a/command/video.cpp 2020-01-11 10:19:55.247477749 +0000
-+++ b/command/video.cpp 2020-01-11 12:26:37.611880096 +0000
-@@ -49,11 +49,12 @@
+diff --git a/command/video.cpp b/command/video.cpp
+index 1bf3ec9..d6f5429 100644
+--- a/command/video.cpp
++++ b/command/video.cpp
+@@ -49,11 +49,12 @@ cMarkAdLogo::cMarkAdLogo(MarkAdContext *maContext)
LOGOHEIGHT=LOGO_DEFHDHEIGHT;
LOGOWIDTH=LOGO_DEFHDWIDTH;
}
@@ -2337,7 +2534,7 @@ diff -u --new-file '--exclude=version.h' a/command/video.cpp
b/command/video.cpp
pixfmt_info=false;
Clear();
-@@ -61,12 +62,14 @@
+@@ -61,12 +62,14 @@ cMarkAdLogo::cMarkAdLogo(MarkAdContext *maContext)
void cMarkAdLogo::Clear()
{
@@ -2353,7 +2550,7 @@ diff -u --new-file '--exclude=version.h' a/command/video.cpp
b/command/video.cpp
if ((plane<0) || (plane>3)) return -3;
char *path;
-@@ -136,6 +139,7 @@
+@@ -136,6 +139,7 @@ int cMarkAdLogo::Load(const char *directory, char *file, int plane)
void cMarkAdLogo::Save(int framenumber, uchar picture[4][MAXPIXEL], int plane)
{
@@ -2361,7 +2558,7 @@ diff -u --new-file '--exclude=version.h' a/command/video.cpp
b/command/video.cpp
if (!macontext) return;
if ((plane<0) || (plane>3)) return;
if (!macontext->Info.ChannelName) return;
-@@ -338,13 +342,14 @@
+@@ -338,13 +342,14 @@ int cMarkAdLogo::Detect(int framenumber, int *logoframenumber)
if (extract) return LOGO_NOCHANGE;
if (!processed) return LOGO_ERROR;
@@ -2378,7 +2575,7 @@ diff -u --new-file '--exclude=version.h' a/command/video.cpp
b/command/video.cpp
}
int ret=LOGO_NOCHANGE;
-@@ -421,15 +426,27 @@
+@@ -421,15 +426,27 @@ int cMarkAdLogo::Process(int FrameNumber, int *LogoFrameNumber)
if (!macontext->Video.Data.Valid)
{
area.status=LOGO_UNINITIALIZED;
@@ -2412,7 +2609,7 @@ diff -u --new-file '--exclude=version.h' a/command/video.cpp
b/command/video.cpp
if ((area.aspectratio.Num!=macontext->Video.Info.AspectRatio.Num) ||
(area.aspectratio.Den!=macontext->Video.Info.AspectRatio.Den))
{
-@@ -477,6 +494,68 @@
+@@ -477,6 +494,68 @@ int cMarkAdLogo::Process(int FrameNumber, int *LogoFrameNumber)
return Detect(FrameNumber,LogoFrameNumber);
}
@@ -2481,7 +2678,7 @@ diff -u --new-file '--exclude=version.h' a/command/video.cpp
b/command/video.cpp
cMarkAdBlackBordersHoriz::cMarkAdBlackBordersHoriz(MarkAdContext *maContext)
{
macontext=maContext;
-@@ -500,9 +579,16 @@
+@@ -500,9 +579,16 @@ int cMarkAdBlackBordersHoriz::Process(int FrameNumber, int
*BorderIFrame)
// Assumption: If we have 4:3, we should have aspectratio-changes!
//if (macontext->Video.Info.AspectRatio.Num==4) return 0; // seems not to be true
in all countries?
*BorderIFrame=0;
@@ -2499,7 +2696,7 @@ diff -u --new-file '--exclude=version.h' a/command/video.cpp
b/command/video.cpp
int start=(height-CHECKHEIGHT)*macontext->Video.Data.PlaneLinesize[0];
int end=height*macontext->Video.Data.PlaneLinesize[0];
bool ftop=true,fbottom=true;
-@@ -597,6 +683,10 @@
+@@ -597,6 +683,10 @@ int cMarkAdBlackBordersVert::Process(int FrameNumber, int
*BorderIFrame)
bool fleft=true,fright=true;
int val=0,cnt=0;
@@ -2510,7 +2707,7 @@ diff -u --new-file '--exclude=version.h' a/command/video.cpp
b/command/video.cpp
int
end=macontext->Video.Data.PlaneLinesize[0]*(macontext->Video.Info.Height-VOFFSET_);
int i=VOFFSET_*macontext->Video.Data.PlaneLinesize[0];
while (i<end) {
-@@ -712,7 +802,11 @@
+@@ -712,7 +802,11 @@ bool cMarkAdOverlap::areSimilar(simpleHistogram &hist1,
simpleHistogram &hist2)
similar+=abs(hist1[i]-hist2[i]);
}
//printf("%6i\n",similar);
@@ -2523,7 +2720,7 @@ diff -u --new-file '--exclude=version.h' a/command/video.cpp
b/command/video.cpp
return false;
}
-@@ -730,6 +824,7 @@
+@@ -730,6 +824,7 @@ MarkAdPos *cMarkAdOverlap::Detect()
bool
simil=areSimilar(histbuf[OV_BEFORE][B].histogram,histbuf[OV_AFTER][A].histogram);
if (simil)
{
@@ -2531,7 +2728,7 @@ diff -u --new-file '--exclude=version.h' a/command/video.cpp
b/command/video.cpp
tmpA=A;
tmpB=B;
start=A+1;
-@@ -741,8 +836,7 @@
+@@ -741,8 +836,7 @@ MarkAdPos *cMarkAdOverlap::Detect()
}
else
{
@@ -2541,7 +2738,7 @@ diff -u --new-file '--exclude=version.h' a/command/video.cpp
b/command/video.cpp
if (simcnt>similarMaxCnt)
{
if
((histbuf[OV_BEFORE][tmpB].framenumber>result.FrameNumberBefore) &&
-@@ -777,11 +871,20 @@
+@@ -777,11 +871,20 @@ MarkAdPos *cMarkAdOverlap::Detect()
MarkAdPos *cMarkAdOverlap::Process(int FrameNumber, int Frames, bool BeforeAd, bool
H264)
{
@@ -2564,19 +2761,19 @@ diff -u --new-file '--exclude=version.h'
a/command/video.cpp b/command/video.cpp
}
if (BeforeAd)
-@@ -831,8 +934,9 @@
+@@ -830,9 +933,8 @@ MarkAdPos *cMarkAdOverlap::Process(int FrameNumber, int Frames, bool
BeforeAd, b
+ cMarkAdVideo::cMarkAdVideo(MarkAdContext *maContext)
{
macontext=maContext;
-
+-
- memset(&marks,0,sizeof(marks));
-
-+// memset(&marks,0,sizeof(marks));
+ marks={};
+ blackScreen=new cMarkAdBlackScreen(maContext);
hborder=new cMarkAdBlackBordersHoriz(maContext);
vborder=new cMarkAdBlackBordersVert(maContext);
logo = new cMarkAdLogo(maContext);
-@@ -843,6 +947,7 @@
+@@ -843,6 +945,7 @@ cMarkAdVideo::cMarkAdVideo(MarkAdContext *maContext)
cMarkAdVideo::~cMarkAdVideo()
{
resetmarks();
@@ -2584,7 +2781,7 @@ diff -u --new-file '--exclude=version.h' a/command/video.cpp
b/command/video.cpp
if (hborder) delete hborder;
if (vborder) delete vborder;
if (logo) delete logo;
-@@ -855,6 +960,7 @@
+@@ -855,6 +958,7 @@ void cMarkAdVideo::Clear()
aspectratio.Den=0;
framelast=0;
framebeforelast=0;
@@ -2592,7 +2789,7 @@ diff -u --new-file '--exclude=version.h' a/command/video.cpp
b/command/video.cpp
if (hborder) hborder->Clear();
if (vborder) vborder->Clear();
if (logo) logo->Clear();
-@@ -862,7 +968,8 @@
+@@ -862,7 +966,8 @@ void cMarkAdVideo::Clear()
void cMarkAdVideo::resetmarks()
{
@@ -2602,7 +2799,7 @@ diff -u --new-file '--exclude=version.h' a/command/video.cpp
b/command/video.cpp
}
bool cMarkAdVideo::addmark(int type, int position, MarkAdAspectRatio *before,
-@@ -906,6 +1013,7 @@
+@@ -906,6 +1011,7 @@ bool cMarkAdVideo::aspectratiochange(MarkAdAspectRatio &a,
MarkAdAspectRatio &b,
MarkAdPos *cMarkAdVideo::ProcessOverlap(int FrameNumber, int Frames, bool BeforeAd, bool
H264)
{
@@ -2610,7 +2807,7 @@ diff -u --new-file '--exclude=version.h' a/command/video.cpp
b/command/video.cpp
if (!FrameNumber) return NULL;
if (!overlap) overlap=new cMarkAdOverlap(macontext);
if (!overlap) return NULL;
-@@ -918,15 +1026,25 @@
+@@ -918,15 +1024,25 @@ MarkAdMarks *cMarkAdVideo::Process(int FrameNumber, int
FrameNumberNext)
if ((!FrameNumber) && (!FrameNumberNext)) return NULL;
resetmarks();
@@ -2638,7 +2835,7 @@ diff -u --new-file '--exclude=version.h' a/command/video.cpp
b/command/video.cpp
if ((hret<0) && (hborderframenumber!=-1))
{
addmark(MT_HBORDERSTOP,hborderframenumber);
-@@ -934,12 +1052,10 @@
+@@ -934,12 +1050,10 @@ MarkAdMarks *cMarkAdVideo::Process(int FrameNumber, int
FrameNumberNext)
int vborderframenumber;
int vret=vborder->Process(FrameNumber,&vborderframenumber);
@@ -2651,7 +2848,7 @@ diff -u --new-file '--exclude=version.h' a/command/video.cpp
b/command/video.cpp
if ((vret<0) && (vborderframenumber!=-1))
{
addmark(MT_VBORDERSTOP,vborderframenumber);
-@@ -967,17 +1083,22 @@
+@@ -967,17 +1081,22 @@ MarkAdMarks *cMarkAdVideo::Process(int FrameNumber, int
FrameNumberNext)
addmark(MT_HBORDERSTOP,framebeforelast);
hborder->SetStatusBorderInvisible();
}
@@ -2662,7 +2859,7 @@ diff -u --new-file '--exclude=version.h' a/command/video.cpp
b/command/video.cpp
- addmark(MT_ASPECTSTART,start ? FrameNumber : FrameNumberNext,
- &aspectratio,&macontext->Video.Info.AspectRatio);
+ if (((macontext->Info.AspectRatio.Num == 4) &&
(macontext->Info.AspectRatio.Den == 3)) ||
-+ ((macontext->Info.AspectRatio.Num == 0) &&
(macontext->Info.AspectRatio.Den == 0))) {
++ ((macontext->Info.AspectRatio.Num == 0) &&
(macontext->Info.AspectRatio.Den == 0))) {
+ if ((macontext->Video.Info.AspectRatio.Num==4) &&
(macontext->Video.Info.AspectRatio.Den==3)) {
+ addmark(MT_ASPECTSTART,start ? FrameNumber :
FrameNumberNext,&aspectratio,&macontext->Video.Info.AspectRatio);
+ }
@@ -2684,24 +2881,25 @@ diff -u --new-file '--exclude=version.h'
a/command/video.cpp b/command/video.cpp
}
}
-diff -u --new-file '--exclude=version.h' a/command/video.h b/command/video.h
---- a/command/video.h 2020-01-11 10:19:55.247477749 +0000
-+++ b/command/video.h 2020-01-11 12:26:37.611880096 +0000
-@@ -34,6 +34,13 @@
+diff --git a/command/video.h b/command/video.h
+index 85138ca..2a1b630 100644
+--- a/command/video.h
++++ b/command/video.h
+@@ -32,6 +32,13 @@ enum
+ LOGO_VISIBLE=1
+ };
- enum
- {
++enum
++{
+ BLACKSCREEN_UNINITIALIZED=-2,
+ BLACKSCREEN_INVISIBLE=-1,
+ BLACKSCREEN_VISIBLE=1
+};
+
-+enum
-+{
+ enum
+ {
HBORDER_UNINITIALIZED=-2,
- HBORDER_INVISIBLE=-1,
- HBORDER_VISIBLE=1
-@@ -150,6 +157,17 @@
+@@ -150,6 +157,17 @@ public:
void Clear();
};
@@ -2719,7 +2917,7 @@ diff -u --new-file '--exclude=version.h' a/command/video.h
b/command/video.h
class cMarkAdBlackBordersHoriz
{
private:
-@@ -197,6 +215,7 @@
+@@ -197,6 +215,7 @@ private:
MarkAdMarks marks;
MarkAdAspectRatio aspectratio;
@@ -2727,3 +2925,319 @@ diff -u --new-file '--exclude=version.h' a/command/video.h
b/command/video.h
cMarkAdBlackBordersHoriz *hborder;
cMarkAdBlackBordersVert *vborder;
cMarkAdLogo *logo;
+diff --git a/plugin/Makefile b/plugin/Makefile
+index 2f51502..19a4f25 100644
+--- a/plugin/Makefile
++++ b/plugin/Makefile
+@@ -1,54 +1,55 @@
+ #
+ # Makefile for a Video Disk Recorder plugin
++# Adapted to the new VDR makefile environment by Stefan Hofmann
+ #
++# $Id: $
+
+ # The official name of this plugin.
+ # This name will be used in the '-P...' option of VDR to load the plugin.
+ # By default the main source file also carries this name.
+-# IMPORTANT: the presence of this macro is important for the Make.config
+-# file. So it must be defined, even if it is not used here!
+-#
+-PLUGIN = markad
+-
+-### The version number of this plugin (taken from the main source file):
+
+-$(shell GITVERSION=`git rev-parse --short HEAD 2> /dev/null`; if [
"$$GITVERSION" ]; then sed "s/\";/ ($$GITVERSION)\";/"
../version.dist > ../version.h; else cp ../version.dist ../version.h; fi)
+-VERSION = $(shell grep 'static const char \*VERSION *=' ../version.h | awk
'{ print $$6 }' | sed -e 's/[";]//g')
++PLUGIN = markad
+
+-### The C++ compiler and options:
++### The version number of this plugin (taken from the version header file):
+
+-CXX ?= g++
+-CXXFLAGS ?= -fPIC -g -O2 -Wall -Wextra -Woverloaded-virtual -Wno-parentheses
++VERSION = $(shell grep 'static const char \*VERSION *=' version.h | awk '{
print $$6 }' | sed -e 's/[";]//g')
+
+ ### The directory environment:
+
+-VDRDIR ?= ../../../..
+-LIBDIR ?= ../../../lib
++# Use package data if installed...otherwise assume we're under the VDR source
directory:
++PKGCFG = $(if $(VDRDIR),$(shell pkg-config --variable=$(1) $(VDRDIR)/vdr.pc),$(shell
PKG_CONFIG_PATH="$$PKG_CONFIG_PATH:../../../.." pkg-config --variable=$(1)
vdr))
++LIBDIR = $(call PKGCFG,libdir)
++LOCDIR = $(call PKGCFG,locdir)
++#
+ TMPDIR ?= /tmp
+
+-### Make sure that necessary options are included:
+-
+--include $(VDRDIR)/Make.global
++### The compiler options:
+
+-### Allow user defined options to overwrite defaults:
++export CFLAGS = $(call PKGCFG,cflags)
++export CXXFLAGS = $(call PKGCFG,cxxflags)
++CXXVERION=$(shell $(CXX) -dumpversion | cut -d"." -f1)
++ifeq ($(CXXVERION),4)
++export CXXFLAGS += -std=c++11 # to prevent a lot of compiler warnings with g++ V4
++endif
+
+--include $(VDRDIR)/Make.config
++### The version number of VDR's plugin API:
+
+-### The version number of VDR's plugin API (taken from VDR's
"config.h"):
+-
+-APIVERSION = $(shell sed -ne '/define
APIVERSION/s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h)
++APIVERSION = $(call PKGCFG,apiversion)
+
+ ### The name of the distribution archive:
+
+ ARCHIVE = $(PLUGIN)-$(VERSION)
+ PACKAGE = vdr-$(ARCHIVE)
+
++### The name of the shared object file:
++
++SOFILE = libvdr-$(PLUGIN).so
++
+ ### Includes and Defines (add further entries here):
+
+-INCLUDES += -I$(VDRDIR)/include
++INCLUDES +=
+
+-DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"'
+-DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
++DEFINES += -DPLUGIN_NAME_I18N='"$(PLUGIN)"'
+
+ ### The object files (add further files here):
+
+@@ -56,12 +57,12 @@ OBJS = $(PLUGIN).o status.o menu.o setup.o
+
+ ### The main target:
+
+-all: libvdr-$(PLUGIN).so i18n
++all: $(SOFILE) i18n
+
+ ### Implicit rules:
+
+ %.o: %.cpp
+- $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $<
++ $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
+
+ ### Dependencies:
+
+@@ -75,36 +76,39 @@ $(DEPFILE): Makefile
+ ### Internationalization (I18N):
+
+ PODIR = po
+-LOCALEDIR = $(VDRDIR)/locale
+ I18Npo = $(wildcard $(PODIR)/*.po)
+-I18Nmsgs = $(addprefix $(LOCALEDIR)/, $(addsuffix /LC_MESSAGES/vdr-$(PLUGIN).mo,
$(notdir $(foreach file, $(I18Npo), $(basename $(file))))))
++I18Nmo = $(addsuffix .mo, $(foreach file, $(I18Npo), $(basename $(file))))
++I18Nmsgs = $(addprefix $(DESTDIR)$(LOCDIR)/, $(addsuffix /LC_MESSAGES/vdr-$(PLUGIN).mo,
$(notdir $(foreach file, $(I18Npo), $(basename $(file))))))
+ I18Npot = $(PODIR)/$(PLUGIN).pot
+
+ %.mo: %.po
+ msgfmt -c -o $@ $<
+
+ $(I18Npot): $(wildcard *.cpp *.h)
+- xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP
--msgid-bugs-address='<see README>' -o $@ $^
++ xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP
--package-name=vdr-$(PLUGIN) --package-version=$(VERSION)
--msgid-bugs-address='<vdr(a)dolze.de>' -o $@ `ls $^`
+
+ %.po: $(I18Npot)
+- msgmerge -U --no-wrap --no-location --backup=none -q $@ $<
++ msgmerge -U --no-wrap --no-location --backup=none -q -N $@ $<
+ @touch $@
+
+-$(I18Nmsgs): $(LOCALEDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo
+- @mkdir -p $(dir $@)
+- cp $< $@
++$(I18Nmsgs): $(DESTDIR)$(LOCDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo
++ install -D -m644 $< $@
+
+ .PHONY: i18n
+-i18n: $(I18Nmsgs) $(I18Npot)
++i18n: $(I18Nmo) $(I18Npot)
++
++install-i18n: $(I18Nmsgs)
+
+ ### Targets:
+
+-install: all
+- cp --remove-destination libvdr-$(PLUGIN).so
$(LIBDIR)/libvdr-$(PLUGIN).so.$(APIVERSION)
++$(SOFILE): $(OBJS)
++ $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) -o $@
++
++install-lib: $(SOFILE)
++ install -D $^ $(DESTDIR)$(LIBDIR)/$^.$(APIVERSION)
+
+-libvdr-$(PLUGIN).so: $(OBJS)
+- $(CXX) $(CXXFLAGS) -shared $(OBJS) $(LIBS) -o $@
+- cp --remove-destination libvdr-$(PLUGIN).so
$(LIBDIR)/libvdr-$(PLUGIN).so.$(APIVERSION)
++install: install-lib install-i18n
+
+ clean:
+- @-rm -f $(OBJS) $(DEPFILE) *.so *.so.* *.tgz core* *~ $(PODIR)/*.mo $(PODIR)/*.pot
++ @-rm -f $(PODIR)/*.mo $(PODIR)/*.pot
++ @-rm -f $(OBJS) $(DEPFILE) *.so *.tgz core* *~
+diff --git a/plugin/markad.cpp b/plugin/markad.cpp
+index e5801cb..0499841 100644
+--- a/plugin/markad.cpp
++++ b/plugin/markad.cpp
+@@ -54,10 +54,15 @@ cPluginMarkAd::~cPluginMarkAd()
+ const char *cPluginMarkAd::CommandLineHelp(void)
+ {
+ // Return a string that describes all known command line options.
+- return " -b DIR, --bindir=DIR use DIR as location for markad
executable\n"
+- " (default: /usr/bin)\n"
+- " -l DIR --logocachedir=DIR use DIR as location for markad
logos\n"
+- " (default: /var/lib/markad)\n";
++ return " -b DIR, --bindir=DIR use DIR as location for markad
executable\n"
++ " (default: /usr/bin)\n"
++ " -l DIR --logocachedir=DIR use DIR as location for markad
logos\n"
++ " (default: /var/lib/markad)\n"
++ " --loglevel=<level> sets loglevel to the specified
value\n"
++ " <level> 1=error 2=info 3=debug
4=trace\n"
++ " --astopoffs=<value> (default is 100)\n"
++ " assumed stop offset in seconds range
from 0 to 240\n"
++ " --cDecoder use new cDecoder class)\n";
+ }
+
+ bool cPluginMarkAd::ProcessArgs(int argc, char *argv[])
+@@ -65,9 +70,11 @@ bool cPluginMarkAd::ProcessArgs(int argc, char *argv[])
+ // Command line argument processing
+ static struct option long_options[] =
+ {
+- { "bindir", required_argument, NULL, 'b'
+- },
+- { "logocachedir", required_argument, NULL, 'l'},
++ { "bindir", required_argument, NULL, 'b'},
++ { "logocachedir", required_argument, NULL, 'l'},
++ { "loglevel", required_argument, NULL, '1'},
++ { "astopoffs", required_argument, NULL, '2'},
++ { "cDecoder", no_argument, NULL, '3'},
+ { NULL, 0, NULL, 0 }
+ };
+
+@@ -103,6 +110,15 @@ bool cPluginMarkAd::ProcessArgs(int argc, char *argv[])
+ return false;
+ }
+ break;
++ case '1':
++ loglevel=atoi(optarg);
++ break;
++ case '2':
++ astopoffs=atoi(optarg);
++ break;
++ case '3':
++ cDecoder=true;
++ break;
+ default:
+ return false;
+ }
+@@ -132,6 +148,13 @@ bool cPluginMarkAd::Start(void)
+ // Start any background activities the plugin shall perform.
+ lastcheck=0;
+ setup.PluginName=Name();
++ if (loglevel)
++ if(! asprintf(&setup.LogLevel," --loglevel=%i ",loglevel))
++ esyslog("markad: asprintf ouf of memory");
++ if (astopoffs>=0)
++ if(! asprintf(&setup.aStopOffs," --astopoffs=%i ",astopoffs))
++ esyslog("markad: asprintf ouf of memory");
++ setup.cDecoder=cDecoder;
+ setup.LogoDir=logodir;
+ statusMonitor = new cStatusMarkAd(bindir,logodir,&setup);
+ return (statusMonitor!=NULL);
+diff --git a/plugin/markad.h b/plugin/markad.h
+index 27652b9..2b04fa7 100644
+--- a/plugin/markad.h
++++ b/plugin/markad.h
+@@ -23,6 +23,9 @@ private:
+ cStatusMarkAd *statusMonitor;
+ char *bindir;
+ char *logodir;
++ int loglevel=0;
++ int astopoffs=-1;
++ bool cDecoder=false;
+ struct setup setup;
+ char title[80];
+ time_t lastcheck;
+diff --git a/plugin/setup.h b/plugin/setup.h
+index 6677d6f..a75822a 100644
+--- a/plugin/setup.h
++++ b/plugin/setup.h
+@@ -25,6 +25,9 @@ struct setup
+ bool LogoOnly;
+ bool DeferredShutdown;
+ const char *LogoDir;
++ char *LogLevel=NULL;
++ char *aStopOffs=NULL;
++ bool cDecoder=false;
+ const char *PluginName;
+ };
+
+diff --git a/plugin/status.cpp b/plugin/status.cpp
+index efc8db3..3699031 100644
+--- a/plugin/status.cpp
++++ b/plugin/status.cpp
+@@ -72,7 +72,7 @@ bool cStatusMarkAd::Start(const char *FileName, const char *Name, const
bool Dir
+ {
+ if ((Direct) && (Get(FileName)!=-1)) return false;
+
+- cString cmd = cString::sprintf("\"%s\"/markad %s%s%s%s%s%s%s -l
\"%s\" %s \"%s\"",
++ cString cmd = cString::sprintf("\"%s\"/markad %s%s%s%s%s%s%s%s%s%s -l
\"%s\" %s \"%s\"",
+ bindir,
+ setup->Verbose ? " -v " : "",
+ setup->SaveInfo ? " -I " :
"",
+@@ -85,7 +85,11 @@ bool cStatusMarkAd::Start(const char *FileName, const char *Name,
const bool Dir
+ setup->NoMargins ? " -i 4 " :
"",
+ setup->SecondPass ? "" : "
--pass1only ",
+ setup->Log2Rec ? " -R " : "",
+- logodir,Direct ? "-O after" :
"--online=2 before",
++ setup->LogLevel ? setup->LogLevel : "",
++ setup->aStopOffs ? setup->aStopOffs : "",
++ setup->cDecoder ? " --cDecoder " : "",
++ logodir,
++ Direct ? "-O after" : "--online=2 before",
+ FileName);
+ usleep(1000000); // wait 1 second
+ if (SystemExec(cmd)!=-1)
+@@ -152,12 +156,13 @@ bool cStatusMarkAd::LogoExists(const cDevice *Device,const char
*FileName)
+ #endif
+ {
+ #if APIVERSNUM>=10722
+- if (Timer->Recording() && const_cast<cDevice
*>(Device)->IsTunedToTransponder(Timer->Channel()) &&
+- (difftime(time(NULL),Timer->StartTime())<60))
+- {
+- timer=Timer;
+- break;
+- }
++ if (Timer->Recording() && const_cast<cDevice
*>(Device)->IsTunedToTransponder(Timer->Channel()))
++ if (difftime(time(NULL),Timer->StartTime())<60)
++ {
++ timer=Timer;
++ break;
++ }
++ else esyslog("markad: recording start is later than timer start,
ignoring");
+ #else
+ if (Timer->Recording() &&
Device->IsTunedToTransponder(Timer->Channel()) &&
+ (difftime(time(NULL),Timer->StartTime())<60))
+@@ -301,9 +306,10 @@ bool cStatusMarkAd::getPid(int Position)
+ char *buf;
+ if (asprintf(&buf,"%s/markad.pid",recs[Position].FileName)==-1) return
false;
+
++ usleep(500*1000); // wait 500ms to give markad time to create pid file
+ FILE *fpid=fopen(buf,"r");
+ if (fpid)
+- {
++ {
+ free(buf);
+ int pid;
+ ret=fscanf(fpid,"%10i\n",&pid);
+@@ -312,6 +318,7 @@ bool cStatusMarkAd::getPid(int Position)
+ }
+ else
+ {
++ esyslog("markad: failed to open pid file %s with errno %i", buf, errno);
+ if (errno==ENOENT)
+ {
+ // no such file or directory -> markad done or crashed
diff --git a/vdr-markad.spec b/vdr-markad.spec
index 5b3fffb..30cc8b0 100644
--- a/vdr-markad.spec
+++ b/vdr-markad.spec
@@ -4,7 +4,7 @@
Name: vdr-markad
Version: 0.1.4
-Release: 32.%{gitdate}git%{shortcommit0}%{?dist}
+Release: 33.%{gitdate}git%{shortcommit0}%{?dist}
Summary: Advanced commercial detection for VDR
License: GPLv2+
# how to get the tarball
@@ -13,13 +13,7 @@ License: GPLv2+
URL:
http://projects.vdr-developer.org/projects/plg-markad
Source0:
http://projects.vdr-developer.org/git/vdr-plugin-markad.git/snapshot/vdr-...
Source1: %{name}.conf
-Patch0: 00-markad-libavcodec58-V0-02.diff
-Patch1: 01-markad-Makefile-V0-06.diff
-Patch2: 02-markad-deprecated-V0-05.diff
-Patch3: 03-markad-decoder-V0-59.diff
-
-
-
+Patch0: 03-markad-decoder-V1-00.diff
BuildRequires: gcc-c++
BuildRequires: vdr-devel >= 1.7.30
BuildRequires: ffmpeg-devel >= 4.1
@@ -61,6 +55,12 @@ fi
%{vdr_vardir}/markad/
%changelog
+* Fri Mar 13 2020 Martin Gansser <martinkg(a)fedoraproject.org> -
0.1.4-33.20170313gitea2e182
+- Replace 03-markad-decoder-V0-59.diff by 03-markad-decoder-V0-59.diff
+- Dropped 00-markad-libavcodec58-V0-02.diff
+- Dropped 01-markad-Makefile-V0-06.diff
+- Dropped 02-markad-deprecated-V0-05.diff
+
* Sat Feb 22 2020 RPM Fusion Release Engineering <leigh123linux(a)googlemail.com> -
0.1.4-32.20170313gitea2e182
- Rebuild for ffmpeg-4.3 git