Hmm.. I frames are 0 here won't buf_size be zero? Seem bad to crash xbmc in that case.