summaryrefslogtreecommitdiff
path: root/command/video.cpp
diff options
context:
space:
mode:
authorJochen Dolze <vdr@dolze.de>2010-04-21 08:41:34 +0200
committerJochen Dolze <vdr@dolze.de>2010-04-21 08:41:34 +0200
commitc54d478ac11813767e0cbd383fb43f659651eb43 (patch)
treeaa56ffd3792a2e53ef6da8552d3f478e75de74f1 /command/video.cpp
parentb8fb66fe7f224892070debe4597b53c9beca6eb9 (diff)
downloadvdr-plugin-markad-c54d478ac11813767e0cbd383fb43f659651eb43.tar.gz
vdr-plugin-markad-c54d478ac11813767e0cbd383fb43f659651eb43.tar.bz2
added -G and --bstart/--bstop options
Diffstat (limited to 'command/video.cpp')
-rw-r--r--command/video.cpp38
1 files changed, 29 insertions, 9 deletions
diff --git a/command/video.cpp b/command/video.cpp
index f32faa9..5eae436 100644
--- a/command/video.cpp
+++ b/command/video.cpp
@@ -53,13 +53,17 @@ cMarkAdLogo::~cMarkAdLogo()
{
}
-int cMarkAdLogo::Load(char *file)
+int cMarkAdLogo::Load(char *directory, char *file)
{
+ char *path;
+ if (asprintf(&path,"%s/%s.pgm",directory,file)==-1) return -3;
+
// Load mask
FILE *pFile;
area.valid=false;
area.corner=-1;
- pFile=fopen(file, "rb");
+ pFile=fopen(path, "rb");
+ free(path);
if (!pFile) return -1;
fscanf(pFile, "P5\n#C%i %i\n%d %d\n255\n#", &area.corner,&area.mpixel,&LOGOWIDTH,&LOGOHEIGHT);
@@ -358,20 +362,21 @@ int cMarkAdLogo::Process(int LastIFrame, int *LogoIFrame)
{
area.valid=false; // just to be sure!
char *buf=NULL;
- if (asprintf(&buf,"%s/%s-A%i_%i.pgm",macontext->LogoDir,macontext->Info.ChannelID,
+ if (asprintf(&buf,"%s-A%i_%i",macontext->Info.ChannelID,
macontext->Video.Info.AspectRatio.Num,macontext->Video.Info.AspectRatio.Den)!=-1)
{
- int ret=Load(buf);
+ int ret=Load(macontext->LogoDir,buf);
switch (ret)
{
case -1:
- esyslog("failed to open %s",buf);
-
+ isyslog("no logo for %s",buf);
break;
-
case -2:
esyslog("format error in %s",buf);
break;
+ case -3:
+ esyslog("cannot load %s",buf);
+ break;
}
free(buf);
}
@@ -467,7 +472,7 @@ int cMarkAdBlackBordersHoriz::Process(int LastIFrame, int *BorderIFrame)
}
else
{
-#define MINSECS 60
+#define MINSECS 420
switch (borderstatus)
{
case UNINITIALIZED:
@@ -645,7 +650,22 @@ MarkAdMark *cMarkAdVideo::Process(int LastIFrame)
macontext->Video.Info.AspectRatio.Num,
macontext->Video.Info.AspectRatio.Den,LastIFrame)!=-1)
{
- AddMark(MT_ASPECTCHANGE,LastIFrame,buf);
+ if ((macontext->Info.AspectRatio.Num) && (macontext->Info.AspectRatio.Den))
+ {
+ if ((macontext->Video.Info.AspectRatio.Num==macontext->Info.AspectRatio.Num) &&
+ (macontext->Video.Info.AspectRatio.Num==macontext->Info.AspectRatio.Num))
+ {
+ AddMark(MT_ASPECTSTART,LastIFrame,buf);
+ }
+ else
+ {
+ AddMark(MT_ASPECTSTOP,LastIFrame,buf);
+ }
+ }
+ else
+ {
+ AddMark(MT_ASPECTCHANGE,LastIFrame,buf);
+ }
free(buf);
}
}