Skip to content

Commit

Permalink
Implement CommDetectMinCommBreakLength with Logo detection method
Browse files Browse the repository at this point in the history
Ignore commercial breaks if their duration are less than
CommDetectMinCommBreakLength. It fixes false positive, when the logo
temporary changes to annonce something. Seen on TF1 channel.
  • Loading branch information
hamelg committed Feb 28, 2021
1 parent 8aeace6 commit 6d1955c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
23 changes: 23 additions & 0 deletions mythtv/programs/mythcommflag/ClassicCommDetector.cpp
Expand Up @@ -2379,12 +2379,35 @@ void ClassicCommDetector::ConvertShowMapToCommMap(
return;

show_map_t::const_iterator sit;
uint64_t comm_start = 0;
uint64_t comm_end = 0;

for (sit = in.begin(); sit != in.end(); ++sit)
{
if (*sit == MARK_START)
{
out[sit.key()] = MARK_COMM_END;
comm_end = sit.key();
}
else
{
out[sit.key()] = MARK_COMM_START;
comm_start = sit.key();
}

// Remove COMM break if duration is less than CommDetectMinCommBreakLength
if (comm_start && comm_end)
{
if (comm_start > comm_end)
continue;

if ((comm_end - comm_start) < (m_commDetectMinCommBreakLength * m_fps) )
{
out.remove(comm_start);
out.remove(comm_end);
}
comm_start = comm_end = 0;
}
}

frm_dir_map_t::iterator it = out.begin();
Expand Down
2 changes: 1 addition & 1 deletion mythtv/programs/mythcommflag/ClassicCommDetector.h
Expand Up @@ -106,7 +106,7 @@ class ClassicCommDetector : public CommDetectorBase
bool FrameIsInBreakMap(uint64_t f, const frm_dir_map_t &breakMap) const;
void DumpMap(frm_dir_map_t &map);
static void CondenseMarkMap(show_map_t &map, int spacing, int length);
static void ConvertShowMapToCommMap(
void ConvertShowMapToCommMap(
frm_dir_map_t &out, const show_map_t &in);
void CleanupFrameInfo(void);
void GetLogoCommBreakMap(show_map_t &map);
Expand Down

0 comments on commit 6d1955c

Please sign in to comment.