diff options
Diffstat (limited to 'command')
-rw-r--r-- | command/markad-standalone.cpp | 87 | ||||
-rw-r--r-- | command/markad-standalone.h | 2 | ||||
-rw-r--r-- | command/marks.cpp | 4 | ||||
-rw-r--r-- | command/marks.h | 2 | ||||
-rw-r--r-- | command/video.cpp | 3 |
5 files changed, 57 insertions, 41 deletions
diff --git a/command/markad-standalone.cpp b/command/markad-standalone.cpp index 4129f63..ec2f4a0 100644 --- a/command/markad-standalone.cpp +++ b/command/markad-standalone.cpp @@ -360,7 +360,7 @@ void cMarkAdStandalone::CheckStartStop(int frame, bool checkend) } } -void cMarkAdStandalone::CheckLogoMarks() +void cMarkAdStandalone::CheckLogoMarks(clMark *last) { clMark *mark=marks.GetFirst(); while (mark) @@ -382,6 +382,7 @@ void cMarkAdStandalone::CheckLogoMarks() } } mark=mark->Next(); + if ((last) && (mark==last)) return; } } @@ -607,7 +608,8 @@ void cMarkAdStandalone::AddMark(MarkAdMark *Mark) if ((Mark->Position-prev->position)<MARKDIFF) { if (Mark->Comment) isyslog("%s",Mark->Comment); - isyslog("aspectratio change in short distance, deleting this mark (%i)",Mark->Position); + isyslog("aspectratio change in short distance, deleting this mark (%i)", + Mark->Position); return; } } @@ -618,7 +620,8 @@ void cMarkAdStandalone::AddMark(MarkAdMark *Mark) if ((Mark->Position-prev->position)<MARKDIFF) { if (Mark->Comment) isyslog("%s",Mark->Comment); - isyslog("audiochannel change in short distance, deleting this mark (%i)",Mark->Position); + isyslog("audiochannel change in short distance, deleting this mark (%i)", + Mark->Position); return; } } @@ -627,8 +630,8 @@ void cMarkAdStandalone::AddMark(MarkAdMark *Mark) if (macontext.Info.Length>0) { - if (((Mark->Type & 0xF0)==MT_BORDERCHANGE) && (Mark->Position>chkLEFT) && - (!macontext.Video.Options.IgnoreLogoDetection)) + if ((marks.Count(MT_BORDERCHANGE,0xF0)>=3) && (Mark->Position>chkLEFT) && + (Mark->Position<chkRIGHT) && (!macontext.Video.Options.IgnoreLogoDetection)) { if (Mark->Comment) { @@ -641,47 +644,62 @@ void cMarkAdStandalone::AddMark(MarkAdMark *Mark) marks.Del((uchar) MT_LOGOSTOP); } - if (((Mark->Type==MT_CHANNELSTART) || (Mark->Type==MT_ASPECTSTART)) && - (Mark->Position>chkLEFT) && (Mark->Position<chkRIGHT) && (bDecodeVideo)) + bool deleteLogoBorder=false; + if ((marks.Count(MT_CHANNELCHANGE,0xF0)>=3) && (Mark->Position>chkLEFT) && + (Mark->Position<chkRIGHT) && (!macontext.Video.Options.IgnoreLogoDetection)) { - if (Mark->Comment) + if (!loggedAlready) { - isyslog("%s",Mark->Comment); - loggedAlready=true; + if (Mark->Comment) + { + isyslog("%s",Mark->Comment); + loggedAlready=true; + } } - - if ((Mark->Type & 0xF0)==MT_CHANNELCHANGE) + isyslog("audio channel changes detected. logo/border detection disabled"); + if (macontext.Info.VPid.Type==MARKAD_PIDTYPE_VIDEO_H262) { - isyslog("audio channel changes detected. logo/border detection disabled"); - if (macontext.Info.VPid.Type==MARKAD_PIDTYPE_VIDEO_H262) + if (!macontext.Info.AspectRatio.Num) { - if (!macontext.Info.AspectRatio.Num) - { - isyslog("assuming broadcast aspectratio is 16:9"); - macontext.Info.AspectRatio.Num=16; - macontext.Info.AspectRatio.Den=9; - macontext.Video.Options.IgnoreAspectRatio=true; - } + isyslog("assuming broadcast aspectratio is 16:9"); + macontext.Info.AspectRatio.Num=16; + macontext.Info.AspectRatio.Den=9; + macontext.Video.Options.IgnoreAspectRatio=true; } - macontext.Audio.Info.DolbyDigital51=true; - setAudio51=true; - setAudio20=false; - reprocess=true; } - else - { - isyslog("aspectratio changes detected. logo/border detection disabled"); + macontext.Audio.Info.DolbyDigital51=true; + setAudio51=true; + setAudio20=false; + reprocess=true; + deleteLogoBorder=true; + } - if ((!macontext.Info.AspectRatio.Num) && ((Mark->Type & 0xF0)==MT_ASPECTCHANGE)) + if ((marks.Count(MT_ASPECTCHANGE,0xF0)>=3) && (Mark->Position>chkLEFT) && + (Mark->Position<chkRIGHT) && (!macontext.Video.Options.IgnoreLogoDetection)) + { + if (!loggedAlready) + { + if (Mark->Comment) { - isyslog("assuming broadcast aspectratio is 4:3"); - macontext.Info.AspectRatio.Num=4; - macontext.Info.AspectRatio.Den=3; - reprocess=true; - setVideo43=true; + isyslog("%s",Mark->Comment); + loggedAlready=true; } } + isyslog("aspectratio changes detected. logo/border detection disabled"); + if ((!macontext.Info.AspectRatio.Num) && ((Mark->Type & 0xF0)==MT_ASPECTCHANGE)) + { + isyslog("assuming broadcast aspectratio is 4:3"); + macontext.Info.AspectRatio.Num=4; + macontext.Info.AspectRatio.Den=3; + reprocess=true; + setVideo43=true; + } + deleteLogoBorder=true; + } + + if (deleteLogoBorder) + { bDecodeVideo=false; macontext.Video.Data.Valid=false; marks.Del((uchar) MT_LOGOSTART); @@ -691,6 +709,7 @@ void cMarkAdStandalone::AddMark(MarkAdMark *Mark) } } if (Mark->Position>chkLEFT) CheckFirstMark(); + if (marksAligned) CheckLogoMarks(marks.GetLast()); if ((Mark->Comment) && (!loggedAlready)) isyslog("%s",Mark->Comment); marks.Add(Mark->Type,Mark->Position,Mark->Comment); diff --git a/command/markad-standalone.h b/command/markad-standalone.h index 7ffc391..87c86ca 100644 --- a/command/markad-standalone.h +++ b/command/markad-standalone.h @@ -242,7 +242,7 @@ unsigned Descriptor_Length: bool CheckDolbyDigital51(); void CheckStartStop(int frame, bool checkend=false); void CheckInfoAspectRatio(); - void CheckLogoMarks(); + void CheckLogoMarks(clMark *last=NULL); void AddStartMark(); void AddMark(MarkAdMark *Mark); bool Reset(bool FirstPass=true); diff --git a/command/marks.cpp b/command/marks.cpp index 8d433c4..a59840b 100644 --- a/command/marks.cpp +++ b/command/marks.cpp @@ -47,7 +47,7 @@ clMarks::~clMarks() if (indexfd!=-1) close(indexfd); } -int clMarks::Count(int Type) +int clMarks::Count(int Type, int Mask) { if (Type==0xFF) return count; @@ -57,7 +57,7 @@ int clMarks::Count(int Type) clMark *mark=first; while (mark) { - if (mark->type==Type) ret++; + if ((mark->type & Mask)==Type) ret++; mark=mark->Next(); } return ret; diff --git a/command/marks.h b/command/marks.h index 3d9f4e3..6a488f7 100644 --- a/command/marks.h +++ b/command/marks.h @@ -83,7 +83,7 @@ public: indexfd=-1; } ~clMarks(); - int Count(int Type=0xFF); + int Count(int Type=0xFF, int Mask=0xFF); void SetFileName(const char *FileName) { if (FileName) diff --git a/command/video.cpp b/command/video.cpp index 70fd808..525033e 100644 --- a/command/video.cpp +++ b/command/video.cpp @@ -455,9 +455,6 @@ int cMarkAdLogo::Process(int FrameNumber, int *LogoFrameNumber) LOGOHEIGHT=macontext->Config->logoHeight; } } - - //if (!area.valid) return ERROR; - return Detect(FrameNumber,LogoFrameNumber); } |