summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--command/logos/DAS_VIERTE-A16_9-P0.pgmbin0 -> 15644 bytes
-rw-r--r--command/markad-standalone.cpp31
-rw-r--r--plugin/markad.cpp4
-rw-r--r--plugin/po/de_DE.po16
-rw-r--r--plugin/po/it_IT.po14
-rw-r--r--plugin/setup.cpp126
-rw-r--r--plugin/setup.h14
-rw-r--r--plugin/status.cpp100
-rw-r--r--plugin/status.h5
9 files changed, 265 insertions, 45 deletions
diff --git a/command/logos/DAS_VIERTE-A16_9-P0.pgm b/command/logos/DAS_VIERTE-A16_9-P0.pgm
new file mode 100644
index 0000000..ed9e214
--- /dev/null
+++ b/command/logos/DAS_VIERTE-A16_9-P0.pgm
Binary files differ
diff --git a/command/markad-standalone.cpp b/command/markad-standalone.cpp
index 73524d1..409afc6 100644
--- a/command/markad-standalone.cpp
+++ b/command/markad-standalone.cpp
@@ -356,14 +356,6 @@ void cMarkAdStandalone::CheckStartStop(int frame, bool checkend)
int MARKDIFF=length/6;
if (MARKDIFF>MAXRANGE) MARKDIFF=MAXRANGE;
MARKDIFF=(int) (MARKDIFF*macontext.Video.Info.FramesPerSecond);
-#if 0
- clMark *before_iStart=marks.GetPrev(iStart,MT_START,0xF);
- if (before_iStart)
- {
- int tmpdiff=abs(iStart-before_iStart->position);
- if (tmpdiff<MARKDIFF) MARKDIFF=tmpdiff;
- }
-#endif
iStartCheck=iStart+MARKDIFF;
CalculateStopPosition(iStart,MARKDIFF);
}
@@ -626,6 +618,24 @@ void cMarkAdStandalone::AddMark(MarkAdMark *Mark)
}
}
+ if (Mark->Type==MT_CHANNELSTOP)
+ {
+ clMark *prev=marks.GetPrev(Mark->Position,MT_CHANNELSTART);
+ if (prev)
+ {
+ int MARKDIFF=(int) (macontext.Video.Info.FramesPerSecond*240);
+ if ((Mark->Position-prev->position)<MARKDIFF)
+ {
+ if (Mark->Comment) isyslog("%s",Mark->Comment);
+ double distance=(Mark->Position-prev->position)/macontext.Video.Info.FramesPerSecond;
+ isyslog("channel distance too short (%.1fs), deleting (%i,%i)",distance,
+ prev->position,Mark->Position);
+ marks.Del(prev);
+ return;
+ }
+ }
+ }
+
if (Mark->Type==MT_LOGOSTOP)
{
// check if last mark is an audiochannel stop
@@ -839,6 +849,7 @@ bool cMarkAdStandalone::CheckIndexGrowing()
#define WAITTIME 15
if (!indexFile) return false;
+ if (macontext.Config->logoExtraction!=-1) return false;
if (sleepcnt>=2) return false; // we already slept too much
bool notenough=true;
@@ -1596,7 +1607,8 @@ void cMarkAdStandalone::Process()
else
{
// this shouldn't be reached
- esyslog("ALERT: stopping before end of broadcast");
+ if (!macontext.Config->logoExtraction!=-1)
+ esyslog("ALERT: stopping before end of broadcast");
}
}
}
@@ -1926,6 +1938,7 @@ bool cMarkAdStandalone::LoadInfo()
{
if (macontext.Info.ChannelName[i]==' ') macontext.Info.ChannelName[i]='_';
if (macontext.Info.ChannelName[i]=='.') macontext.Info.ChannelName[i]='_';
+ if (macontext.Info.ChannelName[i]=='/') macontext.Info.ChannelName[i]='_';
}
}
}
diff --git a/plugin/markad.cpp b/plugin/markad.cpp
index 7e7437a..68908ba 100644
--- a/plugin/markad.cpp
+++ b/plugin/markad.cpp
@@ -39,6 +39,7 @@ cPluginMarkAd::cPluginMarkAd(void)
setup.SecondPass=true;
setup.IOPrioClass=1;
setup.Log2Rec=false;
+ setup.LogoOnly=false;
}
cPluginMarkAd::~cPluginMarkAd()
@@ -128,6 +129,8 @@ bool cPluginMarkAd::Initialize(void)
bool cPluginMarkAd::Start(void)
{
// Start any background activities the plugin shall perform.
+ setup.PluginName=Name();
+ setup.LogoDir=logodir;
statusMonitor = new cStatusMarkAd(bindir,logodir,&setup);
return (statusMonitor!=NULL);
}
@@ -190,6 +193,7 @@ bool cPluginMarkAd::SetupParse(const char *Name, const char *Value)
else if (!strcasecmp(Name,"IOPrioClass")) setup.IOPrioClass=atoi(Value);
else if (!strcasecmp(Name,"AC3Always")) setup.AC3Always=atoi(Value);
else if (!strcasecmp(Name,"Log2Rec")) setup.Log2Rec=atoi(Value);
+ else if (!strcasecmp(Name,"LogoOnly")) setup.LogoOnly=atoi(Value);
else return false;
return true;
}
diff --git a/plugin/po/de_DE.po b/plugin/po/de_DE.po
index 6ced106..d7bc92d 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-11-24 19:57+0100\n"
+"POT-Creation-Date: 2010-12-31 16:41+0100\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"
@@ -40,7 +40,7 @@ msgid "Recording\t Status"
msgstr "Aufnahme\t Status"
msgid "no running markad found"
-msgstr "Kein aktives markad gefunden"
+msgstr "kein aktives markad gefunden"
msgid "Pause"
msgstr "Pause"
@@ -72,6 +72,9 @@ msgstr " während einer anderen Aufnahme"
msgid " while replaying"
msgstr " während einer Wiedergabe"
+msgid "scan only channels with logo"
+msgstr "nur Kanäle mit Logo scannen"
+
msgid "hdd access priority"
msgstr "HDD-Zugriffspriorität"
@@ -102,5 +105,14 @@ msgstr "Log ins Aufnahmeverzeichnis"
msgid "hide mainmenu entry"
msgstr "Hauptmenüeintrag verstecken"
+msgid "show list"
+msgstr "zeige Liste"
+
+msgid "list"
+msgstr "Liste"
+
+msgid "back"
+msgstr "zurück"
+
msgid "Mark advertisements"
msgstr "Markiere Werbung"
diff --git a/plugin/po/it_IT.po b/plugin/po/it_IT.po
index 3c97af0..8cef04e 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-11-24 19:57+0100\n"
+"POT-Creation-Date: 2010-12-31 16:41+0100\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"
@@ -75,6 +75,9 @@ msgstr " durante un'altra registrazione"
msgid " while replaying"
msgstr " durante la riproduzione"
+msgid "scan only channels with logo"
+msgstr ""
+
msgid "hdd access priority"
msgstr ""
@@ -105,5 +108,14 @@ msgstr ""
msgid "hide mainmenu entry"
msgstr ""
+msgid "show list"
+msgstr ""
+
+msgid "list"
+msgstr ""
+
+msgid "back"
+msgstr ""
+
msgid "Mark advertisements"
msgstr "Segna i marcatori della pubblicitá"
diff --git a/plugin/setup.cpp b/plugin/setup.cpp
index e87b7db..99090ed 100644
--- a/plugin/setup.cpp
+++ b/plugin/setup.cpp
@@ -24,6 +24,7 @@ cSetupMarkAd::cSetupMarkAd(struct setup *Setup)
secondpass=setup->SecondPass;
ac3always=setup->AC3Always;
log2rec=setup->Log2Rec;
+ logoonly=setup->LogoOnly;
processTexts[0]=tr("after");
processTexts[1]=tr("during");
@@ -31,20 +32,26 @@ cSetupMarkAd::cSetupMarkAd(struct setup *Setup)
ioprioTexts[0]=tr("high");
ioprioTexts[1]=tr("normal");
ioprioTexts[2]=tr("low");
+
+ lpos=0;
+
write();
}
void cSetupMarkAd::write(void)
{
-
+ int current=Current();
Clear();
- Add(new cMenuEditStraItem(tr("execution"),&processduring,2,processTexts));
+ cMenuEditStraItem *first=new cMenuEditStraItem(tr("execution"),&processduring,2,processTexts);
+ if (!first) return;
+ Add(first);
if (!processduring)
{
Add(new cMenuEditBoolItem(tr(" during another recording"),&whilerecording));
Add(new cMenuEditBoolItem(tr(" while replaying"),&whilereplaying));
}
-
+ Add(new cMenuEditBoolItem(tr("scan only channels with logo"),&logoonly),true);
+ lpos=Current();
Add(new cMenuEditStraItem(tr("hdd access priority"),&ioprioclass,3,ioprioTexts));
Add(new cMenuEditBoolItem(tr("examine AC3 always"),&ac3always));
Add(new cMenuEditBoolItem(tr("ignore timer margins"),&nomargins));
@@ -57,27 +64,45 @@ void cSetupMarkAd::write(void)
Add(new cMenuEditBoolItem(tr("log to recording directory"),&log2rec));
Add(new cMenuEditBoolItem(tr("hide mainmenu entry"),&hidemainmenuentry));
+ if (current==-1)
+ {
+ SetCurrent(first);
+ }
+ else
+ {
+ SetCurrent(Get(current));
+ }
Display();
}
eOSState cSetupMarkAd::ProcessKey(eKeys Key)
{
-
- eOSState state=osUnknown;
- switch (Key)
+ eOSState state = cOsdMenu::ProcessKey(Key);
+ if (HasSubMenu()) return osContinue;
+ switch (state)
{
- case kLeft:
- state=cMenuSetupPage::ProcessKey(Key);
- if (Current()==0) write();
+ case osContinue:
+ if (((Key==kLeft) || (Key==kRight)) && (Current()==0)) write();
+
+ if ((Key==kDown) || (Key==kUp))
+ {
+ if (Current()==lpos)
+ {
+ SetHelp(NULL,NULL,NULL,tr("show list"));
+ }
+ else
+ {
+ SetHelp(NULL,NULL,NULL,NULL);
+ }
+ }
break;
- case kRight:
- state=cMenuSetupPage::ProcessKey(Key);
- if (Current()==0) write();
+ case osUnknown:
+ if ((Key==kBlue) && (Current()==lpos))
+ return AddSubMenu(new cSetupMarkAdList(setup));;
break;
default:
- state=cMenuSetupPage::ProcessKey(Key);
break;
}
return state;
@@ -98,6 +123,7 @@ void cSetupMarkAd::Store(void)
SetupStore("IOPrioClass",ioprioclass);
SetupStore("AC3Always",ac3always);
SetupStore("Log2Rec",log2rec);
+ SetupStore("LogoOnly",logoonly);
setup->ProcessDuring=(bool) processduring;
setup->whileRecording=(bool) whilerecording;
@@ -112,4 +138,78 @@ void cSetupMarkAd::Store(void)
setup->IOPrioClass=ioprioclass;
setup->AC3Always=ac3always;
setup->Log2Rec=log2rec;
+ setup->LogoOnly=logoonly;
+}
+
+#define CHNUMWIDTH (numdigits(Channels.MaxNumber())+1)
+
+cSetupMarkAdList::cSetupMarkAdList(struct setup *Setup)
+ :cOsdMenu("",CHNUMWIDTH)
+{
+ SetTitle(cString::sprintf("%s - %s '%s' %s",trVDR("Setup"),trVDR("Plugin"),Setup->PluginName,tr("list")));
+ SetHelp(NULL,NULL,NULL,tr("back"));
+
+ DIR *dir=opendir(Setup->LogoDir);
+ if (!dir) return;
+ struct dirent *dirent;
+ while (dirent=readdir(dir))
+ {
+ if (dirent->d_name[0]=='.') continue;
+ if (strstr(dirent->d_name,"-P0.pgm"))
+ {
+ char *name=strdup(dirent->d_name);
+ if (name)
+ {
+ char *m=strchr(name,'-');
+ if (m) *m=0;
+
+ for (cChannel *channel = Channels.First(); channel; channel = Channels.Next(channel))
+ {
+ if (channel->Name())
+ {
+ char *cname=strdup(channel->Name());
+ if (cname)
+ {
+ for (int i=0; i<(int) strlen(cname); i++)
+ {
+ if (cname[i]==' ') cname[i]='_';
+ if (cname[i]=='.') cname[i]='_';
+ if (cname[i]=='/') cname[i]='_';
+ }
+ if (!strcmp(name,cname))
+ {
+ Add(new cOsdItem(cString::sprintf("%i\t%s",channel->Number(),channel->Name())));
+ free(cname);
+ break;
+ }
+ free(cname);
+ }
+ }
+ }
+
+ free(name);
+ }
+ }
+ }
+ closedir(dir);
+}
+
+eOSState cSetupMarkAdList::ProcessKey (eKeys Key)
+{
+ eOSState state = cOsdMenu::ProcessKey(Key);
+ if (HasSubMenu()) return osContinue;
+ if (state==osUnknown)
+ {
+ switch (Key)
+ {
+ case kOk:
+ case kBlue:
+ case kBack:
+ state=osBack;
+ break;
+ default:
+ break;
+ }
+ }
+ return state;
}
diff --git a/plugin/setup.h b/plugin/setup.h
index cd9cc0f..0080dfc 100644
--- a/plugin/setup.h
+++ b/plugin/setup.h
@@ -24,6 +24,9 @@ struct setup
bool AC3Always;
bool HideMainMenuEntry;
bool Log2Rec;
+ bool LogoOnly;
+ const char *LogoDir;
+ const char *PluginName;
};
class cSetupMarkAd : public cMenuSetupPage
@@ -45,11 +48,20 @@ private:
int hidemainmenuentry;
int ac3always;
int log2rec;
+ int logoonly;
void write(void);
+ int lpos;
protected:
virtual void Store(void);
public:
- cSetupMarkAd(struct setup *setup);
+ cSetupMarkAd(struct setup *Setup);
+ eOSState ProcessKey(eKeys Key);
+};
+
+class cSetupMarkAdList : public cOsdMenu
+{
+public:
+ cSetupMarkAdList(struct setup *Setup);
eOSState ProcessKey(eKeys Key);
};
diff --git a/plugin/status.cpp b/plugin/status.cpp
index 31ae31a..ad088c1 100644
--- a/plugin/status.cpp
+++ b/plugin/status.cpp
@@ -71,7 +71,8 @@ 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%s -r %i -l \"%s\" %s \"%s\"",bindir,
+ cString cmd = cString::sprintf("\"%s\"/markad %s%s%s%s%s%s%s%s -r %i -l \"%s\" %s \"%s\"",
+ bindir,
setup->Verbose ? " -v " : "",
setup->BackupMarks ? " -B " : "",
setup->GenIndex ? " -G " : "",
@@ -81,7 +82,8 @@ bool cStatusMarkAd::Start(const char *FileName, const char *Name, const bool Dir
setup->AC3Always ? " -a " : "",
setup->Log2Rec ? " -R " : "",
setup->IOPrioClass+1,
- logodir,Direct ? "-O after" : "--online=2 before", FileName);
+ logodir,Direct ? "-O after" : "--online=2 before",
+ FileName);
dsyslog("markad: executing %s",*cmd);
if (SystemExec(cmd)!=-1)
{
@@ -120,6 +122,68 @@ bool cStatusMarkAd::Start(const char *FileName, const char *Name, const bool Dir
return false;
}
+void cStatusMarkAd::TimerChange(const cTimer *Timer, eTimerChange Change)
+{
+ if (!Timer) return;
+ if (Change!=tcDel) return;
+ Remove(Timer->File(),true);
+}
+
+bool cStatusMarkAd::LogoExists(const char *Name)
+{
+ if (!Name) return false;
+ cTimer *timer=NULL;
+ for (cTimer *Timer = Timers.First(); Timer; Timer=Timers.Next(Timer))
+ {
+ if (Timer->Recording() && (!strcmp(Timer->File(),Name)))
+ {
+ timer=Timer;
+ break;
+ }
+ }
+ if (!timer) return false;
+
+ const cChannel *chan=timer->Channel();
+ if (!chan) return false;
+ char *cname=strdup(chan->Name());
+ if (!cname) return false;
+ for (int i=0; i<(int) strlen(cname); i++)
+ {
+ if (cname[i]==' ') cname[i]='_';
+ if (cname[i]=='.') cname[i]='_';
+ if (cname[i]=='/') cname[i]='_';
+ }
+
+ char *fname=NULL;
+ if (asprintf(&fname,"%s/%s-A16_9-P0.pgm",logodir,cname)==-1)
+ {
+ free(cname);
+ return false;
+ }
+
+ struct stat statbuf;
+ if (stat(fname,&statbuf)==-1)
+ {
+ free(fname);
+ fname=NULL;
+ if (asprintf(&fname,"%s/%s-A4_3-P0.pgm",logodir,cname)==-1)
+ {
+ free(cname);
+ return false;
+ }
+
+ if (stat(fname,&statbuf)==-1)
+ {
+ free(cname);
+ free(fname);
+ return false;
+ }
+ }
+ free(fname);
+ free(cname);
+ return true;
+}
+
void cStatusMarkAd::Recording(const cDevice *UNUSED(Device), const char *Name,
const char *FileName, bool On)
{
@@ -129,6 +193,7 @@ void cStatusMarkAd::Recording(const cDevice *UNUSED(Device), const char *Name,
if (On)
{
+ if (setup->LogoOnly && !LogoExists(Name)) return;
// Start markad with recording
Start(FileName,Name,false);
}
@@ -244,27 +309,30 @@ bool cStatusMarkAd::MarkAdRunning()
return (tmpRecs!=NULL);
}
-int cStatusMarkAd::Get(const char *FileName)
+int cStatusMarkAd::Get(const char *FileName, const char *Name)
{
for (int i=0; i<(MAXDEVICES*MAXRECEIVERS); i++)
{
- if ((recs[i].FileName) && (!strcmp(recs[i].FileName,FileName))) return i;
+ if (Name && recs[i].Name && !strcmp(recs[i].Name,Name)) return i;
+ if (FileName && recs[i].FileName && !strcmp(recs[i].FileName,FileName)) return i;
}
return -1;
}
+void cStatusMarkAd::Remove(const char *Name, bool Kill)
+{
+ if (!Name) return;
+ int pos=Get(NULL,Name);
+ if (pos==-1) return;
+ Remove(pos,Kill);
+}
+
void cStatusMarkAd::Remove(int Position, bool Kill)
{
- if (recs[Position].FileName)
- {
- free(recs[Position].FileName);
- recs[Position].FileName=NULL;
- }
- if (recs[Position].Name)
- {
- free(recs[Position].Name);
- recs[Position].Name=NULL;
- }
+ if (recs[Position].FileName) free(recs[Position].FileName);
+ recs[Position].FileName=NULL;
+ if (recs[Position].Name) free(recs[Position].Name);
+ recs[Position].Name=NULL;
if ((Kill) && (recs[Position].Pid))
{
@@ -279,10 +347,6 @@ void cStatusMarkAd::Remove(int Position, bool Kill)
kill(recs[Position].Pid,SIGKILL);
}
}
- else
- {
- kill(recs[Position].Pid,SIGKILL);
- }
}
recs[Position].Status=0;
recs[Position].Pid=0;
diff --git a/plugin/status.h b/plugin/status.h
index e9cad87..3f0f5a5 100644
--- a/plugin/status.h
+++ b/plugin/status.h
@@ -41,14 +41,17 @@ private:
bool getStatus(int Position);
int Recording();
bool Replaying();
- int Get(const char *FileName);
+ int Get(const char *FileName, const char *Name=NULL);
int Add(const char *FileName, const char *Name);
void Remove(int Position, bool Kill=false);
+ void Remove(const char *Name, bool Kill=false);
void Pause(const char *FileName);
void Continue(const char *FileName);
+ bool LogoExists(const char *Name);
protected:
virtual void Recording(const cDevice *Device, const char *Name, const char *FileName, bool On);
virtual void Replaying(const cControl *Control, const char *Name, const char *FileName, bool On);
+ virtual void TimerChange(const cTimer *Timer, eTimerChange Change);
public:
cStatusMarkAd(const char *BinDir,const char *LogoDir, struct setup *Setup);
~cStatusMarkAd();