diff options
-rw-r--r-- | command/global.h | 1 | ||||
-rw-r--r-- | command/markad-standalone.cpp | 81 | ||||
-rw-r--r-- | plugin/markad.cpp | 2 | ||||
-rw-r--r-- | plugin/po/de_DE.po | 15 | ||||
-rw-r--r-- | plugin/po/it_IT.po | 14 | ||||
-rw-r--r-- | plugin/setup.cpp | 8 | ||||
-rw-r--r-- | plugin/setup.h | 3 | ||||
-rw-r--r-- | plugin/status.cpp | 5 |
8 files changed, 113 insertions, 16 deletions
diff --git a/command/global.h b/command/global.h index 8062cf9..2dcc9f1 100644 --- a/command/global.h +++ b/command/global.h @@ -147,7 +147,6 @@ typedef struct MarkAdContext { int Channels; // number of audio channels int SampleRate; - bool DolbyDigital51; } Info; struct Data { diff --git a/command/markad-standalone.cpp b/command/markad-standalone.cpp index 4686df8..c00c79d 100644 --- a/command/markad-standalone.cpp +++ b/command/markad-standalone.cpp @@ -29,10 +29,31 @@ #include "markad-standalone.h" #include "version.h" +extern int sys_ioprio_set(int which, int who, int ioprio); bool SYSLOG=false; cMarkAdStandalone *cmasta=NULL; int SysLogLevel=2; +static inline int ioprio_set(int which, int who, int ioprio) +{ +#if defined(__i386__) +#define __NR_ioprio_set 289 +#define __NR_ioprio_get 290 +#elif defined(__ppc__) +#define __NR_ioprio_set 273 +#define __NR_ioprio_get 274 +#elif defined(__x86_64__) +#define __NR_ioprio_set 251 +#define __NR_ioprio_get 252 +#elif defined(__ia64__) +#define __NR_ioprio_set 1274 +#define __NR_ioprio_get 1275 +#else +#error "Unsupported arch" +#endif + return syscall(__NR_ioprio_set, which, who, ioprio); +} + void syslog_with_tid(int priority, const char *format, ...) { va_list ap; @@ -620,7 +641,7 @@ void cMarkAdStandalone::AddMark(MarkAdMark *Mark) marks.Del((uchar) MT_LOGOSTOP); } - if ((((Mark->Type & 0xF0)==MT_CHANNELCHANGE) || ((Mark->Type & 0xF0)==MT_ASPECTCHANGE)) && + if (((Mark->Type==MT_CHANNELSTART) || (Mark->Type==MT_ASPECTSTART)) && (Mark->Position>chkLEFT) && (Mark->Position<chkRIGHT) && (bDecodeVideo)) { if (Mark->Comment) @@ -1314,7 +1335,7 @@ bool cMarkAdStandalone::Reset(bool FirstPass) bool cMarkAdStandalone::CheckDolbyDigital51() { - if (!macontext.Audio.Info.DolbyDigital51) return false; + if (!ac3_demux) return false; if (abort) return false; // Assumption: last mark must be MT_CHANNELSTOP and the position must be @@ -1329,12 +1350,17 @@ bool cMarkAdStandalone::CheckDolbyDigital51() } reprocess=true; - macontext.Audio.Info.DolbyDigital51=false; bDecodeVideo=true; setAudio20=true; setAudio51=false; isyslog("%s DolbyDigital5.1 marks found", mark ? "not enough" : "no"); isyslog("restarting from scratch"); + if (ac3_demux) + { + delete ac3_demux; + ac3_demux=NULL; + macontext.Info.DPid.Num=0; + } Reset(); return true; } @@ -1430,7 +1456,7 @@ void cMarkAdStandalone::Process() ((isTS) || ((macontext.Info.VPid.Type== MARKAD_PIDTYPE_VIDEO_H264) && (!isTS))) ? ", sorry you're lost" : - ", please recreate index"); + ", please run genindex"); } } } @@ -1732,7 +1758,6 @@ bool cMarkAdStandalone::LoadInfo() { bDecodeVideo=false; macontext.Video.Options.IgnoreAspectRatio=true; - macontext.Audio.Info.DolbyDigital51=true; isyslog("broadcast with DolbyDigital5.1, disabling video decoding"); if (macontext.Info.VPid.Type==MARKAD_PIDTYPE_VIDEO_H262) { @@ -1751,7 +1776,6 @@ bool cMarkAdStandalone::LoadInfo() { setAudio20=true; } - } } } @@ -2396,9 +2420,14 @@ int usage(int svdrpport) " audio and timer info)\n" "-l --logocachedir\n" " directory where logos stored, default /var/lib/markad\n" - "-p --priority level=<priority>\n" - " priority-level of markad when running in background\n" - " <-20...19> default 19\n" + "-p --priority=<priority>\n" + " software priority of markad when running in background\n" + " <priority> from -20...19, default 19\n" + "-r --ioprio=<class>[,<level>]\n" + " io priority of markad when running in background\n" + " <class> 1 = realtime, <level> from 0..7, default 4\n" + " 2 = besteffort, <level> from 0..7, default 4\n" + " 3 = idle\n" "-v --verbose\n" " increments loglevel by one, can be given multiple times\n" "-B --backupmarks\n" @@ -2497,6 +2526,8 @@ int main(int argc, char *argv[]) bool bAfter=false,bBefore=false,bEdited=false; bool bFork=false,bNice=false,bImmediateCall=false; int niceLevel = 19; + int ioprio_class=2; + int ioprio=4; char *recDir=NULL; char *tok,*str; int ntok; @@ -2545,6 +2576,7 @@ int main(int argc, char *argv[]) {"nelonen",0,0,'n'}, {"overlap",0,0,'o' }, {"priority",1,0,'p'}, + {"ioprio",1,0,'r'}, {"statisticfile",1,0,'s'}, {"verbose", 0, 0, 'v'}, @@ -2572,7 +2604,7 @@ int main(int argc, char *argv[]) {0, 0, 0, 0} }; - c = getopt_long (argc, argv, "abcd:i:jl:nop:s:vBCGL:OST:V", + c = getopt_long (argc, argv, "abcd:i:jl:nop:r:s:vBCGL:OST:V", long_options, &option_index); if (c == -1) break; @@ -2653,6 +2685,30 @@ int main(int argc, char *argv[]) bNice = true; break; + case 'r': + // --ioprio + str=strchr(optarg,','); + if (str) + { + *str=0; + ioprio=atoi(str+1); + *str=','; + } + ioprio_class=atoi(optarg); + if ((ioprio_class<1) || (ioprio_class>3)) + { + fprintf(stderr, "markad: invalid io-priority: %s\n", optarg); + return 2; + } + if ((ioprio<0) || (ioprio>7)) + { + fprintf(stderr, "markad: invalid io-priority: %s\n", optarg); + return 2; + } + if (ioprio_class==3) ioprio=7; + bNice = true; + break; + case 's': // --statisticfile break; @@ -2963,6 +3019,10 @@ int main(int argc, char *argv[]) { esyslog("failed to set nice to %d",niceLevel); } + if (ioprio_set(1,getpid(),ioprio | ioprio_class << 13)==-1) + { + esyslog("failed to set ioprio to IOPRIO_CLASS_IDLE"); + } } // now do the work... @@ -3002,6 +3062,5 @@ int main(int argc, char *argv[]) delete cmasta; return 0; } - return usage(svdrpport); } diff --git a/plugin/markad.cpp b/plugin/markad.cpp index 75d77ee..b94ca82 100644 --- a/plugin/markad.cpp +++ b/plugin/markad.cpp @@ -37,6 +37,7 @@ cPluginMarkAd::cPluginMarkAd(void) setup.NoMargins=false; setup.HideMainMenuEntry=false; setup.SecondPass=true; + setup.IOPrioClass=1; } cPluginMarkAd::~cPluginMarkAd() @@ -185,6 +186,7 @@ bool cPluginMarkAd::SetupParse(const char *Name, const char *Value) else if (!strcasecmp(Name,"IgnoreMargins")) setup.NoMargins=atoi(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 return false; return true; } diff --git a/plugin/po/de_DE.po b/plugin/po/de_DE.po index b46b33f..06027b3 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-06 14:53+0200\n" +"POT-Creation-Date: 2010-10-08 21:30+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" @@ -54,6 +54,15 @@ msgstr "danach" msgid "during" msgstr "während" +msgid "high" +msgstr "hoch" + +msgid "normal" +msgstr "normal" + +msgid "low" +msgstr "niedrig" + msgid "execution" msgstr "Ausführung" @@ -63,6 +72,9 @@ msgstr " während einer anderen Aufnahme" msgid " while replaying" msgstr " während einer Wiedergabe" +msgid "hdd access priority" +msgstr "HDD-Zugriffspriorität" + msgid "repair index, if broken" msgstr "Kaputte Indexdatei reparieren" @@ -86,3 +98,4 @@ 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 c63dedd..1579e51 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-06 14:53+0200\n" +"POT-Creation-Date: 2010-10-08 21:30+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" @@ -57,6 +57,15 @@ msgstr "dopo" msgid "during" msgstr "durante" +msgid "high" +msgstr "" + +msgid "normal" +msgstr "" + +msgid "low" +msgstr "" + msgid "execution" msgstr "Esecuzione" @@ -66,6 +75,9 @@ msgstr " durante un'altra registrazione" msgid " while replaying" msgstr " durante la riproduzione" +msgid "hdd access priority" +msgstr "" + msgid "repair index, if broken" msgstr "Ripara indice, se errato" diff --git a/plugin/setup.cpp b/plugin/setup.cpp index 3f60c72..544d724 100644 --- a/plugin/setup.cpp +++ b/plugin/setup.cpp @@ -12,6 +12,7 @@ cSetupMarkAd::cSetupMarkAd(struct setup *Setup) setup=Setup; processduring=setup->ProcessDuring; + ioprioclass=setup->IOPrioClass; whilerecording=setup->whileRecording; whilereplaying=setup->whileReplaying; osdmsg=setup->OSDMessage; @@ -25,6 +26,9 @@ cSetupMarkAd::cSetupMarkAd(struct setup *Setup) processTexts[0]=tr("after"); processTexts[1]=tr("during"); + ioprioTexts[0]=tr("high"); + ioprioTexts[1]=tr("normal"); + ioprioTexts[2]=tr("low"); write(); } @@ -39,6 +43,8 @@ void cSetupMarkAd::write(void) Add(new cMenuEditBoolItem(tr(" while replaying"),&whilereplaying)); } + Add(new cMenuEditStraItem(tr("hdd access priority"),&ioprioclass,3,ioprioTexts)); + Add(new cMenuEditBoolItem(tr("repair index, if broken"),&genindex)); Add(new cMenuEditBoolItem(tr("ignore timer margins"),&nomargins)); Add(new cMenuEditBoolItem(tr("detect overlaps"),&secondpass)); @@ -86,6 +92,7 @@ void cSetupMarkAd::Store(void) SetupStore("OSDMessage",osdmsg); SetupStore("Verbose",verbose); SetupStore("HideMainMenuEntry",hidemainmenuentry); + SetupStore("IOPrioClass",ioprioclass); setup->ProcessDuring=(bool) processduring; setup->whileRecording=(bool) whilerecording; @@ -97,4 +104,5 @@ void cSetupMarkAd::Store(void) setup->Verbose=(bool) verbose; setup->NoMargins=(bool) nomargins; setup->HideMainMenuEntry=(bool) hidemainmenuentry; + setup->IOPrioClass=ioprioclass; } diff --git a/plugin/setup.h b/plugin/setup.h index 446778f..4cd5274 100644 --- a/plugin/setup.h +++ b/plugin/setup.h @@ -12,6 +12,7 @@ struct setup { bool ProcessDuring; + int IOPrioClass; bool whileRecording; bool whileReplaying; bool OSDMessage; @@ -27,8 +28,10 @@ class cSetupMarkAd : public cMenuSetupPage { private: const char *processTexts[2]; + const char *ioprioTexts[3]; struct setup *setup; int processduring; + int ioprioclass; int whilerecording; int whilereplaying; int osdmsg; diff --git a/plugin/status.cpp b/plugin/status.cpp index 01a1dc5..9708598 100644 --- a/plugin/status.cpp +++ b/plugin/status.cpp @@ -71,16 +71,17 @@ 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 -l \"%s\" %s \"%s\"",bindir, + cString cmd = cString::sprintf("\"%s\"/markad %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->IOPrioClass+1, logodir,Direct ? "-O after" : "--online=2 before", FileName); dsyslog("markad: executing %s",*cmd); - if (SystemExec(cmd)!=-1) + if (SystemExec(cmd,true)!=-1) { usleep(200000); int pos=Add(FileName,Name); |