Robert Tsai mythtv at tsaiberspace.net
Sun May 21 16:29:24 UTC 2006

I've implemented a new commercial flagger with a framework that should
make it easier to do the planned multi-threading improvements, as well
as to add more analysis algorithms with less boilerplate work
unrelated to actual video analysis. The flagger itself is a new type
returned by CommDetectorFactory::makeCommDetector, so it is safely
well outside of the current ClassicCommDetector code.

(This is independent and separable from Lucas' ClassicCommDetector

I have a new logo-detector working, but I don't think I've got
integration with the database completely correct. I know the detection
itself is working based on my debugging output. However, the database
integration is not quite correct (the "marks" QMap that is supposed to
be returned by getCommercialBreakList). The symptoms are:

	- In "Edit Recordings", the little hash marks are not
	  correctly aligned with the "red" bars denoting commercial
	  breaks. The red bars are correct; the hash marks are not

	- When playing back a recording that has been subjected to my
	  new commercial flagger, commercials are forcibly skipped
	  over (despite the Auto-Skip being set to "off" or "notify").
	  Even if I attempt to rewind, the player simply skips over
	  the marked breaks.

	  This means that if the flagger is wrong, I can't rewind to
	  see what I missed, nor can I rewind if I actually want to
	  watch some movie trailer advertisement or something.

What I've done is to simply set marks[frameno] = MARK_COMM_START where
breaks begin, and set marks[frameno] = MARK_COMM_END where the content
starts up again.

Some direct questions:

	- Which frame should be marked as MARK_COMM_END? The last
	  frame of the commercial break, or the first frame of the
	  content? If the latter, that means it is technically
	  impossible to represent a single-frame commercial-break; is
	  that intended? (I acknowledge that a single-frame break is
	  more likely a falsely-indicated break, so that this scenario
	  is not real-worldly expected to ever happen.)

	- What am I doing wrong? :)

My code snippet reads ("isContent" is a routine that simply returns
whether the flagger believes a given frame is content or commercial;
"pass1" can be considered here to simply be an opaque blob of data):

    /* Create break list. */

    bool prevContent, thisContent;

    if (!(prevContent = isContent(pass1, 0)))
        marks[0] = MARK_COMM_START;
    for (long long frameno = 1; frameno < nframes; frameno++)
        if ((thisContent = isContent(pass1, frameno)) != prevContent)
            marks[frameno] = thisContent ? MARK_COMM_END : MARK_COMM_START;
            prevContent = thisContent;
    if (!prevContent)
        marks[nframes] = MARK_COMM_END;

I will be digging through ProgramInfo::SetMarkupMap to see exactly
what is going on, but I'm hoping to get a higher-level idea of what is
going on.


More information about the mythtv-dev mailing list