summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--command/audio.cpp16
-rw-r--r--command/global.h41
-rw-r--r--command/markad-standalone.cpp184
-rw-r--r--command/markad-standalone.h13
-rw-r--r--command/video.cpp20
-rw-r--r--command/video.h2
-rw-r--r--plugin/markad.cpp1
-rw-r--r--plugin/po/de_DE.po12
-rw-r--r--plugin/po/it_IT.po11
-rw-r--r--plugin/setup.cpp11
-rw-r--r--plugin/setup.h2
-rw-r--r--plugin/status.cpp3
12 files changed, 172 insertions, 144 deletions
diff --git a/command/audio.cpp b/command/audio.cpp
index 448d1e9..dba0f59 100644
--- a/command/audio.cpp
+++ b/command/audio.cpp
@@ -149,13 +149,25 @@ MarkAdMark *cMarkAdAudio::Process(int FrameNumber, int FrameNumberNext)
if (ChannelChange(macontext->Audio.Info.Channels,channels))
{
+ bool start=false;
+ if (macontext->Audio.Info.DolbyDigital51)
+ {
+ if (macontext->Audio.Info.Channels>2) start=true;
+ else start=false;
+ }
+ else
+ {
+ if (macontext->Audio.Info.Channels>2) start=false;
+ else start=true;
+ }
+
char *buf=NULL;
if (asprintf(&buf,"audio channel change from %i to %i (%i)", channels,
macontext->Audio.Info.Channels,
- (macontext->Audio.Info.Channels>2) ? FrameNumberNext :
+ start ? FrameNumberNext :
framelast)!=-1)
{
- if (macontext->Audio.Info.Channels>2)
+ if (start)
{
AddMark(MT_CHANNELSTART,FrameNumberNext,buf);
}
diff --git a/command/global.h b/command/global.h
index 2dcc9f1..e7cc76c 100644
--- a/command/global.h
+++ b/command/global.h
@@ -55,6 +55,31 @@ typedef unsigned char uchar;
#define MT_MOVED 0xE0
#define MT_ALL 0xFF
+typedef struct config
+{
+ char logoDirectory[1024];
+ char LogoDir[1024];
+ char markFileName[1024];
+ char svdrphost[1024];
+
+ int logoExtraction;
+ int logoWidth;
+ int logoHeight;
+ int ignoreInfo;
+ int svdrpport;
+ int threads;
+
+ bool DecodeVideo;
+ bool DecodeAudio;
+ bool BackupMarks;
+
+ bool NoPid;
+ bool OSD;
+ bool Before;
+ bool GenIndex;
+ bool AC3Always;
+} MarkAdConfig;
+
typedef struct MarkAdPos
{
int FrameNumberBefore;
@@ -89,15 +114,7 @@ typedef struct MarkAdPid
typedef struct MarkAdContext
{
- char *LogoDir; // Logo Directory, default /var/lib/markad
-
- struct Options
- {
- int LogoExtraction;
- int LogoWidth;
- int LogoHeight;
- bool ASD;
- } Options;
+ const MarkAdConfig *Config;
struct Info
{
@@ -138,13 +155,9 @@ typedef struct MarkAdContext
struct Audio
{
- struct Options
- {
- bool AudioSilenceDetection;
- } Options;
-
struct Info
{
+ bool DolbyDigital51;
int Channels; // number of audio channels
int SampleRate;
} Info;
diff --git a/command/markad-standalone.cpp b/command/markad-standalone.cpp
index c00c79d..4129f63 100644
--- a/command/markad-standalone.cpp
+++ b/command/markad-standalone.cpp
@@ -663,6 +663,7 @@ void cMarkAdStandalone::AddMark(MarkAdMark *Mark)
macontext.Video.Options.IgnoreAspectRatio=true;
}
}
+ macontext.Audio.Info.DolbyDigital51=true;
setAudio51=true;
setAudio20=false;
reprocess=true;
@@ -1168,7 +1169,7 @@ bool cMarkAdStandalone::ProcessFile(int Number)
nextPictType=MA_I_TYPE;
}
- if (bGenIndex)
+ if (macontext.Config->GenIndex)
{
if ((macontext.Info.VPid.Type==MARKAD_PIDTYPE_VIDEO_H262) ||
((macontext.Info.VPid.Type==MARKAD_PIDTYPE_VIDEO_H264) &&
@@ -1252,7 +1253,7 @@ bool cMarkAdStandalone::ProcessFile(int Number)
{
if ((!isTS) && (!noticeVDR_AC3))
{
- dsyslog("found AC3");
+ isyslog("found AC3%s",macontext.Config->AC3Always ? "*" : "");
noticeVDR_AC3=true;
}
if (apkt.Timestamp) audiotime=apkt.Timestamp;
@@ -1271,7 +1272,7 @@ bool cMarkAdStandalone::ProcessFile(int Number)
}
}
- if (((gotendmark) && (!bGenIndex)) || (reprocess))
+ if (((gotendmark) && (!macontext.Config->GenIndex)) || (reprocess))
{
if (f!=-1) close(f);
return true;
@@ -1335,7 +1336,7 @@ bool cMarkAdStandalone::Reset(bool FirstPass)
bool cMarkAdStandalone::CheckDolbyDigital51()
{
- if (!ac3_demux) return false;
+ if (!macontext.Audio.Info.DolbyDigital51) return false;
if (abort) return false;
// Assumption: last mark must be MT_CHANNELSTOP and the position must be
@@ -1350,12 +1351,13 @@ bool cMarkAdStandalone::CheckDolbyDigital51()
}
reprocess=true;
- bDecodeVideo=true;
+ bDecodeVideo=macontext.Config->DecodeVideo;
setAudio20=true;
setAudio51=false;
+ macontext.Audio.Info.DolbyDigital51=false;
isyslog("%s DolbyDigital5.1 marks found", mark ? "not enough" : "no");
isyslog("restarting from scratch");
- if (ac3_demux)
+ if ((ac3_demux) && (!macontext.Config->AC3Always))
{
delete ac3_demux;
ac3_demux=NULL;
@@ -1371,7 +1373,7 @@ void cMarkAdStandalone::ProcessFile()
{
if (abort) break;
if (!ProcessFile(i)) break;
- if ((gotendmark) && (!bGenIndex)) break;
+ if ((gotendmark) && (!macontext.Config->GenIndex)) break;
if (reprocess)
{
isyslog("restarting from scratch");
@@ -1411,7 +1413,7 @@ void cMarkAdStandalone::Process()
{
if (abort) return;
- if (bBackupMarks) marks.Backup(directory,isTS);
+ if (macontext.Config->BackupMarks) marks.Backup(directory,isTS);
ProcessFile();
if (CheckDolbyDigital51()) ProcessFile();
@@ -1422,12 +1424,12 @@ void cMarkAdStandalone::Process()
if (marks.Save(directory,macontext.Video.Info.FramesPerSecond,isTS))
{
int iIndexError=false;
- int tframecnt=bGenIndex ? framecnt : 0;
+ int tframecnt=macontext.Config->GenIndex ? framecnt : 0;
if (marks.CheckIndex(directory,isTS,&tframecnt,&iIndexError))
{
if (iIndexError)
{
- if (bGenIndex)
+ if (macontext.Config->GenIndex)
{
switch (iIndexError)
{
@@ -1461,7 +1463,7 @@ void cMarkAdStandalone::Process()
}
}
}
- if (bGenIndex) marks.RemoveGeneratedIndex(directory,isTS);
+ if (macontext.Config->GenIndex) marks.RemoveGeneratedIndex(directory,isTS);
if ((!bIgnoreAudioInfo) && (!bIgnoreVideoInfo) && (macontext.Info.Length)) SaveInfo();
}
@@ -1671,7 +1673,6 @@ bool cMarkAdStandalone::LoadInfo()
rStart=mktime(&t);
}
- bool tbDecodeVideo=bDecodeVideo;
long start=0;
char *line=NULL;
size_t length;
@@ -1749,14 +1750,17 @@ bool cMarkAdStandalone::LoadInfo()
// if we have DolbyDigital 2.0 disable AC3
if (strchr(descr,'2'))
{
- macontext.Info.DPid.Num=0;
- isyslog("broadcast with DolbyDigital2.0, disabling AC3 decoding");
+ isyslog("broadcast with DolbyDigital2.0%s",macontext.Config->AC3Always ?
+ "" : ", disabling AC3 decoding");
+
+ if (!macontext.Config->AC3Always) macontext.Info.DPid.Num=0;
}
else
// if we have DolbyDigital 5.1 disable video decoding
if (strchr(descr,'5'))
{
bDecodeVideo=false;
+ macontext.Audio.Info.DolbyDigital51=true;
macontext.Video.Options.IgnoreAspectRatio=true;
isyslog("broadcast with DolbyDigital5.1, disabling video decoding");
if (macontext.Info.VPid.Type==MARKAD_PIDTYPE_VIDEO_H262)
@@ -1806,7 +1810,7 @@ bool cMarkAdStandalone::LoadInfo()
macontext.Info.AspectRatio.Den=0;
bIgnoreAudioInfo=true;
bIgnoreVideoInfo=true;
- bDecodeVideo=tbDecodeVideo;
+ bDecodeVideo=macontext.Config->DecodeVideo;
macontext.Video.Options.IgnoreAspectRatio=false;
}
@@ -2088,12 +2092,7 @@ void cMarkAdStandalone::RemovePidfile()
const char cMarkAdStandalone::frametypes[8]={'?','I','P','B','D','S','s','b'};
-cMarkAdStandalone::cMarkAdStandalone(const char *Directory, bool BackupMarks, int LogoExtraction,
- int LogoWidth, int LogoHeight, bool DecodeVideo,
- bool DecodeAudio, int IgnoreInfo,
- const char *LogoDir, const char *MarkFileName,
- bool noPid, bool OSD, const char *SVDRPHost, int SVDRPPort,
- bool Before, bool GenIndex, int Threads)
+cMarkAdStandalone::cMarkAdStandalone(const char *Directory, const MarkAdConfig *config)
{
setlocale(LC_MESSAGES, "");
directory=Directory;
@@ -2131,18 +2130,14 @@ cMarkAdStandalone::cMarkAdStandalone(const char *Directory, bool BackupMarks, in
title[0]=0;
memset(&macontext,0,sizeof(macontext));
- macontext.LogoDir=(char *) LogoDir;
- macontext.Options.LogoExtraction=LogoExtraction;
- macontext.Options.LogoWidth=LogoWidth;
- macontext.Options.LogoHeight=LogoHeight;
-
- bDecodeVideo=DecodeVideo;
- bDecodeAudio=DecodeAudio;
- bGenIndex=GenIndex;
- bBackupMarks=BackupMarks;
+ macontext.Config=config;
+
+ bDecodeVideo=config->DecodeVideo;
+ bDecodeAudio=config->DecodeAudio;
+
tStart=iStart=iStop=iStartCheck=iStopCheck=0;
- if ((IgnoreInfo & IGNORE_VIDEOINFO)==IGNORE_VIDEOINFO)
+ if ((config->ignoreInfo & IGNORE_VIDEOINFO)==IGNORE_VIDEOINFO)
{
bIgnoreVideoInfo=true;
}
@@ -2151,7 +2146,7 @@ cMarkAdStandalone::cMarkAdStandalone(const char *Directory, bool BackupMarks, in
bIgnoreVideoInfo=false;
}
- if ((IgnoreInfo & IGNORE_AUDIOINFO)==IGNORE_AUDIOINFO)
+ if ((config->ignoreInfo & IGNORE_AUDIOINFO)==IGNORE_AUDIOINFO)
{
bIgnoreAudioInfo=true;
}
@@ -2160,7 +2155,7 @@ cMarkAdStandalone::cMarkAdStandalone(const char *Directory, bool BackupMarks, in
bIgnoreAudioInfo=false;
}
- if ((IgnoreInfo & IGNORE_TIMERINFO)==IGNORE_TIMERINFO)
+ if ((config->ignoreInfo & IGNORE_TIMERINFO)==IGNORE_TIMERINFO)
{
bIgnoreTimerInfo=true;
}
@@ -2196,7 +2191,7 @@ cMarkAdStandalone::cMarkAdStandalone(const char *Directory, bool BackupMarks, in
isyslog("timer info usage disabled by user");
}
- if (LogoExtraction!=-1)
+ if (config->logoExtraction!=-1)
{
// just to be sure extraction works
bDecodeVideo=true;
@@ -2204,13 +2199,13 @@ cMarkAdStandalone::cMarkAdStandalone(const char *Directory, bool BackupMarks, in
bIgnoreVideoInfo=true;
}
- if (!noPid)
+ if (!config->NoPid)
{
CreatePidfile();
if (abort) return;
}
- if (Before) sleep(10);
+ if (config->Before) sleep(10);
if (!CheckTS()) return;
@@ -2246,7 +2241,7 @@ cMarkAdStandalone::cMarkAdStandalone(const char *Directory, bool BackupMarks, in
if (bDecodeVideo)
{
esyslog("failed loading info - logo %s%sdisabled",
- (LogoExtraction!=-1) ? "extraction" : "detection",
+ (config->logoExtraction!=-1) ? "extraction" : "detection",
bIgnoreTimerInfo ? " " : " and pre-/post-timer ");
tStart=0;
}
@@ -2264,9 +2259,9 @@ cMarkAdStandalone::cMarkAdStandalone(const char *Directory, bool BackupMarks, in
ptitle=(char *) Directory;
}
- if (OSD)
+ if (config->OSD)
{
- osd= new cOSDMessage(SVDRPHost,SVDRPPort);
+ osd= new cOSDMessage(config->svdrphost,config->svdrpport);
if (osd) osd->Send("%s %s",tr("starting markad for"),ptitle);
}
else
@@ -2274,7 +2269,7 @@ cMarkAdStandalone::cMarkAdStandalone(const char *Directory, bool BackupMarks, in
osd=NULL;
}
- if (MarkFileName[0]) marks.SetFileName(MarkFileName);
+ if (config->markFileName[0]) marks.SetFileName(config->markFileName);
if (macontext.Info.VPid.Num)
{
@@ -2310,7 +2305,7 @@ cMarkAdStandalone::cMarkAdStandalone(const char *Directory, bool BackupMarks, in
if (macontext.Info.DPid.Num)
{
if (macontext.Info.DPid.Num!=-1)
- dsyslog("using AC3 (0x%04x)",macontext.Info.DPid.Num);
+ dsyslog("using AC3 (0x%04x)%s",macontext.Info.DPid.Num,macontext.Config->AC3Always ? "*" : "");
ac3_demux = new cMarkAdDemux();
}
else
@@ -2321,7 +2316,7 @@ cMarkAdStandalone::cMarkAdStandalone(const char *Directory, bool BackupMarks, in
if (!abort)
{
decoder = new cMarkAdDecoder(macontext.Info.VPid.Type==MARKAD_PIDTYPE_VIDEO_H264,
- macontext.Info.APid.Num!=0,macontext.Info.DPid.Num!=0,Threads);
+ macontext.Info.APid.Num!=0,macontext.Info.DPid.Num!=0,config->threads);
video = new cMarkAdVideo(&macontext);
audio = new cMarkAdAudio(&macontext);
streaminfo = new cMarkAdStreamInfo;
@@ -2406,6 +2401,9 @@ int usage(int svdrpport)
// nothing done, give the user some help
printf("Usage: markad [options] cmd <record>\n"
"options:\n"
+ "-a --AC3\n"
+ " always search in DolbyDigital channels, even if the\n"
+ " broadcast isn't in DolbyDigital5.1\n"
"-b --background\n"
" markad runs as a background-process\n"
" this will be automatically set if called with \"after\"\n"
@@ -2523,7 +2521,7 @@ static void signal_handler(int sig)
int main(int argc, char *argv[])
{
int c;
- bool bAfter=false,bBefore=false,bEdited=false;
+ bool bAfter=false,bEdited=false;
bool bFork=false,bNice=false,bImmediateCall=false;
int niceLevel = 19;
int ioprio_class=2;
@@ -2531,33 +2529,31 @@ int main(int argc, char *argv[])
char *recDir=NULL;
char *tok,*str;
int ntok;
- int logoExtraction=-1;
- int logoWidth=-1;
- int logoHeight=-1;
- bool bBackupMarks=false,bNoPid=false,bOSD=false;
- char markFileName[1024]="";
- char logoDirectory[1024]="";
- char svdrphost[1024]="127.0.0.1";
- int svdrpport;
- bool bDecodeVideo=true;
- bool bDecodeAudio=true;
- int ignoreInfo=0;
- bool bGenIndex=false;
+ int online=0;
bool bPass2Only=false;
bool bPass1Only=false;
- int online=0;
- int threads=-1;
- strcpy(logoDirectory,"/var/lib/markad");
+ struct config config;
+ memset(&config,0,sizeof(config));
+
+ // set defaults
+ config.DecodeVideo=true;
+ config.DecodeAudio=true;
+ config.logoExtraction=-1;
+ config.logoWidth=-1;
+ config.logoHeight=-1;
+ config.threads=-1;
+ strcpy(config.svdrphost,"127.0.0.1");
+ strcpy(config.logoDirectory,"/var/lib/markad");
struct servent *serv=getservbyname("svdrp","tcp");
if (serv)
{
- svdrpport=htons(serv->s_port);
+ config.svdrpport=htons(serv->s_port);
}
else
{
- svdrpport=2001;
+ config.svdrpport=2001;
}
while (1)
@@ -2614,6 +2610,7 @@ int main(int argc, char *argv[])
case 'a':
// --ac3
+ config.AC3Always=true;
break;
case 'b':
@@ -2630,14 +2627,14 @@ int main(int argc, char *argv[])
switch (atoi(optarg))
{
case 1:
- bDecodeVideo=false;
+ config.DecodeVideo=false;
break;
case 2:
- bDecodeAudio=false;
+ config.DecodeAudio=false;
break;
case 3:
- bDecodeVideo=false;
- bDecodeAudio=false;
+ config.DecodeVideo=false;
+ config.DecodeAudio=false;
break;
default:
fprintf(stderr, "markad: invalid disable option: %s\n", optarg);
@@ -2648,8 +2645,8 @@ int main(int argc, char *argv[])
case 'i':
// --ignoreinfo
- ignoreInfo=atoi(optarg);
- if ((ignoreInfo<0) || (ignoreInfo>255))
+ config.ignoreInfo=atoi(optarg);
+ if ((config.ignoreInfo<0) || (config.ignoreInfo>255))
{
fprintf(stderr, "markad: invalid ignoreinfo option: %s\n", optarg);
return 2;
@@ -2661,8 +2658,8 @@ int main(int argc, char *argv[])
break;
case 'l':
- strncpy(logoDirectory,optarg,sizeof(logoDirectory));
- logoDirectory[sizeof(logoDirectory)-1]=0;
+ strncpy(config.logoDirectory,optarg,sizeof(config.logoDirectory));
+ config.logoDirectory[sizeof(config.logoDirectory)-1]=0;
break;
case 'n':
@@ -2721,7 +2718,7 @@ int main(int argc, char *argv[])
case 'B':
// --backupmarks
- bBackupMarks=true;
+ config.BackupMarks=true;
break;
case 'C':
@@ -2729,7 +2726,7 @@ int main(int argc, char *argv[])
break;
case 'G':
- bGenIndex=true;
+ config.GenIndex=true;
break;
case 'L':
@@ -2741,8 +2738,8 @@ int main(int argc, char *argv[])
switch (ntok)
{
case 0:
- logoExtraction=atoi(tok);
- if ((logoExtraction<0) || (logoExtraction>3))
+ config.logoExtraction=atoi(tok);
+ if ((config.logoExtraction<0) || (config.logoExtraction>3))
{
fprintf(stderr, "markad: invalid extractlogo value: %s\n", tok);
return 2;
@@ -2750,8 +2747,8 @@ int main(int argc, char *argv[])
break;
case 1:
- logoWidth=atoi(tok);
- if ((logoWidth<50) || (logoWidth>LOGO_MAXWIDTH))
+ config.logoWidth=atoi(tok);
+ if ((config.logoWidth<50) || (config.logoWidth>LOGO_MAXWIDTH))
{
fprintf(stderr, "markad: invalid width value: %s\n", tok);
return 2;
@@ -2759,8 +2756,8 @@ int main(int argc, char *argv[])
break;
case 2:
- logoHeight=atoi(tok);
- if ((logoHeight<20) || (logoHeight>LOGO_MAXHEIGHT))
+ config.logoHeight=atoi(tok);
+ if ((config.logoHeight<20) || (config.logoHeight>LOGO_MAXHEIGHT))
{
fprintf(stderr, "markad: invalid height value: %s\n", tok);
return 2;
@@ -2777,7 +2774,7 @@ int main(int argc, char *argv[])
case 'O':
// --OSD
- bOSD=true;
+ config.OSD=true;
break;
case 'S':
@@ -2786,9 +2783,9 @@ int main(int argc, char *argv[])
case 'T':
// --threads
- threads=atoi(optarg);
- if (threads<1) threads=1;
- if (threads>16) threads=16;
+ config.threads=atoi(optarg);
+ if (config.threads<1) config.threads=1;
+ if (config.threads>16) config.threads=16;
break;
case 'V':
@@ -2807,8 +2804,8 @@ int main(int argc, char *argv[])
break;
case 1: // --markfile
- strncpy(markFileName,optarg,sizeof(markFileName));
- markFileName[sizeof(markFileName)-1]=0;
+ strncpy(config.markFileName,optarg,sizeof(config.markFileName));
+ config.markFileName[sizeof(config.markFileName)-1]=0;
break;
case 2: // --loglevel
@@ -2830,7 +2827,7 @@ int main(int argc, char *argv[])
break;
case 5: // --nopid
- bNoPid=true;
+ config.NoPid=true;
break;
case 6: // --asd
@@ -2840,14 +2837,14 @@ int main(int argc, char *argv[])
break;
case 8: // --svdrphost
- strncpy(svdrphost,optarg,sizeof(svdrphost));
- svdrphost[sizeof(svdrphost)-1]=0;
+ strncpy(config.svdrphost,optarg,sizeof(config.svdrphost));
+ config.svdrphost[sizeof(config.svdrphost)-1]=0;
break;
case 9: // --svdrpport
if (isnumber(optarg) && atoi(optarg) > 0 && atoi(optarg) < 65536)
{
- svdrpport=atoi(optarg);
+ config.svdrpport=atoi(optarg);
}
else
{
@@ -2891,7 +2888,7 @@ int main(int argc, char *argv[])
else if (strcmp(argv[optind], "before" ) == 0 )
{
if (!online) online=1;
- bBefore = bFork = bNice = SYSLOG = true;
+ config.Before = bFork = bNice = SYSLOG = true;
}
else if (strcmp(argv[optind], "edited" ) == 0 )
{
@@ -2919,7 +2916,7 @@ int main(int argc, char *argv[])
// do nothing if called from vdr before/after the video is cutted
if ((bAfter) && (online)) return 0;
- if (bBefore)
+ if (config.Before)
{
if (!online) return 0;
if ((online==1) && (!strchr(recDir,'@'))) return 0;
@@ -2928,7 +2925,7 @@ int main(int argc, char *argv[])
// we can run, if one of bImmediateCall, bAfter, bBefore or bNice is true
// and recDir is given
- if ( (bImmediateCall || bBefore || bAfter || bNice) && recDir )
+ if ( (bImmediateCall || config.Before || bAfter || bNice) && recDir )
{
// if bFork is given go in background
if ( bFork )
@@ -3021,7 +3018,7 @@ int main(int argc, char *argv[])
}
if (ioprio_set(1,getpid(),ioprio | ioprio_class << 13)==-1)
{
- esyslog("failed to set ioprio to IOPRIO_CLASS_IDLE");
+ esyslog("failed to set ioprio to %i,%i",ioprio_class,ioprio);
}
}
@@ -3051,10 +3048,7 @@ int main(int argc, char *argv[])
signal(SIGTSTP, signal_handler);
signal(SIGCONT, signal_handler);
- cmasta = new cMarkAdStandalone(recDir,bBackupMarks, logoExtraction, logoWidth, logoHeight,
- bDecodeVideo,bDecodeAudio,ignoreInfo,
- logoDirectory,markFileName,bNoPid,bOSD,svdrphost,
- svdrpport,bBefore,bGenIndex,threads);
+ cmasta = new cMarkAdStandalone(recDir,&config);
if (!cmasta) return -1;
if (!bPass2Only) cmasta->Process();
@@ -3062,5 +3056,5 @@ int main(int argc, char *argv[])
delete cmasta;
return 0;
}
- return usage(svdrpport);
+ return usage(config.svdrpport);
}
diff --git a/command/markad-standalone.h b/command/markad-standalone.h
index b4e2359..7ffc391 100644
--- a/command/markad-standalone.h
+++ b/command/markad-standalone.h
@@ -8,6 +8,7 @@
#ifndef __markad_standalone_h_
#define __markad_standalone_h_
+#include "global.h"
#include "demux.h"
#include "decoder.h"
#include "video.h"
@@ -25,6 +26,7 @@
#define MAXRANGE 420 /* range to search for start/stop marks in seconds */
+
class cOSDMessage
{
private:
@@ -205,7 +207,7 @@ unsigned Descriptor_Length:
bool bIgnoreAudioInfo;
bool bIgnoreVideoInfo;
bool bIgnoreTimerInfo;
- bool bGenIndex;
+
int tStart; // pretimer in seconds
int iStart; // pretimer as index value
int iStartCheck; // check position for iStart
@@ -231,7 +233,7 @@ unsigned Descriptor_Length:
bool aspectChecked;
bool marksAligned;
- bool bBackupMarks;
+
clMarks marks;
char *IndexToHMSF(int Index);
void CalculateStopPosition(int startframe, int delta);
@@ -264,12 +266,7 @@ public:
}
void Process2ndPass();
void Process();
- cMarkAdStandalone(const char *Directory, bool BackupMarks, int LogoExtraction,
- int LogoWidth, int LogoHeight, bool DecodeVideo,
- bool DecodeAudio, int IgnoreInfo,
- const char *LogoDir, const char *MarkFileName,
- bool noPid, bool OSD, const char *SVDRPHost, int SVDRPPort,
- bool Before, bool GenIndex, int Threads);
+ cMarkAdStandalone(const char *Directory, const MarkAdConfig *config);
~cMarkAdStandalone();
};
diff --git a/command/video.cpp b/command/video.cpp
index 95c48b4..70fd808 100644
--- a/command/video.cpp
+++ b/command/video.cpp
@@ -65,7 +65,7 @@ void cMarkAdLogo::Clear()
area.status=UNINITIALIZED;
}
-int cMarkAdLogo::Load(char *directory, char *file, int plane)
+int cMarkAdLogo::Load(const char *directory, char *file, int plane)
{
if ((plane<0) || (plane>3)) return -3;
@@ -306,7 +306,7 @@ int cMarkAdLogo::SobelPlane(int plane)
int cMarkAdLogo::Detect(int framenumber, int *logoframenumber)
{
- bool extract=(macontext->Options.LogoExtraction!=-1);
+ bool extract=(macontext->Config->logoExtraction!=-1);
int rpixel=0,mpixel=0;
int processed=0;
@@ -406,10 +406,10 @@ int cMarkAdLogo::Process(int FrameNumber, int *LogoFrameNumber)
if (!macontext->Video.Data.Valid) return ERROR;
if (!macontext->Video.Info.Width) return ERROR;
if (!macontext->Video.Info.Height) return ERROR;
- if (!macontext->LogoDir) return ERROR;
+ if (!macontext->Config->logoDirectory[0]) return ERROR;
if (!macontext->Info.ChannelName) return ERROR;
- if (macontext->Options.LogoExtraction==-1)
+ if (macontext->Config->logoExtraction==-1)
{
if ((area.aspectratio.Num!=macontext->Video.Info.AspectRatio.Num) ||
(area.aspectratio.Den!=macontext->Video.Info.AspectRatio.Den))
@@ -421,7 +421,7 @@ int cMarkAdLogo::Process(int FrameNumber, int *LogoFrameNumber)
area.corner=-1;
for (int plane=0; plane<4; plane++)
{
- int ret=Load(macontext->LogoDir,buf,plane);
+ int ret=Load(macontext->Config->logoDirectory,buf,plane);
switch (ret)
{
case -1:
@@ -445,14 +445,14 @@ int cMarkAdLogo::Process(int FrameNumber, int *LogoFrameNumber)
{
area.aspectratio.Num=macontext->Video.Info.AspectRatio.Num;
area.aspectratio.Den=macontext->Video.Info.AspectRatio.Den;
- area.corner=macontext->Options.LogoExtraction;
- if (macontext->Options.LogoWidth!=-1)
+ area.corner=macontext->Config->logoExtraction;
+ if (macontext->Config->logoWidth!=-1)
{
- LOGOWIDTH=macontext->Options.LogoWidth;
+ LOGOWIDTH=macontext->Config->logoWidth;
}
- if (macontext->Options.LogoHeight!=-1)
+ if (macontext->Config->logoHeight!=-1)
{
- LOGOHEIGHT=macontext->Options.LogoHeight;
+ LOGOHEIGHT=macontext->Config->logoHeight;
}
}
diff --git a/command/video.h b/command/video.h
index 8be247b..36fdf5f 100644
--- a/command/video.h
+++ b/command/video.h
@@ -108,7 +108,7 @@ private:
bool pixfmt_info;
int SobelPlane(int plane); // do sobel operation on plane
int Detect(int framenumber, int *logoframenumber); // ret 1 = logo, 0 = unknown, -1 = no logo
- int Load(char *directory, char *file, int plane);
+ int Load(const char *directory, char *file, int plane);
void Save(int framenumber, uchar picture[4][MAXPIXEL], int plane);
public:
cMarkAdLogo(MarkAdContext *maContext);
diff --git a/plugin/markad.cpp b/plugin/markad.cpp
index b94ca82..daf1193 100644
--- a/plugin/markad.cpp
+++ b/plugin/markad.cpp
@@ -187,6 +187,7 @@ bool cPluginMarkAd::SetupParse(const char *Name, const char *Value)
else if (!strcasecmp(Name,"HideMainMenuEntry")) setup.HideMainMenuEntry=atoi(Value)?true:false;
else if (!strcasecmp(Name,"SecondPass")) setup.SecondPass=atoi(Value);
else if (!strcasecmp(Name,"IOPrioClass")) setup.IOPrioClass=atoi(Value);
+ else if (!strcasecmp(Name,"AC3Always")) setup.AC3Always=atoi(Value);
else return false;
return true;
}
diff --git a/plugin/po/de_DE.po b/plugin/po/de_DE.po
index 06027b3..1441bc6 100644
--- a/plugin/po/de_DE.po
+++ b/plugin/po/de_DE.po
@@ -4,7 +4,7 @@ msgid ""
msgstr ""
"Project-Id-Version: vdr\n"
"Report-Msgid-Bugs-To: <see README>\n"
-"POT-Creation-Date: 2010-10-08 21:30+0200\n"
+"POT-Creation-Date: 2010-10-10 15:33+0200\n"
"PO-Revision-Date: 2009-08-27 14:18+0200\n"
"Last-Translator: Jochen Dolze <vdr@dolze.de>\n"
"Language-Team: <vdr@linuxtv.org>\n"
@@ -75,8 +75,8 @@ msgstr " während einer Wiedergabe"
msgid "hdd access priority"
msgstr "HDD-Zugriffspriorität"
-msgid "repair index, if broken"
-msgstr "Kaputte Indexdatei reparieren"
+msgid "examine AC3 always"
+msgstr "AC3 immer untersuchen"
msgid "ignore timer margins"
msgstr "Timer Vor-/Nachlauf ignorieren"
@@ -84,6 +84,9 @@ msgstr "Timer Vor-/Nachlauf ignorieren"
msgid "detect overlaps"
msgstr "erkenne Überlappungen"
+msgid "repair index, if broken"
+msgstr "kaputte Indexdatei reparieren"
+
msgid "OSD message"
msgstr "OSD Meldung"
@@ -93,9 +96,8 @@ msgstr "alte Marken sichern"
msgid "verbose logging"
msgstr "ausführliches Logging"
-msgid "Hide Mainmenu entry"
+msgid "hide mainmenu entry"
msgstr "Hauptmenüeintrag verstecken"
msgid "Mark advertisements"
msgstr "Markiere Werbung"
-
diff --git a/plugin/po/it_IT.po b/plugin/po/it_IT.po
index 1579e51..8f60382 100644
--- a/plugin/po/it_IT.po
+++ b/plugin/po/it_IT.po
@@ -4,7 +4,7 @@ msgid ""
msgstr ""
"Project-Id-Version: vdr\n"
"Report-Msgid-Bugs-To: <see README>\n"
-"POT-Creation-Date: 2010-10-08 21:30+0200\n"
+"POT-Creation-Date: 2010-10-10 15:33+0200\n"
"PO-Revision-Date: 2010-08-09 20:05+0100\n"
"Last-Translator: Diego Pierotto <vdr-italian@tiscali.it>\n"
"Language-Team: <vdr@linuxtv.org>\n"
@@ -78,8 +78,8 @@ msgstr " durante la riproduzione"
msgid "hdd access priority"
msgstr ""
-msgid "repair index, if broken"
-msgstr "Ripara indice, se errato"
+msgid "examine AC3 always"
+msgstr ""
msgid "ignore timer margins"
msgstr "Ignora margini timer"
@@ -87,6 +87,9 @@ msgstr "Ignora margini timer"
msgid "detect overlaps"
msgstr ""
+msgid "repair index, if broken"
+msgstr "Ripara indice, se errato"
+
msgid "OSD message"
msgstr "Messaggio OSD"
@@ -96,7 +99,7 @@ msgstr "Salva marcatori"
msgid "verbose logging"
msgstr "Log dettagliato"
-msgid "Hide Mainmenu entry"
+msgid "hide mainmenu entry"
msgstr ""
msgid "Mark advertisements"
diff --git a/plugin/setup.cpp b/plugin/setup.cpp
index 544d724..28af746 100644
--- a/plugin/setup.cpp
+++ b/plugin/setup.cpp
@@ -22,6 +22,7 @@ cSetupMarkAd::cSetupMarkAd(struct setup *Setup)
nomargins=setup->NoMargins;
hidemainmenuentry=setup->HideMainMenuEntry;
secondpass=setup->SecondPass;
+ ac3always=setup->AC3Always;
processTexts[0]=tr("after");
processTexts[1]=tr("during");
@@ -44,15 +45,15 @@ void cSetupMarkAd::write(void)
}
Add(new cMenuEditStraItem(tr("hdd access priority"),&ioprioclass,3,ioprioTexts));
-
- Add(new cMenuEditBoolItem(tr("repair index, if broken"),&genindex));
+ Add(new cMenuEditBoolItem(tr("examine AC3 always"),&ac3always));
Add(new cMenuEditBoolItem(tr("ignore timer margins"),&nomargins));
Add(new cMenuEditBoolItem(tr("detect overlaps"),&secondpass));
-
+ Add(new cOsdItem("",osUnknown,false));
+ Add(new cMenuEditBoolItem(tr("repair index, if broken"),&genindex));
Add(new cMenuEditBoolItem(tr("OSD message"),&osdmsg));
Add(new cMenuEditBoolItem(tr("backup marks"),&backupmarks));
Add(new cMenuEditBoolItem(tr("verbose logging"),&verbose));
- Add(new cMenuEditBoolItem(tr("Hide Mainmenu entry"),&hidemainmenuentry));
+ Add(new cMenuEditBoolItem(tr("hide mainmenu entry"),&hidemainmenuentry));
Display();
}
@@ -93,6 +94,7 @@ void cSetupMarkAd::Store(void)
SetupStore("Verbose",verbose);
SetupStore("HideMainMenuEntry",hidemainmenuentry);
SetupStore("IOPrioClass",ioprioclass);
+ SetupStore("AC3Always",ac3always);
setup->ProcessDuring=(bool) processduring;
setup->whileRecording=(bool) whilerecording;
@@ -105,4 +107,5 @@ void cSetupMarkAd::Store(void)
setup->NoMargins=(bool) nomargins;
setup->HideMainMenuEntry=(bool) hidemainmenuentry;
setup->IOPrioClass=ioprioclass;
+ setup->AC3Always=ac3always;
}
diff --git a/plugin/setup.h b/plugin/setup.h
index 4cd5274..736ef8a 100644
--- a/plugin/setup.h
+++ b/plugin/setup.h
@@ -21,6 +21,7 @@ struct setup
bool GenIndex;
bool NoMargins;
bool SecondPass;
+ bool AC3Always;
bool HideMainMenuEntry;
};
@@ -41,6 +42,7 @@ private:
int nomargins;
int secondpass;
int hidemainmenuentry;
+ int ac3always;
void write(void);
protected:
virtual void Store(void);
diff --git a/plugin/status.cpp b/plugin/status.cpp
index 9708598..3521bfa 100644
--- a/plugin/status.cpp
+++ b/plugin/status.cpp
@@ -71,13 +71,14 @@ 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 -r %i -l \"%s\" %s \"%s\"",bindir,
+ cString cmd = cString::sprintf("\"%s\"/markad %s%s%s%s%s%s%s -r %i -l \"%s\" %s \"%s\"",bindir,
setup->Verbose ? " -v " : "",
setup->BackupMarks ? " -B " : "",
setup->GenIndex ? " -G " : "",
setup->OSDMessage ? " -O " : "",
setup->NoMargins ? " -i 4 " : "",
setup->SecondPass ? "" : " --pass1only ",
+ setup->AC3Always ? " -a " : "",
setup->IOPrioClass+1,
logodir,Direct ? "-O after" : "--online=2 before", FileName);
dsyslog("markad: executing %s",*cmd);