Add a generic write function to av_fifo.