[mythtv] PATCH: Commercial detection/skip using blank frames

Isaac Richards ijr at po.cwru.edu
Fri Feb 21 22:34:55 EST 2003

On Friday 21 February 2003 09:23 pm, Chris Pinkham wrote:
> > On Friday 21 February 2003 10:55 am, Chris Pinkham wrote:
> > > Attached is a much better implemention of the commercial skipping patch
> > > I uploaded earlier this week.  I've been using this for a couple
> > > nights.
> >
> > I've just committed this -- I did fix the segfault that was occurring on
> > exiting playback, though.  I also disabled the automatic commercial skip
> > by
> >
> > Let me know if you agree/disagree with any of my changes.
> I haven't had a chance to recompile and test it (wife's watching TV), but
> I notice that you got rid of the GetFrameRetainWPos function.  The
> function would decode a frame without incrementing wpos to the next
> position.  Then you could use vbuffer[wpos] to refernce that frame.
> Now it looks like it's just calling GetFrame(1,true); which looks like it
> still increments wpos inside GetFrame.  So when GetFrameVariance(wpos)
> is called, it's not really looking at the frame just read in, it's looking
> at the frame which is next in the buffer (wpos points to the next available
> write position right?)  So it's not checking for a blank frame where it
> thinks it is since it's looking in the wrong place in the buffer.
> I might be looking at this wrong, but wanted to speak up sooner rather
> than later since it's in CVS already.

> What was causing the segfault.  I thought it was related to my hack to
> get XJ.cpp working without XV.  Was the fix adding the "unsafe" option 
> to GetFrame?

Ah, true, it should be using the previous value of wpos, before the call to 
GetFrame().  Just fixed it in CVS.  And yeah, the GetFrameRetainWPos was 
causing the segfault -- for mp4 encodes, you were essentially telling 
libavcodec to reuse the same buffer it had just used, and that was causing 
the segfault when it came time for libavcodec to clean up after itself.  The 
video you were getting was probably fairly garbled =)

> Other than that it looks good to me (course I haven't had a chance to
> retest it yet though).  :)  So you tested the 'Z' manual mode?  Was it
> working OK?

Yeah, seemed to work ok.  It got confused by an all-white section of an ad, 
that I saw, and several times it stopped on the 'later tonight' previews for 
other shows before the actual show came back on, but other than that, seems 
pretty good.


More information about the mythtv-dev mailing list