diff options
author | Jochen Dolze <vdr@dolze.de> | 2010-06-20 23:11:24 +0200 |
---|---|---|
committer | Jochen Dolze <vdr@dolze.de> | 2010-06-20 23:11:24 +0200 |
commit | 0f47971de0782234b534ec623203b56684d80c52 (patch) | |
tree | f74f9b2e007f51e8048657adf5f7d1ae2096688d /command | |
parent | bef61eb0094f10d9bc453dcd6b13750d2a53c6bb (diff) | |
download | vdr-plugin-markad-0f47971de0782234b534ec623203b56684d80c52.tar.gz vdr-plugin-markad-0f47971de0782234b534ec623203b56684d80c52.tar.bz2 |
Added STDC_CONSTANT_MACROS to Makefile
Added function CheckLogoMarks
Diffstat (limited to 'command')
-rw-r--r-- | command/Makefile | 1 | ||||
-rw-r--r-- | command/decoder.cpp | 2 | ||||
-rw-r--r-- | command/markad-standalone.cpp | 47 | ||||
-rw-r--r-- | command/markad-standalone.h | 1 |
4 files changed, 44 insertions, 7 deletions
diff --git a/command/Makefile b/command/Makefile index da4a04a..1656d77 100644 --- a/command/Makefile +++ b/command/Makefile @@ -19,6 +19,7 @@ PKG-INCLUDES += libavcodec DEFINES += -D_GNU_SOURCE DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE +DEFINES += -D__STDC_CONSTANT_MACROS INCLUDES += $(shell $(PKG-CONFIG) --cflags $(PKG-INCLUDES)) LIBS += $(shell $(PKG-CONFIG) --libs $(PKG-LIBS)) diff --git a/command/decoder.cpp b/command/decoder.cpp index 4d94950..e600278 100644 --- a/command/decoder.cpp +++ b/command/decoder.cpp @@ -5,8 +5,6 @@ * */ -#define __STDC_CONSTANT_MACROS - #include <stdint.h> #include <sched.h> #include <sys/types.h> diff --git a/command/markad-standalone.cpp b/command/markad-standalone.cpp index 1fdb5d1..26bd2c8 100644 --- a/command/markad-standalone.cpp +++ b/command/markad-standalone.cpp @@ -210,6 +210,31 @@ void cMarkAdStandalone::CheckStartStop(int lastiframe) } } +void cMarkAdStandalone::CheckLogoMarks() +{ + clMark *mark=marks.GetFirst(); + while (mark) + { + if ((mark->type==MT_LOGOSTOP) && mark->Next() && mark->Next()->type==MT_LOGOSTART) + { + int MARKDIFF=(int) (macontext.Video.Info.FramesPerSecond*35); + if (abs(mark->Next()->position-mark->position)<=MARKDIFF) + { + double distance=(mark->Next()->position-mark->position)/ + macontext.Video.Info.FramesPerSecond; + isyslog("logo distance too short (%.1fs), deleting (%i,%i)",distance, + mark->position,mark->Next()->position); + clMark *tmp=mark; + mark=mark->Next()->Next(); + marks.Del(tmp->Next()); + marks.Del(tmp); + continue; + } + } + mark=mark->Next(); + } +} + void cMarkAdStandalone::CheckLastMark() { clMark *last=marks.GetLast(); @@ -358,11 +383,22 @@ void cMarkAdStandalone::AddMark(MarkAdMark *Mark) { clMark *last=NULL; int MINMARKDIFF=(int) (macontext.Video.Info.FramesPerSecond*180); - if ((iStart>0) && (abs(Mark->Position-iStart)<=MINMARKDIFF) && ((Mark->Type & 0x0F)==MT_START)) + if (iStart>0) { - last=marks.GetPrev(Mark->Position,MT_START,0xF); - if (!last) last=marks.GetPrev(Mark->Position,MT_ASPECTCHANGE); - if ((last) && (abs(last->position-iStart)>MINMARKDIFF)) last=NULL; + if (abs(Mark->Position-iStart)<=MINMARKDIFF) + { + if ((Mark->Type & 0x0F)==MT_START) + { + last=marks.GetPrev(Mark->Position,MT_START,0xF); + if (!last) last=marks.GetPrev(Mark->Position,MT_ASPECTCHANGE); + if ((last) && (abs(last->position-iStart)>MINMARKDIFF)) last=NULL; + } + } + else + { + marks.DelTill(iStart); + iStart=0; + } } if (iStop>0) @@ -714,7 +750,7 @@ bool cMarkAdStandalone::ProcessFile(const char *Directory, int Number) { lastiframe=iframe; CheckStartStop(lastiframe); - if (lastiframe>chkLEFT) CheckInfoAspectRatio(); + if (lastiframe>chkLEFT) CheckInfoAspectRatio(); iframe=framecnt-1; dRes=true; @@ -910,6 +946,7 @@ void cMarkAdStandalone::Process(const char *Directory) } CheckLastMark(); + CheckLogoMarks(); gettimeofday(&tv2,&tz); time_t sec; diff --git a/command/markad-standalone.h b/command/markad-standalone.h index d04bcc4..910ff8c 100644 --- a/command/markad-standalone.h +++ b/command/markad-standalone.h @@ -216,6 +216,7 @@ unsigned Descriptor_Length: void CheckLastMark(); void CheckStartStop(int lastiframe); void CheckInfoAspectRatio(); + void CheckLogoMarks(); void AddStartMark(); void AddMark(MarkAdMark *Mark); void Reset(); |