Factorize get_duration() out of 4 places of the avi demuxer.