diff options
author | Jochen Dolze <vdr@dolze.de> | 2011-02-14 11:50:09 +0100 |
---|---|---|
committer | Jochen Dolze <vdr@dolze.de> | 2011-02-14 11:50:09 +0100 |
commit | 92599dbf7638540b9ed9ff3dbd6f2625c1c3f45f (patch) | |
tree | 851db7a7ea6c7177e6402bbfe1b8950a062b6f3b /command | |
parent | b48a0e3f7bee7f9fc4825e0bce4c06ed90d3794c (diff) | |
download | vdr-plugin-markad-92599dbf7638540b9ed9ff3dbd6f2625c1c3f45f.tar.gz vdr-plugin-markad-92599dbf7638540b9ed9ff3dbd6f2625c1c3f45f.tar.bz2 |
Improved stop detection
H262 fps detection bugfix
Diffstat (limited to 'command')
-rw-r--r-- | command/demux.cpp | 9 | ||||
-rw-r--r-- | command/markad-standalone.cpp | 53 | ||||
-rw-r--r-- | command/marks.cpp | 8 | ||||
-rw-r--r-- | command/marks.h | 2 | ||||
-rw-r--r-- | command/streaminfo.cpp | 2 | ||||
-rw-r--r-- | command/video.cpp | 10 | ||||
-rw-r--r-- | command/video.h | 5 |
7 files changed, 52 insertions, 37 deletions
diff --git a/command/demux.cpp b/command/demux.cpp index 905c3e2..9f634bd 100644 --- a/command/demux.cpp +++ b/command/demux.cpp @@ -1116,7 +1116,14 @@ void cDemux::DisableDPid() if (ts2pkt_dpid) delete ts2pkt_dpid; pes2audioes_ac3=NULL; ts2pkt_dpid=NULL; - dpid=0; + if (TS) + { + dpid=-1; + } + else + { + dpid=0; + } stream_or_pid=0; } diff --git a/command/markad-standalone.cpp b/command/markad-standalone.cpp index f0a5ff6..c48e952 100644 --- a/command/markad-standalone.cpp +++ b/command/markad-standalone.cpp @@ -192,13 +192,14 @@ void cMarkAdStandalone::CalculateCheckPositions(int startframe) iStart=-startframe; iStop=-(startframe+len_in_frames); chkSTART=-iStart+delta; - chkSTOP=-iStop+delta; + chkSTOP=-iStop+(3*delta); } void cMarkAdStandalone::CheckStop() { dsyslog("checking stop"); - clMark *end=marks.GetAround(iStop,MT_STOP,0x0F); + int delta=(chkSTOP-iStop)+macontext.Video.Info.FramesPerSecond*(MAXRANGE+60); + clMark *end=marks.GetAround(delta,iStop,MT_STOP,0x0F); if (end) { @@ -210,7 +211,7 @@ void cMarkAdStandalone::CheckStop() //fallback, shouldn't be reached MarkAdMark mark; memset(&mark,0,sizeof(mark)); - mark.Position=iStart; + mark.Position=iStop; mark.Type=MT_ASSUMEDSTOP; AddMark(&mark); marks.DelTill(iStop,false); @@ -256,26 +257,23 @@ void cMarkAdStandalone::CheckStart() macontext.Info.Channels=macontext.Audio.Info.Channels; if (macontext.Info.Channels==6) { - isyslog("DolbyDigital5.1 audio detected. logo/border detection disabled"); + isyslog("DolbyDigital5.1 audio detected. logo/border/aspect detection disabled"); bDecodeVideo=false; + macontext.Video.Options.IgnoreAspectRatio=true; + macontext.Video.Options.IgnoreLogoDetection=true; marks.Del(MT_ASPECTSTART); marks.Del(MT_ASPECTSTOP); // start mark must be around istart - begin=marks.GetAround(iStart,MT_CHANNELSTART); + begin=marks.GetAround(INT_MAX,iStart,MT_CHANNELSTART); } else { if (macontext.Info.DPid.Num) { - isyslog("broadcast with %i audio channels%s",macontext.Info.Channels, - macontext.Config->AC3Always ? - "" : ", disabling AC3 decoding"); - - if (!macontext.Config->AC3Always) - { - macontext.Info.DPid.Num=0; - demux->DisableDPid(); - } + if (macontext.Info.Channels) + isyslog("broadcast with %i audio channels, disabling AC3 decoding",macontext.Info.Channels); + macontext.Info.DPid.Num=0; + demux->DisableDPid(); } } @@ -304,14 +302,16 @@ void cMarkAdStandalone::CheckStart() (macontext.Video.Info.AspectRatio.Den==3)) { bDecodeVideo=false; + macontext.Video.Options.IgnoreLogoDetection=true; marks.Del(MT_CHANNELSTART); marks.Del(MT_CHANNELSTOP); // start mark must be around iStart - begin=marks.GetAround(iStart,MT_ASPECTSTART); + begin=marks.GetAround(macontext.Video.Info.FramesPerSecond*(MAXRANGE*4),iStart,MT_ASPECTSTART); } if (!bDecodeVideo) { + macontext.Video.Data.Valid=false; marks.Del(MT_LOGOSTART); marks.Del(MT_LOGOSTOP); marks.Del(MT_HBORDERSTART); @@ -322,7 +322,7 @@ void cMarkAdStandalone::CheckStart() if (!begin) { - begin=marks.GetAround(iStart,MT_START,0x0F); + begin=marks.GetAround(macontext.Video.Info.FramesPerSecond*(MAXRANGE*2),iStart,MT_START,0x0F); } if (begin) { @@ -349,6 +349,7 @@ void cMarkAdStandalone::AddMark(MarkAdMark *Mark) { if (!Mark) return; if (!Mark->Type) return; + if (gotendmark) return; char *comment=NULL; switch (Mark->Type) @@ -931,11 +932,6 @@ bool cMarkAdStandalone::ProcessFile(int Number) dRes=true; } } - if (macontext.Video.Info.FramesPerSecond<0) - { - macontext.Video.Info.FramesPerSecond*=-1; - isyslog("using framerate of %.f",macontext.Video.Info.FramesPerSecond); - } if ((decoder) && (bDecodeVideo)) dRes=decoder->DecodeVideo(&macontext,pkt.Data,pkt.Length); @@ -962,7 +958,7 @@ bool cMarkAdStandalone::ProcessFile(int Number) { if ((!isTS) && (!noticeVDR_AC3)) { - isyslog("found AC3%s",macontext.Config->AC3Always ? "*" : ""); + isyslog("found AC3"); noticeVDR_AC3=true; } if ((framecnt-iframe)<=3) @@ -1506,14 +1502,10 @@ bool cMarkAdStandalone::LoadInfo() // if we have DolbyDigital 2.0 disable AC3 if (strchr(descr,'2')) { - isyslog("broadcast with DolbyDigital2.0%s",macontext.Config->AC3Always ? - "" : ", disabling AC3 decoding"); + isyslog("broadcast with DolbyDigital2.0, disabling AC3 decoding"); - if (!macontext.Config->AC3Always) - { - macontext.Info.DPid.Num=0; - macontext.Info.Channels=2; - } + macontext.Info.DPid.Num=0; + macontext.Info.Channels=2; } // if we have DolbyDigital 5.1 disable video decoding if (strchr(descr,'5')) @@ -2084,7 +2076,7 @@ cMarkAdStandalone::cMarkAdStandalone(const char *Directory, const MarkAdConfig * if (macontext.Info.DPid.Num) { if (macontext.Info.DPid.Num!=-1) - dsyslog("found AC3 (0x%04x)%s",macontext.Info.DPid.Num,macontext.Config->AC3Always ? "*" : ""); + dsyslog("found AC3 (0x%04x)",macontext.Info.DPid.Num); } if (!abort) @@ -2397,7 +2389,6 @@ int main(int argc, char *argv[]) case 'a': // --ac3 - config.AC3Always=true; break; case 'b': diff --git a/command/marks.cpp b/command/marks.cpp index 8442872..8909e3c 100644 --- a/command/marks.cpp +++ b/command/marks.cpp @@ -186,14 +186,18 @@ clMark *clMarks::Get(int Position) return mark; } -clMark *clMarks::GetAround(int Position, int Type, int Mask) +clMark *clMarks::GetAround(int Frames, int Position, int Type, int Mask) { clMark *m1=GetPrev(Position,Type,Mask); clMark *m2=GetNext(Position,Type,Mask); if (!m1 && !m2) return NULL; if (!m1 && m2) return m2; - if (m1 && !m2) return m1; + if (m1 && !m2) + { + if (abs(Position-m1->position)>Frames) return NULL; + return m1; + } if (abs(m1->position-Position)>abs(m2->position-Position)) { diff --git a/command/marks.h b/command/marks.h index 8c4a890..18e6cc4 100644 --- a/command/marks.h +++ b/command/marks.h @@ -100,7 +100,7 @@ public: void Del(unsigned char Type); void Del(int Position); clMark *Get(int Position); - clMark *GetAround(int Position, int Type=0xFF, int Mask=0xFF); + clMark *GetAround(int Frames, int Position, int Type=0xFF, int Mask=0xFF); clMark *GetPrev(int Position,int Type=0xFF, int Mask=0xFF); clMark *GetNext(int Position,int Type=0xFF, int Mask=0xFF); clMark *GetFirst() diff --git a/command/streaminfo.cpp b/command/streaminfo.cpp index 602916e..874ba8f 100644 --- a/command/streaminfo.cpp +++ b/command/streaminfo.cpp @@ -603,7 +603,7 @@ unsigned BitRateExtL: { if (fps!=maContext->Video.Info.FramesPerSecond) { - maContext->Video.Info.FramesPerSecond=-fps; + maContext->Video.Info.FramesPerSecond=fps; } } } diff --git a/command/video.cpp b/command/video.cpp index 7d09dd2..d0de34a 100644 --- a/command/video.cpp +++ b/command/video.cpp @@ -406,7 +406,11 @@ int cMarkAdLogo::Detect(int framenumber, int *logoframenumber) int cMarkAdLogo::Process(int FrameNumber, int *LogoFrameNumber) { if (!macontext) return LOGO_ERROR; - if (!macontext->Video.Data.Valid) return LOGO_ERROR; + if (!macontext->Video.Data.Valid) + { + area.status=LOGO_UNINITIALIZED; + return LOGO_ERROR; + } if (!macontext->Video.Info.Width) return LOGO_ERROR; if (!macontext->Video.Info.Height) return LOGO_ERROR; if (!macontext->Config->logoDirectory[0]) return LOGO_ERROR; @@ -862,6 +866,10 @@ MarkAdMarks *cMarkAdVideo::Process(int FrameNumber, int FrameNumberNext) } } } + else + { + logo->SetStatusUninitialized(); + } int hborderframenumber; int hret=hborder->Process(FrameNumber,&hborderframenumber); diff --git a/command/video.h b/command/video.h index 9606f8b..f4abbec 100644 --- a/command/video.h +++ b/command/video.h @@ -136,6 +136,11 @@ public: if (area.status==LOGO_VISIBLE) area.status=LOGO_INVISIBLE; } + void SetStatusUninitialized() + { + if (area.status!=LOGO_UNINITIALIZED) + area.status=LOGO_UNINITIALIZED; + } void Clear(); }; |